vskill 0.5.100 → 0.5.101
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.
- package/agents.json +1 -1
- package/dist/eval-server/api-routes.d.ts +7 -0
- package/dist/eval-server/api-routes.js +29 -5
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-ui/assets/{CommandPalette-FSV5s4ZA.js → CommandPalette-BsIqE6hu.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-B-bI251D.js → UpdateDropdown-Cx3XWMAn.js} +1 -1
- package/dist/eval-ui/assets/{index-CwunQ8pZ.js → index-BOb5IGB8.js} +23 -23
- package/dist/eval-ui/assets/{index-BjFfyEIP.css → index-D5FxVeoM.css} +1 -1
- package/dist/eval-ui/index.html +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-Cx3XWMAn.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BsIqE6hu.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
/* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const p of d)if(p.type==="childList")for(const f of p.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function i(d){const p={};return d.integrity&&(p.integrity=d.integrity),d.referrerPolicy&&(p.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?p.credentials="include":d.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function o(d){if(d.ep)return;d.ep=!0;const p=i(d);fetch(d.href,p)}})();function ug(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var _d={exports:{}},fs={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.js
|
|
@@ -7,7 +7,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Gh;function V1(){if(Gh)return fs;Gh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,d,p){var f=null;if(p!==void 0&&(f=""+p),d.key!==void 0&&(f=""+d.key),"key"in d){p={};for(var h in d)h!=="key"&&(p[h]=d[h])}else p=d;return d=p.ref,{$$typeof:a,type:o,key:f,ref:d!==void 0?d:null,props:p}}return fs.Fragment=r,fs.jsx=i,fs.jsxs=i,fs}var
|
|
10
|
+
*/var Gh;function V1(){if(Gh)return fs;Gh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,d,p){var f=null;if(p!==void 0&&(f=""+p),d.key!==void 0&&(f=""+d.key),"key"in d){p={};for(var h in d)h!=="key"&&(p[h]=d[h])}else p=d;return d=p.ref,{$$typeof:a,type:o,key:f,ref:d!==void 0?d:null,props:p}}return fs.Fragment=r,fs.jsx=i,fs.jsxs=i,fs}var Fh;function $1(){return Fh||(Fh=1,_d.exports=V1()),_d.exports}var n=$1(),Od={exports:{}},Oe={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* react.production.js
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var qh;function P1(){if(qh)return Oe;qh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),p=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),j=Symbol.iterator;function S(_){return _===null||typeof _!="object"?null:(_=j&&_[j]||_["@@iterator"],typeof _=="function"?_:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,T={};function C(_,W,ie){this.props=_,this.context=W,this.refs=T,this.updater=ie||k}C.prototype.isReactComponent={},C.prototype.setState=function(_,W){if(typeof _!="object"&&typeof _!="function"&&_!=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,_,W,"setState")},C.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function M(){}M.prototype=C.prototype;function O(_,W,ie){this.props=_,this.context=W,this.refs=T,this.updater=ie||k}var U=O.prototype=new M;U.constructor=O,A(U,C.prototype),U.isPureReactComponent=!0;var L=Array.isArray;function V(){}var w={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function E(_,W,ie){var ue=ie.ref;return{$$typeof:a,type:_,key:W,ref:ue!==void 0?ue:null,props:ie}}function B(_,W){return E(_.type,W,_.props)}function P(_){return typeof _=="object"&&_!==null&&_.$$typeof===a}function F(_){var W={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(ie){return W[ie]})}var te=/\/+/g;function Q(_,W){return typeof _=="object"&&_!==null&&_.key!=null?F(""+_.key):W.toString(36)}function z(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(V,V):(_.status="pending",_.then(function(W){_.status==="pending"&&(_.status="fulfilled",_.value=W)},function(W){_.status==="pending"&&(_.status="rejected",_.reason=W)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function R(_,W,ie,ue,ge){var xe=typeof _;(xe==="undefined"||xe==="boolean")&&(_=null);var we=!1;if(_===null)we=!0;else switch(xe){case"bigint":case"string":case"number":we=!0;break;case"object":switch(_.$$typeof){case a:case r:we=!0;break;case y:return we=_._init,R(we(_._payload),W,ie,ue,ge)}}if(we)return ge=ge(_),we=ue===""?"."+Q(_,0):ue,L(ge)?(ie="",we!=null&&(ie=we.replace(te,"$&/")+"/"),R(ge,W,ie,"",function(De){return De})):ge!=null&&(P(ge)&&(ge=B(ge,ie+(ge.key==null||_&&_.key===ge.key?"":(""+ge.key).replace(te,"$&/")+"/")+we)),W.push(ge)),1;we=0;var oe=ue===""?".":ue+":";if(L(_))for(var Se=0;Se<_.length;Se++)ue=_[Se],xe=oe+Q(ue,Se),we+=R(ue,W,ie,xe,ge);else if(Se=S(_),typeof Se=="function")for(_=Se.call(_),Se=0;!(ue=_.next()).done;)ue=ue.value,xe=oe+Q(ue,Se++),we+=R(ue,W,ie,xe,ge);else if(xe==="object"){if(typeof _.then=="function")return R(z(_),W,ie,ue,ge);throw W=String(_),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return we}function I(_,W,ie){if(_==null)return _;var ue=[],ge=0;return R(_,ue,"","",function(xe){return W.call(ie,xe,ge++)}),ue}function Z(_){if(_._status===-1){var W=_._result;W=W(),W.then(function(ie){(_._status===0||_._status===-1)&&(_._status=1,_._result=ie)},function(ie){(_._status===0||_._status===-1)&&(_._status=2,_._result=ie)}),_._status===-1&&(_._status=0,_._result=W)}if(_._status===1)return _._result.default;throw _._result}var q=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},de={map:I,forEach:function(_,W,ie){I(_,function(){W.apply(this,arguments)},ie)},count:function(_){var W=0;return I(_,function(){W++}),W},toArray:function(_){return I(_,function(W){return W})||[]},only:function(_){if(!P(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return Oe.Activity=v,Oe.Children=de,Oe.Component=C,Oe.Fragment=i,Oe.Profiler=d,Oe.PureComponent=O,Oe.StrictMode=o,Oe.Suspense=x,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(_){return w.H.useMemoCache(_)}},Oe.cache=function(_){return function(){return _.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(_,W,ie){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var ue=A({},_.props),ge=_.key;if(W!=null)for(xe in W.key!==void 0&&(ge=""+W.key),W)!D.call(W,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&W.ref===void 0||(ue[xe]=W[xe]);var xe=arguments.length-2;if(xe===1)ue.children=ie;else if(1<xe){for(var we=Array(xe),oe=0;oe<xe;oe++)we[oe]=arguments[oe+2];ue.children=we}return E(_.type,ge,ue)},Oe.createContext=function(_){return _={$$typeof:f,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:p,_context:_},_},Oe.createElement=function(_,W,ie){var ue,ge={},xe=null;if(W!=null)for(ue in W.key!==void 0&&(xe=""+W.key),W)D.call(W,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(ge[ue]=W[ue]);var we=arguments.length-2;if(we===1)ge.children=ie;else if(1<we){for(var oe=Array(we),Se=0;Se<we;Se++)oe[Se]=arguments[Se+2];ge.children=oe}if(_&&_.defaultProps)for(ue in we=_.defaultProps,we)ge[ue]===void 0&&(ge[ue]=we[ue]);return E(_,xe,ge)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(_){return{$$typeof:h,render:_}},Oe.isValidElement=P,Oe.lazy=function(_){return{$$typeof:y,_payload:{_status:-1,_result:_},_init:Z}},Oe.memo=function(_,W){return{$$typeof:m,type:_,compare:W===void 0?null:W}},Oe.startTransition=function(_){var W=w.T,ie={};w.T=ie;try{var ue=_(),ge=w.S;ge!==null&&ge(ie,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(V,q)}catch(xe){q(xe)}finally{W!==null&&ie.types!==null&&(W.types=ie.types),w.T=W}},Oe.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},Oe.use=function(_){return w.H.use(_)},Oe.useActionState=function(_,W,ie){return w.H.useActionState(_,W,ie)},Oe.useCallback=function(_,W){return w.H.useCallback(_,W)},Oe.useContext=function(_){return w.H.useContext(_)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(_,W){return w.H.useDeferredValue(_,W)},Oe.useEffect=function(_,W){return w.H.useEffect(_,W)},Oe.useEffectEvent=function(_){return w.H.useEffectEvent(_)},Oe.useId=function(){return w.H.useId()},Oe.useImperativeHandle=function(_,W,ie){return w.H.useImperativeHandle(_,W,ie)},Oe.useInsertionEffect=function(_,W){return w.H.useInsertionEffect(_,W)},Oe.useLayoutEffect=function(_,W){return w.H.useLayoutEffect(_,W)},Oe.useMemo=function(_,W){return w.H.useMemo(_,W)},Oe.useOptimistic=function(_,W){return w.H.useOptimistic(_,W)},Oe.useReducer=function(_,W,ie){return w.H.useReducer(_,W,ie)},Oe.useRef=function(_){return w.H.useRef(_)},Oe.useState=function(_){return w.H.useState(_)},Oe.useSyncExternalStore=function(_,W,ie){return w.H.useSyncExternalStore(_,W,ie)},Oe.useTransition=function(){return w.H.useTransition()},Oe.version="19.2.4",Oe}var Yh;function Eu(){return Yh||(Yh=1,Od.exports=P1()),Od.exports}var g=Eu();const Ce=ug(g);var Bd={exports:{}},ps={},Id={exports:{}},Hd={};/**
|
|
19
19
|
* @license React
|
|
20
20
|
* scheduler.production.js
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the MIT license found in the
|
|
25
25
|
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var Wh;function G1(){return Wh||(Wh=1,(function(a){function r(R,I){var Z=R.length;R.push(I);e:for(;0<Z;){var
|
|
26
|
+
*/var Wh;function G1(){return Wh||(Wh=1,(function(a){function r(R,I){var Z=R.length;R.push(I);e:for(;0<Z;){var q=Z-1>>>1,de=R[q];if(0<d(de,I))R[q]=I,R[Z]=de,Z=q;else break e}}function i(R){return R.length===0?null:R[0]}function o(R){if(R.length===0)return null;var I=R[0],Z=R.pop();if(Z!==I){R[0]=Z;e:for(var q=0,de=R.length,_=de>>>1;q<_;){var W=2*(q+1)-1,ie=R[W],ue=W+1,ge=R[ue];if(0>d(ie,Z))ue<de&&0>d(ge,ie)?(R[q]=ge,R[ue]=Z,q=ue):(R[q]=ie,R[W]=Z,q=W);else if(ue<de&&0>d(ge,Z))R[q]=ge,R[ue]=Z,q=ue;else break e}}return I}function d(R,I){var Z=R.sortIndex-I.sortIndex;return Z!==0?Z:R.id-I.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var p=performance;a.unstable_now=function(){return p.now()}}else{var f=Date,h=f.now();a.unstable_now=function(){return f.now()-h}}var x=[],m=[],y=1,v=null,j=3,S=!1,k=!1,A=!1,T=!1,C=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function U(R){for(var I=i(m);I!==null;){if(I.callback===null)o(m);else if(I.startTime<=R)o(m),I.sortIndex=I.expirationTime,r(x,I);else break;I=i(m)}}function L(R){if(A=!1,U(R),!k)if(i(x)!==null)k=!0,V||(V=!0,F());else{var I=i(m);I!==null&&z(L,I.startTime-R)}}var V=!1,w=-1,D=5,E=-1;function B(){return T?!0:!(a.unstable_now()-E<D)}function P(){if(T=!1,V){var R=a.unstable_now();E=R;var I=!0;try{e:{k=!1,A&&(A=!1,M(w),w=-1),S=!0;var Z=j;try{t:{for(U(R),v=i(x);v!==null&&!(v.expirationTime>R&&B());){var q=v.callback;if(typeof q=="function"){v.callback=null,j=v.priorityLevel;var de=q(v.expirationTime<=R);if(R=a.unstable_now(),typeof de=="function"){v.callback=de,U(R),I=!0;break t}v===i(x)&&o(x),U(R)}else o(x);v=i(x)}if(v!==null)I=!0;else{var _=i(m);_!==null&&z(L,_.startTime-R),I=!1}}break e}finally{v=null,j=Z,S=!1}I=void 0}}finally{I?F():V=!1}}}var F;if(typeof O=="function")F=function(){O(P)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,Q=te.port2;te.port1.onmessage=P,F=function(){Q.postMessage(null)}}else F=function(){C(P,0)};function z(R,I){w=C(function(){R(a.unstable_now())},I)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(R){R.callback=null},a.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(R){switch(j){case 1:case 2:case 3:var I=3;break;default:I=j}var Z=j;j=I;try{return R()}finally{j=Z}},a.unstable_requestPaint=function(){T=!0},a.unstable_runWithPriority=function(R,I){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var Z=j;j=R;try{return I()}finally{j=Z}},a.unstable_scheduleCallback=function(R,I,Z){var q=a.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?q+Z:q):Z=q,R){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=Z+de,R={id:y++,callback:I,priorityLevel:R,startTime:Z,expirationTime:de,sortIndex:-1},Z>q?(R.sortIndex=Z,r(m,R),i(x)===null&&R===i(m)&&(A?(M(w),w=-1):A=!0,z(L,Z-q))):(R.sortIndex=de,r(x,R),k||S||(k=!0,V||(V=!0,F()))),R},a.unstable_shouldYield=B,a.unstable_wrapCallback=function(R){var I=j;return function(){var Z=j;j=I;try{return R.apply(this,arguments)}finally{j=Z}}}})(Hd)),Hd}var Kh;function F1(){return Kh||(Kh=1,Id.exports=G1()),Id.exports}var Ud={exports:{}},Xt={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* react-dom.production.js
|
|
29
29
|
*
|
|
@@ -31,7 +31,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var Xh;function
|
|
34
|
+
*/var Xh;function q1(){if(Xh)return Xt;Xh=1;var a=Eu();function r(x){var m="https://react.dev/errors/"+x;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},d=Symbol.for("react.portal");function p(x,m,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:v==null?null:""+v,children:x,containerInfo:m,implementation:y}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,m){if(x==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Xt.createPortal=function(x,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(r(299));return p(x,m,null,y)},Xt.flushSync=function(x){var m=f.T,y=o.p;try{if(f.T=null,o.p=2,x)return x()}finally{f.T=m,o.p=y,o.d.f()}},Xt.preconnect=function(x,m){typeof x=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(x,m))},Xt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Xt.preinit=function(x,m){if(typeof x=="string"&&m&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin),j=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?o.d.S(x,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:v,integrity:j,fetchPriority:S}):y==="script"&&o.d.X(x,{crossOrigin:v,integrity:j,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Xt.preinitModule=function(x,m){if(typeof x=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=h(m.as,m.crossOrigin);o.d.M(x,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(x)},Xt.preload=function(x,m){if(typeof x=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,v=h(y,m.crossOrigin);o.d.L(x,y,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Xt.preloadModule=function(x,m){if(typeof x=="string")if(m){var y=h(m.as,m.crossOrigin);o.d.m(x,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(x)},Xt.requestFormReset=function(x){o.d.r(x)},Xt.unstable_batchedUpdates=function(x,m){return x(m)},Xt.useFormState=function(x,m,y){return f.H.useFormState(x,m,y)},Xt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Xt.version="19.2.4",Xt}var Qh;function fg(){if(Qh)return Ud.exports;Qh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Ud.exports=q1(),Ud.exports}/**
|
|
35
35
|
* @license React
|
|
36
36
|
* react-dom-client.production.js
|
|
37
37
|
*
|
|
@@ -39,45 +39,45 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-
|
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the MIT license found in the
|
|
41
41
|
* LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/var Zh;function
|
|
42
|
+
*/var Zh;function Y1(){if(Zh)return ps;Zh=1;var a=F1(),r=Eu(),i=fg();function o(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 d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function p(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 f(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 h(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 x(e){if(p(e)!==e)throw Error(o(188))}function m(e){var t=e.alternate;if(!t){if(t=p(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,s=t;;){var c=l.return;if(c===null)break;var u=c.alternate;if(u===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===l)return x(c),e;if(u===s)return x(c),t;u=u.sibling}throw Error(o(188))}if(l.return!==s.return)l=c,s=u;else{for(var b=!1,N=c.child;N;){if(N===l){b=!0,l=c,s=u;break}if(N===s){b=!0,s=c,l=u;break}N=N.sibling}if(!b){for(N=u.child;N;){if(N===l){b=!0,l=u,s=c;break}if(N===s){b=!0,s=u,l=c;break}N=N.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==s)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,j=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),O=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function F(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function Q(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case C:return"Profiler";case T:return"StrictMode";case L:return"Suspense";case V:return"SuspenseList";case E:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case O:return e.displayName||"Context";case M:return(e._context.displayName||"Context")+".Consumer";case U:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case w:return t=e.displayName||null,t!==null?t:Q(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return Q(e(t))}catch{}}return null}var z=Array.isArray,R=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},q=[],de=-1;function _(e){return{current:e}}function W(e){0>de||(e.current=q[de],q[de]=null,de--)}function ie(e,t){de++,q[de]=e.current,e.current=t}var ue=_(null),ge=_(null),xe=_(null),we=_(null);function oe(e,t){switch(ie(xe,t),ie(ge,e),ie(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ph(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ph(t),e=mh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(ue),ie(ue,e)}function Se(){W(ue),W(ge),W(xe)}function De(e){e.memoizedState!==null&&ie(we,e);var t=ue.current,l=mh(t,e.type);t!==l&&(ie(ge,e),ie(ue,l))}function Ie(e){ge.current===e&&(W(ue),W(ge)),we.current===e&&(W(we),os._currentValue=Z)}var ae,pe;function fe(e){if(ae===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||"",pe=-1<l.stack.indexOf(`
|
|
43
43
|
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
44
|
`+ae+e+pe}var he=!1;function ve(e,t){if(!e||he)return"";he=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var se=function(){throw Error()};if(Object.defineProperty(se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(se,[])}catch(ee){var X=ee}Reflect.construct(e,[],se)}else{try{se.call()}catch(ee){X=ee}e.call(se.prototype)}}else{try{throw Error()}catch(ee){X=ee}(se=e())&&typeof se.catch=="function"&&se.catch(function(){})}}catch(ee){if(ee&&X&&typeof ee.stack=="string")return[ee.stack,X.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),b=u[0],N=u[1];if(b&&N){var H=b.split(`
|
|
45
45
|
`),K=N.split(`
|
|
46
46
|
`);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<K.length&&!K[c].includes("DetermineComponentFrameRoot");)c++;if(s===H.length||c===K.length)for(s=H.length-1,c=K.length-1;1<=s&&0<=c&&H[s]!==K[c];)c--;for(;1<=s&&0<=c;s--,c--)if(H[s]!==K[c]){if(s!==1||c!==1)do if(s--,c--,0>c||H[s]!==K[c]){var ne=`
|
|
47
47
|
`+H[s].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=s&&0<=c);break}}}finally{he=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?fe(l):""}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe("Lazy");case 13:return e.child!==t&&t!==null?fe("Suspense Fallback"):fe("Suspense");case 19:return fe("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return fe("Activity");default:return""}}function re(e){try{var t="",l=null;do t+=_e(e,l),l=e,e=e.return;while(e);return t}catch(s){return`
|
|
48
48
|
Error generating stack: `+s.message+`
|
|
49
|
-
`+s.stack}}var Te=Object.prototype.hasOwnProperty,Qe=a.unstable_scheduleCallback,at=a.unstable_cancelCallback,$t=a.unstable_shouldYield,Pt=a.unstable_requestPaint,lt=a.unstable_now,St=a.unstable_getCurrentPriorityLevel,ye=a.unstable_ImmediatePriority,At=a.unstable_UserBlockingPriority,Le=a.unstable_NormalPriority,gt=a.unstable_LowPriority,Kt=a.unstable_IdlePriority,rt=a.log,Qa=a.unstable_setDisableYieldValue,Zn=null,Nt=null;function kt(e){if(typeof rt=="function"&&Qa(e),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Zn,e)}catch{}}var jt=Math.clz32?Math.clz32:Hn,In=Math.log,Za=Math.LN2;function Hn(e){return e>>>=0,e===0?32:31-(In(e)/Za|0)|0}var $e=256,Ht=262144,Jn=4194304;function Et(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 jr(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~u,s!==0?c=Et(s):(b&=N,b!==0?c=Et(b):l||(l=N&~e,l!==0&&(c=Et(l))))):(N=s&~u,N!==0?c=Et(N):b!==0?c=Et(b):l||(l=s&~e,l!==0&&(c=Et(l)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:c}function Cn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function So(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 Fu(){var e=Jn;return Jn<<=1,(Jn&62914560)===0&&(Jn=4194304),e}function ko(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Sr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Rv(e,t,l,s,c,u){var b=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 N=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=b&~l;0<l;){var ne=31-jt(l),se=1<<ne;N[ne]=0,H[ne]=-1;var X=K[ne];if(X!==null)for(K[ne]=null,ne=0;ne<X.length;ne++){var ee=X[ne];ee!==null&&(ee.lane&=-536870913)}l&=~se}s!==0&&Wu(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(b&~t))}function Wu(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-jt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function Ku(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-jt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Xu(e,t){var l=t&-t;return l=(l&42)!==0?1:wo(l),(l&(e.suspendedLanes|t))!==0?0:l}function wo(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 Co(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qu(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:Bh(e.type))}function Zu(e,t){var l=I.p;try{return I.p=e,t()}finally{I.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,rn="__reactProps$"+ba,kl="__reactContainer$"+ba,No="__reactEvents$"+ba,Av="__reactListeners$"+ba,Mv="__reactHandles$"+ba,Ju="__reactResources$"+ba,kr="__reactMarker$"+ba;function Eo(e){delete e[Gt],delete e[rn],delete e[No],delete e[Av],delete e[Mv]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=jh(e);e!==null;){if(l=e[Gt])return l;e=jh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Ju];return t||(t=e[Ju]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[kr]=!0}var ef=new Set,tf={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(tf[e]=t,e=0;e<t.length;e++)ef.add(t[e])}var zv=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]*$"),nf={},af={};function Lv(e){return Te.call(af,e)?!0:Te.call(nf,e)?!1:zv.test(e)?af[e]=!0:(nf[e]=!0,!1)}function _s(e,t,l){if(Lv(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Os(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 ea(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dv(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,u.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function To(e){if(!e._valueTracker){var t=lf(e)?"checked":"value";e._valueTracker=Dv(e,t,""+e[t])}}function rf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=lf(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Bs(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 _v=/[\n"\\]/g;function En(e){return e.replace(_v,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ro(e,t,l,s,c,u,b,N){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Nn(t)):e.value!==""+Nn(t)&&(e.value=""+Nn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Ao(e,b,Nn(t)):l!=null?Ao(e,b,Nn(l)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Nn(N):e.removeAttribute("name")}function sf(e,t,l,s,c,u,b,N){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){To(e);return}l=l!=null?""+Nn(l):"",t=t!=null?""+Nn(t):l,N||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),To(e)}function Ao(e,t,l){t==="number"&&Bs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Nn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function of(e,t,l){if(t!=null&&(t=""+Nn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Nn(l):""}function cf(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(z(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Nn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),To(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Ov=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 df(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||Ov.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function uf(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&df(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&df(e,u,t[u])}function Mo(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 Bv=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"]]),Iv=/^[\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 Is(e){return Iv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var zo=null;function Lo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function ff(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[rn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ro(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="'+En(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[rn]||null;if(!c)throw Error(o(90));Ro(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&rf(s)}break e;case"textarea":of(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Do=!1;function pf(e,t,l){if(Do)return e(t,l);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(Al!==null||Ml!==null)&&(Ci(),Al&&(t=Al,e=Ml,Ml=Al=null,ff(t),e)))for(t=0;t<e.length;t++)ff(e[t])}}function Cr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[rn]||null;if(s===null)return null;l=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_o=!1;if(na)try{var Nr={};Object.defineProperty(Nr,"passive",{get:function(){_o=!0}}),window.addEventListener("test",Nr,Nr),window.removeEventListener("test",Nr,Nr)}catch{_o=!1}var ja=null,Oo=null,Hs=null;function mf(){if(Hs)return Hs;var e,t=Oo,l=t.length,s,c="value"in ja?ja.value:ja.textContent,u=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[u-s];s++);return Hs=c.slice(e,1<s?1-s:void 0)}function Us(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 Vs(){return!0}function hf(){return!1}function sn(e){function t(l,s,c,u,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=b,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(l=e[N],this[N]=l?l(u):u[N]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Vs:hf,this.isPropagationStopped=hf,this}return v(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=Vs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=sn(el),Er=v({},el,{view:0,detail:0}),Hv=sn(Er),Bo,Io,Tr,Ps=v({},Er,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,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!==Tr&&(Tr&&e.type==="mousemove"?(Bo=e.screenX-Tr.screenX,Io=e.screenY-Tr.screenY):Io=Bo=0,Tr=e),Bo)},movementY:function(e){return"movementY"in e?e.movementY:Io}}),xf=sn(Ps),Uv=v({},Ps,{dataTransfer:0}),Vv=sn(Uv),$v=v({},Er,{relatedTarget:0}),Ho=sn($v),Pv=v({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),Gv=sn(Pv),qv=v({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Yv=sn(qv),Fv=v({},el,{data:0}),gf=sn(Fv),Wv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kv={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"},Xv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Xv[e])?!!t[e]:!1}function Uo(){return Qv}var Zv=v({},Er,{key:function(e){if(e.key){var t=Wv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Us(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Kv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(e){return e.type==="keypress"?Us(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Us(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Jv=sn(Zv),ey=v({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vf=sn(ey),ty=v({},Er,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),ny=sn(ty),ay=v({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),ly=sn(ay),ry=v({},Ps,{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}),sy=sn(ry),iy=v({},el,{newState:0,oldState:0}),oy=sn(iy),cy=[9,13,27,32],Vo=na&&"CompositionEvent"in window,Rr=null;na&&"documentMode"in document&&(Rr=document.documentMode);var dy=na&&"TextEvent"in window&&!Rr,yf=na&&(!Vo||Rr&&8<Rr&&11>=Rr),bf=" ",jf=!1;function Sf(e,t){switch(e){case"keyup":return cy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zl=!1;function uy(e,t){switch(e){case"compositionend":return kf(t);case"keypress":return t.which!==32?null:(jf=!0,bf);case"textInput":return e=t.data,e===bf&&jf?null:e;default:return null}}function fy(e,t){if(zl)return e==="compositionend"||!Vo&&Sf(e,t)?(e=mf(),Hs=Oo=ja=null,zl=!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 yf&&t.locale!=="ko"?null:t.data;default:return null}}var py={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 wf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!py[e.type]:t==="textarea"}function Cf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=zi(t,"onChange"),0<t.length&&(l=new $s("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Ar=null,Mr=null;function my(e){ih(e,0)}function Gs(e){var t=wr(e);if(rf(t))return e}function Nf(e,t){if(e==="change")return t}var Ef=!1;if(na){var $o;if(na){var Po="oninput"in document;if(!Po){var Tf=document.createElement("div");Tf.setAttribute("oninput","return;"),Po=typeof Tf.oninput=="function"}$o=Po}else $o=!1;Ef=$o&&(!document.documentMode||9<document.documentMode)}function Rf(){Ar&&(Ar.detachEvent("onpropertychange",Af),Mr=Ar=null)}function Af(e){if(e.propertyName==="value"&&Gs(Mr)){var t=[];Cf(t,Mr,e,Lo(e)),pf(my,t)}}function hy(e,t,l){e==="focusin"?(Rf(),Ar=t,Mr=l,Ar.attachEvent("onpropertychange",Af)):e==="focusout"&&Rf()}function xy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gs(Mr)}function gy(e,t){if(e==="click")return Gs(t)}function vy(e,t){if(e==="input"||e==="change")return Gs(t)}function yy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pn=typeof Object.is=="function"?Object.is:yy;function zr(e,t){if(pn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!Te.call(t,c)||!pn(e[c],t[c]))return!1}return!0}function Mf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zf(e,t){var l=Mf(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Mf(l)}}function Lf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Df(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bs(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=Bs(e.document)}return t}function Go(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 by=na&&"documentMode"in document&&11>=document.documentMode,Ll=null,qo=null,Lr=null,Yo=!1;function _f(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Yo||Ll==null||Ll!==Bs(s)||(s=Ll,"selectionStart"in s&&Go(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Lr&&zr(Lr,s)||(Lr=s,s=zi(qo,"onSelect"),0<s.length&&(t=new $s("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=Ll)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Dl={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},Fo={},Of={};na&&(Of=document.createElement("div").style,"AnimationEvent"in window||(delete Dl.animationend.animation,delete Dl.animationiteration.animation,delete Dl.animationstart.animation),"TransitionEvent"in window||delete Dl.transitionend.transition);function nl(e){if(Fo[e])return Fo[e];if(!Dl[e])return e;var t=Dl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Of)return Fo[e]=t[l];return e}var Bf=nl("animationend"),If=nl("animationiteration"),Hf=nl("animationstart"),jy=nl("transitionrun"),Sy=nl("transitionstart"),ky=nl("transitioncancel"),Uf=nl("transitionend"),Vf=new Map,Wo="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(" ");Wo.push("scrollEnd");function Un(e,t){Vf.set(e,t),Ja(t,[e])}var qs=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)},Tn=[],_l=0,Ko=0;function Ys(){for(var e=_l,t=Ko=_l=0;t<e;){var l=Tn[t];Tn[t++]=null;var s=Tn[t];Tn[t++]=null;var c=Tn[t];Tn[t++]=null;var u=Tn[t];if(Tn[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}u!==0&&$f(l,c,u)}}function Fs(e,t,l,s){Tn[_l++]=e,Tn[_l++]=t,Tn[_l++]=l,Tn[_l++]=s,Ko|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Xo(e,t,l,s){return Fs(e,t,l,s),Ws(e)}function al(e,t){return Fs(e,null,null,t),Ws(e)}function $f(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,u=e.return;u!==null;)u.childLanes|=l,s=u.alternate,s!==null&&(s.childLanes|=l),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-jt(l),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),u):null}function Ws(e){if(50<ts)throw ts=0,rd=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ol={};function wy(e,t,l,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(e,t,l,s){return new wy(e,t,l,s)}function Qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aa(e,t){var l=e.alternate;return l===null?(l=mn(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 Pf(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 Ks(e,t,l,s,c,u){var b=0;if(s=e,typeof e=="function")Qo(e)&&(b=1);else if(typeof e=="string")b=R1(e,l,ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case E:return e=mn(31,l,t,c),e.elementType=E,e.lanes=u,e;case A:return ll(l.children,c,u,t);case T:b=8,c|=24;break;case C:return e=mn(12,l,t,c|2),e.elementType=C,e.lanes=u,e;case L:return e=mn(13,l,t,c),e.elementType=L,e.lanes=u,e;case V:return e=mn(19,l,t,c),e.elementType=V,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:b=10;break e;case M:b=9;break e;case U:b=11;break e;case w:b=14;break e;case D:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=mn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function ll(e,t,l,s){return e=mn(7,e,s,t),e.lanes=l,e}function Zo(e,t,l){return e=mn(6,e,null,t),e.lanes=l,e}function Gf(e){var t=mn(18,null,null,0);return t.stateNode=e,t}function Jo(e,t,l){return t=mn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var qf=new WeakMap;function Rn(e,t){if(typeof e=="object"&&e!==null){var l=qf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:re(t)},qf.set(e,t),t)}return{value:e,source:t,stack:re(t)}}var Bl=[],Il=0,Xs=null,Dr=0,An=[],Mn=0,Sa=null,qn=1,Yn="";function la(e,t){Bl[Il++]=Dr,Bl[Il++]=Xs,Xs=e,Dr=t}function Yf(e,t,l){An[Mn++]=qn,An[Mn++]=Yn,An[Mn++]=Sa,Sa=e;var s=qn;e=Yn;var c=32-jt(s)-1;s&=~(1<<c),l+=1;var u=32-jt(t)+c;if(30<u){var b=c-c%5;u=(s&(1<<b)-1).toString(32),s>>=b,c-=b,qn=1<<32-jt(t)+c|l<<c|s,Yn=u+e}else qn=1<<u|l<<c|s,Yn=e}function ec(e){e.return!==null&&(la(e,1),Yf(e,1,0))}function tc(e){for(;e===Xs;)Xs=Bl[--Il],Bl[Il]=null,Dr=Bl[--Il],Bl[Il]=null;for(;e===Sa;)Sa=An[--Mn],An[Mn]=null,Yn=An[--Mn],An[Mn]=null,qn=An[--Mn],An[Mn]=null}function Ff(e,t){An[Mn++]=qn,An[Mn++]=Yn,An[Mn++]=Sa,qn=t.id,Yn=t.overflow,Sa=e}var qt=null,pt=null,Ke=!1,ka=null,zn=!1,nc=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _r(Rn(t,e)),nc}function Wf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[rn]=s,l){case"dialog":Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":case"embed":Ye("load",t);break;case"video":case"audio":for(l=0;l<as.length;l++)Ye(as[l],t);break;case"source":Ye("error",t);break;case"img":case"image":case"link":Ye("error",t),Ye("load",t);break;case"details":Ye("toggle",t);break;case"input":Ye("invalid",t),sf(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ye("invalid",t);break;case"textarea":Ye("invalid",t),cf(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||uh(t.textContent,l)?(s.popover!=null&&(Ye("beforetoggle",t),Ye("toggle",t)),s.onScroll!=null&&Ye("scroll",t),s.onScrollEnd!=null&&Ye("scrollend",t),s.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||wa(e,!0)}function Kf(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:qt=qt.return}}function Hl(e){if(e!==qt)return!1;if(!Ke)return Kf(e),Ke=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||bd(e.type,e.memoizedProps)),l=!l),l&&pt&&wa(e),Kf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=bh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=bh(e)}else t===27?(t=pt,Ia(e.type)?(e=Cd,Cd=null,pt=e):pt=t):pt=qt?Dn(e.stateNode.nextSibling):null;return!0}function rl(){pt=qt=null,Ke=!1}function ac(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function _r(e){ka===null?ka=[e]:ka.push(e)}var lc=_(null),sl=null,ra=null;function Ca(e,t,l){ie(lc,t._currentValue),t._currentValue=l}function sa(e){e._currentValue=lc.current,W(lc)}function rc(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function sc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var b=c.child;u=u.firstContext;e:for(;u!==null;){var N=u;u=c;for(var H=0;H<t.length;H++)if(N.context===t[H]){u.lanes|=l,N=u.alternate,N!==null&&(N.lanes|=l),rc(u.return,l,e),s||(b=null);break e}u=N.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,u=b.alternate,u!==null&&(u.lanes|=l),rc(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ul(e,t,l,s){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var N=c.type;pn(c.pendingProps.value,b.value)||(e!==null?e.push(N):e=[N])}}else if(c===we.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(os):e=[os])}c=c.return}e!==null&&sc(t,e,l,s),t.flags|=262144}function Qs(e){for(e=e.firstContext;e!==null;){if(!pn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,ra=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Xf(sl,e)}function Zs(e,t){return sl===null&&il(e),Xf(e,t)}function Xf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},ra===null){if(e===null)throw Error(o(308));ra=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ra=ra.next=t;return l}var Cy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Ny=a.unstable_scheduleCallback,Ey=a.unstable_NormalPriority,Mt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ic(){return{controller:new Cy,data:new Map,refCount:0}}function Or(e){e.refCount--,e.refCount===0&&Ny(Ey,function(){e.controller.abort()})}var Br=null,oc=0,Vl=0,$l=null;function Ty(e,t){if(Br===null){var l=Br=[];oc=0,Vl=ud(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return oc++,t.then(Qf,Qf),t}function Qf(){if(--oc===0&&Br!==null){$l!==null&&($l.status="fulfilled");var e=Br;Br=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ry(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var Zf=R.S;R.S=function(e,t){_m=lt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ty(e,t),Zf!==null&&Zf(e,t)};var ol=_(null);function cc(){var e=ol.current;return e!==null?e:ft.pooledCache}function Js(e,t){t===null?ie(ol,ol.current):ie(ol,t.pool)}function Jf(){var e=cc();return e===null?null:{parent:Mt._currentValue,pool:e}}var Pl=Error(o(460)),dc=Error(o(474)),ei=Error(o(542)),ti={then:function(){}};function ep(e){return e=e.status,e==="fulfilled"||e==="rejected"}function tp(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ta,ta),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ap(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ap(e),e}throw dl=t,Pl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(dl=l,Pl):l}}var dl=null;function np(){if(dl===null)throw Error(o(459));var e=dl;return dl=null,e}function ap(e){if(e===Pl||e===ei)throw Error(o(483))}var Gl=null,Ir=0;function ni(e){var t=Ir;return Ir+=1,Gl===null&&(Gl=[]),tp(Gl,e,t)}function Hr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ai(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function lp(e){function t(G,$){if(e){var F=G.deletions;F===null?(G.deletions=[$],G.flags|=16):F.push($)}}function l(G,$){if(!e)return null;for(;$!==null;)t(G,$),$=$.sibling;return null}function s(G){for(var $=new Map;G!==null;)G.key!==null?$.set(G.key,G):$.set(G.index,G),G=G.sibling;return $}function c(G,$){return G=aa(G,$),G.index=0,G.sibling=null,G}function u(G,$,F){return G.index=F,e?(F=G.alternate,F!==null?(F=F.index,F<$?(G.flags|=67108866,$):F):(G.flags|=67108866,$)):(G.flags|=1048576,$)}function b(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function N(G,$,F,le){return $===null||$.tag!==6?($=Zo(F,G.mode,le),$.return=G,$):($=c($,F),$.return=G,$)}function H(G,$,F,le){var Re=F.type;return Re===A?ne(G,$,F.props.children,le,F.key):$!==null&&($.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===D&&cl(Re)===$.type)?($=c($,F.props),Hr($,F),$.return=G,$):($=Ks(F.type,F.key,F.props,null,G.mode,le),Hr($,F),$.return=G,$)}function K(G,$,F,le){return $===null||$.tag!==4||$.stateNode.containerInfo!==F.containerInfo||$.stateNode.implementation!==F.implementation?($=Jo(F,G.mode,le),$.return=G,$):($=c($,F.children||[]),$.return=G,$)}function ne(G,$,F,le,Re){return $===null||$.tag!==7?($=ll(F,G.mode,le,Re),$.return=G,$):($=c($,F),$.return=G,$)}function se(G,$,F){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Zo(""+$,G.mode,F),$.return=G,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return F=Ks($.type,$.key,$.props,null,G.mode,F),Hr(F,$),F.return=G,F;case k:return $=Jo($,G.mode,F),$.return=G,$;case D:return $=cl($),se(G,$,F)}if(z($)||q($))return $=ll($,G.mode,F,null),$.return=G,$;if(typeof $.then=="function")return se(G,ni($),F);if($.$$typeof===O)return se(G,Zs(G,$),F);ai(G,$)}return null}function X(G,$,F,le){var Re=$!==null?$.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Re!==null?null:N(G,$,""+F,le);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case S:return F.key===Re?H(G,$,F,le):null;case k:return F.key===Re?K(G,$,F,le):null;case D:return F=cl(F),X(G,$,F,le)}if(z(F)||q(F))return Re!==null?null:ne(G,$,F,le,null);if(typeof F.then=="function")return X(G,$,ni(F),le);if(F.$$typeof===O)return X(G,$,Zs(G,F),le);ai(G,F)}return null}function ee(G,$,F,le,Re){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return G=G.get(F)||null,N($,G,""+le,Re);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case S:return G=G.get(le.key===null?F:le.key)||null,H($,G,le,Re);case k:return G=G.get(le.key===null?F:le.key)||null,K($,G,le,Re);case D:return le=cl(le),ee(G,$,F,le,Re)}if(z(le)||q(le))return G=G.get(F)||null,ne($,G,le,Re,null);if(typeof le.then=="function")return ee(G,$,F,ni(le),Re);if(le.$$typeof===O)return ee(G,$,F,Zs($,le),Re);ai($,le)}return null}function je(G,$,F,le){for(var Re=null,Ze=null,ke=$,Ue=$=0,We=null;ke!==null&&Ue<F.length;Ue++){ke.index>Ue?(We=ke,ke=null):We=ke.sibling;var Je=X(G,ke,F[Ue],le);if(Je===null){ke===null&&(ke=We);break}e&&ke&&Je.alternate===null&&t(G,ke),$=u(Je,$,Ue),Ze===null?Re=Je:Ze.sibling=Je,Ze=Je,ke=We}if(Ue===F.length)return l(G,ke),Ke&&la(G,Ue),Re;if(ke===null){for(;Ue<F.length;Ue++)ke=se(G,F[Ue],le),ke!==null&&($=u(ke,$,Ue),Ze===null?Re=ke:Ze.sibling=ke,Ze=ke);return Ke&&la(G,Ue),Re}for(ke=s(ke);Ue<F.length;Ue++)We=ee(ke,G,Ue,F[Ue],le),We!==null&&(e&&We.alternate!==null&&ke.delete(We.key===null?Ue:We.key),$=u(We,$,Ue),Ze===null?Re=We:Ze.sibling=We,Ze=We);return e&&ke.forEach(function(Pa){return t(G,Pa)}),Ke&&la(G,Ue),Re}function Ae(G,$,F,le){if(F==null)throw Error(o(151));for(var Re=null,Ze=null,ke=$,Ue=$=0,We=null,Je=F.next();ke!==null&&!Je.done;Ue++,Je=F.next()){ke.index>Ue?(We=ke,ke=null):We=ke.sibling;var Pa=X(G,ke,Je.value,le);if(Pa===null){ke===null&&(ke=We);break}e&&ke&&Pa.alternate===null&&t(G,ke),$=u(Pa,$,Ue),Ze===null?Re=Pa:Ze.sibling=Pa,Ze=Pa,ke=We}if(Je.done)return l(G,ke),Ke&&la(G,Ue),Re;if(ke===null){for(;!Je.done;Ue++,Je=F.next())Je=se(G,Je.value,le),Je!==null&&($=u(Je,$,Ue),Ze===null?Re=Je:Ze.sibling=Je,Ze=Je);return Ke&&la(G,Ue),Re}for(ke=s(ke);!Je.done;Ue++,Je=F.next())Je=ee(ke,G,Ue,Je.value,le),Je!==null&&(e&&Je.alternate!==null&&ke.delete(Je.key===null?Ue:Je.key),$=u(Je,$,Ue),Ze===null?Re=Je:Ze.sibling=Je,Ze=Je);return e&&ke.forEach(function(U1){return t(G,U1)}),Ke&&la(G,Ue),Re}function dt(G,$,F,le){if(typeof F=="object"&&F!==null&&F.type===A&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case S:e:{for(var Re=F.key;$!==null;){if($.key===Re){if(Re=F.type,Re===A){if($.tag===7){l(G,$.sibling),le=c($,F.props.children),le.return=G,G=le;break e}}else if($.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===D&&cl(Re)===$.type){l(G,$.sibling),le=c($,F.props),Hr(le,F),le.return=G,G=le;break e}l(G,$);break}else t(G,$);$=$.sibling}F.type===A?(le=ll(F.props.children,G.mode,le,F.key),le.return=G,G=le):(le=Ks(F.type,F.key,F.props,null,G.mode,le),Hr(le,F),le.return=G,G=le)}return b(G);case k:e:{for(Re=F.key;$!==null;){if($.key===Re)if($.tag===4&&$.stateNode.containerInfo===F.containerInfo&&$.stateNode.implementation===F.implementation){l(G,$.sibling),le=c($,F.children||[]),le.return=G,G=le;break e}else{l(G,$);break}else t(G,$);$=$.sibling}le=Jo(F,G.mode,le),le.return=G,G=le}return b(G);case D:return F=cl(F),dt(G,$,F,le)}if(z(F))return je(G,$,F,le);if(q(F)){if(Re=q(F),typeof Re!="function")throw Error(o(150));return F=Re.call(F),Ae(G,$,F,le)}if(typeof F.then=="function")return dt(G,$,ni(F),le);if(F.$$typeof===O)return dt(G,$,Zs(G,F),le);ai(G,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,$!==null&&$.tag===6?(l(G,$.sibling),le=c($,F),le.return=G,G=le):(l(G,$),le=Zo(F,G.mode,le),le.return=G,G=le),b(G)):l(G,$)}return function(G,$,F,le){try{Ir=0;var Re=dt(G,$,F,le);return Gl=null,Re}catch(ke){if(ke===Pl||ke===ei)throw ke;var Ze=mn(29,ke,null,G.mode);return Ze.lanes=le,Ze.return=G,Ze}finally{}}}var ul=lp(!0),rp=lp(!1),Na=!1;function uc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fc(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 Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(tt&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ws(e),$f(e,null,l),t}return Fs(e,s,t,l),Ws(e)}function Ur(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Ku(e,l)}}function pc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?c=u=b:u=u.next=b,l=l.next}while(l!==null);u===null?c=u=t:u=u.next=t}else c=u=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var mc=!1;function Vr(){if(mc){var e=$l;if(e!==null)throw e}}function $r(e,t,l,s){mc=!1;var c=e.updateQueue;Na=!1;var u=c.firstBaseUpdate,b=c.lastBaseUpdate,N=c.shared.pending;if(N!==null){c.shared.pending=null;var H=N,K=H.next;H.next=null,b===null?u=K:b.next=K,b=H;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==b&&(N===null?ne.firstBaseUpdate=K:N.next=K,ne.lastBaseUpdate=H))}if(u!==null){var se=c.baseState;b=0,ne=K=H=null,N=u;do{var X=N.lane&-536870913,ee=X!==N.lane;if(ee?(Fe&X)===X:(s&X)===X){X!==0&&X===Vl&&(mc=!0),ne!==null&&(ne=ne.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var je=e,Ae=N;X=t;var dt=l;switch(Ae.tag){case 1:if(je=Ae.payload,typeof je=="function"){se=je.call(dt,se,X);break e}se=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ae.payload,X=typeof je=="function"?je.call(dt,se,X):je,X==null)break e;se=v({},se,X);break e;case 2:Na=!0}}X=N.callback,X!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=c.callbacks,ee===null?c.callbacks=[X]:ee.push(X))}else ee={lane:X,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(K=ne=ee,H=se):ne=ne.next=ee,b|=X;if(N=N.next,N===null){if(N=c.shared.pending,N===null)break;ee=N,N=ee.next,ee.next=null,c.lastBaseUpdate=ee,c.shared.pending=null}}while(!0);ne===null&&(H=se),c.baseState=H,c.firstBaseUpdate=K,c.lastBaseUpdate=ne,u===null&&(c.shared.lanes=0),La|=b,e.lanes=b,e.memoizedState=se}}function sp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function ip(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)sp(l[e],t)}var ql=_(null),li=_(0);function op(e,t){e=ha,ie(li,e),ie(ql,t),ha=e|t.baseLanes}function hc(){ie(li,ha),ie(ql,ql.current)}function xc(){ha=li.current,W(ql),W(li)}var hn=_(null),Ln=null;function Ra(e){var t=e.alternate;ie(Tt,Tt.current&1),ie(hn,e),Ln===null&&(t===null||ql.current!==null||t.memoizedState!==null)&&(Ln=e)}function gc(e){ie(Tt,Tt.current),ie(hn,e),Ln===null&&(Ln=e)}function cp(e){e.tag===22?(ie(Tt,Tt.current),ie(hn,e),Ln===null&&(Ln=e)):Aa()}function Aa(){ie(Tt,Tt.current),ie(hn,hn.current)}function xn(e){W(hn),Ln===e&&(Ln=null),W(Tt)}var Tt=_(0);function ri(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||kd(l)||wd(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 ia=0,He=null,ot=null,zt=null,si=!1,Yl=!1,fl=!1,ii=0,Pr=0,Fl=null,Ay=0;function wt(){throw Error(o(321))}function vc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!pn(e[l],t[l]))return!1;return!0}function yc(e,t,l,s,c,u){return ia=u,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?Yp:Dc,fl=!1,u=l(s,c),fl=!1,Yl&&(u=up(t,l,s,c)),dp(e),u}function dp(e){R.H=Yr;var t=ot!==null&&ot.next!==null;if(ia=0,zt=ot=He=null,si=!1,Pr=0,Fl=null,t)throw Error(o(300));e===null||Lt||(e=e.dependencies,e!==null&&Qs(e)&&(Lt=!0))}function up(e,t,l,s){He=e;var c=0;do{if(Yl&&(Fl=null),Pr=0,Yl=!1,25<=c)throw Error(o(301));if(c+=1,zt=ot=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}R.H=Fp,u=t(l,s)}while(Yl);return u}function My(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(ot!==null?ot.memoizedState:null)!==e&&(He.flags|=1024),t}function bc(){var e=ii!==0;return ii=0,e}function jc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Sc(e){if(si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}si=!1}ia=0,zt=ot=He=null,Yl=!1,Pr=ii=0,Fl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?He.memoizedState=zt=e:zt=zt.next=e,zt}function Rt(){if(ot===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=ot.next;var t=zt===null?He.memoizedState:zt.next;if(t!==null)zt=t,ot=e;else{if(e===null)throw He.alternate===null?Error(o(467)):Error(o(310));ot=e,e={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},zt===null?He.memoizedState=zt=e:zt=zt.next=e}return zt}function oi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=Pr;return Pr+=1,Fl===null&&(Fl=[]),e=tp(Fl,e,t),t=He,(zt===null?t.memoizedState:zt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?Yp:Dc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===O)return Yt(e)}throw Error(o(438,String(e)))}function kc(e){var t=null,l=He.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=He.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=oi(),He.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=B;return t.index++,l}function oa(e,t){return typeof t=="function"?t(e):t}function di(e){var t=Rt();return wc(t,ot,e)}function wc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,u=s.pending;if(u!==null){if(c!==null){var b=c.next;c.next=u.next,u.next=b}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var N=b=null,H=null,K=t,ne=!1;do{var se=K.lane&-536870913;if(se!==K.lane?(Fe&se)===se:(ia&se)===se){var X=K.revertLane;if(X===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),se===Vl&&(ne=!0);else if((ia&X)===X){K=K.next,X===Vl&&(ne=!0);continue}else se={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(N=H=se,b=u):H=H.next=se,He.lanes|=X,La|=X;se=K.action,fl&&l(u,se),u=K.hasEagerState?K.eagerState:l(u,se)}else X={lane:se,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(N=H=X,b=u):H=H.next=X,He.lanes|=se,La|=se;K=K.next}while(K!==null&&K!==t);if(H===null?b=u:H.next=N,!pn(u,e.memoizedState)&&(Lt=!0,ne&&(l=$l,l!==null)))throw l;e.memoizedState=u,e.baseState=b,e.baseQueue=H,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Cc(e){var t=Rt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,u=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do u=e(u,b.action),b=b.next;while(b!==c);pn(u,t.memoizedState)||(Lt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),l.lastRenderedState=u}return[u,s]}function fp(e,t,l){var s=He,c=Rt(),u=Ke;if(u){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!pn((ot||c).memoizedState,l);if(b&&(c.memoizedState=l,Lt=!0),c=c.queue,Tc(hp.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||zt!==null&&zt.memoizedState.tag&1){if(s.flags|=2048,Wl(9,{destroy:void 0},mp.bind(null,s,c,l,t),null),ft===null)throw Error(o(349));u||(ia&127)!==0||pp(s,t,l)}return l}function pp(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=He.updateQueue,t===null?(t=oi(),He.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function mp(e,t,l,s){t.value=l,t.getSnapshot=s,xp(t)&&gp(e)}function hp(e,t,l){return l(function(){xp(t)&&gp(e)})}function xp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!pn(e,l)}catch{return!0}}function gp(e){var t=al(e,2);t!==null&&fn(t,e,2)}function Nc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){kt(!0);try{l()}finally{kt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:e},t}function vp(e,t,l,s){return e.baseState=l,wc(e,ot,typeof s=="function"?s:oa)}function zy(e,t,l,s,c){if(pi(e))throw Error(o(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){u.listeners.push(b)}};R.T!==null?l(!0):u.isTransition=!1,s(u),l=t.pending,l===null?(u.next=t.pending=u,yp(t,u)):(u.next=l.next,t.pending=l.next=u)}}function yp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=R.T,b={};R.T=b;try{var N=l(c,s),H=R.S;H!==null&&H(b,N),bp(e,t,N)}catch(K){Ec(e,t,K)}finally{u!==null&&b.types!==null&&(u.types=b.types),R.T=u}}else try{u=l(c,s),bp(e,t,u)}catch(K){Ec(e,t,K)}}function bp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){jp(e,t,s)},function(s){return Ec(e,t,s)}):jp(e,t,l)}function jp(e,t,l){t.status="fulfilled",t.value=l,Sp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,yp(e,l)))}function Ec(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,Sp(t),t=t.next;while(t!==s)}e.action=null}function Sp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function kp(e,t){return t}function wp(e,t){if(Ke){var l=ft.formState;if(l!==null){e:{var s=He;if(Ke){if(pt){t:{for(var c=pt,u=zn;c.nodeType!==8;){if(!u){c=null;break t}if(c=Dn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){pt=Dn(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kp,lastRenderedState:t},l.queue=s,l=Pp.bind(null,He,s),s.dispatch=l,s=Nc(!1),u=Lc.bind(null,He,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=zy.bind(null,He,c,u,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function Cp(e){var t=Rt();return Np(t,ot,e)}function Np(e,t,l){if(t=wc(e,t,kp)[0],e=di(oa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Pl?ei:b}else s=t;t=Rt();var c=t.queue,u=c.dispatch;return l!==t.memoizedState&&(He.flags|=2048,Wl(9,{destroy:void 0},Ly.bind(null,c,l),null)),[s,u,e]}function Ly(e,t){e.action=t}function Ep(e){var t=Rt(),l=ot;if(l!==null)return Np(t,l,e);Rt(),t=t.memoizedState,l=Rt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Wl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=He.updateQueue,t===null&&(t=oi(),He.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function Tp(){return Rt().memoizedState}function ui(e,t,l,s){var c=Jt();He.flags|=e,c.memoizedState=Wl(1|t,{destroy:void 0},l,s===void 0?null:s)}function fi(e,t,l,s){var c=Rt();s=s===void 0?null:s;var u=c.memoizedState.inst;ot!==null&&s!==null&&vc(s,ot.memoizedState.deps)?c.memoizedState=Wl(t,u,l,s):(He.flags|=e,c.memoizedState=Wl(1|t,u,l,s))}function Rp(e,t){ui(8390656,8,e,t)}function Tc(e,t){fi(2048,8,e,t)}function Dy(e){He.flags|=4;var t=He.updateQueue;if(t===null)t=oi(),He.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Ap(e){var t=Rt().memoizedState;return Dy({ref:t,nextImpl:e}),function(){if((tt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Mp(e,t){return fi(4,2,e,t)}function zp(e,t){return fi(4,4,e,t)}function Lp(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 Dp(e,t,l){l=l!=null?l.concat([e]):null,fi(4,4,Lp.bind(null,t,e),l)}function Rc(){}function _p(e,t){var l=Rt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&vc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Op(e,t){var l=Rt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&vc(t,s[1]))return s[0];if(s=e(),fl){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[s,t],s}function Ac(e,t,l){return l===void 0||(ia&1073741824)!==0&&(Fe&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Bm(),He.lanes|=e,La|=e,l)}function Bp(e,t,l,s){return pn(l,t)?l:ql.current!==null?(e=Ac(e,l,s),pn(e,t)||(Lt=!0),e):(ia&42)===0||(ia&1073741824)!==0&&(Fe&261930)===0?(Lt=!0,e.memoizedState=l):(e=Bm(),He.lanes|=e,La|=e,t)}function Ip(e,t,l,s,c){var u=I.p;I.p=u!==0&&8>u?u:8;var b=R.T,N={};R.T=N,Lc(e,!1,t,l);try{var H=c(),K=R.S;if(K!==null&&K(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=Ry(H,s);qr(e,t,ne,yn(e))}else qr(e,t,s,yn(e))}catch(se){qr(e,t,{then:function(){},status:"rejected",reason:se},yn())}finally{I.p=u,b!==null&&N.types!==null&&(b.types=N.types),R.T=b}}function _y(){}function Mc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Hp(e).queue;Ip(e,c,t,Z,l===null?_y:function(){return Up(e),l(s)})}function Hp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:Z},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Up(e){var t=Hp(e);t.next===null&&(t=e.alternate.memoizedState),qr(e,t.next.queue,{},yn())}function zc(){return Yt(os)}function Vp(){return Rt().memoizedState}function $p(){return Rt().memoizedState}function Oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=yn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(fn(s,t,l),Ur(s,t,l)),t={cache:ic()},e.payload=t;return}t=t.return}}function By(e,t,l){var s=yn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pi(e)?Gp(t,l):(l=Xo(e,t,l,s),l!==null&&(fn(l,e,s),qp(l,t,s)))}function Pp(e,t,l){var s=yn();qr(e,t,l,s)}function qr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pi(e))Gp(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var b=t.lastRenderedState,N=u(b,l);if(c.hasEagerState=!0,c.eagerState=N,pn(N,b))return Fs(e,t,c,0),ft===null&&Ys(),!1}catch{}finally{}if(l=Xo(e,t,c,s),l!==null)return fn(l,e,s),qp(l,t,s),!0}return!1}function Lc(e,t,l,s){if(s={lane:2,revertLane:ud(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},pi(e)){if(t)throw Error(o(479))}else t=Xo(e,l,s,2),t!==null&&fn(t,e,2)}function pi(e){var t=e.alternate;return e===He||t!==null&&t===He}function Gp(e,t){Yl=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function qp(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Ku(e,l)}}var Yr={readContext:Yt,use:ci,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};Yr.useEffectEvent=wt;var Yp={readContext:Yt,use:ci,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:Rp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,ui(4194308,4,Lp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return ui(4194308,4,e,t)},useInsertionEffect:function(e,t){ui(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(fl){kt(!0);try{l(t)}finally{kt(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=By.bind(null,He,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Nc(e);var t=e.queue,l=Pp.bind(null,He,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Jt();return Ac(l,e,t)},useTransition:function(){var e=Nc(!1);return e=Ip.bind(null,He,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=He,c=Jt();if(Ke){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ft===null)throw Error(o(349));(Fe&127)!==0||pp(s,t,l)}c.memoizedState=l;var u={value:l,getSnapshot:t};return c.queue=u,Rp(hp.bind(null,s,u,e),[e]),s.flags|=2048,Wl(9,{destroy:void 0},mp.bind(null,s,u,l,t),null),l},useId:function(){var e=Jt(),t=ft.identifierPrefix;if(Ke){var l=Yn,s=qn;l=(s&~(1<<32-jt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Ay++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:wp,useActionState:wp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Lc.bind(null,He,!0,l),l.dispatch=t,[e,t]},useMemoCache:kc,useCacheRefresh:function(){return Jt().memoizedState=Oy.bind(null,He)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((tt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Dc={readContext:Yt,use:ci,useCallback:_p,useContext:Yt,useEffect:Tc,useImperativeHandle:Dp,useInsertionEffect:Mp,useLayoutEffect:zp,useMemo:Op,useReducer:di,useRef:Tp,useState:function(){return di(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Rt();return Bp(l,ot.memoizedState,e,t)},useTransition:function(){var e=di(oa)[0],t=Rt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:fp,useId:Vp,useHostTransitionStatus:zc,useFormState:Cp,useActionState:Cp,useOptimistic:function(e,t){var l=Rt();return vp(l,ot,e,t)},useMemoCache:kc,useCacheRefresh:$p};Dc.useEffectEvent=Ap;var Fp={readContext:Yt,use:ci,useCallback:_p,useContext:Yt,useEffect:Tc,useImperativeHandle:Dp,useInsertionEffect:Mp,useLayoutEffect:zp,useMemo:Op,useReducer:Cc,useRef:Tp,useState:function(){return Cc(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Rt();return ot===null?Ac(l,e,t):Bp(l,ot.memoizedState,e,t)},useTransition:function(){var e=Cc(oa)[0],t=Rt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:fp,useId:Vp,useHostTransitionStatus:zc,useFormState:Ep,useActionState:Ep,useOptimistic:function(e,t){var l=Rt();return ot!==null?vp(l,ot,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:kc,useCacheRefresh:$p};Fp.useEffectEvent=Ap;function _c(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:v({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Oc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=yn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(fn(t,e,s),Ur(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=yn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(fn(t,e,s),Ur(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=yn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(fn(t,e,l),Ur(t,e,l))}};function Wp(e,t,l,s,c,u,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,b):t.prototype&&t.prototype.isPureReactComponent?!zr(l,s)||!zr(c,u):!0}function Kp(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Oc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=v({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Xp(e){qs(e)}function Qp(e){console.error(e)}function Zp(e){qs(e)}function mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Jp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Bc(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){mi(e,t)},l}function em(e){return e=Ea(e),e.tag=3,e}function tm(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;e.payload=function(){return c(u)},e.callback=function(){Jp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Jp(t,l,s),typeof c!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function Iy(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Ul(t,l,c,!0),l=hn.current,l!==null){switch(l.tag){case 31:case 13:return Ln===null?Ni():l.alternate===null&&Ct===0&&(Ct=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),od(e,s,c)),!1;case 22:return l.flags|=65536,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),od(e,s,c)),!1}throw Error(o(435,l.tag))}return od(e,s,c),Ni(),!1}if(Ke)return t=hn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==nc&&(e=Error(o(422),{cause:s}),_r(Rn(e,l)))):(s!==nc&&(t=Error(o(423),{cause:s}),_r(Rn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Rn(s,l),c=Bc(e.stateNode,s,c),pc(e,c),Ct!==4&&(Ct=2)),!1;var u=Error(o(520),{cause:s});if(u=Rn(u,l),es===null?es=[u]:es.push(u),Ct!==4&&(Ct=2),t===null)return!0;s=Rn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=Bc(l.stateNode,s,e),pc(l,e),!1;case 1:if(t=l.type,u=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Da===null||!Da.has(u))))return l.flags|=65536,c&=-c,l.lanes|=c,c=em(c),tm(c,e,l,s),pc(l,c),!1}l=l.return}while(l!==null);return!1}var Ic=Error(o(461)),Lt=!1;function Ft(e,t,l,s){t.child=e===null?rp(t,null,l,s):ul(t,e.child,l,s)}function nm(e,t,l,s,c){l=l.render;var u=t.ref;if("ref"in s){var b={};for(var N in s)N!=="ref"&&(b[N]=s[N])}else b=s;return il(t),s=yc(e,t,l,b,u,c),N=bc(),e!==null&&!Lt?(jc(e,t,c),ca(e,t,c)):(Ke&&N&&ec(t),t.flags|=1,Ft(e,t,s,c),t.child)}function am(e,t,l,s,c){if(e===null){var u=l.type;return typeof u=="function"&&!Qo(u)&&u.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=u,lm(e,t,u,s,c)):(e=Ks(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Yc(e,c)){var b=u.memoizedProps;if(l=l.compare,l=l!==null?l:zr,l(b,s)&&e.ref===t.ref)return ca(e,t,c)}return t.flags|=1,e=aa(u,s),e.ref=t.ref,e.return=t,t.child=e}function lm(e,t,l,s,c){if(e!==null){var u=e.memoizedProps;if(zr(u,s)&&e.ref===t.ref)if(Lt=!1,t.pendingProps=s=u,Yc(e,c))(e.flags&131072)!==0&&(Lt=!0);else return t.lanes=e.lanes,ca(e,t,c)}return Hc(e,t,l,s,c)}function rm(e,t,l,s){var c=s.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~u}else s=0,t.child=null;return sm(e,t,u,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,u!==null?u.cachePool:null),u!==null?op(t,u):hc(),cp(t);else return s=t.lanes=536870912,sm(e,t,u!==null?u.baseLanes|l:l,l,s)}else u!==null?(Js(t,u.cachePool),op(t,u),Aa(),t.memoizedState=null):(e!==null&&Js(t,null),hc(),Aa());return Ft(e,t,c,l),t.child}function Fr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sm(e,t,l,s,c){var u=cc();return u=u===null?null:{parent:Mt._currentValue,pool:u},t.memoizedState={baseLanes:l,cachePool:u},e!==null&&Js(t,null),hc(),cp(t),e!==null&&Ul(e,t,s,!0),t.childLanes=c,null}function hi(e,t){return t=gi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function im(e,t,l){return ul(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,xn(t),t.memoizedState=null,e}function Hy(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ke){if(s.mode==="hidden")return e=hi(t,s),t.lanes=536870912,Fr(null,e);if(gc(t),(e=pt)?(e=yh(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:qn,overflow:Yn}:null,retryLane:536870912,hydrationErrors:null},l=Gf(e),l.return=t,t.child=l,qt=t,pt=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return hi(t,s)}var u=e.memoizedState;if(u!==null){var b=u.dehydrated;if(gc(t),c)if(t.flags&256)t.flags&=-257,t=im(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Lt||Ul(e,t,l,!1),c=(l&e.childLanes)!==0,Lt||c){if(s=ft,s!==null&&(b=Xu(s,l),b!==0&&b!==u.retryLane))throw u.retryLane=b,al(e,b),fn(s,e,b),Ic;Ni(),t=im(e,t,l)}else e=u.treeContext,pt=Dn(b.nextSibling),qt=t,Ke=!0,ka=null,zn=!1,e!==null&&Ff(t,e),t=hi(t,s),t.flags|=4096;return t}return e=aa(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Hc(e,t,l,s,c){return il(t),l=yc(e,t,l,s,void 0,c),s=bc(),e!==null&&!Lt?(jc(e,t,c),ca(e,t,c)):(Ke&&s&&ec(t),t.flags|=1,Ft(e,t,l,c),t.child)}function om(e,t,l,s,c,u){return il(t),t.updateQueue=null,l=up(t,s,l,c),dp(e),s=bc(),e!==null&&!Lt?(jc(e,t,u),ca(e,t,u)):(Ke&&s&&ec(t),t.flags|=1,Ft(e,t,l,u),t.child)}function cm(e,t,l,s,c){if(il(t),t.stateNode===null){var u=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(u=Yt(b)),u=new l(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Oc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},uc(t),b=l.contextType,u.context=typeof b=="object"&&b!==null?Yt(b):Ol,u.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(_c(t,l,b,s),u.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(b=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),b!==u.state&&Oc.enqueueReplaceState(u,u.state,null),$r(t,s,u,c),Vr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var N=t.memoizedProps,H=pl(l,N);u.props=H;var K=u.context,ne=l.contextType;b=Ol,typeof ne=="object"&&ne!==null&&(b=Yt(ne));var se=l.getDerivedStateFromProps;ne=typeof se=="function"||typeof u.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,ne||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(N||K!==b)&&Kp(t,u,s,b),Na=!1;var X=t.memoizedState;u.state=X,$r(t,s,u,c),Vr(),K=t.memoizedState,N||X!==K||Na?(typeof se=="function"&&(_c(t,l,se,s),K=t.memoizedState),(H=Na||Wp(t,l,H,s,X,K,b))?(ne||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=K),u.props=s,u.state=K,u.context=b,s=H):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,fc(e,t),b=t.memoizedProps,ne=pl(l,b),u.props=ne,se=t.pendingProps,X=u.context,K=l.contextType,H=Ol,typeof K=="object"&&K!==null&&(H=Yt(K)),N=l.getDerivedStateFromProps,(K=typeof N=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b!==se||X!==H)&&Kp(t,u,s,H),Na=!1,X=t.memoizedState,u.state=X,$r(t,s,u,c),Vr();var ee=t.memoizedState;b!==se||X!==ee||Na||e!==null&&e.dependencies!==null&&Qs(e.dependencies)?(typeof N=="function"&&(_c(t,l,N,s),ee=t.memoizedState),(ne=Na||Wp(t,l,ne,s,X,ee,H)||e!==null&&e.dependencies!==null&&Qs(e.dependencies))?(K||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,ee,H),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,ee,H)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ee),u.props=s,u.state=ee,u.context=H,s=ne):(typeof u.componentDidUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,xi(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=ul(t,e.child,null,c),t.child=ul(t,null,l,c)):Ft(e,t,l,c),t.memoizedState=u.state,e=t.child):e=ca(e,t,c),e}function dm(e,t,l,s){return rl(),t.flags|=256,Ft(e,t,l,s),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:Jf()}}function $c(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function um(e,t,l){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,b;if((b=u)||(b=e!==null&&e.memoizedState===null?!1:(Tt.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ke){if(c?Ra(t):Aa(),(e=pt)?(e=yh(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:qn,overflow:Yn}:null,retryLane:536870912,hydrationErrors:null},l=Gf(e),l.return=t,t.child=l,qt=t,pt=null)):e=null,e===null)throw wa(t);return wd(e)?t.lanes=32:t.lanes=536870912,null}var N=s.children;return s=s.fallback,c?(Aa(),c=t.mode,N=gi({mode:"hidden",children:N},c),s=ll(s,c,l,null),N.return=t,s.return=t,N.sibling=s,t.child=N,s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,Fr(null,s)):(Ra(t),Pc(t,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(u)t.flags&256?(Ra(t),t.flags&=-257,t=Gc(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),N=s.fallback,c=t.mode,s=gi({mode:"visible",children:s.children},c),N=ll(N,c,l,null),N.flags|=2,s.return=t,N.return=t,s.sibling=N,t.child=s,ul(t,e.child,null,l),s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,t=Fr(null,s));else if(Ra(t),wd(N)){if(b=N.nextSibling&&N.nextSibling.dataset,b)var K=b.dgst;b=K,s=Error(o(419)),s.stack="",s.digest=b,_r({value:s,source:null,stack:null}),t=Gc(e,t,l)}else if(Lt||Ul(e,t,l,!1),b=(l&e.childLanes)!==0,Lt||b){if(b=ft,b!==null&&(s=Xu(b,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,al(e,s),fn(b,e,s),Ic;kd(N)||Ni(),t=Gc(e,t,l)}else kd(N)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,pt=Dn(N.nextSibling),qt=t,Ke=!0,ka=null,zn=!1,e!==null&&Ff(t,e),t=Pc(t,s.children),t.flags|=4096);return t}return c?(Aa(),N=s.fallback,c=t.mode,H=e.child,K=H.sibling,s=aa(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,K!==null?N=aa(K,N):(N=ll(N,c,l,null),N.flags|=2),N.return=t,s.return=t,s.sibling=N,t.child=s,Fr(null,s),s=t.child,N=e.child.memoizedState,N===null?N=Vc(l):(c=N.cachePool,c!==null?(H=Mt._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Jf(),N={baseLanes:N.baseLanes|l,cachePool:c}),s.memoizedState=N,s.childLanes=$c(e,b,l),t.memoizedState=Uc,Fr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=aa(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Pc(e,t){return t=gi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function gi(e,t){return e=mn(22,e,null,t),e.lanes=0,e}function Gc(e,t,l){return ul(t,e.child,null,l),e=Pc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fm(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),rc(e.return,t,l)}function qc(e,t,l,s,c,u){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:u}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=u)}function pm(e,t,l){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var b=Tt.current,N=(b&2)!==0;if(N?(b=b&1|2,t.flags|=128):b&=1,ie(Tt,b),Ft(e,t,s,l),s=Ke?Dr:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fm(e,l,t);else if(e.tag===19)fm(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(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ri(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),qc(t,!1,c,l,u,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ri(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}qc(t,!0,l,null,u,s);break;case"together":qc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ca(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),La|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ul(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=aa(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=aa(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Yc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Qs(e)))}function Uy(e,t,l){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Ca(t,Mt,e.memoizedState.cache),rl();break;case 27:case 5:De(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,gc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?um(e,t,l):(Ra(t),e=ca(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Ul(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return pm(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ie(Tt,Tt.current),s)break;return null;case 22:return t.lanes=0,rm(e,t,l,t.pendingProps);case 24:Ca(t,Mt,e.memoizedState.cache)}return ca(e,t,l)}function mm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Lt=!0;else{if(!Yc(e,l)&&(t.flags&128)===0)return Lt=!1,Uy(e,t,l);Lt=(e.flags&131072)!==0}else Lt=!1,Ke&&(t.flags&1048576)!==0&&Yf(t,Dr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Qo(e)?(s=pl(e,s),t.tag=1,t=cm(null,t,e,s,l)):(t.tag=0,t=Hc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===U){t.tag=11,t=nm(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=am(null,t,e,s,l);break e}}throw t=Q(e)||e,Error(o(306,t,""))}}return t;case 0:return Hc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),cm(e,t,s,c,l);case 3:e:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,fc(e,t),$r(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,Mt,s),s!==u.cache&&sc(t,[Mt],l,!0),Vr(),s=b.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=dm(e,t,s,l);break e}else if(s!==c){c=Rn(Error(o(424)),t),_r(c),t=dm(e,t,s,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(pt=Dn(e.firstChild),qt=t,Ke=!0,ka=null,zn=!0,l=rp(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=ca(e,t,l);break e}Ft(e,t,s,l)}t=t.child}return t;case 26:return xi(e,t),e===null?(l=Ch(t.type,null,t.pendingProps,null))?t.memoizedState=l:Ke||(l=t.type,e=t.pendingProps,s=Li(xe.current).createElement(l),s[Gt]=t,s[rn]=e,Wt(s,l,e),Ut(s),t.stateNode=s):t.memoizedState=Ch(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return De(t),e===null&&Ke&&(s=t.stateNode=Sh(t.type,t.pendingProps,xe.current),qt=t,zn=!0,c=pt,Ia(t.type)?(Cd=c,pt=Dn(s.firstChild)):pt=c),Ft(e,t,t.pendingProps.children,l),xi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ke&&((c=s=pt)&&(s=x1(s,t.type,t.pendingProps,zn),s!==null?(t.stateNode=s,qt=t,pt=Dn(s.firstChild),zn=!1,c=!0):c=!1),c||wa(t)),De(t),c=t.type,u=t.pendingProps,b=e!==null?e.memoizedProps:null,s=u.children,bd(c,u)?s=null:b!==null&&bd(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=yc(e,t,My,null,null,l),os._currentValue=c),xi(e,t),Ft(e,t,s,l),t.child;case 6:return e===null&&Ke&&((e=l=pt)&&(l=g1(l,t.pendingProps,zn),l!==null?(t.stateNode=l,qt=t,pt=null,e=!0):e=!1),e||wa(t)),null;case 13:return um(e,t,l);case 4:return oe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=ul(t,null,s,l):Ft(e,t,s,l),t.child;case 11:return nm(e,t,t.type,t.pendingProps,l);case 7:return Ft(e,t,t.pendingProps,l),t.child;case 8:return Ft(e,t,t.pendingProps.children,l),t.child;case 12:return Ft(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Ft(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=Yt(c),s=s(c),t.flags|=1,Ft(e,t,s,l),t.child;case 14:return am(e,t,t.type,t.pendingProps,l);case 15:return lm(e,t,t.type,t.pendingProps,l);case 19:return pm(e,t,l);case 31:return Hy(e,t,l);case 22:return rm(e,t,l,t.pendingProps);case 24:return il(t),s=Yt(Mt),e===null?(c=cc(),c===null&&(c=ft,u=ic(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=l),c=u),t.memoizedState={parent:s,cache:c},uc(t),Ca(t,Mt,c)):((e.lanes&l)!==0&&(fc(e,t),$r(t,null,null,l),Vr()),c=e.memoizedState,u=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,Mt,s)):(s=u.cache,Ca(t,Mt,s),s!==c.cache&&sc(t,[Mt],l,!0))),Ft(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function da(e){e.flags|=4}function Fc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Vm())e.flags|=8192;else throw dl=ti,dc}else e.flags&=-16777217}function hm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ah(t))if(Vm())e.flags|=8192;else throw dl=ti,dc}function vi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Fu():536870912,e.lanes|=t,Zl|=t)}function Wr(e,t){if(!Ke)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 s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function Vy(e,t,l){var s=t.pendingProps;switch(tc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(t),null;case 1:return mt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),sa(Mt),Se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?da(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ac())),mt(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(da(t),u!==null?(mt(t),hm(t,u)):(mt(t),Fc(t,c,null,s,l))):u?u!==e.memoizedState?(da(t),mt(t),hm(t,u)):(mt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&da(t),mt(t),Fc(t,c,e,s,l)),null;case 27:if(Ie(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&da(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return mt(t),null}e=ue.current,Hl(t)?Wf(t):(e=Sh(c,s,l),t.stateNode=e,da(t))}return mt(t),null;case 5:if(Ie(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&da(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return mt(t),null}if(u=ue.current,Hl(t))Wf(t);else{var b=Li(xe.current);switch(u){case 1:u=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=b.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}u[Gt]=t,u[rn]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)u.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=u;e:switch(Wt(u,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&da(t)}}return mt(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&da(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=qt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||uh(e.nodeValue,l)),e||wa(t,!0)}else e=Li(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return mt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),e=!1}else l=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(xn(t),t):(xn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return mt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),c=!1}else c=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(xn(t),t):(xn(t),null)}return xn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),vi(t,t.updateQueue),mt(t),null);case 4:return Se(),e===null&&hd(t.stateNode.containerInfo),mt(t),null;case 10:return sa(t.type),mt(t),null;case 19:if(W(Tt),s=t.memoizedState,s===null)return mt(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)Wr(s,!1);else{if(Ct!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ri(e),u!==null){for(t.flags|=128,Wr(s,!1),e=u.updateQueue,t.updateQueue=e,vi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Pf(l,e),l=l.sibling;return ie(Tt,Tt.current&1|2),Ke&&la(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&<()>ki&&(t.flags|=128,c=!0,Wr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ri(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,vi(t,e),Wr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ke)return mt(t),null}else 2*lt()-s.renderingStartTime>ki&&l!==536870912&&(t.flags|=128,c=!0,Wr(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=lt(),e.sibling=null,l=Tt.current,ie(Tt,c?l&1|2:l&1),Ke&&la(t,s.treeForkCount),e):(mt(t),null);case 22:case 23:return xn(t),xc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(mt(t),t.subtreeFlags&6&&(t.flags|=8192)):mt(t),l=t.updateQueue,l!==null&&vi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&W(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),sa(Mt),mt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function $y(e,t){switch(tc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(Mt),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ie(t),null;case 31:if(t.memoizedState!==null){if(xn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(Tt),null;case 4:return Se(),null;case 10:return sa(t.type),null;case 22:case 23:return xn(t),xc(),e!==null&&W(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(Mt),null;case 25:return null;default:return null}}function xm(e,t){switch(tc(t),t.tag){case 3:sa(Mt),Se();break;case 26:case 27:case 5:Ie(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&xn(t);break;case 13:xn(t);break;case 19:W(Tt);break;case 10:sa(t.type);break;case 22:case 23:xn(t),xc(),e!==null&&W(ol);break;case 24:sa(Mt)}}function Kr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var u=l.create,b=l.inst;s=u(),b.destroy=s}l=l.next}while(l!==c)}}catch(N){it(t,t.return,N)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var u=c.next;s=u;do{if((s.tag&e)===e){var b=s.inst,N=b.destroy;if(N!==void 0){b.destroy=void 0,c=t;var H=l,K=N;try{K()}catch(ne){it(c,H,ne)}}}s=s.next}while(s!==u)}}catch(ne){it(t,t.return,ne)}}function gm(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{ip(t,l)}catch(s){it(e,e.return,s)}}}function vm(e,t,l){l.props=pl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){it(e,t,s)}}function Xr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){it(e,t,c)}}function Fn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){it(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){it(e,t,c)}else l.current=null}function ym(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){it(e,e.return,c)}}function Wc(e,t,l){try{var s=e.stateNode;d1(s,e.type,l,t),s[rn]=t}catch(c){it(e,e.return,c)}}function bm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function Kc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bm(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&&Ia(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 Xc(e,t,l){var s=e.tag;if(s===5||s===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=ta));else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,l),e=e.sibling;e!==null;)Xc(e,t,l),e=e.sibling}function yi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(yi(e,t,l),e=e.sibling;e!==null;)yi(e,t,l),e=e.sibling}function jm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Wt(t,s,l),t[Gt]=e,t[rn]=l}catch(u){it(e,e.return,u)}}var ua=!1,Dt=!1,Qc=!1,Sm=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function Py(e,t){if(e=e.containerInfo,vd=Ui,e=Df(e),Go(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break e}var b=0,N=-1,H=-1,K=0,ne=0,se=e,X=null;t:for(;;){for(var ee;se!==l||c!==0&&se.nodeType!==3||(N=b+c),se!==u||s!==0&&se.nodeType!==3||(H=b+s),se.nodeType===3&&(b+=se.nodeValue.length),(ee=se.firstChild)!==null;)X=se,se=ee;for(;;){if(se===e)break t;if(X===l&&++K===c&&(N=b),X===u&&++ne===s&&(H=b),(ee=se.nextSibling)!==null)break;se=X,X=se.parentNode}se=ee}l=N===-1||H===-1?null:{start:N,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(yd={focusedElem:e,selectionRange:l},Ui=!1,Vt=t;Vt!==null;)if(t=Vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vt=e;else for(;Vt!==null;){switch(t=Vt,u=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++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,l=t,c=u.memoizedProps,u=u.memoizedState,s=l.stateNode;try{var je=pl(l.type,c);e=s.getSnapshotBeforeUpdate(je,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){it(l,l.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Sd(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Sd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Vt=e;break}Vt=t.return}}function km(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:pa(e,l),s&4&&Kr(5,l);break;case 1:if(pa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){it(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){it(l,l.return,b)}}s&64&&gm(l),s&512&&Xr(l,l.return);break;case 3:if(pa(e,l),s&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{ip(e,t)}catch(b){it(l,l.return,b)}}break;case 27:t===null&&s&4&&jm(l);case 26:case 5:pa(e,l),t===null&&s&4&&ym(l),s&512&&Xr(l,l.return);break;case 12:pa(e,l);break;case 31:pa(e,l),s&4&&Nm(e,l);break;case 13:pa(e,l),s&4&&Em(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Zy.bind(null,l),v1(e,l))));break;case 22:if(s=l.memoizedState!==null||ua,!s){t=t!==null&&t.memoizedState!==null||Dt,c=ua;var u=Dt;ua=s,(Dt=t)&&!u?ma(e,l,(l.subtreeFlags&8772)!==0):pa(e,l),ua=c,Dt=u}break;case 30:break;default:pa(e,l)}}function wm(e){var t=e.alternate;t!==null&&(e.alternate=null,wm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Eo(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 vt=null,on=!1;function fa(e,t,l){for(l=l.child;l!==null;)Cm(e,t,l),l=l.sibling}function Cm(e,t,l){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(Zn,l)}catch{}switch(l.tag){case 26:Dt||Fn(l,t),fa(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Dt||Fn(l,t);var s=vt,c=on;Ia(l.type)&&(vt=l.stateNode,on=!1),fa(e,t,l),rs(l.stateNode),vt=s,on=c;break;case 5:Dt||Fn(l,t);case 6:if(s=vt,c=on,vt=null,fa(e,t,l),vt=s,on=c,vt!==null)if(on)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(u){it(l,t,u)}else try{vt.removeChild(l.stateNode)}catch(u){it(l,t,u)}break;case 18:vt!==null&&(on?(e=vt,gh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):gh(vt,l.stateNode));break;case 4:s=vt,c=on,vt=l.stateNode.containerInfo,on=!0,fa(e,t,l),vt=s,on=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),Dt||Ma(4,l,t),fa(e,t,l);break;case 1:Dt||(Fn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&vm(l,t,s)),fa(e,t,l);break;case 21:fa(e,t,l);break;case 22:Dt=(s=Dt)||l.memoizedState!==null,fa(e,t,l),Dt=s;break;default:fa(e,t,l)}}function Nm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){it(t,t.return,l)}}}function Em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){it(t,t.return,l)}}function Gy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sm),t;default:throw Error(o(435,e.tag))}}function bi(e,t){var l=Gy(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Jy.bind(null,e,s);s.then(c,c)}})}function cn(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],u=e,b=t,N=b;e:for(;N!==null;){switch(N.tag){case 27:if(Ia(N.type)){vt=N.stateNode,on=!1;break e}break;case 5:vt=N.stateNode,on=!1;break e;case 3:case 4:vt=N.stateNode.containerInfo,on=!0;break e}N=N.return}if(vt===null)throw Error(o(160));Cm(u,b,c),vt=null,on=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tm(t,e),t=t.sibling}var Vn=null;function Tm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:cn(t,e),dn(e),s&4&&(Ma(3,e,e.return),Kr(3,e),Ma(5,e,e.return));break;case 1:cn(t,e),dn(e),s&512&&(Dt||l===null||Fn(l,l.return)),s&64&&ua&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=Vn;if(cn(t,e),dn(e),s&512&&(Dt||l===null||Fn(l,l.return)),s&4){var u=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":u=c.getElementsByTagName("title")[0],(!u||u[kr]||u[Gt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),Wt(u,s,l),u[Gt]=e,Ut(u),s=u;break e;case"link":var b=Th("link","href",c).get(s+(l.href||""));if(b){for(var N=0;N<b.length;N++)if(u=b[N],u.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&u.getAttribute("rel")===(l.rel==null?null:l.rel)&&u.getAttribute("title")===(l.title==null?null:l.title)&&u.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(N,1);break t}}u=c.createElement(s),Wt(u,s,l),c.head.appendChild(u);break;case"meta":if(b=Th("meta","content",c).get(s+(l.content||""))){for(N=0;N<b.length;N++)if(u=b[N],u.getAttribute("content")===(l.content==null?null:""+l.content)&&u.getAttribute("name")===(l.name==null?null:l.name)&&u.getAttribute("property")===(l.property==null?null:l.property)&&u.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&u.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(N,1);break t}}u=c.createElement(s),Wt(u,s,l),c.head.appendChild(u);break;default:throw Error(o(468,s))}u[Gt]=e,Ut(u),s=u}e.stateNode=s}else Rh(c,e.type,e.stateNode);else e.stateNode=Eh(c,s,e.memoizedProps);else u!==s?(u===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):u.count--,s===null?Rh(c,e.type,e.stateNode):Eh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,l.memoizedProps)}break;case 27:cn(t,e),dn(e),s&512&&(Dt||l===null||Fn(l,l.return)),l!==null&&s&4&&Wc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(cn(t,e),dn(e),s&512&&(Dt||l===null||Fn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(je){it(e,e.return,je)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Wc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Qc=!0);break;case 6:if(cn(t,e),dn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(je){it(e,e.return,je)}}break;case 3:if(Oi=null,c=Vn,Vn=Di(t.containerInfo),cn(t,e),Vn=c,dn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(je){it(e,e.return,je)}Qc&&(Qc=!1,Rm(e));break;case 4:s=Vn,Vn=Di(e.stateNode.containerInfo),cn(t,e),dn(e),Vn=s;break;case 12:cn(t,e),dn(e);break;case 31:cn(t,e),dn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 13:cn(t,e),dn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Si=lt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=ua,ne=Dt;if(ua=K||c,Dt=ne||H,cn(t,e),Dt=ne,ua=K,dn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||ua||Dt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(u=H.stateNode,c)b=u.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{N=H.stateNode;var se=H.memoizedProps.style,X=se!=null&&se.hasOwnProperty("display")?se.display:null;N.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(je){it(H,H.return,je)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(je){it(H,H.return,je)}}}else if(t.tag===18){if(l===null){H=t;try{var ee=H.stateNode;c?vh(ee,!0):vh(H.stateNode,!1)}catch(je){it(H,H.return,je)}}}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}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,bi(e,l))));break;case 19:cn(t,e),dn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 30:break;case 21:break;default:cn(t,e),dn(e)}}function dn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(bm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,u=Kc(e);yi(e,u,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var N=Kc(e);yi(e,N,b);break;case 3:case 4:var H=l.stateNode.containerInfo,K=Kc(e);Xc(e,K,H);break;default:throw Error(o(161))}}catch(ne){it(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)km(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Fn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&vm(t,t.return,l),ml(t);break;case 27:rs(t.stateNode);case 26:case 5:Fn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function ma(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,b=u.flags;switch(u.tag){case 0:case 11:case 15:ma(c,u,l),Kr(4,u);break;case 1:if(ma(c,u,l),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(K){it(s,s.return,K)}if(s=u,c=s.updateQueue,c!==null){var N=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)sp(H[c],N)}catch(K){it(s,s.return,K)}}l&&b&64&&gm(u),Xr(u,u.return);break;case 27:jm(u);case 26:case 5:ma(c,u,l),l&&s===null&&b&4&&ym(u),Xr(u,u.return);break;case 12:ma(c,u,l);break;case 31:ma(c,u,l),l&&b&4&&Nm(c,u);break;case 13:ma(c,u,l),l&&b&4&&Em(c,u);break;case 22:u.memoizedState===null&&ma(c,u,l),Xr(u,u.return);break;case 30:break;default:ma(c,u,l)}t=t.sibling}}function Zc(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&&Or(l))}function Jc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Or(e))}function $n(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Am(e,t,l,s),t=t.sibling}function Am(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:$n(e,t,l,s),c&2048&&Kr(9,t);break;case 1:$n(e,t,l,s);break;case 3:$n(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Or(e)));break;case 12:if(c&2048){$n(e,t,l,s),e=t.stateNode;try{var u=t.memoizedProps,b=u.id,N=u.onPostCommit;typeof N=="function"&&N(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){it(t,t.return,H)}}else $n(e,t,l,s);break;case 31:$n(e,t,l,s);break;case 13:$n(e,t,l,s);break;case 23:break;case 22:u=t.stateNode,b=t.alternate,t.memoizedState!==null?u._visibility&2?$n(e,t,l,s):Qr(e,t):u._visibility&2?$n(e,t,l,s):(u._visibility|=2,Kl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Zc(b,t);break;case 24:$n(e,t,l,s),c&2048&&Jc(t.alternate,t);break;default:$n(e,t,l,s)}}function Kl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,b=t,N=l,H=s,K=b.flags;switch(b.tag){case 0:case 11:case 15:Kl(u,b,N,H,c),Kr(8,b);break;case 23:break;case 22:var ne=b.stateNode;b.memoizedState!==null?ne._visibility&2?Kl(u,b,N,H,c):Qr(u,b):(ne._visibility|=2,Kl(u,b,N,H,c)),c&&K&2048&&Zc(b.alternate,b);break;case 24:Kl(u,b,N,H,c),c&&K&2048&&Jc(b.alternate,b);break;default:Kl(u,b,N,H,c)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Qr(l,s),c&2048&&Zc(s.alternate,s);break;case 24:Qr(l,s),c&2048&&Jc(s.alternate,s);break;default:Qr(l,s)}t=t.sibling}}var Zr=8192;function Xl(e,t,l){if(e.subtreeFlags&Zr)for(e=e.child;e!==null;)Mm(e,t,l),e=e.sibling}function Mm(e,t,l){switch(e.tag){case 26:Xl(e,t,l),e.flags&Zr&&e.memoizedState!==null&&A1(l,Vn,e.memoizedState,e.memoizedProps);break;case 5:Xl(e,t,l);break;case 3:case 4:var s=Vn;Vn=Di(e.stateNode.containerInfo),Xl(e,t,l),Vn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Zr,Zr=16777216,Xl(e,t,l),Zr=s):Xl(e,t,l));break;default:Xl(e,t,l)}}function zm(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 Jr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Vt=s,Dm(s,e)}zm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lm(e),e=e.sibling}function Lm(e){switch(e.tag){case 0:case 11:case 15:Jr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Jr(e);break;case 12:Jr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ji(e)):Jr(e);break;default:Jr(e)}}function ji(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Vt=s,Dm(s,e)}zm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),ji(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ji(t));break;default:ji(t)}e=e.sibling}}function Dm(e,t){for(;Vt!==null;){var l=Vt;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Or(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,Vt=s;else e:for(l=e;Vt!==null;){s=Vt;var c=s.sibling,u=s.return;if(wm(s),s===l){Vt=null;break e}if(c!==null){c.return=u,Vt=c;break e}Vt=u}}}var qy={getCacheForType:function(e){var t=Yt(Mt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Yt(Mt).controller.signal}},Yy=typeof WeakMap=="function"?WeakMap:Map,tt=0,ft=null,qe=null,Fe=0,st=0,gn=null,za=!1,Ql=!1,ed=!1,ha=0,Ct=0,La=0,hl=0,td=0,vn=0,Zl=0,es=null,un=null,nd=!1,Si=0,_m=0,ki=1/0,wi=null,Da=null,Ot=0,_a=null,Jl=null,xa=0,ad=0,ld=null,Om=null,ts=0,rd=null;function yn(){return(tt&2)!==0&&Fe!==0?Fe&-Fe:R.T!==null?ud():Qu()}function Bm(){if(vn===0)if((Fe&536870912)===0||Ke){var e=Ht;Ht<<=1,(Ht&3932160)===0&&(Ht=262144),vn=e}else vn=536870912;return e=hn.current,e!==null&&(e.flags|=32),vn}function fn(e,t,l){(e===ft&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Fe,vn,!1)),Sr(e,l),((tt&2)===0||e!==ft)&&(e===ft&&((tt&2)===0&&(hl|=l),Ct===4&&Oa(e,Fe,vn,!1)),Wn(e))}function Im(e,t,l){if((tt&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Cn(e,t),c=s?Ky(e,t):id(e,t,!0),u=s;do{if(c===0){Ql&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,u&&!Fy(l)){c=id(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var N=e;c=es;var H=N.current.memoizedState.isDehydrated;if(H&&(er(N,b).flags|=256),b=id(N,b,!1),b!==2){if(ed&&!H){N.errorRecoveryDisabledLanes|=u,hl|=u,c=4;break e}u=un,un=c,u!==null&&(un===null?un=u:un.push.apply(un,u))}c=b}if(u=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,u=c,u){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!za);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=Si+300-lt(),10<c)){if(Oa(s,t,vn,!za),jr(s,0,!0)!==0)break e;xa=t,s.timeoutHandle=hh(Hm.bind(null,s,l,un,wi,nd,t,vn,hl,Zl,za,u,"Throttled",-0,0),c);break e}Hm(s,l,un,wi,nd,t,vn,hl,Zl,za,u,null,-0,0)}}break}while(!0);Wn(e)}function Hm(e,t,l,s,c,u,b,N,H,K,ne,se,X,ee){if(e.timeoutHandle=-1,se=t.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ta},Mm(t,u,se);var je=(u&62914560)===u?Si-lt():(u&4194048)===u?_m-lt():0;if(je=M1(se,je),je!==null){xa=u,e.cancelPendingCommit=je(Fm.bind(null,e,t,u,l,s,c,b,N,H,ne,se,null,X,ee)),Oa(e,u,b,!K);return}}Fm(e,t,u,l,s,c,b,N,H)}function Fy(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 s=0;s<l.length;s++){var c=l[s],u=c.getSnapshot;c=c.value;try{if(!pn(u(),c))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 Oa(e,t,l,s){t&=~td,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-jt(c),b=1<<u;s[u]=-1,c&=~b}l!==0&&Wu(e,l,t)}function Ci(){return(tt&6)===0?(ns(0),!1):!0}function sd(){if(qe!==null){if(st===0)var e=qe.return;else e=qe,ra=sl=null,Sc(e),Gl=null,Ir=0,e=qe;for(;e!==null;)xm(e.alternate,e),e=e.return;qe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,p1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),xa=0,sd(),ft=e,qe=l=aa(e.current,null),Fe=t,st=0,gn=null,za=!1,Ql=Cn(e,t),ed=!1,Zl=vn=td=hl=La=Ct=0,un=es=null,nd=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-jt(s),u=1<<c;t|=e[c],s&=~u}return ha=t,Ys(),l}function Um(e,t){He=null,R.H=Yr,t===Pl||t===ei?(t=np(),st=3):t===dc?(t=np(),st=4):st=t===Ic?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,gn=t,qe===null&&(Ct=1,mi(e,Rn(t,e.current)))}function Vm(){var e=hn.current;return e===null?!0:(Fe&4194048)===Fe?Ln===null:(Fe&62914560)===Fe||(Fe&536870912)!==0?e===Ln:!1}function $m(){var e=R.H;return R.H=Yr,e===null?Yr:e}function Pm(){var e=R.A;return R.A=qy,e}function Ni(){Ct=4,za||(Fe&4194048)!==Fe&&hn.current!==null||(Ql=!0),(La&134217727)===0&&(hl&134217727)===0||ft===null||Oa(ft,Fe,vn,!1)}function id(e,t,l){var s=tt;tt|=2;var c=$m(),u=Pm();(ft!==e||Fe!==t)&&(wi=null,er(e,t)),t=!1;var b=Ct;e:do try{if(st!==0&&qe!==null){var N=qe,H=gn;switch(st){case 8:sd(),b=6;break e;case 3:case 2:case 9:case 6:hn.current===null&&(t=!0);var K=st;if(st=0,gn=null,tr(e,N,H,K),l&&Ql){b=0;break e}break;default:K=st,st=0,gn=null,tr(e,N,H,K)}}Wy(),b=Ct;break}catch(ne){Um(e,ne)}while(!0);return t&&e.shellSuspendCounter++,ra=sl=null,tt=s,R.H=c,R.A=u,qe===null&&(ft=null,Fe=0,Ys()),b}function Wy(){for(;qe!==null;)Gm(qe)}function Ky(e,t){var l=tt;tt|=2;var s=$m(),c=Pm();ft!==e||Fe!==t?(wi=null,ki=lt()+500,er(e,t)):Ql=Cn(e,t);e:do try{if(st!==0&&qe!==null){t=qe;var u=gn;t:switch(st){case 1:st=0,gn=null,tr(e,t,u,1);break;case 2:case 9:if(ep(u)){st=0,gn=null,qm(t);break}t=function(){st!==2&&st!==9||ft!==e||(st=7),Wn(e)},u.then(t,t);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:ep(u)?(st=0,gn=null,qm(t)):(st=0,gn=null,tr(e,t,u,7));break;case 5:var b=null;switch(qe.tag){case 26:b=qe.memoizedState;case 5:case 27:var N=qe;if(b?Ah(b):N.stateNode.complete){st=0,gn=null;var H=N.sibling;if(H!==null)qe=H;else{var K=N.return;K!==null?(qe=K,Ei(K)):qe=null}break t}}st=0,gn=null,tr(e,t,u,5);break;case 6:st=0,gn=null,tr(e,t,u,6);break;case 8:sd(),Ct=6;break e;default:throw Error(o(462))}}Xy();break}catch(ne){Um(e,ne)}while(!0);return ra=sl=null,R.H=s,R.A=c,tt=l,qe!==null?0:(ft=null,Fe=0,Ys(),Ct)}function Xy(){for(;qe!==null&&!$t();)Gm(qe)}function Gm(e){var t=mm(e.alternate,e,ha);e.memoizedProps=e.pendingProps,t===null?Ei(e):qe=t}function qm(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=om(l,t,t.pendingProps,t.type,void 0,Fe);break;case 11:t=om(l,t,t.pendingProps,t.type.render,t.ref,Fe);break;case 5:Sc(t);default:xm(l,t),t=qe=Pf(t,ha),t=mm(l,t,ha)}e.memoizedProps=e.pendingProps,t===null?Ei(e):qe=t}function tr(e,t,l,s){ra=sl=null,Sc(t),Gl=null,Ir=0;var c=t.return;try{if(Iy(e,c,t,l,Fe)){Ct=1,mi(e,Rn(l,e.current)),qe=null;return}}catch(u){if(c!==null)throw qe=c,u;Ct=1,mi(e,Rn(l,e.current)),qe=null;return}t.flags&32768?(Ke||s===1?e=!0:Ql||(Fe&536870912)!==0?e=!1:(za=e=!0,(s===2||s===9||s===3||s===6)&&(s=hn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Ym(t,e)):Ei(t)}function Ei(e){var t=e;do{if((t.flags&32768)!==0){Ym(t,za);return}e=t.return;var l=Vy(t.alternate,t,ha);if(l!==null){qe=l;return}if(t=t.sibling,t!==null){qe=t;return}qe=t=e}while(t!==null);Ct===0&&(Ct=5)}function Ym(e,t){do{var l=$y(e.alternate,e);if(l!==null){l.flags&=32767,qe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){qe=e;return}qe=e=l}while(e!==null);Ct=6,qe=null}function Fm(e,t,l,s,c,u,b,N,H){e.cancelPendingCommit=null;do Ti();while(Ot!==0);if((tt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(u=t.lanes|t.childLanes,u|=Ko,Rv(e,l,u,b,N,H),e===ft&&(qe=ft=null,Fe=0),Jl=t,_a=e,xa=l,ad=u,ld=c,Om=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,e1(Le,function(){return Zm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=R.T,R.T=null,c=I.p,I.p=2,b=tt,tt|=4;try{Py(e,t,l)}finally{tt=b,I.p=c,R.T=s}}Ot=1,Wm(),Km(),Xm()}}function Wm(){if(Ot===1){Ot=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=R.T,R.T=null;var s=I.p;I.p=2;var c=tt;tt|=4;try{Tm(t,e);var u=yd,b=Df(e.containerInfo),N=u.focusedElem,H=u.selectionRange;if(b!==N&&N&&N.ownerDocument&&Lf(N.ownerDocument.documentElement,N)){if(H!==null&&Go(N)){var K=H.start,ne=H.end;if(ne===void 0&&(ne=K),"selectionStart"in N)N.selectionStart=K,N.selectionEnd=Math.min(ne,N.value.length);else{var se=N.ownerDocument||document,X=se&&se.defaultView||window;if(X.getSelection){var ee=X.getSelection(),je=N.textContent.length,Ae=Math.min(H.start,je),dt=H.end===void 0?Ae:Math.min(H.end,je);!ee.extend&&Ae>dt&&(b=dt,dt=Ae,Ae=b);var G=zf(N,Ae),$=zf(N,dt);if(G&&$&&(ee.rangeCount!==1||ee.anchorNode!==G.node||ee.anchorOffset!==G.offset||ee.focusNode!==$.node||ee.focusOffset!==$.offset)){var F=se.createRange();F.setStart(G.node,G.offset),ee.removeAllRanges(),Ae>dt?(ee.addRange(F),ee.extend($.node,$.offset)):(F.setEnd($.node,$.offset),ee.addRange(F))}}}}for(se=[],ee=N;ee=ee.parentNode;)ee.nodeType===1&&se.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<se.length;N++){var le=se[N];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Ui=!!vd,yd=vd=null}finally{tt=c,I.p=s,R.T=l}}e.current=t,Ot=2}}function Km(){if(Ot===2){Ot=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=R.T,R.T=null;var s=I.p;I.p=2;var c=tt;tt|=4;try{km(e,t.alternate,t)}finally{tt=c,I.p=s,R.T=l}}Ot=3}}function Xm(){if(Ot===4||Ot===3){Ot=0,Pt();var e=_a,t=Jl,l=xa,s=Om;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ot=5:(Ot=0,Jl=_a=null,Qm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Da=null),Co(l),t=t.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(Zn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=R.T,c=I.p,I.p=2,R.T=null;try{for(var u=e.onRecoverableError,b=0;b<s.length;b++){var N=s[b];u(N.value,{componentStack:N.stack})}}finally{R.T=t,I.p=c}}(xa&3)!==0&&Ti(),Wn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===rd?ts++:(ts=0,rd=e):ts=0,ns(0)}}function Qm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Or(t)))}function Ti(){return Wm(),Km(),Xm(),Zm()}function Zm(){if(Ot!==5)return!1;var e=_a,t=ad;ad=0;var l=Co(xa),s=R.T,c=I.p;try{I.p=32>l?32:l,R.T=null,l=ld,ld=null;var u=_a,b=xa;if(Ot=0,Jl=_a=null,xa=0,(tt&6)!==0)throw Error(o(331));var N=tt;if(tt|=4,Lm(u.current),Am(u,u.current,b,l),tt=N,ns(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(Zn,u)}catch{}return!0}finally{I.p=c,R.T=s,Qm(e,t)}}function Jm(e,t,l){t=Rn(l,t),t=Bc(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(Sr(e,2),Wn(e))}function it(e,t,l){if(e.tag===3)Jm(e,e,l);else for(;t!==null;){if(t.tag===3){Jm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Da===null||!Da.has(s))){e=Rn(l,e),l=em(2),s=Ta(t,l,2),s!==null&&(tm(l,s,t,e),Sr(s,2),Wn(s));break}}t=t.return}}function od(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new Yy;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(ed=!0,c.add(l),e=Qy.bind(null,e,t,l),t.then(e,e))}function Qy(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ft===e&&(Fe&l)===l&&(Ct===4||Ct===3&&(Fe&62914560)===Fe&&300>lt()-Si?(tt&2)===0&&er(e,0):td|=l,Zl===Fe&&(Zl=0)),Wn(e)}function eh(e,t){t===0&&(t=Fu()),e=al(e,t),e!==null&&(Sr(e,t),Wn(e))}function Zy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),eh(e,l)}function Jy(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),eh(e,l)}function e1(e,t){return Qe(e,t)}var Ri=null,nr=null,cd=!1,Ai=!1,dd=!1,Ba=0;function Wn(e){e!==nr&&e.next===null&&(nr===null?Ri=nr=e:nr=nr.next=e),Ai=!0,cd||(cd=!0,n1())}function ns(e,t){if(!dd&&Ai){dd=!0;do for(var l=!1,s=Ri;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var b=s.suspendedLanes,N=s.pingedLanes;u=(1<<31-jt(42|e)+1)-1,u&=c&~(b&~N),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,lh(s,u))}else u=Fe,u=jr(s,s===ft?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Cn(s,u)||(l=!0,lh(s,u));s=s.next}while(l);dd=!1}}function t1(){th()}function th(){Ai=cd=!1;var e=0;Ba!==0&&f1()&&(e=Ba);for(var t=lt(),l=null,s=Ri;s!==null;){var c=s.next,u=nh(s,t);u===0?(s.next=null,l===null?Ri=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(u&3)!==0)&&(Ai=!0)),s=c}Ot!==0&&Ot!==5||ns(e),Ba!==0&&(Ba=0)}function nh(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var b=31-jt(u),N=1<<b,H=c[b];H===-1?((N&l)===0||(N&s)!==0)&&(c[b]=So(N,t)):H<=t&&(e.expiredLanes|=N),u&=~N}if(t=ft,l=Fe,l=jr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(st===2||st===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&at(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Cn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&at(s),Co(l)){case 2:case 8:l=At;break;case 32:l=Le;break;case 268435456:l=Kt;break;default:l=Le}return s=ah.bind(null,e),l=Qe(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&at(s),e.callbackPriority=2,e.callbackNode=null,2}function ah(e,t){if(Ot!==0&&Ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ti()&&e.callbackNode!==l)return null;var s=Fe;return s=jr(e,e===ft?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Im(e,s,t),nh(e,lt()),e.callbackNode!=null&&e.callbackNode===l?ah.bind(null,e):null)}function lh(e,t){if(Ti())return null;Im(e,t,!0)}function n1(){m1(function(){(tt&6)!==0?Qe(ye,t1):th()})}function ud(){if(Ba===0){var e=Vl;e===0&&(e=$e,$e<<=1,($e&261888)===0&&($e=256)),Ba=e}return Ba}function rh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Is(""+e)}function sh(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 a1(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var u=rh((c[rn]||null).action),b=s.submitter;b&&(t=(t=b[rn]||null)?rh(t.formAction):b.getAttribute("formAction"),t!==null&&(u=t,b=null));var N=new $s("action","action",null,s,c);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var H=b?sh(c,b):new FormData(c);Mc(l,{pending:!0,data:H,method:c.method,action:u},null,H)}}else typeof u=="function"&&(N.preventDefault(),H=b?sh(c,b):new FormData(c),Mc(l,{pending:!0,data:H,method:c.method,action:u},u,H))},currentTarget:c}]})}}for(var fd=0;fd<Wo.length;fd++){var pd=Wo[fd],l1=pd.toLowerCase(),r1=pd[0].toUpperCase()+pd.slice(1);Un(l1,"on"+r1)}Un(Bf,"onAnimationEnd"),Un(If,"onAnimationIteration"),Un(Hf,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(jy,"onTransitionRun"),Un(Sy,"onTransitionStart"),Un(ky,"onTransitionCancel"),Un(Uf,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="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(" "),s1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(as));function ih(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var b=s.length-1;0<=b;b--){var N=s[b],H=N.instance,K=N.currentTarget;if(N=N.listener,H!==u&&c.isPropagationStopped())break e;u=N,c.currentTarget=K;try{u(c)}catch(ne){qs(ne)}c.currentTarget=null,u=H}else for(b=0;b<s.length;b++){if(N=s[b],H=N.instance,K=N.currentTarget,N=N.listener,H!==u&&c.isPropagationStopped())break e;u=N,c.currentTarget=K;try{u(c)}catch(ne){qs(ne)}c.currentTarget=null,u=H}}}}function Ye(e,t){var l=t[No];l===void 0&&(l=t[No]=new Set);var s=e+"__bubble";l.has(s)||(oh(t,e,2,!1),l.add(s))}function md(e,t,l){var s=0;t&&(s|=4),oh(l,e,s,t)}var Mi="_reactListening"+Math.random().toString(36).slice(2);function hd(e){if(!e[Mi]){e[Mi]=!0,ef.forEach(function(l){l!=="selectionchange"&&(s1.has(l)||md(l,!1,e),md(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mi]||(t[Mi]=!0,md("selectionchange",!1,t))}}function oh(e,t,l,s){switch(Bh(t)){case 2:var c=D1;break;case 8:c=_1;break;default:c=Ad}l=c.bind(null,t,l,e),c=void 0,!_o||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function xd(e,t,l,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var N=s.stateNode.containerInfo;if(N===c)break;if(b===4)for(b=s.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;N!==null;){if(b=wl(N),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){s=u=b;continue e}N=N.parentNode}}s=s.return}pf(function(){var K=u,ne=Lo(l),se=[];e:{var X=Vf.get(e);if(X!==void 0){var ee=$s,je=e;switch(e){case"keypress":if(Us(l)===0)break e;case"keydown":case"keyup":ee=Jv;break;case"focusin":je="focus",ee=Ho;break;case"focusout":je="blur",ee=Ho;break;case"beforeblur":case"afterblur":ee=Ho;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":ee=xf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Vv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=ny;break;case Bf:case If:case Hf:ee=Gv;break;case Uf:ee=ly;break;case"scroll":case"scrollend":ee=Hv;break;case"wheel":ee=sy;break;case"copy":case"cut":case"paste":ee=Yv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=vf;break;case"toggle":case"beforetoggle":ee=oy}var Ae=(t&4)!==0,dt=!Ae&&(e==="scroll"||e==="scrollend"),G=Ae?X!==null?X+"Capture":null:X;Ae=[];for(var $=K,F;$!==null;){var le=$;if(F=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||F===null||G===null||(le=Cr($,G),le!=null&&Ae.push(ls($,le,F))),dt)break;$=$.return}0<Ae.length&&(X=new ee(X,je,null,l,ne),se.push({event:X,listeners:Ae}))}}if((t&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",X&&l!==zo&&(je=l.relatedTarget||l.fromElement)&&(wl(je)||je[kl]))break e;if((ee||X)&&(X=ne.window===ne?ne:(X=ne.ownerDocument)?X.defaultView||X.parentWindow:window,ee?(je=l.relatedTarget||l.toElement,ee=K,je=je?wl(je):null,je!==null&&(dt=p(je),Ae=je.tag,je!==dt||Ae!==5&&Ae!==27&&Ae!==6)&&(je=null)):(ee=null,je=K),ee!==je)){if(Ae=xf,le="onMouseLeave",G="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=vf,le="onPointerLeave",G="onPointerEnter",$="pointer"),dt=ee==null?X:wr(ee),F=je==null?X:wr(je),X=new Ae(le,$+"leave",ee,l,ne),X.target=dt,X.relatedTarget=F,le=null,wl(ne)===K&&(Ae=new Ae(G,$+"enter",je,l,ne),Ae.target=F,Ae.relatedTarget=dt,le=Ae),dt=le,ee&&je)t:{for(Ae=i1,G=ee,$=je,F=0,le=G;le;le=Ae(le))F++;le=0;for(var Re=$;Re;Re=Ae(Re))le++;for(;0<F-le;)G=Ae(G),F--;for(;0<le-F;)$=Ae($),le--;for(;F--;){if(G===$||$!==null&&G===$.alternate){Ae=G;break t}G=Ae(G),$=Ae($)}Ae=null}else Ae=null;ee!==null&&ch(se,X,ee,Ae,!1),je!==null&&dt!==null&&ch(se,dt,je,Ae,!0)}}e:{if(X=K?wr(K):window,ee=X.nodeName&&X.nodeName.toLowerCase(),ee==="select"||ee==="input"&&X.type==="file")var Ze=Nf;else if(wf(X))if(Ef)Ze=vy;else{Ze=xy;var ke=hy}else ee=X.nodeName,!ee||ee.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?K&&Mo(K.elementType)&&(Ze=Nf):Ze=gy;if(Ze&&(Ze=Ze(e,K))){Cf(se,Ze,l,ne);break e}ke&&ke(e,X,K),e==="focusout"&&K&&X.type==="number"&&K.memoizedProps.value!=null&&Ao(X,"number",X.value)}switch(ke=K?wr(K):window,e){case"focusin":(wf(ke)||ke.contentEditable==="true")&&(Ll=ke,qo=K,Lr=null);break;case"focusout":Lr=qo=Ll=null;break;case"mousedown":Yo=!0;break;case"contextmenu":case"mouseup":case"dragend":Yo=!1,_f(se,l,ne);break;case"selectionchange":if(by)break;case"keydown":case"keyup":_f(se,l,ne)}var Ue;if(Vo)e:{switch(e){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else zl?Sf(e,l)&&(We="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(We="onCompositionStart");We&&(yf&&l.locale!=="ko"&&(zl||We!=="onCompositionStart"?We==="onCompositionEnd"&&zl&&(Ue=mf()):(ja=ne,Oo="value"in ja?ja.value:ja.textContent,zl=!0)),ke=zi(K,We),0<ke.length&&(We=new gf(We,e,null,l,ne),se.push({event:We,listeners:ke}),Ue?We.data=Ue:(Ue=kf(l),Ue!==null&&(We.data=Ue)))),(Ue=dy?uy(e,l):fy(e,l))&&(We=zi(K,"onBeforeInput"),0<We.length&&(ke=new gf("onBeforeInput","beforeinput",null,l,ne),se.push({event:ke,listeners:We}),ke.data=Ue)),a1(se,e,K,l,ne)}ih(se,t)})}function ls(e,t,l){return{instance:e,listener:t,currentTarget:l}}function zi(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Cr(e,l),c!=null&&s.unshift(ls(e,c,u)),c=Cr(e,t),c!=null&&s.push(ls(e,c,u))),e.tag===3)return s;e=e.return}return[]}function i1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ch(e,t,l,s,c){for(var u=t._reactName,b=[];l!==null&&l!==s;){var N=l,H=N.alternate,K=N.stateNode;if(N=N.tag,H!==null&&H===s)break;N!==5&&N!==26&&N!==27||K===null||(H=K,c?(K=Cr(l,u),K!=null&&b.unshift(ls(l,K,H))):c||(K=Cr(l,u),K!=null&&b.push(ls(l,K,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var o1=/\r\n?/g,c1=/\u0000|\uFFFD/g;function dh(e){return(typeof e=="string"?e:""+e).replace(o1,`
|
|
50
|
-
`).replace(c1,"")}function uh(e,t){return t=dh(t),dh(e)===t}function ct(e,t,l,s,c,u){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":Os(e,"class",s);break;case"tabIndex":Os(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(e,l,s);break;case"style":uf(e,s,u);break;case"data":if(t!=="object"){Os(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="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 u=="function"&&(l==="formAction"?(t!=="input"&&ct(e,t,"name",c.name,c,null),ct(e,t,"formEncType",c.formEncType,c,null),ct(e,t,"formMethod",c.formMethod,c,null),ct(e,t,"formTarget",c.formTarget,c,null)):(ct(e,t,"encType",c.encType,c,null),ct(e,t,"method",c.method,c,null),ct(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ta);break;case"onScroll":s!=null&&Ye("scroll",e);break;case"onScrollEnd":s!=null&&Ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Is(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),_s(e,"popover",s);break;case"xlinkActuate":ea(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ea(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ea(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ea(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ea(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ea(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ea(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ea(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ea(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_s(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Bv.get(l)||l,_s(e,l,s))}}function gd(e,t,l,s,c,u){switch(l){case"style":uf(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&Ye("scroll",e);break;case"onScrollEnd":s!=null&&Ye("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tf.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),u=e[rn]||null,u=u!=null?u[l]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof s=="function")){typeof u!="function"&&u!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):_s(e,l,s)}}}function Wt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var s=!1,c=!1,u;for(u in l)if(l.hasOwnProperty(u)){var b=l[u];if(b!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,u,b,l,null)}}c&&ct(e,t,"srcSet",l.srcSet,l,null),s&&ct(e,t,"src",l.src,l,null);return;case"input":Ye("invalid",e);var N=u=b=c=null,H=null,K=null;for(s in l)if(l.hasOwnProperty(s)){var ne=l[s];if(ne!=null)switch(s){case"name":c=ne;break;case"type":b=ne;break;case"checked":H=ne;break;case"defaultChecked":K=ne;break;case"value":u=ne;break;case"defaultValue":N=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,t));break;default:ct(e,t,s,ne,l,null)}}sf(e,u,N,H,K,b,c,!1);return;case"select":Ye("invalid",e),s=b=u=null;for(c in l)if(l.hasOwnProperty(c)&&(N=l[c],N!=null))switch(c){case"value":u=N;break;case"defaultValue":b=N;break;case"multiple":s=N;default:ct(e,t,c,N,l,null)}t=u,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":Ye("invalid",e),u=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(N=l[b],N!=null))switch(b){case"value":s=N;break;case"defaultValue":c=N;break;case"children":u=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(o(91));break;default:ct(e,t,b,N,l,null)}cf(e,s,c,u);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:ct(e,t,H,s,l,null)}return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(s=0;s<as.length;s++)Ye(as[s],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("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(K in l)if(l.hasOwnProperty(K)&&(s=l[K],s!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,K,s,l,null)}return;default:if(Mo(t)){for(ne in l)l.hasOwnProperty(ne)&&(s=l[ne],s!==void 0&&gd(e,t,ne,s,l,void 0));return}}for(N in l)l.hasOwnProperty(N)&&(s=l[N],s!=null&&ct(e,t,N,s,l,null))}function d1(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,b=null,N=null,H=null,K=null,ne=null;for(ee in l){var se=l[ee];if(l.hasOwnProperty(ee)&&se!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":H=se;default:s.hasOwnProperty(ee)||ct(e,t,ee,null,s,se)}}for(var X in s){var ee=s[X];if(se=l[X],s.hasOwnProperty(X)&&(ee!=null||se!=null))switch(X){case"type":u=ee;break;case"name":c=ee;break;case"checked":K=ee;break;case"defaultChecked":ne=ee;break;case"value":b=ee;break;case"defaultValue":N=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:ee!==se&&ct(e,t,X,ee,s,se)}}Ro(e,b,N,H,K,ne,u,c);return;case"select":ee=b=N=X=null;for(u in l)if(H=l[u],l.hasOwnProperty(u)&&H!=null)switch(u){case"value":break;case"multiple":ee=H;default:s.hasOwnProperty(u)||ct(e,t,u,null,s,H)}for(c in s)if(u=s[c],H=l[c],s.hasOwnProperty(c)&&(u!=null||H!=null))switch(c){case"value":X=u;break;case"defaultValue":N=u;break;case"multiple":b=u;default:u!==H&&ct(e,t,c,u,s,H)}t=N,l=b,s=ee,X!=null?Tl(e,!!l,X,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":ee=X=null;for(N in l)if(c=l[N],l.hasOwnProperty(N)&&c!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:ct(e,t,N,null,s,c)}for(b in s)if(c=s[b],u=l[b],s.hasOwnProperty(b)&&(c!=null||u!=null))switch(b){case"value":X=c;break;case"defaultValue":ee=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==u&&ct(e,t,b,c,s,u)}of(e,X,ee);return;case"option":for(var je in l)if(X=l[je],l.hasOwnProperty(je)&&X!=null&&!s.hasOwnProperty(je))switch(je){case"selected":e.selected=!1;break;default:ct(e,t,je,null,s,X)}for(H in s)if(X=s[H],ee=l[H],s.hasOwnProperty(H)&&X!==ee&&(X!=null||ee!=null))switch(H){case"selected":e.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:ct(e,t,H,X,s,ee)}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 Ae in l)X=l[Ae],l.hasOwnProperty(Ae)&&X!=null&&!s.hasOwnProperty(Ae)&&ct(e,t,Ae,null,s,X);for(K in s)if(X=s[K],ee=l[K],s.hasOwnProperty(K)&&X!==ee&&(X!=null||ee!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:ct(e,t,K,X,s,ee)}return;default:if(Mo(t)){for(var dt in l)X=l[dt],l.hasOwnProperty(dt)&&X!==void 0&&!s.hasOwnProperty(dt)&&gd(e,t,dt,void 0,s,X);for(ne in s)X=s[ne],ee=l[ne],!s.hasOwnProperty(ne)||X===ee||X===void 0&&ee===void 0||gd(e,t,ne,X,s,ee);return}}for(var G in l)X=l[G],l.hasOwnProperty(G)&&X!=null&&!s.hasOwnProperty(G)&&ct(e,t,G,null,s,X);for(se in s)X=s[se],ee=l[se],!s.hasOwnProperty(se)||X===ee||X==null&&ee==null||ct(e,t,se,X,s,ee)}function fh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],u=c.transferSize,b=c.initiatorType,N=c.duration;if(u&&N&&fh(b)){for(b=0,N=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],K=H.startTime;if(K>N)break;var ne=H.transferSize,se=H.initiatorType;ne&&fh(se)&&(H=H.responseEnd,b+=ne*(H<N?1:(N-K)/(H-K)))}if(--s,t+=8*(u+b)/(c.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 vd=null,yd=null;function Li(e){return e.nodeType===9?e:e.ownerDocument}function ph(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 mh(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 bd(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 jd=null;function f1(){var e=window.event;return e&&e.type==="popstate"?e===jd?!1:(jd=e,!0):(jd=null,!1)}var hh=typeof setTimeout=="function"?setTimeout:void 0,p1=typeof clearTimeout=="function"?clearTimeout:void 0,xh=typeof Promise=="function"?Promise:void 0,m1=typeof queueMicrotask=="function"?queueMicrotask:typeof xh<"u"?function(e){return xh.resolve(null).then(e).catch(h1)}:hh;function h1(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function gh(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")rs(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,rs(l);for(var u=l.firstChild;u;){var b=u.nextSibling,N=u.nodeName;u[kr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&u.rel.toLowerCase()==="stylesheet"||l.removeChild(u),u=b}}else l==="body"&&rs(e.ownerDocument.body);l=c}while(l);sr(t)}function vh(e,t){var l=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function Sd(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":Sd(l),Eo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function x1(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[kr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Dn(e.nextSibling),e===null)break}return null}function g1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Dn(e.nextSibling),e===null))return null;return e}function yh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Dn(e.nextSibling),e===null))return null;return e}function kd(e){return e.data==="$?"||e.data==="$~"}function wd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function v1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Dn(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 Cd=null;function bh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Dn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function jh(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 Sh(e,t,l){switch(t=Li(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function rs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Eo(e)}var _n=new Map,kh=new Set;function Di(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ga=I.d;I.d={f:y1,r:b1,D:j1,C:S1,L:k1,m:w1,X:N1,S:C1,M:E1};function y1(){var e=ga.f(),t=Ci();return e||t}function b1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?Up(t):ga.r(e)}var ar=typeof document>"u"?null:document;function wh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=En(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),kh.has(c)||(kh.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Wt(t,"link",e),Ut(t),s.head.appendChild(t)))}}function j1(e){ga.D(e),wh("dns-prefetch",e,null)}function S1(e,t){ga.C(e,t),wh("preconnect",e,t)}function k1(e,t,l){ga.L(e,t,l);var s=ar;if(s&&e&&t){var c='link[rel="preload"][as="'+En(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+En(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+En(l.imageSizes)+'"]')):c+='[href="'+En(e)+'"]';var u=c;switch(t){case"style":u=lr(e);break;case"script":u=rr(e)}_n.has(u)||(e=v({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),_n.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(ss(u))||t==="script"&&s.querySelector(is(u))||(t=s.createElement("link"),Wt(t,"link",e),Ut(t),s.head.appendChild(t)))}}function w1(e,t){ga.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+En(s)+'"][href="'+En(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=rr(e)}if(!_n.has(u)&&(e=v({rel:"modulepreload",href:e},t),_n.set(u,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(is(u)))return}s=l.createElement("link"),Wt(s,"link",e),Ut(s),l.head.appendChild(s)}}}function C1(e,t,l){ga.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,u=lr(e);t=t||"default";var b=c.get(u);if(!b){var N={loading:0,preload:null};if(b=s.querySelector(ss(u)))N.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},l),(l=_n.get(u))&&Nd(e,l);var H=b=s.createElement("link");Ut(H),Wt(H,"link",e),H._p=new Promise(function(K,ne){H.onload=K,H.onerror=ne}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,_i(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:N},c.set(u,b)}}}function N1(e,t){ga.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),u=s.get(c);u||(u=l.querySelector(is(c)),u||(e=v({src:e,async:!0},t),(t=_n.get(c))&&Ed(e,t),u=l.createElement("script"),Ut(u),Wt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function E1(e,t){ga.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),u=s.get(c);u||(u=l.querySelector(is(c)),u||(e=v({src:e,async:!0,type:"module"},t),(t=_n.get(c))&&Ed(e,t),u=l.createElement("script"),Ut(u),Wt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function Ch(e,t,l,s){var c=(c=xe.current)?Di(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var u=Nl(c).hoistableStyles,b=u.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,b),(u=c.querySelector(ss(e)))&&!u._p&&(b.instance=u,b.state.loading=5),_n.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},_n.set(e,l),u||T1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+En(e)+'"'}function ss(e){return'link[rel="stylesheet"]['+e+"]"}function Nh(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function T1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Wt(t,"link",l),Ut(t),e.head.appendChild(t))}function rr(e){return'[src="'+En(e)+'"]'}function is(e){return"script[async]"+e}function Eh(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+En(l.href)+'"]');if(s)return t.instance=s,Ut(s),s;var c=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ut(s),Wt(s,"style",c),_i(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var u=e.querySelector(ss(c));if(u)return t.state.loading|=4,t.instance=u,Ut(u),u;s=Nh(l),(c=_n.get(c))&&Nd(s,c),u=(e.ownerDocument||e).createElement("link"),Ut(u);var b=u;return b._p=new Promise(function(N,H){b.onload=N,b.onerror=H}),Wt(u,"link",s),t.state.loading|=4,_i(u,l.precedence,e),t.instance=u;case"script":return u=rr(l.src),(c=e.querySelector(is(u)))?(t.instance=c,Ut(c),c):(s=l,(c=_n.get(u))&&(s=v({},l),Ed(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ut(c),Wt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_i(s,l.precedence,e));return t.instance}function _i(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,u=c,b=0;b<s.length;b++){var N=s[b];if(N.dataset.precedence===t)u=N;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Nd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ed(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oi=null;function Th(e,t,l){if(Oi===null){var s=new Map,c=Oi=new Map;c.set(l,s)}else c=Oi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var u=l[c];if(!(u[kr]||u[Gt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var b=u.getAttribute(t)||"";b=e+b;var N=s.get(b);N?N.push(u):s.set(b,[u])}}return s}function Rh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function R1(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 Ah(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function A1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),u=t.querySelector(ss(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,Ut(u);return}u=t.ownerDocument||t,s=Nh(s),(c=_n.get(c))&&Nd(s,c),u=u.createElement("link"),Ut(u);var b=u;b._p=new Promise(function(N,H){b.onload=N,b.onerror=H}),Wt(u,"link",s),l.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Bi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Td=0;function M1(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Td===0&&(Td=62500*u1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Td?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ii=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ii=new Map,t.forEach(z1,e),Ii=null,Bi.call(e))}function z1(e,t){if(!(t.state.loading&4)){var l=Ii.get(e);if(l)var s=l.get(null);else{l=new Map,Ii.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var b=c[u];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),u=l.get(b)||s,u===s&&l.set(null,c),l.set(b,c),this.count++,s=Bi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var os={$$typeof:O,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function L1(e,t,l,s,c,u,b,N,H){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=ko(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ko(0),this.hiddenUpdates=ko(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Mh(e,t,l,s,c,u,b,N,H,K,ne,se){return e=new L1(e,t,l,b,H,K,ne,se,N),t=1,u===!0&&(t|=24),u=mn(3,null,null,t),e.current=u,u.stateNode=e,t=ic(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:l,cache:t},uc(u),e}function zh(e){return e?(e=Ol,e):Ol}function Lh(e,t,l,s,c,u){c=zh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},u=u===void 0?null:u,u!==null&&(s.callback=u),l=Ta(e,s,t),l!==null&&(fn(l,e,t),Ur(l,e,t))}function Dh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Rd(e,t){Dh(e,t),(e=e.alternate)&&Dh(e,t)}function _h(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&fn(t,e,67108864),Rd(e,67108864)}}function Oh(e){if(e.tag===13||e.tag===31){var t=yn();t=wo(t);var l=al(e,t);l!==null&&fn(l,e,t),Rd(e,t)}}var Ui=!0;function D1(e,t,l,s){var c=R.T;R.T=null;var u=I.p;try{I.p=2,Ad(e,t,l,s)}finally{I.p=u,R.T=c}}function _1(e,t,l,s){var c=R.T;R.T=null;var u=I.p;try{I.p=8,Ad(e,t,l,s)}finally{I.p=u,R.T=c}}function Ad(e,t,l,s){if(Ui){var c=Md(s);if(c===null)xd(e,t,s,Vi,l),Ih(e,s);else if(B1(c,e,t,l,s))s.stopPropagation();else if(Ih(e,s),t&4&&-1<O1.indexOf(e)){for(;c!==null;){var u=Cl(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var b=Et(u.pendingLanes);if(b!==0){var N=u;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var H=1<<31-jt(b);N.entanglements[1]|=H,b&=~H}Wn(u),(tt&6)===0&&(ki=lt()+500,ns(0))}}break;case 31:case 13:N=al(u,2),N!==null&&fn(N,u,2),Ci(),Rd(u,2)}if(u=Md(s),u===null&&xd(e,t,s,Vi,l),u===c)break;c=u}c!==null&&s.stopPropagation()}else xd(e,t,s,null,l)}}function Md(e){return e=Lo(e),zd(e)}var Vi=null;function zd(e){if(Vi=null,e=wl(e),e!==null){var t=p(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=h(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 Vi=e,null}function Bh(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(St()){case ye:return 2;case At:return 8;case Le:case gt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var Ld=!1,Ha=null,Ua=null,Va=null,cs=new Map,ds=new Map,$a=[],O1="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 Ih(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":cs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ds.delete(t.pointerId)}}function us(e,t,l,s,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:u,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&_h(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function B1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=us(Ua,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var u=c.pointerId;return cs.set(u,us(cs.get(u)||null,e,t,l,s,c)),!0;case"gotpointercapture":return u=c.pointerId,ds.set(u,us(ds.get(u)||null,e,t,l,s,c)),!0}return!1}function Hh(e){var t=wl(e.target);if(t!==null){var l=p(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Zu(e.priority,function(){Oh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Zu(e.priority,function(){Oh(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 $i(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Md(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);zo=s,l.target.dispatchEvent(s),zo=null}else return t=Cl(l),t!==null&&_h(t),e.blockedOn=l,!1;t.shift()}return!0}function Uh(e,t,l){$i(e)&&l.delete(t)}function I1(){Ld=!1,Ha!==null&&$i(Ha)&&(Ha=null),Ua!==null&&$i(Ua)&&(Ua=null),Va!==null&&$i(Va)&&(Va=null),cs.forEach(Uh),ds.forEach(Uh)}function Pi(e,t){e.blockedOn===t&&(e.blockedOn=null,Ld||(Ld=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,I1)))}var Gi=null;function Vh(e){Gi!==e&&(Gi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Gi===e&&(Gi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(zd(s||l)===null)continue;break}var u=Cl(l);u!==null&&(e.splice(t,3),t-=3,Mc(u,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(H){return Pi(H,e)}Ha!==null&&Pi(Ha,e),Ua!==null&&Pi(Ua,e),Va!==null&&Pi(Va,e),cs.forEach(t),ds.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)Hh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],u=l[s+1],b=c[rn]||null;if(typeof u=="function")b||Vh(l);else if(b){var N=null;if(u&&u.hasAttribute("formAction")){if(c=u,b=u[rn]||null)N=b.formAction;else if(zd(c)!==null)continue}else N=b.action;typeof N=="function"?l[s+1]=N:(l.splice(s,3),s-=3),Vh(l)}}}function $h(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Dd(e){this._internalRoot=e}qi.prototype.render=Dd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=yn();Lh(l,s,e,t,null,null)},qi.prototype.unmount=Dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Lh(e.current,2,null,e,null,null),Ci(),t[kl]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qu();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&Hh(e)}};var Ph=r.version;if(Ph!=="19.2.4")throw Error(o(527,Ph,"19.2.4"));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var H1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yi.isDisabled&&Yi.supportsFiber)try{Zn=Yi.inject(H1),Nt=Yi}catch{}}return ps.createRoot=function(e,t){if(!d(e))throw Error(o(299));var l=!1,s="",c=Xp,u=Qp,b=Zp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Mh(e,1,!1,null,null,l,s,null,c,u,b,$h),e[kl]=t.current,hd(e),new Dd(t)},ps.hydrateRoot=function(e,t,l){if(!d(e))throw Error(o(299));var s=!1,c="",u=Xp,b=Qp,N=Zp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(N=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=Mh(e,1,!0,t,l??null,s,c,H,u,b,N,$h),t.context=zh(null),l=t.current,s=yn(),s=wo(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,Sr(t,l),Wn(t),e[kl]=t.current,hd(e),new qi(t)},ps.version="19.2.4",ps}var Jh;function W1(){if(Jh)return Bd.exports;Jh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Bd.exports=F1(),Bd.exports}var K1=W1();const X1="modulepreload",Q1=function(a){return"/"+a},ex={},Tu=function(r,i,o){let d=Promise.resolve();if(i&&i.length>0){let f=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));d=f(i.map(m=>{if(m=Q1(m),m in ex)return;ex[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":X1,y||(j.as="script"),j.crossOrigin="",j.href=m,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)return new Promise((S,k)=>{j.addEventListener("load",S),j.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${m}`)))})}))}function p(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return d.then(f=>{for(const h of f||[])h.status==="rejected"&&p(h.reason);return r().catch(p)})},tx={own:"authoring-project",installed:"available-project",global:"available-personal"},fu=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function Z1(a){if(typeof a=="string"){if(fu.has(a))return a;if(Object.prototype.hasOwnProperty.call(tx,a))return tx[a]}return"authoring-project"}function J1(a){return a.startsWith("available-")?"available":"authoring"}function eb(a){const r=a.indexOf("-");return a.slice(r+1)}const Ya="";class ys extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${Ya}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new ys(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function tb(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Vd(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function nb(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let d;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?d=r.installMethod:d=o==="own"?"authored":"copied";const p=typeof r.scopeV2=="string"&&fu.has(r.scopeV2)?r.scopeV2:Z1(r.scope),f=J1(p),h=eb(p),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let m;r.shadowedBy===null?m=null:typeof r.shadowedBy=="string"&&fu.has(r.shadowedBy)?m=r.shadowedBy:m=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:d,scopeV2:p,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:m,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Vd(r.tags),deps:Vd(r.deps),mcpDeps:Vd(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:tb(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const v=r.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ee={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(nb):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${Ya}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new ys(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const d=o.toString();return Ge(`/api/skills/${a}/${r}/history${d?"?"+d:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const d=new URLSearchParams;o&&d.set("model",o);const p=d.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${p?"?"+p:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${Ya}/api/skills/${a}/${r}/sweep`,d=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),d},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${Ya}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${Ya}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${Ya}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return $d(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const d=o.toString();return $d(`/api/skills/${a}/${r}/test-install${d?"?"+d:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return $d(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Ya}/api/studio/ops/stream`)}};async function $d(a,r,i){const o=await fetch(`${Ya}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(v=S.code)}catch{}const j=new ys(y,o.status);throw v&&(j.code=v),j}const d=o.body.getReader(),p=new TextDecoder;let f="",h="",x=null,m=null;for(;;){const{done:y,value:v}=await d.read();if(y)break;f+=p.decode(v,{stream:!0});const j=f.split(`
|
|
51
|
-
`);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let k={};try{k=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const A={type:h,...k};r==null||r(A),A.type==="done"&&(x=A),A.type==="error"&&(m=A)}h=""}}if(m){const y=new ys(m.message,500);throw y.code=m.code,y}if(!x)throw new ys("Transfer stream ended without 'done' event",500);return x}function ab(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const d=o.name.split("/").pop()||o.name;i.set(d,o)}return a.map(o=>{const d=i.get(o.skill);return d?{...o,updateAvailable:d.updateAvailable,currentVersion:d.installed,latestVersion:d.latest??void 0}:o})}function lb(a){const[r,i]=g.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return g.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const d=p=>i(p.matches);return o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[a]),r}const rb=3e5,sb=500,ib=15e3,ob=6e4;function cb(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function db(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function ub(a){a()}function fb(a){const r=rb,i=sb,o=ib,d=ob,[p,f]=g.useState([]),[h,x]=g.useState(()=>new Map),[m,y]=g.useState(0),[v,j]=g.useState(!1),[S,k]=g.useState(null),[A,T]=g.useState(null),C=g.useRef(null),M=g.useRef(null),O=g.useRef(null),U=g.useRef(null),L=g.useRef(!0),V=g.useCallback(async()=>{j(!0);const B=new AbortController,P=setTimeout(()=>B.abort(),o);try{const q=await Promise.race([Ee.getSkillUpdates(),new Promise((te,Q)=>{B.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(q==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;f(q),x(cb(q)),y(db(q)),M.current=Date.now(),k(M.current),T(null)}catch(q){if(!L.current)return;T(q instanceof Error?q:new Error(String(q)))}finally{clearTimeout(P),L.current&&j(!1)}},[o]),w=g.useCallback(()=>{if(C.current)return C.current;const B=V().finally(()=>{C.current=null});return C.current=B,B},[V]),D=g.useCallback(()=>{O.current==null&&(O.current=setInterval(()=>{w()},r))},[r,w]),E=g.useCallback(()=>{O.current!=null&&(clearInterval(O.current),O.current=null)},[]);return g.useEffect(()=>{L.current=!0,(M.current==null||Date.now()-M.current>d)&&ub(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const q=()=>{if(U.current&&(clearTimeout(U.current),U.current=null),document.visibilityState==="hidden"){E();return}U.current=setTimeout(()=>{U.current=null,(M.current==null||Date.now()-M.current>d)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",q),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",q),U.current&&clearTimeout(U.current),E()}},[]),{updates:p,updatesMap:h,updateCount:m,isRefreshing:v,lastFetchAt:S,error:A,refresh:w}}const pb={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function mb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const pg=g.createContext(null);function ya(){const a=g.useContext(pg);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function hb({children:a}){const[r,i]=g.useReducer(mb,pb),o=lb("(max-width: 767px)");g.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[d,p]=g.useState(()=>{try{const L=window.localStorage.getItem("vskill.studio.prefs");if(!L)return null;const V=JSON.parse(L);return typeof V.activeAgent=="string"?V.activeAgent:null}catch{return null}});g.useEffect(()=>{function L(V){if(!(V instanceof CustomEvent))return;const w=V.detail;w!=null&&w.agentId&&p(w.agentId)}return window.addEventListener("studio:agent-changed",L),()=>window.removeEventListener("studio:agent-changed",L)},[]);const f=g.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const L=d?{agent:d}:void 0;Ee.getSkills(L).then(V=>{i({type:"SET_SKILLS",skills:V});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,E,B]=D,P=V.find(q=>q.plugin===E&&q.skill===B);P&&i({type:"SELECT_SKILL",skill:{plugin:E,skill:B,origin:P.origin}})}}).catch(V=>i({type:"SET_SKILLS_ERROR",error:V.message}))},[d]);g.useEffect(()=>{f()},[f]);const h=g.useCallback(L=>{i({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),x=g.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),m=g.useCallback(L=>{i({type:"SET_MODE",mode:L})},[]),y=g.useCallback(L=>{i({type:"SET_SEARCH",query:L})},[]),v=g.useCallback(L=>{i({type:"SET_MOBILE_VIEW",view:L})},[]),j=g.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=fb(),k=g.useMemo(()=>{const L=r.skills.map(V=>{if(!V.updateAvailable&&V.latestVersion===void 0)return V;const w={...V};return delete w.updateAvailable,delete w.currentVersion,delete w.latestVersion,w});return ab(L,S.updates)},[r.skills,S.updates]),A=g.useMemo(()=>{const L={source:0,installed:0};for(const V of k)V.updateAvailable&&(L[V.origin]+=1);return L},[k]),T=g.useMemo(()=>({...r,skills:k}),[r,k]),C=S.updateCount,M=S.refresh,O=S.isRefreshing,U=g.useMemo(()=>({state:T,selectSkill:h,clearSelection:x,setMode:m,setSearch:y,setMobileView:v,refreshSkills:f,updateCount:C,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:A,isRefreshingUpdates:O,refreshUpdates:M}),[T,h,x,m,y,v,f,C,j,S.updates,A,O,M]);return n.jsx(pg.Provider,{value:U,children:a})}const xb={config:null,loading:!0};function gb(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const mg=g.createContext(null);function bl(){const a=g.useContext(mg);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function vb({children:a}){const[r,i]=g.useReducer(gb,xb),o=g.useCallback(()=>{Ee.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);g.useEffect(()=>{o()},[o]);const d=g.useCallback(async(f,h)=>{const x=await Ee.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),p=g.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:d,refreshConfig:o}),[r,d,o]);return n.jsx(mg.Provider,{value:p,children:a})}function yb({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:d,banner:p,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:m,children:[p,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:d?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&d,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var mo=fg();const bb=ug(mo),nx=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],jb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},Sb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},kb={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},wb={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function Cb(a,r){var h,x;const i=jb[a.id]??null,o=Sb[a.id]??null,d=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,p=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(m=>({id:m.id,displayName:m.label,billingMode:wb[a.id]??"per-token"}));return{id:a.id,displayName:Nb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:d,binaryAvailable:p,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:kb[a.id]??null,models:f}}function Nb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function Eb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of nx){const d=r.get(o);d&&i.push(d)}for(const o of a)nx.includes(o.id)||i.push(o);return i}function Tb(a){const[r,i]=g.useState(null),[o,d]=g.useState("loading"),[p,f]=g.useState(null),h=g.useRef(null),x=g.useRef(0),m=g.useCallback(async()=>{try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`/api/config returned ${k.status}`);const A=await k.json(),T=Eb((A.providers||[]).map(C=>Cb(C,A.detection)));i({agents:T,activeAgent:A.provider??null,activeModel:A.model??null}),d("ready"),f(null)}catch(k){d("error"),f(k.message)}},[]);g.useEffect(()=>{m()},[m]);const y=g.useCallback(async()=>{const k=Date.now();if(!(k-x.current<5*6e4))try{const A=await fetch("/api/openrouter/models");if(!A.ok)return;const T=await A.json();x.current=k,i(C=>{if(!C)return C;const M=C.agents.map(O=>{if(O.id!=="openrouter")return O;const U=T.models.map(V=>({id:V.id,displayName:V.name,contextWindow:V.contextWindow,pricing:V.pricing,billingMode:"per-token"}));return{...O,models:U,catalogAgeMs:T.ageSec?T.ageSec*1e3:0,cacheStale:!!T.stale}});return{...C,agents:M}}),T.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(T.ageSec??0)*1e3)}catch{}},[a]),v=g.useCallback(k=>{h.current=k,k==="openrouter"&&y()},[y]),j=g.useCallback(()=>{x.current=0,m()},[m]),S=g.useCallback(async(k,A)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k,model:A})})).ok&&i(C=>C&&{...C,activeAgent:k,activeModel:A})},[]);return{status:o,catalog:r,error:p,focusAgent:v,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Pd({variant:a,label:r,onActivate:i,installUrl:o}){function d(f){if(f.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function p(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:d,onKeyDown:p,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,children:r})}function pu({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const Rb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},Ab={appTitle:"Skill Studio",commandPaletteButtonLabel:"Open command palette",commandPaletteHint:"⌘K",themeToggleLight:"Switch to light theme",themeToggleDark:"Switch to dark theme",themeToggleAuto:"Switch to auto theme",projectPathLabel:"Project",modelLabel:"Model",healthLabel:"Health"},Mb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},zb={open:"Open",copyPath:"Copy Path",revealInEditor:"Reveal in Editor",edit:"Edit",duplicate:"Duplicate",runBenchmark:"Run Benchmark",update:"Update",uninstall:"Uninstall",retry:"Retry",editPlaceholder:"Edit lands with 0675. Open the file in your editor."},Lb={inputPlaceholder:"Type a command or search",emptyResults:"No matches. Try a different query.",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",actionSelectSkill:"Select skill",actionRunBenchmark:"Run benchmark",actionSwitchTheme:"Switch theme",actionNewSkill:"New skill",closeLabel:"Close palette"},Db={title:"Keyboard shortcuts",closeLabel:"Close shortcuts",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",search:"Focus search",moveDown:"Move selection down",moveUp:"Move selection up",openSelected:"Open selected skill",openPalette:"Open command palette",openShortcuts:"Open this cheatsheet",toggleSidebar:"Toggle sidebar",toggleTheme:"Toggle theme"},_b={pathCopied:"Path copied.",configCopied:"Config copied.",skillDuplicated:"Skill duplicated.",benchmarkQueued:"Benchmark queued.",themeUpdated:"Theme updated.",skillUpdated:"Skill updated.",actionFailed:"Action failed. Retry or check logs.",networkError:"Network error. Check your connection.",permissionDenied:"Permission denied. Check file access.",unknownError:"Something went wrong. Retry or check logs."},Ob={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Bb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Ib={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Hb={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Ub={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start service →"}},Vb={subscriptionBilling:"· subscription",free:"· free"},$b={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},Pb={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},Gb={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},qb={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},Yb={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},Fb={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Wb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Kb={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:Rb,shell:Ab,detail:Mb,actions:zb,palette:Lb,shortcuts:Db,toasts:_b,connection:Ob,forms:Bb,errors:Ib,picker:Hb,providers:Ub,models:Vb,settings:$b,statusBar:Pb,scopePicker:Gb,scopeSection:qb,claudeCodeLabel:Yb,setupDrawer:Fb,setupProviders:Kb,scopeLabels:Wb},ax=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Xb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:d,onOpenSettings:p}){const f=a.filter(x=>ax.has(x.id)),h=a.filter(x=>!ax.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(lx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:d,onOpenSettings:p},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(lx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:d,onOpenSettings:p},x.id))]})}function lx({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:d,onOpenSettings:p}){const{providers:f}=J,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},m=a.id==="claude-cli"||a.id==="claude-code",y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>d(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(pu,{unlocked:!0,size:10}):n.jsx(pu,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:J.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Pd,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>p(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Pd,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Pd,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>p(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Qb(a,r,i,o){const f=a>=80,h=g.useRef(null),[x,m]=g.useState(0),y=g.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:j}=g.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),k=Math.ceil(i/r)+8,A=Math.min(a,S+k);return{visibleStart:S,visibleEnd:A}},[f,x,r,i,a,4]);return{visibleStart:v,visibleEnd:j,totalHeight:a*r,offsetTop:v*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const hg=44,Zb=352,Jb=60;function e0(a){var p,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((p=a.pricing)==null?void 0:p.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,d=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${d}`:d}function t0(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(d=>d.displayName.toLowerCase().includes(i)).sort((d,p)=>{const f=d.displayName.toLowerCase().indexOf(i),h=p.displayName.toLowerCase().indexOf(i);return f!==h?f-h:d.displayName.length-p.displayName.length})}function n0({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[d,p]=g.useState(""),[f,h]=g.useState(""),x=g.useRef(null);if(g.useEffect(()=>{const v=setTimeout(()=>h(d),Jb);return()=>clearTimeout(v)},[d]),g.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const m=g.useMemo(()=>t0(a.models,f),[a.models,f]),y=Qb(m.length,hg,Zb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:d,onChange:v=>p(v.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),m.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>p(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:J.picker.clearSearch})]}):m.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:m.slice(y.visibleStart,y.visibleEnd).map(v=>n.jsx(a0,{model:v,isActive:v.id===r,onSelect:()=>i(v.id)},v.id))})})})]})}function a0({model:a,isActive:r,onSelect:i}){const o=e0(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:hg,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:o})]})}const rx={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function l0(){const[a,r]=g.useState(null),[i,o]=g.useState(!0),[d,p]=g.useState(null),f=g.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();r({...rx,...y}),p(null)}catch(m){p(m.message),r(rx)}finally{o(!1)}},[]);g.useEffect(()=>{f()},[f]);const h=g.useCallback(async(m,y,v="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y,tier:v})});if(!j.ok){const k=await j.json().catch(()=>({error:j.statusText}));throw new Error(k.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=g.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await f()},[f]);return{state:a,loading:i,error:d,save:h,remove:x,refresh:f}}const r0=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function s0(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function i0(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function o0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:d,save:p,remove:f}=l0(),[h,x]=g.useState("browser"),m=g.useRef(null),y=g.useRef(null),[v,j]=g.useState(i??"anthropic");if(g.useEffect(()=>{if(!a)return;const k=document.activeElement,A=setTimeout(()=>{var M;const T=i?`input[data-provider="${i}"]`:"input[data-provider]",C=(M=m.current)==null?void 0:M.querySelector(T);C==null||C.focus()},0);return()=>{var T;clearTimeout(A),(T=k==null?void 0:k.focus)==null||T.call(k)}},[a,i]),g.useEffect(()=>{if(!a)return;const k=A=>{if(A.key==="Escape"){A.preventDefault(),r();return}if(A.key==="Tab"&&m.current){const T=m.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(T.length===0)return;const C=T[0],M=T[T.length-1];A.shiftKey&&document.activeElement===C?(A.preventDefault(),M.focus()):!A.shiftKey&&document.activeElement===M&&(A.preventDefault(),C.focus())}};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a,r]),!a)return null;const S=s0();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:k=>{k.target===k.currentTarget&&r()},children:n.jsxs("div",{ref:m,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:k=>k.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),r0.map(k=>n.jsx(c0,{providerId:k.id,providerName:k.name,keyIssuanceUrl:k.keyIssuanceUrl,prefix:k.prefix,metadata:d==null?void 0:d[k.id],tier:h,onSave:async A=>{const T=await p(k.id,A,h);return o==null||o(J.settings.keySaved(k.name)),T},onRemove:async()=>{await f(k.id),o==null||o(J.settings.keyRemoved(k.name))},inputRef:k.id===(i??"anthropic")?y:void 0},k.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,n.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function c0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:d,onSave:p,onRemove:f,inputRef:h}){const[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState(!1),[k,A]=g.useState(!1),[T,C]=g.useState(null),M=x.trim(),O=M.length===0,U=M.length>0&&!M.startsWith(o),L=g.useCallback(async()=>{if(!O){S(!0);try{const D=await p(M);D.warning?C(D.warning):C(null),m("")}finally{S(!1)}}},[O,p,M]),V=g.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const E=await navigator.clipboard.readText();m(E)}catch{}},[]),w=g.useCallback(async()=>{A(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:D=>{m(D.target.value),C(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>v(!y),style:ir,children:y?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:V,style:ir,children:J.settings.paste})]}),O&&x.length>0&&n.jsx("div",{role:"status",style:d0,children:J.settings.enterNonEmpty}),U&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:sx,children:J.settings.prefixWarn(r)}),T&&n.jsx("div",{role:"status",style:sx,children:T}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:L,disabled:O||j,"data-testid":`save-${a}`,style:{...ir,background:O?"var(--surface-2)":"var(--accent, var(--color-accent))",color:O?"var(--text-muted)":"white",cursor:O?"not-allowed":"pointer"},children:J.settings.save}),(d==null?void 0:d.stored)&&n.jsx(n.Fragment,{children:k?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>A(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>A(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:J.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:d!=null&&d.stored&&d.updatedAt?J.settings.keyStoredAt(i0(d.updatedAt)):J.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},d0={fontSize:11,color:"var(--danger, #b33)"},sx={fontSize:11,color:"var(--warning, var(--text-muted))"};function u0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function f0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:d}=Tb({onStaleCatalog:(D,E)=>{const B=Math.round(E/6e4);a==null||a(`Using cached ${D} catalog (${B} min old)`)}}),[p,f]=g.useState(!1),[h,x]=g.useState(!1),[m,y]=g.useState(),[v,j]=g.useState(null),[S,k]=g.useState("agents"),A=g.useRef(null);g.useRef(null),g.useEffect(()=>{var D;i&&!v&&j(i.activeAgent??((D=i.agents[0])==null?void 0:D.id)??null)},[i,v]);const T=(i==null?void 0:i.agents)??[],C=g.useMemo(()=>T.find(D=>D.id===v)??T[0],[T,v]),M=g.useCallback(()=>{var D;f(!0),k("agents"),j((i==null?void 0:i.activeAgent)??((D=T[0])==null?void 0:D.id)??null)},[i,T]),O=g.useCallback(()=>{var D;f(!1),(D=A.current)==null||D.focus()},[]);g.useEffect(()=>{const D=E=>{var P;if(!(E.metaKey||E.ctrlKey)||E.key.toLowerCase()!=="k")return;const B=(P=document.activeElement)==null?void 0:P.tagName;B==="INPUT"||B==="TEXTAREA"||(E.preventDefault(),f(q=>!q))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),g.useEffect(()=>{if(!p)return;const D=B=>{if(B.key==="Escape"){B.preventDefault(),O();return}if(B.key==="ArrowDown"){B.preventDefault(),E(1);return}if(B.key==="ArrowUp"){B.preventDefault(),E(-1);return}if(B.key==="ArrowRight"&&S==="agents"){B.preventDefault(),k("models");return}if(B.key==="ArrowLeft"&&S==="models"){B.preventDefault(),k("agents");return}if(B.key==="Enter"){B.preventDefault(),S==="agents"&&C?k("models"):S==="models"&&C&&C.models[0]&&(d(C.id,C.models[0].id),O());return}};function E(B){if(S==="agents"){const P=T.findIndex(te=>te.id===v),q=T[Math.max(0,Math.min(T.length-1,P+B))];q&&(j(q.id),o(q.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,S,T,v,C,O,o,d]);const U=g.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),f(!1)},[]),L=T.find(D=>D.id===(i==null?void 0:i.activeAgent)),V=L==null?void 0:L.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=g.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",E=(V==null?void 0:V.displayName)??i.activeModel??"Model";return`${D} · ${E}`},[r,i,L,V]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:A,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>p?O():M(),"aria-haspopup":"listbox","aria-expanded":p,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),p&&typeof document<"u"&&mo.createPortal(n.jsxs(p0,{reducedMotion:u0(),onClickOutside:O,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Xb,{agents:T,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:v,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),k("models")},onOpenSettings:U}),C&&n.jsx(n0,{agent:C,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{d(C.id,D),O()},onOpenSettings:U})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>U(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),n.jsx(o0,{open:h,onClose:()=>x(!1),initialProvider:m,onToast:a})]})}function p0({children:a,reducedMotion:r,onClickOutside:i}){const o=g.useRef(null);return g.useEffect(()=>{const d=p=>{o.current&&!o.current.contains(p.target)&&i()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
49
|
+
`+s.stack}}var Te=Object.prototype.hasOwnProperty,Qe=a.unstable_scheduleCallback,at=a.unstable_cancelCallback,$t=a.unstable_shouldYield,Pt=a.unstable_requestPaint,lt=a.unstable_now,St=a.unstable_getCurrentPriorityLevel,ye=a.unstable_ImmediatePriority,At=a.unstable_UserBlockingPriority,Le=a.unstable_NormalPriority,gt=a.unstable_LowPriority,Kt=a.unstable_IdlePriority,rt=a.log,Qa=a.unstable_setDisableYieldValue,Zn=null,Nt=null;function kt(e){if(typeof rt=="function"&&Qa(e),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Zn,e)}catch{}}var jt=Math.clz32?Math.clz32:Hn,In=Math.log,Za=Math.LN2;function Hn(e){return e>>>=0,e===0?32:31-(In(e)/Za|0)|0}var $e=256,Ht=262144,Jn=4194304;function Et(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 jr(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var N=s&134217727;return N!==0?(s=N&~u,s!==0?c=Et(s):(b&=N,b!==0?c=Et(b):l||(l=N&~e,l!==0&&(c=Et(l))))):(N=s&~u,N!==0?c=Et(N):b!==0?c=Et(b):l||(l=s&~e,l!==0&&(c=Et(l)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:c}function Cn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function So(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 Yu(){var e=Jn;return Jn<<=1,(Jn&62914560)===0&&(Jn=4194304),e}function ko(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Sr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Rv(e,t,l,s,c,u){var b=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 N=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=b&~l;0<l;){var ne=31-jt(l),se=1<<ne;N[ne]=0,H[ne]=-1;var X=K[ne];if(X!==null)for(K[ne]=null,ne=0;ne<X.length;ne++){var ee=X[ne];ee!==null&&(ee.lane&=-536870913)}l&=~se}s!==0&&Wu(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(b&~t))}function Wu(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-jt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function Ku(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-jt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Xu(e,t){var l=t&-t;return l=(l&42)!==0?1:wo(l),(l&(e.suspendedLanes|t))!==0?0:l}function wo(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 Co(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Qu(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:Bh(e.type))}function Zu(e,t){var l=I.p;try{return I.p=e,t()}finally{I.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,rn="__reactProps$"+ba,kl="__reactContainer$"+ba,No="__reactEvents$"+ba,Av="__reactListeners$"+ba,Mv="__reactHandles$"+ba,Ju="__reactResources$"+ba,kr="__reactMarker$"+ba;function Eo(e){delete e[Gt],delete e[rn],delete e[No],delete e[Av],delete e[Mv]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=jh(e);e!==null;){if(l=e[Gt])return l;e=jh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function wr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Ju];return t||(t=e[Ju]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[kr]=!0}var ef=new Set,tf={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(tf[e]=t,e=0;e<t.length;e++)ef.add(t[e])}var zv=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]*$"),nf={},af={};function Lv(e){return Te.call(af,e)?!0:Te.call(nf,e)?!1:zv.test(e)?af[e]=!0:(nf[e]=!0,!1)}function _s(e,t,l){if(Lv(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Os(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 ea(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function lf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Dv(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,u.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function To(e){if(!e._valueTracker){var t=lf(e)?"checked":"value";e._valueTracker=Dv(e,t,""+e[t])}}function rf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=lf(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Bs(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 _v=/[\n"\\]/g;function En(e){return e.replace(_v,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ro(e,t,l,s,c,u,b,N){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Nn(t)):e.value!==""+Nn(t)&&(e.value=""+Nn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?Ao(e,b,Nn(t)):l!=null?Ao(e,b,Nn(l)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Nn(N):e.removeAttribute("name")}function sf(e,t,l,s,c,u,b,N){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){To(e);return}l=l!=null?""+Nn(l):"",t=t!=null?""+Nn(t):l,N||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=N?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),To(e)}function Ao(e,t,l){t==="number"&&Bs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Nn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function of(e,t,l){if(t!=null&&(t=""+Nn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Nn(l):""}function cf(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(z(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Nn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),To(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Ov=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 df(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||Ov.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function uf(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&df(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&df(e,u,t[u])}function Mo(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 Bv=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"]]),Iv=/^[\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 Is(e){return Iv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ta(){}var zo=null;function Lo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function ff(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[rn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ro(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="'+En(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[rn]||null;if(!c)throw Error(o(90));Ro(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&rf(s)}break e;case"textarea":of(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Do=!1;function pf(e,t,l){if(Do)return e(t,l);Do=!0;try{var s=e(t);return s}finally{if(Do=!1,(Al!==null||Ml!==null)&&(Ci(),Al&&(t=Al,e=Ml,Ml=Al=null,ff(t),e)))for(t=0;t<e.length;t++)ff(e[t])}}function Cr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[rn]||null;if(s===null)return null;l=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var na=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),_o=!1;if(na)try{var Nr={};Object.defineProperty(Nr,"passive",{get:function(){_o=!0}}),window.addEventListener("test",Nr,Nr),window.removeEventListener("test",Nr,Nr)}catch{_o=!1}var ja=null,Oo=null,Hs=null;function mf(){if(Hs)return Hs;var e,t=Oo,l=t.length,s,c="value"in ja?ja.value:ja.textContent,u=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[u-s];s++);return Hs=c.slice(e,1<s?1-s:void 0)}function Us(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 Vs(){return!0}function hf(){return!1}function sn(e){function t(l,s,c,u,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=b,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(l=e[N],this[N]=l?l(u):u[N]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Vs:hf,this.isPropagationStopped=hf,this}return v(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=Vs)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Vs)},persist:function(){},isPersistent:Vs}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=sn(el),Er=v({},el,{view:0,detail:0}),Hv=sn(Er),Bo,Io,Tr,Ps=v({},Er,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,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!==Tr&&(Tr&&e.type==="mousemove"?(Bo=e.screenX-Tr.screenX,Io=e.screenY-Tr.screenY):Io=Bo=0,Tr=e),Bo)},movementY:function(e){return"movementY"in e?e.movementY:Io}}),xf=sn(Ps),Uv=v({},Ps,{dataTransfer:0}),Vv=sn(Uv),$v=v({},Er,{relatedTarget:0}),Ho=sn($v),Pv=v({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),Gv=sn(Pv),Fv=v({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qv=sn(Fv),Yv=v({},el,{data:0}),gf=sn(Yv),Wv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kv={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"},Xv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Xv[e])?!!t[e]:!1}function Uo(){return Qv}var Zv=v({},Er,{key:function(e){if(e.key){var t=Wv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Us(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Kv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(e){return e.type==="keypress"?Us(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Us(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Jv=sn(Zv),ey=v({},Ps,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vf=sn(ey),ty=v({},Er,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),ny=sn(ty),ay=v({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),ly=sn(ay),ry=v({},Ps,{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}),sy=sn(ry),iy=v({},el,{newState:0,oldState:0}),oy=sn(iy),cy=[9,13,27,32],Vo=na&&"CompositionEvent"in window,Rr=null;na&&"documentMode"in document&&(Rr=document.documentMode);var dy=na&&"TextEvent"in window&&!Rr,yf=na&&(!Vo||Rr&&8<Rr&&11>=Rr),bf=" ",jf=!1;function Sf(e,t){switch(e){case"keyup":return cy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zl=!1;function uy(e,t){switch(e){case"compositionend":return kf(t);case"keypress":return t.which!==32?null:(jf=!0,bf);case"textInput":return e=t.data,e===bf&&jf?null:e;default:return null}}function fy(e,t){if(zl)return e==="compositionend"||!Vo&&Sf(e,t)?(e=mf(),Hs=Oo=ja=null,zl=!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 yf&&t.locale!=="ko"?null:t.data;default:return null}}var py={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 wf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!py[e.type]:t==="textarea"}function Cf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=zi(t,"onChange"),0<t.length&&(l=new $s("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Ar=null,Mr=null;function my(e){ih(e,0)}function Gs(e){var t=wr(e);if(rf(t))return e}function Nf(e,t){if(e==="change")return t}var Ef=!1;if(na){var $o;if(na){var Po="oninput"in document;if(!Po){var Tf=document.createElement("div");Tf.setAttribute("oninput","return;"),Po=typeof Tf.oninput=="function"}$o=Po}else $o=!1;Ef=$o&&(!document.documentMode||9<document.documentMode)}function Rf(){Ar&&(Ar.detachEvent("onpropertychange",Af),Mr=Ar=null)}function Af(e){if(e.propertyName==="value"&&Gs(Mr)){var t=[];Cf(t,Mr,e,Lo(e)),pf(my,t)}}function hy(e,t,l){e==="focusin"?(Rf(),Ar=t,Mr=l,Ar.attachEvent("onpropertychange",Af)):e==="focusout"&&Rf()}function xy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gs(Mr)}function gy(e,t){if(e==="click")return Gs(t)}function vy(e,t){if(e==="input"||e==="change")return Gs(t)}function yy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pn=typeof Object.is=="function"?Object.is:yy;function zr(e,t){if(pn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!Te.call(t,c)||!pn(e[c],t[c]))return!1}return!0}function Mf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zf(e,t){var l=Mf(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Mf(l)}}function Lf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Df(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Bs(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=Bs(e.document)}return t}function Go(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 by=na&&"documentMode"in document&&11>=document.documentMode,Ll=null,Fo=null,Lr=null,qo=!1;function _f(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;qo||Ll==null||Ll!==Bs(s)||(s=Ll,"selectionStart"in s&&Go(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Lr&&zr(Lr,s)||(Lr=s,s=zi(Fo,"onSelect"),0<s.length&&(t=new $s("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=Ll)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Dl={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},Yo={},Of={};na&&(Of=document.createElement("div").style,"AnimationEvent"in window||(delete Dl.animationend.animation,delete Dl.animationiteration.animation,delete Dl.animationstart.animation),"TransitionEvent"in window||delete Dl.transitionend.transition);function nl(e){if(Yo[e])return Yo[e];if(!Dl[e])return e;var t=Dl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Of)return Yo[e]=t[l];return e}var Bf=nl("animationend"),If=nl("animationiteration"),Hf=nl("animationstart"),jy=nl("transitionrun"),Sy=nl("transitionstart"),ky=nl("transitioncancel"),Uf=nl("transitionend"),Vf=new Map,Wo="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(" ");Wo.push("scrollEnd");function Un(e,t){Vf.set(e,t),Ja(t,[e])}var Fs=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)},Tn=[],_l=0,Ko=0;function qs(){for(var e=_l,t=Ko=_l=0;t<e;){var l=Tn[t];Tn[t++]=null;var s=Tn[t];Tn[t++]=null;var c=Tn[t];Tn[t++]=null;var u=Tn[t];if(Tn[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}u!==0&&$f(l,c,u)}}function Ys(e,t,l,s){Tn[_l++]=e,Tn[_l++]=t,Tn[_l++]=l,Tn[_l++]=s,Ko|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Xo(e,t,l,s){return Ys(e,t,l,s),Ws(e)}function al(e,t){return Ys(e,null,null,t),Ws(e)}function $f(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,u=e.return;u!==null;)u.childLanes|=l,s=u.alternate,s!==null&&(s.childLanes|=l),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-jt(l),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),u):null}function Ws(e){if(50<ts)throw ts=0,rd=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ol={};function wy(e,t,l,s){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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(e,t,l,s){return new wy(e,t,l,s)}function Qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function aa(e,t){var l=e.alternate;return l===null?(l=mn(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 Pf(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 Ks(e,t,l,s,c,u){var b=0;if(s=e,typeof e=="function")Qo(e)&&(b=1);else if(typeof e=="string")b=R1(e,l,ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case E:return e=mn(31,l,t,c),e.elementType=E,e.lanes=u,e;case A:return ll(l.children,c,u,t);case T:b=8,c|=24;break;case C:return e=mn(12,l,t,c|2),e.elementType=C,e.lanes=u,e;case L:return e=mn(13,l,t,c),e.elementType=L,e.lanes=u,e;case V:return e=mn(19,l,t,c),e.elementType=V,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:b=10;break e;case M:b=9;break e;case U:b=11;break e;case w:b=14;break e;case D:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=mn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function ll(e,t,l,s){return e=mn(7,e,s,t),e.lanes=l,e}function Zo(e,t,l){return e=mn(6,e,null,t),e.lanes=l,e}function Gf(e){var t=mn(18,null,null,0);return t.stateNode=e,t}function Jo(e,t,l){return t=mn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Ff=new WeakMap;function Rn(e,t){if(typeof e=="object"&&e!==null){var l=Ff.get(e);return l!==void 0?l:(t={value:e,source:t,stack:re(t)},Ff.set(e,t),t)}return{value:e,source:t,stack:re(t)}}var Bl=[],Il=0,Xs=null,Dr=0,An=[],Mn=0,Sa=null,Fn=1,qn="";function la(e,t){Bl[Il++]=Dr,Bl[Il++]=Xs,Xs=e,Dr=t}function qf(e,t,l){An[Mn++]=Fn,An[Mn++]=qn,An[Mn++]=Sa,Sa=e;var s=Fn;e=qn;var c=32-jt(s)-1;s&=~(1<<c),l+=1;var u=32-jt(t)+c;if(30<u){var b=c-c%5;u=(s&(1<<b)-1).toString(32),s>>=b,c-=b,Fn=1<<32-jt(t)+c|l<<c|s,qn=u+e}else Fn=1<<u|l<<c|s,qn=e}function ec(e){e.return!==null&&(la(e,1),qf(e,1,0))}function tc(e){for(;e===Xs;)Xs=Bl[--Il],Bl[Il]=null,Dr=Bl[--Il],Bl[Il]=null;for(;e===Sa;)Sa=An[--Mn],An[Mn]=null,qn=An[--Mn],An[Mn]=null,Fn=An[--Mn],An[Mn]=null}function Yf(e,t){An[Mn++]=Fn,An[Mn++]=qn,An[Mn++]=Sa,Fn=t.id,qn=t.overflow,Sa=e}var Ft=null,pt=null,Ke=!1,ka=null,zn=!1,nc=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw _r(Rn(t,e)),nc}function Wf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[rn]=s,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<as.length;l++)qe(as[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),sf(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),cf(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||uh(t.textContent,l)?(s.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),s.onScroll!=null&&qe("scroll",t),s.onScrollEnd!=null&&qe("scrollend",t),s.onClick!=null&&(t.onclick=ta),t=!0):t=!1,t||wa(e,!0)}function Kf(e){for(Ft=e.return;Ft;)switch(Ft.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Ft=Ft.return}}function Hl(e){if(e!==Ft)return!1;if(!Ke)return Kf(e),Ke=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||bd(e.type,e.memoizedProps)),l=!l),l&&pt&&wa(e),Kf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=bh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=bh(e)}else t===27?(t=pt,Ia(e.type)?(e=Cd,Cd=null,pt=e):pt=t):pt=Ft?Dn(e.stateNode.nextSibling):null;return!0}function rl(){pt=Ft=null,Ke=!1}function ac(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function _r(e){ka===null?ka=[e]:ka.push(e)}var lc=_(null),sl=null,ra=null;function Ca(e,t,l){ie(lc,t._currentValue),t._currentValue=l}function sa(e){e._currentValue=lc.current,W(lc)}function rc(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function sc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var b=c.child;u=u.firstContext;e:for(;u!==null;){var N=u;u=c;for(var H=0;H<t.length;H++)if(N.context===t[H]){u.lanes|=l,N=u.alternate,N!==null&&(N.lanes|=l),rc(u.return,l,e),s||(b=null);break e}u=N.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,u=b.alternate,u!==null&&(u.lanes|=l),rc(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Ul(e,t,l,s){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var N=c.type;pn(c.pendingProps.value,b.value)||(e!==null?e.push(N):e=[N])}}else if(c===we.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(os):e=[os])}c=c.return}e!==null&&sc(t,e,l,s),t.flags|=262144}function Qs(e){for(e=e.firstContext;e!==null;){if(!pn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,ra=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Xf(sl,e)}function Zs(e,t){return sl===null&&il(e),Xf(e,t)}function Xf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},ra===null){if(e===null)throw Error(o(308));ra=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ra=ra.next=t;return l}var Cy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Ny=a.unstable_scheduleCallback,Ey=a.unstable_NormalPriority,Mt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ic(){return{controller:new Cy,data:new Map,refCount:0}}function Or(e){e.refCount--,e.refCount===0&&Ny(Ey,function(){e.controller.abort()})}var Br=null,oc=0,Vl=0,$l=null;function Ty(e,t){if(Br===null){var l=Br=[];oc=0,Vl=ud(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return oc++,t.then(Qf,Qf),t}function Qf(){if(--oc===0&&Br!==null){$l!==null&&($l.status="fulfilled");var e=Br;Br=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ry(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var Zf=R.S;R.S=function(e,t){_m=lt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ty(e,t),Zf!==null&&Zf(e,t)};var ol=_(null);function cc(){var e=ol.current;return e!==null?e:ft.pooledCache}function Js(e,t){t===null?ie(ol,ol.current):ie(ol,t.pool)}function Jf(){var e=cc();return e===null?null:{parent:Mt._currentValue,pool:e}}var Pl=Error(o(460)),dc=Error(o(474)),ei=Error(o(542)),ti={then:function(){}};function ep(e){return e=e.status,e==="fulfilled"||e==="rejected"}function tp(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ta,ta),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ap(e),e;default:if(typeof t.status=="string")t.then(ta,ta);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ap(e),e}throw dl=t,Pl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(dl=l,Pl):l}}var dl=null;function np(){if(dl===null)throw Error(o(459));var e=dl;return dl=null,e}function ap(e){if(e===Pl||e===ei)throw Error(o(483))}var Gl=null,Ir=0;function ni(e){var t=Ir;return Ir+=1,Gl===null&&(Gl=[]),tp(Gl,e,t)}function Hr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ai(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function lp(e){function t(G,$){if(e){var Y=G.deletions;Y===null?(G.deletions=[$],G.flags|=16):Y.push($)}}function l(G,$){if(!e)return null;for(;$!==null;)t(G,$),$=$.sibling;return null}function s(G){for(var $=new Map;G!==null;)G.key!==null?$.set(G.key,G):$.set(G.index,G),G=G.sibling;return $}function c(G,$){return G=aa(G,$),G.index=0,G.sibling=null,G}function u(G,$,Y){return G.index=Y,e?(Y=G.alternate,Y!==null?(Y=Y.index,Y<$?(G.flags|=67108866,$):Y):(G.flags|=67108866,$)):(G.flags|=1048576,$)}function b(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function N(G,$,Y,le){return $===null||$.tag!==6?($=Zo(Y,G.mode,le),$.return=G,$):($=c($,Y),$.return=G,$)}function H(G,$,Y,le){var Re=Y.type;return Re===A?ne(G,$,Y.props.children,le,Y.key):$!==null&&($.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===D&&cl(Re)===$.type)?($=c($,Y.props),Hr($,Y),$.return=G,$):($=Ks(Y.type,Y.key,Y.props,null,G.mode,le),Hr($,Y),$.return=G,$)}function K(G,$,Y,le){return $===null||$.tag!==4||$.stateNode.containerInfo!==Y.containerInfo||$.stateNode.implementation!==Y.implementation?($=Jo(Y,G.mode,le),$.return=G,$):($=c($,Y.children||[]),$.return=G,$)}function ne(G,$,Y,le,Re){return $===null||$.tag!==7?($=ll(Y,G.mode,le,Re),$.return=G,$):($=c($,Y),$.return=G,$)}function se(G,$,Y){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Zo(""+$,G.mode,Y),$.return=G,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case S:return Y=Ks($.type,$.key,$.props,null,G.mode,Y),Hr(Y,$),Y.return=G,Y;case k:return $=Jo($,G.mode,Y),$.return=G,$;case D:return $=cl($),se(G,$,Y)}if(z($)||F($))return $=ll($,G.mode,Y,null),$.return=G,$;if(typeof $.then=="function")return se(G,ni($),Y);if($.$$typeof===O)return se(G,Zs(G,$),Y);ai(G,$)}return null}function X(G,$,Y,le){var Re=$!==null?$.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Re!==null?null:N(G,$,""+Y,le);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:return Y.key===Re?H(G,$,Y,le):null;case k:return Y.key===Re?K(G,$,Y,le):null;case D:return Y=cl(Y),X(G,$,Y,le)}if(z(Y)||F(Y))return Re!==null?null:ne(G,$,Y,le,null);if(typeof Y.then=="function")return X(G,$,ni(Y),le);if(Y.$$typeof===O)return X(G,$,Zs(G,Y),le);ai(G,Y)}return null}function ee(G,$,Y,le,Re){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return G=G.get(Y)||null,N($,G,""+le,Re);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case S:return G=G.get(le.key===null?Y:le.key)||null,H($,G,le,Re);case k:return G=G.get(le.key===null?Y:le.key)||null,K($,G,le,Re);case D:return le=cl(le),ee(G,$,Y,le,Re)}if(z(le)||F(le))return G=G.get(Y)||null,ne($,G,le,Re,null);if(typeof le.then=="function")return ee(G,$,Y,ni(le),Re);if(le.$$typeof===O)return ee(G,$,Y,Zs($,le),Re);ai($,le)}return null}function je(G,$,Y,le){for(var Re=null,Ze=null,ke=$,Ue=$=0,We=null;ke!==null&&Ue<Y.length;Ue++){ke.index>Ue?(We=ke,ke=null):We=ke.sibling;var Je=X(G,ke,Y[Ue],le);if(Je===null){ke===null&&(ke=We);break}e&&ke&&Je.alternate===null&&t(G,ke),$=u(Je,$,Ue),Ze===null?Re=Je:Ze.sibling=Je,Ze=Je,ke=We}if(Ue===Y.length)return l(G,ke),Ke&&la(G,Ue),Re;if(ke===null){for(;Ue<Y.length;Ue++)ke=se(G,Y[Ue],le),ke!==null&&($=u(ke,$,Ue),Ze===null?Re=ke:Ze.sibling=ke,Ze=ke);return Ke&&la(G,Ue),Re}for(ke=s(ke);Ue<Y.length;Ue++)We=ee(ke,G,Ue,Y[Ue],le),We!==null&&(e&&We.alternate!==null&&ke.delete(We.key===null?Ue:We.key),$=u(We,$,Ue),Ze===null?Re=We:Ze.sibling=We,Ze=We);return e&&ke.forEach(function(Pa){return t(G,Pa)}),Ke&&la(G,Ue),Re}function Ae(G,$,Y,le){if(Y==null)throw Error(o(151));for(var Re=null,Ze=null,ke=$,Ue=$=0,We=null,Je=Y.next();ke!==null&&!Je.done;Ue++,Je=Y.next()){ke.index>Ue?(We=ke,ke=null):We=ke.sibling;var Pa=X(G,ke,Je.value,le);if(Pa===null){ke===null&&(ke=We);break}e&&ke&&Pa.alternate===null&&t(G,ke),$=u(Pa,$,Ue),Ze===null?Re=Pa:Ze.sibling=Pa,Ze=Pa,ke=We}if(Je.done)return l(G,ke),Ke&&la(G,Ue),Re;if(ke===null){for(;!Je.done;Ue++,Je=Y.next())Je=se(G,Je.value,le),Je!==null&&($=u(Je,$,Ue),Ze===null?Re=Je:Ze.sibling=Je,Ze=Je);return Ke&&la(G,Ue),Re}for(ke=s(ke);!Je.done;Ue++,Je=Y.next())Je=ee(ke,G,Ue,Je.value,le),Je!==null&&(e&&Je.alternate!==null&&ke.delete(Je.key===null?Ue:Je.key),$=u(Je,$,Ue),Ze===null?Re=Je:Ze.sibling=Je,Ze=Je);return e&&ke.forEach(function(U1){return t(G,U1)}),Ke&&la(G,Ue),Re}function dt(G,$,Y,le){if(typeof Y=="object"&&Y!==null&&Y.type===A&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:e:{for(var Re=Y.key;$!==null;){if($.key===Re){if(Re=Y.type,Re===A){if($.tag===7){l(G,$.sibling),le=c($,Y.props.children),le.return=G,G=le;break e}}else if($.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===D&&cl(Re)===$.type){l(G,$.sibling),le=c($,Y.props),Hr(le,Y),le.return=G,G=le;break e}l(G,$);break}else t(G,$);$=$.sibling}Y.type===A?(le=ll(Y.props.children,G.mode,le,Y.key),le.return=G,G=le):(le=Ks(Y.type,Y.key,Y.props,null,G.mode,le),Hr(le,Y),le.return=G,G=le)}return b(G);case k:e:{for(Re=Y.key;$!==null;){if($.key===Re)if($.tag===4&&$.stateNode.containerInfo===Y.containerInfo&&$.stateNode.implementation===Y.implementation){l(G,$.sibling),le=c($,Y.children||[]),le.return=G,G=le;break e}else{l(G,$);break}else t(G,$);$=$.sibling}le=Jo(Y,G.mode,le),le.return=G,G=le}return b(G);case D:return Y=cl(Y),dt(G,$,Y,le)}if(z(Y))return je(G,$,Y,le);if(F(Y)){if(Re=F(Y),typeof Re!="function")throw Error(o(150));return Y=Re.call(Y),Ae(G,$,Y,le)}if(typeof Y.then=="function")return dt(G,$,ni(Y),le);if(Y.$$typeof===O)return dt(G,$,Zs(G,Y),le);ai(G,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,$!==null&&$.tag===6?(l(G,$.sibling),le=c($,Y),le.return=G,G=le):(l(G,$),le=Zo(Y,G.mode,le),le.return=G,G=le),b(G)):l(G,$)}return function(G,$,Y,le){try{Ir=0;var Re=dt(G,$,Y,le);return Gl=null,Re}catch(ke){if(ke===Pl||ke===ei)throw ke;var Ze=mn(29,ke,null,G.mode);return Ze.lanes=le,Ze.return=G,Ze}finally{}}}var ul=lp(!0),rp=lp(!1),Na=!1;function uc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function fc(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 Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(tt&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ws(e),$f(e,null,l),t}return Ys(e,s,t,l),Ws(e)}function Ur(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Ku(e,l)}}function pc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?c=u=b:u=u.next=b,l=l.next}while(l!==null);u===null?c=u=t:u=u.next=t}else c=u=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var mc=!1;function Vr(){if(mc){var e=$l;if(e!==null)throw e}}function $r(e,t,l,s){mc=!1;var c=e.updateQueue;Na=!1;var u=c.firstBaseUpdate,b=c.lastBaseUpdate,N=c.shared.pending;if(N!==null){c.shared.pending=null;var H=N,K=H.next;H.next=null,b===null?u=K:b.next=K,b=H;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==b&&(N===null?ne.firstBaseUpdate=K:N.next=K,ne.lastBaseUpdate=H))}if(u!==null){var se=c.baseState;b=0,ne=K=H=null,N=u;do{var X=N.lane&-536870913,ee=X!==N.lane;if(ee?(Ye&X)===X:(s&X)===X){X!==0&&X===Vl&&(mc=!0),ne!==null&&(ne=ne.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var je=e,Ae=N;X=t;var dt=l;switch(Ae.tag){case 1:if(je=Ae.payload,typeof je=="function"){se=je.call(dt,se,X);break e}se=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Ae.payload,X=typeof je=="function"?je.call(dt,se,X):je,X==null)break e;se=v({},se,X);break e;case 2:Na=!0}}X=N.callback,X!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=c.callbacks,ee===null?c.callbacks=[X]:ee.push(X))}else ee={lane:X,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(K=ne=ee,H=se):ne=ne.next=ee,b|=X;if(N=N.next,N===null){if(N=c.shared.pending,N===null)break;ee=N,N=ee.next,ee.next=null,c.lastBaseUpdate=ee,c.shared.pending=null}}while(!0);ne===null&&(H=se),c.baseState=H,c.firstBaseUpdate=K,c.lastBaseUpdate=ne,u===null&&(c.shared.lanes=0),La|=b,e.lanes=b,e.memoizedState=se}}function sp(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function ip(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)sp(l[e],t)}var Fl=_(null),li=_(0);function op(e,t){e=ha,ie(li,e),ie(Fl,t),ha=e|t.baseLanes}function hc(){ie(li,ha),ie(Fl,Fl.current)}function xc(){ha=li.current,W(Fl),W(li)}var hn=_(null),Ln=null;function Ra(e){var t=e.alternate;ie(Tt,Tt.current&1),ie(hn,e),Ln===null&&(t===null||Fl.current!==null||t.memoizedState!==null)&&(Ln=e)}function gc(e){ie(Tt,Tt.current),ie(hn,e),Ln===null&&(Ln=e)}function cp(e){e.tag===22?(ie(Tt,Tt.current),ie(hn,e),Ln===null&&(Ln=e)):Aa()}function Aa(){ie(Tt,Tt.current),ie(hn,hn.current)}function xn(e){W(hn),Ln===e&&(Ln=null),W(Tt)}var Tt=_(0);function ri(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||kd(l)||wd(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 ia=0,He=null,ot=null,zt=null,si=!1,ql=!1,fl=!1,ii=0,Pr=0,Yl=null,Ay=0;function wt(){throw Error(o(321))}function vc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!pn(e[l],t[l]))return!1;return!0}function yc(e,t,l,s,c,u){return ia=u,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?qp:Dc,fl=!1,u=l(s,c),fl=!1,ql&&(u=up(t,l,s,c)),dp(e),u}function dp(e){R.H=qr;var t=ot!==null&&ot.next!==null;if(ia=0,zt=ot=He=null,si=!1,Pr=0,Yl=null,t)throw Error(o(300));e===null||Lt||(e=e.dependencies,e!==null&&Qs(e)&&(Lt=!0))}function up(e,t,l,s){He=e;var c=0;do{if(ql&&(Yl=null),Pr=0,ql=!1,25<=c)throw Error(o(301));if(c+=1,zt=ot=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}R.H=Yp,u=t(l,s)}while(ql);return u}function My(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(ot!==null?ot.memoizedState:null)!==e&&(He.flags|=1024),t}function bc(){var e=ii!==0;return ii=0,e}function jc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Sc(e){if(si){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}si=!1}ia=0,zt=ot=He=null,ql=!1,Pr=ii=0,Yl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zt===null?He.memoizedState=zt=e:zt=zt.next=e,zt}function Rt(){if(ot===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=ot.next;var t=zt===null?He.memoizedState:zt.next;if(t!==null)zt=t,ot=e;else{if(e===null)throw He.alternate===null?Error(o(467)):Error(o(310));ot=e,e={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},zt===null?He.memoizedState=zt=e:zt=zt.next=e}return zt}function oi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=Pr;return Pr+=1,Yl===null&&(Yl=[]),e=tp(Yl,e,t),t=He,(zt===null?t.memoizedState:zt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?qp:Dc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===O)return qt(e)}throw Error(o(438,String(e)))}function kc(e){var t=null,l=He.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=He.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=oi(),He.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=B;return t.index++,l}function oa(e,t){return typeof t=="function"?t(e):t}function di(e){var t=Rt();return wc(t,ot,e)}function wc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,u=s.pending;if(u!==null){if(c!==null){var b=c.next;c.next=u.next,u.next=b}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var N=b=null,H=null,K=t,ne=!1;do{var se=K.lane&-536870913;if(se!==K.lane?(Ye&se)===se:(ia&se)===se){var X=K.revertLane;if(X===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),se===Vl&&(ne=!0);else if((ia&X)===X){K=K.next,X===Vl&&(ne=!0);continue}else se={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(N=H=se,b=u):H=H.next=se,He.lanes|=X,La|=X;se=K.action,fl&&l(u,se),u=K.hasEagerState?K.eagerState:l(u,se)}else X={lane:se,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(N=H=X,b=u):H=H.next=X,He.lanes|=se,La|=se;K=K.next}while(K!==null&&K!==t);if(H===null?b=u:H.next=N,!pn(u,e.memoizedState)&&(Lt=!0,ne&&(l=$l,l!==null)))throw l;e.memoizedState=u,e.baseState=b,e.baseQueue=H,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Cc(e){var t=Rt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,u=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do u=e(u,b.action),b=b.next;while(b!==c);pn(u,t.memoizedState)||(Lt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),l.lastRenderedState=u}return[u,s]}function fp(e,t,l){var s=He,c=Rt(),u=Ke;if(u){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!pn((ot||c).memoizedState,l);if(b&&(c.memoizedState=l,Lt=!0),c=c.queue,Tc(hp.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||zt!==null&&zt.memoizedState.tag&1){if(s.flags|=2048,Wl(9,{destroy:void 0},mp.bind(null,s,c,l,t),null),ft===null)throw Error(o(349));u||(ia&127)!==0||pp(s,t,l)}return l}function pp(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=He.updateQueue,t===null?(t=oi(),He.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function mp(e,t,l,s){t.value=l,t.getSnapshot=s,xp(t)&&gp(e)}function hp(e,t,l){return l(function(){xp(t)&&gp(e)})}function xp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!pn(e,l)}catch{return!0}}function gp(e){var t=al(e,2);t!==null&&fn(t,e,2)}function Nc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){kt(!0);try{l()}finally{kt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:e},t}function vp(e,t,l,s){return e.baseState=l,wc(e,ot,typeof s=="function"?s:oa)}function zy(e,t,l,s,c){if(pi(e))throw Error(o(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){u.listeners.push(b)}};R.T!==null?l(!0):u.isTransition=!1,s(u),l=t.pending,l===null?(u.next=t.pending=u,yp(t,u)):(u.next=l.next,t.pending=l.next=u)}}function yp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=R.T,b={};R.T=b;try{var N=l(c,s),H=R.S;H!==null&&H(b,N),bp(e,t,N)}catch(K){Ec(e,t,K)}finally{u!==null&&b.types!==null&&(u.types=b.types),R.T=u}}else try{u=l(c,s),bp(e,t,u)}catch(K){Ec(e,t,K)}}function bp(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){jp(e,t,s)},function(s){return Ec(e,t,s)}):jp(e,t,l)}function jp(e,t,l){t.status="fulfilled",t.value=l,Sp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,yp(e,l)))}function Ec(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,Sp(t),t=t.next;while(t!==s)}e.action=null}function Sp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function kp(e,t){return t}function wp(e,t){if(Ke){var l=ft.formState;if(l!==null){e:{var s=He;if(Ke){if(pt){t:{for(var c=pt,u=zn;c.nodeType!==8;){if(!u){c=null;break t}if(c=Dn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){pt=Dn(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kp,lastRenderedState:t},l.queue=s,l=Pp.bind(null,He,s),s.dispatch=l,s=Nc(!1),u=Lc.bind(null,He,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=zy.bind(null,He,c,u,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function Cp(e){var t=Rt();return Np(t,ot,e)}function Np(e,t,l){if(t=wc(e,t,kp)[0],e=di(oa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Pl?ei:b}else s=t;t=Rt();var c=t.queue,u=c.dispatch;return l!==t.memoizedState&&(He.flags|=2048,Wl(9,{destroy:void 0},Ly.bind(null,c,l),null)),[s,u,e]}function Ly(e,t){e.action=t}function Ep(e){var t=Rt(),l=ot;if(l!==null)return Np(t,l,e);Rt(),t=t.memoizedState,l=Rt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Wl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=He.updateQueue,t===null&&(t=oi(),He.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function Tp(){return Rt().memoizedState}function ui(e,t,l,s){var c=Jt();He.flags|=e,c.memoizedState=Wl(1|t,{destroy:void 0},l,s===void 0?null:s)}function fi(e,t,l,s){var c=Rt();s=s===void 0?null:s;var u=c.memoizedState.inst;ot!==null&&s!==null&&vc(s,ot.memoizedState.deps)?c.memoizedState=Wl(t,u,l,s):(He.flags|=e,c.memoizedState=Wl(1|t,u,l,s))}function Rp(e,t){ui(8390656,8,e,t)}function Tc(e,t){fi(2048,8,e,t)}function Dy(e){He.flags|=4;var t=He.updateQueue;if(t===null)t=oi(),He.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function Ap(e){var t=Rt().memoizedState;return Dy({ref:t,nextImpl:e}),function(){if((tt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function Mp(e,t){return fi(4,2,e,t)}function zp(e,t){return fi(4,4,e,t)}function Lp(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 Dp(e,t,l){l=l!=null?l.concat([e]):null,fi(4,4,Lp.bind(null,t,e),l)}function Rc(){}function _p(e,t){var l=Rt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&vc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Op(e,t){var l=Rt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&vc(t,s[1]))return s[0];if(s=e(),fl){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[s,t],s}function Ac(e,t,l){return l===void 0||(ia&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Bm(),He.lanes|=e,La|=e,l)}function Bp(e,t,l,s){return pn(l,t)?l:Fl.current!==null?(e=Ac(e,l,s),pn(e,t)||(Lt=!0),e):(ia&42)===0||(ia&1073741824)!==0&&(Ye&261930)===0?(Lt=!0,e.memoizedState=l):(e=Bm(),He.lanes|=e,La|=e,t)}function Ip(e,t,l,s,c){var u=I.p;I.p=u!==0&&8>u?u:8;var b=R.T,N={};R.T=N,Lc(e,!1,t,l);try{var H=c(),K=R.S;if(K!==null&&K(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ne=Ry(H,s);Fr(e,t,ne,yn(e))}else Fr(e,t,s,yn(e))}catch(se){Fr(e,t,{then:function(){},status:"rejected",reason:se},yn())}finally{I.p=u,b!==null&&N.types!==null&&(b.types=N.types),R.T=b}}function _y(){}function Mc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Hp(e).queue;Ip(e,c,t,Z,l===null?_y:function(){return Up(e),l(s)})}function Hp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:Z},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:oa,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Up(e){var t=Hp(e);t.next===null&&(t=e.alternate.memoizedState),Fr(e,t.next.queue,{},yn())}function zc(){return qt(os)}function Vp(){return Rt().memoizedState}function $p(){return Rt().memoizedState}function Oy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=yn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(fn(s,t,l),Ur(s,t,l)),t={cache:ic()},e.payload=t;return}t=t.return}}function By(e,t,l){var s=yn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},pi(e)?Gp(t,l):(l=Xo(e,t,l,s),l!==null&&(fn(l,e,s),Fp(l,t,s)))}function Pp(e,t,l){var s=yn();Fr(e,t,l,s)}function Fr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(pi(e))Gp(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var b=t.lastRenderedState,N=u(b,l);if(c.hasEagerState=!0,c.eagerState=N,pn(N,b))return Ys(e,t,c,0),ft===null&&qs(),!1}catch{}finally{}if(l=Xo(e,t,c,s),l!==null)return fn(l,e,s),Fp(l,t,s),!0}return!1}function Lc(e,t,l,s){if(s={lane:2,revertLane:ud(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},pi(e)){if(t)throw Error(o(479))}else t=Xo(e,l,s,2),t!==null&&fn(t,e,2)}function pi(e){var t=e.alternate;return e===He||t!==null&&t===He}function Gp(e,t){ql=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Fp(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Ku(e,l)}}var qr={readContext:qt,use:ci,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};qr.useEffectEvent=wt;var qp={readContext:qt,use:ci,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:Rp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,ui(4194308,4,Lp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return ui(4194308,4,e,t)},useInsertionEffect:function(e,t){ui(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){kt(!0);try{e()}finally{kt(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(fl){kt(!0);try{l(t)}finally{kt(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=By.bind(null,He,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Nc(e);var t=e.queue,l=Pp.bind(null,He,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Jt();return Ac(l,e,t)},useTransition:function(){var e=Nc(!1);return e=Ip.bind(null,He,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=He,c=Jt();if(Ke){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ft===null)throw Error(o(349));(Ye&127)!==0||pp(s,t,l)}c.memoizedState=l;var u={value:l,getSnapshot:t};return c.queue=u,Rp(hp.bind(null,s,u,e),[e]),s.flags|=2048,Wl(9,{destroy:void 0},mp.bind(null,s,u,l,t),null),l},useId:function(){var e=Jt(),t=ft.identifierPrefix;if(Ke){var l=qn,s=Fn;l=(s&~(1<<32-jt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Ay++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:zc,useFormState:wp,useActionState:wp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Lc.bind(null,He,!0,l),l.dispatch=t,[e,t]},useMemoCache:kc,useCacheRefresh:function(){return Jt().memoizedState=Oy.bind(null,He)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((tt&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Dc={readContext:qt,use:ci,useCallback:_p,useContext:qt,useEffect:Tc,useImperativeHandle:Dp,useInsertionEffect:Mp,useLayoutEffect:zp,useMemo:Op,useReducer:di,useRef:Tp,useState:function(){return di(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Rt();return Bp(l,ot.memoizedState,e,t)},useTransition:function(){var e=di(oa)[0],t=Rt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:fp,useId:Vp,useHostTransitionStatus:zc,useFormState:Cp,useActionState:Cp,useOptimistic:function(e,t){var l=Rt();return vp(l,ot,e,t)},useMemoCache:kc,useCacheRefresh:$p};Dc.useEffectEvent=Ap;var Yp={readContext:qt,use:ci,useCallback:_p,useContext:qt,useEffect:Tc,useImperativeHandle:Dp,useInsertionEffect:Mp,useLayoutEffect:zp,useMemo:Op,useReducer:Cc,useRef:Tp,useState:function(){return Cc(oa)},useDebugValue:Rc,useDeferredValue:function(e,t){var l=Rt();return ot===null?Ac(l,e,t):Bp(l,ot.memoizedState,e,t)},useTransition:function(){var e=Cc(oa)[0],t=Rt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:fp,useId:Vp,useHostTransitionStatus:zc,useFormState:Ep,useActionState:Ep,useOptimistic:function(e,t){var l=Rt();return ot!==null?vp(l,ot,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:kc,useCacheRefresh:$p};Yp.useEffectEvent=Ap;function _c(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:v({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Oc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=yn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(fn(t,e,s),Ur(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=yn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(fn(t,e,s),Ur(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=yn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(fn(t,e,l),Ur(t,e,l))}};function Wp(e,t,l,s,c,u,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,b):t.prototype&&t.prototype.isPureReactComponent?!zr(l,s)||!zr(c,u):!0}function Kp(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Oc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=v({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Xp(e){Fs(e)}function Qp(e){console.error(e)}function Zp(e){Fs(e)}function mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Jp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Bc(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){mi(e,t)},l}function em(e){return e=Ea(e),e.tag=3,e}function tm(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;e.payload=function(){return c(u)},e.callback=function(){Jp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Jp(t,l,s),typeof c!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var N=s.stack;this.componentDidCatch(s.value,{componentStack:N!==null?N:""})})}function Iy(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Ul(t,l,c,!0),l=hn.current,l!==null){switch(l.tag){case 31:case 13:return Ln===null?Ni():l.alternate===null&&Ct===0&&(Ct=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),od(e,s,c)),!1;case 22:return l.flags|=65536,s===ti?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),od(e,s,c)),!1}throw Error(o(435,l.tag))}return od(e,s,c),Ni(),!1}if(Ke)return t=hn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==nc&&(e=Error(o(422),{cause:s}),_r(Rn(e,l)))):(s!==nc&&(t=Error(o(423),{cause:s}),_r(Rn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Rn(s,l),c=Bc(e.stateNode,s,c),pc(e,c),Ct!==4&&(Ct=2)),!1;var u=Error(o(520),{cause:s});if(u=Rn(u,l),es===null?es=[u]:es.push(u),Ct!==4&&(Ct=2),t===null)return!0;s=Rn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=Bc(l.stateNode,s,e),pc(l,e),!1;case 1:if(t=l.type,u=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Da===null||!Da.has(u))))return l.flags|=65536,c&=-c,l.lanes|=c,c=em(c),tm(c,e,l,s),pc(l,c),!1}l=l.return}while(l!==null);return!1}var Ic=Error(o(461)),Lt=!1;function Yt(e,t,l,s){t.child=e===null?rp(t,null,l,s):ul(t,e.child,l,s)}function nm(e,t,l,s,c){l=l.render;var u=t.ref;if("ref"in s){var b={};for(var N in s)N!=="ref"&&(b[N]=s[N])}else b=s;return il(t),s=yc(e,t,l,b,u,c),N=bc(),e!==null&&!Lt?(jc(e,t,c),ca(e,t,c)):(Ke&&N&&ec(t),t.flags|=1,Yt(e,t,s,c),t.child)}function am(e,t,l,s,c){if(e===null){var u=l.type;return typeof u=="function"&&!Qo(u)&&u.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=u,lm(e,t,u,s,c)):(e=Ks(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!qc(e,c)){var b=u.memoizedProps;if(l=l.compare,l=l!==null?l:zr,l(b,s)&&e.ref===t.ref)return ca(e,t,c)}return t.flags|=1,e=aa(u,s),e.ref=t.ref,e.return=t,t.child=e}function lm(e,t,l,s,c){if(e!==null){var u=e.memoizedProps;if(zr(u,s)&&e.ref===t.ref)if(Lt=!1,t.pendingProps=s=u,qc(e,c))(e.flags&131072)!==0&&(Lt=!0);else return t.lanes=e.lanes,ca(e,t,c)}return Hc(e,t,l,s,c)}function rm(e,t,l,s){var c=s.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~u}else s=0,t.child=null;return sm(e,t,u,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Js(t,u!==null?u.cachePool:null),u!==null?op(t,u):hc(),cp(t);else return s=t.lanes=536870912,sm(e,t,u!==null?u.baseLanes|l:l,l,s)}else u!==null?(Js(t,u.cachePool),op(t,u),Aa(),t.memoizedState=null):(e!==null&&Js(t,null),hc(),Aa());return Yt(e,t,c,l),t.child}function Yr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function sm(e,t,l,s,c){var u=cc();return u=u===null?null:{parent:Mt._currentValue,pool:u},t.memoizedState={baseLanes:l,cachePool:u},e!==null&&Js(t,null),hc(),cp(t),e!==null&&Ul(e,t,s,!0),t.childLanes=c,null}function hi(e,t){return t=gi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function im(e,t,l){return ul(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,xn(t),t.memoizedState=null,e}function Hy(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ke){if(s.mode==="hidden")return e=hi(t,s),t.lanes=536870912,Yr(null,e);if(gc(t),(e=pt)?(e=yh(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Fn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Gf(e),l.return=t,t.child=l,Ft=t,pt=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return hi(t,s)}var u=e.memoizedState;if(u!==null){var b=u.dehydrated;if(gc(t),c)if(t.flags&256)t.flags&=-257,t=im(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Lt||Ul(e,t,l,!1),c=(l&e.childLanes)!==0,Lt||c){if(s=ft,s!==null&&(b=Xu(s,l),b!==0&&b!==u.retryLane))throw u.retryLane=b,al(e,b),fn(s,e,b),Ic;Ni(),t=im(e,t,l)}else e=u.treeContext,pt=Dn(b.nextSibling),Ft=t,Ke=!0,ka=null,zn=!1,e!==null&&Yf(t,e),t=hi(t,s),t.flags|=4096;return t}return e=aa(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function xi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Hc(e,t,l,s,c){return il(t),l=yc(e,t,l,s,void 0,c),s=bc(),e!==null&&!Lt?(jc(e,t,c),ca(e,t,c)):(Ke&&s&&ec(t),t.flags|=1,Yt(e,t,l,c),t.child)}function om(e,t,l,s,c,u){return il(t),t.updateQueue=null,l=up(t,s,l,c),dp(e),s=bc(),e!==null&&!Lt?(jc(e,t,u),ca(e,t,u)):(Ke&&s&&ec(t),t.flags|=1,Yt(e,t,l,u),t.child)}function cm(e,t,l,s,c){if(il(t),t.stateNode===null){var u=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(u=qt(b)),u=new l(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Oc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},uc(t),b=l.contextType,u.context=typeof b=="object"&&b!==null?qt(b):Ol,u.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(_c(t,l,b,s),u.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(b=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),b!==u.state&&Oc.enqueueReplaceState(u,u.state,null),$r(t,s,u,c),Vr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var N=t.memoizedProps,H=pl(l,N);u.props=H;var K=u.context,ne=l.contextType;b=Ol,typeof ne=="object"&&ne!==null&&(b=qt(ne));var se=l.getDerivedStateFromProps;ne=typeof se=="function"||typeof u.getSnapshotBeforeUpdate=="function",N=t.pendingProps!==N,ne||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(N||K!==b)&&Kp(t,u,s,b),Na=!1;var X=t.memoizedState;u.state=X,$r(t,s,u,c),Vr(),K=t.memoizedState,N||X!==K||Na?(typeof se=="function"&&(_c(t,l,se,s),K=t.memoizedState),(H=Na||Wp(t,l,H,s,X,K,b))?(ne||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=K),u.props=s,u.state=K,u.context=b,s=H):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,fc(e,t),b=t.memoizedProps,ne=pl(l,b),u.props=ne,se=t.pendingProps,X=u.context,K=l.contextType,H=Ol,typeof K=="object"&&K!==null&&(H=qt(K)),N=l.getDerivedStateFromProps,(K=typeof N=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(b!==se||X!==H)&&Kp(t,u,s,H),Na=!1,X=t.memoizedState,u.state=X,$r(t,s,u,c),Vr();var ee=t.memoizedState;b!==se||X!==ee||Na||e!==null&&e.dependencies!==null&&Qs(e.dependencies)?(typeof N=="function"&&(_c(t,l,N,s),ee=t.memoizedState),(ne=Na||Wp(t,l,ne,s,X,ee,H)||e!==null&&e.dependencies!==null&&Qs(e.dependencies))?(K||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,ee,H),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,ee,H)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ee),u.props=s,u.state=ee,u.context=H,s=ne):(typeof u.componentDidUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&X===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,xi(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=ul(t,e.child,null,c),t.child=ul(t,null,l,c)):Yt(e,t,l,c),t.memoizedState=u.state,e=t.child):e=ca(e,t,c),e}function dm(e,t,l,s){return rl(),t.flags|=256,Yt(e,t,l,s),t.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Vc(e){return{baseLanes:e,cachePool:Jf()}}function $c(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function um(e,t,l){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,b;if((b=u)||(b=e!==null&&e.memoizedState===null?!1:(Tt.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ke){if(c?Ra(t):Aa(),(e=pt)?(e=yh(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:Fn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=Gf(e),l.return=t,t.child=l,Ft=t,pt=null)):e=null,e===null)throw wa(t);return wd(e)?t.lanes=32:t.lanes=536870912,null}var N=s.children;return s=s.fallback,c?(Aa(),c=t.mode,N=gi({mode:"hidden",children:N},c),s=ll(s,c,l,null),N.return=t,s.return=t,N.sibling=s,t.child=N,s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,Yr(null,s)):(Ra(t),Pc(t,N))}var H=e.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(u)t.flags&256?(Ra(t),t.flags&=-257,t=Gc(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),N=s.fallback,c=t.mode,s=gi({mode:"visible",children:s.children},c),N=ll(N,c,l,null),N.flags|=2,s.return=t,N.return=t,s.sibling=N,t.child=s,ul(t,e.child,null,l),s=t.child,s.memoizedState=Vc(l),s.childLanes=$c(e,b,l),t.memoizedState=Uc,t=Yr(null,s));else if(Ra(t),wd(N)){if(b=N.nextSibling&&N.nextSibling.dataset,b)var K=b.dgst;b=K,s=Error(o(419)),s.stack="",s.digest=b,_r({value:s,source:null,stack:null}),t=Gc(e,t,l)}else if(Lt||Ul(e,t,l,!1),b=(l&e.childLanes)!==0,Lt||b){if(b=ft,b!==null&&(s=Xu(b,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,al(e,s),fn(b,e,s),Ic;kd(N)||Ni(),t=Gc(e,t,l)}else kd(N)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,pt=Dn(N.nextSibling),Ft=t,Ke=!0,ka=null,zn=!1,e!==null&&Yf(t,e),t=Pc(t,s.children),t.flags|=4096);return t}return c?(Aa(),N=s.fallback,c=t.mode,H=e.child,K=H.sibling,s=aa(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,K!==null?N=aa(K,N):(N=ll(N,c,l,null),N.flags|=2),N.return=t,s.return=t,s.sibling=N,t.child=s,Yr(null,s),s=t.child,N=e.child.memoizedState,N===null?N=Vc(l):(c=N.cachePool,c!==null?(H=Mt._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Jf(),N={baseLanes:N.baseLanes|l,cachePool:c}),s.memoizedState=N,s.childLanes=$c(e,b,l),t.memoizedState=Uc,Yr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=aa(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Pc(e,t){return t=gi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function gi(e,t){return e=mn(22,e,null,t),e.lanes=0,e}function Gc(e,t,l){return ul(t,e.child,null,l),e=Pc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fm(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),rc(e.return,t,l)}function Fc(e,t,l,s,c,u){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:u}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=u)}function pm(e,t,l){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var b=Tt.current,N=(b&2)!==0;if(N?(b=b&1|2,t.flags|=128):b&=1,ie(Tt,b),Yt(e,t,s,l),s=Ke?Dr:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fm(e,l,t);else if(e.tag===19)fm(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(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ri(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),Fc(t,!1,c,l,u,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ri(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}Fc(t,!0,l,null,u,s);break;case"together":Fc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ca(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),La|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ul(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=aa(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=aa(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function qc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Qs(e)))}function Uy(e,t,l){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Ca(t,Mt,e.memoizedState.cache),rl();break;case 27:case 5:De(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,gc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?um(e,t,l):(Ra(t),e=ca(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Ul(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return pm(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ie(Tt,Tt.current),s)break;return null;case 22:return t.lanes=0,rm(e,t,l,t.pendingProps);case 24:Ca(t,Mt,e.memoizedState.cache)}return ca(e,t,l)}function mm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Lt=!0;else{if(!qc(e,l)&&(t.flags&128)===0)return Lt=!1,Uy(e,t,l);Lt=(e.flags&131072)!==0}else Lt=!1,Ke&&(t.flags&1048576)!==0&&qf(t,Dr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Qo(e)?(s=pl(e,s),t.tag=1,t=cm(null,t,e,s,l)):(t.tag=0,t=Hc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===U){t.tag=11,t=nm(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=am(null,t,e,s,l);break e}}throw t=Q(e)||e,Error(o(306,t,""))}}return t;case 0:return Hc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),cm(e,t,s,c,l);case 3:e:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,fc(e,t),$r(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,Mt,s),s!==u.cache&&sc(t,[Mt],l,!0),Vr(),s=b.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=dm(e,t,s,l);break e}else if(s!==c){c=Rn(Error(o(424)),t),_r(c),t=dm(e,t,s,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(pt=Dn(e.firstChild),Ft=t,Ke=!0,ka=null,zn=!0,l=rp(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=ca(e,t,l);break e}Yt(e,t,s,l)}t=t.child}return t;case 26:return xi(e,t),e===null?(l=Ch(t.type,null,t.pendingProps,null))?t.memoizedState=l:Ke||(l=t.type,e=t.pendingProps,s=Li(xe.current).createElement(l),s[Gt]=t,s[rn]=e,Wt(s,l,e),Ut(s),t.stateNode=s):t.memoizedState=Ch(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return De(t),e===null&&Ke&&(s=t.stateNode=Sh(t.type,t.pendingProps,xe.current),Ft=t,zn=!0,c=pt,Ia(t.type)?(Cd=c,pt=Dn(s.firstChild)):pt=c),Yt(e,t,t.pendingProps.children,l),xi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ke&&((c=s=pt)&&(s=x1(s,t.type,t.pendingProps,zn),s!==null?(t.stateNode=s,Ft=t,pt=Dn(s.firstChild),zn=!1,c=!0):c=!1),c||wa(t)),De(t),c=t.type,u=t.pendingProps,b=e!==null?e.memoizedProps:null,s=u.children,bd(c,u)?s=null:b!==null&&bd(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=yc(e,t,My,null,null,l),os._currentValue=c),xi(e,t),Yt(e,t,s,l),t.child;case 6:return e===null&&Ke&&((e=l=pt)&&(l=g1(l,t.pendingProps,zn),l!==null?(t.stateNode=l,Ft=t,pt=null,e=!0):e=!1),e||wa(t)),null;case 13:return um(e,t,l);case 4:return oe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=ul(t,null,s,l):Yt(e,t,s,l),t.child;case 11:return nm(e,t,t.type,t.pendingProps,l);case 7:return Yt(e,t,t.pendingProps,l),t.child;case 8:return Yt(e,t,t.pendingProps.children,l),t.child;case 12:return Yt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Yt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=qt(c),s=s(c),t.flags|=1,Yt(e,t,s,l),t.child;case 14:return am(e,t,t.type,t.pendingProps,l);case 15:return lm(e,t,t.type,t.pendingProps,l);case 19:return pm(e,t,l);case 31:return Hy(e,t,l);case 22:return rm(e,t,l,t.pendingProps);case 24:return il(t),s=qt(Mt),e===null?(c=cc(),c===null&&(c=ft,u=ic(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=l),c=u),t.memoizedState={parent:s,cache:c},uc(t),Ca(t,Mt,c)):((e.lanes&l)!==0&&(fc(e,t),$r(t,null,null,l),Vr()),c=e.memoizedState,u=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,Mt,s)):(s=u.cache,Ca(t,Mt,s),s!==c.cache&&sc(t,[Mt],l,!0))),Yt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function da(e){e.flags|=4}function Yc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Vm())e.flags|=8192;else throw dl=ti,dc}else e.flags&=-16777217}function hm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Ah(t))if(Vm())e.flags|=8192;else throw dl=ti,dc}function vi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Yu():536870912,e.lanes|=t,Zl|=t)}function Wr(e,t){if(!Ke)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 s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function Vy(e,t,l){var s=t.pendingProps;switch(tc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(t),null;case 1:return mt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),sa(Mt),Se(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?da(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,ac())),mt(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(da(t),u!==null?(mt(t),hm(t,u)):(mt(t),Yc(t,c,null,s,l))):u?u!==e.memoizedState?(da(t),mt(t),hm(t,u)):(mt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&da(t),mt(t),Yc(t,c,e,s,l)),null;case 27:if(Ie(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&da(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return mt(t),null}e=ue.current,Hl(t)?Wf(t):(e=Sh(c,s,l),t.stateNode=e,da(t))}return mt(t),null;case 5:if(Ie(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&da(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return mt(t),null}if(u=ue.current,Hl(t))Wf(t);else{var b=Li(xe.current);switch(u){case 1:u=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=b.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}u[Gt]=t,u[rn]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)u.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=u;e:switch(Wt(u,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&da(t)}}return mt(t),Yc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&da(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=Ft,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||uh(e.nodeValue,l)),e||wa(t,!0)}else e=Li(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return mt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),e=!1}else l=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(xn(t),t):(xn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return mt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),c=!1}else c=ac(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(xn(t),t):(xn(t),null)}return xn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),vi(t,t.updateQueue),mt(t),null);case 4:return Se(),e===null&&hd(t.stateNode.containerInfo),mt(t),null;case 10:return sa(t.type),mt(t),null;case 19:if(W(Tt),s=t.memoizedState,s===null)return mt(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)Wr(s,!1);else{if(Ct!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ri(e),u!==null){for(t.flags|=128,Wr(s,!1),e=u.updateQueue,t.updateQueue=e,vi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Pf(l,e),l=l.sibling;return ie(Tt,Tt.current&1|2),Ke&&la(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&<()>ki&&(t.flags|=128,c=!0,Wr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ri(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,vi(t,e),Wr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ke)return mt(t),null}else 2*lt()-s.renderingStartTime>ki&&l!==536870912&&(t.flags|=128,c=!0,Wr(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=lt(),e.sibling=null,l=Tt.current,ie(Tt,c?l&1|2:l&1),Ke&&la(t,s.treeForkCount),e):(mt(t),null);case 22:case 23:return xn(t),xc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(mt(t),t.subtreeFlags&6&&(t.flags|=8192)):mt(t),l=t.updateQueue,l!==null&&vi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&W(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),sa(Mt),mt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function $y(e,t){switch(tc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(Mt),Se(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ie(t),null;case 31:if(t.memoizedState!==null){if(xn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(xn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(Tt),null;case 4:return Se(),null;case 10:return sa(t.type),null;case 22:case 23:return xn(t),xc(),e!==null&&W(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(Mt),null;case 25:return null;default:return null}}function xm(e,t){switch(tc(t),t.tag){case 3:sa(Mt),Se();break;case 26:case 27:case 5:Ie(t);break;case 4:Se();break;case 31:t.memoizedState!==null&&xn(t);break;case 13:xn(t);break;case 19:W(Tt);break;case 10:sa(t.type);break;case 22:case 23:xn(t),xc(),e!==null&&W(ol);break;case 24:sa(Mt)}}function Kr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var u=l.create,b=l.inst;s=u(),b.destroy=s}l=l.next}while(l!==c)}}catch(N){it(t,t.return,N)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var u=c.next;s=u;do{if((s.tag&e)===e){var b=s.inst,N=b.destroy;if(N!==void 0){b.destroy=void 0,c=t;var H=l,K=N;try{K()}catch(ne){it(c,H,ne)}}}s=s.next}while(s!==u)}}catch(ne){it(t,t.return,ne)}}function gm(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{ip(t,l)}catch(s){it(e,e.return,s)}}}function vm(e,t,l){l.props=pl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){it(e,t,s)}}function Xr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){it(e,t,c)}}function Yn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){it(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){it(e,t,c)}else l.current=null}function ym(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){it(e,e.return,c)}}function Wc(e,t,l){try{var s=e.stateNode;d1(s,e.type,l,t),s[rn]=t}catch(c){it(e,e.return,c)}}function bm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ia(e.type)||e.tag===4}function Kc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bm(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&&Ia(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 Xc(e,t,l){var s=e.tag;if(s===5||s===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=ta));else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Xc(e,t,l),e=e.sibling;e!==null;)Xc(e,t,l),e=e.sibling}function yi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ia(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(yi(e,t,l),e=e.sibling;e!==null;)yi(e,t,l),e=e.sibling}function jm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Wt(t,s,l),t[Gt]=e,t[rn]=l}catch(u){it(e,e.return,u)}}var ua=!1,Dt=!1,Qc=!1,Sm=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function Py(e,t){if(e=e.containerInfo,vd=Ui,e=Df(e),Go(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break e}var b=0,N=-1,H=-1,K=0,ne=0,se=e,X=null;t:for(;;){for(var ee;se!==l||c!==0&&se.nodeType!==3||(N=b+c),se!==u||s!==0&&se.nodeType!==3||(H=b+s),se.nodeType===3&&(b+=se.nodeValue.length),(ee=se.firstChild)!==null;)X=se,se=ee;for(;;){if(se===e)break t;if(X===l&&++K===c&&(N=b),X===u&&++ne===s&&(H=b),(ee=se.nextSibling)!==null)break;se=X,X=se.parentNode}se=ee}l=N===-1||H===-1?null:{start:N,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(yd={focusedElem:e,selectionRange:l},Ui=!1,Vt=t;Vt!==null;)if(t=Vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vt=e;else for(;Vt!==null;){switch(t=Vt,u=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++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,l=t,c=u.memoizedProps,u=u.memoizedState,s=l.stateNode;try{var je=pl(l.type,c);e=s.getSnapshotBeforeUpdate(je,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){it(l,l.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Sd(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Sd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Vt=e;break}Vt=t.return}}function km(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:pa(e,l),s&4&&Kr(5,l);break;case 1:if(pa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){it(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){it(l,l.return,b)}}s&64&&gm(l),s&512&&Xr(l,l.return);break;case 3:if(pa(e,l),s&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{ip(e,t)}catch(b){it(l,l.return,b)}}break;case 27:t===null&&s&4&&jm(l);case 26:case 5:pa(e,l),t===null&&s&4&&ym(l),s&512&&Xr(l,l.return);break;case 12:pa(e,l);break;case 31:pa(e,l),s&4&&Nm(e,l);break;case 13:pa(e,l),s&4&&Em(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Zy.bind(null,l),v1(e,l))));break;case 22:if(s=l.memoizedState!==null||ua,!s){t=t!==null&&t.memoizedState!==null||Dt,c=ua;var u=Dt;ua=s,(Dt=t)&&!u?ma(e,l,(l.subtreeFlags&8772)!==0):pa(e,l),ua=c,Dt=u}break;case 30:break;default:pa(e,l)}}function wm(e){var t=e.alternate;t!==null&&(e.alternate=null,wm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Eo(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 vt=null,on=!1;function fa(e,t,l){for(l=l.child;l!==null;)Cm(e,t,l),l=l.sibling}function Cm(e,t,l){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(Zn,l)}catch{}switch(l.tag){case 26:Dt||Yn(l,t),fa(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Dt||Yn(l,t);var s=vt,c=on;Ia(l.type)&&(vt=l.stateNode,on=!1),fa(e,t,l),rs(l.stateNode),vt=s,on=c;break;case 5:Dt||Yn(l,t);case 6:if(s=vt,c=on,vt=null,fa(e,t,l),vt=s,on=c,vt!==null)if(on)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(u){it(l,t,u)}else try{vt.removeChild(l.stateNode)}catch(u){it(l,t,u)}break;case 18:vt!==null&&(on?(e=vt,gh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):gh(vt,l.stateNode));break;case 4:s=vt,c=on,vt=l.stateNode.containerInfo,on=!0,fa(e,t,l),vt=s,on=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),Dt||Ma(4,l,t),fa(e,t,l);break;case 1:Dt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&vm(l,t,s)),fa(e,t,l);break;case 21:fa(e,t,l);break;case 22:Dt=(s=Dt)||l.memoizedState!==null,fa(e,t,l),Dt=s;break;default:fa(e,t,l)}}function Nm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){it(t,t.return,l)}}}function Em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){it(t,t.return,l)}}function Gy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Sm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Sm),t;default:throw Error(o(435,e.tag))}}function bi(e,t){var l=Gy(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Jy.bind(null,e,s);s.then(c,c)}})}function cn(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],u=e,b=t,N=b;e:for(;N!==null;){switch(N.tag){case 27:if(Ia(N.type)){vt=N.stateNode,on=!1;break e}break;case 5:vt=N.stateNode,on=!1;break e;case 3:case 4:vt=N.stateNode.containerInfo,on=!0;break e}N=N.return}if(vt===null)throw Error(o(160));Cm(u,b,c),vt=null,on=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tm(t,e),t=t.sibling}var Vn=null;function Tm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:cn(t,e),dn(e),s&4&&(Ma(3,e,e.return),Kr(3,e),Ma(5,e,e.return));break;case 1:cn(t,e),dn(e),s&512&&(Dt||l===null||Yn(l,l.return)),s&64&&ua&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=Vn;if(cn(t,e),dn(e),s&512&&(Dt||l===null||Yn(l,l.return)),s&4){var u=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":u=c.getElementsByTagName("title")[0],(!u||u[kr]||u[Gt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),Wt(u,s,l),u[Gt]=e,Ut(u),s=u;break e;case"link":var b=Th("link","href",c).get(s+(l.href||""));if(b){for(var N=0;N<b.length;N++)if(u=b[N],u.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&u.getAttribute("rel")===(l.rel==null?null:l.rel)&&u.getAttribute("title")===(l.title==null?null:l.title)&&u.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(N,1);break t}}u=c.createElement(s),Wt(u,s,l),c.head.appendChild(u);break;case"meta":if(b=Th("meta","content",c).get(s+(l.content||""))){for(N=0;N<b.length;N++)if(u=b[N],u.getAttribute("content")===(l.content==null?null:""+l.content)&&u.getAttribute("name")===(l.name==null?null:l.name)&&u.getAttribute("property")===(l.property==null?null:l.property)&&u.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&u.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(N,1);break t}}u=c.createElement(s),Wt(u,s,l),c.head.appendChild(u);break;default:throw Error(o(468,s))}u[Gt]=e,Ut(u),s=u}e.stateNode=s}else Rh(c,e.type,e.stateNode);else e.stateNode=Eh(c,s,e.memoizedProps);else u!==s?(u===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):u.count--,s===null?Rh(c,e.type,e.stateNode):Eh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,l.memoizedProps)}break;case 27:cn(t,e),dn(e),s&512&&(Dt||l===null||Yn(l,l.return)),l!==null&&s&4&&Wc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(cn(t,e),dn(e),s&512&&(Dt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(je){it(e,e.return,je)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Wc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Qc=!0);break;case 6:if(cn(t,e),dn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(je){it(e,e.return,je)}}break;case 3:if(Oi=null,c=Vn,Vn=Di(t.containerInfo),cn(t,e),Vn=c,dn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(je){it(e,e.return,je)}Qc&&(Qc=!1,Rm(e));break;case 4:s=Vn,Vn=Di(e.stateNode.containerInfo),cn(t,e),dn(e),Vn=s;break;case 12:cn(t,e),dn(e);break;case 31:cn(t,e),dn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 13:cn(t,e),dn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Si=lt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=ua,ne=Dt;if(ua=K||c,Dt=ne||H,cn(t,e),Dt=ne,ua=K,dn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||ua||Dt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(u=H.stateNode,c)b=u.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{N=H.stateNode;var se=H.memoizedProps.style,X=se!=null&&se.hasOwnProperty("display")?se.display:null;N.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(je){it(H,H.return,je)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(je){it(H,H.return,je)}}}else if(t.tag===18){if(l===null){H=t;try{var ee=H.stateNode;c?vh(ee,!0):vh(H.stateNode,!1)}catch(je){it(H,H.return,je)}}}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}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,bi(e,l))));break;case 19:cn(t,e),dn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,bi(e,s)));break;case 30:break;case 21:break;default:cn(t,e),dn(e)}}function dn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(bm(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,u=Kc(e);yi(e,u,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var N=Kc(e);yi(e,N,b);break;case 3:case 4:var H=l.stateNode.containerInfo,K=Kc(e);Xc(e,K,H);break;default:throw Error(o(161))}}catch(ne){it(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Rm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Rm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)km(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&vm(t,t.return,l),ml(t);break;case 27:rs(t.stateNode);case 26:case 5:Yn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function ma(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,b=u.flags;switch(u.tag){case 0:case 11:case 15:ma(c,u,l),Kr(4,u);break;case 1:if(ma(c,u,l),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(K){it(s,s.return,K)}if(s=u,c=s.updateQueue,c!==null){var N=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)sp(H[c],N)}catch(K){it(s,s.return,K)}}l&&b&64&&gm(u),Xr(u,u.return);break;case 27:jm(u);case 26:case 5:ma(c,u,l),l&&s===null&&b&4&&ym(u),Xr(u,u.return);break;case 12:ma(c,u,l);break;case 31:ma(c,u,l),l&&b&4&&Nm(c,u);break;case 13:ma(c,u,l),l&&b&4&&Em(c,u);break;case 22:u.memoizedState===null&&ma(c,u,l),Xr(u,u.return);break;case 30:break;default:ma(c,u,l)}t=t.sibling}}function Zc(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&&Or(l))}function Jc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Or(e))}function $n(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Am(e,t,l,s),t=t.sibling}function Am(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:$n(e,t,l,s),c&2048&&Kr(9,t);break;case 1:$n(e,t,l,s);break;case 3:$n(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Or(e)));break;case 12:if(c&2048){$n(e,t,l,s),e=t.stateNode;try{var u=t.memoizedProps,b=u.id,N=u.onPostCommit;typeof N=="function"&&N(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){it(t,t.return,H)}}else $n(e,t,l,s);break;case 31:$n(e,t,l,s);break;case 13:$n(e,t,l,s);break;case 23:break;case 22:u=t.stateNode,b=t.alternate,t.memoizedState!==null?u._visibility&2?$n(e,t,l,s):Qr(e,t):u._visibility&2?$n(e,t,l,s):(u._visibility|=2,Kl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Zc(b,t);break;case 24:$n(e,t,l,s),c&2048&&Jc(t.alternate,t);break;default:$n(e,t,l,s)}}function Kl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,b=t,N=l,H=s,K=b.flags;switch(b.tag){case 0:case 11:case 15:Kl(u,b,N,H,c),Kr(8,b);break;case 23:break;case 22:var ne=b.stateNode;b.memoizedState!==null?ne._visibility&2?Kl(u,b,N,H,c):Qr(u,b):(ne._visibility|=2,Kl(u,b,N,H,c)),c&&K&2048&&Zc(b.alternate,b);break;case 24:Kl(u,b,N,H,c),c&&K&2048&&Jc(b.alternate,b);break;default:Kl(u,b,N,H,c)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Qr(l,s),c&2048&&Zc(s.alternate,s);break;case 24:Qr(l,s),c&2048&&Jc(s.alternate,s);break;default:Qr(l,s)}t=t.sibling}}var Zr=8192;function Xl(e,t,l){if(e.subtreeFlags&Zr)for(e=e.child;e!==null;)Mm(e,t,l),e=e.sibling}function Mm(e,t,l){switch(e.tag){case 26:Xl(e,t,l),e.flags&Zr&&e.memoizedState!==null&&A1(l,Vn,e.memoizedState,e.memoizedProps);break;case 5:Xl(e,t,l);break;case 3:case 4:var s=Vn;Vn=Di(e.stateNode.containerInfo),Xl(e,t,l),Vn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Zr,Zr=16777216,Xl(e,t,l),Zr=s):Xl(e,t,l));break;default:Xl(e,t,l)}}function zm(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 Jr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Vt=s,Dm(s,e)}zm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Lm(e),e=e.sibling}function Lm(e){switch(e.tag){case 0:case 11:case 15:Jr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Jr(e);break;case 12:Jr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ji(e)):Jr(e);break;default:Jr(e)}}function ji(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];Vt=s,Dm(s,e)}zm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),ji(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,ji(t));break;default:ji(t)}e=e.sibling}}function Dm(e,t){for(;Vt!==null;){var l=Vt;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Or(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,Vt=s;else e:for(l=e;Vt!==null;){s=Vt;var c=s.sibling,u=s.return;if(wm(s),s===l){Vt=null;break e}if(c!==null){c.return=u,Vt=c;break e}Vt=u}}}var Fy={getCacheForType:function(e){var t=qt(Mt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return qt(Mt).controller.signal}},qy=typeof WeakMap=="function"?WeakMap:Map,tt=0,ft=null,Fe=null,Ye=0,st=0,gn=null,za=!1,Ql=!1,ed=!1,ha=0,Ct=0,La=0,hl=0,td=0,vn=0,Zl=0,es=null,un=null,nd=!1,Si=0,_m=0,ki=1/0,wi=null,Da=null,Ot=0,_a=null,Jl=null,xa=0,ad=0,ld=null,Om=null,ts=0,rd=null;function yn(){return(tt&2)!==0&&Ye!==0?Ye&-Ye:R.T!==null?ud():Qu()}function Bm(){if(vn===0)if((Ye&536870912)===0||Ke){var e=Ht;Ht<<=1,(Ht&3932160)===0&&(Ht=262144),vn=e}else vn=536870912;return e=hn.current,e!==null&&(e.flags|=32),vn}function fn(e,t,l){(e===ft&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Ye,vn,!1)),Sr(e,l),((tt&2)===0||e!==ft)&&(e===ft&&((tt&2)===0&&(hl|=l),Ct===4&&Oa(e,Ye,vn,!1)),Wn(e))}function Im(e,t,l){if((tt&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Cn(e,t),c=s?Ky(e,t):id(e,t,!0),u=s;do{if(c===0){Ql&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,u&&!Yy(l)){c=id(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var N=e;c=es;var H=N.current.memoizedState.isDehydrated;if(H&&(er(N,b).flags|=256),b=id(N,b,!1),b!==2){if(ed&&!H){N.errorRecoveryDisabledLanes|=u,hl|=u,c=4;break e}u=un,un=c,u!==null&&(un===null?un=u:un.push.apply(un,u))}c=b}if(u=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,u=c,u){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!za);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=Si+300-lt(),10<c)){if(Oa(s,t,vn,!za),jr(s,0,!0)!==0)break e;xa=t,s.timeoutHandle=hh(Hm.bind(null,s,l,un,wi,nd,t,vn,hl,Zl,za,u,"Throttled",-0,0),c);break e}Hm(s,l,un,wi,nd,t,vn,hl,Zl,za,u,null,-0,0)}}break}while(!0);Wn(e)}function Hm(e,t,l,s,c,u,b,N,H,K,ne,se,X,ee){if(e.timeoutHandle=-1,se=t.subtreeFlags,se&8192||(se&16785408)===16785408){se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ta},Mm(t,u,se);var je=(u&62914560)===u?Si-lt():(u&4194048)===u?_m-lt():0;if(je=M1(se,je),je!==null){xa=u,e.cancelPendingCommit=je(Ym.bind(null,e,t,u,l,s,c,b,N,H,ne,se,null,X,ee)),Oa(e,u,b,!K);return}}Ym(e,t,u,l,s,c,b,N,H)}function Yy(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 s=0;s<l.length;s++){var c=l[s],u=c.getSnapshot;c=c.value;try{if(!pn(u(),c))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 Oa(e,t,l,s){t&=~td,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-jt(c),b=1<<u;s[u]=-1,c&=~b}l!==0&&Wu(e,l,t)}function Ci(){return(tt&6)===0?(ns(0),!1):!0}function sd(){if(Fe!==null){if(st===0)var e=Fe.return;else e=Fe,ra=sl=null,Sc(e),Gl=null,Ir=0,e=Fe;for(;e!==null;)xm(e.alternate,e),e=e.return;Fe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,p1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),xa=0,sd(),ft=e,Fe=l=aa(e.current,null),Ye=t,st=0,gn=null,za=!1,Ql=Cn(e,t),ed=!1,Zl=vn=td=hl=La=Ct=0,un=es=null,nd=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-jt(s),u=1<<c;t|=e[c],s&=~u}return ha=t,qs(),l}function Um(e,t){He=null,R.H=qr,t===Pl||t===ei?(t=np(),st=3):t===dc?(t=np(),st=4):st=t===Ic?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,gn=t,Fe===null&&(Ct=1,mi(e,Rn(t,e.current)))}function Vm(){var e=hn.current;return e===null?!0:(Ye&4194048)===Ye?Ln===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===Ln:!1}function $m(){var e=R.H;return R.H=qr,e===null?qr:e}function Pm(){var e=R.A;return R.A=Fy,e}function Ni(){Ct=4,za||(Ye&4194048)!==Ye&&hn.current!==null||(Ql=!0),(La&134217727)===0&&(hl&134217727)===0||ft===null||Oa(ft,Ye,vn,!1)}function id(e,t,l){var s=tt;tt|=2;var c=$m(),u=Pm();(ft!==e||Ye!==t)&&(wi=null,er(e,t)),t=!1;var b=Ct;e:do try{if(st!==0&&Fe!==null){var N=Fe,H=gn;switch(st){case 8:sd(),b=6;break e;case 3:case 2:case 9:case 6:hn.current===null&&(t=!0);var K=st;if(st=0,gn=null,tr(e,N,H,K),l&&Ql){b=0;break e}break;default:K=st,st=0,gn=null,tr(e,N,H,K)}}Wy(),b=Ct;break}catch(ne){Um(e,ne)}while(!0);return t&&e.shellSuspendCounter++,ra=sl=null,tt=s,R.H=c,R.A=u,Fe===null&&(ft=null,Ye=0,qs()),b}function Wy(){for(;Fe!==null;)Gm(Fe)}function Ky(e,t){var l=tt;tt|=2;var s=$m(),c=Pm();ft!==e||Ye!==t?(wi=null,ki=lt()+500,er(e,t)):Ql=Cn(e,t);e:do try{if(st!==0&&Fe!==null){t=Fe;var u=gn;t:switch(st){case 1:st=0,gn=null,tr(e,t,u,1);break;case 2:case 9:if(ep(u)){st=0,gn=null,Fm(t);break}t=function(){st!==2&&st!==9||ft!==e||(st=7),Wn(e)},u.then(t,t);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:ep(u)?(st=0,gn=null,Fm(t)):(st=0,gn=null,tr(e,t,u,7));break;case 5:var b=null;switch(Fe.tag){case 26:b=Fe.memoizedState;case 5:case 27:var N=Fe;if(b?Ah(b):N.stateNode.complete){st=0,gn=null;var H=N.sibling;if(H!==null)Fe=H;else{var K=N.return;K!==null?(Fe=K,Ei(K)):Fe=null}break t}}st=0,gn=null,tr(e,t,u,5);break;case 6:st=0,gn=null,tr(e,t,u,6);break;case 8:sd(),Ct=6;break e;default:throw Error(o(462))}}Xy();break}catch(ne){Um(e,ne)}while(!0);return ra=sl=null,R.H=s,R.A=c,tt=l,Fe!==null?0:(ft=null,Ye=0,qs(),Ct)}function Xy(){for(;Fe!==null&&!$t();)Gm(Fe)}function Gm(e){var t=mm(e.alternate,e,ha);e.memoizedProps=e.pendingProps,t===null?Ei(e):Fe=t}function Fm(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=om(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=om(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:Sc(t);default:xm(l,t),t=Fe=Pf(t,ha),t=mm(l,t,ha)}e.memoizedProps=e.pendingProps,t===null?Ei(e):Fe=t}function tr(e,t,l,s){ra=sl=null,Sc(t),Gl=null,Ir=0;var c=t.return;try{if(Iy(e,c,t,l,Ye)){Ct=1,mi(e,Rn(l,e.current)),Fe=null;return}}catch(u){if(c!==null)throw Fe=c,u;Ct=1,mi(e,Rn(l,e.current)),Fe=null;return}t.flags&32768?(Ke||s===1?e=!0:Ql||(Ye&536870912)!==0?e=!1:(za=e=!0,(s===2||s===9||s===3||s===6)&&(s=hn.current,s!==null&&s.tag===13&&(s.flags|=16384))),qm(t,e)):Ei(t)}function Ei(e){var t=e;do{if((t.flags&32768)!==0){qm(t,za);return}e=t.return;var l=Vy(t.alternate,t,ha);if(l!==null){Fe=l;return}if(t=t.sibling,t!==null){Fe=t;return}Fe=t=e}while(t!==null);Ct===0&&(Ct=5)}function qm(e,t){do{var l=$y(e.alternate,e);if(l!==null){l.flags&=32767,Fe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Fe=e;return}Fe=e=l}while(e!==null);Ct=6,Fe=null}function Ym(e,t,l,s,c,u,b,N,H){e.cancelPendingCommit=null;do Ti();while(Ot!==0);if((tt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(u=t.lanes|t.childLanes,u|=Ko,Rv(e,l,u,b,N,H),e===ft&&(Fe=ft=null,Ye=0),Jl=t,_a=e,xa=l,ad=u,ld=c,Om=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,e1(Le,function(){return Zm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=R.T,R.T=null,c=I.p,I.p=2,b=tt,tt|=4;try{Py(e,t,l)}finally{tt=b,I.p=c,R.T=s}}Ot=1,Wm(),Km(),Xm()}}function Wm(){if(Ot===1){Ot=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=R.T,R.T=null;var s=I.p;I.p=2;var c=tt;tt|=4;try{Tm(t,e);var u=yd,b=Df(e.containerInfo),N=u.focusedElem,H=u.selectionRange;if(b!==N&&N&&N.ownerDocument&&Lf(N.ownerDocument.documentElement,N)){if(H!==null&&Go(N)){var K=H.start,ne=H.end;if(ne===void 0&&(ne=K),"selectionStart"in N)N.selectionStart=K,N.selectionEnd=Math.min(ne,N.value.length);else{var se=N.ownerDocument||document,X=se&&se.defaultView||window;if(X.getSelection){var ee=X.getSelection(),je=N.textContent.length,Ae=Math.min(H.start,je),dt=H.end===void 0?Ae:Math.min(H.end,je);!ee.extend&&Ae>dt&&(b=dt,dt=Ae,Ae=b);var G=zf(N,Ae),$=zf(N,dt);if(G&&$&&(ee.rangeCount!==1||ee.anchorNode!==G.node||ee.anchorOffset!==G.offset||ee.focusNode!==$.node||ee.focusOffset!==$.offset)){var Y=se.createRange();Y.setStart(G.node,G.offset),ee.removeAllRanges(),Ae>dt?(ee.addRange(Y),ee.extend($.node,$.offset)):(Y.setEnd($.node,$.offset),ee.addRange(Y))}}}}for(se=[],ee=N;ee=ee.parentNode;)ee.nodeType===1&&se.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<se.length;N++){var le=se[N];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Ui=!!vd,yd=vd=null}finally{tt=c,I.p=s,R.T=l}}e.current=t,Ot=2}}function Km(){if(Ot===2){Ot=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=R.T,R.T=null;var s=I.p;I.p=2;var c=tt;tt|=4;try{km(e,t.alternate,t)}finally{tt=c,I.p=s,R.T=l}}Ot=3}}function Xm(){if(Ot===4||Ot===3){Ot=0,Pt();var e=_a,t=Jl,l=xa,s=Om;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ot=5:(Ot=0,Jl=_a=null,Qm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Da=null),Co(l),t=t.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(Zn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=R.T,c=I.p,I.p=2,R.T=null;try{for(var u=e.onRecoverableError,b=0;b<s.length;b++){var N=s[b];u(N.value,{componentStack:N.stack})}}finally{R.T=t,I.p=c}}(xa&3)!==0&&Ti(),Wn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===rd?ts++:(ts=0,rd=e):ts=0,ns(0)}}function Qm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Or(t)))}function Ti(){return Wm(),Km(),Xm(),Zm()}function Zm(){if(Ot!==5)return!1;var e=_a,t=ad;ad=0;var l=Co(xa),s=R.T,c=I.p;try{I.p=32>l?32:l,R.T=null,l=ld,ld=null;var u=_a,b=xa;if(Ot=0,Jl=_a=null,xa=0,(tt&6)!==0)throw Error(o(331));var N=tt;if(tt|=4,Lm(u.current),Am(u,u.current,b,l),tt=N,ns(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(Zn,u)}catch{}return!0}finally{I.p=c,R.T=s,Qm(e,t)}}function Jm(e,t,l){t=Rn(l,t),t=Bc(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(Sr(e,2),Wn(e))}function it(e,t,l){if(e.tag===3)Jm(e,e,l);else for(;t!==null;){if(t.tag===3){Jm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Da===null||!Da.has(s))){e=Rn(l,e),l=em(2),s=Ta(t,l,2),s!==null&&(tm(l,s,t,e),Sr(s,2),Wn(s));break}}t=t.return}}function od(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new qy;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(ed=!0,c.add(l),e=Qy.bind(null,e,t,l),t.then(e,e))}function Qy(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ft===e&&(Ye&l)===l&&(Ct===4||Ct===3&&(Ye&62914560)===Ye&&300>lt()-Si?(tt&2)===0&&er(e,0):td|=l,Zl===Ye&&(Zl=0)),Wn(e)}function eh(e,t){t===0&&(t=Yu()),e=al(e,t),e!==null&&(Sr(e,t),Wn(e))}function Zy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),eh(e,l)}function Jy(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),eh(e,l)}function e1(e,t){return Qe(e,t)}var Ri=null,nr=null,cd=!1,Ai=!1,dd=!1,Ba=0;function Wn(e){e!==nr&&e.next===null&&(nr===null?Ri=nr=e:nr=nr.next=e),Ai=!0,cd||(cd=!0,n1())}function ns(e,t){if(!dd&&Ai){dd=!0;do for(var l=!1,s=Ri;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var b=s.suspendedLanes,N=s.pingedLanes;u=(1<<31-jt(42|e)+1)-1,u&=c&~(b&~N),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,lh(s,u))}else u=Ye,u=jr(s,s===ft?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Cn(s,u)||(l=!0,lh(s,u));s=s.next}while(l);dd=!1}}function t1(){th()}function th(){Ai=cd=!1;var e=0;Ba!==0&&f1()&&(e=Ba);for(var t=lt(),l=null,s=Ri;s!==null;){var c=s.next,u=nh(s,t);u===0?(s.next=null,l===null?Ri=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(u&3)!==0)&&(Ai=!0)),s=c}Ot!==0&&Ot!==5||ns(e),Ba!==0&&(Ba=0)}function nh(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var b=31-jt(u),N=1<<b,H=c[b];H===-1?((N&l)===0||(N&s)!==0)&&(c[b]=So(N,t)):H<=t&&(e.expiredLanes|=N),u&=~N}if(t=ft,l=Ye,l=jr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(st===2||st===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&at(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Cn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&at(s),Co(l)){case 2:case 8:l=At;break;case 32:l=Le;break;case 268435456:l=Kt;break;default:l=Le}return s=ah.bind(null,e),l=Qe(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&at(s),e.callbackPriority=2,e.callbackNode=null,2}function ah(e,t){if(Ot!==0&&Ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ti()&&e.callbackNode!==l)return null;var s=Ye;return s=jr(e,e===ft?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Im(e,s,t),nh(e,lt()),e.callbackNode!=null&&e.callbackNode===l?ah.bind(null,e):null)}function lh(e,t){if(Ti())return null;Im(e,t,!0)}function n1(){m1(function(){(tt&6)!==0?Qe(ye,t1):th()})}function ud(){if(Ba===0){var e=Vl;e===0&&(e=$e,$e<<=1,($e&261888)===0&&($e=256)),Ba=e}return Ba}function rh(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Is(""+e)}function sh(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 a1(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var u=rh((c[rn]||null).action),b=s.submitter;b&&(t=(t=b[rn]||null)?rh(t.formAction):b.getAttribute("formAction"),t!==null&&(u=t,b=null));var N=new $s("action","action",null,s,c);e.push({event:N,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var H=b?sh(c,b):new FormData(c);Mc(l,{pending:!0,data:H,method:c.method,action:u},null,H)}}else typeof u=="function"&&(N.preventDefault(),H=b?sh(c,b):new FormData(c),Mc(l,{pending:!0,data:H,method:c.method,action:u},u,H))},currentTarget:c}]})}}for(var fd=0;fd<Wo.length;fd++){var pd=Wo[fd],l1=pd.toLowerCase(),r1=pd[0].toUpperCase()+pd.slice(1);Un(l1,"on"+r1)}Un(Bf,"onAnimationEnd"),Un(If,"onAnimationIteration"),Un(Hf,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(jy,"onTransitionRun"),Un(Sy,"onTransitionStart"),Un(ky,"onTransitionCancel"),Un(Uf,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var as="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(" "),s1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(as));function ih(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var b=s.length-1;0<=b;b--){var N=s[b],H=N.instance,K=N.currentTarget;if(N=N.listener,H!==u&&c.isPropagationStopped())break e;u=N,c.currentTarget=K;try{u(c)}catch(ne){Fs(ne)}c.currentTarget=null,u=H}else for(b=0;b<s.length;b++){if(N=s[b],H=N.instance,K=N.currentTarget,N=N.listener,H!==u&&c.isPropagationStopped())break e;u=N,c.currentTarget=K;try{u(c)}catch(ne){Fs(ne)}c.currentTarget=null,u=H}}}}function qe(e,t){var l=t[No];l===void 0&&(l=t[No]=new Set);var s=e+"__bubble";l.has(s)||(oh(t,e,2,!1),l.add(s))}function md(e,t,l){var s=0;t&&(s|=4),oh(l,e,s,t)}var Mi="_reactListening"+Math.random().toString(36).slice(2);function hd(e){if(!e[Mi]){e[Mi]=!0,ef.forEach(function(l){l!=="selectionchange"&&(s1.has(l)||md(l,!1,e),md(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Mi]||(t[Mi]=!0,md("selectionchange",!1,t))}}function oh(e,t,l,s){switch(Bh(t)){case 2:var c=D1;break;case 8:c=_1;break;default:c=Ad}l=c.bind(null,t,l,e),c=void 0,!_o||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function xd(e,t,l,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var N=s.stateNode.containerInfo;if(N===c)break;if(b===4)for(b=s.return;b!==null;){var H=b.tag;if((H===3||H===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;N!==null;){if(b=wl(N),b===null)return;if(H=b.tag,H===5||H===6||H===26||H===27){s=u=b;continue e}N=N.parentNode}}s=s.return}pf(function(){var K=u,ne=Lo(l),se=[];e:{var X=Vf.get(e);if(X!==void 0){var ee=$s,je=e;switch(e){case"keypress":if(Us(l)===0)break e;case"keydown":case"keyup":ee=Jv;break;case"focusin":je="focus",ee=Ho;break;case"focusout":je="blur",ee=Ho;break;case"beforeblur":case"afterblur":ee=Ho;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":ee=xf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Vv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=ny;break;case Bf:case If:case Hf:ee=Gv;break;case Uf:ee=ly;break;case"scroll":case"scrollend":ee=Hv;break;case"wheel":ee=sy;break;case"copy":case"cut":case"paste":ee=qv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=vf;break;case"toggle":case"beforetoggle":ee=oy}var Ae=(t&4)!==0,dt=!Ae&&(e==="scroll"||e==="scrollend"),G=Ae?X!==null?X+"Capture":null:X;Ae=[];for(var $=K,Y;$!==null;){var le=$;if(Y=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||Y===null||G===null||(le=Cr($,G),le!=null&&Ae.push(ls($,le,Y))),dt)break;$=$.return}0<Ae.length&&(X=new ee(X,je,null,l,ne),se.push({event:X,listeners:Ae}))}}if((t&7)===0){e:{if(X=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",X&&l!==zo&&(je=l.relatedTarget||l.fromElement)&&(wl(je)||je[kl]))break e;if((ee||X)&&(X=ne.window===ne?ne:(X=ne.ownerDocument)?X.defaultView||X.parentWindow:window,ee?(je=l.relatedTarget||l.toElement,ee=K,je=je?wl(je):null,je!==null&&(dt=p(je),Ae=je.tag,je!==dt||Ae!==5&&Ae!==27&&Ae!==6)&&(je=null)):(ee=null,je=K),ee!==je)){if(Ae=xf,le="onMouseLeave",G="onMouseEnter",$="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=vf,le="onPointerLeave",G="onPointerEnter",$="pointer"),dt=ee==null?X:wr(ee),Y=je==null?X:wr(je),X=new Ae(le,$+"leave",ee,l,ne),X.target=dt,X.relatedTarget=Y,le=null,wl(ne)===K&&(Ae=new Ae(G,$+"enter",je,l,ne),Ae.target=Y,Ae.relatedTarget=dt,le=Ae),dt=le,ee&&je)t:{for(Ae=i1,G=ee,$=je,Y=0,le=G;le;le=Ae(le))Y++;le=0;for(var Re=$;Re;Re=Ae(Re))le++;for(;0<Y-le;)G=Ae(G),Y--;for(;0<le-Y;)$=Ae($),le--;for(;Y--;){if(G===$||$!==null&&G===$.alternate){Ae=G;break t}G=Ae(G),$=Ae($)}Ae=null}else Ae=null;ee!==null&&ch(se,X,ee,Ae,!1),je!==null&&dt!==null&&ch(se,dt,je,Ae,!0)}}e:{if(X=K?wr(K):window,ee=X.nodeName&&X.nodeName.toLowerCase(),ee==="select"||ee==="input"&&X.type==="file")var Ze=Nf;else if(wf(X))if(Ef)Ze=vy;else{Ze=xy;var ke=hy}else ee=X.nodeName,!ee||ee.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?K&&Mo(K.elementType)&&(Ze=Nf):Ze=gy;if(Ze&&(Ze=Ze(e,K))){Cf(se,Ze,l,ne);break e}ke&&ke(e,X,K),e==="focusout"&&K&&X.type==="number"&&K.memoizedProps.value!=null&&Ao(X,"number",X.value)}switch(ke=K?wr(K):window,e){case"focusin":(wf(ke)||ke.contentEditable==="true")&&(Ll=ke,Fo=K,Lr=null);break;case"focusout":Lr=Fo=Ll=null;break;case"mousedown":qo=!0;break;case"contextmenu":case"mouseup":case"dragend":qo=!1,_f(se,l,ne);break;case"selectionchange":if(by)break;case"keydown":case"keyup":_f(se,l,ne)}var Ue;if(Vo)e:{switch(e){case"compositionstart":var We="onCompositionStart";break e;case"compositionend":We="onCompositionEnd";break e;case"compositionupdate":We="onCompositionUpdate";break e}We=void 0}else zl?Sf(e,l)&&(We="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(We="onCompositionStart");We&&(yf&&l.locale!=="ko"&&(zl||We!=="onCompositionStart"?We==="onCompositionEnd"&&zl&&(Ue=mf()):(ja=ne,Oo="value"in ja?ja.value:ja.textContent,zl=!0)),ke=zi(K,We),0<ke.length&&(We=new gf(We,e,null,l,ne),se.push({event:We,listeners:ke}),Ue?We.data=Ue:(Ue=kf(l),Ue!==null&&(We.data=Ue)))),(Ue=dy?uy(e,l):fy(e,l))&&(We=zi(K,"onBeforeInput"),0<We.length&&(ke=new gf("onBeforeInput","beforeinput",null,l,ne),se.push({event:ke,listeners:We}),ke.data=Ue)),a1(se,e,K,l,ne)}ih(se,t)})}function ls(e,t,l){return{instance:e,listener:t,currentTarget:l}}function zi(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Cr(e,l),c!=null&&s.unshift(ls(e,c,u)),c=Cr(e,t),c!=null&&s.push(ls(e,c,u))),e.tag===3)return s;e=e.return}return[]}function i1(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ch(e,t,l,s,c){for(var u=t._reactName,b=[];l!==null&&l!==s;){var N=l,H=N.alternate,K=N.stateNode;if(N=N.tag,H!==null&&H===s)break;N!==5&&N!==26&&N!==27||K===null||(H=K,c?(K=Cr(l,u),K!=null&&b.unshift(ls(l,K,H))):c||(K=Cr(l,u),K!=null&&b.push(ls(l,K,H)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var o1=/\r\n?/g,c1=/\u0000|\uFFFD/g;function dh(e){return(typeof e=="string"?e:""+e).replace(o1,`
|
|
50
|
+
`).replace(c1,"")}function uh(e,t){return t=dh(t),dh(e)===t}function ct(e,t,l,s,c,u){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":Os(e,"class",s);break;case"tabIndex":Os(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Os(e,l,s);break;case"style":uf(e,s,u);break;case"data":if(t!=="object"){Os(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="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 u=="function"&&(l==="formAction"?(t!=="input"&&ct(e,t,"name",c.name,c,null),ct(e,t,"formEncType",c.formEncType,c,null),ct(e,t,"formMethod",c.formMethod,c,null),ct(e,t,"formTarget",c.formTarget,c,null)):(ct(e,t,"encType",c.encType,c,null),ct(e,t,"method",c.method,c,null),ct(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Is(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ta);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Is(""+s),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":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":qe("beforetoggle",e),qe("toggle",e),_s(e,"popover",s);break;case"xlinkActuate":ea(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":ea(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":ea(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":ea(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":ea(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":ea(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":ea(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":ea(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":ea(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":_s(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Bv.get(l)||l,_s(e,l,s))}}function gd(e,t,l,s,c,u){switch(l){case"style":uf(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ta);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!tf.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),u=e[rn]||null,u=u!=null?u[l]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof s=="function")){typeof u!="function"&&u!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):_s(e,l,s)}}}function Wt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var s=!1,c=!1,u;for(u in l)if(l.hasOwnProperty(u)){var b=l[u];if(b!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,u,b,l,null)}}c&&ct(e,t,"srcSet",l.srcSet,l,null),s&&ct(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var N=u=b=c=null,H=null,K=null;for(s in l)if(l.hasOwnProperty(s)){var ne=l[s];if(ne!=null)switch(s){case"name":c=ne;break;case"type":b=ne;break;case"checked":H=ne;break;case"defaultChecked":K=ne;break;case"value":u=ne;break;case"defaultValue":N=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,t));break;default:ct(e,t,s,ne,l,null)}}sf(e,u,N,H,K,b,c,!1);return;case"select":qe("invalid",e),s=b=u=null;for(c in l)if(l.hasOwnProperty(c)&&(N=l[c],N!=null))switch(c){case"value":u=N;break;case"defaultValue":b=N;break;case"multiple":s=N;default:ct(e,t,c,N,l,null)}t=u,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),u=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(N=l[b],N!=null))switch(b){case"value":s=N;break;case"defaultValue":c=N;break;case"children":u=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(o(91));break;default:ct(e,t,b,N,l,null)}cf(e,s,c,u);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:ct(e,t,H,s,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(s=0;s<as.length;s++)qe(as[s],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("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(K in l)if(l.hasOwnProperty(K)&&(s=l[K],s!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,K,s,l,null)}return;default:if(Mo(t)){for(ne in l)l.hasOwnProperty(ne)&&(s=l[ne],s!==void 0&&gd(e,t,ne,s,l,void 0));return}}for(N in l)l.hasOwnProperty(N)&&(s=l[N],s!=null&&ct(e,t,N,s,l,null))}function d1(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,b=null,N=null,H=null,K=null,ne=null;for(ee in l){var se=l[ee];if(l.hasOwnProperty(ee)&&se!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":H=se;default:s.hasOwnProperty(ee)||ct(e,t,ee,null,s,se)}}for(var X in s){var ee=s[X];if(se=l[X],s.hasOwnProperty(X)&&(ee!=null||se!=null))switch(X){case"type":u=ee;break;case"name":c=ee;break;case"checked":K=ee;break;case"defaultChecked":ne=ee;break;case"value":b=ee;break;case"defaultValue":N=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:ee!==se&&ct(e,t,X,ee,s,se)}}Ro(e,b,N,H,K,ne,u,c);return;case"select":ee=b=N=X=null;for(u in l)if(H=l[u],l.hasOwnProperty(u)&&H!=null)switch(u){case"value":break;case"multiple":ee=H;default:s.hasOwnProperty(u)||ct(e,t,u,null,s,H)}for(c in s)if(u=s[c],H=l[c],s.hasOwnProperty(c)&&(u!=null||H!=null))switch(c){case"value":X=u;break;case"defaultValue":N=u;break;case"multiple":b=u;default:u!==H&&ct(e,t,c,u,s,H)}t=N,l=b,s=ee,X!=null?Tl(e,!!l,X,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":ee=X=null;for(N in l)if(c=l[N],l.hasOwnProperty(N)&&c!=null&&!s.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:ct(e,t,N,null,s,c)}for(b in s)if(c=s[b],u=l[b],s.hasOwnProperty(b)&&(c!=null||u!=null))switch(b){case"value":X=c;break;case"defaultValue":ee=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==u&&ct(e,t,b,c,s,u)}of(e,X,ee);return;case"option":for(var je in l)if(X=l[je],l.hasOwnProperty(je)&&X!=null&&!s.hasOwnProperty(je))switch(je){case"selected":e.selected=!1;break;default:ct(e,t,je,null,s,X)}for(H in s)if(X=s[H],ee=l[H],s.hasOwnProperty(H)&&X!==ee&&(X!=null||ee!=null))switch(H){case"selected":e.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:ct(e,t,H,X,s,ee)}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 Ae in l)X=l[Ae],l.hasOwnProperty(Ae)&&X!=null&&!s.hasOwnProperty(Ae)&&ct(e,t,Ae,null,s,X);for(K in s)if(X=s[K],ee=l[K],s.hasOwnProperty(K)&&X!==ee&&(X!=null||ee!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(o(137,t));break;default:ct(e,t,K,X,s,ee)}return;default:if(Mo(t)){for(var dt in l)X=l[dt],l.hasOwnProperty(dt)&&X!==void 0&&!s.hasOwnProperty(dt)&&gd(e,t,dt,void 0,s,X);for(ne in s)X=s[ne],ee=l[ne],!s.hasOwnProperty(ne)||X===ee||X===void 0&&ee===void 0||gd(e,t,ne,X,s,ee);return}}for(var G in l)X=l[G],l.hasOwnProperty(G)&&X!=null&&!s.hasOwnProperty(G)&&ct(e,t,G,null,s,X);for(se in s)X=s[se],ee=l[se],!s.hasOwnProperty(se)||X===ee||X==null&&ee==null||ct(e,t,se,X,s,ee)}function fh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function u1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],u=c.transferSize,b=c.initiatorType,N=c.duration;if(u&&N&&fh(b)){for(b=0,N=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],K=H.startTime;if(K>N)break;var ne=H.transferSize,se=H.initiatorType;ne&&fh(se)&&(H=H.responseEnd,b+=ne*(H<N?1:(N-K)/(H-K)))}if(--s,t+=8*(u+b)/(c.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 vd=null,yd=null;function Li(e){return e.nodeType===9?e:e.ownerDocument}function ph(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 mh(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 bd(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 jd=null;function f1(){var e=window.event;return e&&e.type==="popstate"?e===jd?!1:(jd=e,!0):(jd=null,!1)}var hh=typeof setTimeout=="function"?setTimeout:void 0,p1=typeof clearTimeout=="function"?clearTimeout:void 0,xh=typeof Promise=="function"?Promise:void 0,m1=typeof queueMicrotask=="function"?queueMicrotask:typeof xh<"u"?function(e){return xh.resolve(null).then(e).catch(h1)}:hh;function h1(e){setTimeout(function(){throw e})}function Ia(e){return e==="head"}function gh(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")rs(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,rs(l);for(var u=l.firstChild;u;){var b=u.nextSibling,N=u.nodeName;u[kr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&u.rel.toLowerCase()==="stylesheet"||l.removeChild(u),u=b}}else l==="body"&&rs(e.ownerDocument.body);l=c}while(l);sr(t)}function vh(e,t){var l=e;e=0;do{var s=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||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function Sd(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":Sd(l),Eo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function x1(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[kr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Dn(e.nextSibling),e===null)break}return null}function g1(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=Dn(e.nextSibling),e===null))return null;return e}function yh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Dn(e.nextSibling),e===null))return null;return e}function kd(e){return e.data==="$?"||e.data==="$~"}function wd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function v1(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Dn(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 Cd=null;function bh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return Dn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function jh(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 Sh(e,t,l){switch(t=Li(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function rs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Eo(e)}var _n=new Map,kh=new Set;function Di(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ga=I.d;I.d={f:y1,r:b1,D:j1,C:S1,L:k1,m:w1,X:N1,S:C1,M:E1};function y1(){var e=ga.f(),t=Ci();return e||t}function b1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?Up(t):ga.r(e)}var ar=typeof document>"u"?null:document;function wh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=En(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),kh.has(c)||(kh.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Wt(t,"link",e),Ut(t),s.head.appendChild(t)))}}function j1(e){ga.D(e),wh("dns-prefetch",e,null)}function S1(e,t){ga.C(e,t),wh("preconnect",e,t)}function k1(e,t,l){ga.L(e,t,l);var s=ar;if(s&&e&&t){var c='link[rel="preload"][as="'+En(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+En(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+En(l.imageSizes)+'"]')):c+='[href="'+En(e)+'"]';var u=c;switch(t){case"style":u=lr(e);break;case"script":u=rr(e)}_n.has(u)||(e=v({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),_n.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(ss(u))||t==="script"&&s.querySelector(is(u))||(t=s.createElement("link"),Wt(t,"link",e),Ut(t),s.head.appendChild(t)))}}function w1(e,t){ga.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+En(s)+'"][href="'+En(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=rr(e)}if(!_n.has(u)&&(e=v({rel:"modulepreload",href:e},t),_n.set(u,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(is(u)))return}s=l.createElement("link"),Wt(s,"link",e),Ut(s),l.head.appendChild(s)}}}function C1(e,t,l){ga.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,u=lr(e);t=t||"default";var b=c.get(u);if(!b){var N={loading:0,preload:null};if(b=s.querySelector(ss(u)))N.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},l),(l=_n.get(u))&&Nd(e,l);var H=b=s.createElement("link");Ut(H),Wt(H,"link",e),H._p=new Promise(function(K,ne){H.onload=K,H.onerror=ne}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,_i(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:N},c.set(u,b)}}}function N1(e,t){ga.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),u=s.get(c);u||(u=l.querySelector(is(c)),u||(e=v({src:e,async:!0},t),(t=_n.get(c))&&Ed(e,t),u=l.createElement("script"),Ut(u),Wt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function E1(e,t){ga.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),u=s.get(c);u||(u=l.querySelector(is(c)),u||(e=v({src:e,async:!0,type:"module"},t),(t=_n.get(c))&&Ed(e,t),u=l.createElement("script"),Ut(u),Wt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function Ch(e,t,l,s){var c=(c=xe.current)?Di(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var u=Nl(c).hoistableStyles,b=u.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,b),(u=c.querySelector(ss(e)))&&!u._p&&(b.instance=u,b.state.loading=5),_n.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},_n.set(e,l),u||T1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+En(e)+'"'}function ss(e){return'link[rel="stylesheet"]['+e+"]"}function Nh(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function T1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Wt(t,"link",l),Ut(t),e.head.appendChild(t))}function rr(e){return'[src="'+En(e)+'"]'}function is(e){return"script[async]"+e}function Eh(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+En(l.href)+'"]');if(s)return t.instance=s,Ut(s),s;var c=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ut(s),Wt(s,"style",c),_i(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var u=e.querySelector(ss(c));if(u)return t.state.loading|=4,t.instance=u,Ut(u),u;s=Nh(l),(c=_n.get(c))&&Nd(s,c),u=(e.ownerDocument||e).createElement("link"),Ut(u);var b=u;return b._p=new Promise(function(N,H){b.onload=N,b.onerror=H}),Wt(u,"link",s),t.state.loading|=4,_i(u,l.precedence,e),t.instance=u;case"script":return u=rr(l.src),(c=e.querySelector(is(u)))?(t.instance=c,Ut(c),c):(s=l,(c=_n.get(u))&&(s=v({},l),Ed(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ut(c),Wt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,_i(s,l.precedence,e));return t.instance}function _i(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,u=c,b=0;b<s.length;b++){var N=s[b];if(N.dataset.precedence===t)u=N;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Nd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ed(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Oi=null;function Th(e,t,l){if(Oi===null){var s=new Map,c=Oi=new Map;c.set(l,s)}else c=Oi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var u=l[c];if(!(u[kr]||u[Gt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var b=u.getAttribute(t)||"";b=e+b;var N=s.get(b);N?N.push(u):s.set(b,[u])}}return s}function Rh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function R1(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 Ah(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function A1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),u=t.querySelector(ss(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Bi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,Ut(u);return}u=t.ownerDocument||t,s=Nh(s),(c=_n.get(c))&&Nd(s,c),u=u.createElement("link"),Ut(u);var b=u;b._p=new Promise(function(N,H){b.onload=N,b.onerror=H}),Wt(u,"link",s),l.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Bi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Td=0;function M1(e,t){return e.stylesheets&&e.count===0&&Hi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Td===0&&(Td=62500*u1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Hi(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Td?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Bi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ii=null;function Hi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ii=new Map,t.forEach(z1,e),Ii=null,Bi.call(e))}function z1(e,t){if(!(t.state.loading&4)){var l=Ii.get(e);if(l)var s=l.get(null);else{l=new Map,Ii.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var b=c[u];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),u=l.get(b)||s,u===s&&l.set(null,c),l.set(b,c),this.count++,s=Bi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var os={$$typeof:O,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function L1(e,t,l,s,c,u,b,N,H){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=ko(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ko(0),this.hiddenUpdates=ko(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function Mh(e,t,l,s,c,u,b,N,H,K,ne,se){return e=new L1(e,t,l,b,H,K,ne,se,N),t=1,u===!0&&(t|=24),u=mn(3,null,null,t),e.current=u,u.stateNode=e,t=ic(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:l,cache:t},uc(u),e}function zh(e){return e?(e=Ol,e):Ol}function Lh(e,t,l,s,c,u){c=zh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},u=u===void 0?null:u,u!==null&&(s.callback=u),l=Ta(e,s,t),l!==null&&(fn(l,e,t),Ur(l,e,t))}function Dh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Rd(e,t){Dh(e,t),(e=e.alternate)&&Dh(e,t)}function _h(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&fn(t,e,67108864),Rd(e,67108864)}}function Oh(e){if(e.tag===13||e.tag===31){var t=yn();t=wo(t);var l=al(e,t);l!==null&&fn(l,e,t),Rd(e,t)}}var Ui=!0;function D1(e,t,l,s){var c=R.T;R.T=null;var u=I.p;try{I.p=2,Ad(e,t,l,s)}finally{I.p=u,R.T=c}}function _1(e,t,l,s){var c=R.T;R.T=null;var u=I.p;try{I.p=8,Ad(e,t,l,s)}finally{I.p=u,R.T=c}}function Ad(e,t,l,s){if(Ui){var c=Md(s);if(c===null)xd(e,t,s,Vi,l),Ih(e,s);else if(B1(c,e,t,l,s))s.stopPropagation();else if(Ih(e,s),t&4&&-1<O1.indexOf(e)){for(;c!==null;){var u=Cl(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var b=Et(u.pendingLanes);if(b!==0){var N=u;for(N.pendingLanes|=2,N.entangledLanes|=2;b;){var H=1<<31-jt(b);N.entanglements[1]|=H,b&=~H}Wn(u),(tt&6)===0&&(ki=lt()+500,ns(0))}}break;case 31:case 13:N=al(u,2),N!==null&&fn(N,u,2),Ci(),Rd(u,2)}if(u=Md(s),u===null&&xd(e,t,s,Vi,l),u===c)break;c=u}c!==null&&s.stopPropagation()}else xd(e,t,s,null,l)}}function Md(e){return e=Lo(e),zd(e)}var Vi=null;function zd(e){if(Vi=null,e=wl(e),e!==null){var t=p(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=h(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 Vi=e,null}function Bh(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(St()){case ye:return 2;case At:return 8;case Le:case gt:return 32;case Kt:return 268435456;default:return 32}default:return 32}}var Ld=!1,Ha=null,Ua=null,Va=null,cs=new Map,ds=new Map,$a=[],O1="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 Ih(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":cs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ds.delete(t.pointerId)}}function us(e,t,l,s,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:u,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&_h(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function B1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=us(Ua,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var u=c.pointerId;return cs.set(u,us(cs.get(u)||null,e,t,l,s,c)),!0;case"gotpointercapture":return u=c.pointerId,ds.set(u,us(ds.get(u)||null,e,t,l,s,c)),!0}return!1}function Hh(e){var t=wl(e.target);if(t!==null){var l=p(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,Zu(e.priority,function(){Oh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,Zu(e.priority,function(){Oh(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 $i(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Md(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);zo=s,l.target.dispatchEvent(s),zo=null}else return t=Cl(l),t!==null&&_h(t),e.blockedOn=l,!1;t.shift()}return!0}function Uh(e,t,l){$i(e)&&l.delete(t)}function I1(){Ld=!1,Ha!==null&&$i(Ha)&&(Ha=null),Ua!==null&&$i(Ua)&&(Ua=null),Va!==null&&$i(Va)&&(Va=null),cs.forEach(Uh),ds.forEach(Uh)}function Pi(e,t){e.blockedOn===t&&(e.blockedOn=null,Ld||(Ld=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,I1)))}var Gi=null;function Vh(e){Gi!==e&&(Gi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Gi===e&&(Gi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(zd(s||l)===null)continue;break}var u=Cl(l);u!==null&&(e.splice(t,3),t-=3,Mc(u,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(H){return Pi(H,e)}Ha!==null&&Pi(Ha,e),Ua!==null&&Pi(Ua,e),Va!==null&&Pi(Va,e),cs.forEach(t),ds.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)Hh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],u=l[s+1],b=c[rn]||null;if(typeof u=="function")b||Vh(l);else if(b){var N=null;if(u&&u.hasAttribute("formAction")){if(c=u,b=u[rn]||null)N=b.formAction;else if(zd(c)!==null)continue}else N=b.action;typeof N=="function"?l[s+1]=N:(l.splice(s,3),s-=3),Vh(l)}}}function $h(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Dd(e){this._internalRoot=e}Fi.prototype.render=Dd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=yn();Lh(l,s,e,t,null,null)},Fi.prototype.unmount=Dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Lh(e.current,2,null,e,null,null),Ci(),t[kl]=null}};function Fi(e){this._internalRoot=e}Fi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Qu();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&Hh(e)}};var Ph=r.version;if(Ph!=="19.2.4")throw Error(o(527,Ph,"19.2.4"));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var H1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qi.isDisabled&&qi.supportsFiber)try{Zn=qi.inject(H1),Nt=qi}catch{}}return ps.createRoot=function(e,t){if(!d(e))throw Error(o(299));var l=!1,s="",c=Xp,u=Qp,b=Zp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=Mh(e,1,!1,null,null,l,s,null,c,u,b,$h),e[kl]=t.current,hd(e),new Dd(t)},ps.hydrateRoot=function(e,t,l){if(!d(e))throw Error(o(299));var s=!1,c="",u=Xp,b=Qp,N=Zp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(N=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=Mh(e,1,!0,t,l??null,s,c,H,u,b,N,$h),t.context=zh(null),l=t.current,s=yn(),s=wo(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,Sr(t,l),Wn(t),e[kl]=t.current,hd(e),new Fi(t)},ps.version="19.2.4",ps}var Jh;function W1(){if(Jh)return Bd.exports;Jh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Bd.exports=Y1(),Bd.exports}var K1=W1();const X1="modulepreload",Q1=function(a){return"/"+a},ex={},Tu=function(r,i,o){let d=Promise.resolve();if(i&&i.length>0){let f=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));d=f(i.map(m=>{if(m=Q1(m),m in ex)return;ex[m]=!0;const y=m.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${v}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":X1,y||(j.as="script"),j.crossOrigin="",j.href=m,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)return new Promise((S,k)=>{j.addEventListener("load",S),j.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${m}`)))})}))}function p(f){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return d.then(f=>{for(const h of f||[])h.status==="rejected"&&p(h.reason);return r().catch(p)})},tx={own:"authoring-project",installed:"available-project",global:"available-personal"},fu=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function Z1(a){if(typeof a=="string"){if(fu.has(a))return a;if(Object.prototype.hasOwnProperty.call(tx,a))return tx[a]}return"authoring-project"}function J1(a){return a.startsWith("available-")?"available":"authoring"}function eb(a){const r=a.indexOf("-");return a.slice(r+1)}const qa="";class ys extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${qa}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new ys(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function tb(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Vd(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function nb(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let d;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?d=r.installMethod:d=o==="own"?"authored":"copied";const p=typeof r.scopeV2=="string"&&fu.has(r.scopeV2)?r.scopeV2:Z1(r.scope),f=J1(p),h=eb(p),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let m;r.shadowedBy===null?m=null:typeof r.shadowedBy=="string"&&fu.has(r.shadowedBy)?m=r.shadowedBy:m=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:d,scopeV2:p,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:m,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Vd(r.tags),deps:Vd(r.deps),mcpDeps:Vd(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:tb(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const v=r.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ee={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(nb):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${qa}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new ys(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const d=o.toString();return Ge(`/api/skills/${a}/${r}/history${d?"?"+d:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const d=new URLSearchParams;o&&d.set("model",o);const p=d.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${p?"?"+p:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${qa}/api/skills/${a}/${r}/sweep`,d=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),d},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${qa}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${qa}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${qa}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return $d(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const d=o.toString();return $d(`/api/skills/${a}/${r}/test-install${d?"?"+d:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return $d(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${qa}/api/studio/ops/stream`)}};async function $d(a,r,i){const o=await fetch(`${qa}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(v=S.code)}catch{}const j=new ys(y,o.status);throw v&&(j.code=v),j}const d=o.body.getReader(),p=new TextDecoder;let f="",h="",x=null,m=null;for(;;){const{done:y,value:v}=await d.read();if(y)break;f+=p.decode(v,{stream:!0});const j=f.split(`
|
|
51
|
+
`);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let k={};try{k=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const A={type:h,...k};r==null||r(A),A.type==="done"&&(x=A),A.type==="error"&&(m=A)}h=""}}if(m){const y=new ys(m.message,500);throw y.code=m.code,y}if(!x)throw new ys("Transfer stream ended without 'done' event",500);return x}function ab(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const d=o.name.split("/").pop()||o.name;i.set(d,o)}return a.map(o=>{const d=i.get(o.skill);return d?{...o,updateAvailable:d.updateAvailable,currentVersion:d.installed,latestVersion:d.latest??void 0}:o})}function lb(a){const[r,i]=g.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return g.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const d=p=>i(p.matches);return o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[a]),r}const rb=3e5,sb=500,ib=15e3,ob=6e4;function cb(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function db(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function ub(a){a()}function fb(a){const r=rb,i=sb,o=ib,d=ob,[p,f]=g.useState([]),[h,x]=g.useState(()=>new Map),[m,y]=g.useState(0),[v,j]=g.useState(!1),[S,k]=g.useState(null),[A,T]=g.useState(null),C=g.useRef(null),M=g.useRef(null),O=g.useRef(null),U=g.useRef(null),L=g.useRef(!0),V=g.useCallback(async()=>{j(!0);const B=new AbortController,P=setTimeout(()=>B.abort(),o);try{const F=await Promise.race([Ee.getSkillUpdates(),new Promise((te,Q)=>{B.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(F==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;f(F),x(cb(F)),y(db(F)),M.current=Date.now(),k(M.current),T(null)}catch(F){if(!L.current)return;T(F instanceof Error?F:new Error(String(F)))}finally{clearTimeout(P),L.current&&j(!1)}},[o]),w=g.useCallback(()=>{if(C.current)return C.current;const B=V().finally(()=>{C.current=null});return C.current=B,B},[V]),D=g.useCallback(()=>{O.current==null&&(O.current=setInterval(()=>{w()},r))},[r,w]),E=g.useCallback(()=>{O.current!=null&&(clearInterval(O.current),O.current=null)},[]);return g.useEffect(()=>{L.current=!0,(M.current==null||Date.now()-M.current>d)&&ub(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const F=()=>{if(U.current&&(clearTimeout(U.current),U.current=null),document.visibilityState==="hidden"){E();return}U.current=setTimeout(()=>{U.current=null,(M.current==null||Date.now()-M.current>d)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",F),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",F),U.current&&clearTimeout(U.current),E()}},[]),{updates:p,updatesMap:h,updateCount:m,isRefreshing:v,lastFetchAt:S,error:A,refresh:w}}const pb={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function mb(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const pg=g.createContext(null);function ya(){const a=g.useContext(pg);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function hb({children:a}){const[r,i]=g.useReducer(mb,pb),o=lb("(max-width: 767px)");g.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const[d,p]=g.useState(()=>{try{const L=window.localStorage.getItem("vskill.studio.prefs");if(!L)return null;const V=JSON.parse(L);return typeof V.activeAgent=="string"?V.activeAgent:null}catch{return null}});g.useEffect(()=>{function L(V){if(!(V instanceof CustomEvent))return;const w=V.detail;w!=null&&w.agentId&&p(w.agentId)}return window.addEventListener("studio:agent-changed",L),()=>window.removeEventListener("studio:agent-changed",L)},[]);const f=g.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0});const L=d?{agent:d}:void 0;Ee.getSkills(L).then(V=>{i({type:"SET_SKILLS",skills:V});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,E,B]=D,P=V.find(F=>F.plugin===E&&F.skill===B);P&&i({type:"SELECT_SKILL",skill:{plugin:E,skill:B,origin:P.origin}})}}).catch(V=>i({type:"SET_SKILLS_ERROR",error:V.message}))},[d]);g.useEffect(()=>{f()},[f]);const h=g.useCallback(L=>{i({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),x=g.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),m=g.useCallback(L=>{i({type:"SET_MODE",mode:L})},[]),y=g.useCallback(L=>{i({type:"SET_SEARCH",query:L})},[]),v=g.useCallback(L=>{i({type:"SET_MOBILE_VIEW",view:L})},[]),j=g.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),S=fb(),k=g.useMemo(()=>{const L=r.skills.map(V=>{if(!V.updateAvailable&&V.latestVersion===void 0)return V;const w={...V};return delete w.updateAvailable,delete w.currentVersion,delete w.latestVersion,w});return ab(L,S.updates)},[r.skills,S.updates]),A=g.useMemo(()=>{const L={source:0,installed:0};for(const V of k)V.updateAvailable&&(L[V.origin]+=1);return L},[k]),T=g.useMemo(()=>({...r,skills:k}),[r,k]),C=S.updateCount,M=S.refresh,O=S.isRefreshing,U=g.useMemo(()=>({state:T,selectSkill:h,clearSelection:x,setMode:m,setSearch:y,setMobileView:v,refreshSkills:f,updateCount:C,dismissUpdateNotification:j,updates:S.updates,outdatedByOrigin:A,isRefreshingUpdates:O,refreshUpdates:M}),[T,h,x,m,y,v,f,C,j,S.updates,A,O,M]);return n.jsx(pg.Provider,{value:U,children:a})}const xb={config:null,loading:!0};function gb(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const mg=g.createContext(null);function bl(){const a=g.useContext(mg);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function vb({children:a}){const[r,i]=g.useReducer(gb,xb),o=g.useCallback(()=>{Ee.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);g.useEffect(()=>{o()},[o]);const d=g.useCallback(async(f,h)=>{const x=await Ee.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),p=g.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:d,refreshConfig:o}),[r,d,o]);return n.jsx(mg.Provider,{value:p,children:a})}function yb({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:d,banner:p,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const m={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:m,children:[p,n.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:a}),n.jsxs("div",{style:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:d?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&d,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var mo=fg();const bb=ug(mo),nx=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],jb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},Sb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},kb={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},wb={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function Cb(a,r){var h,x;const i=jb[a.id]??null,o=Sb[a.id]??null,d=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,p=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(m=>({id:m.id,displayName:m.label,billingMode:wb[a.id]??"per-token",...m.pricing?{pricing:m.pricing}:{}}));return{id:a.id,displayName:Nb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:d,binaryAvailable:p,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:kb[a.id]??null,models:f,resolvedModel:a.resolvedModel??null}}function Nb(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function Eb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of nx){const d=r.get(o);d&&i.push(d)}for(const o of a)nx.includes(o.id)||i.push(o);return i}function Tb(a){const[r,i]=g.useState(null),[o,d]=g.useState("loading"),[p,f]=g.useState(null),h=g.useRef(null),x=g.useRef(0),m=g.useCallback(async()=>{try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`/api/config returned ${k.status}`);const A=await k.json(),T=Eb((A.providers||[]).map(C=>Cb(C,A.detection)));i({agents:T,activeAgent:A.provider??null,activeModel:A.model??null}),d("ready"),f(null)}catch(k){d("error"),f(k.message)}},[]);g.useEffect(()=>{m()},[m]);const y=g.useCallback(async()=>{const k=Date.now();if(!(k-x.current<5*6e4))try{const A=await fetch("/api/openrouter/models");if(!A.ok)return;const T=await A.json();x.current=k,i(C=>{if(!C)return C;const M=C.agents.map(O=>{if(O.id!=="openrouter")return O;const U=T.models.map(V=>({id:V.id,displayName:V.name,contextWindow:V.contextWindow,pricing:V.pricing,billingMode:"per-token"}));return{...O,models:U,catalogAgeMs:T.ageSec?T.ageSec*1e3:0,cacheStale:!!T.stale}});return{...C,agents:M}}),T.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(T.ageSec??0)*1e3)}catch{}},[a]),v=g.useCallback(k=>{h.current=k,k==="openrouter"&&y()},[y]),j=g.useCallback(()=>{x.current=0,m()},[m]),S=g.useCallback(async(k,A)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k,model:A})})).ok&&i(C=>C&&{...C,activeAgent:k,activeModel:A})},[]);return{status:o,catalog:r,error:p,focusAgent:v,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Pd({variant:a,label:r,onActivate:i,installUrl:o,tooltip:d}){function p(h){if(h.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function f(h){(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p(h))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:p,onKeyDown:f,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,...d?{title:d}:{},children:r})}function pu({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const Rb={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},Ab={appTitle:"Skill Studio",commandPaletteButtonLabel:"Open command palette",commandPaletteHint:"⌘K",themeToggleLight:"Switch to light theme",themeToggleDark:"Switch to dark theme",themeToggleAuto:"Switch to auto theme",projectPathLabel:"Project",modelLabel:"Model",healthLabel:"Health"},Mb={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:a=>`Couldn't load SKILL.md for ${a}.`,loadErrorBody:"Check the file path and your workspace permissions.",openInEditor:"Open in editor",copyPath:"Copy path",copyConfigSnippet:"Copy config snippet",depNotInstalledTooltip:"Not installed",missingValue:"—",announceViewingOwn:a=>`Viewing ${a} (Own)`,announceViewingInstalled:a=>`Viewing ${a} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},zb={open:"Open",copyPath:"Copy Path",revealInEditor:"Reveal in Editor",edit:"Edit",duplicate:"Duplicate",runBenchmark:"Run Benchmark",update:"Update",uninstall:"Uninstall",retry:"Retry",editPlaceholder:"Edit lands with 0675. Open the file in your editor."},Lb={inputPlaceholder:"Type a command or search",emptyResults:"No matches. Try a different query.",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",actionSelectSkill:"Select skill",actionRunBenchmark:"Run benchmark",actionSwitchTheme:"Switch theme",actionNewSkill:"New skill",closeLabel:"Close palette"},Db={title:"Keyboard shortcuts",closeLabel:"Close shortcuts",groupNavigation:"Navigation",groupActions:"Actions",groupTheme:"Theme",search:"Focus search",moveDown:"Move selection down",moveUp:"Move selection up",openSelected:"Open selected skill",openPalette:"Open command palette",openShortcuts:"Open this cheatsheet",toggleSidebar:"Toggle sidebar",toggleTheme:"Toggle theme"},_b={pathCopied:"Path copied.",configCopied:"Config copied.",skillDuplicated:"Skill duplicated.",benchmarkQueued:"Benchmark queued.",themeUpdated:"Theme updated.",skillUpdated:"Skill updated.",actionFailed:"Action failed. Retry or check logs.",networkError:"Network error. Check your connection.",permissionDenied:"Permission denied. Check file access.",unknownError:"Something went wrong. Retry or check logs."},Ob={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Bb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Ib={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Hb={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},Ub={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},Vb={subscriptionBilling:"· subscription",free:"· free"},$b={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},Pb={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},Gb={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Fb={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},qb={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},Yb={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Wb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Kb={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:Rb,shell:Ab,detail:Mb,actions:zb,palette:Lb,shortcuts:Db,toasts:_b,connection:Ob,forms:Bb,errors:Ib,picker:Hb,providers:Ub,models:Vb,settings:$b,statusBar:Pb,scopePicker:Gb,scopeSection:Fb,claudeCodeLabel:qb,setupDrawer:Yb,setupProviders:Kb,scopeLabels:Wb},ax=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Xb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:d,onOpenSettings:p}){const f=a.filter(x=>ax.has(x.id)),h=a.filter(x=>!ax.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(lx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:d,onOpenSettings:p},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(lx,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:d,onOpenSettings:p},x.id))]})}function lx({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:d,onOpenSettings:p}){const{providers:f}=J,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},m=a.id==="claude-cli"||a.id==="claude-code",y={minHeight:36,height:m?"auto":36,padding:m?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>d(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(pu,{unlocked:!0,size:10}):n.jsx(pu,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:J.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Pd,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>p(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Pd,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Pd,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,tooltip:a.id==="lm-studio"?f.lmStudio.startServiceTooltip:void 0,onActivate:()=>p(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function Qb(a,r,i,o){const f=a>=80,h=g.useRef(null),[x,m]=g.useState(0),y=g.useCallback(S=>{m(S.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:j}=g.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(x/r)-4),k=Math.ceil(i/r)+8,A=Math.min(a,S+k);return{visibleStart:S,visibleEnd:A}},[f,x,r,i,a,4]);return{visibleStart:v,visibleEnd:j,totalHeight:a*r,offsetTop:v*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const hg=44,Zb=352,Jb=60;function e0(a){var p,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((p=a.pricing)==null?void 0:p.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,d=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${d}`:d}function t0(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(d=>d.displayName.toLowerCase().includes(i)).sort((d,p)=>{const f=d.displayName.toLowerCase().indexOf(i),h=p.displayName.toLowerCase().indexOf(i);return f!==h?f-h:d.displayName.length-p.displayName.length})}function n0({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[d,p]=g.useState(""),[f,h]=g.useState(""),x=g.useRef(null);if(g.useEffect(()=>{const v=setTimeout(()=>h(d),Jb);return()=>clearTimeout(v)},[d]),g.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const m=g.useMemo(()=>t0(a.models,f),[a.models,f]),y=Qb(m.length,hg,Zb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:d,onChange:v=>p(v.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),m.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>p(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:J.picker.clearSearch})]}):m.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:m.slice(y.visibleStart,y.visibleEnd).map(v=>n.jsx(a0,{model:v,isActive:v.id===r,onSelect:()=>i(v.id),resolvedModel:a.id==="claude-cli"?a.resolvedModel??null:null},v.id))})})})]})}function a0({model:a,isActive:r,onSelect:i,resolvedModel:o}){const d=e0(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:hg,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:d}),o&&n.jsxs("span",{"data-testid":`model-row-${a.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",o]})]})}const rx={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function l0(){const[a,r]=g.useState(null),[i,o]=g.useState(!0),[d,p]=g.useState(null),f=g.useCallback(async()=>{o(!0);try{const m=await fetch("/api/settings/keys");if(!m.ok)throw new Error(`GET /api/settings/keys returned ${m.status}`);const y=await m.json();r({...rx,...y}),p(null)}catch(m){p(m.message),r(rx)}finally{o(!1)}},[]);g.useEffect(()=>{f()},[f]);const h=g.useCallback(async(m,y,v="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:m,key:y,tier:v})});if(!j.ok){const k=await j.json().catch(()=>({error:j.statusText}));throw new Error(k.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),x=g.useCallback(async m=>{const y=await fetch(`/api/settings/keys/${m}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${m} returned ${y.status}`);await f()},[f]);return{state:a,loading:i,error:d,save:h,remove:x,refresh:f}}const r0=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function s0(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function i0(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function o0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:d,save:p,remove:f}=l0(),[h,x]=g.useState("browser"),m=g.useRef(null),y=g.useRef(null),[v,j]=g.useState(i??"anthropic");if(g.useEffect(()=>{if(!a)return;const k=document.activeElement,A=setTimeout(()=>{var M;const T=i?`input[data-provider="${i}"]`:"input[data-provider]",C=(M=m.current)==null?void 0:M.querySelector(T);C==null||C.focus()},0);return()=>{var T;clearTimeout(A),(T=k==null?void 0:k.focus)==null||T.call(k)}},[a,i]),g.useEffect(()=>{if(!a)return;const k=A=>{if(A.key==="Escape"){A.preventDefault(),r();return}if(A.key==="Tab"&&m.current){const T=m.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(T.length===0)return;const C=T[0],M=T[T.length-1];A.shiftKey&&document.activeElement===C?(A.preventDefault(),M.focus()):!A.shiftKey&&document.activeElement===M&&(A.preventDefault(),C.focus())}};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a,r]),!a)return null;const S=s0();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:k=>{k.target===k.currentTarget&&r()},children:n.jsxs("div",{ref:m,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:k=>k.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),r0.map(k=>n.jsx(c0,{providerId:k.id,providerName:k.name,keyIssuanceUrl:k.keyIssuanceUrl,prefix:k.prefix,metadata:d==null?void 0:d[k.id],tier:h,onSave:async A=>{const T=await p(k.id,A,h);return o==null||o(J.settings.keySaved(k.name)),T},onRemove:async()=>{await f(k.id),o==null||o(J.settings.keyRemoved(k.name))},inputRef:k.id===(i??"anthropic")?y:void 0},k.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,n.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function c0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:d,onSave:p,onRemove:f,inputRef:h}){const[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState(!1),[k,A]=g.useState(!1),[T,C]=g.useState(null),M=x.trim(),O=M.length===0,U=M.length>0&&!M.startsWith(o),L=g.useCallback(async()=>{if(!O){S(!0);try{const D=await p(M);D.warning?C(D.warning):C(null),m("")}finally{S(!1)}}},[O,p,M]),V=g.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const E=await navigator.clipboard.readText();m(E)}catch{}},[]),w=g.useCallback(async()=>{A(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:D=>{m(D.target.value),C(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>v(!y),style:ir,children:y?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:V,style:ir,children:J.settings.paste})]}),O&&x.length>0&&n.jsx("div",{role:"status",style:d0,children:J.settings.enterNonEmpty}),U&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:sx,children:J.settings.prefixWarn(r)}),T&&n.jsx("div",{role:"status",style:sx,children:T}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:L,disabled:O||j,"data-testid":`save-${a}`,style:{...ir,background:O?"var(--surface-2)":"var(--accent, var(--color-accent))",color:O?"var(--text-muted)":"white",cursor:O?"not-allowed":"pointer"},children:J.settings.save}),(d==null?void 0:d.stored)&&n.jsx(n.Fragment,{children:k?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>A(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>A(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:J.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:d!=null&&d.stored&&d.updatedAt?J.settings.keyStoredAt(i0(d.updatedAt)):J.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},d0={fontSize:11,color:"var(--danger, #b33)"},sx={fontSize:11,color:"var(--warning, var(--text-muted))"};function u0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function f0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:d}=Tb({onStaleCatalog:(D,E)=>{const B=Math.round(E/6e4);a==null||a(`Using cached ${D} catalog (${B} min old)`)}}),[p,f]=g.useState(!1),[h,x]=g.useState(!1),[m,y]=g.useState(),[v,j]=g.useState(null),[S,k]=g.useState("agents"),A=g.useRef(null);g.useRef(null),g.useEffect(()=>{var D;i&&!v&&j(i.activeAgent??((D=i.agents[0])==null?void 0:D.id)??null)},[i,v]);const T=(i==null?void 0:i.agents)??[],C=g.useMemo(()=>T.find(D=>D.id===v)??T[0],[T,v]),M=g.useCallback(()=>{var D;f(!0),k("agents"),j((i==null?void 0:i.activeAgent)??((D=T[0])==null?void 0:D.id)??null)},[i,T]),O=g.useCallback(()=>{var D;f(!1),(D=A.current)==null||D.focus()},[]);g.useEffect(()=>{const D=E=>{var P;if(!(E.metaKey||E.ctrlKey)||E.key.toLowerCase()!=="k")return;const B=(P=document.activeElement)==null?void 0:P.tagName;B==="INPUT"||B==="TEXTAREA"||(E.preventDefault(),f(F=>!F))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),g.useEffect(()=>{if(!p)return;const D=B=>{if(B.key==="Escape"){B.preventDefault(),O();return}if(B.key==="ArrowDown"){B.preventDefault(),E(1);return}if(B.key==="ArrowUp"){B.preventDefault(),E(-1);return}if(B.key==="ArrowRight"&&S==="agents"){B.preventDefault(),k("models");return}if(B.key==="ArrowLeft"&&S==="models"){B.preventDefault(),k("agents");return}if(B.key==="Enter"){B.preventDefault(),S==="agents"&&C?k("models"):S==="models"&&C&&C.models[0]&&(d(C.id,C.models[0].id),O());return}};function E(B){if(S==="agents"){const P=T.findIndex(te=>te.id===v),F=T[Math.max(0,Math.min(T.length-1,P+B))];F&&(j(F.id),o(F.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[p,S,T,v,C,O,o,d]);const U=g.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),f(!1)},[]),L=T.find(D=>D.id===(i==null?void 0:i.activeAgent)),V=L==null?void 0:L.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=g.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",E=(V==null?void 0:V.displayName)??i.activeModel??"Model";return`${D} · ${E}`},[r,i,L,V]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:A,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>p?O():M(),"aria-haspopup":"listbox","aria-expanded":p,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),p&&typeof document<"u"&&mo.createPortal(n.jsxs(p0,{reducedMotion:u0(),onClickOutside:O,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Xb,{agents:T,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:v,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),k("models")},onOpenSettings:U}),C&&n.jsx(n0,{agent:C,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{d(C.id,D),O()},onOpenSettings:U})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>U(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),n.jsx(o0,{open:h,onClose:()=>x(!1),initialProvider:m,onToast:a})]})}function p0({children:a,reducedMotion:r,onClickOutside:i}){const o=g.useRef(null);return g.useEffect(()=>{const d=p=>{o.current&&!o.current.contains(p.target)&&i()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
52
52
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
53
53
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
54
|
-
}`})]})}function ix(){typeof window>"u"||(window.location.hash="#/")}function m0({onHome:a}){const[r,i]=g.useState(!1),[o,d]=g.useState(!1),p=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),ix(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),ix(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:p,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const h0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='1.75'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%20focusable='false'%3e%3cpath%20d='M5.5%2017h11l-1.2-1.8a2%202%200%200%201-.3-1.1V10a4%204%200%201%200-8%200v4.1a2%202%200%200%201-.3%201.1L5.5%2017Z'%20/%3e%3cpath%20d='M10%2020a2%202%200%200%200%204%200'%20/%3e%3ccircle%20cx='17'%20cy='7'%20r='2.2'%20fill='currentColor'%20stroke='none'%20/%3e%3c/svg%3e",x0=g.lazy(()=>Tu(()=>import("./UpdateDropdown-B-bI251D.js"),__vite__mapDeps([0,1])));function g0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:d}=ya(),[p,f]=g.useState(!1),h=g.useRef(null),x=g.useCallback(()=>f(!1),[]),m=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),v=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":v,"aria-haspopup":"dialog","aria-expanded":p,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:m,cursor:"pointer"},children:[n.jsx("img",{src:h0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),p&&n.jsx(g.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(x0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),k=S.length>=2?S[S.length-2]:S[0],A=S[S.length-1];d({plugin:k,skill:A,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function ox(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function v0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:d,onRequestCreateSkill:p}){const f=r?r.origin==="installed"?"Project":"Skills":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(m0,{onHome:o}),d?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:d}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&n.jsxs(n.Fragment,{children:[n.jsx(cx,{segment:"origin",onClick:()=>ox({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),n.jsx(dx,{}),n.jsx(cx,{segment:"plugin",onClick:()=>ox({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(dx,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[p&&n.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:p,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"none",background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(f0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(g0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function cx({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:d=>{d.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:d=>{const p=(i==null?void 0:i.color)??"var(--text-secondary)";d.currentTarget.style.color=p},children:o})}function dx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ho="vskill-theme";function xg(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function y0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function b0(a){try{const r=a.getItem(ho);return xg(r)}catch{return"auto"}}function j0(a,r){try{a.setItem(ho,r)}catch{}}function S0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function k0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const gg=g.createContext(null);function w0({storage:a,matchMedia:r,target:i,children:o}){const d=a??(typeof window<"u"?window.localStorage:void 0),p=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=g.useState(()=>d?b0(d):"auto"),[m,y]=g.useState(()=>k0(p)),v=g.useMemo(()=>y0(h,m),[h,m]);g.useEffect(()=>{f&&S0(f,h,v)},[f,h,v]),g.useEffect(()=>{if(!p)return;const k=p("(prefers-color-scheme: dark)"),A=C=>y(C.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",A),()=>k.removeEventListener("change",A);const T=k;return T.addListener(A),()=>T.removeListener(A)},[p]),g.useEffect(()=>{if(typeof window>"u")return;const k=A=>{A.key===ho&&x(xg(A.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useEffect(()=>{if(!p||!f)return;let k;try{k=p("(prefers-contrast: more)")}catch{return}const A=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};A(k.matches);const T=M=>A(M.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",T),()=>k.removeEventListener("change",T);const C=k;return C.addListener(T),()=>C.removeListener(T)},[p,f]);const j=g.useCallback(k=>{x(k),d&&j0(d,k)},[d]),S=g.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:j}),[h,v,j]);return n.jsx(gg.Provider,{value:S,children:o})}function vg(){const a=g.useContext(gg);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const ux=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function C0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of ux){const d=r.get(o);d&&i.push(d)}for(const o of a)ux.includes(o.id)||i.push(o);return i}function N0(a){const[r,i]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return g.useEffect(()=>{var p;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),d=()=>i(o.matches);return(p=o.addEventListener)==null||p.call(o,"change",d),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",d)}},[a]),r}function E0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=C0(a),d=N0(640),[p,f]=g.useState(!1),h=g.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(d){const x=o.filter(m=>m.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!p),"aria-label":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),p&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>n.jsx(fx,{p:m,onClick:h},m.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(fx,{p:x,onClick:h,compact:!0},x.id))})}function fx({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(pu,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function T0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ho)}catch{return null}}function R0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:d,onOpenProviderSettings:p,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:m}=vg(),v=T0()==="auto",j=A0(h,x,v),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(px,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(M0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),d&&d.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(px,{}),n.jsx(E0,{providers:d,onOpenSettings:p,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(z0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function A0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function M0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function px(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function z0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ao=new Map,gl=new Map,xs=new Map;function an(a){ao.delete(a),gl.delete(a);const r=xs.get(a);if(r)for(const i of r)i()}function xr(a,r,i={}){const{ttl:o=3e4,enabled:d=!0}=i,[,p]=g.useState(0),f=g.useRef(!0),h=g.useRef(a);h.current=a;const x=()=>an(a);g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),g.useEffect(()=>{if(!d)return;const j=()=>{f.current&&p(S=>S+1)};return xs.has(a)||xs.set(a,new Set),xs.get(a).add(j),()=>{var S;(S=xs.get(a))==null||S.delete(j)}},[a,d]),g.useEffect(()=>{if(!d)return;const j=ao.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(gl.has(a)){const T=gl.get(a),C=()=>{f.current&&h.current===a&&p(M=>M+1)};T.subscribers.push(C);return}const k={promise:Promise.resolve(),subscribers:[]},A=r().then(T=>{ao.set(a,{data:T,fetchedAt:Date.now()}),gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C()},T=>{gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C();throw T});k.promise=A,gl.set(a,k)},[a,r,o,d]);const m=ao.get(a),y=d&&!m&&gl.has(a);return{data:m==null?void 0:m.data,loading:y||d&&!m,error:void 0,revalidate:x}}const xo=0,Wa=1,gr=2,yg=4;function mx(a){return()=>a}function L0(a){a()}function bg(a,r){return i=>a(r(i))}function hx(a,r){return()=>a(r)}function D0(a,r){return i=>a(r,i)}function Ru(a){return a!==void 0}function _0(...a){return()=>{a.map(L0)}}function vr(){}function go(a,r){return r(a),a}function O0(a,r){return r(a)}function xt(...a){return a}function nt(a,r){return a(Wa,r)}function Ve(a,r){a(xo,r)}function Au(a){a(gr)}function bt(a){return a(yg)}function Ne(a,r){return nt(a,D0(r,xo))}function Pn(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function xx(a){let r,i;return o=>d=>{r=d,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function jg(a,r){return a===r}function ht(a=jg){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function ze(a){return r=>i=>{a(i)&&r(i)}}function be(a){return r=>bg(r,a)}function Kn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=B0(...r);return((o,d)=>{switch(o){case gr:Au(a);return;case Wa:return nt(a,i(d))}})}function Xn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>d=>{r=d,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function Pe(...a){const r=new Array(a.length);let i=0,o=null;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{const m=i;i|=h,r[f]=x,m!==d&&i===d&&o&&(o(),o=null)})}),p=>f=>{const h=()=>{p([f].concat(r))};i===d?h():o=h}}function B0(...a){return r=>a.reduceRight(O0,r)}function I0(a){let r,i;const o=()=>r==null?void 0:r();return function(d,p){switch(d){case Wa:return p?i===p?void 0:(o(),i=p,r=nt(a,p),r):(o(),vr);case gr:o(),i=null;return}}}function me(a){let r=a;const i=Xe();return((o,d)=>{switch(o){case xo:r=d;break;case Wa:{d(r);break}case yg:return r}return i(o,d)})}function Zt(a,r){return go(me(r),i=>Ne(a,i))}function Xe(){const a=[];return((r,i)=>{switch(r){case xo:a.slice().forEach(o=>{o(i)});return;case gr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function Sn(a){return go(Xe(),r=>Ne(a,r))}function et(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:H0(),singleton:i}}const H0=()=>Symbol();function U0(a){const r=new Map,i=({constructor:o,dependencies:d,id:p,singleton:f})=>{if(f&&r.has(p))return r.get(p);const h=o(d.map(x=>i(x)));return f&&r.set(p,h),h};return i(a)}function _t(...a){const r=Xe(),i=new Array(a.length);let o=0;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{i[f]=x,o|=h,o===d&&Ve(r,i)})}),function(p,f){switch(p){case gr:{Au(r);return}case Wa:return o===d&&f(i),nt(r,f)}}}function Me(a,r=jg){return ce(a,ht(r))}function mu(...a){return function(r,i){switch(r){case gr:return;case Wa:return _0(...a.map(o=>nt(o,i)))}}}const It={DEBUG:0,INFO:1,WARN:2,ERROR:3},V0={[It.DEBUG]:"debug",[It.ERROR]:"error",[It.INFO]:"log",[It.WARN]:"warn"},$0=()=>typeof globalThis>"u"?window:globalThis,Ka=et(()=>{const a=me(It.ERROR);return{log:me((r,i,o=It.INFO)=>{const d=$0().VIRTUOSO_LOG_LEVEL??bt(a);o>=d&&console[V0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Mu(a,r,i).callbackRef}function Mu(a,r,i){const o=Ce.useRef(null);let d=f=>{};const p=Ce.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return d=f=>{f&&r?(p==null||p.observe(f),o.current=f):(o.current&&(p==null||p.unobserve(o.current)),o.current=null)},{callbackRef:d,ref:o}}function P0(a,r,i,o,d,p,f,h,x){const m=Ce.useCallback(y=>{const v=G0(y.children,r,h?"offsetWidth":"offsetHeight",d);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let k;S&&(k=j.ownerDocument.defaultView);const A=f?h?f.scrollLeft:f.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,C=f?h?f.offsetWidth:f.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(A,0),viewportHeight:C}),p==null||p(h?gx("column-gap",getComputedStyle(y).columnGap,d):gx("row-gap",getComputedStyle(y).rowGap,d)),v!==null&&a(v)},[a,r,d,p,f,o,h]);return Mu(m,i,x)}function G0(a,r,i,o){const d=a.length;if(d===0)return null;const p=[];for(let f=0;f<d;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},It.ERROR),y===m)continue;const v=p[p.length-1];p.length===0||v.size!==y||v.endIndex!==x-1?p.push({endIndex:x,size:y,startIndex:x}):p[p.length-1].endIndex++}return p}function gx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}function Sg(a,r,i){const o=Ce.useRef(null),d=Ce.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const m=x.getBoundingClientRect(),y=m.width;let v,j;if(r){const S=r.getBoundingClientRect(),k=m.top-S.top;j=S.height-Math.max(0,k),v=k+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,m.top),v=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:p,ref:f}=Mu(d,!0,i),h=Ce.useCallback(()=>{d(f.current)},[d,f]);return Ce.useEffect(()=>{var m;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const x=(m=f.current)==null?void 0:m.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),p}const ln=et(()=>{const a=Xe(),r=Xe(),i=me(0),o=Xe(),d=me(0),p=Xe(),f=Xe(),h=me(0),x=me(0),m=me(0),y=me(0),v=Xe(),j=Xe(),S=me(!1),k=me(!1),A=me(!1);return Ne(ce(a,be(({scrollTop:T})=>T)),r),Ne(ce(a,be(({scrollHeight:T})=>T)),f),Ne(r,d),{deviation:i,fixedFooterHeight:m,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:v,scrollTop:r,skipAnimationFrameInResizeObserver:A,smoothScrollTargetReached:o,statefulScrollTop:d,viewportHeight:p}},[],{singleton:!0}),ks={lvl:0};function kg(a,r){const i=a.length;if(i===0)return[];let{index:o,value:d}=r(a[0]);const p=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);p.push({end:h-1,start:o,value:d}),o=h,d=x}return p.push({end:1/0,start:o,value:d}),p}function ut(a){return a===ks}function ws(a,r){if(!ut(a))return r===a.k?a.v:r<a.k?ws(a.l,r):ws(a.r,r)}function Gn(a,r,i="k"){if(ut(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function bn(a,r,i){return ut(a)?Ng(r,i,1):r===a.k?Bt(a,{k:r,v:i}):r<a.k?vx(Bt(a,{l:bn(a.l,r,i)})):vx(Bt(a,{r:bn(a.r,r,i)}))}function dr(){return ks}function ur(a,r,i){if(ut(a))return[];const o=Gn(a,r)[0];return q0(xu(a,o,i))}function hu(a,r){if(ut(a))return ks;const{k:i,l:o,r:d}=a;if(r===i){if(ut(o))return d;if(ut(d))return o;const[p,f]=Cg(o);return lo(Bt(a,{k:p,l:wg(o),v:f}))}return r<i?lo(Bt(a,{l:hu(o,r)})):lo(Bt(a,{r:hu(d,r)}))}function vl(a){return ut(a)?[]:[...vl(a.l),{k:a.k,v:a.v},...vl(a.r)]}function xu(a,r,i){if(ut(a))return[];const{k:o,l:d,r:p,v:f}=a;let h=[];return o>r&&(h=h.concat(xu(d,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(xu(p,r,i))),h}function lo(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Gd(r))return Eg(Bt(a,{lvl:i-1}));if(!ut(r)&&!ut(r.r))return Bt(r.r,{l:Bt(r,{r:r.r.l}),lvl:i,r:Bt(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Gd(a))return gu(Bt(a,{lvl:i-1}));if(!ut(o)&&!ut(o.l)){const d=o.l,p=Gd(d)?o.lvl-1:o.lvl;return Bt(d,{l:Bt(a,{lvl:i-1,r:d.l}),lvl:d.lvl+1,r:gu(Bt(o,{l:d.r,lvl:p}))})}throw new Error("Unexpected empty nodes")}function Bt(a,r){return Ng(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function wg(a){return ut(a.r)?a.l:lo(Bt(a,{r:wg(a.r)}))}function Gd(a){return ut(a)||a.lvl>a.r.lvl}function Cg(a){return ut(a.r)?[a.k,a.v]:Cg(a.r)}function Ng(a,r,i,o=ks,d=ks){return{k:a,l:o,lvl:i,r:d,v:r}}function vx(a){return gu(Eg(a))}function Eg(a){const{l:r}=a;return!ut(r)&&r.lvl===a.lvl?Bt(r,{r:Bt(a,{l:r.r})}):a}function gu(a){const{lvl:r,r:i}=a;return!ut(i)&&!ut(i.r)&&i.lvl===r&&i.r.lvl===r?Bt(i,{l:Bt(a,{r:i.l}),lvl:r+1}):a}function q0(a){return kg(a,({k:r,v:i})=>({index:r,value:i}))}function Tg(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function Cs(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const zu=et(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function Rg(a,r,i){return a[oo(a,r,i)]}function oo(a,r,i,o=0){let d=a.length-1;for(;o<=d;){const p=Math.floor((o+d)/2),f=a[p],h=i(f,r);if(h===0)return p;if(h===-1){if(d-o<2)return p-1;d=p-1}else{if(d===o)return p;o=p+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function Y0(a,r,i,o){const d=oo(a,r,o),p=oo(a,i,o,d);return a.slice(d,p+1)}function Fa(a,r){return Math.round(a.getBoundingClientRect()[r])}function vo(a){return!ut(a.groupOffsetTree)}function Lu({index:a},r){return r===a?0:r<a?-1:1}function F0(){return{groupIndices:[],groupOffsetTree:dr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:dr()}}function W0(a,r){let i=ut(a)?0:1/0;for(const o of r){const{endIndex:d,size:p,startIndex:f}=o;if(i=Math.min(i,f),ut(a)){a=bn(a,0,p);continue}const h=ur(a,f-1,d+1);if(h.some(tj(o)))continue;let x=!1,m=!1;for(const{end:y,start:v,value:j}of h)x?(d>=v||p===j)&&(a=hu(a,v)):(m=j!==p,x=!0),y>d&&d>=v&&j!==p&&(a=bn(a,d+1,j));m&&(a=bn(a,f,p))}return[a,i]}function K0(a){return typeof a.groupIndex<"u"}function X0({offset:a},r){return r===a?0:r<a?-1:1}function Ns(a,r,i){if(r.length===0)return 0;const{index:o,offset:d,size:p}=Rg(r,a,Lu),f=a-o,h=p*f+(f-1)*i+d;return h>0?h+i:h}function Ag(a,r){if(!vo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Mg(a,r,i){if(K0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let d=Ag(o,r);return d=Math.max(0,d,Math.min(i,d)),d}function Q0(a,r,i,o=0){return o>0&&(r=Math.max(r,Rg(a,o,Lu).offset)),kg(Y0(a,r,i,X0),ej)}function Z0(a,[r,i,o,d]){r.length>0&&o("received item sizes",r,It.DEBUG);const p=a.sizeTree;let f=p,h=0;if(i.length>0&&ut(p)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((k,A)=>bn(bn(k,A,j),A+1,S),f)}else[f,h]=W0(f,r);if(f===p)return a;const{lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v}=vu(a.offsetTree,h,f,d);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>bn(j,S,Ns(S,v,d)),dr()),lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:f}}function J0(a){return vl(a).map(({k:r,v:i},o,d)=>{const p=d[o+1];return{endIndex:p!==void 0?p.k-1:1/0,size:i,startIndex:r}})}function yx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function vu(a,r,i,o){let d=a,p=0,f=0,h=0,x=0;if(r!==0){x=oo(d,r-1,Lu),h=d[x].offset;const m=Gn(i,r-1);p=m[0],f=m[1],d.length&&d[x].size===Gn(i,r)[1]&&(x-=1),d=d.slice(0,x+1)}else d=[];for(const{start:m,value:y}of ur(i,r,1/0)){const v=m-p,j=v*f+h+v*o;d.push({index:m,offset:j,size:y}),p=m,h=j,f=y}return{lastIndex:p,lastOffset:h,lastSize:f,offsetTree:d}}function ej(a){return{index:a.index,value:a}}function tj(a){const{endIndex:r,size:i,startIndex:o}=a;return d=>d.start===o&&(d.end===r||d.end===1/0)&&d.value===i}const nj={offsetHeight:"height",offsetWidth:"width"},Qn=et(([{log:a},{recalcInProgress:r}])=>{const i=Xe(),o=Xe(),d=Zt(o,0),p=Xe(),f=Xe(),h=me(0),x=me([]),m=me(void 0),y=me(void 0),v=me(void 0),j=me(void 0),S=me((w,D)=>Fa(w,nj[D])),k=me(void 0),A=me(0),T=F0(),C=Zt(ce(i,Pe(x,a,A),Xn(Z0,T),ht()),T),M=Zt(ce(x,ht(),Xn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),be(({prev:w})=>w)),[]);Ne(ce(x,ze(w=>w.length>0),Pe(C,A),be(([w,D,E])=>{const B=w.reduce((P,q,te)=>bn(P,q,Ns(q,D.offsetTree,E)||te),dr());return{...D,groupIndices:w,groupOffsetTree:B}})),C),Ne(ce(o,Pe(C),ze(([w,{lastIndex:D}])=>w<D),be(([w,{lastIndex:D,lastSize:E}])=>[{endIndex:D,size:E,startIndex:w}])),i),Ne(m,y);const O=Zt(ce(m,be(w=>w===void 0)),!0);Ne(ce(y,ze(w=>w!==void 0&&ut(bt(C).sizeTree)),be(w=>{const D=bt(v),E=bt(x).length>0;return D!==void 0&&D!==0?E?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ne(ce(j,ze(w=>w!==void 0&&w.length>0&&ut(bt(C).sizeTree)),be(w=>{const D=[];let E=w[0],B=0;for(let P=1;P<w.length;P++){const q=w[P];q!==E&&(D.push({endIndex:P-1,size:E,startIndex:B}),E=q,B=P)}return D.push({endIndex:w.length-1,size:E,startIndex:B}),D})),i),Ne(ce(x,Pe(v,y),ze(([,w,D])=>w!==void 0&&D!==void 0),be(([w,D,E])=>{const B=[];for(let P=0;P<w.length;P++){const q=w[P],te=w[P+1];B.push({startIndex:q,endIndex:q,size:D}),te!==void 0&&B.push({startIndex:q+1,endIndex:te-1,size:E})}return B})),i);const U=Sn(ce(i,Pe(C),Xn(({sizes:w},[D,E])=>({changed:E!==w,sizes:E}),{changed:!1,sizes:T}),be(w=>w.changed)));nt(ce(h,Xn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),be(w=>w.diff)),w=>{const{groupIndices:D}=bt(C);if(w>0)Ve(r,!0),Ve(p,w+yx(w,D));else if(w<0){const E=bt(M);E.length>0&&(w-=yx(-w,E)),Ve(f,w)}}),nt(ce(h,Pe(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},It.ERROR)});const L=Sn(p);Ne(ce(p,Pe(C),be(([w,D])=>{const E=D.groupIndices.length>0,B=[],P=D.lastSize;if(E){const q=ws(D.sizeTree,0);let te=0,Q=0;for(;te<w;){const R=D.groupIndices[Q],I=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-R-1;B.push({endIndex:R,size:q,startIndex:R}),B.push({endIndex:R+1+I-1,size:P,startIndex:R+1}),Q++,te+=I+1}const z=vl(D.sizeTree);return te!==w&&z.shift(),z.reduce((R,{k:I,v:Z})=>{let Y=R.ranges;return R.prevSize!==0&&(Y=[...R.ranges,{endIndex:I+w-1,size:R.prevSize,startIndex:R.prevIndex}]),{prevIndex:I+w,prevSize:Z,ranges:Y}},{prevIndex:w,prevSize:0,ranges:B}).ranges}return vl(D.sizeTree).reduce((q,{k:te,v:Q})=>({prevIndex:te+w,prevSize:Q,ranges:[...q.ranges,{endIndex:te+w-1,size:q.prevSize,startIndex:q.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),i);const V=Sn(ce(f,Pe(C,A),be(([w,{offsetTree:D},E])=>{const B=-w;return Ns(B,D,E)})));return Ne(ce(f,Pe(C,A),be(([w,D,E])=>{if(D.groupIndices.length>0){if(ut(D.sizeTree))return D;let P=dr();const q=bt(M);let te=0,Q=0,z=0;for(;te<-w;){z=q[Q];const R=q[Q+1]-z-1;Q++,te+=R+1}if(P=vl(D.sizeTree).reduce((R,{k:I,v:Z})=>bn(R,Math.max(0,I+w),Z),P),te!==-w){const R=ws(D.sizeTree,z);P=bn(P,0,R);const I=Gn(D.sizeTree,-w+1)[1];P=bn(P,1,I)}return{...D,sizeTree:P,...vu(D.offsetTree,0,P,E)}}const B=vl(D.sizeTree).reduce((P,{k:q,v:te})=>bn(P,Math.max(0,q+w),te),dr());return{...D,sizeTree:B,...vu(D.offsetTree,0,B,E)}})),C),{beforeUnshiftWith:L,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:v,gap:A,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:U,shiftWith:f,shiftWithOffset:V,sizeRanges:i,sizes:C,statefulTotalCount:d,totalCount:o,trackItemSizes:O,unshiftWith:p}},xt(Ka,zu),{singleton:!0});function aj(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const zg=et(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:d}])=>{const p=Xe(),f=Xe(),h=Sn(ce(p,be(aj)));return Ne(ce(h,be(x=>x.totalCount)),i),Ne(ce(h,be(x=>x.groupIndices)),a),Ne(ce(_t(d,r,o),ze(([x,m])=>vo(m)),be(([x,m,y])=>Gn(m.groupOffsetTree,Math.max(x-y,0),"v")[0]),ht(),be(x=>[x])),f),{groupCounts:p,topItemsIndexes:f}},xt(Qn,ln)),Xa=et(([{log:a}])=>{const r=me(!1),i=Sn(ce(r,ze(o=>o),ht()));return nt(r,o=>{o&&bt(a)("props updated",{},It.DEBUG)}),{didMount:i,propsReady:r}},xt(Ka),{singleton:!0}),lj=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Lg(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!lj)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const As=et(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:d,fixedHeaderHeight:p,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:j}])=>{const S=Xe(),k=Xe(),A=me(0);let T=null,C=null,M=null;function O(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),C&&(clearTimeout(C),C=null),Ve(x,!1)}return Ne(ce(S,Pe(i,v,o,A,h,f,j),Pe(a,p,d),be(([[U,L,V,w,D,E,B,P],q,te,Q])=>{const z=Lg(U),{align:R,behavior:I,offset:Z}=z,Y=w-1,de=Mg(z,L,Y);let _=Ns(de,L.offsetTree,q)+E;R==="end"?(_+=te+Gn(L.sizeTree,de)[1]-V+Q,de===Y&&(_+=B)):R==="center"?_+=(te+Gn(L.sizeTree,de)[1]-V+Q)/2:_-=D,Z!==void 0&&Z!==0&&(_+=Z);const W=ie=>{O(),ie?(P("retrying to scroll to",{location:U},It.DEBUG),Ve(S,U)):(Ve(k,!0),P("list did not change, scroll successful",{},It.DEBUG))};if(O(),I==="smooth"){let ie=!1;M=nt(r,ue=>{ie=ie||ue}),T=Pn(y,()=>{W(ie)})}else T=Pn(ce(r,rj(150)),W);return C=setTimeout(()=>{O()},1200),Ve(x,!0),P("scrolling from index to",{behavior:I,index:de,top:_},It.DEBUG),{behavior:I,top:_}})),m),{scrollTargetReached:k,scrollToIndex:S,topListHeight:A}},xt(Qn,ln,Ka),{singleton:!0});function rj(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Du(a,r){a===0?r():requestAnimationFrame(()=>{Du(a-1,r)})}function _u(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Ms=et(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:d,scrollToIndex:p},{didMount:f}])=>{const h=me(!0),x=me(0),m=me(!0);return Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),h),Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),m),nt(ce(_t(r,f),Pe(h,i,a,m),ze(([[,y],v,{sizeTree:j},S,k])=>y&&(!ut(j)||Ru(S))&&!v&&!k),Pe(x)),([,y])=>{Pn(d,()=>{Ve(m,!0)}),Du(4,()=>{Pn(o,()=>{Ve(h,!0)}),Ve(p,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:x,scrolledToInitialItem:h}},xt(Qn,ln,As,Xa),{singleton:!0});function Dg(a,r){return Math.abs(a-r)<1.01}const Es="up",bs="down",sj="none",ij={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},oj=0,zs=et(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:d,viewportHeight:p}])=>{const f=me(!1),h=me(!0),x=Xe(),m=Xe(),y=me(4),v=me(oj),j=Zt(ce(mu(ce(Me(d),yl(1),Kn(!0)),ce(Me(d),yl(1),Kn(!1),xx(100))),ht()),!1),S=Zt(ce(mu(ce(i,Kn(!0)),ce(i,Kn(!1),xx(200))),ht()),!1);Ne(ce(_t(Me(d),Me(v)),be(([M,O])=>M<=O),ht()),h),Ne(ce(h,va(50)),m);const k=Sn(ce(_t(o,Me(p),Me(r),Me(a),Me(y)),Xn((M,[{scrollHeight:O,scrollTop:U},L,V,w,D])=>{const E=U+L-O>-D,B={scrollHeight:O,scrollTop:U,viewportHeight:L};if(E){let q,te;return U>M.state.scrollTop?(q="SCROLLED_DOWN",te=M.state.scrollTop-U):(q="SIZE_DECREASED",te=M.state.scrollTop-U||M.scrollTopDelta),{atBottom:!0,atBottomBecause:q,scrollTopDelta:te,state:B}}let P;return B.scrollHeight>M.state.scrollHeight?P="SIZE_INCREASED":L<M.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":U<M.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:B}},ij),ht((M,O)=>M!==void 0&&M.atBottom===O.atBottom))),A=Zt(ce(o,Xn((M,{scrollHeight:O,scrollTop:U,viewportHeight:L})=>{if(!Dg(M.scrollHeight,O)){const V=O-(U+L)<1;return M.scrollTop!==U&&V?{changed:!0,jump:M.scrollTop-U,scrollHeight:O,scrollTop:U}:{changed:!0,jump:0,scrollHeight:O,scrollTop:U}}return{changed:!1,jump:0,scrollHeight:O,scrollTop:U}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ze(M=>M.changed),be(M=>M.jump)),0);Ne(ce(k,be(M=>M.atBottom)),f),Ne(ce(f,va(50)),x);const T=me(bs);Ne(ce(o,be(({scrollTop:M})=>M),ht(),Xn((M,O)=>bt(S)?{direction:M.direction,prevScrollTop:O}:{direction:O<M.prevScrollTop?Es:bs,prevScrollTop:O},{direction:bs,prevScrollTop:0}),be(M=>M.direction)),T),Ne(ce(o,va(50),Kn(sj)),T);const C=me(0);return Ne(ce(j,ze(M=>!M),Kn(0)),C),Ne(ce(d,va(100),Pe(j),ze(([M,O])=>O),Xn(([M,O],[U])=>[O,U],[0,0]),be(([M,O])=>O-M)),C),{atBottomState:k,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:A,scrollDirection:T,scrollVelocity:C}},xt(ln)),Ts="top",Rs="bottom",bx="none";function jx(a,r,i){return typeof a=="number"?i===Es&&r===Ts||i===bs&&r===Rs?a:0:i===Es?r===Ts?a.main:a.reverse:r===Rs?a.main:a.reverse}function Sx(a,r){return typeof a=="number"?a:a[r]??0}const Ou=et(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:d}])=>{const p=Xe(),f=me(0),h=me(0),x=me(0),m=Zt(ce(_t(Me(o),Me(d),Me(i),Me(p,Cs),Me(x),Me(f),Me(r),Me(a),Me(h)),be(([y,v,j,[S,k],A,T,C,M,O])=>{const U=y-M,L=T+C,V=Math.max(j-U,0);let w=bx;const D=Sx(O,Ts),E=Sx(O,Rs);return S-=M,S+=j+C,k+=j+C,k-=M,S>y+L-D&&(w=Es),k<y-V+v+E&&(w=bs),w!==bx?[Math.max(U-j-jx(A,Ts,w)-D,0),U-V-C+v+jx(A,Rs,w)+E]:null}),ze(y=>y!==null),ht(Cs)),[0,0]);return{increaseViewportBy:h,listBoundary:p,overscan:x,topListHeight:f,visibleRange:m}},xt(ln),{singleton:!0});function cj(a,r,i){if(vo(r)){const o=Ag(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const qd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ro(a,r,i,o,d,p){const{lastIndex:f,lastOffset:h,lastSize:x}=d;let m=0,y=0;if(a.length>0){m=a[0].offset;const A=a[a.length-1];y=A.offset+A.size}const v=i-f,j=h+v*x+(v-1)*o,S=m,k=j-y;return{bottom:y,firstItemIndex:p,items:kx(a,d,p),offsetBottom:k,offsetTop:m,top:S,topItems:kx(r,d,p),topListHeight:r.reduce((A,T)=>T.size+A,0),totalCount:i}}function _g(a,r,i,o,d,p){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=_u(r,h),m=Array.from({length:h}).map((y,v)=>({data:p[v+x],index:v+x,offset:0,size:0}));return ro(m,[],h,d,i,o)}function kx(a,r,i){if(a.length===0)return[];if(!vo(r))return a.map(m=>({...m,index:m.index+i,originalIndex:m.index}));const o=a[0].index,d=a[a.length-1].index,p=[],f=ur(r.groupOffsetTree,o,d);let h,x=0;for(const m of a){(!h||h.end<m.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:m.index-(x+1)+i},p.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return p}function wx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=et(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:d},p,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},j,{didMount:S},{recalcInProgress:k}])=>{const A=me([]),T=me(0),C=Xe(),M=me(0);Ne(p.topItemsIndexes,A);const O=Zt(ce(_t(S,k,Me(x,Cs),Me(d),Me(o),Me(m),y,Me(A),Me(r),Me(i),Me(M),a),ze(([w,D,,E,,,,,,,,B])=>{const P=B!==void 0&&B.length!==E;return w&&!D&&!P}),be(([,,[w,D],E,B,P,q,te,Q,z,R,I])=>{var Se,De;const Z=B,{offsetTree:Y,sizeTree:de}=Z,_=bt(T);if(E===0)return{...qd,totalCount:E};if(w===0&&D===0)return _===0?{...qd,totalCount:E}:_g(_,P,B,Q,z,I||[]);if(ut(de))return _>0?null:ro(cj(_u(P,E),Z,I),[],E,z,Z,Q);const W=[];if(te.length>0){const Ie=te[0],ae=te[te.length-1];let pe=0;for(const fe of ur(de,Ie,ae)){const he=fe.value,ve=Math.max(fe.start,Ie),_e=Math.min(fe.end,ae);for(let re=ve;re<=_e;re++)W.push({data:I==null?void 0:I[re],index:re,offset:pe,size:he}),pe+=he}}if(!q)return ro([],W,E,z,Z,Q);const ie=te.length>0?te[te.length-1]+1:0,ue=Q0(Y,w,D,ie);if(ue.length===0)return null;const ge=E-1,xe=go([],Ie=>{for(const ae of ue){const pe=ae.value;let fe=pe.offset,he=ae.start;const ve=pe.size;if(pe.offset<w){he+=Math.floor((w-pe.offset+z)/(ve+z));const re=he-ae.start;fe+=re*ve+re*z}he<ie&&(fe+=(ie-he)*ve,he=ie);const _e=Math.min(ae.end,ge);for(let re=he;re<=_e&&!(fe>=D);re++)Ie.push({data:I==null?void 0:I[re],index:re,offset:fe,size:ve}),fe+=ve+z}}),we=wx(R,Ts),oe=wx(R,Rs);if(xe.length>0&&(we>0||oe>0)){const Ie=xe[0],ae=xe[xe.length-1];if(we>0&&Ie.index>ie){const pe=Math.min(we,Ie.index-ie),fe=[];let he=Ie.offset;for(let ve=Ie.index-1;ve>=Ie.index-pe;ve--){const _e=((Se=ur(de,ve,ve)[0])==null?void 0:Se.value)??Ie.size;he-=_e+z,fe.unshift({data:I==null?void 0:I[ve],index:ve,offset:he,size:_e})}xe.unshift(...fe)}if(oe>0&&ae.index<ge){const pe=Math.min(oe,ge-ae.index);let fe=ae.offset+ae.size+z;for(let he=ae.index+1;he<=ae.index+pe;he++){const ve=((De=ur(de,he,he)[0])==null?void 0:De.value)??ae.size;xe.push({data:I==null?void 0:I[he],index:he,offset:fe,size:ve}),fe+=ve+z}}}return ro(xe,W,E,z,Z,Q)}),ze(w=>w!==null),ht()),qd);Ne(ce(a,ze(Ru),be(w=>w==null?void 0:w.length)),d),Ne(ce(O,be(w=>w.topListHeight)),v),Ne(v,h),Ne(ce(O,be(w=>[w.top,w.bottom])),f),Ne(ce(O,be(w=>w.items)),C);const U=Sn(ce(O,ze(({items:w})=>w.length>0),Pe(d,a),ze(([{items:w},D])=>w[w.length-1].originalIndex===D-1),be(([,w,D])=>[w-1,D]),ht(Cs),be(([w])=>w))),L=Sn(ce(O,va(200),ze(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),be(({items:w})=>w[0].index),ht())),V=Sn(ce(O,ze(({items:w})=>w.length>0),be(({items:w})=>{let D=0,E=w.length-1;for(;w[D].type==="group"&&D<E;)D++;for(;w[E].type==="group"&&E>D;)E--;return{endIndex:w[E].index,startIndex:w[D].index}}),ht(Tg)));return{endReached:U,initialItemCount:T,itemsRendered:C,listState:O,minOverscanItemCount:M,rangeChanged:V,startReached:L,topItemsIndexes:A,...j}},xt(Qn,zg,Ou,Ms,As,zs,Xa,zu),{singleton:!0}),Og=et(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:d}])=>{const p=Xe(),f=Zt(ce(_t(i,a,o,r,d),be(([h,x,m,y,v])=>h+x+m+y+v.offsetBottom+v.bottom)),0);return Ne(Me(f),p),{totalListHeight:f,totalListHeightChanged:p}},xt(ln,Sl),{singleton:!0}),dj=et(([{viewportHeight:a},{totalListHeight:r}])=>{const i=me(!1),o=Zt(ce(_t(i,a,r),ze(([d])=>d),be(([,d,p])=>Math.max(0,d-p)),va(0),ht()),0);return{alignToBottom:i,paddingTopAddition:o}},xt(ln,Og),{singleton:!0}),Bg=et(()=>({context:me(null)})),uj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...d},viewportBottom:p,viewportTop:f})=>r<f?{...d,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>p?{...d,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Ig=et(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:d,headerHeight:p,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:m}])=>{const y=Xe();return Ne(ce(y,Pe(r,x,i,p,d,o,h),Pe(a),be(([[v,j,S,k,A,T,C,M],O])=>{const{calculateViewLocation:U=uj,done:L,...V}=v,w=Mg(v,j,k-1),D=Ns(w,j.offsetTree,O)+A+T,E=D+Gn(j.sizeTree,w)[1],B=M+T,P=M+S-C,q=U({itemBottom:E,itemTop:D,locationParams:V,viewportBottom:P,viewportTop:B});return q!==null?L&&Pn(ce(f,ze(te=>!te),yl(bt(f)?1:2)),L):L==null||L(),q}),ze(v=>v!==null)),m),{scrollIntoView:y}},xt(Qn,ln,As,Sl,Ka),{singleton:!0});function Cx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const fj=(a,r)=>typeof a=="function"?Cx(a(r)):r&&Cx(a),pj=et(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:d,isAtBottom:p},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:m},{log:y},{scrollingInProgress:v},{context:j},{scrollIntoView:S}])=>{const k=me(!1),A=Xe();let T=null;function C(L){Ve(f,{align:"end",behavior:L,index:"LAST"})}nt(ce(_t(ce(Me(r),yl(1)),x),Pe(Me(k),p,h,v),be(([[L,V],w,D,E,B])=>{let P=V&&E,q="auto";return P&&(q=fj(w,D||B),P=P&&q!==!1),{followOutputBehavior:q,shouldFollow:P,totalCount:L}}),ze(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:V})=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L)}):T=Pn(a,()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L),T=null})});function M(L){const V=Pn(d,w=>{L&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(bt(y)("scrolling to bottom due to increased size",{},It.DEBUG),C("auto"))});setTimeout(V,100)}nt(ce(_t(Me(k),r,m),ze(([L,,V])=>L!==!1&&V),Xn(({value:L},[,V])=>({refreshed:L===V,value:V}),{refreshed:!1,value:0}),ze(({refreshed:L})=>L),Pe(k,r)),([,L])=>{bt(h)&&M(L!==!1)}),nt(A,()=>{M(bt(k)!==!1)}),nt(_t(Me(k),d),([L,V])=>{L!==!1&&!V.atBottom&&V.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&C("auto")});const O=me(null),U=Xe();return Ne(mu(ce(Me(o),be(L=>(L==null?void 0:L.length)??0)),ce(Me(r))),U),nt(ce(_t(ce(U,yl(1)),x),Pe(Me(O),h,v,j),be(([[L,V],w,D,E,B])=>V&&D&&(w==null?void 0:w({context:B,totalCount:L,scrollingInProgress:E}))),ze(L=>!!L),va(0)),L=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("scrolling into view",{}),Ve(S,L)}):T=Pn(a,()=>{bt(y)("scrolling into view",{}),Ve(S,L),T=null})}),{autoscrollToBottom:A,followOutput:k,scrollIntoViewOnChange:O}},xt(Qn,zs,As,Ms,Xa,Ka,ln,Bg,Ig)),mj=et(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:d},{initialItemCount:p,listState:f},{didMount:h}])=>(Ne(ce(h,Pe(p),ze(([,x])=>x!==0),Pe(d,o,r,i,a),be(([[,x],m,y,v,j,S=[]])=>_g(x,m,y,v,j,S))),f),{}),xt(Qn,Ms,Sl,Xa),{singleton:!0}),hj=et(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=me(0);return nt(ce(a,Pe(o),ze(([,d])=>d!==0),be(([,d])=>({top:d}))),d=>{Pn(ce(i,yl(1),ze(p=>p.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(r,d)})})}),{initialScrollTop:o}},xt(Xa,ln,Sl),{singleton:!0}),Hg=et(([{scrollVelocity:a}])=>{const r=me(!1),i=Xe(),o=me(!1);return Ne(ce(a,Pe(o,r,i),ze(([d,p])=>p!==!1&&p!==void 0),be(([d,p,f,h])=>{const{enter:x,exit:m}=p;if(f){if(m(d,h))return!1}else if(x(d,h))return!0;return f}),ht()),r),nt(ce(_t(r,a,i),Pe(o)),([[d,p,f],h])=>{d&&h!==!1&&h!==void 0&&h.change&&h.change(p,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},xt(zs),{singleton:!0}),Bu=et(([{scrollContainerState:a,scrollTo:r}])=>{const i=Xe(),o=Xe(),d=Xe(),p=me(!1),f=me(void 0);return Ne(ce(_t(i,o),be(([{scrollTop:h,viewportHeight:x},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:x}))),a),Ne(ce(r,Pe(o),be(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),d),{customScrollParent:f,useWindowScroll:p,windowScrollContainerState:i,windowScrollTo:d,windowViewportRect:o}},xt(ln)),xj=et(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:d},{didMount:p},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const m=Xe(),y=me(void 0),v=me(null),j=me(null);return Ne(h,v),Ne(x,j),nt(ce(m,Pe(r,o,f,v,j,i)),([S,k,A,T,C,M,O])=>{const U=J0(k.sizeTree);T&&C!==null&&M!==null&&(A=C.scrollTop-M.offsetTop),A-=O,S({ranges:U,scrollTop:A})}),Ne(ce(y,ze(Ru),be(gj)),d),Ne(ce(p,Pe(y),ze(([,S])=>S!==void 0),ht(),be(([,S])=>S.ranges)),a),{getState:m,restoreStateFrom:y}},xt(Qn,ln,Ms,Xa,Bu));function gj(a){return{align:"start",index:0,offset:a.scrollTop}}const vj=et(([{topItemsIndexes:a}])=>{const r=me(0);return Ne(ce(r,ze(i=>i>=0),be(i=>Array.from({length:i}).map((o,d)=>d))),a),{topItemCount:r}},xt(Sl));function Ug(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const yj=Ug(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),bj=et(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:d,isScrolling:p,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:j},{log:S},{recalcInProgress:k}])=>{const A=Sn(ce(x,Pe(f),Xn(([,C,M,O],[{bottom:U,items:L,offsetBottom:V,totalCount:w},D])=>{const E=U+V;let B=0;return M===w&&C.length>0&&L.length>0&&(L[0].originalIndex===0&&C[0].originalIndex===0||(B=E-O,B!==0&&(B+=D))),[B,L,w,E]},[0,[],0,0]),ze(([C])=>C!==0),Pe(o,h,i,d,S,k),ze(([,C,M,O,,,U])=>!U&&!O&&C!==0&&M===Es),be(([[C],,,,,M])=>(M("Upward scrolling compensation",{amount:C},It.DEBUG),C))));function T(C){C>0?(Ve(r,{behavior:"auto",top:-C}),Ve(a,0)):(Ve(a,0),Ve(r,{behavior:"auto",top:-C}))}return nt(ce(A,Pe(a,p)),([C,M,O])=>{O&&yj()?Ve(a,M-C):T(-C)}),nt(ce(_t(Zt(p,!1),a,k),ze(([C,M,O])=>!C&&!O&&M!==0),be(([C,M])=>M),va(1)),T),Ne(ce(v,be(C=>({top:-C}))),r),nt(ce(m,Pe(j,y),be(([C,{groupIndices:M,lastSize:O,sizeTree:U},L])=>{function V(P){return P*(O+L)}if(M.length===0)return V(C);let w=0;const D=ws(U,0);let E=0,B=0;for(;E<C;){E++,w+=D;let P=M.length===B+1?1/0:M[B+1]-M[B]-1;E+P>C&&(w-=D,P=C-E+1),E+=P,w+=V(P),B++}return w})),C=>{Ve(a,C),requestAnimationFrame(()=>{Ve(r,{top:C}),requestAnimationFrame(()=>{Ve(a,0),Ve(k,!1)})})}),{deviation:a}},xt(ln,zs,Sl,Qn,Ka,zu)),jj=et(([a,r,i,o,d,p,f,h,x,m,y])=>({...a,...r,...i,...o,...d,...p,...f,...h,...x,...m,...y}),xt(Ou,mj,Xa,Hg,Og,hj,dj,Bu,Ig,Ka,Bg)),Vg=et(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:d,gap:p,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T},C,M,O,U,{scrollToIndex:L},V,{topItemCount:w},{groupCounts:D},E])=>{const{listState:B,minOverscanItemCount:P,topItemsIndexes:q,rangeChanged:te,...Q}=U;return Ne(te,E.scrollSeekRangeChanged),Ne(ce(E.windowViewportRect,be(z=>z.visibleHeight)),C.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:d,gap:p,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T,sizeRanges:m,topItemCount:w,topItemsIndexes:q,totalCount:j,...O,groupIndices:f,itemSize:x,listState:B,minOverscanItemCount:P,scrollToIndex:L,statefulTotalCount:v,trackItemSizes:S,rangeChanged:te,...Q,...E,...C,sizes:y,...M}},xt(Qn,Ms,ln,xj,pj,Sl,As,bj,vj,zg,jj));function Sj(a,r){const i={},o={};let d=0;const p=a.length;for(;d<p;)o[a[d]]=1,d+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Fi=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function $g(a,r,i){const o=Object.keys(r.required||{}),d=Object.keys(r.optional||{}),p=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=Ce.createContext({});function x(T,C){T.propsReady!==void 0&&Ve(T.propsReady,!1);for(const M of o){const O=T[r.required[M]];Ve(O,C[M])}for(const M of d)if(M in C){const O=T[r.optional[M]];Ve(O,C[M])}T.propsReady!==void 0&&Ve(T.propsReady,!0)}function m(T){return p.reduce((C,M)=>(C[M]=O=>{const U=T[r.methods[M]];Ve(U,O)},C),{})}function y(T){return f.reduce((C,M)=>(C[M]=I0(T[r.events[M]]),C),{})}const v=Ce.forwardRef(function(T,C){const{children:M,...O}=T,[U]=Ce.useState(()=>go(U0(a),w=>{x(w,O)})),[L]=Ce.useState(hx(y,U));Fi(()=>{for(const w of f)w in O&&nt(L[w],O[w]);return()=>{Object.values(L).map(Au)}},[O,L,U]),Fi(()=>{x(U,O)}),Ce.useImperativeHandle(C,mx(m(U)));const V=i;return n.jsx(h.Provider,{value:U,children:i!==void 0?n.jsx(V,{...Sj([...o,...d,...f],O),children:M}):M})}),j=T=>{const C=Ce.useContext(h);return Ce.useCallback(M=>{Ve(C[T],M)},[C,T])},S=T=>{const C=Ce.useContext(h)[T],M=Ce.useCallback(O=>nt(C,O),[C]);return Ce.useSyncExternalStore(M,()=>bt(C),()=>bt(C))},k=T=>{const C=Ce.useContext(h)[T],[M,O]=Ce.useState(hx(bt,C));return Fi(()=>nt(C,U=>{U!==M&&O(mx(U))}),[C,M]),M},A=parseInt(Ce.version)>=18?S:k;return{Component:v,useEmitter:(T,C)=>{const M=Ce.useContext(h)[T];Fi(()=>nt(M,C),[C,M])},useEmitterValue:A,usePublisher:j}}const Pg=Ce.createContext(void 0),Gg=Ce.createContext(void 0),Yd="-webkit-sticky",Nx="sticky",Iu=Ug(()=>{if(typeof document>"u")return Nx;const a=document.createElement("div");return a.style.position=Yd,a.style.position===Yd?Yd:Nx}),qg=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function Fd(a){return"self"in a}function kj(a){return"body"in a}function Yg(a,r,i,o=vr,d,p){const f=Ce.useRef(null),h=Ce.useRef(null),x=Ce.useRef(null),m=Ce.useCallback(j=>{let S,k,A;const T=j.target;if(kj(T)||Fd(T)){const M=Fd(T)?T:T.defaultView;A=p===!0?M.scrollX:M.scrollY,S=p===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,k=p===!0?M.innerWidth:M.innerHeight}else A=p===!0?T.scrollLeft:T.scrollTop,S=p===!0?T.scrollWidth:T.scrollHeight,k=p===!0?T.offsetWidth:T.offsetHeight;const C=()=>{a({scrollHeight:S,scrollTop:Math.max(A,0),viewportHeight:k})};j.suppressFlushSync===!0?C():bb.flushSync(C),h.current!==null&&(A===h.current||A<=0||A===S-k)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,p]);Ce.useEffect(()=>{const j=d||f.current;return o(d||f.current),m({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",m,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",m)}},[f,m,i,o,d]);function y(j){const S=f.current;if(!S||(p===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=j.behavior==="smooth";let A,T,C;Fd(S)?(T=Math.max(Fa(S.document.documentElement,p===!0?"width":"height"),p===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),A=p===!0?S.innerWidth:S.innerHeight,C=p===!0?window.scrollX:window.scrollY):(T=S[p===!0?"scrollWidth":"scrollHeight"],A=Fa(S,p===!0?"width":"height"),C=S[p===!0?"scrollLeft":"scrollTop"]);const M=T-A;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),Dg(A,T)||j.top===C){a({scrollHeight:T,scrollTop:C,viewportHeight:A}),k&&r(!0);return}k?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function v(j){p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:v,scrollerRef:f,scrollToCallback:y}}function Hu(a){return a}const wj=et(()=>{const a=me(h=>`Item ${h}`),r=me(h=>`Group ${h}`),i=me({}),o=me(Hu),d=me("div"),p=me(vr),f=(h,x=null)=>Zt(ce(i,be(m=>m[h]),ht()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:d,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:p,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),Cj=et(([a,r])=>({...a,...r}),xt(Vg,wj)),Nj=({height:a})=>n.jsx("div",{style:{height:a}}),Ej={overflowAnchor:"none",position:Iu(),zIndex:1},Fg={overflowAnchor:"none"},Tj={...Fg,display:"inline-block",height:"100%"},Ex=Ce.memo(function({showTopList:a=!1}){const r=Be("listState"),i=On("sizeRanges"),o=Be("useWindowScroll"),d=Be("customScrollParent"),p=On("windowScrollContainerState"),f=On("scrollContainerState"),h=d||o?p:f,x=Be("itemContent"),m=Be("context"),y=Be("groupContent"),v=Be("trackItemSizes"),j=Be("itemSize"),S=Be("log"),k=On("gap"),A=Be("horizontalDirection"),{callbackRef:T}=P0(i,j,v,a?vr:h,S,k,d,A,Be("skipAnimationFrameInResizeObserver")),[C,M]=Ce.useState(0);Uu("deviation",Q=>{C!==Q&&M(Q)});const O=Be("EmptyPlaceholder"),U=Be("ScrollSeekPlaceholder")??Nj,L=Be("ListComponent"),V=Be("ItemComponent"),w=Be("GroupComponent"),D=Be("computeItemKey"),E=Be("isSeeking"),B=Be("groupIndices").length>0,P=Be("alignToBottom"),q=Be("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...A?{display:"inline-block",height:"100%",marginLeft:C!==0?C:P?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:C!==0?C:P?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...q?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&O!==null&&O!==void 0?n.jsx(O,{...Qt(O,m)}):n.jsx(L,{...Qt(L,m),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:te,children:(a?r.topItems:r.items).map(Q=>{const z=Q.originalIndex,R=D(z+r.firstItemIndex,Q.data,m);return E?g.createElement(U,{...Qt(U,m),height:Q.size,index:Q.index,key:R,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?g.createElement(w,{...Qt(w,m),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:Ej},y(Q.index,m)):g.createElement(V,{...Qt(V,m),...zj(V,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:A?Tj:Fg},B?x(Q.index,Q.groupIndex,Q.data,m):x(Q.index,Q.data,m))})})}),Rj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Aj={outline:"none",overflowX:"auto",position:"relative"},yo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Mj={position:Iu(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function zj(a,r){return{item:typeof a=="string"?void 0:r}}const Lj=Ce.memo(function(){const a=Be("HeaderComponent"),r=On("headerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Dj=Ce.memo(function(){const a=Be("FooterComponent"),r=On("footerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null});function Wg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:k}=Yg(h,m,x,y,void 0,v);return a("scrollTo",k),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?Aj:Rj,...d},tabIndex:0,...f,...Qt(x,p),children:o})})}function Kg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),j=r("customScrollParent"),S=Ce.useRef(null),k=r("scrollerRef"),{scrollByCallback:A,scrollerRef:T,scrollToCallback:C}=Yg(h,m,x,k,j);return qg(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",C),a("scrollBy",A),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...d,...y!==0?{height:y+v}:void 0},...f,...Qt(x,p),children:o})})}const _j=({children:a})=>{const r=Ce.useContext(Pg),i=On("viewportHeight"),o=On("fixedItemHeight"),d=Be("alignToBottom"),p=Be("horizontalDirection"),f=Ce.useMemo(()=>bg(i,x=>Fa(x,p?"width":"height")),[i,p]),h=jl(f,!0,Be("skipAnimationFrameInResizeObserver"));return Ce.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:yo(d),children:a})},Oj=({children:a})=>{const r=Ce.useContext(Pg),i=On("windowViewportRect"),o=On("fixedItemHeight"),d=Be("customScrollParent"),p=Sg(i,d,Be("skipAnimationFrameInResizeObserver")),f=Be("alignToBottom");return Ce.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:p,style:yo(f),children:a})},Bj=({children:a})=>{const r=Be("TopItemListComponent")??"div",i=Be("headerHeight"),o={...Mj,marginTop:`${i}px`},d=Be("context");return n.jsx(r,{style:o,...Qt(r,d),children:a})},Ij=Ce.memo(function(a){const r=Be("useWindowScroll"),i=Be("topItemsIndexes").length>0,o=Be("customScrollParent"),d=Be("context");return n.jsxs(o||r?Vj:Uj,{...a,context:d,children:[i&&n.jsx(Bj,{children:n.jsx(Ex,{showTopList:!0})}),n.jsxs(o||r?Oj:_j,{children:[n.jsx(Lj,{}),n.jsx(Ex,{}),n.jsx(Dj,{})]})]})}),{Component:Hj,useEmitter:Uu,useEmitterValue:Be,usePublisher:On}=$g(Cj,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ij),Uj=Wg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),Vj=Kg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),$j=Hj,Pj=et(()=>{const a=me(m=>n.jsxs("td",{children:["Item $",m]})),r=me(null),i=me(m=>n.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=me(null),d=me(null),p=me({}),f=me(Hu),h=me(vr),x=(m,y=null)=>Zt(ce(p,be(v=>v[m]),ht()),y);return{components:p,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:d,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});xt(Vg,Pj);Iu();const Tx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Gj={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Rx,floor:co,max:js,min:Wd,round:Ax}=Math;function Mx(a,r,i){return Array.from({length:r-a+1}).map((o,d)=>({data:i===null?null:i[d+a],index:d+a}))}function qj(a){return{...Gj,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function Yj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Fj=et(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:d,headerHeight:p,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},j,S,{didMount:k,propsReady:A},{customScrollParent:T,useWindowScroll:C,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U},L])=>{const V=me(0),w=me(0),D=me(Tx),E=me({height:0,width:0}),B=me({height:0,width:0}),P=Xe(),q=Xe(),te=me(0),Q=me(null),z=me({column:0,row:0}),R=Xe(),I=Xe(),Z=me(!1),Y=me(0),de=me(!0),_=me(!1),W=me(!1);nt(ce(k,Pe(Y),ze(([oe,Se])=>Se!==0)),()=>{Ve(de,!1)}),nt(ce(_t(k,de,B,E,Y,_),ze(([oe,Se,De,Ie,,ae])=>oe&&!Se&&De.height!==0&&Ie.height!==0&&!ae)),([,,,,oe])=>{Ve(_,!0),Du(1,()=>{Ve(P,oe)}),Pn(ce(m),()=>{Ve(r,[0,0]),Ve(de,!0)})}),Ne(ce(I,ze(oe=>oe!=null&&oe.scrollTop>0),Kn(0)),w),nt(ce(k,Pe(I),ze(([,oe])=>oe!=null)),([,oe])=>{oe&&(Ve(E,oe.viewport),Ve(B,oe.item),Ve(z,oe.gap),oe.scrollTop>0&&(Ve(Z,!0),Pn(ce(m,yl(1)),Se=>{Ve(Z,!1)}),Ve(x,{top:oe.scrollTop})))}),Ne(ce(E,be(({height:oe})=>oe)),v),Ne(ce(_t(Me(E,Wi),Me(B,Wi),Me(z,(oe,Se)=>oe!==void 0&&oe.column===Se.column&&oe.row===Se.row),Me(m)),be(([oe,Se,De,Ie])=>({gap:De,item:Se,scrollTop:Ie,viewport:oe}))),R),Ne(ce(_t(Me(V),o,Me(z,Yj),Me(B,Wi),Me(E,Wi),Me(Q),Me(w),Me(Z),Me(de),Me(Y)),ze(([,,,,,,,oe])=>!oe),be(([oe,[Se,De],Ie,ae,pe,fe,he,,ve,_e])=>{const{column:re,row:Te}=Ie,{height:Qe,width:at}=ae,{width:$t}=pe;if(he===0&&(oe===0||$t===0))return Tx;if(at===0){const rt=_u(_e,oe),Qa=rt+Math.max(he-1,0);return qj(Mx(rt,Qa,fe))}const Pt=Xg($t,at,re);let lt,St;ve?Se===0&&De===0&&he>0?(lt=0,St=he-1):(lt=Pt*co((Se+Te)/(Qe+Te)),St=Pt*Rx((De+Te)/(Qe+Te))-1,St=Wd(oe-1,js(St,Pt-1)),lt=Wd(St,js(0,lt))):(lt=0,St=-1);const ye=Mx(lt,St,fe),{bottom:At,top:Le}=zx(pe,Ie,ae,ye),gt=Rx(oe/Pt),Kt=gt*Qe+(gt-1)*Te-At;return{bottom:At,itemHeight:Qe,items:ye,itemWidth:at,offsetBottom:Kt,offsetTop:Le,top:Le}})),D),Ne(ce(Q,ze(oe=>oe!==null),be(oe=>oe.length)),V),Ne(ce(_t(E,B,D,z),ze(([oe,Se,{items:De}])=>De.length>0&&Se.height!==0&&oe.height!==0),be(([oe,Se,{items:De},Ie])=>{const{bottom:ae,top:pe}=zx(oe,Ie,Se,De);return[pe,ae]}),ht(Cs)),r);const ie=me(!1);Ne(ce(m,Pe(ie),be(([oe,Se])=>Se||oe!==0)),ie);const ue=Sn(ce(_t(D,V),ze(([{items:oe}])=>oe.length>0),Pe(ie),ze(([[oe,Se],De])=>{const Ie=oe.items[oe.items.length-1].index===Se-1;return(De||oe.bottom>0&&oe.itemHeight>0&&oe.offsetBottom===0&&oe.items.length===Se)&&Ie}),be(([[,oe]])=>oe-1),ht())),ge=Sn(ce(Me(D),ze(({items:oe})=>oe.length>0&&oe[0].index===0),Kn(0),ht())),xe=Sn(ce(Me(D),Pe(Z),ze(([{items:oe},Se])=>oe.length>0&&!Se),be(([{items:oe}])=>({endIndex:oe[oe.length-1].index,startIndex:oe[0].index})),ht(Tg),va(0)));Ne(xe,S.scrollSeekRangeChanged),Ne(ce(P,Pe(E,B,V,z),be(([oe,Se,De,Ie,ae])=>{const pe=Lg(oe),{align:fe,behavior:he,offset:ve}=pe;let _e=pe.index;_e==="LAST"&&(_e=Ie-1),_e=js(0,_e,Wd(Ie-1,_e));let re=yu(Se,ae,De,_e);return fe==="end"?re=Ax(re-Se.height+De.height):fe==="center"&&(re=Ax(re-Se.height/2+De.height/2)),ve!==void 0&&ve!==0&&(re+=ve),{behavior:he,top:re}})),x);const we=Zt(ce(D,be(oe=>oe.offsetBottom+oe.bottom)),0);return Ne(ce(U,be(oe=>({height:oe.visibleHeight,width:oe.visibleWidth}))),E),{customScrollParent:T,data:Q,deviation:te,footerHeight:d,gap:z,headerHeight:p,increaseViewportBy:a,initialItemCount:w,itemDimensions:B,overscan:i,restoreStateFrom:I,scrollBy:f,scrollContainerState:h,scrollHeight:q,scrollTo:x,scrollToIndex:P,scrollTop:m,smoothScrollTargetReached:y,totalCount:V,useWindowScroll:C,viewportDimensions:E,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U,...S,gridState:D,horizontalDirection:W,initialTopMostItemIndex:Y,totalListHeight:we,...j,endReached:ue,propsReady:A,rangeChanged:xe,startReached:ge,stateChanged:R,stateRestoreInProgress:Z,...L}},xt(Ou,ln,zs,Hg,Xa,Bu,Ka));function Xg(a,r,i){return js(1,co((a+i)/(co(r)+i)))}function zx(a,r,i,o){const{height:d}=i;if(d===void 0||o.length===0)return{bottom:0,top:0};const p=yu(a,r,i,o[0].index);return{bottom:yu(a,r,i,o[o.length-1].index)+d,top:p}}function yu(a,r,i,o){const d=Xg(a.width,i.width,r.column),p=co(o/d),f=p*i.height+js(0,p-1)*r.row;return f>0?f+r.row:f}const Wj=et(()=>{const a=me(v=>`Item ${v}`),r=me({}),i=me(null),o=me("virtuoso-grid-item"),d=me("virtuoso-grid-list"),p=me(Hu),f=me("div"),h=me(vr),x=(v,j=null)=>Zt(ce(r,be(S=>S[v]),ht()),j),m=me(!1),y=me(!1);return Ne(Me(y),m),{components:r,computeItemKey:p,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:d,ListComponent:x("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Kj=et(([a,r])=>({...a,...r}),xt(Fj,Wj)),Xj=Ce.memo(function(){const a=yt("gridState"),r=yt("listClassName"),i=yt("itemClassName"),o=yt("itemContent"),d=yt("computeItemKey"),p=yt("isSeeking"),f=Bn("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),m=yt("ScrollSeekPlaceholder"),y=yt("context"),v=Bn("itemDimensions"),j=Bn("gap"),S=yt("log"),k=yt("stateRestoreInProgress"),A=Bn("reportReadyState"),T=jl(Ce.useMemo(()=>C=>{const M=C.parentElement.parentElement.scrollHeight;f(M);const O=C.firstChild;if(O!==null){const{height:U,width:L}=O.getBoundingClientRect();v({height:U,width:L})}j({column:Lx("column-gap",getComputedStyle(C).columnGap,S),row:Lx("row-gap",getComputedStyle(C).rowGap,S)})},[f,v,j,S]),!0,!1);return qg(()=>{a.itemHeight>0&&a.itemWidth>0&&A(!0)},[a]),k?null:n.jsx(x,{className:r,ref:T,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(C=>{const M=d(C.index,C.data,y);return p?n.jsx(m,{...Qt(m,y),height:a.itemHeight,index:C.index,width:a.itemWidth},M):g.createElement(h,{...Qt(h,y),className:i,"data-index":C.index,key:M},o(C.index,C.data,y))})})}),Qj=Ce.memo(function(){const a=yt("HeaderComponent"),r=Bn("headerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Zj=Ce.memo(function(){const a=yt("FooterComponent"),r=Bn("footerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Fa(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Jj=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("itemDimensions"),o=Bn("viewportDimensions"),d=jl(Ce.useMemo(()=>p=>{o(p.getBoundingClientRect())},[o]),!0,!1);return Ce.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:d,style:yo(!1),children:a})},e2=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("windowViewportRect"),o=Bn("itemDimensions"),d=yt("customScrollParent"),p=Sg(i,d,!1);return Ce.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:p,style:yo(!1),children:a})},t2=Ce.memo(function({...a}){const r=yt("useWindowScroll"),i=yt("customScrollParent"),o=i||r?a2:n2,d=i||r?e2:Jj,p=yt("context");return n.jsx(o,{...a,...Qt(o,p),children:n.jsxs(d,{children:[n.jsx(Qj,{}),n.jsx(Xj,{}),n.jsx(Zj,{})]})})}),{useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}=$g(Kj,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},t2),n2=Wg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}),a2=Kg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn});function Lx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}const l2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Zg={source:"Own",installed:"Installed"};function r2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function s2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Dx({origin:a,count:r,filteredCount:i,updateCount:o,children:d}){const p=l2[a],[f,h]=g.useState(()=>r2(p)),x=g.useCallback(()=>{h(j=>{const S=!j;return s2(p,S),S})},[p]),m=Zg[a],y=`sidebar-section-${a}-header`,v=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":v,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(o2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(i2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:d})]})}function i2({origin:a,updateCount:r}){const[i,o]=g.useState(!1),d=Zg[a].toLowerCase(),p=`${r} updates available in ${d} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":p,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function o2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Vu(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function c2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:d="Invalid filter expression"}){const p=g.useRef(null),f=g.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return g.useEffect(()=>{function x(m){var j;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(j=p.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:p,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:d}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function d2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.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 u2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function f2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const d=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?p=>{p.preventDefault(),o(p,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true","aria-label":a.updateAvailable?"Update available":void 0,title:a.updateAvailable?`Update available${a.latestVersion?` → ${a.latestVersion}`:""}`:void 0,style:{width:a.updateAvailable?10:6,height:a.updateAvailable?10:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0,boxShadow:a.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(d2,{target:a.symlinkTarget??null}),n.jsx(u2,{skill:a})]})}const uo=g.memo(f2);function p2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:d}){const p=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:p.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(uo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:d})},`${f.plugin}/${f.skill}`)})})]})}function m2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function _x({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:d,headerActionSlot:p}){var v;const f=r??((v=a[0])==null?void 0:v.pluginName)??"unknown-plugin",[h,x]=g.useState(()=>m2(o,i)),m=g.useCallback(()=>{x(j=>{const S=!j;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(S))}catch{}return S})},[o]),y=h?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":f,role:"group","aria-label":`${f} (${a.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[n.jsxs("button",{type:"button",onClick:m,"aria-expanded":!h,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[n.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:12,display:"inline-block",textAlign:"center",fontSize:10,color:"var(--text-secondary)"},children:y}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:f}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),p&&n.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:p})]}),!h&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(j=>n.jsx("div",{"data-vskill-plugin-skill":j.pluginNamespace??j.skill,children:d(j)},`${j.pluginNamespace??j.skill}`))})]})}function h2({pluginName:a,enabled:r,onAfterAction:i}){const[o,d]=g.useState(!1),[p,f]=g.useState(null),[h,x]=g.useState(null),m=g.useRef(null);g.useEffect(()=>{if(!o)return;function v(j){m.current&&!m.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){f(v),x(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${a}? This removes the plugin and its skills.`)){f(null);return}const j=await fetch(`/api/plugins/${encodeURIComponent(a)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),S=await j.json().catch(()=>({}));if(!j.ok||!S.ok){x(S.error??`${v} failed (${j.status})`);return}an("skills"),an("plugins"),i==null||i(),d(!1)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}}return n.jsxs("div",{ref:m,style:{position:"relative",display:"inline-flex"},children:[n.jsx("button",{type:"button","aria-label":`Manage ${a}`,title:`Manage ${a}`,onClick:v=>{v.stopPropagation(),d(j=>!j)},"data-vskill-plugin-action-trigger":a,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)",v.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)",v.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&n.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[r?n.jsx(Kd,{onClick:()=>void y("disable"),disabled:p!==null,busy:p==="disable",label:"Disable",hint:"Keep installed, turn off"}):n.jsx(Kd,{onClick:()=>void y("enable"),disabled:p!==null,busy:p==="enable",label:"Enable",hint:"Activate plugin"}),n.jsx(Kd,{onClick:()=>void y("uninstall"),disabled:p!==null,busy:p==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&n.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]})]})}function Kd({onClick:a,disabled:r,busy:i,label:o,hint:d,danger:p}){return n.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a()},disabled:r,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:r?"not-allowed":"pointer",color:p?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:r&&!i?.5:1,fontFamily:"inherit"},onMouseEnter:f=>{r||(f.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:12,fontWeight:500},children:i?`${o}…`:o}),n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:d})]})}function Ox({name:a,count:r,className:i,variant:o,collapsed:d,onToggle:p,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",m=typeof p=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},v=d?"▸":"▾",j=n.jsxs(n.Fragment,{children:[m&&n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block",letterSpacing:0,textTransform:"none"},children:v}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&n.jsx("span",{style:{marginLeft:"auto"},children:n.jsx(x2,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return m?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,onClick:()=>p(!d),"aria-expanded":!d,children:j}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,children:j})}function x2({label:a,title:r,icon:i,onClick:o,accent:d}){return n.jsxs("button",{type:"button","aria-label":a,title:r??a,onClick:p=>{p.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${d}`,background:"transparent",color:d,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:p=>{p.currentTarget.style.background=`color-mix(in oklch, ${d} 15%, transparent)`},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i,a]})}function g2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function v2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,d=!!a.shift,p=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?d=!0:(x==="alt"||x==="option")&&(p=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:d,alt:p,allowInInputs:!!a.allowInInputs,handler:a.handler}}function y2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function b2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,d=!!a.shiftKey,p=!!a.altKey;return i!==r.meta||o!==r.ctrl||d!==r.shift||p!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function bu(a,r={}){const{enabled:i=!0,target:o}=r,d=g.useRef([]),p=Array.isArray(a)?a:[a];d.current=p.map(v2),g.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const m=x,y=y2(m.target);for(const v of d.current){if(!b2(m,v))continue;const j=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!j)){v.handler(m);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const j2=200;function S2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function k2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const d of a){const p=d.scopeV2??(d.scope==="installed"?"available-project":d.scope==="global"?"available-personal":"authoring-project");p==="available-project"?i.availableProject.push(d):p==="available-personal"?i.availablePersonal.push(d):p==="available-plugin"?i.availablePlugin.push(d):p==="authoring-plugin"?i.authoringPlugin.push(d):i.authoringProject.push(d)}function o(d){const p=d.filter(x=>Vu(x,r)),f={};for(const x of p){const m=x.pluginName??x.plugin;(f[m]||(f[m]=[])).push(x)}const h=Object.entries(f).sort((x,m)=>x[0].localeCompare(m[0]));return{total:d.length,filtered:p.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function w2(a,r){const i=[],o=[],d=[];for(const f of a){const h=S2(f);h==="global"?d.push(f):h==="installed"?o.push(f):i.push(f)}function p(f){var y;const h=f.filter(v=>Vu(v,r)),x={};for(const v of h)(x[y=v.plugin]||(x[y]=[])).push(v);const m=Object.entries(x).sort((v,j)=>v[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:m}}return{own:p(i),installed:p(o),global:p(d)}}function C2(a,r){const i=[],o=[];for(const p of a)(p.origin==="installed"?o:i).push(p);function d(p){var m;const f=p.filter(y=>Vu(y,r)),h={};for(const y of f)(h[m=y.plugin]||(h[m]=[])).push(y);const x=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:p.length,filtered:f.length,byPlugin:x}}return{own:d(i),installed:d(o)}}function N2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:d,onRetry:p,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:m,topSlot:y}){const v=!!x||a.some(Z=>Z.scope!==void 0&&Z.scope!==null),j=x??"claude-cli",[S,k]=g.useState(""),A=g.useDeferredValue(S),T=g.useMemo(()=>w2(a,A),[a,A]),C=g.useMemo(()=>k2(a,A),[a,A]),M=j==="claude-code",{data:O}=xr("plugins",()=>fetch("/api/plugins").then(Z=>Z.json()),{enabled:M,ttl:6e4}),U=g.useMemo(()=>{const Z=new Map;for(const Y of(O==null?void 0:O.plugins)??[]){const de=Z.get(Y.name);Z.set(Y.name,!!de||!!Y.enabled)}return Z},[O==null?void 0:O.plugins]),[L,V]=g.useState(()=>ju(`vskill-sidebar-${j}-group-available-collapsed`)),[w,D]=g.useState(()=>ju(`vskill-sidebar-${j}-group-authoring-collapsed`)),E=g.useCallback(Z=>{V(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(Z))}catch{}},[j]),B=g.useCallback(Z=>{D(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(Z))}catch{}},[j]),{own:P,installed:q}=g.useMemo(()=>C2(a,A),[a,A]),Q=T.own.filtered+T.installed.filtered+T.global.filtered>=j2,z=g.useMemo(()=>{const Z=Y=>{const de=[];for(const[,_]of Y){const W=[..._].sort((ie,ue)=>ie.skill.localeCompare(ue.skill));de.push(...W)}return de};return v?[...Z(T.own.byPlugin),...Z(T.installed.byPlugin),...Z(T.global.byPlugin)]:[...Z(P.byPlugin),...Z(q.byPlugin)]},[v,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,P.byPlugin,q.byPlugin]),R=g.useMemo(()=>r?z.findIndex(Z=>Z.plugin===r.plugin&&Z.skill===r.skill):-1,[z,r]),I=g.useCallback(Z=>{if(z.length===0)return;const Y=R<0?Z>0?0:z.length-1:Math.min(Math.max(R+Z,0),z.length-1);i(z[Y])},[z,R,i]);return bu([{key:"j",handler:()=>I(1)},{key:"k",handler:()=>I(-1)},{key:"Enter",handler:()=>{R>=0&&i(z[R])}}],{enabled:!o&&!d}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(c2,{value:S,onChange:k}),o&&n.jsx(M2,{}),!o&&d&&n.jsx(z2,{error:d,onRetry:p}),!o&&!d&&v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ox,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:L,onToggle:E,count:C.availableProject.total+C.availablePersonal.total+C.availablePlugin.total}),!L&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:C.availableProject.total,filteredCount:S?C.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:C.availableProject.filtered===0?n.jsx(Ix,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(ms,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:C.availablePersonal.total,filteredCount:S?C.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:C.availablePersonal.filtered===0?n.jsx(T2,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsxs(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:C.availablePlugin.total,filteredCount:S?C.availablePlugin.filtered:null,children:[n.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[n.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),C.availablePlugin.filtered===0?n.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):C.availablePlugin.byPlugin.map(([Z,Y])=>n.jsx(_x,{pluginName:Z,skills:Y,persistKey:`vskill-plugin-available-${Z}-collapsed`,headerActionSlot:M?n.jsx(h2,{pluginName:Z,enabled:U.get(Z)??!0}):void 0,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`available-${Z}`))]})]}),n.jsx(A2,{}),n.jsx(Ox,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:w,onToggle:B,count:C.authoringProject.total+C.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),!w&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:C.authoringProject.total,filteredCount:S?C.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),children:C.authoringProject.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:C.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsx(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:C.authoringPlugin.total,filteredCount:S?C.authoringPlugin.filtered:null,children:C.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):C.authoringPlugin.byPlugin.map(([Z,Y])=>n.jsx(_x,{pluginName:Z,skills:Y,persistKey:`vskill-plugin-authoring-${Z}-collapsed`,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`authoring-${Z}`))})]})]}),!o&&!d&&!v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Dx,{origin:"source",count:P.total,filteredCount:S?P.filtered:null,updateCount:h==null?void 0:h.source,children:P.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:P.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(R2,{}),n.jsx(Dx,{origin:"installed",count:q.total,filteredCount:S?q.filtered:null,updateCount:h==null?void 0:h.installed,children:q.filtered===0?n.jsx(Ix,{queryActive:!!S}):n.jsx(hs,{items:q.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})})]})]})}function ju(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ms({label:a,storageKey:r,count:i,filteredCount:o,updateCount:d,children:p}){const[f,h]=g.useState(()=>ju(r)),x=g.useCallback(()=>{h(y=>{const v=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(v))}catch{}return v})},[r]),m=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-secondary)",width:10,display:"inline-block"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",m,")"]}),d!=null&&d>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[d," update",d!==1?"s":""]})]}),!f&&n.jsx("div",{children:p})]})}function E2(a){const r=[];for(const[i,o]of a){const d=[...o].sort((p,f)=>p.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:d.length});for(const p of d)r.push({kind:"row",skill:p})}return r}function hs({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:d}){if(d){const p=E2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx($j,{overscan:4,totalCount:p.length,itemContent:f=>{const h=p[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,m=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(uo,{skill:x,isSelected:m,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([p,f])=>n.jsx(p2,{plugin:p,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},p))})}function Bx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx($u,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ix({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install <plugin>"})," to add one."]})})}function T2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function $u({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function R2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function A2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function M2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(g2,{},a))})}function z2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:L2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function L2(a){const r=a.split(`
|
|
54
|
+
}`})]})}function ix(){typeof window>"u"||(window.location.hash="#/")}function m0({onHome:a}){const[r,i]=g.useState(!1),[o,d]=g.useState(!1),p=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),ix(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),ix(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:p,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const h0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='1.75'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%20focusable='false'%3e%3cpath%20d='M5.5%2017h11l-1.2-1.8a2%202%200%200%201-.3-1.1V10a4%204%200%201%200-8%200v4.1a2%202%200%200%201-.3%201.1L5.5%2017Z'%20/%3e%3cpath%20d='M10%2020a2%202%200%200%200%204%200'%20/%3e%3ccircle%20cx='17'%20cy='7'%20r='2.2'%20fill='currentColor'%20stroke='none'%20/%3e%3c/svg%3e",x0=g.lazy(()=>Tu(()=>import("./UpdateDropdown-Cx3XWMAn.js"),__vite__mapDeps([0,1])));function g0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:d}=ya(),[p,f]=g.useState(!1),h=g.useRef(null),x=g.useCallback(()=>f(!1),[]),m=a>0?"var(--text-primary)":"var(--text-secondary)",y=a>9?"9+":String(a),v=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":v,"aria-haspopup":"dialog","aria-expanded":p,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:m,cursor:"pointer"},children:[n.jsx("img",{src:h0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),p&&n.jsx(g.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(x0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),k=S.length>=2?S[S.length-2]:S[0],A=S[S.length-1];d({plugin:k,skill:A,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function ox(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function v0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:d,onRequestCreateSkill:p}){const f=r?r.origin==="installed"?"Project":"Skills":null;return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[n.jsx(m0,{onHome:o}),d?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:d}):a&&n.jsx("span",{title:a,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a})]}),n.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:r&&f&&n.jsxs(n.Fragment,{children:[n.jsx(cx,{segment:"origin",onClick:()=>ox({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:f}),n.jsx(dx,{}),n.jsx(cx,{segment:"plugin",onClick:()=>ox({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(dx,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[p&&n.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:p,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--color-action, #2F5B8E)",background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(f0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(g0,{})}),n.jsx("button",{type:"button",onClick:i,"aria-label":"Open command palette",title:"Command palette (⌘K)",style:{display:"inline-flex",alignItems:"center",gap:6,height:26,padding:"0 10px",borderRadius:4,border:"1px solid var(--border-default)",background:"transparent",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono)",cursor:"pointer"},children:n.jsx("span",{children:"⌘K"})})]})]})}function cx({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:d=>{d.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:d=>{const p=(i==null?void 0:i.color)??"var(--text-secondary)";d.currentTarget.style.color=p},children:o})}function dx(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ho="vskill-theme";function xg(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function y0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function b0(a){try{const r=a.getItem(ho);return xg(r)}catch{return"auto"}}function j0(a,r){try{a.setItem(ho,r)}catch{}}function S0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function k0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const gg=g.createContext(null);function w0({storage:a,matchMedia:r,target:i,children:o}){const d=a??(typeof window<"u"?window.localStorage:void 0),p=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=g.useState(()=>d?b0(d):"auto"),[m,y]=g.useState(()=>k0(p)),v=g.useMemo(()=>y0(h,m),[h,m]);g.useEffect(()=>{f&&S0(f,h,v)},[f,h,v]),g.useEffect(()=>{if(!p)return;const k=p("(prefers-color-scheme: dark)"),A=C=>y(C.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",A),()=>k.removeEventListener("change",A);const T=k;return T.addListener(A),()=>T.removeListener(A)},[p]),g.useEffect(()=>{if(typeof window>"u")return;const k=A=>{A.key===ho&&x(xg(A.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useEffect(()=>{if(!p||!f)return;let k;try{k=p("(prefers-contrast: more)")}catch{return}const A=M=>{M?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};A(k.matches);const T=M=>A(M.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",T),()=>k.removeEventListener("change",T);const C=k;return C.addListener(T),()=>C.removeListener(T)},[p,f]);const j=g.useCallback(k=>{x(k),d&&j0(d,k)},[d]),S=g.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:j}),[h,v,j]);return n.jsx(gg.Provider,{value:S,children:o})}function vg(){const a=g.useContext(gg);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const ux=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function C0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of ux){const d=r.get(o);d&&i.push(d)}for(const o of a)ux.includes(o.id)||i.push(o);return i}function N0(a){const[r,i]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return g.useEffect(()=>{var p;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),d=()=>i(o.matches);return(p=o.addEventListener)==null||p.call(o,"change",d),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",d)}},[a]),r}function E0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=C0(a),d=N0(640),[p,f]=g.useState(!1),h=g.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(d){const x=o.filter(m=>m.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!p),"aria-label":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),p&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(m=>n.jsx(fx,{p:m,onClick:h},m.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(fx,{p:x,onClick:h,compact:!0},x.id))})}function fx({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(pu,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function T0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ho)}catch{return null}}function R0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:d,onOpenProviderSettings:p,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:m}=vg(),v=T0()==="auto",j=A0(h,x,v),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(px,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(M0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),d&&d.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(px,{}),n.jsx(E0,{providers:d,onOpenSettings:p,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>m(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(z0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function A0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function M0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function px(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function z0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const ao=new Map,gl=new Map,xs=new Map;function an(a){ao.delete(a),gl.delete(a);const r=xs.get(a);if(r)for(const i of r)i()}function xr(a,r,i={}){const{ttl:o=3e4,enabled:d=!0}=i,[,p]=g.useState(0),f=g.useRef(!0),h=g.useRef(a);h.current=a;const x=()=>an(a);g.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),g.useEffect(()=>{if(!d)return;const j=()=>{f.current&&p(S=>S+1)};return xs.has(a)||xs.set(a,new Set),xs.get(a).add(j),()=>{var S;(S=xs.get(a))==null||S.delete(j)}},[a,d]),g.useEffect(()=>{if(!d)return;const j=ao.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(gl.has(a)){const T=gl.get(a),C=()=>{f.current&&h.current===a&&p(M=>M+1)};T.subscribers.push(C);return}const k={promise:Promise.resolve(),subscribers:[]},A=r().then(T=>{ao.set(a,{data:T,fetchedAt:Date.now()}),gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C()},T=>{gl.delete(a),f.current&&h.current===a&&p(C=>C+1);for(const C of k.subscribers)C();throw T});k.promise=A,gl.set(a,k)},[a,r,o,d]);const m=ao.get(a),y=d&&!m&&gl.has(a);return{data:m==null?void 0:m.data,loading:y||d&&!m,error:void 0,revalidate:x}}const xo=0,Wa=1,gr=2,yg=4;function mx(a){return()=>a}function L0(a){a()}function bg(a,r){return i=>a(r(i))}function hx(a,r){return()=>a(r)}function D0(a,r){return i=>a(r,i)}function Ru(a){return a!==void 0}function _0(...a){return()=>{a.map(L0)}}function vr(){}function go(a,r){return r(a),a}function O0(a,r){return r(a)}function xt(...a){return a}function nt(a,r){return a(Wa,r)}function Ve(a,r){a(xo,r)}function Au(a){a(gr)}function bt(a){return a(yg)}function Ne(a,r){return nt(a,D0(r,xo))}function Pn(a,r){const i=a(Wa,o=>{i(),r(o)});return i}function xx(a){let r,i;return o=>d=>{r=d,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function jg(a,r){return a===r}function ht(a=jg){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function ze(a){return r=>i=>{a(i)&&r(i)}}function be(a){return r=>bg(r,a)}function Kn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=B0(...r);return((o,d)=>{switch(o){case gr:Au(a);return;case Wa:return nt(a,i(d))}})}function Xn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>d=>{r=d,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function Pe(...a){const r=new Array(a.length);let i=0,o=null;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{const m=i;i|=h,r[f]=x,m!==d&&i===d&&o&&(o(),o=null)})}),p=>f=>{const h=()=>{p([f].concat(r))};i===d?h():o=h}}function B0(...a){return r=>a.reduceRight(O0,r)}function I0(a){let r,i;const o=()=>r==null?void 0:r();return function(d,p){switch(d){case Wa:return p?i===p?void 0:(o(),i=p,r=nt(a,p),r):(o(),vr);case gr:o(),i=null;return}}}function me(a){let r=a;const i=Xe();return((o,d)=>{switch(o){case xo:r=d;break;case Wa:{d(r);break}case yg:return r}return i(o,d)})}function Zt(a,r){return go(me(r),i=>Ne(a,i))}function Xe(){const a=[];return((r,i)=>{switch(r){case xo:a.slice().forEach(o=>{o(i)});return;case gr:a.splice(0,a.length);return;case Wa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function Sn(a){return go(Xe(),r=>Ne(a,r))}function et(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:H0(),singleton:i}}const H0=()=>Symbol();function U0(a){const r=new Map,i=({constructor:o,dependencies:d,id:p,singleton:f})=>{if(f&&r.has(p))return r.get(p);const h=o(d.map(x=>i(x)));return f&&r.set(p,h),h};return i(a)}function _t(...a){const r=Xe(),i=new Array(a.length);let o=0;const d=2**a.length-1;return a.forEach((p,f)=>{const h=2**f;nt(p,x=>{i[f]=x,o|=h,o===d&&Ve(r,i)})}),function(p,f){switch(p){case gr:{Au(r);return}case Wa:return o===d&&f(i),nt(r,f)}}}function Me(a,r=jg){return ce(a,ht(r))}function mu(...a){return function(r,i){switch(r){case gr:return;case Wa:return _0(...a.map(o=>nt(o,i)))}}}const It={DEBUG:0,INFO:1,WARN:2,ERROR:3},V0={[It.DEBUG]:"debug",[It.ERROR]:"error",[It.INFO]:"log",[It.WARN]:"warn"},$0=()=>typeof globalThis>"u"?window:globalThis,Ka=et(()=>{const a=me(It.ERROR);return{log:me((r,i,o=It.INFO)=>{const d=$0().VIRTUOSO_LOG_LEVEL??bt(a);o>=d&&console[V0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Mu(a,r,i).callbackRef}function Mu(a,r,i){const o=Ce.useRef(null);let d=f=>{};const p=Ce.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return d=f=>{f&&r?(p==null||p.observe(f),o.current=f):(o.current&&(p==null||p.unobserve(o.current)),o.current=null)},{callbackRef:d,ref:o}}function P0(a,r,i,o,d,p,f,h,x){const m=Ce.useCallback(y=>{const v=G0(y.children,r,h?"offsetWidth":"offsetHeight",d);let j=y.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let k;S&&(k=j.ownerDocument.defaultView);const A=f?h?f.scrollLeft:f.scrollTop:S?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,T=f?h?f.scrollWidth:f.scrollHeight:S?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,C=f?h?f.offsetWidth:f.offsetHeight:S?h?k.innerWidth:k.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:T,scrollTop:Math.max(A,0),viewportHeight:C}),p==null||p(h?gx("column-gap",getComputedStyle(y).columnGap,d):gx("row-gap",getComputedStyle(y).rowGap,d)),v!==null&&a(v)},[a,r,d,p,f,o,h]);return Mu(m,i,x)}function G0(a,r,i,o){const d=a.length;if(d===0)return null;const p=[];for(let f=0;f<d;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),m=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},It.ERROR),y===m)continue;const v=p[p.length-1];p.length===0||v.size!==y||v.endIndex!==x-1?p.push({endIndex:x,size:y,startIndex:x}):p[p.length-1].endIndex++}return p}function gx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}function Sg(a,r,i){const o=Ce.useRef(null),d=Ce.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const m=x.getBoundingClientRect(),y=m.width;let v,j;if(r){const S=r.getBoundingClientRect(),k=m.top-S.top;j=S.height-Math.max(0,k),v=k+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,m.top),v=m.top+S.scrollY}o.current={listHeight:m.height,offsetTop:v,visibleHeight:j,visibleWidth:y},a(o.current)},[a,r]),{callbackRef:p,ref:f}=Mu(d,!0,i),h=Ce.useCallback(()=>{d(f.current)},[d,f]);return Ce.useEffect(()=>{var m;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const x=(m=f.current)==null?void 0:m.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),p}const ln=et(()=>{const a=Xe(),r=Xe(),i=me(0),o=Xe(),d=me(0),p=Xe(),f=Xe(),h=me(0),x=me(0),m=me(0),y=me(0),v=Xe(),j=Xe(),S=me(!1),k=me(!1),A=me(!1);return Ne(ce(a,be(({scrollTop:T})=>T)),r),Ne(ce(a,be(({scrollHeight:T})=>T)),f),Ne(r,d),{deviation:i,fixedFooterHeight:m,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:v,scrollTop:r,skipAnimationFrameInResizeObserver:A,smoothScrollTargetReached:o,statefulScrollTop:d,viewportHeight:p}},[],{singleton:!0}),ks={lvl:0};function kg(a,r){const i=a.length;if(i===0)return[];let{index:o,value:d}=r(a[0]);const p=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);p.push({end:h-1,start:o,value:d}),o=h,d=x}return p.push({end:1/0,start:o,value:d}),p}function ut(a){return a===ks}function ws(a,r){if(!ut(a))return r===a.k?a.v:r<a.k?ws(a.l,r):ws(a.r,r)}function Gn(a,r,i="k"){if(ut(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function bn(a,r,i){return ut(a)?Ng(r,i,1):r===a.k?Bt(a,{k:r,v:i}):r<a.k?vx(Bt(a,{l:bn(a.l,r,i)})):vx(Bt(a,{r:bn(a.r,r,i)}))}function dr(){return ks}function ur(a,r,i){if(ut(a))return[];const o=Gn(a,r)[0];return F0(xu(a,o,i))}function hu(a,r){if(ut(a))return ks;const{k:i,l:o,r:d}=a;if(r===i){if(ut(o))return d;if(ut(d))return o;const[p,f]=Cg(o);return lo(Bt(a,{k:p,l:wg(o),v:f}))}return r<i?lo(Bt(a,{l:hu(o,r)})):lo(Bt(a,{r:hu(d,r)}))}function vl(a){return ut(a)?[]:[...vl(a.l),{k:a.k,v:a.v},...vl(a.r)]}function xu(a,r,i){if(ut(a))return[];const{k:o,l:d,r:p,v:f}=a;let h=[];return o>r&&(h=h.concat(xu(d,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(xu(p,r,i))),h}function lo(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Gd(r))return Eg(Bt(a,{lvl:i-1}));if(!ut(r)&&!ut(r.r))return Bt(r.r,{l:Bt(r,{r:r.r.l}),lvl:i,r:Bt(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Gd(a))return gu(Bt(a,{lvl:i-1}));if(!ut(o)&&!ut(o.l)){const d=o.l,p=Gd(d)?o.lvl-1:o.lvl;return Bt(d,{l:Bt(a,{lvl:i-1,r:d.l}),lvl:d.lvl+1,r:gu(Bt(o,{l:d.r,lvl:p}))})}throw new Error("Unexpected empty nodes")}function Bt(a,r){return Ng(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function wg(a){return ut(a.r)?a.l:lo(Bt(a,{r:wg(a.r)}))}function Gd(a){return ut(a)||a.lvl>a.r.lvl}function Cg(a){return ut(a.r)?[a.k,a.v]:Cg(a.r)}function Ng(a,r,i,o=ks,d=ks){return{k:a,l:o,lvl:i,r:d,v:r}}function vx(a){return gu(Eg(a))}function Eg(a){const{l:r}=a;return!ut(r)&&r.lvl===a.lvl?Bt(r,{r:Bt(a,{l:r.r})}):a}function gu(a){const{lvl:r,r:i}=a;return!ut(i)&&!ut(i.r)&&i.lvl===r&&i.r.lvl===r?Bt(i,{l:Bt(a,{r:i.l}),lvl:r+1}):a}function F0(a){return kg(a,({k:r,v:i})=>({index:r,value:i}))}function Tg(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function Cs(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const zu=et(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function Rg(a,r,i){return a[oo(a,r,i)]}function oo(a,r,i,o=0){let d=a.length-1;for(;o<=d;){const p=Math.floor((o+d)/2),f=a[p],h=i(f,r);if(h===0)return p;if(h===-1){if(d-o<2)return p-1;d=p-1}else{if(d===o)return p;o=p+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function q0(a,r,i,o){const d=oo(a,r,o),p=oo(a,i,o,d);return a.slice(d,p+1)}function Ya(a,r){return Math.round(a.getBoundingClientRect()[r])}function vo(a){return!ut(a.groupOffsetTree)}function Lu({index:a},r){return r===a?0:r<a?-1:1}function Y0(){return{groupIndices:[],groupOffsetTree:dr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:dr()}}function W0(a,r){let i=ut(a)?0:1/0;for(const o of r){const{endIndex:d,size:p,startIndex:f}=o;if(i=Math.min(i,f),ut(a)){a=bn(a,0,p);continue}const h=ur(a,f-1,d+1);if(h.some(tj(o)))continue;let x=!1,m=!1;for(const{end:y,start:v,value:j}of h)x?(d>=v||p===j)&&(a=hu(a,v)):(m=j!==p,x=!0),y>d&&d>=v&&j!==p&&(a=bn(a,d+1,j));m&&(a=bn(a,f,p))}return[a,i]}function K0(a){return typeof a.groupIndex<"u"}function X0({offset:a},r){return r===a?0:r<a?-1:1}function Ns(a,r,i){if(r.length===0)return 0;const{index:o,offset:d,size:p}=Rg(r,a,Lu),f=a-o,h=p*f+(f-1)*i+d;return h>0?h+i:h}function Ag(a,r){if(!vo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function Mg(a,r,i){if(K0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let d=Ag(o,r);return d=Math.max(0,d,Math.min(i,d)),d}function Q0(a,r,i,o=0){return o>0&&(r=Math.max(r,Rg(a,o,Lu).offset)),kg(q0(a,r,i,X0),ej)}function Z0(a,[r,i,o,d]){r.length>0&&o("received item sizes",r,It.DEBUG);const p=a.sizeTree;let f=p,h=0;if(i.length>0&&ut(p)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((k,A)=>bn(bn(k,A,j),A+1,S),f)}else[f,h]=W0(f,r);if(f===p)return a;const{lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v}=vu(a.offsetTree,h,f,d);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>bn(j,S,Ns(S,v,d)),dr()),lastIndex:x,lastOffset:m,lastSize:y,offsetTree:v,sizeTree:f}}function J0(a){return vl(a).map(({k:r,v:i},o,d)=>{const p=d[o+1];return{endIndex:p!==void 0?p.k-1:1/0,size:i,startIndex:r}})}function yx(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function vu(a,r,i,o){let d=a,p=0,f=0,h=0,x=0;if(r!==0){x=oo(d,r-1,Lu),h=d[x].offset;const m=Gn(i,r-1);p=m[0],f=m[1],d.length&&d[x].size===Gn(i,r)[1]&&(x-=1),d=d.slice(0,x+1)}else d=[];for(const{start:m,value:y}of ur(i,r,1/0)){const v=m-p,j=v*f+h+v*o;d.push({index:m,offset:j,size:y}),p=m,h=j,f=y}return{lastIndex:p,lastOffset:h,lastSize:f,offsetTree:d}}function ej(a){return{index:a.index,value:a}}function tj(a){const{endIndex:r,size:i,startIndex:o}=a;return d=>d.start===o&&(d.end===r||d.end===1/0)&&d.value===i}const nj={offsetHeight:"height",offsetWidth:"width"},Qn=et(([{log:a},{recalcInProgress:r}])=>{const i=Xe(),o=Xe(),d=Zt(o,0),p=Xe(),f=Xe(),h=me(0),x=me([]),m=me(void 0),y=me(void 0),v=me(void 0),j=me(void 0),S=me((w,D)=>Ya(w,nj[D])),k=me(void 0),A=me(0),T=Y0(),C=Zt(ce(i,Pe(x,a,A),Xn(Z0,T),ht()),T),M=Zt(ce(x,ht(),Xn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),be(({prev:w})=>w)),[]);Ne(ce(x,ze(w=>w.length>0),Pe(C,A),be(([w,D,E])=>{const B=w.reduce((P,F,te)=>bn(P,F,Ns(F,D.offsetTree,E)||te),dr());return{...D,groupIndices:w,groupOffsetTree:B}})),C),Ne(ce(o,Pe(C),ze(([w,{lastIndex:D}])=>w<D),be(([w,{lastIndex:D,lastSize:E}])=>[{endIndex:D,size:E,startIndex:w}])),i),Ne(m,y);const O=Zt(ce(m,be(w=>w===void 0)),!0);Ne(ce(y,ze(w=>w!==void 0&&ut(bt(C).sizeTree)),be(w=>{const D=bt(v),E=bt(x).length>0;return D!==void 0&&D!==0?E?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),Ne(ce(j,ze(w=>w!==void 0&&w.length>0&&ut(bt(C).sizeTree)),be(w=>{const D=[];let E=w[0],B=0;for(let P=1;P<w.length;P++){const F=w[P];F!==E&&(D.push({endIndex:P-1,size:E,startIndex:B}),E=F,B=P)}return D.push({endIndex:w.length-1,size:E,startIndex:B}),D})),i),Ne(ce(x,Pe(v,y),ze(([,w,D])=>w!==void 0&&D!==void 0),be(([w,D,E])=>{const B=[];for(let P=0;P<w.length;P++){const F=w[P],te=w[P+1];B.push({startIndex:F,endIndex:F,size:D}),te!==void 0&&B.push({startIndex:F+1,endIndex:te-1,size:E})}return B})),i);const U=Sn(ce(i,Pe(C),Xn(({sizes:w},[D,E])=>({changed:E!==w,sizes:E}),{changed:!1,sizes:T}),be(w=>w.changed)));nt(ce(h,Xn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),be(w=>w.diff)),w=>{const{groupIndices:D}=bt(C);if(w>0)Ve(r,!0),Ve(p,w+yx(w,D));else if(w<0){const E=bt(M);E.length>0&&(w-=yx(-w,E)),Ve(f,w)}}),nt(ce(h,Pe(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},It.ERROR)});const L=Sn(p);Ne(ce(p,Pe(C),be(([w,D])=>{const E=D.groupIndices.length>0,B=[],P=D.lastSize;if(E){const F=ws(D.sizeTree,0);let te=0,Q=0;for(;te<w;){const R=D.groupIndices[Q],I=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-R-1;B.push({endIndex:R,size:F,startIndex:R}),B.push({endIndex:R+1+I-1,size:P,startIndex:R+1}),Q++,te+=I+1}const z=vl(D.sizeTree);return te!==w&&z.shift(),z.reduce((R,{k:I,v:Z})=>{let q=R.ranges;return R.prevSize!==0&&(q=[...R.ranges,{endIndex:I+w-1,size:R.prevSize,startIndex:R.prevIndex}]),{prevIndex:I+w,prevSize:Z,ranges:q}},{prevIndex:w,prevSize:0,ranges:B}).ranges}return vl(D.sizeTree).reduce((F,{k:te,v:Q})=>({prevIndex:te+w,prevSize:Q,ranges:[...F.ranges,{endIndex:te+w-1,size:F.prevSize,startIndex:F.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),i);const V=Sn(ce(f,Pe(C,A),be(([w,{offsetTree:D},E])=>{const B=-w;return Ns(B,D,E)})));return Ne(ce(f,Pe(C,A),be(([w,D,E])=>{if(D.groupIndices.length>0){if(ut(D.sizeTree))return D;let P=dr();const F=bt(M);let te=0,Q=0,z=0;for(;te<-w;){z=F[Q];const R=F[Q+1]-z-1;Q++,te+=R+1}if(P=vl(D.sizeTree).reduce((R,{k:I,v:Z})=>bn(R,Math.max(0,I+w),Z),P),te!==-w){const R=ws(D.sizeTree,z);P=bn(P,0,R);const I=Gn(D.sizeTree,-w+1)[1];P=bn(P,1,I)}return{...D,sizeTree:P,...vu(D.offsetTree,0,P,E)}}const B=vl(D.sizeTree).reduce((P,{k:F,v:te})=>bn(P,Math.max(0,F+w),te),dr());return{...D,sizeTree:B,...vu(D.offsetTree,0,B,E)}})),C),{beforeUnshiftWith:L,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:m,fixedGroupSize:v,gap:A,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:U,shiftWith:f,shiftWithOffset:V,sizeRanges:i,sizes:C,statefulTotalCount:d,totalCount:o,trackItemSizes:O,unshiftWith:p}},xt(Ka,zu),{singleton:!0});function aj(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const zg=et(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:d}])=>{const p=Xe(),f=Xe(),h=Sn(ce(p,be(aj)));return Ne(ce(h,be(x=>x.totalCount)),i),Ne(ce(h,be(x=>x.groupIndices)),a),Ne(ce(_t(d,r,o),ze(([x,m])=>vo(m)),be(([x,m,y])=>Gn(m.groupOffsetTree,Math.max(x-y,0),"v")[0]),ht(),be(x=>[x])),f),{groupCounts:p,topItemsIndexes:f}},xt(Qn,ln)),Xa=et(([{log:a}])=>{const r=me(!1),i=Sn(ce(r,ze(o=>o),ht()));return nt(r,o=>{o&&bt(a)("props updated",{},It.DEBUG)}),{didMount:i,propsReady:r}},xt(Ka),{singleton:!0}),lj=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Lg(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!lj)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const As=et(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:d,fixedHeaderHeight:p,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:m,smoothScrollTargetReached:y,viewportHeight:v},{log:j}])=>{const S=Xe(),k=Xe(),A=me(0);let T=null,C=null,M=null;function O(){T!==null&&(T(),T=null),M!==null&&(M(),M=null),C&&(clearTimeout(C),C=null),Ve(x,!1)}return Ne(ce(S,Pe(i,v,o,A,h,f,j),Pe(a,p,d),be(([[U,L,V,w,D,E,B,P],F,te,Q])=>{const z=Lg(U),{align:R,behavior:I,offset:Z}=z,q=w-1,de=Mg(z,L,q);let _=Ns(de,L.offsetTree,F)+E;R==="end"?(_+=te+Gn(L.sizeTree,de)[1]-V+Q,de===q&&(_+=B)):R==="center"?_+=(te+Gn(L.sizeTree,de)[1]-V+Q)/2:_-=D,Z!==void 0&&Z!==0&&(_+=Z);const W=ie=>{O(),ie?(P("retrying to scroll to",{location:U},It.DEBUG),Ve(S,U)):(Ve(k,!0),P("list did not change, scroll successful",{},It.DEBUG))};if(O(),I==="smooth"){let ie=!1;M=nt(r,ue=>{ie=ie||ue}),T=Pn(y,()=>{W(ie)})}else T=Pn(ce(r,rj(150)),W);return C=setTimeout(()=>{O()},1200),Ve(x,!0),P("scrolling from index to",{behavior:I,index:de,top:_},It.DEBUG),{behavior:I,top:_}})),m),{scrollTargetReached:k,scrollToIndex:S,topListHeight:A}},xt(Qn,ln,Ka),{singleton:!0});function rj(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Du(a,r){a===0?r():requestAnimationFrame(()=>{Du(a-1,r)})}function _u(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Ms=et(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:d,scrollToIndex:p},{didMount:f}])=>{const h=me(!0),x=me(0),m=me(!0);return Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),h),Ne(ce(f,Pe(x),ze(([y,v])=>v!==0),Kn(!1)),m),nt(ce(_t(r,f),Pe(h,i,a,m),ze(([[,y],v,{sizeTree:j},S,k])=>y&&(!ut(j)||Ru(S))&&!v&&!k),Pe(x)),([,y])=>{Pn(d,()=>{Ve(m,!0)}),Du(4,()=>{Pn(o,()=>{Ve(h,!0)}),Ve(p,y)})}),{initialItemFinalLocationReached:m,initialTopMostItemIndex:x,scrolledToInitialItem:h}},xt(Qn,ln,As,Xa),{singleton:!0});function Dg(a,r){return Math.abs(a-r)<1.01}const Es="up",bs="down",sj="none",ij={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},oj=0,zs=et(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:d,viewportHeight:p}])=>{const f=me(!1),h=me(!0),x=Xe(),m=Xe(),y=me(4),v=me(oj),j=Zt(ce(mu(ce(Me(d),yl(1),Kn(!0)),ce(Me(d),yl(1),Kn(!1),xx(100))),ht()),!1),S=Zt(ce(mu(ce(i,Kn(!0)),ce(i,Kn(!1),xx(200))),ht()),!1);Ne(ce(_t(Me(d),Me(v)),be(([M,O])=>M<=O),ht()),h),Ne(ce(h,va(50)),m);const k=Sn(ce(_t(o,Me(p),Me(r),Me(a),Me(y)),Xn((M,[{scrollHeight:O,scrollTop:U},L,V,w,D])=>{const E=U+L-O>-D,B={scrollHeight:O,scrollTop:U,viewportHeight:L};if(E){let F,te;return U>M.state.scrollTop?(F="SCROLLED_DOWN",te=M.state.scrollTop-U):(F="SIZE_DECREASED",te=M.state.scrollTop-U||M.scrollTopDelta),{atBottom:!0,atBottomBecause:F,scrollTopDelta:te,state:B}}let P;return B.scrollHeight>M.state.scrollHeight?P="SIZE_INCREASED":L<M.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":U<M.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:B}},ij),ht((M,O)=>M!==void 0&&M.atBottom===O.atBottom))),A=Zt(ce(o,Xn((M,{scrollHeight:O,scrollTop:U,viewportHeight:L})=>{if(!Dg(M.scrollHeight,O)){const V=O-(U+L)<1;return M.scrollTop!==U&&V?{changed:!0,jump:M.scrollTop-U,scrollHeight:O,scrollTop:U}:{changed:!0,jump:0,scrollHeight:O,scrollTop:U}}return{changed:!1,jump:0,scrollHeight:O,scrollTop:U}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ze(M=>M.changed),be(M=>M.jump)),0);Ne(ce(k,be(M=>M.atBottom)),f),Ne(ce(f,va(50)),x);const T=me(bs);Ne(ce(o,be(({scrollTop:M})=>M),ht(),Xn((M,O)=>bt(S)?{direction:M.direction,prevScrollTop:O}:{direction:O<M.prevScrollTop?Es:bs,prevScrollTop:O},{direction:bs,prevScrollTop:0}),be(M=>M.direction)),T),Ne(ce(o,va(50),Kn(sj)),T);const C=me(0);return Ne(ce(j,ze(M=>!M),Kn(0)),C),Ne(ce(d,va(100),Pe(j),ze(([M,O])=>O),Xn(([M,O],[U])=>[O,U],[0,0]),be(([M,O])=>O-M)),C),{atBottomState:k,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:m,atTopThreshold:v,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:A,scrollDirection:T,scrollVelocity:C}},xt(ln)),Ts="top",Rs="bottom",bx="none";function jx(a,r,i){return typeof a=="number"?i===Es&&r===Ts||i===bs&&r===Rs?a:0:i===Es?r===Ts?a.main:a.reverse:r===Rs?a.main:a.reverse}function Sx(a,r){return typeof a=="number"?a:a[r]??0}const Ou=et(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:d}])=>{const p=Xe(),f=me(0),h=me(0),x=me(0),m=Zt(ce(_t(Me(o),Me(d),Me(i),Me(p,Cs),Me(x),Me(f),Me(r),Me(a),Me(h)),be(([y,v,j,[S,k],A,T,C,M,O])=>{const U=y-M,L=T+C,V=Math.max(j-U,0);let w=bx;const D=Sx(O,Ts),E=Sx(O,Rs);return S-=M,S+=j+C,k+=j+C,k-=M,S>y+L-D&&(w=Es),k<y-V+v+E&&(w=bs),w!==bx?[Math.max(U-j-jx(A,Ts,w)-D,0),U-V-C+v+jx(A,Rs,w)+E]:null}),ze(y=>y!==null),ht(Cs)),[0,0]);return{increaseViewportBy:h,listBoundary:p,overscan:x,topListHeight:f,visibleRange:m}},xt(ln),{singleton:!0});function cj(a,r,i){if(vo(r)){const o=Ag(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Fd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ro(a,r,i,o,d,p){const{lastIndex:f,lastOffset:h,lastSize:x}=d;let m=0,y=0;if(a.length>0){m=a[0].offset;const A=a[a.length-1];y=A.offset+A.size}const v=i-f,j=h+v*x+(v-1)*o,S=m,k=j-y;return{bottom:y,firstItemIndex:p,items:kx(a,d,p),offsetBottom:k,offsetTop:m,top:S,topItems:kx(r,d,p),topListHeight:r.reduce((A,T)=>T.size+A,0),totalCount:i}}function _g(a,r,i,o,d,p){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=_u(r,h),m=Array.from({length:h}).map((y,v)=>({data:p[v+x],index:v+x,offset:0,size:0}));return ro(m,[],h,d,i,o)}function kx(a,r,i){if(a.length===0)return[];if(!vo(r))return a.map(m=>({...m,index:m.index+i,originalIndex:m.index}));const o=a[0].index,d=a[a.length-1].index,p=[],f=ur(r.groupOffsetTree,o,d);let h,x=0;for(const m of a){(!h||h.end<m.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;m.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:m.index-(x+1)+i},p.push({...y,data:m.data,offset:m.offset,originalIndex:m.index,size:m.size})}return p}function wx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=et(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:d},p,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:m,scrolledToInitialItem:y},{topListHeight:v},j,{didMount:S},{recalcInProgress:k}])=>{const A=me([]),T=me(0),C=Xe(),M=me(0);Ne(p.topItemsIndexes,A);const O=Zt(ce(_t(S,k,Me(x,Cs),Me(d),Me(o),Me(m),y,Me(A),Me(r),Me(i),Me(M),a),ze(([w,D,,E,,,,,,,,B])=>{const P=B!==void 0&&B.length!==E;return w&&!D&&!P}),be(([,,[w,D],E,B,P,F,te,Q,z,R,I])=>{var Se,De;const Z=B,{offsetTree:q,sizeTree:de}=Z,_=bt(T);if(E===0)return{...Fd,totalCount:E};if(w===0&&D===0)return _===0?{...Fd,totalCount:E}:_g(_,P,B,Q,z,I||[]);if(ut(de))return _>0?null:ro(cj(_u(P,E),Z,I),[],E,z,Z,Q);const W=[];if(te.length>0){const Ie=te[0],ae=te[te.length-1];let pe=0;for(const fe of ur(de,Ie,ae)){const he=fe.value,ve=Math.max(fe.start,Ie),_e=Math.min(fe.end,ae);for(let re=ve;re<=_e;re++)W.push({data:I==null?void 0:I[re],index:re,offset:pe,size:he}),pe+=he}}if(!F)return ro([],W,E,z,Z,Q);const ie=te.length>0?te[te.length-1]+1:0,ue=Q0(q,w,D,ie);if(ue.length===0)return null;const ge=E-1,xe=go([],Ie=>{for(const ae of ue){const pe=ae.value;let fe=pe.offset,he=ae.start;const ve=pe.size;if(pe.offset<w){he+=Math.floor((w-pe.offset+z)/(ve+z));const re=he-ae.start;fe+=re*ve+re*z}he<ie&&(fe+=(ie-he)*ve,he=ie);const _e=Math.min(ae.end,ge);for(let re=he;re<=_e&&!(fe>=D);re++)Ie.push({data:I==null?void 0:I[re],index:re,offset:fe,size:ve}),fe+=ve+z}}),we=wx(R,Ts),oe=wx(R,Rs);if(xe.length>0&&(we>0||oe>0)){const Ie=xe[0],ae=xe[xe.length-1];if(we>0&&Ie.index>ie){const pe=Math.min(we,Ie.index-ie),fe=[];let he=Ie.offset;for(let ve=Ie.index-1;ve>=Ie.index-pe;ve--){const _e=((Se=ur(de,ve,ve)[0])==null?void 0:Se.value)??Ie.size;he-=_e+z,fe.unshift({data:I==null?void 0:I[ve],index:ve,offset:he,size:_e})}xe.unshift(...fe)}if(oe>0&&ae.index<ge){const pe=Math.min(oe,ge-ae.index);let fe=ae.offset+ae.size+z;for(let he=ae.index+1;he<=ae.index+pe;he++){const ve=((De=ur(de,he,he)[0])==null?void 0:De.value)??ae.size;xe.push({data:I==null?void 0:I[he],index:he,offset:fe,size:ve}),fe+=ve+z}}}return ro(xe,W,E,z,Z,Q)}),ze(w=>w!==null),ht()),Fd);Ne(ce(a,ze(Ru),be(w=>w==null?void 0:w.length)),d),Ne(ce(O,be(w=>w.topListHeight)),v),Ne(v,h),Ne(ce(O,be(w=>[w.top,w.bottom])),f),Ne(ce(O,be(w=>w.items)),C);const U=Sn(ce(O,ze(({items:w})=>w.length>0),Pe(d,a),ze(([{items:w},D])=>w[w.length-1].originalIndex===D-1),be(([,w,D])=>[w-1,D]),ht(Cs),be(([w])=>w))),L=Sn(ce(O,va(200),ze(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),be(({items:w})=>w[0].index),ht())),V=Sn(ce(O,ze(({items:w})=>w.length>0),be(({items:w})=>{let D=0,E=w.length-1;for(;w[D].type==="group"&&D<E;)D++;for(;w[E].type==="group"&&E>D;)E--;return{endIndex:w[E].index,startIndex:w[D].index}}),ht(Tg)));return{endReached:U,initialItemCount:T,itemsRendered:C,listState:O,minOverscanItemCount:M,rangeChanged:V,startReached:L,topItemsIndexes:A,...j}},xt(Qn,zg,Ou,Ms,As,zs,Xa,zu),{singleton:!0}),Og=et(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:d}])=>{const p=Xe(),f=Zt(ce(_t(i,a,o,r,d),be(([h,x,m,y,v])=>h+x+m+y+v.offsetBottom+v.bottom)),0);return Ne(Me(f),p),{totalListHeight:f,totalListHeightChanged:p}},xt(ln,Sl),{singleton:!0}),dj=et(([{viewportHeight:a},{totalListHeight:r}])=>{const i=me(!1),o=Zt(ce(_t(i,a,r),ze(([d])=>d),be(([,d,p])=>Math.max(0,d-p)),va(0),ht()),0);return{alignToBottom:i,paddingTopAddition:o}},xt(ln,Og),{singleton:!0}),Bg=et(()=>({context:me(null)})),uj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...d},viewportBottom:p,viewportTop:f})=>r<f?{...d,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>p?{...d,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Ig=et(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:d,headerHeight:p,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:m}])=>{const y=Xe();return Ne(ce(y,Pe(r,x,i,p,d,o,h),Pe(a),be(([[v,j,S,k,A,T,C,M],O])=>{const{calculateViewLocation:U=uj,done:L,...V}=v,w=Mg(v,j,k-1),D=Ns(w,j.offsetTree,O)+A+T,E=D+Gn(j.sizeTree,w)[1],B=M+T,P=M+S-C,F=U({itemBottom:E,itemTop:D,locationParams:V,viewportBottom:P,viewportTop:B});return F!==null?L&&Pn(ce(f,ze(te=>!te),yl(bt(f)?1:2)),L):L==null||L(),F}),ze(v=>v!==null)),m),{scrollIntoView:y}},xt(Qn,ln,As,Sl,Ka),{singleton:!0});function Cx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const fj=(a,r)=>typeof a=="function"?Cx(a(r)):r&&Cx(a),pj=et(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:d,isAtBottom:p},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:m},{log:y},{scrollingInProgress:v},{context:j},{scrollIntoView:S}])=>{const k=me(!1),A=Xe();let T=null;function C(L){Ve(f,{align:"end",behavior:L,index:"LAST"})}nt(ce(_t(ce(Me(r),yl(1)),x),Pe(Me(k),p,h,v),be(([[L,V],w,D,E,B])=>{let P=V&&E,F="auto";return P&&(F=fj(w,D||B),P=P&&F!==!1),{followOutputBehavior:F,shouldFollow:P,totalCount:L}}),ze(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:V})=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L)}):T=Pn(a,()=>{bt(y)("following output to ",{totalCount:V},It.DEBUG),C(L),T=null})});function M(L){const V=Pn(d,w=>{L&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&T===null&&(bt(y)("scrolling to bottom due to increased size",{},It.DEBUG),C("auto"))});setTimeout(V,100)}nt(ce(_t(Me(k),r,m),ze(([L,,V])=>L!==!1&&V),Xn(({value:L},[,V])=>({refreshed:L===V,value:V}),{refreshed:!1,value:0}),ze(({refreshed:L})=>L),Pe(k,r)),([,L])=>{bt(h)&&M(L!==!1)}),nt(A,()=>{M(bt(k)!==!1)}),nt(_t(Me(k),d),([L,V])=>{L!==!1&&!V.atBottom&&V.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&C("auto")});const O=me(null),U=Xe();return Ne(mu(ce(Me(o),be(L=>(L==null?void 0:L.length)??0)),ce(Me(r))),U),nt(ce(_t(ce(U,yl(1)),x),Pe(Me(O),h,v,j),be(([[L,V],w,D,E,B])=>V&&D&&(w==null?void 0:w({context:B,totalCount:L,scrollingInProgress:E}))),ze(L=>!!L),va(0)),L=>{T!==null&&(T(),T=null),bt(i)!==void 0?requestAnimationFrame(()=>{bt(y)("scrolling into view",{}),Ve(S,L)}):T=Pn(a,()=>{bt(y)("scrolling into view",{}),Ve(S,L),T=null})}),{autoscrollToBottom:A,followOutput:k,scrollIntoViewOnChange:O}},xt(Qn,zs,As,Ms,Xa,Ka,ln,Bg,Ig)),mj=et(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:d},{initialItemCount:p,listState:f},{didMount:h}])=>(Ne(ce(h,Pe(p),ze(([,x])=>x!==0),Pe(d,o,r,i,a),be(([[,x],m,y,v,j,S=[]])=>_g(x,m,y,v,j,S))),f),{}),xt(Qn,Ms,Sl,Xa),{singleton:!0}),hj=et(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=me(0);return nt(ce(a,Pe(o),ze(([,d])=>d!==0),be(([,d])=>({top:d}))),d=>{Pn(ce(i,yl(1),ze(p=>p.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(r,d)})})}),{initialScrollTop:o}},xt(Xa,ln,Sl),{singleton:!0}),Hg=et(([{scrollVelocity:a}])=>{const r=me(!1),i=Xe(),o=me(!1);return Ne(ce(a,Pe(o,r,i),ze(([d,p])=>p!==!1&&p!==void 0),be(([d,p,f,h])=>{const{enter:x,exit:m}=p;if(f){if(m(d,h))return!1}else if(x(d,h))return!0;return f}),ht()),r),nt(ce(_t(r,a,i),Pe(o)),([[d,p,f],h])=>{d&&h!==!1&&h!==void 0&&h.change&&h.change(p,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},xt(zs),{singleton:!0}),Bu=et(([{scrollContainerState:a,scrollTo:r}])=>{const i=Xe(),o=Xe(),d=Xe(),p=me(!1),f=me(void 0);return Ne(ce(_t(i,o),be(([{scrollTop:h,viewportHeight:x},{offsetTop:m,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-m),viewportHeight:x}))),a),Ne(ce(r,Pe(o),be(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),d),{customScrollParent:f,useWindowScroll:p,windowScrollContainerState:i,windowScrollTo:d,windowViewportRect:o}},xt(ln)),xj=et(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:d},{didMount:p},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const m=Xe(),y=me(void 0),v=me(null),j=me(null);return Ne(h,v),Ne(x,j),nt(ce(m,Pe(r,o,f,v,j,i)),([S,k,A,T,C,M,O])=>{const U=J0(k.sizeTree);T&&C!==null&&M!==null&&(A=C.scrollTop-M.offsetTop),A-=O,S({ranges:U,scrollTop:A})}),Ne(ce(y,ze(Ru),be(gj)),d),Ne(ce(p,Pe(y),ze(([,S])=>S!==void 0),ht(),be(([,S])=>S.ranges)),a),{getState:m,restoreStateFrom:y}},xt(Qn,ln,Ms,Xa,Bu));function gj(a){return{align:"start",index:0,offset:a.scrollTop}}const vj=et(([{topItemsIndexes:a}])=>{const r=me(0);return Ne(ce(r,ze(i=>i>=0),be(i=>Array.from({length:i}).map((o,d)=>d))),a),{topItemCount:r}},xt(Sl));function Ug(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const yj=Ug(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),bj=et(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:d,isScrolling:p,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:m,gap:y,shiftWithOffset:v,sizes:j},{log:S},{recalcInProgress:k}])=>{const A=Sn(ce(x,Pe(f),Xn(([,C,M,O],[{bottom:U,items:L,offsetBottom:V,totalCount:w},D])=>{const E=U+V;let B=0;return M===w&&C.length>0&&L.length>0&&(L[0].originalIndex===0&&C[0].originalIndex===0||(B=E-O,B!==0&&(B+=D))),[B,L,w,E]},[0,[],0,0]),ze(([C])=>C!==0),Pe(o,h,i,d,S,k),ze(([,C,M,O,,,U])=>!U&&!O&&C!==0&&M===Es),be(([[C],,,,,M])=>(M("Upward scrolling compensation",{amount:C},It.DEBUG),C))));function T(C){C>0?(Ve(r,{behavior:"auto",top:-C}),Ve(a,0)):(Ve(a,0),Ve(r,{behavior:"auto",top:-C}))}return nt(ce(A,Pe(a,p)),([C,M,O])=>{O&&yj()?Ve(a,M-C):T(-C)}),nt(ce(_t(Zt(p,!1),a,k),ze(([C,M,O])=>!C&&!O&&M!==0),be(([C,M])=>M),va(1)),T),Ne(ce(v,be(C=>({top:-C}))),r),nt(ce(m,Pe(j,y),be(([C,{groupIndices:M,lastSize:O,sizeTree:U},L])=>{function V(P){return P*(O+L)}if(M.length===0)return V(C);let w=0;const D=ws(U,0);let E=0,B=0;for(;E<C;){E++,w+=D;let P=M.length===B+1?1/0:M[B+1]-M[B]-1;E+P>C&&(w-=D,P=C-E+1),E+=P,w+=V(P),B++}return w})),C=>{Ve(a,C),requestAnimationFrame(()=>{Ve(r,{top:C}),requestAnimationFrame(()=>{Ve(a,0),Ve(k,!1)})})}),{deviation:a}},xt(ln,zs,Sl,Qn,Ka,zu)),jj=et(([a,r,i,o,d,p,f,h,x,m,y])=>({...a,...r,...i,...o,...d,...p,...f,...h,...x,...m,...y}),xt(Ou,mj,Xa,Hg,Og,hj,dj,Bu,Ig,Ka,Bg)),Vg=et(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:d,gap:p,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:m,sizes:y,statefulTotalCount:v,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T},C,M,O,U,{scrollToIndex:L},V,{topItemCount:w},{groupCounts:D},E])=>{const{listState:B,minOverscanItemCount:P,topItemsIndexes:F,rangeChanged:te,...Q}=U;return Ne(te,E.scrollSeekRangeChanged),Ne(ce(E.windowViewportRect,be(z=>z.visibleHeight)),C.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:d,gap:p,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:A,scrolledToInitialItem:T,sizeRanges:m,topItemCount:w,topItemsIndexes:F,totalCount:j,...O,groupIndices:f,itemSize:x,listState:B,minOverscanItemCount:P,scrollToIndex:L,statefulTotalCount:v,trackItemSizes:S,rangeChanged:te,...Q,...E,...C,sizes:y,...M}},xt(Qn,Ms,ln,xj,pj,Sl,As,bj,vj,zg,jj));function Sj(a,r){const i={},o={};let d=0;const p=a.length;for(;d<p;)o[a[d]]=1,d+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Yi=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function $g(a,r,i){const o=Object.keys(r.required||{}),d=Object.keys(r.optional||{}),p=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=Ce.createContext({});function x(T,C){T.propsReady!==void 0&&Ve(T.propsReady,!1);for(const M of o){const O=T[r.required[M]];Ve(O,C[M])}for(const M of d)if(M in C){const O=T[r.optional[M]];Ve(O,C[M])}T.propsReady!==void 0&&Ve(T.propsReady,!0)}function m(T){return p.reduce((C,M)=>(C[M]=O=>{const U=T[r.methods[M]];Ve(U,O)},C),{})}function y(T){return f.reduce((C,M)=>(C[M]=I0(T[r.events[M]]),C),{})}const v=Ce.forwardRef(function(T,C){const{children:M,...O}=T,[U]=Ce.useState(()=>go(U0(a),w=>{x(w,O)})),[L]=Ce.useState(hx(y,U));Yi(()=>{for(const w of f)w in O&&nt(L[w],O[w]);return()=>{Object.values(L).map(Au)}},[O,L,U]),Yi(()=>{x(U,O)}),Ce.useImperativeHandle(C,mx(m(U)));const V=i;return n.jsx(h.Provider,{value:U,children:i!==void 0?n.jsx(V,{...Sj([...o,...d,...f],O),children:M}):M})}),j=T=>{const C=Ce.useContext(h);return Ce.useCallback(M=>{Ve(C[T],M)},[C,T])},S=T=>{const C=Ce.useContext(h)[T],M=Ce.useCallback(O=>nt(C,O),[C]);return Ce.useSyncExternalStore(M,()=>bt(C),()=>bt(C))},k=T=>{const C=Ce.useContext(h)[T],[M,O]=Ce.useState(hx(bt,C));return Yi(()=>nt(C,U=>{U!==M&&O(mx(U))}),[C,M]),M},A=parseInt(Ce.version)>=18?S:k;return{Component:v,useEmitter:(T,C)=>{const M=Ce.useContext(h)[T];Yi(()=>nt(M,C),[C,M])},useEmitterValue:A,usePublisher:j}}const Pg=Ce.createContext(void 0),Gg=Ce.createContext(void 0),qd="-webkit-sticky",Nx="sticky",Iu=Ug(()=>{if(typeof document>"u")return Nx;const a=document.createElement("div");return a.style.position=qd,a.style.position===qd?qd:Nx}),Fg=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function Yd(a){return"self"in a}function kj(a){return"body"in a}function qg(a,r,i,o=vr,d,p){const f=Ce.useRef(null),h=Ce.useRef(null),x=Ce.useRef(null),m=Ce.useCallback(j=>{let S,k,A;const T=j.target;if(kj(T)||Yd(T)){const M=Yd(T)?T:T.defaultView;A=p===!0?M.scrollX:M.scrollY,S=p===!0?M.document.documentElement.scrollWidth:M.document.documentElement.scrollHeight,k=p===!0?M.innerWidth:M.innerHeight}else A=p===!0?T.scrollLeft:T.scrollTop,S=p===!0?T.scrollWidth:T.scrollHeight,k=p===!0?T.offsetWidth:T.offsetHeight;const C=()=>{a({scrollHeight:S,scrollTop:Math.max(A,0),viewportHeight:k})};j.suppressFlushSync===!0?C():bb.flushSync(C),h.current!==null&&(A===h.current||A<=0||A===S-k)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,p]);Ce.useEffect(()=>{const j=d||f.current;return o(d||f.current),m({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",m,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",m)}},[f,m,i,o,d]);function y(j){const S=f.current;if(!S||(p===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const k=j.behavior==="smooth";let A,T,C;Yd(S)?(T=Math.max(Ya(S.document.documentElement,p===!0?"width":"height"),p===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),A=p===!0?S.innerWidth:S.innerHeight,C=p===!0?window.scrollX:window.scrollY):(T=S[p===!0?"scrollWidth":"scrollHeight"],A=Ya(S,p===!0?"width":"height"),C=S[p===!0?"scrollLeft":"scrollTop"]);const M=T-A;if(j.top=Math.ceil(Math.max(Math.min(M,j.top),0)),Dg(A,T)||j.top===C){a({scrollHeight:T,scrollTop:C,viewportHeight:A}),k&&r(!0);return}k?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.current=null,p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function v(j){p===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:v,scrollerRef:f,scrollToCallback:y}}function Hu(a){return a}const wj=et(()=>{const a=me(h=>`Item ${h}`),r=me(h=>`Group ${h}`),i=me({}),o=me(Hu),d=me("div"),p=me(vr),f=(h,x=null)=>Zt(ce(i,be(m=>m[h]),ht()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:d,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:p,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),Cj=et(([a,r])=>({...a,...r}),xt(Vg,wj)),Nj=({height:a})=>n.jsx("div",{style:{height:a}}),Ej={overflowAnchor:"none",position:Iu(),zIndex:1},Yg={overflowAnchor:"none"},Tj={...Yg,display:"inline-block",height:"100%"},Ex=Ce.memo(function({showTopList:a=!1}){const r=Be("listState"),i=On("sizeRanges"),o=Be("useWindowScroll"),d=Be("customScrollParent"),p=On("windowScrollContainerState"),f=On("scrollContainerState"),h=d||o?p:f,x=Be("itemContent"),m=Be("context"),y=Be("groupContent"),v=Be("trackItemSizes"),j=Be("itemSize"),S=Be("log"),k=On("gap"),A=Be("horizontalDirection"),{callbackRef:T}=P0(i,j,v,a?vr:h,S,k,d,A,Be("skipAnimationFrameInResizeObserver")),[C,M]=Ce.useState(0);Uu("deviation",Q=>{C!==Q&&M(Q)});const O=Be("EmptyPlaceholder"),U=Be("ScrollSeekPlaceholder")??Nj,L=Be("ListComponent"),V=Be("ItemComponent"),w=Be("GroupComponent"),D=Be("computeItemKey"),E=Be("isSeeking"),B=Be("groupIndices").length>0,P=Be("alignToBottom"),F=Be("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...A?{display:"inline-block",height:"100%",marginLeft:C!==0?C:P?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:C!==0?C:P?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...F?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&O!==null&&O!==void 0?n.jsx(O,{...Qt(O,m)}):n.jsx(L,{...Qt(L,m),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:T,style:te,children:(a?r.topItems:r.items).map(Q=>{const z=Q.originalIndex,R=D(z+r.firstItemIndex,Q.data,m);return E?g.createElement(U,{...Qt(U,m),height:Q.size,index:Q.index,key:R,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?g.createElement(w,{...Qt(w,m),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:Ej},y(Q.index,m)):g.createElement(V,{...Qt(V,m),...zj(V,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:R,style:A?Tj:Yg},B?x(Q.index,Q.groupIndex,Q.data,m):x(Q.index,Q.data,m))})})}),Rj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Aj={outline:"none",overflowX:"auto",position:"relative"},yo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Mj={position:Iu(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function zj(a,r){return{item:typeof a=="string"?void 0:r}}const Lj=Ce.memo(function(){const a=Be("HeaderComponent"),r=On("headerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Dj=Ce.memo(function(){const a=Be("FooterComponent"),r=On("footerHeight"),i=Be("HeaderFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,Be("skipAnimationFrameInResizeObserver")),d=Be("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null});function Wg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("scrollerRef"),v=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:k}=qg(h,m,x,y,void 0,v);return a("scrollTo",k),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...v?Aj:Rj,...d},tabIndex:0,...f,...Qt(x,p),children:o})})}function Kg({useEmitter:a,useEmitterValue:r,usePublisher:i}){return Ce.memo(function({children:o,style:d,context:p,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),m=i("smoothScrollTargetReached"),y=r("totalListHeight"),v=r("deviation"),j=r("customScrollParent"),S=Ce.useRef(null),k=r("scrollerRef"),{scrollByCallback:A,scrollerRef:T,scrollToCallback:C}=qg(h,m,x,k,j);return Fg(()=>{var M;return T.current=j||((M=S.current)==null?void 0:M.ownerDocument.defaultView),()=>{T.current=null}},[T,j]),a("windowScrollTo",C),a("scrollBy",A),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...d,...y!==0?{height:y+v}:void 0},...f,...Qt(x,p),children:o})})}const _j=({children:a})=>{const r=Ce.useContext(Pg),i=On("viewportHeight"),o=On("fixedItemHeight"),d=Be("alignToBottom"),p=Be("horizontalDirection"),f=Ce.useMemo(()=>bg(i,x=>Ya(x,p?"width":"height")),[i,p]),h=jl(f,!0,Be("skipAnimationFrameInResizeObserver"));return Ce.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:yo(d),children:a})},Oj=({children:a})=>{const r=Ce.useContext(Pg),i=On("windowViewportRect"),o=On("fixedItemHeight"),d=Be("customScrollParent"),p=Sg(i,d,Be("skipAnimationFrameInResizeObserver")),f=Be("alignToBottom");return Ce.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:p,style:yo(f),children:a})},Bj=({children:a})=>{const r=Be("TopItemListComponent")??"div",i=Be("headerHeight"),o={...Mj,marginTop:`${i}px`},d=Be("context");return n.jsx(r,{style:o,...Qt(r,d),children:a})},Ij=Ce.memo(function(a){const r=Be("useWindowScroll"),i=Be("topItemsIndexes").length>0,o=Be("customScrollParent"),d=Be("context");return n.jsxs(o||r?Vj:Uj,{...a,context:d,children:[i&&n.jsx(Bj,{children:n.jsx(Ex,{showTopList:!0})}),n.jsxs(o||r?Oj:_j,{children:[n.jsx(Lj,{}),n.jsx(Ex,{}),n.jsx(Dj,{})]})]})}),{Component:Hj,useEmitter:Uu,useEmitterValue:Be,usePublisher:On}=$g(Cj,{optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ij),Uj=Wg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),Vj=Kg({useEmitter:Uu,useEmitterValue:Be,usePublisher:On}),$j=Hj,Pj=et(()=>{const a=me(m=>n.jsxs("td",{children:["Item $",m]})),r=me(null),i=me(m=>n.jsxs("td",{colSpan:1e3,children:["Group ",m]})),o=me(null),d=me(null),p=me({}),f=me(Hu),h=me(vr),x=(m,y=null)=>Zt(ce(p,be(v=>v[m]),ht()),y);return{components:p,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:d,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});xt(Vg,Pj);Iu();const Tx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},Gj={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Rx,floor:co,max:js,min:Wd,round:Ax}=Math;function Mx(a,r,i){return Array.from({length:r-a+1}).map((o,d)=>({data:i===null?null:i[d+a],index:d+a}))}function Fj(a){return{...Gj,items:a}}function Wi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function qj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Yj=et(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:d,headerHeight:p,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:m,smoothScrollTargetReached:y,viewportHeight:v},j,S,{didMount:k,propsReady:A},{customScrollParent:T,useWindowScroll:C,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U},L])=>{const V=me(0),w=me(0),D=me(Tx),E=me({height:0,width:0}),B=me({height:0,width:0}),P=Xe(),F=Xe(),te=me(0),Q=me(null),z=me({column:0,row:0}),R=Xe(),I=Xe(),Z=me(!1),q=me(0),de=me(!0),_=me(!1),W=me(!1);nt(ce(k,Pe(q),ze(([oe,Se])=>Se!==0)),()=>{Ve(de,!1)}),nt(ce(_t(k,de,B,E,q,_),ze(([oe,Se,De,Ie,,ae])=>oe&&!Se&&De.height!==0&&Ie.height!==0&&!ae)),([,,,,oe])=>{Ve(_,!0),Du(1,()=>{Ve(P,oe)}),Pn(ce(m),()=>{Ve(r,[0,0]),Ve(de,!0)})}),Ne(ce(I,ze(oe=>oe!=null&&oe.scrollTop>0),Kn(0)),w),nt(ce(k,Pe(I),ze(([,oe])=>oe!=null)),([,oe])=>{oe&&(Ve(E,oe.viewport),Ve(B,oe.item),Ve(z,oe.gap),oe.scrollTop>0&&(Ve(Z,!0),Pn(ce(m,yl(1)),Se=>{Ve(Z,!1)}),Ve(x,{top:oe.scrollTop})))}),Ne(ce(E,be(({height:oe})=>oe)),v),Ne(ce(_t(Me(E,Wi),Me(B,Wi),Me(z,(oe,Se)=>oe!==void 0&&oe.column===Se.column&&oe.row===Se.row),Me(m)),be(([oe,Se,De,Ie])=>({gap:De,item:Se,scrollTop:Ie,viewport:oe}))),R),Ne(ce(_t(Me(V),o,Me(z,qj),Me(B,Wi),Me(E,Wi),Me(Q),Me(w),Me(Z),Me(de),Me(q)),ze(([,,,,,,,oe])=>!oe),be(([oe,[Se,De],Ie,ae,pe,fe,he,,ve,_e])=>{const{column:re,row:Te}=Ie,{height:Qe,width:at}=ae,{width:$t}=pe;if(he===0&&(oe===0||$t===0))return Tx;if(at===0){const rt=_u(_e,oe),Qa=rt+Math.max(he-1,0);return Fj(Mx(rt,Qa,fe))}const Pt=Xg($t,at,re);let lt,St;ve?Se===0&&De===0&&he>0?(lt=0,St=he-1):(lt=Pt*co((Se+Te)/(Qe+Te)),St=Pt*Rx((De+Te)/(Qe+Te))-1,St=Wd(oe-1,js(St,Pt-1)),lt=Wd(St,js(0,lt))):(lt=0,St=-1);const ye=Mx(lt,St,fe),{bottom:At,top:Le}=zx(pe,Ie,ae,ye),gt=Rx(oe/Pt),Kt=gt*Qe+(gt-1)*Te-At;return{bottom:At,itemHeight:Qe,items:ye,itemWidth:at,offsetBottom:Kt,offsetTop:Le,top:Le}})),D),Ne(ce(Q,ze(oe=>oe!==null),be(oe=>oe.length)),V),Ne(ce(_t(E,B,D,z),ze(([oe,Se,{items:De}])=>De.length>0&&Se.height!==0&&oe.height!==0),be(([oe,Se,{items:De},Ie])=>{const{bottom:ae,top:pe}=zx(oe,Ie,Se,De);return[pe,ae]}),ht(Cs)),r);const ie=me(!1);Ne(ce(m,Pe(ie),be(([oe,Se])=>Se||oe!==0)),ie);const ue=Sn(ce(_t(D,V),ze(([{items:oe}])=>oe.length>0),Pe(ie),ze(([[oe,Se],De])=>{const Ie=oe.items[oe.items.length-1].index===Se-1;return(De||oe.bottom>0&&oe.itemHeight>0&&oe.offsetBottom===0&&oe.items.length===Se)&&Ie}),be(([[,oe]])=>oe-1),ht())),ge=Sn(ce(Me(D),ze(({items:oe})=>oe.length>0&&oe[0].index===0),Kn(0),ht())),xe=Sn(ce(Me(D),Pe(Z),ze(([{items:oe},Se])=>oe.length>0&&!Se),be(([{items:oe}])=>({endIndex:oe[oe.length-1].index,startIndex:oe[0].index})),ht(Tg),va(0)));Ne(xe,S.scrollSeekRangeChanged),Ne(ce(P,Pe(E,B,V,z),be(([oe,Se,De,Ie,ae])=>{const pe=Lg(oe),{align:fe,behavior:he,offset:ve}=pe;let _e=pe.index;_e==="LAST"&&(_e=Ie-1),_e=js(0,_e,Wd(Ie-1,_e));let re=yu(Se,ae,De,_e);return fe==="end"?re=Ax(re-Se.height+De.height):fe==="center"&&(re=Ax(re-Se.height/2+De.height/2)),ve!==void 0&&ve!==0&&(re+=ve),{behavior:he,top:re}})),x);const we=Zt(ce(D,be(oe=>oe.offsetBottom+oe.bottom)),0);return Ne(ce(U,be(oe=>({height:oe.visibleHeight,width:oe.visibleWidth}))),E),{customScrollParent:T,data:Q,deviation:te,footerHeight:d,gap:z,headerHeight:p,increaseViewportBy:a,initialItemCount:w,itemDimensions:B,overscan:i,restoreStateFrom:I,scrollBy:f,scrollContainerState:h,scrollHeight:F,scrollTo:x,scrollToIndex:P,scrollTop:m,smoothScrollTargetReached:y,totalCount:V,useWindowScroll:C,viewportDimensions:E,windowScrollContainerState:M,windowScrollTo:O,windowViewportRect:U,...S,gridState:D,horizontalDirection:W,initialTopMostItemIndex:q,totalListHeight:we,...j,endReached:ue,propsReady:A,rangeChanged:xe,startReached:ge,stateChanged:R,stateRestoreInProgress:Z,...L}},xt(Ou,ln,zs,Hg,Xa,Bu,Ka));function Xg(a,r,i){return js(1,co((a+i)/(co(r)+i)))}function zx(a,r,i,o){const{height:d}=i;if(d===void 0||o.length===0)return{bottom:0,top:0};const p=yu(a,r,i,o[0].index);return{bottom:yu(a,r,i,o[o.length-1].index)+d,top:p}}function yu(a,r,i,o){const d=Xg(a.width,i.width,r.column),p=co(o/d),f=p*i.height+js(0,p-1)*r.row;return f>0?f+r.row:f}const Wj=et(()=>{const a=me(v=>`Item ${v}`),r=me({}),i=me(null),o=me("virtuoso-grid-item"),d=me("virtuoso-grid-list"),p=me(Hu),f=me("div"),h=me(vr),x=(v,j=null)=>Zt(ce(r,be(S=>S[v]),ht()),j),m=me(!1),y=me(!1);return Ne(Me(y),m),{components:r,computeItemKey:p,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:d,ListComponent:x("List","div"),readyStateChanged:m,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Kj=et(([a,r])=>({...a,...r}),xt(Yj,Wj)),Xj=Ce.memo(function(){const a=yt("gridState"),r=yt("listClassName"),i=yt("itemClassName"),o=yt("itemContent"),d=yt("computeItemKey"),p=yt("isSeeking"),f=Bn("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),m=yt("ScrollSeekPlaceholder"),y=yt("context"),v=Bn("itemDimensions"),j=Bn("gap"),S=yt("log"),k=yt("stateRestoreInProgress"),A=Bn("reportReadyState"),T=jl(Ce.useMemo(()=>C=>{const M=C.parentElement.parentElement.scrollHeight;f(M);const O=C.firstChild;if(O!==null){const{height:U,width:L}=O.getBoundingClientRect();v({height:U,width:L})}j({column:Lx("column-gap",getComputedStyle(C).columnGap,S),row:Lx("row-gap",getComputedStyle(C).rowGap,S)})},[f,v,j,S]),!0,!1);return Fg(()=>{a.itemHeight>0&&a.itemWidth>0&&A(!0)},[a]),k?null:n.jsx(x,{className:r,ref:T,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(C=>{const M=d(C.index,C.data,y);return p?n.jsx(m,{...Qt(m,y),height:a.itemHeight,index:C.index,width:a.itemWidth},M):g.createElement(h,{...Qt(h,y),className:i,"data-index":C.index,key:M},o(C.index,C.data,y))})})}),Qj=Ce.memo(function(){const a=yt("HeaderComponent"),r=Bn("headerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Zj=Ce.memo(function(){const a=yt("FooterComponent"),r=Bn("footerHeight"),i=yt("headerFooterTag"),o=jl(Ce.useMemo(()=>p=>{r(Ya(p,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,d)})}):null}),Jj=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("itemDimensions"),o=Bn("viewportDimensions"),d=jl(Ce.useMemo(()=>p=>{o(p.getBoundingClientRect())},[o]),!0,!1);return Ce.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:d,style:yo(!1),children:a})},e2=({children:a})=>{const r=Ce.useContext(Gg),i=Bn("windowViewportRect"),o=Bn("itemDimensions"),d=yt("customScrollParent"),p=Sg(i,d,!1);return Ce.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:p,style:yo(!1),children:a})},t2=Ce.memo(function({...a}){const r=yt("useWindowScroll"),i=yt("customScrollParent"),o=i||r?a2:n2,d=i||r?e2:Jj,p=yt("context");return n.jsx(o,{...a,...Qt(o,p),children:n.jsxs(d,{children:[n.jsx(Qj,{}),n.jsx(Xj,{}),n.jsx(Zj,{})]})})}),{useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}=$g(Kj,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},t2),n2=Wg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn}),a2=Kg({useEmitter:Qg,useEmitterValue:yt,usePublisher:Bn});function Lx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,It.WARN),r==="normal"?0:parseInt(r??"0",10)}const l2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Zg={source:"Own",installed:"Installed"};function r2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function s2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Dx({origin:a,count:r,filteredCount:i,updateCount:o,children:d}){const p=l2[a],[f,h]=g.useState(()=>r2(p)),x=g.useCallback(()=>{h(j=>{const S=!j;return s2(p,S),S})},[p]),m=Zg[a],y=`sidebar-section-${a}-header`,v=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":v,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(o2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:m}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(i2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:d})]})}function i2({origin:a,updateCount:r}){const[i,o]=g.useState(!1),d=Zg[a].toLowerCase(),p=`${r} updates available in ${d} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":p,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function o2({collapsed:a}){return n.jsx("svg",{"aria-hidden":"true",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Vu(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function c2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:d="Invalid filter expression"}){const p=g.useRef(null),f=g.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return g.useEffect(()=>{function x(m){var j;if(m.key!=="/")return;const y=m.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(m.preventDefault(),(j=p.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:p,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:d}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function d2({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.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 u2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function f2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const d=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?p=>{p.preventDefault(),o(p,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true","aria-label":a.updateAvailable?"Update available":void 0,title:a.updateAvailable?`Update available${a.latestVersion?` → ${a.latestVersion}`:""}`:void 0,style:{width:a.updateAvailable?10:6,height:a.updateAvailable?10:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0,boxShadow:a.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(d2,{target:a.symlinkTarget??null}),n.jsx(u2,{skill:a})]})}const uo=g.memo(f2);function p2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:d}){const p=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:p.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(uo,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:d})},`${f.plugin}/${f.skill}`)})})]})}function m2(a,r){if(!a||typeof window>"u")return r;try{const i=window.localStorage.getItem(a);return i===null?r:i==="true"}catch{return r}}function _x({skills:a,pluginName:r,initialCollapsed:i=!1,persistKey:o,renderSkill:d,headerActionSlot:p}){var v;const f=r??((v=a[0])==null?void 0:v.pluginName)??"unknown-plugin",[h,x]=g.useState(()=>m2(o,i)),m=g.useCallback(()=>{x(j=>{const S=!j;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(S))}catch{}return S})},[o]),y=h?"▸":"▾";return n.jsxs("div",{"data-vskill-plugin-tree":f,role:"group","aria-label":`${f} (${a.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[n.jsxs("button",{type:"button",onClick:m,"aria-expanded":!h,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[n.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:y}),n.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:f}),n.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",a.length,")"]})]}),p&&n.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:p})]}),!h&&n.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:a.map(j=>n.jsx("div",{"data-vskill-plugin-skill":j.pluginNamespace??j.skill,children:d(j)},`${j.pluginNamespace??j.skill}`))})]})}function h2({pluginName:a,enabled:r,onAfterAction:i}){const[o,d]=g.useState(!1),[p,f]=g.useState(null),[h,x]=g.useState(null),m=g.useRef(null);g.useEffect(()=>{if(!o)return;function v(j){m.current&&!m.current.contains(j.target)&&d(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){f(v),x(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${a}? This removes the plugin and its skills.`)){f(null);return}const j=await fetch(`/api/plugins/${encodeURIComponent(a)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),S=await j.json().catch(()=>({}));if(!j.ok||!S.ok){x(S.error??`${v} failed (${j.status})`);return}an("skills"),an("plugins"),i==null||i(),d(!1)}catch(j){x(j instanceof Error?j.message:String(j))}finally{f(null)}}return n.jsxs("div",{ref:m,style:{position:"relative",display:"inline-flex"},children:[n.jsx("button",{type:"button","aria-label":`Manage ${a}`,title:`Manage ${a}`,onClick:v=>{v.stopPropagation(),d(j=>!j)},"data-vskill-plugin-action-trigger":a,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)",v.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)",v.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&n.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[r?n.jsx(Kd,{onClick:()=>void y("disable"),disabled:p!==null,busy:p==="disable",label:"Disable",hint:"Keep installed, turn off"}):n.jsx(Kd,{onClick:()=>void y("enable"),disabled:p!==null,busy:p==="enable",label:"Enable",hint:"Activate plugin"}),n.jsx(Kd,{onClick:()=>void y("uninstall"),disabled:p!==null,busy:p==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&n.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]})]})}function Kd({onClick:a,disabled:r,busy:i,label:o,hint:d,danger:p}){return n.jsxs("button",{type:"button",onClick:f=>{f.stopPropagation(),a()},disabled:r,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:r?"not-allowed":"pointer",color:p?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:r&&!i?.5:1,fontFamily:"inherit"},onMouseEnter:f=>{r||(f.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:12,fontWeight:500},children:i?`${o}…`:o}),n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:d})]})}function Ox({name:a,count:r,className:i,variant:o,collapsed:d,onToggle:p,action:f}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",m=typeof p=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:m?"pointer":"default",border:"none",textAlign:"left"},v=d?"▸":"▾",j=n.jsxs(n.Fragment,{children:[m&&n.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:h,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",r,")"]}),f&&n.jsx("span",{style:{marginLeft:"auto"},children:n.jsx(x2,{label:f.label,title:f.title,icon:f.icon,onClick:f.onClick,accent:h})})]});return m?n.jsx("button",{type:"button","data-vskill-group-header":a,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,onClick:()=>p(!d),"aria-expanded":!d,children:j}):n.jsx("div",{"data-vskill-group-header":a,role:"heading","aria-level":3,className:["vskill-group-header select-none",i??""].join(" ").trim(),style:y,children:j})}function x2({label:a,title:r,icon:i,onClick:o,accent:d}){return n.jsxs("button",{type:"button","aria-label":a,title:r??a,onClick:p=>{p.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${d}`,background:"transparent",color:d,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:p=>{p.currentTarget.style.background=`color-mix(in oklch, ${d} 15%, transparent)`},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children:[i,a]})}function g2(){return n.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[n.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),n.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function v2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,d=!!a.shift,p=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?d=!0:(x==="alt"||x==="option")&&(p=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:d,alt:p,allowInInputs:!!a.allowInInputs,handler:a.handler}}function y2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function b2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,d=!!a.shiftKey,p=!!a.altKey;return i!==r.meta||o!==r.ctrl||d!==r.shift||p!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function bu(a,r={}){const{enabled:i=!0,target:o}=r,d=g.useRef([]),p=Array.isArray(a)?a:[a];d.current=p.map(v2),g.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const m=x,y=y2(m.target);for(const v of d.current){if(!b2(m,v))continue;const j=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!j)){v.handler(m);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const j2=200;function S2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function k2(a,r){const i={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const d of a){const p=d.scopeV2??(d.scope==="installed"?"available-project":d.scope==="global"?"available-personal":"authoring-project");p==="available-project"?i.availableProject.push(d):p==="available-personal"?i.availablePersonal.push(d):p==="available-plugin"?i.availablePlugin.push(d):p==="authoring-plugin"?i.authoringPlugin.push(d):i.authoringProject.push(d)}function o(d){const p=d.filter(x=>Vu(x,r)),f={};for(const x of p){const m=x.pluginName??x.plugin;(f[m]||(f[m]=[])).push(x)}const h=Object.entries(f).sort((x,m)=>x[0].localeCompare(m[0]));return{total:d.length,filtered:p.length,byPlugin:h}}return{availableProject:o(i.availableProject),availablePersonal:o(i.availablePersonal),availablePlugin:o(i.availablePlugin),authoringProject:o(i.authoringProject),authoringPlugin:o(i.authoringPlugin)}}function w2(a,r){const i=[],o=[],d=[];for(const f of a){const h=S2(f);h==="global"?d.push(f):h==="installed"?o.push(f):i.push(f)}function p(f){var y;const h=f.filter(v=>Vu(v,r)),x={};for(const v of h)(x[y=v.plugin]||(x[y]=[])).push(v);const m=Object.entries(x).sort((v,j)=>v[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:m}}return{own:p(i),installed:p(o),global:p(d)}}function C2(a,r){const i=[],o=[];for(const p of a)(p.origin==="installed"?o:i).push(p);function d(p){var m;const f=p.filter(y=>Vu(y,r)),h={};for(const y of f)(h[m=y.plugin]||(h[m]=[])).push(y);const x=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:p.length,filtered:f.length,byPlugin:x}}return{own:d(i),installed:d(o)}}function N2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:d,onRetry:p,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:m,topSlot:y}){const v=!!x||a.some(Z=>Z.scope!==void 0&&Z.scope!==null),j=x??"claude-cli",[S,k]=g.useState(""),A=g.useDeferredValue(S),T=g.useMemo(()=>w2(a,A),[a,A]),C=g.useMemo(()=>k2(a,A),[a,A]),M=j==="claude-code",{data:O}=xr("plugins",()=>fetch("/api/plugins").then(Z=>Z.json()),{enabled:M,ttl:6e4}),U=g.useMemo(()=>{const Z=new Map;for(const q of(O==null?void 0:O.plugins)??[]){const de=Z.get(q.name);Z.set(q.name,!!de||!!q.enabled)}return Z},[O==null?void 0:O.plugins]),[L,V]=g.useState(()=>ju(`vskill-sidebar-${j}-group-available-collapsed`)),[w,D]=g.useState(()=>ju(`vskill-sidebar-${j}-group-authoring-collapsed`)),E=g.useCallback(Z=>{V(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-available-collapsed`,String(Z))}catch{}},[j]),B=g.useCallback(Z=>{D(Z);try{window.localStorage.setItem(`vskill-sidebar-${j}-group-authoring-collapsed`,String(Z))}catch{}},[j]),{own:P,installed:F}=g.useMemo(()=>C2(a,A),[a,A]),Q=T.own.filtered+T.installed.filtered+T.global.filtered>=j2,z=g.useMemo(()=>{const Z=q=>{const de=[];for(const[,_]of q){const W=[..._].sort((ie,ue)=>ie.skill.localeCompare(ue.skill));de.push(...W)}return de};return v?[...Z(T.own.byPlugin),...Z(T.installed.byPlugin),...Z(T.global.byPlugin)]:[...Z(P.byPlugin),...Z(F.byPlugin)]},[v,T.own.byPlugin,T.installed.byPlugin,T.global.byPlugin,P.byPlugin,F.byPlugin]),R=g.useMemo(()=>r?z.findIndex(Z=>Z.plugin===r.plugin&&Z.skill===r.skill):-1,[z,r]),I=g.useCallback(Z=>{if(z.length===0)return;const q=R<0?Z>0?0:z.length-1:Math.min(Math.max(R+Z,0),z.length-1);i(z[q])},[z,R,i]);return bu([{key:"j",handler:()=>I(1)},{key:"k",handler:()=>I(-1)},{key:"Enter",handler:()=>{R>=0&&i(z[R])}}],{enabled:!o&&!d}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(c2,{value:S,onChange:k}),o&&n.jsx(M2,{}),!o&&d&&n.jsx(z2,{error:d,onRetry:p}),!o&&!d&&v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ox,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:L,onToggle:E,count:C.availableProject.total+C.availablePersonal.total+C.availablePlugin.total}),!L&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${j}-available-project-collapsed`,count:C.availableProject.total,filteredCount:S?C.availableProject.filtered:null,updateCount:(m==null?void 0:m.installed)??(h==null?void 0:h.installed),children:C.availableProject.filtered===0?n.jsx(Ix,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availableProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(ms,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${j}-available-personal-collapsed`,count:C.availablePersonal.total,filteredCount:S?C.availablePersonal.filtered:null,updateCount:m==null?void 0:m.global,children:C.availablePersonal.filtered===0?n.jsx(T2,{queryActive:!!S,agentId:j}):n.jsx(hs,{items:C.availablePersonal.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsxs(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-available-plugin-collapsed`,count:C.availablePlugin.total,filteredCount:S?C.availablePlugin.filtered:null,children:[n.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[n.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),C.availablePlugin.filtered===0?n.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):C.availablePlugin.byPlugin.map(([Z,q])=>n.jsx(_x,{pluginName:Z,skills:q,persistKey:`vskill-plugin-available-${Z}-collapsed`,headerActionSlot:M?n.jsx(h2,{pluginName:Z,enabled:U.get(Z)??!0}):void 0,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`available-${Z}`))]})]}),n.jsx(A2,{}),n.jsx(Ox,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:w,onToggle:B,count:C.authoringProject.total+C.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),!w&&n.jsxs(n.Fragment,{children:[n.jsx(ms,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${j}-authoring-project-collapsed`,count:C.authoringProject.total,filteredCount:S?C.authoringProject.filtered:null,updateCount:(m==null?void 0:m.own)??(h==null?void 0:h.source),children:C.authoringProject.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:C.authoringProject.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),M&&n.jsx(ms,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${j}-authoring-plugin-collapsed`,count:C.authoringPlugin.total,filteredCount:S?C.authoringPlugin.filtered:null,children:C.authoringPlugin.filtered===0?n.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",n.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):C.authoringPlugin.byPlugin.map(([Z,q])=>n.jsx(_x,{pluginName:Z,skills:q,persistKey:`vskill-plugin-authoring-${Z}-collapsed`,renderSkill:de=>n.jsx(uo,{skill:de,isSelected:(r==null?void 0:r.plugin)===de.plugin&&(r==null?void 0:r.skill)===de.skill,onSelect:()=>i(de),onContextMenu:f})},`authoring-${Z}`))})]})]}),!o&&!d&&!v&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Dx,{origin:"source",count:P.total,filteredCount:S?P.filtered:null,updateCount:h==null?void 0:h.source,children:P.filtered===0?n.jsx(Bx,{queryActive:!!S}):n.jsx(hs,{items:P.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})}),n.jsx(R2,{}),n.jsx(Dx,{origin:"installed",count:F.total,filteredCount:S?F.filtered:null,updateCount:h==null?void 0:h.installed,children:F.filtered===0?n.jsx(Ix,{queryActive:!!S}):n.jsx(hs,{items:F.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:Q})})]})]})}function ju(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(a)==="true"}catch{return!1}}function ms({label:a,storageKey:r,count:i,filteredCount:o,updateCount:d,children:p}){const[f,h]=g.useState(()=>ju(r)),x=g.useCallback(()=>{h(y=>{const v=!y;if(typeof window<"u")try{window.localStorage.setItem(r,String(v))}catch{}return v})},[r]),m=o!=null&&o!==i?`${o} of ${i}`:String(i);return n.jsxs("section",{"data-vskill-named-scope":a,children:[n.jsxs("button",{type:"button",onClick:x,"aria-expanded":!f,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:f?"▸":"▾"}),n.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:a}),n.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",m,")"]}),d!=null&&d>0&&n.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[d," update",d!==1?"s":""]})]}),!f&&n.jsx("div",{children:p})]})}function E2(a){const r=[];for(const[i,o]of a){const d=[...o].sort((p,f)=>p.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:d.length});for(const p of d)r.push({kind:"row",skill:p})}return r}function hs({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:d}){if(d){const p=E2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx($j,{overscan:4,totalCount:p.length,itemContent:f=>{const h=p[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,m=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(uo,{skill:x,isSelected:m,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([p,f])=>n.jsx(p2,{plugin:p,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},p))})}function Bx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx($u,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ix({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install <plugin>"})," to add one."]})})}function T2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx($u,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function $u({children:a}){return n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-primary)",background:"color-mix(in srgb, var(--border-default) 45%, transparent)",padding:"1px 4px",borderRadius:3},children:a})}function R2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function A2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function M2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(g2,{},a))})}function z2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:L2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function L2(a){const r=a.split(`
|
|
55
55
|
`)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Jg=240,ev=480,tv="vskill-sidebar-width",Ss=320;function Pu(a){return Number.isFinite(a)?Math.round(Math.max(Jg,Math.min(ev,a))):Ss}function D2(){try{const a=localStorage.getItem(tv);if(!a)return Ss;const r=Number(a);return Number.isFinite(r)?Pu(r):Ss}catch{return Ss}}function _2(a){try{localStorage.setItem(tv,String(Pu(a)))}catch{}}function O2({initialWidth:a,onChange:r}){const i=g.useRef({startX:0,startWidth:a,pointerId:null}),o=g.useRef(a);return g.useEffect(()=>{o.current=a},[a]),g.useEffect(()=>{function d(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const h=f.clientX-i.current.startX,x=Pu(i.current.startWidth+h);o.current=x,r(x)}function p(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,_2(o.current))}return window.addEventListener("pointermove",d),window.addEventListener("pointerup",p),window.addEventListener("pointercancel",p),()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":Jg,"aria-valuemax":ev,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:d=>{const p=d.currentTarget;i.current.startX=d.clientX,i.current.startWidth=o.current,i.current.pointerId=d.pointerId;try{p.setPointerCapture(d.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function B2({connected:a,hint:r,onRetry:i}){return a?null:n.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),n.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),n.jsx("div",{style:{flex:1}}),i&&n.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function nv(a){if(a!==void 0)try{return JSON.stringify(a)}catch(r){console.error("Failed to serialize request body:",r);try{const i=new WeakSet;return JSON.stringify(a,(o,d)=>{if(typeof d=="object"&&d!==null){if(i.has(d))return"[Circular]";i.add(d)}return d})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Xd(){const[a,r]=g.useState([]),[i,o]=g.useState(!1),[d,p]=g.useState(!1),[f,h]=g.useState(null),x=g.useRef(null),m=g.useCallback(async(v,j)=>{r([]),o(!0),p(!1),h(null);const S=new AbortController;x.current=S;try{const k=nv(j),A=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:S.signal});if(!A.ok||!A.body){let U=`HTTP ${A.status}`;try{const L=await A.json();L.error&&(U=L.error)}catch{}throw new Error(U)}const T=A.body.getReader(),C=new TextDecoder;let M="",O="";for(;;){const{done:U,value:L}=await T.read();if(U)break;M+=C.decode(L,{stream:!0});const V=M.split(`
|
|
56
56
|
`);M=V.pop()||"";for(const w of V)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),E={event:O,data:D};O==="done"?(p(!0),r(B=>[...B,E])):r(B=>[...B,E])}catch{}O=""}}}catch(k){k.name!=="AbortError"&&h(k.message)}finally{o(!1),x.current=null}},[]),y=g.useCallback(()=>{var v;(v=x.current)==null||v.abort()},[]);return{events:a,running:i,done:d,error:f,start:m,stop:y}}function I2(a){const r=g.useRef(a);r.current=a;const[i,o]=g.useState(new Set),d=g.useRef(new Map),p=g.useCallback(async(m,y,v)=>{var S;(S=d.current.get(m))==null||S.abort();const j=new AbortController;d.current.set(m,j),o(k=>{const A=new Set(k);return A.add(m),A});try{const k=nv(v),A=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:j.signal});if(!A.ok||!A.body){let U=`HTTP ${A.status}`;try{const L=await A.json();L.error&&(U=L.error)}catch{}throw new Error(U)}const T=A.body.getReader(),C=new TextDecoder;let M="",O="";for(;;){const{done:U,value:L}=await T.read();if(U)break;M+=C.decode(L,{stream:!0});const V=M.split(`
|
|
57
|
-
`);M=V.pop()||"";for(const w of V)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),E={event:O,data:D};r.current.onEvent(m,E)}catch{}O=""}}r.current.onDone(m)}catch(k){k.name!=="AbortError"&&r.current.onError(m,k.message)}finally{o(k=>{const A=new Set(k);return A.delete(m),A}),d.current.delete(m)}},[]),f=g.useCallback(m=>{var y;(y=d.current.get(m))==null||y.abort()},[]),h=g.useCallback(()=>{for(const m of d.current.values())m.abort()},[]),x=i.size>0;return{runningSet:i,startCase:p,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const H2={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 U2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const d=new Map;if(r.benchmark)for(const f of r.benchmark.cases)d.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const p=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:d,selectedCaseId:p,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const d=new Map(a.caseRunStates);return d.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:d,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);d.set(r.caseId,{status:"complete",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_ERROR":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);d.set(r.caseId,{status:"error",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_CANCEL":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);return d.set(r.caseId,{status:"cancelled",mode:p==null?void 0:p.mode}),{...a,caseRunStates:d}}case"BULK_RUN_START":{const d=new Map(a.caseRunStates);for(const p of r.caseIds)d.set(p,{status:"queued",mode:r.mode});return{...a,caseRunStates:d,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const d=new Map(a.caseRunStates);for(const[p,f]of d)(f.status==="running"||f.status==="queued")&&d.set(p,{status:"cancelled"});return{...a,caseRunStates:d,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const d=new Map(a.inlineResults);return d.set(r.evalId,r.result),{...a,inlineResults:d}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const d=r.evalChanges??[],p=new Map;for(let f=0;f<d.length;f++)p.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:d},aiEditEvalChanges:d,aiEditEvalSelections:p}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const d=new Map(a.aiEditEvalSelections);return d.set(r.index,!d.get(r.index)),{...a,aiEditEvalSelections:d}}case"SELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const p of d.keys())d.set(p,!0);return{...a,aiEditEvalSelections:d}}case"DESELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const p of d.keys())d.set(p,!1);return{...a,aiEditEvalSelections:d}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function V2(a){if(a==="unit"||a==="integration")return a}function $2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(d=>d.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const av=g.createContext(null);function wn(){const a=g.useContext(av);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Hx({plugin:a,skill:r,origin:i,children:o}){const d=i==="installed",[p,f]=g.useReducer(U2,{...H2,plugin:a,skill:r}),h=g.useRef(new Set),x=g.useRef(new Set),m=g.useRef(new Map),y=g.useCallback((ae,pe)=>{let fe=m.current.get(ae);fe||(fe={assertions:[]},m.current.set(ae,fe)),$2(fe,pe),f({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...fe,assertions:[...fe.assertions]}})},[]),v=g.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const pe=m.current.get(ae)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...pe,assertions:[...pe.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(a,r).then(fe=>f({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=g.useCallback((ae,pe)=>{x.current.has(ae)||(x.current.add(ae),f({type:"CASE_RUN_ERROR",caseId:ae,error:pe}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(a,r).then(fe=>f({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:k,stopAll:A}=I2({onEvent:y,onDone:v,onError:j});g.useEffect(()=>()=>{A()},[A]);const T=g.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const pe=await ae.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:pe.runs||[]})}catch{}},[a,r]);g.useEffect(()=>{let ae=!1;async function pe(){try{const[fe,he,ve]=await Promise.allSettled([Ee.getSkillDetail(a,r),Ee.getEvals(a,r),Ee.getLatestBenchmark(a,r)]);if(ae)return;let _e=null,re=null;if(he.status==="fulfilled")_e=he.value;else{const Te=he.reason;(Te==null?void 0:Te.status)!==404&&(re=(Te==null?void 0:Te.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:fe.status==="fulfilled"?fe.value.skillContent:"",evals:_e,evalsError:re,benchmark:ve.status==="fulfilled"?ve.value:null})}catch(fe){ae||f({type:"SET_ERROR",error:fe.message})}}return pe(),T(),()=>{ae=!0}},[a,r,T]);const C=g.useCallback(async()=>{if(!d)try{await Ee.applyImprovement(a,r,p.skillContent),f({type:"CONTENT_SAVED"})}catch(ae){f({type:"SET_ERROR",error:ae.message})}},[d,a,r,p.skillContent]),M=g.useCallback(async ae=>{if(!d)try{const pe=await Ee.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:pe})}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[d,a,r]),O=g.useCallback((ae,pe="benchmark")=>{if(d)return;const fe=p.caseRunStates.get(ae);if((fe==null?void 0:fe.status)!=="running")if(m.current.delete(ae),x.current.delete(ae),f({type:"CASE_RUN_START",caseId:ae,mode:pe}),pe==="comparison"){const he=`/api/skills/${a}/${r}/compare`;S(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${a}/${r}/benchmark/case/${ae}`;S(ae,he,pe==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,p.caseRunStates,S]),U=g.useCallback((ae="benchmark")=>{var he;if(d)return;const pe=((he=p.evals)==null?void 0:he.evals)??[];if(pe.length===0)return;const fe=pe.map(ve=>ve.id);for(const ve of fe)m.current.delete(ve),x.current.delete(ve);f({type:"BULK_RUN_START",caseIds:fe,mode:ae}),h.current=new Set(fe);for(const ve of fe)if(ae==="comparison")S(ve,`/api/skills/${a}/${r}/compare`,{eval_ids:[ve]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${ve}`;S(ve,_e,ae==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,p.evals,S]),L=g.useCallback(ae=>{k(ae),f({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[k]),V=g.useCallback(()=>{A(),f({type:"CANCEL_ALL"}),h.current.clear()},[A]),w=g.useCallback(async(ae,pe)=>{f({type:"OPEN_IMPROVE",evalId:ae})},[]),D=g.useCallback(async(ae,pe)=>{try{await Ee.applyImprovement(a,r,pe),f({type:"SET_CONTENT",content:pe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),O(ae,"benchmark")}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[a,r,O]),E=Xd(),B=g.useRef(null),P=g.useRef(0);g.useEffect(()=>{const ae=E.events;for(let pe=P.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ve=he.improved,_e=he.reasoning,re=he.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ve,reasoning:_e,evalChanges:re})}if(fe.event==="error"){const ve=he;f({type:"AI_EDIT_ERROR",message:ve.description||"Unknown error",classified:ve})}}P.current=ae.length},[E.events]),g.useEffect(()=>{E.error&&f({type:"AI_EDIT_ERROR",message:E.error})},[E.error]),g.useEffect(()=>()=>{E.stop()},[E.stop]);const q=g.useCallback(async(ae,pe,fe)=>{d||(P.current=0,f({type:"AI_EDIT_LOADING"}),B.current=E.stop,E.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:p.skillContent,evals:p.evals??{skill_name:r,evals:[]},provider:pe,model:fe}))},[d,a,r,p.skillContent,p.evals,E]),te=g.useCallback(()=>{E.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[E]),Q=g.useCallback(async()=>{const ae=p.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ee.applyImprovement(a,r,ae.improved),f({type:"SET_CONTENT",content:ae.improved}),f({type:"CONTENT_SAVED"}),p.aiEditEvalChanges.length>0&&Array.from(p.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:fe}=await Tu(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),he=p.evals??{skill_name:r,evals:[]},ve=fe(he,p.aiEditEvalChanges,p.aiEditEvalSelections);try{const _e=await Ee.saveEvals(a,r,ve);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:ve}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[a,r,p.aiEditResult,p.evals,p.aiEditEvalChanges,p.aiEditEvalSelections]),z=g.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),R=g.useCallback(ae=>{f({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),I=g.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),Z=g.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Y=g.useCallback(async()=>{const ae=p.aiEditEvalsRetry;if(ae)try{const pe=await Ee.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:pe}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(pe){f({type:"SET_ERROR",error:`Retry failed: ${pe.message}`})}},[a,r,p.aiEditEvalsRetry]),de=g.useCallback(async()=>{try{const ae=await Ee.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ae.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:_}=bl(),W=Xd(),ie=g.useRef(0);g.useEffect(()=>{const ae=W.events;for(let pe=ie.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ve=he;Ee.saveEvals(a,r,ve).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}fe.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:he})}ie.current=ae.length},[W.events,a,r]),g.useEffect(()=>{W.error&&f({type:"SET_ERROR",error:W.error})},[W.error]),g.useEffect(()=>()=>{W.stop()},[W.stop]);const ue=g.useCallback(async ae=>{if(d)return;ie.current=0,f({type:"GENERATE_EVALS_START"});const pe={};_!=null&&_.provider&&(pe.provider=_.provider),_!=null&&_.model&&(pe.model=_.model);const fe=V2(ae==null?void 0:ae.testType);fe&&(pe.testType=fe),W.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(pe).length>0?pe:void 0)},[d,a,r,W,_]),ge=Xd(),xe=g.useRef(0);g.useEffect(()=>()=>{ge.stop()},[ge.stop]),g.useEffect(()=>{const ae=ge.events;for(let pe=xe.current;pe<ae.length;pe++){const fe=ae[pe];if(fe.event==="classifying"){const he=fe.data;f({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(fe.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:fe.data}),fe.event==="done"){we.current&&(clearTimeout(we.current),we.current=null);const he=fe.data;if(he.error)f({type:"ACTIVATION_ERROR",error:he.error});else{f({type:"ACTIVATION_DONE",summary:he});const ve={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(_==null?void 0:_.model)||"unknown",provider:(_==null?void 0:_.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ve,...p.activationHistory??[]]})}}}xe.current=ae.length},[ge.events,_,p.activationHistory]),g.useEffect(()=>{ge.error&&(we.current&&(clearTimeout(we.current),we.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const we=g.useRef(null),oe=g.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),Se=g.useCallback(ae=>{const fe=ae.trim().split(`
|
|
57
|
+
`);M=V.pop()||"";for(const w of V)if(w.startsWith("event: "))O=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),E={event:O,data:D};r.current.onEvent(m,E)}catch{}O=""}}r.current.onDone(m)}catch(k){k.name!=="AbortError"&&r.current.onError(m,k.message)}finally{o(k=>{const A=new Set(k);return A.delete(m),A}),d.current.delete(m)}},[]),f=g.useCallback(m=>{var y;(y=d.current.get(m))==null||y.abort()},[]),h=g.useCallback(()=>{for(const m of d.current.values())m.abort()},[]),x=i.size>0;return{runningSet:i,startCase:p,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const H2={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 U2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const d=new Map;if(r.benchmark)for(const f of r.benchmark.cases)d.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const p=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:d,selectedCaseId:p,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const d=new Map(a.caseRunStates);return d.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:d,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);d.set(r.caseId,{status:"complete",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_ERROR":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);d.set(r.caseId,{status:"error",mode:p==null?void 0:p.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_CANCEL":{const d=new Map(a.caseRunStates),p=d.get(r.caseId);return d.set(r.caseId,{status:"cancelled",mode:p==null?void 0:p.mode}),{...a,caseRunStates:d}}case"BULK_RUN_START":{const d=new Map(a.caseRunStates);for(const p of r.caseIds)d.set(p,{status:"queued",mode:r.mode});return{...a,caseRunStates:d,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const d=new Map(a.caseRunStates);for(const[p,f]of d)(f.status==="running"||f.status==="queued")&&d.set(p,{status:"cancelled"});return{...a,caseRunStates:d,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const d=new Map(a.inlineResults);return d.set(r.evalId,r.result),{...a,inlineResults:d}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const d=r.evalChanges??[],p=new Map;for(let f=0;f<d.length;f++)p.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:d},aiEditEvalChanges:d,aiEditEvalSelections:p}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const d=new Map(a.aiEditEvalSelections);return d.set(r.index,!d.get(r.index)),{...a,aiEditEvalSelections:d}}case"SELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const p of d.keys())d.set(p,!0);return{...a,aiEditEvalSelections:d}}case"DESELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const p of d.keys())d.set(p,!1);return{...a,aiEditEvalSelections:d}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function V2(a){if(a==="unit"||a==="integration")return a}function $2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(d=>d.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const av=g.createContext(null);function wn(){const a=g.useContext(av);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Hx({plugin:a,skill:r,origin:i,children:o}){const d=i==="installed",[p,f]=g.useReducer(U2,{...H2,plugin:a,skill:r}),h=g.useRef(new Set),x=g.useRef(new Set),m=g.useRef(new Map),y=g.useCallback((ae,pe)=>{let fe=m.current.get(ae);fe||(fe={assertions:[]},m.current.set(ae,fe)),$2(fe,pe),f({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...fe,assertions:[...fe.assertions]}})},[]),v=g.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const pe=m.current.get(ae)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...pe,assertions:[...pe.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(a,r).then(fe=>f({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=g.useCallback((ae,pe)=>{x.current.has(ae)||(x.current.add(ae),f({type:"CASE_RUN_ERROR",caseId:ae,error:pe}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ee.getLatestBenchmark(a,r).then(fe=>f({type:"BULK_RUN_COMPLETE",benchmark:fe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:k,stopAll:A}=I2({onEvent:y,onDone:v,onError:j});g.useEffect(()=>()=>{A()},[A]);const T=g.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ae.ok){if(ae.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const pe=await ae.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:pe.runs||[]})}catch{}},[a,r]);g.useEffect(()=>{let ae=!1;async function pe(){try{const[fe,he,ve]=await Promise.allSettled([Ee.getSkillDetail(a,r),Ee.getEvals(a,r),Ee.getLatestBenchmark(a,r)]);if(ae)return;let _e=null,re=null;if(he.status==="fulfilled")_e=he.value;else{const Te=he.reason;(Te==null?void 0:Te.status)!==404&&(re=(Te==null?void 0:Te.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:fe.status==="fulfilled"?fe.value.skillContent:"",evals:_e,evalsError:re,benchmark:ve.status==="fulfilled"?ve.value:null})}catch(fe){ae||f({type:"SET_ERROR",error:fe.message})}}return pe(),T(),()=>{ae=!0}},[a,r,T]);const C=g.useCallback(async()=>{if(!d)try{await Ee.applyImprovement(a,r,p.skillContent),f({type:"CONTENT_SAVED"})}catch(ae){f({type:"SET_ERROR",error:ae.message})}},[d,a,r,p.skillContent]),M=g.useCallback(async ae=>{if(!d)try{const pe=await Ee.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:pe})}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[d,a,r]),O=g.useCallback((ae,pe="benchmark")=>{if(d)return;const fe=p.caseRunStates.get(ae);if((fe==null?void 0:fe.status)!=="running")if(m.current.delete(ae),x.current.delete(ae),f({type:"CASE_RUN_START",caseId:ae,mode:pe}),pe==="comparison"){const he=`/api/skills/${a}/${r}/compare`;S(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${a}/${r}/benchmark/case/${ae}`;S(ae,he,pe==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,p.caseRunStates,S]),U=g.useCallback((ae="benchmark")=>{var he;if(d)return;const pe=((he=p.evals)==null?void 0:he.evals)??[];if(pe.length===0)return;const fe=pe.map(ve=>ve.id);for(const ve of fe)m.current.delete(ve),x.current.delete(ve);f({type:"BULK_RUN_START",caseIds:fe,mode:ae}),h.current=new Set(fe);for(const ve of fe)if(ae==="comparison")S(ve,`/api/skills/${a}/${r}/compare`,{eval_ids:[ve]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${ve}`;S(ve,_e,ae==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,p.evals,S]),L=g.useCallback(ae=>{k(ae),f({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[k]),V=g.useCallback(()=>{A(),f({type:"CANCEL_ALL"}),h.current.clear()},[A]),w=g.useCallback(async(ae,pe)=>{f({type:"OPEN_IMPROVE",evalId:ae})},[]),D=g.useCallback(async(ae,pe)=>{try{await Ee.applyImprovement(a,r,pe),f({type:"SET_CONTENT",content:pe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),O(ae,"benchmark")}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[a,r,O]),E=Xd(),B=g.useRef(null),P=g.useRef(0);g.useEffect(()=>{const ae=E.events;for(let pe=P.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ve=he.improved,_e=he.reasoning,re=he.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ve,reasoning:_e,evalChanges:re})}if(fe.event==="error"){const ve=he;f({type:"AI_EDIT_ERROR",message:ve.description||"Unknown error",classified:ve})}}P.current=ae.length},[E.events]),g.useEffect(()=>{E.error&&f({type:"AI_EDIT_ERROR",message:E.error})},[E.error]),g.useEffect(()=>()=>{E.stop()},[E.stop]);const F=g.useCallback(async(ae,pe,fe)=>{d||(P.current=0,f({type:"AI_EDIT_LOADING"}),B.current=E.stop,E.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ae,content:p.skillContent,evals:p.evals??{skill_name:r,evals:[]},provider:pe,model:fe}))},[d,a,r,p.skillContent,p.evals,E]),te=g.useCallback(()=>{E.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[E]),Q=g.useCallback(async()=>{const ae=p.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ee.applyImprovement(a,r,ae.improved),f({type:"SET_CONTENT",content:ae.improved}),f({type:"CONTENT_SAVED"}),p.aiEditEvalChanges.length>0&&Array.from(p.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:fe}=await Tu(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),he=p.evals??{skill_name:r,evals:[]},ve=fe(he,p.aiEditEvalChanges,p.aiEditEvalSelections);try{const _e=await Ee.saveEvals(a,r,ve);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:ve}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(pe){f({type:"SET_ERROR",error:pe.message})}},[a,r,p.aiEditResult,p.evals,p.aiEditEvalChanges,p.aiEditEvalSelections]),z=g.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),R=g.useCallback(ae=>{f({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),I=g.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),Z=g.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),q=g.useCallback(async()=>{const ae=p.aiEditEvalsRetry;if(ae)try{const pe=await Ee.saveEvals(a,r,ae);f({type:"SET_EVALS",evals:pe}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(pe){f({type:"SET_ERROR",error:`Retry failed: ${pe.message}`})}},[a,r,p.aiEditEvalsRetry]),de=g.useCallback(async()=>{try{const ae=await Ee.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ae.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:_}=bl(),W=Xd(),ie=g.useRef(0);g.useEffect(()=>{const ae=W.events;for(let pe=ie.current;pe<ae.length;pe++){const fe=ae[pe],he=fe.data;if(fe.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),fe.event==="done"){const ve=he;Ee.saveEvals(a,r,ve).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}fe.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:he})}ie.current=ae.length},[W.events,a,r]),g.useEffect(()=>{W.error&&f({type:"SET_ERROR",error:W.error})},[W.error]),g.useEffect(()=>()=>{W.stop()},[W.stop]);const ue=g.useCallback(async ae=>{if(d)return;ie.current=0,f({type:"GENERATE_EVALS_START"});const pe={};_!=null&&_.provider&&(pe.provider=_.provider),_!=null&&_.model&&(pe.model=_.model);const fe=V2(ae==null?void 0:ae.testType);fe&&(pe.testType=fe),W.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(pe).length>0?pe:void 0)},[d,a,r,W,_]),ge=Xd(),xe=g.useRef(0);g.useEffect(()=>()=>{ge.stop()},[ge.stop]),g.useEffect(()=>{const ae=ge.events;for(let pe=xe.current;pe<ae.length;pe++){const fe=ae[pe];if(fe.event==="classifying"){const he=fe.data;f({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(fe.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:fe.data}),fe.event==="done"){we.current&&(clearTimeout(we.current),we.current=null);const he=fe.data;if(he.error)f({type:"ACTIVATION_ERROR",error:he.error});else{f({type:"ACTIVATION_DONE",summary:he});const ve={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(_==null?void 0:_.model)||"unknown",provider:(_==null?void 0:_.provider)||"unknown",promptCount:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ve,...p.activationHistory??[]]})}}}xe.current=ae.length},[ge.events,_,p.activationHistory]),g.useEffect(()=>{ge.error&&(we.current&&(clearTimeout(we.current),we.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const we=g.useRef(null),oe=g.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),Se=g.useCallback(ae=>{const fe=ae.trim().split(`
|
|
58
58
|
`).filter(Boolean).map(ve=>ve.startsWith("!")?{prompt:ve.slice(1).trim(),expected:"should_not_activate"}:ve.startsWith("+")?{prompt:ve.slice(1).trim(),expected:"should_activate"}:{prompt:ve.trim(),expected:"auto"});xe.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const he={prompts:fe};_!=null&&_.provider&&(he.provider=_.provider),_!=null&&_.model&&(he.model=_.model),ge.start(`/api/skills/${a}/${r}/activation-test`,he),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{ge.stop(),f({type:"ACTIVATION_TIMEOUT"}),we.current=null},12e4)},[a,r,ge,_]),De=g.useCallback(async(ae=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const pe={count:ae};_!=null&&_.provider&&(pe.provider=_.provider),_!=null&&_.model&&(pe.model=_.model);const fe=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pe)});if(!fe.ok){let at=`HTTP ${fe.status}`;try{const $t=await fe.json();$t.error&&(at=$t.error)}catch{}throw new Error(at)}const he=fe.body.getReader(),ve=new TextDecoder;let _e="",re="",Te=[];for(;;){const{done:at,value:$t}=await he.read();if(at)break;_e+=ve.decode($t,{stream:!0});const Pt=_e.split(`
|
|
59
59
|
`);_e=Pt.pop()||"";for(const lt of Pt)if(lt.startsWith("event: "))re=lt.slice(7).trim();else if(lt.startsWith("data: ")){try{const St=JSON.parse(lt.slice(6));if(re==="done"){if(St.error)throw new Error(St.error);Te=St.prompts||[]}if(re==="error")throw new Error(St.message||St.description||"Generation failed")}catch(St){if(!(St instanceof SyntaxError))throw St}re=""}}const Qe=Te.map(at=>`${at.expected==="should_activate"?"+":"!"}${at.prompt}`).join(`
|
|
60
|
-
`);f({type:"SET_ACTIVATION_PROMPTS",prompts:Qe}),f({type:"GENERATE_PROMPTS_DONE"})}catch(pe){f({type:"GENERATE_PROMPTS_ERROR",error:pe.message})}},[a,r,_]),Ie=g.useMemo(()=>({state:p,dispatch:f,isReadOnly:d,saveContent:C,saveEvals:M,runCase:O,runAll:U,cancelCase:L,cancelAll:V,improveForCase:w,applyImproveAndRerun:D,refreshSkillContent:de,generateEvals:ue,runActivationTest:Se,cancelActivation:oe,generateActivationPrompts:De,fetchActivationHistory:T,submitAiEdit:
|
|
61
|
-
`),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function Gu({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:d=480,collapsible:p=!1,renderContext:f="inline",onRetry:h}){const[x,m]=g.useState(p),[y,v]=g.useState("unified"),j=g.useRef(null),S=g.useRef(null),k=g.useMemo(()=>P2(a),[a]),A=g.useMemo(()=>{const L=k.filter(w=>w.type==="add").length,V=k.filter(w=>w.type==="remove").length;return{added:L,removed:V}},[k]),T=g.useMemo(()=>{let L=0,V=0;return k.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(L++,{...w,origNum:L,newNum:null}):w.type==="add"?(V++,{...w,origNum:null,newNum:V}):(L++,V++,{...w,origNum:L,newNum:V}))},[k]),C=g.useMemo(()=>{const L=[],V=[];for(const w of T)if(w.type==="remove")L.push(w);else if(w.type==="add")V.push(w);else{for(;L.length<V.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;V.length<L.length;)V.push({type:"context",content:"",origNum:null,newNum:null});L.push(w),V.push(w)}for(;L.length<V.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;V.length<L.length;)V.push({type:"context",content:"",origNum:null,newNum:null});return{left:L,right:V}},[T]),M=g.useCallback(L=>{const V=L==="left"?j.current:S.current,w=L==="left"?S.current:j.current;V&&w&&(w.scrollTop=V.scrollTop)},[]);if(!a||k.length===0)return n.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&n.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const O=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",U=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",A.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",A.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),p&&n.jsx("button",{onClick:()=>m(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:d,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:T.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:L.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:L.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"transparent",borderRight:L.type==="add"?"2px solid var(--green)":L.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:L.type==="add"?"+":L.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||""})]},V))})})}):n.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{ref:j,style:{maxHeight:d,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>M("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:C.left.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||""})]},V))})})}),n.jsx("div",{ref:S,style:{maxHeight:d,overflowY:"auto"},onScroll:()=>M("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:C.right.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":"var(--text-secondary)"},children:L.content||""})]},V))})})})]}))]});return f==="modal"?n.jsx("div",{className:O,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:U})}):U}const Ux={CERTIFIED:{bg:"var(--yellow-muted)",text:"var(--yellow)"},VERIFIED:{bg:"var(--accent-muted)",text:"var(--accent)"},COMMUNITY:{bg:"var(--surface-3)",text:"var(--text-tertiary)"}};function G2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function lv(){const{state:a}=wn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:d}=ya(),p=`versions/${r}/${i}`,f=g.useCallback(()=>Ee.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=xr(p,f),[m,y]=g.useState(null),[v,j]=g.useState(null),[S,k]=g.useState(null),[A,T]=g.useState(!1),[C,M]=g.useState("idle"),[O,U]=g.useState(null),L=g.useRef(null),V=g.useRef(null),w=g.useMemo(()=>(h==null?void 0:h.find(Q=>Q.isInstalled))??null,[h]),D=g.useMemo(()=>(h==null?void 0:h[0])??null,[h]),E=w&&D&&w.version!==D.version,B=g.useCallback(Q=>{m?!v&&Q!==m?j(Q):(y(Q),j(null),k(null)):(y(Q),k(null))},[m,v]),P=g.useCallback(async(Q,z)=>{T(!0);try{const R=await Ee.getVersionDiff(r,i,Q,z);k(R)}catch{k(null)}finally{T(!1)}},[r,i]);g.useEffect(()=>{if(m&&v){const Q=h||[],z=Q.findIndex(Y=>Y.version===m),R=Q.findIndex(Y=>Y.version===v),[I,Z]=z>R?[m,v]:[v,m];P(I,Z)}},[m,v,h,P]);const q=g.useCallback(()=>{!w||!D||(y(w.version),j(D.version))},[w,D]),te=g.useCallback(()=>{M("updating"),U(null);const Q=Ee.startSkillUpdate(r,i);L.current=Q,Q.addEventListener("progress",z=>{try{switch(JSON.parse(z.data).status){case"scanning":M("scanning");break;case"installing":M("installing");break;case"done":M("done");break}}catch{M("error"),U("Unexpected response from server")}}),Q.addEventListener("done",()=>{Q.close(),L.current=null,o(),an(p),M("done")}),Q.addEventListener("error",z=>{const R=z;let I="Connection lost";if(R.data)try{I=JSON.parse(R.data).error||"Update failed"}catch{}M("error"),U(I),Q.close(),L.current=null})},[r,i,p,o]);return g.useEffect(()=>()=>{L.current&&(L.current.close(),L.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[E&&n.jsx("button",{onClick:q,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),E&&C!=="done"&&(C==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:O||"Update failed"}),n.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:C!=="idle",className:"btn btn-primary text-[11px]",children:C==="idle"?`Update to ${D==null?void 0:D.version}`:C==="updating"?"Starting update...":C==="scanning"?"Scanning...":"Installing..."})),d>1&&n.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",d,")"]})]})]}),m&&!v&&n.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",m]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),n.jsx("div",{className:"space-y-1",children:h.map(Q=>{const z=Ux[Q.certTier]||Ux.COMMUNITY,R=Q.version===m||Q.version===v,I=Q.isInstalled;return n.jsxs("button",{onClick:()=>B(Q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:R?"var(--accent-muted)":"transparent",border:R?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:Z=>{R||(Z.currentTarget.style.background="var(--surface-1)")},onMouseLeave:Z=>{R||(Z.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:I?10:8,height:I?10:8,background:I?"var(--accent)":"var(--surface-3)",border:I?"2px solid var(--accent)":"2px solid var(--border-default)"}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:Q.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.bg,color:z.text},children:Q.certTier}),I&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(Q.createdAt).toLocaleDateString()})]}),Q.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:G2(Q.diffSummary,80)})]},Q.version)})}),n.jsx("div",{ref:V,style:{height:1}})]}),A&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!A&&n.jsx("div",{className:"mt-4",children:n.jsx(Gu,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>m&&v&&P(S.from,S.to)})})]})}function q2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function Y2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Vx(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function qu(a){return a.skill?W2({skill:a.skill}):X2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function F2(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function W2({skill:a}){const[r,i]=g.useState(!1),o=g.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),Vx(J.toasts.pathCopied,"info")}catch{Vx(J.toasts.permissionDenied,"error")}},[a.dir]),d=a.origin==="installed"?"Project":"Skills",p=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[n.jsx("span",{"data-testid":"detail-header-plugin",children:a.plugin}),n.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[n.jsx("span",{"data-origin-dot":a.origin,"aria-label":`Origin: ${d}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:p}}),d]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(K2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:F2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function K2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function X2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:d,evals:p,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:m,iterationCount:y}=a,v=Array.from(x.values()).some(C=>C.status==="running"||C.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(p==null?void 0:p.evals.reduce((C,M)=>C+M.assertions.length,0))??0,k=(p==null?void 0:p.evals.length)??0,A=q2(j),T=Y2(j);return n.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:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(Q2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:d}),r&&n.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:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.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"}),v&&n.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!r&&i&&n.jsx("button",{disabled:v,onClick:()=>{window.confirm(`Delete skill "${d}"? This cannot be undone.`)&&i()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:C=>{v||(C.currentTarget.style.color="var(--red)")},onMouseLeave:C=>{C.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(Z2,{})}),m.length>0&&n.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.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"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),m.length," regression",m.length>1?"s":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:T,color:A},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function Q2(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Z2(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.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"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const J2=[{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"},{id:"versions",label:"Versions",shortcut:"8"}]}];function eS({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.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 n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.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 n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.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"}),n.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"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function tS({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:d,isActivationRunning:p,hasUpdate:f}){return n.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:J2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(m=>{const y=a===m.id,v=m.id==="editor"&&i||m.id==="run"&&o||m.id==="activation"&&p||m.id==="history"&&d||m.id==="versions"&&f,j=m.id==="run"||m.id==="activation"?"var(--accent)":m.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(m.id),title:`${m.label} (Ctrl+${m.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:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(eS,{id:m.id}),m.label,v&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},m.id)})]},h.label))})}const $x={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 Ls({error:a,onRetry:r,onDismiss:i}){const[o,d]=g.useState(null),p=g.useRef(null);g.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?d(Math.ceil(a.retryAfterMs/1e3)):d(null),()=>{p.current&&clearInterval(p.current)}),[a]),g.useEffect(()=>{if(!(o==null||o<=0))return p.current=setInterval(()=>{d(x=>x==null||x<=1?(p.current&&clearInterval(p.current),0):x-1)},1e3),()=>{p.current&&clearInterval(p.current)}},[o!=null&&o>0]);const f=$x[a.category]||$x.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class nS extends g.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function aS(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,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(r)?{category:"context_window",title:"Content Too Large",description:a,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(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,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(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function lS(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),d={},p=i.split(`
|
|
60
|
+
`);f({type:"SET_ACTIVATION_PROMPTS",prompts:Qe}),f({type:"GENERATE_PROMPTS_DONE"})}catch(pe){f({type:"GENERATE_PROMPTS_ERROR",error:pe.message})}},[a,r,_]),Ie=g.useMemo(()=>({state:p,dispatch:f,isReadOnly:d,saveContent:C,saveEvals:M,runCase:O,runAll:U,cancelCase:L,cancelAll:V,improveForCase:w,applyImproveAndRerun:D,refreshSkillContent:de,generateEvals:ue,runActivationTest:Se,cancelActivation:oe,generateActivationPrompts:De,fetchActivationHistory:T,submitAiEdit:F,cancelAiEdit:te,applyAiEdit:Q,discardAiEdit:z,toggleEvalChange:R,selectAllEvalChanges:I,deselectAllEvalChanges:Z,retryEvalsSave:q}),[p,d,C,M,O,U,L,V,w,D,de,ue,Se,oe,De,T,F,te,Q,z,R,I,Z,q]);return n.jsx(av.Provider,{value:Ie,children:o})}function P2(a){if(!a)return[];const r=a.split(`
|
|
61
|
+
`),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function Gu({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:d=480,collapsible:p=!1,renderContext:f="inline",onRetry:h}){const[x,m]=g.useState(p),[y,v]=g.useState("unified"),j=g.useRef(null),S=g.useRef(null),k=g.useMemo(()=>P2(a),[a]),A=g.useMemo(()=>{const L=k.filter(w=>w.type==="add").length,V=k.filter(w=>w.type==="remove").length;return{added:L,removed:V}},[k]),T=g.useMemo(()=>{let L=0,V=0;return k.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(L++,{...w,origNum:L,newNum:null}):w.type==="add"?(V++,{...w,origNum:null,newNum:V}):(L++,V++,{...w,origNum:L,newNum:V}))},[k]),C=g.useMemo(()=>{const L=[],V=[];for(const w of T)if(w.type==="remove")L.push(w);else if(w.type==="add")V.push(w);else{for(;L.length<V.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;V.length<L.length;)V.push({type:"context",content:"",origNum:null,newNum:null});L.push(w),V.push(w)}for(;L.length<V.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;V.length<L.length;)V.push({type:"context",content:"",origNum:null,newNum:null});return{left:L,right:V}},[T]),M=g.useCallback(L=>{const V=L==="left"?j.current:S.current,w=L==="left"?S.current:j.current;V&&w&&(w.scrollTop=V.scrollTop)},[]);if(!a||k.length===0)return n.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&n.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const O=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",U=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",A.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",A.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),p&&n.jsx("button",{onClick:()=>m(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:d,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:T.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:L.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:L.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"transparent",borderRight:L.type==="add"?"2px solid var(--green)":L.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:L.type==="add"?"+":L.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||""})]},V))})})}):n.jsxs("div",{className:"mx-4 my-4 grid grid-cols-2 gap-0 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{ref:j,style:{maxHeight:d,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>M("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:C.left.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||""})]},V))})})}),n.jsx("div",{ref:S,style:{maxHeight:d,overflowY:"auto"},onScroll:()=>M("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:C.right.map((L,V)=>n.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":"var(--text-secondary)"},children:L.content||""})]},V))})})})]}))]});return f==="modal"?n.jsx("div",{className:O,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:U})}):U}const Ux={CERTIFIED:{bg:"var(--yellow-muted)",text:"var(--yellow)"},VERIFIED:{bg:"var(--accent-muted)",text:"var(--accent)"},COMMUNITY:{bg:"var(--surface-3)",text:"var(--text-tertiary)"}};function G2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function lv(){const{state:a}=wn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:d}=ya(),p=`versions/${r}/${i}`,f=g.useCallback(()=>Ee.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=xr(p,f),[m,y]=g.useState(null),[v,j]=g.useState(null),[S,k]=g.useState(null),[A,T]=g.useState(!1),[C,M]=g.useState("idle"),[O,U]=g.useState(null),L=g.useRef(null),V=g.useRef(null),w=g.useMemo(()=>(h==null?void 0:h.find(Q=>Q.isInstalled))??null,[h]),D=g.useMemo(()=>(h==null?void 0:h[0])??null,[h]),E=w&&D&&w.version!==D.version,B=g.useCallback(Q=>{m?!v&&Q!==m?j(Q):(y(Q),j(null),k(null)):(y(Q),k(null))},[m,v]),P=g.useCallback(async(Q,z)=>{T(!0);try{const R=await Ee.getVersionDiff(r,i,Q,z);k(R)}catch{k(null)}finally{T(!1)}},[r,i]);g.useEffect(()=>{if(m&&v){const Q=h||[],z=Q.findIndex(q=>q.version===m),R=Q.findIndex(q=>q.version===v),[I,Z]=z>R?[m,v]:[v,m];P(I,Z)}},[m,v,h,P]);const F=g.useCallback(()=>{!w||!D||(y(w.version),j(D.version))},[w,D]),te=g.useCallback(()=>{M("updating"),U(null);const Q=Ee.startSkillUpdate(r,i);L.current=Q,Q.addEventListener("progress",z=>{try{switch(JSON.parse(z.data).status){case"scanning":M("scanning");break;case"installing":M("installing");break;case"done":M("done");break}}catch{M("error"),U("Unexpected response from server")}}),Q.addEventListener("done",()=>{Q.close(),L.current=null,o(),an(p),M("done")}),Q.addEventListener("error",z=>{const R=z;let I="Connection lost";if(R.data)try{I=JSON.parse(R.data).error||"Update failed"}catch{}M("error"),U(I),Q.close(),L.current=null})},[r,i,p,o]);return g.useEffect(()=>()=>{L.current&&(L.current.close(),L.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[E&&n.jsx("button",{onClick:F,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),E&&C!=="done"&&(C==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:O||"Update failed"}),n.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:C!=="idle",className:"btn btn-primary text-[11px]",children:C==="idle"?`Update to ${D==null?void 0:D.version}`:C==="updating"?"Starting update...":C==="scanning"?"Scanning...":"Installing..."})),d>1&&n.jsxs("button",{onClick:()=>{window.location.hash="#/updates"},className:"text-[11px] hover:underline",style:{color:"var(--text-tertiary)",background:"transparent",border:"none",cursor:"pointer"},children:["Manage all updates (",d,")"]})]})]}),m&&!v&&n.jsxs("div",{className:"text-[11px] mb-3 px-3 py-2 rounded-lg",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:["Click another version to compare with ",m]}),n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),n.jsx("div",{className:"space-y-1",children:h.map(Q=>{const z=Ux[Q.certTier]||Ux.COMMUNITY,R=Q.version===m||Q.version===v,I=Q.isInstalled;return n.jsxs("button",{onClick:()=>B(Q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:R?"var(--accent-muted)":"transparent",border:R?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:Z=>{R||(Z.currentTarget.style.background="var(--surface-1)")},onMouseLeave:Z=>{R||(Z.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:I?10:8,height:I?10:8,background:I?"var(--accent)":"var(--surface-3)",border:I?"2px solid var(--accent)":"2px solid var(--border-default)"}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:Q.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.bg,color:z.text},children:Q.certTier}),I&&n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:"var(--accent-muted)",color:"var(--accent)"},children:"installed"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(Q.createdAt).toLocaleDateString()})]}),Q.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:G2(Q.diffSummary,80)})]},Q.version)})}),n.jsx("div",{ref:V,style:{height:1}})]}),A&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!A&&n.jsx("div",{className:"mt-4",children:n.jsx(Gu,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>m&&v&&P(S.from,S.to)})})]})}function F2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function q2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Vx(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Fu(a){return a.skill?W2({skill:a.skill}):X2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function Y2(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function W2({skill:a}){const[r,i]=g.useState(!1),o=g.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),Vx(J.toasts.pathCopied,"info")}catch{Vx(J.toasts.permissionDenied,"error")}},[a.dir]),d=a.origin==="installed"?"Project":"Skills",p=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("div",{"data-testid":"detail-header",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[n.jsx("span",{"data-testid":"detail-header-plugin",children:a.plugin}),n.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[n.jsx("span",{"data-origin-dot":a.origin,"aria-label":`Origin: ${d}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:p}}),d]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(K2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:Y2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function K2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function X2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:d,evals:p,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:m,iterationCount:y}=a,v=Array.from(x.values()).some(C=>C.status==="running"||C.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(p==null?void 0:p.evals.reduce((C,M)=>C+M.assertions.length,0))??0,k=(p==null?void 0:p.evals.length)??0,A=F2(j),T=q2(j);return n.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:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(Q2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:d}),r&&n.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:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.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"}),v&&n.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[!r&&i&&n.jsx("button",{disabled:v,onClick:()=>{window.confirm(`Delete skill "${d}"? This cannot be undone.`)&&i()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:C=>{v||(C.currentTarget.style.color="var(--red)")},onMouseLeave:C=>{C.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(Z2,{})}),m.length>0&&n.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.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"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),m.length," regression",m.length>1?"s":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:T,color:A},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function Q2(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Z2(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.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"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const J2=[{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"},{id:"versions",label:"Versions",shortcut:"8"}]}];function eS({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.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 n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.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 n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.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"}),n.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"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function tS({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:d,isActivationRunning:p,hasUpdate:f}){return n.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:J2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(m=>{const y=a===m.id,v=m.id==="editor"&&i||m.id==="run"&&o||m.id==="activation"&&p||m.id==="history"&&d||m.id==="versions"&&f,j=m.id==="run"||m.id==="activation"?"var(--accent)":m.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(m.id),title:`${m.label} (Ctrl+${m.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:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(eS,{id:m.id}),m.label,v&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},m.id)})]},h.label))})}const $x={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 Ls({error:a,onRetry:r,onDismiss:i}){const[o,d]=g.useState(null),p=g.useRef(null);g.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?d(Math.ceil(a.retryAfterMs/1e3)):d(null),()=>{p.current&&clearInterval(p.current)}),[a]),g.useEffect(()=>{if(!(o==null||o<=0))return p.current=setInterval(()=>{d(x=>x==null||x<=1?(p.current&&clearInterval(p.current),0):x-1)},1e3),()=>{p.current&&clearInterval(p.current)}},[o!=null&&o>0]);const f=$x[a.category]||$x.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class nS extends g.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function aS(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,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(r)?{category:"context_window",title:"Content Too Large",description:a,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(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,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(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function lS(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),d={},p=i.split(`
|
|
62
62
|
`);let f="",h=!1;for(const x of p){const m=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(m&&f&&h){const j=m[1],S=m[2].trim();let k=d[f];if((typeof k!="object"||Array.isArray(k))&&(k={},d[f]=k),!S)k[j]=[];else{const A=S.match(/^\[(.+)\]$/);A?k[j]=A[1].split(",").map(T=>T.trim().replace(/^["']|["']$/g,"")).filter(Boolean):k[j]=S.replace(/^["']|["']$/g,"")}continue}const y=x.match(/^\s+-\s+(.+)$/);if(y&&f){h=!1;const j=d[f];Array.isArray(j)?j.push(y[1].trim().replace(/^["']|["']$/g,"")):d[f]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const v=x.match(/^([\w-]+):\s*(.*)$/);if(v){f=v[1];const j=v[2].trim();if(h=!1,!j){d[f]={},h=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){d[f]=S[1].split(",").map(k=>k.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}d[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:d,body:o}}function bo(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=rS(r);return i=i.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>'),i=i.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),i=i.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),i=i.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),i=i.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),i=i.replace(/\n/g,"<br/>"),i}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function rS(a){const r=a.split(`
|
|
63
63
|
`),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const d=Px(r[o]);o+=2;const p=[];for(;o<r.length&&r[o].trim().startsWith("|");)p.push(Px(r[o])),o++;const f='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)"',h='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let x='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';x+="<thead><tr>";for(const m of d)x+=`<th ${f}>${m}</th>`;x+="</tr></thead><tbody>";for(const m of p){x+="<tr>";for(const y of m)x+=`<td ${h}>${y}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(r[o]),o++;return i.join(`
|
|
64
64
|
`)}function Px(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function jo(a,r){const i=a.split(`
|
|
65
65
|
`),o=r.split(`
|
|
66
|
-
`);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const d=i.length,p=o.length,f=Array.from({length:d+1},()=>new Array(p+1).fill(0));for(let y=1;y<=d;y++)for(let v=1;v<=p;v++)i[y-1]===o[v-1]?f[y][v]=f[y-1][v-1]+1:f[y][v]=Math.max(f[y-1][v],f[y][v-1]);const h=[];let x=d,m=p;for(;x>0||m>0;)x>0&&m>0&&i[x-1]===o[m-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,m--):m>0&&(x===0||f[x][m-1]>=f[x-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function sS(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Ds({entries:a,isRunning:r}){const[i,o]=g.useState(!1),d=g.useRef(null);return g.useEffect(()=>{d.current&&!i&&(d.current.scrollTop=d.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),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:p=>{p.currentTarget.style.color="var(--text-primary)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:d,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((p,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((p.timestamp-a[0].timestamp)/1e3).toFixed(1)}s`;return n.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[sS(p.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:p.message}),p.current!=null&&p.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",p.current,"/",p.total,"]"]})]},f)})})]})}function iS({plugin:a,skill:r,skillContent:i,onApplied:o}){const[d,p]=g.useState("closed"),{config:f}=bl(),[h,x]=g.useState("claude-cli"),[m,y]=g.useState("opus"),[v,j]=g.useState([]),[S,k]=g.useState(""),[A,T]=g.useState(""),[C,M]=g.useState(null),[O,U]=g.useState(null),[L,V]=g.useState([]),[w,D]=g.useState(!1),E=g.useRef(null);g.useEffect(()=>{if(!f)return;f.providers.find(I=>I.id==="claude-cli"&&I.available)&&(x("claude-cli"),y("opus"))},[f]),g.useEffect(()=>()=>{var R;(R=E.current)==null||R.abort()},[]);function B(){return f==null?void 0:f.providers.find(R=>R.id===h&&R.available)}const P=g.useCallback(()=>{var R;(R=E.current)==null||R.abort(),p("open")},[]);async function
|
|
67
|
-
`);de=ue.pop()||"";for(const ge of ue)if(ge.startsWith("event: "))_=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));_==="progress"?V(we=>[...we,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):_==="done"||_==="complete"?(k(xe.improved),T(xe.reasoning||""),j(jo(xe.original||i,xe.improved)),p("diff_shown")):_==="error"&&(M(xe.message||xe.description||"Unknown error"),xe.category&&U(xe),p("open"))}catch{}_=""}}}catch(I){I.name!=="AbortError"&&(M(I.message),p("open"))}finally{E.current=null}}async function te(){D(!0);try{await Ee.applyImprovement(a,r,S),o(S),p("closed")}catch(R){M(R.message)}finally{D(!1)}}function Q(){p("closed"),j([]),k(""),T(""),M(null)}if(d==="closed")return n.jsxs("button",{onClick:()=>p("open"),className:"btn btn-secondary mb-5",disabled:!i,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const z=B();return n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.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:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),n.jsx("button",{onClick:Q,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.background="var(--surface-3)"},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-5 py-4",children:[(d==="open"||d==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:R=>{x(R.target.value);const I=f==null?void 0:f.providers.find(Z=>Z.id===R.target.value);I!=null&&I.models[0]&&y(I.models[0].id)},disabled:d==="loading",children:f==null?void 0:f.providers.filter(R=>R.available).map(R=>n.jsx("option",{value:R.id,children:R.label},R.id))})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:m,onChange:R=>y(R.target.value),disabled:d==="loading",children:z==null?void 0:z.models.map(R=>n.jsx("option",{value:R.id,children:R.label},R.id))})]}),d==="loading"?n.jsx("button",{onClick:P,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:q,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),d==="loading"&&L.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ds,{entries:L,isRunning:!0})})]}),C&&n.jsx("div",{className:"mb-4",children:O?n.jsx(Ls,{error:O,onRetry:q,onDismiss:()=>{M(null),U(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:C})}),d==="diff_shown"&&n.jsxs(n.Fragment,{children:[A&&n.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:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),A]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((R,I)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:R.type==="added"?"rgba(34,197,94,0.1)":R.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:R.type==="added"?"var(--green)":R.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:R.type==="added"?"3px solid var(--green)":R.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:R.type==="added"?"+":R.type==="removed"?"-":" "}),R.content]},I))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:te,disabled:w,className:"btn btn-primary",children:w?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),n.jsx("button",{onClick:Q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Gx={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"}},oS={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function cS({change:a,index:r,selected:i,onToggle:o,originalEval:d}){var v;const[p,f]=g.useState(!1),h=Gx[a.action]??Gx.add,x=oS[a.action]??"var(--border-subtle)",m=a.action==="remove"?(d==null?void 0:d.name)??`Eval #${a.evalId}`:((v=a.eval)==null?void 0:v.name)??"Unnamed",y=g.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:m}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!p),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-3)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:p?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),p&&n.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.action==="add"&&a.eval&&n.jsx(dS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&d&&n.jsx(uS,{original:d,proposed:a.eval}),a.action==="remove"&&d&&n.jsx(fS,{evalCase:d})]})]})}function dS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(Su,{label:"Prompt",value:a.prompt}),n.jsx(Su,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function uS({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],d=r.assertions??[],p=new Set(o.map(m=>m.text)),f=new Set(d.map(m=>m.text)),h=d.filter(m=>!p.has(m.text)),x=o.filter(m=>!f.has(m.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(m=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.label}),n.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[n.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",ku(m.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",ku(m.new,120)]})]})]},m.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function fS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(Su,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function Su({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.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:ku(r,300)})]})}function ku(a,r){return a.length>r?a.slice(0,r)+"...":a}const qx={remove:0,modify:1,add:2};function pS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:d,onDeselectAll:p}){if(a.length===0)return null;const f=a.map((x,m)=>({change:x,originalIndex:m}));f.sort((x,m)=>(qx[x.change.action]??2)-(qx[m.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:d,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:m})=>n.jsx(cS,{change:x,index:m,selected:r.get(m)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},m))})]})}function mS(){var R;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:d,cancelAiEdit:p,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:m}=wn(),{aiEditLoading:y,aiEditResult:v,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:k,aiEditEvalChanges:A,aiEditEvalSelections:T,aiEditEvalsRetry:C}=a,[M,O]=g.useState(""),{config:U}=bl(),[L,V]=g.useState("claude-cli"),[w,D]=g.useState("opus"),E=g.useRef(null);g.useEffect(()=>{var I;(I=E.current)==null||I.focus()},[]),g.useEffect(()=>{if(!U)return;U.providers.find(Z=>Z.id==="claude-cli"&&Z.available)&&(V("claude-cli"),D("opus"))},[U]);const B=U==null?void 0:U.providers.find(I=>I.id===L&&I.available),P=g.useCallback(()=>{const I=M.trim();!I||y||i(I,L,w)},[M,y,i,L,w]),q=g.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P()),I.key==="Escape"&&(I.preventDefault(),y?p():d())},[P,y,p,d]),te=g.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),Q=v?jo(a.skillContent,v.improved):[],z=((R=a.evals)==null?void 0:R.evals)??[];return n.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),n.jsx("button",{onClick:d,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:I=>{I.currentTarget.style.background="var(--surface-3)"},onMouseLeave:I=>{I.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-4 py-3",children:[!v&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-2.5",children:[n.jsx("div",{className:"flex-1",children:n.jsx("textarea",{ref:E,value:M,onChange:I=>O(I.target.value),onKeyDown:q,placeholder:"e.g., Add an error handling section...",disabled:y,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:I=>{const Z=I.currentTarget;Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,96)+"px"}})}),n.jsxs("div",{style:{minWidth:100},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:L,onChange:I=>{V(I.target.value);const Z=U==null?void 0:U.providers.find(Y=>Y.id===I.target.value);Z!=null&&Z.models[0]&&D(Z.models[0].id)},disabled:y,style:{width:"100%"},children:U==null?void 0:U.providers.filter(I=>I.available).map(I=>n.jsx("option",{value:I.id,children:I.label},I.id))})]}),n.jsxs("div",{style:{minWidth:80},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:w,onChange:I=>D(I.target.value),disabled:y,style:{width:"100%"},children:B==null?void 0:B.models.map(I=>n.jsx("option",{value:I.id,children:I.label},I.id))})]}),y?n.jsx("button",{onClick:p,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:P,disabled:!M.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ds,{entries:k,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(Ls,{error:S,onRetry:te,onDismiss:d}):n.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),v&&n.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&n.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:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),n.jsx("div",{className:"mb-1",children:n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:Q.map((I,Z)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:I.type==="added"?"rgba(34,197,94,0.1)":I.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:I.type==="added"?"var(--green)":I.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:I.type==="added"?"3px solid var(--green)":I.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:I.type==="added"?"+":I.type==="removed"?"-":" "}),I.content]},Z))}),n.jsx(pS,{changes:A,selections:T,currentEvals:z,onToggle:f,onSelectAll:h,onDeselectAll:x}),C&&n.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:[n.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),n.jsx("button",{onClick:m,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:d,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function hS(a,r){const[i,o]=g.useState([]),[d,p]=g.useState("SKILL.md"),[f,h]=g.useState(null),[x,m]=g.useState(!1),[y,v]=g.useState(null),j=g.useCallback(async()=>{try{const A=await Ee.getSkillFiles(a,r);o(A.files)}catch{o([])}},[a,r]);g.useEffect(()=>{p("SKILL.md"),h(null),v(null),j()},[a,r,j]);const S=g.useCallback(async A=>{if(p(A),A==="SKILL.md"){h(null),v(null);return}m(!0),v(null);try{const T=await Ee.getSkillFile(a,r,A);h(T)}catch(T){v(`Unable to open file: ${T.message}`),h(null)}finally{m(!1)}},[a,r]),k=g.useCallback(()=>{j()},[j]);return{files:i,activeFile:d,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:k,isSkillMd:d==="SKILL.md"}}function xS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function gS(a){const r=[],i=new Map;for(const o of a){const d=o.path.split("/"),f={name:d[d.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const d=o.path.split("/");if(d.length===1){const p=i.get(o.path);p&&r.push(p)}else{const p=d.slice(0,-1).join("/"),f=i.get(p),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function rv({expanded:a}){return n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function sv(){return n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.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 vS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function yS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"23 4 23 10 17 10"}),n.jsx("polyline",{points:"1 20 1 14 7 14"}),n.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 iv({node:a,depth:r,activeFile:i,onSelect:o}){const[d,p]=g.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>p(!d),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*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:[n.jsx(rv,{expanded:d}),n.jsx(sv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),d&&a.children.map(h=>n.jsx(iv,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(vS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:xS(a.size)})]})}function bS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[d,p]=g.useState(!1),f=g.useMemo(()=>gS(a),[a]);return n.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>p(!d),children:[n.jsx(rv,{expanded:d}),n.jsx(sv,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},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:n.jsx(yS,{})})]}),d&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(iv,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Ki(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function jS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function SS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function Yx({content:a}){return n.jsx("textarea",{readOnly:!0,value:a,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 Fx({content:a,fileType:r}){if(r==="json"){const i=jS(a);return n.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:i})}return r==="md"?n.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:bo(a)}}):n.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:a})}function Wx(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function kS({file:a,loading:r,error:i,viewMode:o,plugin:d,skill:p,onSaved:f,onDirtyChange:h}){const[x,m]=g.useState(o),[y,v]=g.useState(!1),[j,S]=g.useState(""),[k,A]=g.useState(!1),[T,C]=g.useState(null),M=o!==x?o:x;g.useEffect(()=>{h==null||h(y)},[y,h]);const O=g.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),v(!0))},[a]),U=g.useCallback(()=>{v(!1)},[]),L=g.useCallback(async()=>{if(!(!d||!p||!a)){A(!0);try{await Ee.saveSkillFile(d,p,a.path,j),C("Saved"),v(!1),f==null||f(),setTimeout(()=>C(null),2e3)}catch(D){C(`Save failed: ${D.message}`),setTimeout(()=>C(null),3e3)}finally{A(!1)}}},[d,p,a,j,f]);if(g.useEffect(()=>{if(!y)return;const D=E=>{(E.ctrlKey||E.metaKey)&&E.key==="s"&&(E.preventDefault(),L())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[y,L]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",Ki(a.size),") — cannot be displayed"]});const V=a.content??"",w=SS(a.path);return n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[a.truncated&&n.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 ",Ki(512*1024)," — ",Ki(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(w==="md"||w==="json")&&["raw","split","preview"].map(D=>n.jsx("button",{onClick:()=>m(D),style:{padding:"2px 8px",fontSize:11,background:M===D?"var(--accent-muted)":"none",color:M===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Ki(a.size),d&&p&&!a.binary&&!y&&n.jsx("button",{onClick:O,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:L,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),n.jsx("button",{onClick:U,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),T&&n.jsx("div",{style:{padding:"4px 12px",background:T.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:T.startsWith("Save failed")?"var(--red)":"var(--green)"},children:T}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:D=>S(D.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}}),n.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:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:L,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),n.jsx("button",{onClick:U,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):M==="split"&&w!=="other"?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:n.jsx(Yx,{content:V})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:w==="json"?n.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:Wx(V)}}):n.jsx(Fx,{content:V,fileType:w})})]}):M==="preview"&&w!=="other"?w==="json"?n.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:Wx(V)}}):n.jsx(Fx,{content:V,fileType:w}):n.jsx(Yx,{content:V})})]})}function wS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function CS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function NS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function ES({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}function Qd({size:a=15}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function TS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=wn(),{plugin:d,skill:p,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:m}=a,[y,v]=g.useState("split"),[j,S]=g.useState(!1),k=g.useRef(null),[A,T]=g.useState(!1),[C,M]=g.useState(""),[O,U]=g.useState(!1),[L,V]=g.useState(null),[w,D]=g.useState([]),[E,B]=g.useState([]),[P,q]=g.useState(null),te=g.useRef(null),{config:Q}=bl(),{files:z,activeFile:R,secondaryContent:I,loading:Z,error:Y,selectFile:de,refresh:_,isSkillMd:W}=hS(d??"",p??""),[ie,ue]=g.useState(!1),ge=g.useCallback(ye=>{ie&&!window.confirm("You have unsaved changes. Discard?")||de(ye)},[ie,de]);g.useEffect(()=>()=>{var ye;(ye=te.current)==null||ye.abort()},[]);const{metadata:xe,body:we}=lS(f),oe=xe["allowed-tools"],Se=Array.isArray(oe)?oe:typeof oe=="string"?[oe]:[],De=xe.name,Ie=xe.description,ae=xe.metadata,pe=typeof ae=="object"&&!Array.isArray(ae)?ae:null,fe=xe.version||(pe==null?void 0:pe.version),he=xe.tags||(pe==null?void 0:pe.tags),ve=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ye=>ye.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),re=Object.entries(xe).filter(([ye])=>!_e.has(ye)),Te=g.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Qe=g.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&Te()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),r({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,Te,m,r]),at=g.useCallback(async()=>{var At,Le;if(!C.trim())return;(At=te.current)==null||At.abort();const ye=new AbortController;te.current=ye,U(!0),q(null),B([]),V(null),D([]);try{const gt=(Q==null?void 0:Q.provider)||"claude-cli",Kt=(Q==null?void 0:Q.model)||"sonnet",rt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:C,provider:gt,model:Kt}),signal:ye.signal});if(!rt.ok||!rt.body){let jt=`HTTP ${rt.status}`;try{const In=await rt.json();In.error&&(jt=In.error)}catch{}throw new Error(jt)}const Qa=rt.body.getReader(),Zn=new TextDecoder;let Nt="",kt="";for(;;){const{done:jt,value:In}=await Qa.read();if(jt)break;Nt+=Zn.decode(In,{stream:!0});const Za=Nt.split(`
|
|
66
|
+
`);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const d=i.length,p=o.length,f=Array.from({length:d+1},()=>new Array(p+1).fill(0));for(let y=1;y<=d;y++)for(let v=1;v<=p;v++)i[y-1]===o[v-1]?f[y][v]=f[y-1][v-1]+1:f[y][v]=Math.max(f[y-1][v],f[y][v-1]);const h=[];let x=d,m=p;for(;x>0||m>0;)x>0&&m>0&&i[x-1]===o[m-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,m--):m>0&&(x===0||f[x][m-1]>=f[x-1][m])?(h.push({type:"added",content:o[m-1]}),m--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function sS(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Ds({entries:a,isRunning:r}){const[i,o]=g.useState(!1),d=g.useRef(null);return g.useEffect(()=>{d.current&&!i&&(d.current.scrollTop=d.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),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:p=>{p.currentTarget.style.color="var(--text-primary)"},onMouseLeave:p=>{p.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:d,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((p,f)=>{const h=f===a.length-1&&r,x=f===0?"0s":`+${((p.timestamp-a[0].timestamp)/1e3).toFixed(1)}s`;return n.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[sS(p.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:p.message}),p.current!=null&&p.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",p.current,"/",p.total,"]"]})]},f)})})]})}function iS({plugin:a,skill:r,skillContent:i,onApplied:o}){const[d,p]=g.useState("closed"),{config:f}=bl(),[h,x]=g.useState("claude-cli"),[m,y]=g.useState("opus"),[v,j]=g.useState([]),[S,k]=g.useState(""),[A,T]=g.useState(""),[C,M]=g.useState(null),[O,U]=g.useState(null),[L,V]=g.useState([]),[w,D]=g.useState(!1),E=g.useRef(null);g.useEffect(()=>{if(!f)return;f.providers.find(I=>I.id==="claude-cli"&&I.available)&&(x("claude-cli"),y("opus"))},[f]),g.useEffect(()=>()=>{var R;(R=E.current)==null||R.abort()},[]);function B(){return f==null?void 0:f.providers.find(R=>R.id===h&&R.available)}const P=g.useCallback(()=>{var R;(R=E.current)==null||R.abort(),p("open")},[]);async function F(){p("loading"),M(null),U(null),V([]);const R=new AbortController;E.current=R;try{const I=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:m}),signal:R.signal});if(!I.ok||!I.body){let W=`HTTP ${I.status}`;try{const ie=await I.json();ie.error&&(W=ie.error)}catch{}throw new Error(W)}const Z=I.body.getReader(),q=new TextDecoder;let de="",_="";for(;;){const{done:W,value:ie}=await Z.read();if(W)break;de+=q.decode(ie,{stream:!0});const ue=de.split(`
|
|
67
|
+
`);de=ue.pop()||"";for(const ge of ue)if(ge.startsWith("event: "))_=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));_==="progress"?V(we=>[...we,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):_==="done"||_==="complete"?(k(xe.improved),T(xe.reasoning||""),j(jo(xe.original||i,xe.improved)),p("diff_shown")):_==="error"&&(M(xe.message||xe.description||"Unknown error"),xe.category&&U(xe),p("open"))}catch{}_=""}}}catch(I){I.name!=="AbortError"&&(M(I.message),p("open"))}finally{E.current=null}}async function te(){D(!0);try{await Ee.applyImprovement(a,r,S),o(S),p("closed")}catch(R){M(R.message)}finally{D(!1)}}function Q(){p("closed"),j([]),k(""),T(""),M(null)}if(d==="closed")return n.jsxs("button",{onClick:()=>p("open"),className:"btn btn-secondary mb-5",disabled:!i,children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const z=B();return n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.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:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),n.jsx("button",{onClick:Q,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:R=>{R.currentTarget.style.background="var(--surface-3)"},onMouseLeave:R=>{R.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-5 py-4",children:[(d==="open"||d==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:R=>{x(R.target.value);const I=f==null?void 0:f.providers.find(Z=>Z.id===R.target.value);I!=null&&I.models[0]&&y(I.models[0].id)},disabled:d==="loading",children:f==null?void 0:f.providers.filter(R=>R.available).map(R=>n.jsx("option",{value:R.id,children:R.label},R.id))})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:m,onChange:R=>y(R.target.value),disabled:d==="loading",children:z==null?void 0:z.models.map(R=>n.jsx("option",{value:R.id,children:R.label},R.id))})]}),d==="loading"?n.jsx("button",{onClick:P,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:F,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),d==="loading"&&L.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ds,{entries:L,isRunning:!0})})]}),C&&n.jsx("div",{className:"mb-4",children:O?n.jsx(Ls,{error:O,onRetry:F,onDismiss:()=>{M(null),U(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:C})}),d==="diff_shown"&&n.jsxs(n.Fragment,{children:[A&&n.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:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),A]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((R,I)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:R.type==="added"?"rgba(34,197,94,0.1)":R.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:R.type==="added"?"var(--green)":R.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:R.type==="added"?"3px solid var(--green)":R.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:R.type==="added"?"+":R.type==="removed"?"-":" "}),R.content]},I))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:te,disabled:w,className:"btn btn-primary",children:w?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),n.jsx("button",{onClick:Q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Gx={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"}},oS={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function cS({change:a,index:r,selected:i,onToggle:o,originalEval:d}){var v;const[p,f]=g.useState(!1),h=Gx[a.action]??Gx.add,x=oS[a.action]??"var(--border-subtle)",m=a.action==="remove"?(d==null?void 0:d.name)??`Eval #${a.evalId}`:((v=a.eval)==null?void 0:v.name)??"Unnamed",y=g.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:m}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!p),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-3)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:p?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),p&&n.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.action==="add"&&a.eval&&n.jsx(dS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&d&&n.jsx(uS,{original:d,proposed:a.eval}),a.action==="remove"&&d&&n.jsx(fS,{evalCase:d})]})]})}function dS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(Su,{label:"Prompt",value:a.prompt}),n.jsx(Su,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function uS({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],d=r.assertions??[],p=new Set(o.map(m=>m.text)),f=new Set(d.map(m=>m.text)),h=d.filter(m=>!p.has(m.text)),x=o.filter(m=>!f.has(m.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(m=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:m.label}),n.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[n.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",ku(m.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",ku(m.new,120)]})]})]},m.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",m.text]},m.id)),h.map(m=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",m.text]},m.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function fS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(Su,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function Su({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.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:ku(r,300)})]})}function ku(a,r){return a.length>r?a.slice(0,r)+"...":a}const Fx={remove:0,modify:1,add:2};function pS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:d,onDeselectAll:p}){if(a.length===0)return null;const f=a.map((x,m)=>({change:x,originalIndex:m}));f.sort((x,m)=>(Fx[x.change.action]??2)-(Fx[m.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:d,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:p,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:m})=>n.jsx(cS,{change:x,index:m,selected:r.get(m)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},m))})]})}function mS(){var R;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:d,cancelAiEdit:p,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:m}=wn(),{aiEditLoading:y,aiEditResult:v,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:k,aiEditEvalChanges:A,aiEditEvalSelections:T,aiEditEvalsRetry:C}=a,[M,O]=g.useState(""),{config:U}=bl(),[L,V]=g.useState("claude-cli"),[w,D]=g.useState("opus"),E=g.useRef(null);g.useEffect(()=>{var I;(I=E.current)==null||I.focus()},[]),g.useEffect(()=>{if(!U)return;U.providers.find(Z=>Z.id==="claude-cli"&&Z.available)&&(V("claude-cli"),D("opus"))},[U]);const B=U==null?void 0:U.providers.find(I=>I.id===L&&I.available),P=g.useCallback(()=>{const I=M.trim();!I||y||i(I,L,w)},[M,y,i,L,w]),F=g.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P()),I.key==="Escape"&&(I.preventDefault(),y?p():d())},[P,y,p,d]),te=g.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),Q=v?jo(a.skillContent,v.improved):[],z=((R=a.evals)==null?void 0:R.evals)??[];return n.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),n.jsx("button",{onClick:d,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:I=>{I.currentTarget.style.background="var(--surface-3)"},onMouseLeave:I=>{I.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-4 py-3",children:[!v&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-2.5",children:[n.jsx("div",{className:"flex-1",children:n.jsx("textarea",{ref:E,value:M,onChange:I=>O(I.target.value),onKeyDown:F,placeholder:"e.g., Add an error handling section...",disabled:y,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:I=>{const Z=I.currentTarget;Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,96)+"px"}})}),n.jsxs("div",{style:{minWidth:100},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:L,onChange:I=>{V(I.target.value);const Z=U==null?void 0:U.providers.find(q=>q.id===I.target.value);Z!=null&&Z.models[0]&&D(Z.models[0].id)},disabled:y,style:{width:"100%"},children:U==null?void 0:U.providers.filter(I=>I.available).map(I=>n.jsx("option",{value:I.id,children:I.label},I.id))})]}),n.jsxs("div",{style:{minWidth:80},children:[n.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsx("select",{className:"input-field text-[11px] py-1",value:w,onChange:I=>D(I.target.value),disabled:y,style:{width:"100%"},children:B==null?void 0:B.models.map(I=>n.jsx("option",{value:I.id,children:I.label},I.id))})]}),y?n.jsx("button",{onClick:p,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:P,disabled:!M.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ds,{entries:k,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(Ls,{error:S,onRetry:te,onDismiss:d}):n.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j})}),v&&n.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&n.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:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),n.jsx("div",{className:"mb-1",children:n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:Q.map((I,Z)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:I.type==="added"?"rgba(34,197,94,0.1)":I.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:I.type==="added"?"var(--green)":I.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:I.type==="added"?"3px solid var(--green)":I.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:I.type==="added"?"+":I.type==="removed"?"-":" "}),I.content]},Z))}),n.jsx(pS,{changes:A,selections:T,currentEvals:z,onToggle:f,onSelectAll:h,onDeselectAll:x}),C&&n.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:[n.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),n.jsx("button",{onClick:m,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:d,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function hS(a,r){const[i,o]=g.useState([]),[d,p]=g.useState("SKILL.md"),[f,h]=g.useState(null),[x,m]=g.useState(!1),[y,v]=g.useState(null),j=g.useCallback(async()=>{try{const A=await Ee.getSkillFiles(a,r);o(A.files)}catch{o([])}},[a,r]);g.useEffect(()=>{p("SKILL.md"),h(null),v(null),j()},[a,r,j]);const S=g.useCallback(async A=>{if(p(A),A==="SKILL.md"){h(null),v(null);return}m(!0),v(null);try{const T=await Ee.getSkillFile(a,r,A);h(T)}catch(T){v(`Unable to open file: ${T.message}`),h(null)}finally{m(!1)}},[a,r]),k=g.useCallback(()=>{j()},[j]);return{files:i,activeFile:d,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:k,isSkillMd:d==="SKILL.md"}}function xS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function gS(a){const r=[],i=new Map;for(const o of a){const d=o.path.split("/"),f={name:d[d.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const d=o.path.split("/");if(d.length===1){const p=i.get(o.path);p&&r.push(p)}else{const p=d.slice(0,-1).join("/"),f=i.get(p),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function rv({expanded:a}){return n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function sv(){return n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.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 vS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function yS(){return n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"23 4 23 10 17 10"}),n.jsx("polyline",{points:"1 20 1 14 7 14"}),n.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 iv({node:a,depth:r,activeFile:i,onSelect:o}){const[d,p]=g.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>p(!d),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*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:[n.jsx(rv,{expanded:d}),n.jsx(sv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),d&&a.children.map(h=>n.jsx(iv,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(vS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:xS(a.size)})]})}function bS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[d,p]=g.useState(!1),f=g.useMemo(()=>gS(a),[a]);return n.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>p(!d),children:[n.jsx(rv,{expanded:d}),n.jsx(sv,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},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:n.jsx(yS,{})})]}),d&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(iv,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Ki(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function jS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function SS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function qx({content:a}){return n.jsx("textarea",{readOnly:!0,value:a,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 Yx({content:a,fileType:r}){if(r==="json"){const i=jS(a);return n.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:i})}return r==="md"?n.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:bo(a)}}):n.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:a})}function Wx(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function kS({file:a,loading:r,error:i,viewMode:o,plugin:d,skill:p,onSaved:f,onDirtyChange:h}){const[x,m]=g.useState(o),[y,v]=g.useState(!1),[j,S]=g.useState(""),[k,A]=g.useState(!1),[T,C]=g.useState(null),M=o!==x?o:x;g.useEffect(()=>{h==null||h(y)},[y,h]);const O=g.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),v(!0))},[a]),U=g.useCallback(()=>{v(!1)},[]),L=g.useCallback(async()=>{if(!(!d||!p||!a)){A(!0);try{await Ee.saveSkillFile(d,p,a.path,j),C("Saved"),v(!1),f==null||f(),setTimeout(()=>C(null),2e3)}catch(D){C(`Save failed: ${D.message}`),setTimeout(()=>C(null),3e3)}finally{A(!1)}}},[d,p,a,j,f]);if(g.useEffect(()=>{if(!y)return;const D=E=>{(E.ctrlKey||E.metaKey)&&E.key==="s"&&(E.preventDefault(),L())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[y,L]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",Ki(a.size),") — cannot be displayed"]});const V=a.content??"",w=SS(a.path);return n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[a.truncated&&n.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 ",Ki(512*1024)," — ",Ki(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(w==="md"||w==="json")&&["raw","split","preview"].map(D=>n.jsx("button",{onClick:()=>m(D),style:{padding:"2px 8px",fontSize:11,background:M===D?"var(--accent-muted)":"none",color:M===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Ki(a.size),d&&p&&!a.binary&&!y&&n.jsx("button",{onClick:O,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:L,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),n.jsx("button",{onClick:U,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),T&&n.jsx("div",{style:{padding:"4px 12px",background:T.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:T.startsWith("Save failed")?"var(--red)":"var(--green)"},children:T}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:D=>S(D.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}}),n.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:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:L,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),n.jsx("button",{onClick:U,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):M==="split"&&w!=="other"?n.jsxs(n.Fragment,{children:[n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:n.jsx(qx,{content:V})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:w==="json"?n.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:Wx(V)}}):n.jsx(Yx,{content:V,fileType:w})})]}):M==="preview"&&w!=="other"?w==="json"?n.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:Wx(V)}}):n.jsx(Yx,{content:V,fileType:w}):n.jsx(qx,{content:V})})]})}function wS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function CS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),n.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function NS({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function ES({size:a=15}){return n.jsxs("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M15 4V2"}),n.jsx("path",{d:"M15 16v-2"}),n.jsx("path",{d:"M8 9h2"}),n.jsx("path",{d:"M20 9h2"}),n.jsx("path",{d:"M17.8 11.8L19 13"}),n.jsx("path",{d:"M15 9h.01"}),n.jsx("path",{d:"M17.8 6.2L19 5"}),n.jsx("path",{d:"M11 6.2L9.7 5"}),n.jsx("path",{d:"M3 21l9-9"})]})}function Qd({size:a=15}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function TS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=wn(),{plugin:d,skill:p,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:m}=a,[y,v]=g.useState("split"),[j,S]=g.useState(!1),k=g.useRef(null),[A,T]=g.useState(!1),[C,M]=g.useState(""),[O,U]=g.useState(!1),[L,V]=g.useState(null),[w,D]=g.useState([]),[E,B]=g.useState([]),[P,F]=g.useState(null),te=g.useRef(null),{config:Q}=bl(),{files:z,activeFile:R,secondaryContent:I,loading:Z,error:q,selectFile:de,refresh:_,isSkillMd:W}=hS(d??"",p??""),[ie,ue]=g.useState(!1),ge=g.useCallback(ye=>{ie&&!window.confirm("You have unsaved changes. Discard?")||de(ye)},[ie,de]);g.useEffect(()=>()=>{var ye;(ye=te.current)==null||ye.abort()},[]);const{metadata:xe,body:we}=lS(f),oe=xe["allowed-tools"],Se=Array.isArray(oe)?oe:typeof oe=="string"?[oe]:[],De=xe.name,Ie=xe.description,ae=xe.metadata,pe=typeof ae=="object"&&!Array.isArray(ae)?ae:null,fe=xe.version||(pe==null?void 0:pe.version),he=xe.tags||(pe==null?void 0:pe.tags),ve=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ye=>ye.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),re=Object.entries(xe).filter(([ye])=>!_e.has(ye)),Te=g.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Qe=g.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&Te()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),r({type:m?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,Te,m,r]),at=g.useCallback(async()=>{var At,Le;if(!C.trim())return;(At=te.current)==null||At.abort();const ye=new AbortController;te.current=ye,U(!0),F(null),B([]),V(null),D([]);try{const gt=(Q==null?void 0:Q.provider)||"claude-cli",Kt=(Q==null?void 0:Q.model)||"sonnet",rt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:C,provider:gt,model:Kt}),signal:ye.signal});if(!rt.ok||!rt.body){let jt=`HTTP ${rt.status}`;try{const In=await rt.json();In.error&&(jt=In.error)}catch{}throw new Error(jt)}const Qa=rt.body.getReader(),Zn=new TextDecoder;let Nt="",kt="";for(;;){const{done:jt,value:In}=await Qa.read();if(jt)break;Nt+=Zn.decode(In,{stream:!0});const Za=Nt.split(`
|
|
68
68
|
`);Nt=Za.pop()||"";for(const Hn of Za)if(Hn.startsWith("event: "))kt=Hn.slice(7).trim();else if(Hn.startsWith("data: ")){try{const $e=JSON.parse(Hn.slice(6));if(kt==="progress")B(Ht=>[...Ht,{phase:$e.phase,message:$e.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const Ht=["---"];$e.name&&Ht.push(`name: ${$e.name}`),$e.description&&Ht.push(`description: "${$e.description.replace(/"/g,'\\"')}"`),$e.model&&Ht.push(`model: ${$e.model}`),(Le=$e.allowedTools)!=null&&Le.trim()&&Ht.push(`allowed-tools: ${$e.allowedTools.trim()}`),Ht.push("---","",$e.body||"");const Jn=Ht.join(`
|
|
69
|
-
`);V(Jn),D(jo(f,Jn)),U(!1)}else kt==="error"&&(q($e.message||$e.description||"Generation failed"),U(!1))}catch{}kt=""}}}catch(gt){gt.name!=="AbortError"&&q(gt.message)}finally{U(!1),te.current=null}},[C,Q,f]),$t=g.useCallback(()=>{L&&r({type:"SET_CONTENT",content:L}),T(!1),V(null),D([]),M(""),B([])},[L,r]),Pt=g.useCallback(()=>{T(!1),V(null),D([]),M(""),B([]),q(null)},[]),lt=g.useCallback(()=>{var ye;A?((ye=te.current)==null||ye.abort(),Pt()):(m&&r({type:"CLOSE_AI_EDIT"}),T(!0))},[A,m,r,Pt]),St=[{mode:"raw",icon:n.jsx(wS,{}),label:"Editor"},{mode:"split",icon:n.jsx(CS,{}),label:"Split"},{mode:"preview",icon:n.jsx(NS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Qe,tabIndex:-1,children:[n.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:[n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:St.map(({mode:ye,icon:At,label:Le})=>n.jsxs("button",{onClick:()=>v(ye),title:Le,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ye?"var(--surface-4)":"transparent",color:y===ye?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ye?600:400,border:"none",cursor:"pointer"},children:[At,n.jsx("span",{style:{letterSpacing:"0.01em"},children:Le})]},ye))}),W?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m?r({type:"CLOSE_AI_EDIT"}):(A&&Pt(),r({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:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[n.jsx(ES,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:lt,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:A?600:400,border:"none",cursor:"pointer",color:A?"var(--purple)":"var(--text-tertiary)",background:A?"var(--purple-muted)":"transparent"},children:[n.jsx(Qd,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:Te,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),d&&p&&n.jsx(bS,{files:z,activeFile:R,onSelect:ge,onRefresh:_}),!W&&n.jsx(kS,{file:I,loading:Z,error:Y,viewMode:y,plugin:d??void 0,skill:p??void 0,onSaved:()=>{de(R),_()},onDirtyChange:ue}),W&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:k,value:f,onChange:ye=>{o||r({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:Qe,spellCheck:!1,readOnly:o,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:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(De||fe||Ie)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[De&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:De}),fe&&n.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",fe]})]}),Ie&&n.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:Ie})]}),ve.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ve.map(ye=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ye},ye))}),Se.length>0&&n.jsx("div",{style:{marginBottom:16},children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Se.map(ye=>n.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:ye},ye))]})}),re.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:re.map(([ye,At],Le)=>{const gt=Array.isArray(At)?At.join(", "):typeof At=="object"?Object.entries(At).map(([Kt,rt])=>`${Kt}: ${Array.isArray(rt)?rt.join(", "):rt}`).join(" | "):At;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Le>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:gt})]},ye)})}),(De||Ie||ve.length>0||Se.length>0||re.length>0)&&we&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),we&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:bo(we)}})]})})]}),W&&m&&n.jsx(mS,{}),W&&A&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Qd,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),n.jsx("div",{className:"flex gap-2 mb-2",children:n.jsx("textarea",{value:C,onChange:ye=>M(ye.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:O,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:O?.5:1},onKeyDown:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&C.trim()&&!O&&(ye.preventDefault(),at())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[O?n.jsx("button",{onClick:()=>{var ye;(ye=te.current)==null||ye.abort(),U(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:at,disabled:!C.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:Pt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),O&&E.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ds,{entries:E,isRunning:!0})}),P&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[P,n.jsx("button",{onClick:at,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Qd,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:w.map((ye,At)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ye.type==="added"?"var(--green-muted)":ye.type==="removed"?"var(--red-muted)":"transparent",color:ye.type==="added"?"var(--green)":ye.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ye.type==="added"?"3px solid var(--green)":ye.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},At))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:$t,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:Pt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),W&&x!==null&&d&&p&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(iS,{plugin:d,skill:p,skillContent:f,onApplied:ye=>{r({type:"SET_CONTENT",content:ye}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function ov(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function cv(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const RS=new Set(["benchmark","comparison","baseline"]);function Kx(a,r,i,o){return a.map(({rate:d,idx:p,total:f})=>{const h=o+p/(f-1)*(r-o*2),x=o+(i-o*2)-d*(i-o*2);return`${h},${x}`})}function dv({entries:a}){const r=a.filter(v=>RS.has(v.type)).slice().reverse(),i=r.map((v,j,S)=>({rate:v.pass_rate,idx:j,total:S.length})).filter((v,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((v,j)=>v.type==="baseline"?[{rate:v.pass_rate,idx:j,total:r.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const d=80,p=24,f=2,h=i.length>=2?Kx(i,d,p,f):[],x=o.length>=2?Kx(o,d,p,f):[],m=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:d,height:p,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),m&&n.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function uv(a,r,i){const o=isNaN(r)?0:r,d=[],p=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const m=d.length>0?` Met criteria: ${d.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(a==="FAIL"||a==="DEGRADING"){const m=p.length>0?` Failed criteria: ${p.map(v=>v.criterion).join(", ")}.`:"",y=[...p.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...f.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...p.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...p.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(a==="MARGINAL"){const m=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(d.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(a==="EMERGING"){const m=[...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(d.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:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=d.length>0?` Passing: ${d.map(m=>m.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const fv={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function AS(a){return Object.hasOwn(fv,a)}function MS(a){return AS(a)?fv[a]:a}function zS(){const{state:a}=wn(),{plugin:r,skill:i}=a,[o,d]=g.useState([]),[p,f]=g.useState([]),[h,x]=g.useState(!0),[m,y]=g.useState(null),[v,j]=g.useState(new Set),[S,k]=g.useState({}),[A,T]=g.useState(null),[C,M]=g.useState(""),[O,U]=g.useState(!1),[L,V]=g.useState(""),[w,D]=g.useState(""),E=g.useCallback(async()=>{x(!0),y(null);try{const[z,R]=await Promise.all([Ee.getCredentials(r,i),Ee.getParams(r,i)]);d(z.credentials),f(R.params)}catch(z){y(z instanceof Error?z.message:"Failed to load parameters"),d([]),f([])}finally{x(!1)}},[r,i]);g.useEffect(()=>{E()},[E]);const B=g.useCallback(async(z,R)=>{U(!0),y(null);try{await Ee.setCredential(r,i,z,R),T(null),M(""),await E()}catch(I){y(I instanceof Error?I.message:`Failed to save ${z}`)}finally{U(!1)}},[r,i,E]),P=g.useCallback(async()=>{const z=L.trim().toUpperCase(),R=w.trim();if(!(!z||!R)){U(!0),y(null);try{await Ee.setCredential(r,i,z,R),V(""),D(""),await E()}catch(I){y(I instanceof Error?I.message:`Failed to add ${z}`)}finally{U(!1)}}},[r,i,L,w,E]),q=g.useCallback(async z=>{if(v.has(z)){j(R=>{const I=new Set(R);return I.delete(z),I}),k(R=>{const I={...R};return delete I[z],I});return}try{const I=(await Ee.getParamsRevealed(r,i,z)).params.find(Z=>Z.name===z);I!=null&&I.value&&(k(Z=>({...Z,[z]:I.value})),j(Z=>new Set(Z).add(z)))}catch{}},[r,i,v]),te=new Set(o.map(z=>z.name)),Q=[...o.map(z=>{const R=p.find(I=>I.name===z.name);return{name:z.name,status:z.status,maskedValue:(R==null?void 0:R.maskedValue)??""}}),...p.filter(z=>!te.has(z.name)).map(z=>({name:z.name,status:z.status,maskedValue:z.maskedValue}))];return n.jsxs("div",{className:"py-2 px-3",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),m&&n.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:m}),h&&Q.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&Q.length===0&&!m&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),Q.map(z=>n.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:z.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:z.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:z.status==="ready"?"var(--green)":"var(--red)"},children:z.status}),(z.maskedValue||z.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(z.name)?S[z.name]??z.maskedValue:z.maskedValue||"***",n.jsx("button",{onClick:()=>q(z.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(z.name)?"Hide":"Reveal"} value for ${z.name}`,children:v.has(z.name)?"hide":"show"})]}),A===z.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:C,onChange:R=>M(R.target.value),onKeyDown:R=>{R.key==="Enter"&&C.trim()&&B(z.name,C)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${z.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>B(z.name,C),disabled:O||!C.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{T(null),M("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{T(z.name),M("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},z.name)),n.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:L,onChange:z=>V(z.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:w,onChange:z=>D(z.target.value),onKeyDown:z=>{z.key==="Enter"&&L.trim()&&w.trim()&&P()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:P,disabled:O||!L.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:O?"not-allowed":"pointer"},children:"Add"})]})]})]})}function LS(a,r,i){const[o,d]=g.useState(null),[p,f]=g.useState(!1),h=g.useRef("");g.useEffect(()=>{const m=`${a}/${r}/${i}`;h.current!==m&&(h.current=m,f(!0),Ee.getCaseHistory(a,r,i).then(y=>d(y)).catch(()=>d([])).finally(()=>f(!1)))},[a,r,i]);const x=g.useCallback(()=>{f(!0),h.current="",Ee.getCaseHistory(a,r,i).then(m=>d(m)).catch(()=>d([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:p,refetch:x}}function DS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const p=i.slice(0,10).map(x=>x.assertions.find(m=>m.id===a)).filter(Boolean);if(p.length>=2){const m=p.filter(y=>y.pass).length/p.length;m>=.3&&m<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),m=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const m=i[0].assertions.find(y=>y.id===a);m!=null&&m.pass&&(o.regression=!0)}return o}function _S(){var Z;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:d,cancelCase:p,cancelAll:f,generateEvals:h,isReadOnly:x}=wn(),{evals:m,evalsError:y,selectedCaseId:v,inlineResults:j,caseRunStates:S,generateEvalsLoading:k,generateEvalsProgress:A,generateEvalsError:T}=a,C=g.useMemo(()=>{for(const Y of S.values())if(Y.status==="running"||Y.status==="queued")return!0;return!1},[S]),[M,O]=g.useState(!1),[U,L]=g.useState("all"),V={skill_name:a.skill,evals:[]},w=m??V,D=w.evals,E=g.useMemo(()=>U==="all"?D:D.filter(Y=>or(Y)===U),[U,D]),B=E.find(Y=>Y.id===v)??null;g.useEffect(()=>{v!==null&&!E.find(Y=>Y.id===v)&&r({type:"SELECT_CASE",caseId:E.length>0?E[0].id:null})},[E,v,r]);const[P,q]=g.useState([]),te=g.useMemo(()=>D.some(Y=>or(Y)==="integration"),[D]);g.useEffect(()=>{te&&Ee.getCredentials(a.plugin,a.skill).then(Y=>q(Y.credentials)).catch(()=>q([]))},[a.plugin,a.skill,te]);const Q=g.useMemo(()=>new Set(P.filter(Y=>Y.status==="missing").map(Y=>Y.name)),[P]),[z,R]=g.useState(!1),I=g.useCallback(Y=>{R(!1),h(Y?{testType:Y}:void 0)},[h]);return!m||D.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.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:y}),n.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"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>O(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>I("unit"),disabled:k||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),n.jsx("button",{onClick:()=>R(!z),disabled:k||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),z&&n.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:n.jsx("button",{onClick:()=>I("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.background="var(--surface-2)"},onMouseLeave:Y=>{Y.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&A.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ds,{entries:A,isRunning:!0})}),T&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ls,{error:T,onRetry:()=>I()})}),M&&n.jsx(Xx,{evals:w,onSave:Y=>{i(Y),O(!1)},onCancel:()=>O(!1)})]}):n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[n.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",E.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:C?n.jsx("button",{onClick:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>d("benchmark"),disabled:E.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>d("comparison"),disabled:E.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(Y=>n.jsx("button",{onClick:()=>L(Y),style:{padding:"2px 8px",fontSize:10,fontWeight:U===Y?600:400,background:U===Y?"var(--accent-muted)":"transparent",color:U===Y?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Y==="all"?`All (${D.length})`:Y==="unit"?`Unit (${D.filter(de=>or(de)==="unit").length})`:`Integration (${D.filter(de=>or(de)==="integration").length})`},Y))}),n.jsxs("div",{className:"py-1",children:[E.length===0&&D.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",U==="all"?"":U+" ","tests yet"]}),E.map(Y=>{var ie;const de=j.get(Y.id),_=v===Y.id,W=or(Y);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:Y.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:_?"var(--accent-muted)":"transparent",borderLeft:_?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:ue=>{_||(ue.currentTarget.style.background="var(--surface-2)")},onMouseLeave:ue=>{_||(ue.currentTarget.style.background="transparent")},children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:_?"var(--text-primary)":"var(--text-secondary)"},children:["#",Y.id," ",Y.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:W==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:W==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:W==="unit"?"U":"I"}),W==="integration"&&((ie=Y.requiredCredentials)==null?void 0:ie.some(ue=>Q.has(ue)))&&n.jsx("span",{title:"Configure credentials to run",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),n.jsx(pv,{result:de})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[Y.assertions.length," assertion",Y.assertions.length!==1?"s":"",(de==null?void 0:de.passRate)!=null&&n.jsx(IS,{passRate:de.passRate})]})]},Y.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>O(!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:Y=>{Y.currentTarget.style.borderColor="var(--accent)",Y.currentTarget.style.color="var(--accent)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-default)",Y.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(zS,{})})]}),n.jsx("div",{className:"overflow-auto",children:B?n.jsx(OS,{evalCase:B,result:j.get(B.id),evals:m,caseStatus:((Z=S.get(B.id))==null?void 0:Z.status)??"idle",onSaveEvals:i,onRun:Y=>o(Y,"benchmark"),onCompare:Y=>o(Y,"comparison"),onCancel:Y=>p(Y),onImprove:Y=>r({type:"OPEN_IMPROVE",evalId:Y})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),M&&n.jsx(Xx,{evals:w,onSave:Y=>{i(Y),O(!1)},onCancel:()=>O(!1)})]})}function OS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:d,onRun:p,onCompare:f,onCancel:h,onImprove:x}){const{state:m,isReadOnly:y}=wn(),{plugin:v,skill:j}=m,{entries:S,loading:k}=LS(v,j,a.id),[A,T]=g.useState(!1),[C,M]=g.useState(a.prompt),[O,U]=g.useState(!1),[L,V]=g.useState(a.expected_output);g.useState(()=>{M(a.prompt),V(a.expected_output)});const w=g.useCallback(Y=>{d({...i,evals:i.evals.map(de=>de.id===Y.id?Y:de)})},[i,d]),D=g.useCallback(()=>{w({...a,prompt:C}),T(!1)},[a,C,w]),E=g.useCallback(()=>{w({...a,expected_output:L}),U(!1)},[a,L,w]),B=g.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),P=g.useCallback((Y,de)=>{w({...a,assertions:a.assertions.map(_=>_.id===Y?{..._,text:de}:_)})},[a,w]),q=g.useCallback(Y=>{w({...a,assertions:a.assertions.filter(de=>de.id!==Y)})},[a,w]),te=g.useCallback(()=>{confirm("Delete this test case?")&&d({...i,evals:i.evals.filter(Y=>Y.id!==a.id)})},[i,a.id,d]),Q=r&&r.assertions.length>0&&r.assertions.every(Y=>Y.pass),z=r&&r.assertions.some(Y=>!Y.pass),R=or(a),I=a.requiredCredentials??[],Z=R==="integration"&&I.length>0;return n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",a.id," ",a.name]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:R==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:R==="unit"?"var(--accent)":"var(--orange)"},children:R==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((R==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:de,requirements:_,cleanup:W,...ie}=a;w({...ie,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${R==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:R==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:R==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:R==="unit"?"Unit":"Integration"}),n.jsx(pv,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>p(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),z&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.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"})]})})]})]}),y&&R==="integration"&&n.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 var(--accent-muted)"},children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),Q&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),Z&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:I.map(Y=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:Y},Y))})]}),!y&&R==="integration"&&n.jsx(VS,{evalCase:a,onUpdate:w}),n.jsx(Xi,{title:"Prompt",children:A?n.jsxs("div",{children:[n.jsx("textarea",{value:C,onChange:Y=>M(Y.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:D,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{M(a.prompt),T(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.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:y?"default":"pointer"},onClick:()=>{y||T(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Xi,{title:"Expected Output",children:O?n.jsxs("div",{children:[n.jsx("textarea",{value:L,onChange:Y=>V(Y.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:E,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{V(a.expected_output),U(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.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:y?"default":"pointer"},onClick:()=>{y||U(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Xi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:B,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(Y=>{const de=r==null?void 0:r.assertions.find(W=>W.assertion_id===Y.id),_=DS(Y.id,de,S);return n.jsx(BS,{assertion:Y,result:de,badges:_,isReadOnly:y,onUpdate:W=>P(Y.id,W),onDelete:()=>q(Y.id)},Y.id)})})}),(r==null?void 0:r.output)&&n.jsx(HS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const Y=uv("INEFFECTIVE",r.passRate);return Y.recommendations&&Y.recommendations.length>0?n.jsx(Xi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:Y.recommendations.map((de,_)=>n.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),de]},_))})]})}):null})(),n.jsx(US,{evalId:a.id,sharedEntries:S,sharedLoading:k})]},a.id)}function BS({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:d,onDelete:p}){const[f,h]=g.useState(!1),[x,m]=g.useState(a.text),[y,v]=g.useState(!1),j=()=>{d(x),h(!1)};return n.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:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.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"}),(i==null?void 0:i.regression)&&n.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:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.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:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.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."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>m(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(m(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:p,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Xi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function pv({result:a}){const[r,i]=g.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",d=a.passRate??0,f=uv(o?"PASS":"FAIL",d);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.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:f.explanation})]})}function IS({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function HS({output:a,durationMs:r,tokens:i}){const[o,d]=g.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>d(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.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:a})]})}function Zd(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Jd({entry:a}){return n.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:ov(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:cv(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",d=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:d},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function US({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:d}=wn(),{plugin:p,skill:f}=o,[h,x]=g.useState(!0),m=r??null,y=i??!1,v=g.useCallback(()=>{x(A=>!A)},[]),j=m?m.slice(0,10):[],S=j.some(A=>{const T=Zd(A.type);return T==="left"||T==="full"}),k=j.some(A=>{const T=Zd(A.type);return T==="right"||T==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:v,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:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",m&&m.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!m||m.length===0?n.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):n.jsxs("div",{children:[j.length>=2&&n.jsx("div",{className:"mb-2",children:n.jsx(dv,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((A,T)=>{const C=Zd(A.type);return C==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Jd,{entry:A})},T):C==="left"?n.jsxs(g.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Jd,{entry:A})}),n.jsx("div",{style:{gridColumn:"2"}})]},T):n.jsxs(g.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Jd,{entry:A})})]},T)})]}),n.jsx("button",{onClick:()=>d({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:A=>{A.currentTarget.style.textDecoration="underline"},onMouseLeave:A=>{A.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Xx({evals:a,onSave:r,onCancel:i}){const[o,d]=g.useState(""),[p,f]=g.useState(""),[h,x]=g.useState(""),[m,y]=g.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,j]=g.useState("unit"),[S,k]=g.useState(""),[A,T]=g.useState([]),[C,M]=g.useState(""),[O,U]=g.useState(""),L=Math.max(0,...a.evals.map(E=>E.id))+1,V=E=>{j(E),E==="unit"&&(T([]),k(""),M(""),U(""))},w=()=>{const E=S.trim().toUpperCase();E&&!A.includes(E)&&T([...A,E]),k("")},D=()=>{if(!o.trim()||!p.trim())return;const E={id:L,name:o.trim(),prompt:p.trim(),expected_output:h.trim(),files:[],assertions:m.filter(B=>B.text.trim()),...v==="integration"?{testType:"integration",...A.length>0?{requiredCredentials:A}:{},...C||O?{requirements:{...C?{platform:C}:{},...O?{chromeProfile:O}:{}}}:{}}:{}};r({...a,evals:[...a.evals,E]})};return n.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:n.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:[n.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),n.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(E=>n.jsx("button",{onClick:()=>V(E),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===E?E==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===E?E==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:E},E))})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),n.jsx("input",{value:o,onChange:E=>d(E.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),n.jsx("textarea",{value:p,onChange:E=>f(E.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:E=>x(E.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((E,B)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:E.text,onChange:P=>y(m.map((q,te)=>te===B?{...q,text:P.target.value}:q)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&n.jsx("button",{onClick:()=>y(m.filter((P,q)=>q!==B)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},E.id)),n.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:A.map(E=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[E,n.jsx("button",{onClick:()=>T(A.filter(B=>B!==E)),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},E))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:E=>k(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),w())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:w,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:C,onChange:E=>M(E.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:O,onChange:E=>U(E.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:i,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsx("button",{onClick:D,disabled:!o.trim()||!p.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function VS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=g.useState(""),d=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},p=x=>{const m=(a.requiredCredentials??[]).filter(y=>y!==x);r({...a,requiredCredentials:m.length>0?m:void 0})};return n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(a.requiredCredentials??[]).map(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>p(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),d())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:d,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function kn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function mv(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function $S(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function PS(a,r){let i="";if(r){const d=new Date(r);isNaN(d.getTime())||(i=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function GS(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const d=Math.round(Math.abs(a)*r);if(d===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const p=a>0?"more":"fewer";return`Your skill passes ${d} ${p} assertions across ${i} ${o}`}function Qx(a,r){const i=o=>{const d=o/5*100;return isFinite(d)?Math.round(Math.min(100,Math.max(0,d))):0};return{skill:i(a),baseline:i(r)}}function qS(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function YS(a,r){const i=a+r,o=i*10,d=i*25,p=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${p(o)}–${p(d)}`}const FS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function WS(a,r){if(!a)return null;const i=FS[a];if(i==null||i===0)return null;const o=i*r*.5,d=i*r*2;return`${kn(o)}–${kn(d)}`}function KS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:d,isReadOnly:p}=wn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:m,inlineResults:y}=a,{config:v}=bl(),j=(f==null?void 0:f.evals)??[],S=g.useMemo(()=>{for(const w of h.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[h]),k=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,A=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="running"||D.status==="queued")}).length,T=g.useRef(null),[C,M]=g.useState(0);g.useEffect(()=>{if(S&&!T.current&&(T.current=Date.now()),!S){T.current=null,M(0);return}const w=setInterval(()=>{T.current&&M(Math.round((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const O=j.reduce((w,D)=>w+D.assertions.length,0),U=j.length+O,L=g.useMemo(()=>YS(j.length,O),[j.length,O]),V=g.useMemo(()=>WS((v==null?void 0:v.provider)??null,U),[v==null?void 0:v.provider,U]);return n.jsxs("div",{className:"p-5",children:[p&&n.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:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),n.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[A," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:d,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||p,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"}),n.jsx("button",{onClick:()=>i("benchmark"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),n.jsx("button",{onClick:()=>i("baseline"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",L]}),V&&n.jsxs("span",{children:["Est. cost: ",V]}),!V&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!V&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",k,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/j.length*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${k/j.length*100}%`,background:"var(--accent)"}})}),n.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",C>=60?`${Math.floor(C/60)}m ${C%60}s`:`${C}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",L]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const D=y.get(w.id),E=h.get(w.id),B=(E==null?void 0:E.status)??"idle",P=m==null?void 0:m.cases.find(q=>q.eval_id===w.id);return n.jsx(QS,{name:w.name,evalId:w.id,result:D,caseCost:P==null?void 0:P.cost,caseBillingMode:P==null?void 0:P.billingMode,caseInputTokens:P==null?void 0:P.inputTokens,caseOutputTokens:P==null?void 0:P.outputTokens,caseStatus:B,runMode:(E==null?void 0:E.mode)??null,comparisonDetail:P==null?void 0:P.comparisonDetail,isReadOnly:p,onRun:q=>r(q,"benchmark"),onBaseline:q=>r(q,"baseline"),onCompare:q=>r(q,"comparison"),onCancel:q=>o(q)},w.id)})}),!S&&m&&m.cases.length>0&&n.jsxs("div",{className:"mt-5",children:[n.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:$S(m.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${mv(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${kn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||p,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:j.length===0?.5:1},children:"Run Final A/B Comparison"})]}),m.comparison&&n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const w=PS(m.model,m.timestamp);return w?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:w}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(Zx,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Zx,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${MS(m.verdict)}`]}),(()=>{const w=m.cases.reduce((E,B)=>E+B.assertions.length,0),D=GS(m.comparison.delta,w,m.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const XS={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:"var(--purple-muted)",color:"var(--purple)"}};function QS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:d,caseInputTokens:p,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:m,isReadOnly:y,onRun:v,onBaseline:j,onCompare:S,onCancel:k}){const[A,T]=g.useState(!1),C=h==="running"||h==="queued",M=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:C?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:C?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(C||M)&&(()=>{const O=XS[x];return O?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:O.bg,color:O.color,padding:"1px 6px"},children:O.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[C?n.jsx("button",{onClick:()=>k(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>v(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),p!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:mv(p,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:kn(o,d)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(O=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:O.pass?"var(--green)":"var(--red)"},children:O.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:O.text})]},O.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>T(!A),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:A?"Hide output":"Show output"}),A&&i.output&&n.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:i.output})]}),m&&n.jsx("div",{className:"px-4 pb-3",children:n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const O=Qx(m.skillContentScore,m.baselineContentScore),U=Qx(m.skillStructureScore,m.baselineStructureScore),L=qS(m.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",O.skill,"% / Baseline ",O.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",U.skill,"% / Baseline ",U.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:L.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:L.text})]})})()})})}),i&&i.errorMessage&&n.jsx(ZS,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const eu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function ZS({errorMessage:a,classifiedError:r}){const[i,o]=g.useState(!1),d=(r==null?void 0:r.title)??"Error",p=r==null?void 0:r.hint,f=r?eu[r.category]??eu.unknown:eu.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:d}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),p&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:p}),i&&n.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:a})]})})}function Zx({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Jx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"var(--green-muted)",text:"var(--green)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"var(--red-muted)",text:"var(--red)"}};function JS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:d}=wn(),{plugin:p,skill:f,activationPrompts:h,activationResults:x,activationSummary:m,activationRunning:y,activationError:v,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:k,generatingPromptsError:A,activationHistory:T}=a,[C,M]=g.useState(h),[O,U]=g.useState(null),[L,V]=g.useState(!1);g.useEffect(()=>{h&&h!==C&&M(h)},[h]),g.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:C})},[C,r]),g.useEffect(()=>{fetch(`/api/skills/${p}/${f}/description`).then(z=>z.json()).then(z=>U(z.rawContent||z.description||null)).catch(()=>U(null))},[p,f]);function w(){i(C)}function D(){d(8)}const E=C.trim().split(`
|
|
70
|
-
`).filter(Boolean).length,B=x.filter(z=>z.classification==="TP"||z.classification==="TN"),P=x.filter(z=>z.classification==="FP"||z.classification==="FN"),
|
|
69
|
+
`);V(Jn),D(jo(f,Jn)),U(!1)}else kt==="error"&&(F($e.message||$e.description||"Generation failed"),U(!1))}catch{}kt=""}}}catch(gt){gt.name!=="AbortError"&&F(gt.message)}finally{U(!1),te.current=null}},[C,Q,f]),$t=g.useCallback(()=>{L&&r({type:"SET_CONTENT",content:L}),T(!1),V(null),D([]),M(""),B([])},[L,r]),Pt=g.useCallback(()=>{T(!1),V(null),D([]),M(""),B([]),F(null)},[]),lt=g.useCallback(()=>{var ye;A?((ye=te.current)==null||ye.abort(),Pt()):(m&&r({type:"CLOSE_AI_EDIT"}),T(!0))},[A,m,r,Pt]),St=[{mode:"raw",icon:n.jsx(wS,{}),label:"Editor"},{mode:"split",icon:n.jsx(CS,{}),label:"Split"},{mode:"preview",icon:n.jsx(NS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Qe,tabIndex:-1,children:[n.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:[n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:St.map(({mode:ye,icon:At,label:Le})=>n.jsxs("button",{onClick:()=>v(ye),title:Le,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ye?"var(--surface-4)":"transparent",color:y===ye?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ye?600:400,border:"none",cursor:"pointer"},children:[At,n.jsx("span",{style:{letterSpacing:"0.01em"},children:Le})]},ye))}),W?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{m?r({type:"CLOSE_AI_EDIT"}):(A&&Pt(),r({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:m?600:400,border:"none",cursor:"pointer",color:m?"var(--purple)":"var(--text-tertiary)",background:m?"var(--purple-muted)":"transparent"},children:[n.jsx(ES,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:lt,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:A?600:400,border:"none",cursor:"pointer",color:A?"var(--purple)":"var(--text-tertiary)",background:A?"var(--purple-muted)":"transparent"},children:[n.jsx(Qd,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:Te,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),d&&p&&n.jsx(bS,{files:z,activeFile:R,onSelect:ge,onRefresh:_}),!W&&n.jsx(kS,{file:I,loading:Z,error:q,viewMode:y,plugin:d??void 0,skill:p??void 0,onSaved:()=>{de(R),_()},onDirtyChange:ue}),W&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:k,value:f,onChange:ye=>{o||r({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:Qe,spellCheck:!1,readOnly:o,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:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(De||fe||Ie)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[De&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:De}),fe&&n.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",fe]})]}),Ie&&n.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:Ie})]}),ve.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ve.map(ye=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ye},ye))}),Se.length>0&&n.jsx("div",{style:{marginBottom:16},children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),Se.map(ye=>n.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:ye},ye))]})}),re.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:re.map(([ye,At],Le)=>{const gt=Array.isArray(At)?At.join(", "):typeof At=="object"?Object.entries(At).map(([Kt,rt])=>`${Kt}: ${Array.isArray(rt)?rt.join(", "):rt}`).join(" | "):At;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Le>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:gt})]},ye)})}),(De||Ie||ve.length>0||Se.length>0||re.length>0)&&we&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),we&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:bo(we)}})]})})]}),W&&m&&n.jsx(mS,{}),W&&A&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Qd,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),n.jsx("div",{className:"flex gap-2 mb-2",children:n.jsx("textarea",{value:C,onChange:ye=>M(ye.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:O,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:O?.5:1},onKeyDown:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&C.trim()&&!O&&(ye.preventDefault(),at())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[O?n.jsx("button",{onClick:()=>{var ye;(ye=te.current)==null||ye.abort(),U(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:at,disabled:!C.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:Pt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),O&&E.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ds,{entries:E,isRunning:!0})}),P&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[P,n.jsx("button",{onClick:at,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),L&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Qd,{size:14}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:w.map((ye,At)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ye.type==="added"?"var(--green-muted)":ye.type==="removed"?"var(--red-muted)":"transparent",color:ye.type==="added"?"var(--green)":ye.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ye.type==="added"?"3px solid var(--green)":ye.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},At))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:$t,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:Pt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),W&&x!==null&&d&&p&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(iS,{plugin:d,skill:p,skillContent:f,onApplied:ye=>{r({type:"SET_CONTENT",content:ye}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function ov(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function cv(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const RS=new Set(["benchmark","comparison","baseline"]);function Kx(a,r,i,o){return a.map(({rate:d,idx:p,total:f})=>{const h=o+p/(f-1)*(r-o*2),x=o+(i-o*2)-d*(i-o*2);return`${h},${x}`})}function dv({entries:a}){const r=a.filter(v=>RS.has(v.type)).slice().reverse(),i=r.map((v,j,S)=>({rate:v.pass_rate,idx:j,total:S.length})).filter((v,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((v,j)=>v.type==="baseline"?[{rate:v.pass_rate,idx:j,total:r.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const d=80,p=24,f=2,h=i.length>=2?Kx(i,d,p,f):[],x=o.length>=2?Kx(o,d,p,f):[],m=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:d,height:p,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),m&&n.jsx("circle",{cx:parseFloat(m.split(",")[0]),cy:parseFloat(m.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function uv(a,r,i){const o=isNaN(r)?0:r,d=[],p=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const m=d.length>0?` Met criteria: ${d.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${m}`}}if(a==="FAIL"||a==="DEGRADING"){const m=p.length>0?` Failed criteria: ${p.map(v=>v.criterion).join(", ")}.`:"",y=[...p.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...f.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${m}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...p.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const m=[...p.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:m}}if(a==="MARGINAL"){const m=[...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(d.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:m}}if(a==="EMERGING"){const m=[...p.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return m.length===0&&m.push(d.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:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:m}}const h=d.length>0?` Passing: ${d.map(m=>m.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(m=>m.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const fv={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function AS(a){return Object.hasOwn(fv,a)}function MS(a){return AS(a)?fv[a]:a}function zS(){const{state:a}=wn(),{plugin:r,skill:i}=a,[o,d]=g.useState([]),[p,f]=g.useState([]),[h,x]=g.useState(!0),[m,y]=g.useState(null),[v,j]=g.useState(new Set),[S,k]=g.useState({}),[A,T]=g.useState(null),[C,M]=g.useState(""),[O,U]=g.useState(!1),[L,V]=g.useState(""),[w,D]=g.useState(""),E=g.useCallback(async()=>{x(!0),y(null);try{const[z,R]=await Promise.all([Ee.getCredentials(r,i),Ee.getParams(r,i)]);d(z.credentials),f(R.params)}catch(z){y(z instanceof Error?z.message:"Failed to load parameters"),d([]),f([])}finally{x(!1)}},[r,i]);g.useEffect(()=>{E()},[E]);const B=g.useCallback(async(z,R)=>{U(!0),y(null);try{await Ee.setCredential(r,i,z,R),T(null),M(""),await E()}catch(I){y(I instanceof Error?I.message:`Failed to save ${z}`)}finally{U(!1)}},[r,i,E]),P=g.useCallback(async()=>{const z=L.trim().toUpperCase(),R=w.trim();if(!(!z||!R)){U(!0),y(null);try{await Ee.setCredential(r,i,z,R),V(""),D(""),await E()}catch(I){y(I instanceof Error?I.message:`Failed to add ${z}`)}finally{U(!1)}}},[r,i,L,w,E]),F=g.useCallback(async z=>{if(v.has(z)){j(R=>{const I=new Set(R);return I.delete(z),I}),k(R=>{const I={...R};return delete I[z],I});return}try{const I=(await Ee.getParamsRevealed(r,i,z)).params.find(Z=>Z.name===z);I!=null&&I.value&&(k(Z=>({...Z,[z]:I.value})),j(Z=>new Set(Z).add(z)))}catch{}},[r,i,v]),te=new Set(o.map(z=>z.name)),Q=[...o.map(z=>{const R=p.find(I=>I.name===z.name);return{name:z.name,status:z.status,maskedValue:(R==null?void 0:R.maskedValue)??""}}),...p.filter(z=>!te.has(z.name)).map(z=>({name:z.name,status:z.status,maskedValue:z.maskedValue}))];return n.jsxs("div",{className:"py-2 px-3",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),m&&n.jsx("div",{className:"text-[10px] px-2 py-1.5 rounded mb-2",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},role:"alert",children:m}),h&&Q.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&Q.length===0&&!m&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),Q.map(z=>n.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:z.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:z.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:z.status==="ready"?"var(--green)":"var(--red)"},children:z.status}),(z.maskedValue||z.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(z.name)?S[z.name]??z.maskedValue:z.maskedValue||"***",n.jsx("button",{onClick:()=>F(z.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(z.name)?"Hide":"Reveal"} value for ${z.name}`,children:v.has(z.name)?"hide":"show"})]}),A===z.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:C,onChange:R=>M(R.target.value),onKeyDown:R=>{R.key==="Enter"&&C.trim()&&B(z.name,C)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${z.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>B(z.name,C),disabled:O||!C.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{T(null),M("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{T(z.name),M("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},z.name)),n.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:L,onChange:z=>V(z.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:w,onChange:z=>D(z.target.value),onKeyDown:z=>{z.key==="Enter"&&L.trim()&&w.trim()&&P()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:P,disabled:O||!L.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:O?"not-allowed":"pointer"},children:"Add"})]})]})]})}function LS(a,r,i){const[o,d]=g.useState(null),[p,f]=g.useState(!1),h=g.useRef("");g.useEffect(()=>{const m=`${a}/${r}/${i}`;h.current!==m&&(h.current=m,f(!0),Ee.getCaseHistory(a,r,i).then(y=>d(y)).catch(()=>d([])).finally(()=>f(!1)))},[a,r,i]);const x=g.useCallback(()=>{f(!0),h.current="",Ee.getCaseHistory(a,r,i).then(m=>d(m)).catch(()=>d([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:p,refetch:x}}function DS(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const p=i.slice(0,10).map(x=>x.assertions.find(m=>m.id===a)).filter(Boolean);if(p.length>=2){const m=p.filter(y=>y.pass).length/p.length;m>=.3&&m<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),m=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(m!=null&&m.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const m=i[0].assertions.find(y=>y.id===a);m!=null&&m.pass&&(o.regression=!0)}return o}function _S(){var Z;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:d,cancelCase:p,cancelAll:f,generateEvals:h,isReadOnly:x}=wn(),{evals:m,evalsError:y,selectedCaseId:v,inlineResults:j,caseRunStates:S,generateEvalsLoading:k,generateEvalsProgress:A,generateEvalsError:T}=a,C=g.useMemo(()=>{for(const q of S.values())if(q.status==="running"||q.status==="queued")return!0;return!1},[S]),[M,O]=g.useState(!1),[U,L]=g.useState("all"),V={skill_name:a.skill,evals:[]},w=m??V,D=w.evals,E=g.useMemo(()=>U==="all"?D:D.filter(q=>or(q)===U),[U,D]),B=E.find(q=>q.id===v)??null;g.useEffect(()=>{v!==null&&!E.find(q=>q.id===v)&&r({type:"SELECT_CASE",caseId:E.length>0?E[0].id:null})},[E,v,r]);const[P,F]=g.useState([]),te=g.useMemo(()=>D.some(q=>or(q)==="integration"),[D]);g.useEffect(()=>{te&&Ee.getCredentials(a.plugin,a.skill).then(q=>F(q.credentials)).catch(()=>F([]))},[a.plugin,a.skill,te]);const Q=g.useMemo(()=>new Set(P.filter(q=>q.status==="missing").map(q=>q.name)),[P]),[z,R]=g.useState(!1),I=g.useCallback(q=>{R(!1),h(q?{testType:q}:void 0)},[h]);return!m||D.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.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:y}),n.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"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>O(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>I("unit"),disabled:k||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),n.jsx("button",{onClick:()=>R(!z),disabled:k||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),z&&n.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:n.jsx("button",{onClick:()=>I("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:q=>{q.currentTarget.style.background="var(--surface-2)"},onMouseLeave:q=>{q.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&A.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ds,{entries:A,isRunning:!0})}),T&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ls,{error:T,onRetry:()=>I()})}),M&&n.jsx(Xx,{evals:w,onSave:q=>{i(q),O(!1)},onCancel:()=>O(!1)})]}):n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[n.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",E.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:C?n.jsx("button",{onClick:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>d("benchmark"),disabled:E.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>d("comparison"),disabled:E.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(q=>n.jsx("button",{onClick:()=>L(q),style:{padding:"2px 8px",fontSize:10,fontWeight:U===q?600:400,background:U===q?"var(--accent-muted)":"transparent",color:U===q?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:q==="all"?`All (${D.length})`:q==="unit"?`Unit (${D.filter(de=>or(de)==="unit").length})`:`Integration (${D.filter(de=>or(de)==="integration").length})`},q))}),n.jsxs("div",{className:"py-1",children:[E.length===0&&D.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",U==="all"?"":U+" ","tests yet"]}),E.map(q=>{var ie;const de=j.get(q.id),_=v===q.id,W=or(q);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:q.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:_?"var(--accent-muted)":"transparent",borderLeft:_?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:ue=>{_||(ue.currentTarget.style.background="var(--surface-2)")},onMouseLeave:ue=>{_||(ue.currentTarget.style.background="transparent")},children:[n.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[n.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:_?"var(--text-primary)":"var(--text-secondary)"},children:["#",q.id," ",q.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:W==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:W==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:W==="unit"?"U":"I"}),W==="integration"&&((ie=q.requiredCredentials)==null?void 0:ie.some(ue=>Q.has(ue)))&&n.jsx("span",{title:"Configure credentials to run",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),n.jsx(pv,{result:de})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[q.assertions.length," assertion",q.assertions.length!==1?"s":"",(de==null?void 0:de.passRate)!=null&&n.jsx(IS,{passRate:de.passRate})]})]},q.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>O(!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:q=>{q.currentTarget.style.borderColor="var(--accent)",q.currentTarget.style.color="var(--accent)"},onMouseLeave:q=>{q.currentTarget.style.borderColor="var(--border-default)",q.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(zS,{})})]}),n.jsx("div",{className:"overflow-auto",children:B?n.jsx(OS,{evalCase:B,result:j.get(B.id),evals:m,caseStatus:((Z=S.get(B.id))==null?void 0:Z.status)??"idle",onSaveEvals:i,onRun:q=>o(q,"benchmark"),onCompare:q=>o(q,"comparison"),onCancel:q=>p(q),onImprove:q=>r({type:"OPEN_IMPROVE",evalId:q})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),M&&n.jsx(Xx,{evals:w,onSave:q=>{i(q),O(!1)},onCancel:()=>O(!1)})]})}function OS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:d,onRun:p,onCompare:f,onCancel:h,onImprove:x}){const{state:m,isReadOnly:y}=wn(),{plugin:v,skill:j}=m,{entries:S,loading:k}=LS(v,j,a.id),[A,T]=g.useState(!1),[C,M]=g.useState(a.prompt),[O,U]=g.useState(!1),[L,V]=g.useState(a.expected_output);g.useState(()=>{M(a.prompt),V(a.expected_output)});const w=g.useCallback(q=>{d({...i,evals:i.evals.map(de=>de.id===q.id?q:de)})},[i,d]),D=g.useCallback(()=>{w({...a,prompt:C}),T(!1)},[a,C,w]),E=g.useCallback(()=>{w({...a,expected_output:L}),U(!1)},[a,L,w]),B=g.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),P=g.useCallback((q,de)=>{w({...a,assertions:a.assertions.map(_=>_.id===q?{..._,text:de}:_)})},[a,w]),F=g.useCallback(q=>{w({...a,assertions:a.assertions.filter(de=>de.id!==q)})},[a,w]),te=g.useCallback(()=>{confirm("Delete this test case?")&&d({...i,evals:i.evals.filter(q=>q.id!==a.id)})},[i,a.id,d]),Q=r&&r.assertions.length>0&&r.assertions.every(q=>q.pass),z=r&&r.assertions.some(q=>!q.pass),R=or(a),I=a.requiredCredentials??[],Z=R==="integration"&&I.length>0;return n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",a.id," ",a.name]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:R==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:R==="unit"?"var(--accent)":"var(--orange)"},children:R==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((R==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:de,requirements:_,cleanup:W,...ie}=a;w({...ie,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${R==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:R==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:R==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:R==="unit"?"Unit":"Integration"}),n.jsx(pv,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>p(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),z&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.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"})]})})]})]}),y&&R==="integration"&&n.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 var(--accent-muted)"},children:[n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),Q&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),Z&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:I.map(q=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:q},q))})]}),!y&&R==="integration"&&n.jsx(VS,{evalCase:a,onUpdate:w}),n.jsx(Xi,{title:"Prompt",children:A?n.jsxs("div",{children:[n.jsx("textarea",{value:C,onChange:q=>M(q.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:D,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{M(a.prompt),T(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.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:y?"default":"pointer"},onClick:()=>{y||T(!0)},onMouseEnter:q=>{y||(q.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:q=>{q.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Xi,{title:"Expected Output",children:O?n.jsxs("div",{children:[n.jsx("textarea",{value:L,onChange:q=>V(q.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:E,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{V(a.expected_output),U(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):n.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:y?"default":"pointer"},onClick:()=>{y||U(!0)},onMouseEnter:q=>{y||(q.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:q=>{q.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Xi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:B,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(q=>{const de=r==null?void 0:r.assertions.find(W=>W.assertion_id===q.id),_=DS(q.id,de,S);return n.jsx(BS,{assertion:q,result:de,badges:_,isReadOnly:y,onUpdate:W=>P(q.id,W),onDelete:()=>F(q.id)},q.id)})})}),(r==null?void 0:r.output)&&n.jsx(HS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const q=uv("INEFFECTIVE",r.passRate);return q.recommendations&&q.recommendations.length>0?n.jsx(Xi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:q.recommendations.map((de,_)=>n.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),de]},_))})]})}):null})(),n.jsx(US,{evalId:a.id,sharedEntries:S,sharedLoading:k})]},a.id)}function BS({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:d,onDelete:p}){const[f,h]=g.useState(!1),[x,m]=g.useState(a.text),[y,v]=g.useState(!1),j=()=>{d(x),h(!1)};return n.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:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.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"}),(i==null?void 0:i.regression)&&n.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:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.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:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.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."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>m(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(m(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:p,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Xi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function pv({result:a}){const[r,i]=g.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",d=a.passRate??0,f=uv(o?"PASS":"FAIL",d);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.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:f.explanation})]})}function IS({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function HS({output:a,durationMs:r,tokens:i}){const[o,d]=g.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>d(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.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:a})]})}function Zd(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Jd({entry:a}){return n.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:ov(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:cv(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",d=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:d},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function US({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:d}=wn(),{plugin:p,skill:f}=o,[h,x]=g.useState(!0),m=r??null,y=i??!1,v=g.useCallback(()=>{x(A=>!A)},[]),j=m?m.slice(0,10):[],S=j.some(A=>{const T=Zd(A.type);return T==="left"||T==="full"}),k=j.some(A=>{const T=Zd(A.type);return T==="right"||T==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:v,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:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:h?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",m&&m.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",m.length," run",m.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!m||m.length===0?n.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):n.jsxs("div",{children:[j.length>=2&&n.jsx("div",{className:"mb-2",children:n.jsx(dv,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((A,T)=>{const C=Zd(A.type);return C==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Jd,{entry:A})},T):C==="left"?n.jsxs(g.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Jd,{entry:A})}),n.jsx("div",{style:{gridColumn:"2"}})]},T):n.jsxs(g.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Jd,{entry:A})})]},T)})]}),n.jsx("button",{onClick:()=>d({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:A=>{A.currentTarget.style.textDecoration="underline"},onMouseLeave:A=>{A.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Xx({evals:a,onSave:r,onCancel:i}){const[o,d]=g.useState(""),[p,f]=g.useState(""),[h,x]=g.useState(""),[m,y]=g.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,j]=g.useState("unit"),[S,k]=g.useState(""),[A,T]=g.useState([]),[C,M]=g.useState(""),[O,U]=g.useState(""),L=Math.max(0,...a.evals.map(E=>E.id))+1,V=E=>{j(E),E==="unit"&&(T([]),k(""),M(""),U(""))},w=()=>{const E=S.trim().toUpperCase();E&&!A.includes(E)&&T([...A,E]),k("")},D=()=>{if(!o.trim()||!p.trim())return;const E={id:L,name:o.trim(),prompt:p.trim(),expected_output:h.trim(),files:[],assertions:m.filter(B=>B.text.trim()),...v==="integration"?{testType:"integration",...A.length>0?{requiredCredentials:A}:{},...C||O?{requirements:{...C?{platform:C}:{},...O?{chromeProfile:O}:{}}}:{}}:{}};r({...a,evals:[...a.evals,E]})};return n.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:n.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:[n.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),n.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(E=>n.jsx("button",{onClick:()=>V(E),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===E?E==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===E?E==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:E},E))})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),n.jsx("input",{value:o,onChange:E=>d(E.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),n.jsx("textarea",{value:p,onChange:E=>f(E.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:E=>x(E.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),n.jsxs("div",{className:"mb-4",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),m.map((E,B)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:E.text,onChange:P=>y(m.map((F,te)=>te===B?{...F,text:P.target.value}:F)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),m.length>1&&n.jsx("button",{onClick:()=>y(m.filter((P,F)=>F!==B)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},E.id)),n.jsx("button",{onClick:()=>y([...m,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),v==="integration"&&n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:A.map(E=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[E,n.jsx("button",{onClick:()=>T(A.filter(B=>B!==E)),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},E))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:E=>k(E.target.value),onKeyDown:E=>{E.key==="Enter"&&(E.preventDefault(),w())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:w,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:C,onChange:E=>M(E.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("label",{className:"block",children:[n.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:O,onChange:E=>U(E.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx("button",{onClick:i,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsx("button",{onClick:D,disabled:!o.trim()||!p.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function VS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=g.useState(""),d=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},p=x=>{const m=(a.requiredCredentials??[]).filter(y=>y!==x);r({...a,requiredCredentials:m.length>0?m:void 0})};return n.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),n.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(a.requiredCredentials??[]).map(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>p(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),d())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:d,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function kn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function mv(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function $S(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function PS(a,r){let i="";if(r){const d=new Date(r);isNaN(d.getTime())||(i=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function GS(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const d=Math.round(Math.abs(a)*r);if(d===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const p=a>0?"more":"fewer";return`Your skill passes ${d} ${p} assertions across ${i} ${o}`}function Qx(a,r){const i=o=>{const d=o/5*100;return isFinite(d)?Math.round(Math.min(100,Math.max(0,d))):0};return{skill:i(a),baseline:i(r)}}function FS(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function qS(a,r){const i=a+r,o=i*10,d=i*25,p=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${p(o)}–${p(d)}`}const YS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function WS(a,r){if(!a)return null;const i=YS[a];if(i==null||i===0)return null;const o=i*r*.5,d=i*r*2;return`${kn(o)}–${kn(d)}`}function KS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:d,isReadOnly:p}=wn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:m,inlineResults:y}=a,{config:v}=bl(),j=(f==null?void 0:f.evals)??[],S=g.useMemo(()=>{for(const w of h.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[h]),k=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,A=j.filter(w=>{const D=h.get(w.id);return D&&(D.status==="running"||D.status==="queued")}).length,T=g.useRef(null),[C,M]=g.useState(0);g.useEffect(()=>{if(S&&!T.current&&(T.current=Date.now()),!S){T.current=null,M(0);return}const w=setInterval(()=>{T.current&&M(Math.round((Date.now()-T.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const O=j.reduce((w,D)=>w+D.assertions.length,0),U=j.length+O,L=g.useMemo(()=>qS(j.length,O),[j.length,O]),V=g.useMemo(()=>WS((v==null?void 0:v.provider)??null,U),[v==null?void 0:v.provider,U]);return n.jsxs("div",{className:"p-5",children:[p&&n.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:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),n.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[A," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:d,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||p,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"}),n.jsx("button",{onClick:()=>i("benchmark"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),n.jsx("button",{onClick:()=>i("baseline"),disabled:j.length===0||S||p,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",L]}),V&&n.jsxs("span",{children:["Est. cost: ",V]}),!V&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!V&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",k,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/j.length*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${k/j.length*100}%`,background:"var(--accent)"}})}),n.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",C>=60?`${Math.floor(C/60)}m ${C%60}s`:`${C}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",L]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const D=y.get(w.id),E=h.get(w.id),B=(E==null?void 0:E.status)??"idle",P=m==null?void 0:m.cases.find(F=>F.eval_id===w.id);return n.jsx(QS,{name:w.name,evalId:w.id,result:D,caseCost:P==null?void 0:P.cost,caseBillingMode:P==null?void 0:P.billingMode,caseInputTokens:P==null?void 0:P.inputTokens,caseOutputTokens:P==null?void 0:P.outputTokens,caseStatus:B,runMode:(E==null?void 0:E.mode)??null,comparisonDetail:P==null?void 0:P.comparisonDetail,isReadOnly:p,onRun:F=>r(F,"benchmark"),onBaseline:F=>r(F,"baseline"),onCompare:F=>r(F,"comparison"),onCancel:F=>o(F)},w.id)})}),!S&&m&&m.cases.length>0&&n.jsxs("div",{className:"mt-5",children:[n.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:$S(m.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(m.overall_pass_rate??0)>=.8?"var(--green)":(m.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:m.overall_pass_rate!=null?`${Math.round(m.overall_pass_rate*100)}%`:"--"})]}),m.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(m.totalDurationMs/1e3).toFixed(1),"s",m.model&&` | Model: ${m.model}`,m.totalInputTokens!=null&&m.totalOutputTokens!=null&&` | Tokens: ${mv(m.totalInputTokens,m.totalOutputTokens)}`,m.totalCost!=null&&` | Cost: ${kn(m.totalCost)}`]}),m.overall_pass_rate>=.9999&&!m.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||p,className:"text-[13px] font-semibold mt-3 w-full rounded-lg transition-opacity duration-150",style:{padding:"10px 0",background:"var(--green)",color:"var(--color-paper)",border:"none",cursor:"pointer",opacity:j.length===0?.5:1},children:"Run Final A/B Comparison"})]}),m.comparison&&n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const w=PS(m.model,m.timestamp);return w?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:w}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(Zx,{label:"Skill",value:m.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Zx,{label:"Baseline",value:m.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:m.comparison.delta>0?"var(--green)":m.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",m.comparison.delta>0?"+":"",(m.comparison.delta*100).toFixed(1),"%",m.verdict&&` | ${MS(m.verdict)}`]}),(()=>{const w=m.cases.reduce((E,B)=>E+B.assertions.length,0),D=GS(m.comparison.delta,w,m.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const XS={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:"var(--purple-muted)",color:"var(--purple)"}};function QS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:d,caseInputTokens:p,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:m,isReadOnly:y,onRun:v,onBaseline:j,onCompare:S,onCancel:k}){const[A,T]=g.useState(!1),C=h==="running"||h==="queued",M=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:C?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:C?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(C||M)&&(()=>{const O=XS[x];return O?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:O.bg,color:O.color,padding:"1px 6px"},children:O.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[C?n.jsx("button",{onClick:()=>k(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>v(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),p!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:mv(p,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:kn(o,d)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(O=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:O.pass?"var(--green)":"var(--red)"},children:O.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:O.text})]},O.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>T(!A),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:A?"Hide output":"Show output"}),A&&i.output&&n.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:i.output})]}),m&&n.jsx("div",{className:"px-4 pb-3",children:n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const O=Qx(m.skillContentScore,m.baselineContentScore),U=Qx(m.skillStructureScore,m.baselineStructureScore),L=FS(m.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",O.skill,"% / Baseline ",O.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",U.skill,"% / Baseline ",U.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:L.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:L.text})]})})()})})}),i&&i.errorMessage&&n.jsx(ZS,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const eu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function ZS({errorMessage:a,classifiedError:r}){const[i,o]=g.useState(!1),d=(r==null?void 0:r.title)??"Error",p=r==null?void 0:r.hint,f=r?eu[r.category]??eu.unknown:eu.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:d}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),p&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:p}),i&&n.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:a})]})})}function Zx({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Jx={TP:{bg:"var(--green-muted)",text:"var(--green)"},TN:{bg:"var(--green-muted)",text:"var(--green)"},FP:{bg:"var(--red-muted)",text:"var(--red)"},FN:{bg:"var(--red-muted)",text:"var(--red)"}};function JS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:d}=wn(),{plugin:p,skill:f,activationPrompts:h,activationResults:x,activationSummary:m,activationRunning:y,activationError:v,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:k,generatingPromptsError:A,activationHistory:T}=a,[C,M]=g.useState(h),[O,U]=g.useState(null),[L,V]=g.useState(!1);g.useEffect(()=>{h&&h!==C&&M(h)},[h]),g.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:C})},[C,r]),g.useEffect(()=>{fetch(`/api/skills/${p}/${f}/description`).then(z=>z.json()).then(z=>U(z.rawContent||z.description||null)).catch(()=>U(null))},[p,f]);function w(){i(C)}function D(){d(8)}const E=C.trim().split(`
|
|
70
|
+
`).filter(Boolean).length,B=x.filter(z=>z.classification==="TP"||z.classification==="TN"),P=x.filter(z=>z.classification==="FP"||z.classification==="FN"),F=(O==null?void 0:O.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=C.trim().length>0,Q=F?bo(F):"";return n.jsxs("div",{className:"p-5 space-y-5",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),n.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."})]}),n.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[n.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),n.jsx("div",{className:"flex gap-1.5",children:n.jsx("button",{onClick:D,disabled:k||!F||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:k?"var(--surface-3)":"var(--surface-2)",color:F?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:F?1:.5,cursor:F?"pointer":"not-allowed"},title:F?void 0:"No skill description available",onMouseEnter:z=>{F&&!k&&(z.currentTarget.style.background="var(--surface-3)")},onMouseLeave:z=>{k||(z.currentTarget.style.background="var(--surface-2)")},children:k?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.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"})}),te?"Regenerate":"Generate"," Test Prompts"]})})})]}),!F&&!y&&n.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."}),A&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:A}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:C,onChange:z=>M(z.target.value),placeholder:`How do I write a unit test?
|
|
71
71
|
What edge cases should I test?
|
|
72
72
|
+Deploy this to production
|
|
73
73
|
!What's the weather like today?
|
|
74
|
-
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Qi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Qi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[E," prompt",E!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:w,disabled:y||!C.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${E} prompts tested`,j&&n.jsx(ak,{startedAt:j})]})]})]})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:q?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Q}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[P.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((z,R)=>n.jsx(eg,{result:z},`incorrect-${R}`))})]}),B.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",B.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:B.map((z,R)=>n.jsx(eg,{result:z},`correct-${R}`))})]})]}),m&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(tu,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),n.jsx(tu,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),n.jsx(tu,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(Zi,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Zi,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Zi,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Zi,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(ek,{history:T,expanded:L,onToggle:()=>V(!L)})]})}function ek({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.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:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(tk,{run:o},o.id))})})]})}function tk({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",d=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:nk(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:d,background:`color-mix(in srgb, ${d} 10%, transparent)`},children:o})]})]})}function nk(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const d=Math.floor(o/60);if(d<60)return`${d}m ago`;const p=Math.floor(d/60);if(p<24)return`${p}h ago`;const f=Math.floor(p/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Qi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function eg({result:a}){const r=Jx[a.classification]||Jx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function tu({label:a,value:r,description:i,detail:o}){const d=Math.round(r*100),p=d>=80?"var(--green)":d>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:p},children:[d,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:a}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zi({abbr:a,count:r,bg:i,color:o,description:d}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:d})]})}function ak({startedAt:a}){const[r,i]=g.useState(0);return g.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const nu={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},tg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},wu=600,Cu=180,tn=40,au=wu-tn*2,Ga=Cu-tn*2,lk=[25,50,75,100];function ng(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function rk(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function sk({entries:a,onPointClick:r}){const[i,o]=g.useState(null),d=g.useMemo(()=>[...a].reverse(),[a]);if(d.length<2)return null;const p=d.length,f=d.map((m,y)=>{const v=tn+y/(p-1)*au,j=m.passRate*100,S=tn+Ga-j/100*Ga;return{x:v,y:S,pct:j,entry:m}}),h=f.map(m=>`${m.x},${m.y}`).join(" "),x=Array.from(new Set(d.map(m=>m.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:p>=20?"auto":void 0},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(m=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:nu[m]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:tg[m]??m})]},m))}),n.jsxs("svg",{width:wu,height:Cu,viewBox:`0 0 ${wu} ${Cu}`,style:{display:"block",overflow:"visible"},children:[lk.map(m=>{const y=tn+Ga-m/100*Ga;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+au,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),n.jsx("line",{x1:tn,y1:tn+Ga,x2:tn+au,y2:tn+Ga,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+Ga+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((m,y)=>n.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:nu[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(m.entry)},y)),ik(p).map(m=>n.jsx("text",{x:f[m].x,y:tn+Ga+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:ng(d[m].timestamp)},m))]}),i&&n.jsxs("div",{style:{position:"absolute",left:i.x,top:i.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:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:ng(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:nu[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:tg[i.entry.type]??i.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(i.entry.passRate*100),"%"]})]}),n.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:rk(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function ik(a){if(a<=3)return Array.from({length:a},(o,d)=>d);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const gs=new Map;let nn=null,so=null,Ji=1e3,vs=0;function hv(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const d=gs.get(r);if(d)for(const p of d)p(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,vs>0&&(so=setTimeout(()=>{Ji=Math.min(Ji*2,3e4),hv()},Ji))},nn.onopen=()=>{Ji=1e3}}function ok(){so!=null&&(clearTimeout(so),so=null),nn==null||nn.close(),nn=null}function ck(a,r){return gs.has(a)||gs.set(a,new Set),gs.get(a).add(r),vs++,hv(),()=>{var i;(i=gs.get(a))==null||i.delete(r),vs--,vs<=0&&(vs=0,ok())}}function fo(a,r){const i=g.useRef(r);i.current=r,g.useEffect(()=>ck(a,d=>i.current(d)),[a])}function po(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function dk(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function uk({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:po(a)},children:[i,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,background:po(a)}})})]})})}function fk({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,d=a.length,p=a.map((x,m)=>{const y=o+m/(d-1)*(r-o*2),v=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:v}}),f=`M ${p[0].x},${i-o} `+p.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${p[p.length-1].x},${i-o} Z`,h=p.map((x,m)=>`${m===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:p[p.length-1].x,cy:p[p.length-1].y,r:3,fill:"var(--accent)"})]})}function pk({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=g.useCallback(()=>Ee.getStats(a,r),[a,r]),{data:d,loading:p}=xr(i,o),f=g.useCallback(()=>an(i),[i]);if(fo("benchmark:complete",f),fo("history:written",f),p)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!d||d.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=d.trendPoints.length>0?d.trendPoints[d.trendPoints.length-1].passRate:0,x=d.trendPoints.length>0?d.trendPoints[0].passRate:0,m=h-x,y=d.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:d.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:po(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:d.modelStats.length})]}),d.totalCost!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:kn(d.totalCost)})]}),d.costPerRun!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:kn(d.costPerRun)})]})]}),d.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(fk,{points:d.trendPoints})]}),d.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),n.jsx("tbody",{children:d.modelStats.map(v=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:po(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:dk(v.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?kn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(v=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-2)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.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:["#",v.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),n.jsx(uk,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function mk({plugin:a,skill:r}){const[i,o]=g.useState(null),[d,p]=g.useState(null),[f,h]=g.useState({}),[x,m]=g.useState({});g.useEffect(()=>{Ee.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(v){if(d===v){p(null);return}if(p(v),!f[v]){m(j=>({...j,[v]:!0}));try{const j=await Ee.getCaseHistory(a,r,v);h(S=>({...S,[v]:j}))}catch{h(j=>({...j,[v]:[]}))}finally{m(j=>({...j,[v]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(v=>{const j=f[v.id]||[],S=d===v.id,k=x[v.id],A=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:T=>{S||(T.currentTarget.style.background="var(--surface-2)")},onMouseLeave:T=>{S||(T.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.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:["#",v.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),j.length>=2&&n.jsx(dv,{entries:j}),A!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(A)},children:[Math.round(A*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((T,C)=>n.jsxs("div",{className:"p-4",style:{background:C===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:ov(T.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:T.type==="benchmark"?"rgba(99,131,255,0.15)":T.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:T.type==="benchmark"?"#6383ff":T.type==="comparison"?"var(--purple)":"#fb923c"},children:T.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(T.pass_rate)},children:[Math.round(T.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[T.durationMs!=null&&n.jsx("span",{children:cv(T.durationMs)}),T.tokens!=null&&n.jsxs("span",{children:[T.tokens>=1e3?`${(T.tokens/1e3).toFixed(1)}k`:T.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:T.assertions.map(M=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:M.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:M.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:M.text}),M.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:M.reasoning})]})]},M.id))})]},C))})})]},v.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function hk(){const{state:a,dispatch:r}=wn(),{plugin:i,skill:o}=a,[d,p]=g.useState("timeline"),[f,h]=g.useState(""),[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState([]),[k,A]=g.useState(null),[T,C]=g.useState(!1),[M,O]=g.useState(null),[U,L]=g.useState(!1),V=`history/${i}/${o}?model=${f}&type=${x}`,w=g.useCallback(()=>Ee.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:D,loading:E}=xr(V,w),B=D??[];g.useEffect(()=>{!D||D.length<2||Ee.compareRuns(i,o,D[0].timestamp,D[1].timestamp).then(z=>{const R=z.regressions.filter(I=>I.change==="regression");r({type:"SET_REGRESSIONS",regressions:R})}).catch(()=>{})},[D,i,o,r]);const P=g.useCallback(()=>an(V),[V]);fo("history:written",P);const q=g.useCallback(async z=>{if(y){S(R=>R.includes(z)?R.filter(I=>I!==z):R.length>=2?[R[1],z]:[...R,z]);return}L(!0);try{const R=await Ee.getHistoryEntry(i,o,z);O(R)}catch{}finally{L(!1)}},[i,o,y]),te=g.useCallback(async()=>{if(j.length===2){C(!0);try{const z=await Ee.compareRuns(i,o,j[0],j[1]);A(z)}catch{}finally{C(!1)}}},[i,o,j]),Q=[...new Set(B.map(z=>z.model))];return E?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(z=>n.jsx("button",{onClick:()=>p(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:d===z?"var(--accent-muted)":"transparent",color:d===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),d==="timeline"&&n.jsxs("div",{children:[B.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(sk,{entries:B,onPointClick:z=>q(z.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:z=>h(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),Q.map(z=>n.jsx("option",{value:z,children:z},z))]}),n.jsxs("select",{value:x,onChange:z=>m(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{v(!y),S([]),A(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:te,disabled:T,className:"btn btn-primary text-[12px]",children:T?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:B.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):B.map(z=>{const R=j.includes(z.timestamp);return n.jsx("button",{onClick:()=>q(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:R?"var(--accent-muted)":"var(--surface-1)",border:R?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:I=>{R||(I.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:I=>{R||(I.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:R?"var(--accent)":"var(--border-default)",background:R?"var(--accent)":"transparent"},children:R&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(z.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"var(--accent-muted)":z.type==="improve"||z.type==="instruct"?"var(--purple-muted)":z.type==="ai-generate"?"var(--green-muted)":z.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"var(--accent)":z.type==="improve"||z.type==="instruct"?"var(--purple)":z.type==="ai-generate"?"var(--green)":z.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type==="instruct"?"ai edit":z.type==="ai-generate"?"ai generate":z.type==="eval-generate"?"eval generate":z.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),z.totalCost!=null&&z.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:kn(z.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),k&&n.jsx(xk,{result:k}),M&&!y&&n.jsx(gk,{run:M,onClose:()=>O(null)})]}),d==="per-eval"&&n.jsx(mk,{plugin:i,skill:o}),d==="statistics"&&n.jsx(pk,{plugin:i,skill:o})]})}function xk({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",kn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",kn(a.runB.totalCost??null)]}),a.runA.totalCost!=null&&a.runB.totalCost!=null&&n.jsxs("span",{style:{color:a.runB.totalCost<=a.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",kn(a.runB.totalCost-a.runA.totalCost)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function gk({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(vk,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${kn(a.totalCost)}`]}),n.jsx("div",{className:"space-y-2",children:a.cases.map(i=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",i.eval_id," ",i.eval_name]}),n.jsxs("div",{className:"flex items-center gap-2",children:[i.cost!=null&&i.cost>0&&n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:kn(i.cost)}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.pass_rate!=null?`${Math.round(i.pass_rate*100)}%`:i.status})]})]})},i.eval_id))})]})}function vk({run:a,onClose:r}){var p;const i=g.useMemo(()=>a.improve?jo(a.improve.original,a.improve.improved):[],[a.improve]),o=g.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),d=g.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((p=a.improve)==null?void 0:p.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),a.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:d.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||""})]},h))})})})]})}function yk({plugin:a,skill:r}){const[i,o]=g.useState([]),[d,p]=g.useState([]),[f,h]=g.useState(!0),[x,m]=g.useState(null);g.useEffect(()=>{Ee.getDependencies(a,r).then(v=>{o(v.mcpDependencies),p(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(v,j){try{await navigator.clipboard.writeText(j),m(v),setTimeout(()=>m(null),2e3)}catch{}}return f?null:i.length===0&&d.length===0?n.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"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.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:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.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"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+d.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(v=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),n.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===v.server?"var(--green)":"var(--accent)"},children:x===v.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.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"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},v.server))]}),d.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:d.map(v=>n.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:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.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"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function ag({plugin:a,skill:r}){const[i,o]=g.useState([]),[d,p]=g.useState(!0),[f,h]=g.useState(null),[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState(null),[k,A]=g.useState(""),[T,C]=g.useState(""),[M,O]=g.useState(!1),[U,L]=g.useState(new Set),V=g.useCallback(async()=>{p(!0);try{const[B,P]=await Promise.all([Ee.getCredentials(a,r).catch(()=>({credentials:[]})),Ee.getParams(a,r).catch(()=>({params:[]}))]),q=new Map(P.params.map(z=>[z.name,z])),te=new Set,Q=[];for(const z of B.credentials){te.add(z.name);const R=q.get(z.name);Q.push({name:z.name,status:z.status==="ready"||z.status==="resolved"?"ready":"missing",source:z.source,maskedValue:R==null?void 0:R.maskedValue})}for(const z of P.params)te.has(z.name)||Q.push({name:z.name,status:z.status,maskedValue:z.maskedValue});o(Q)}finally{p(!1)}},[a,r]);g.useEffect(()=>{V()},[V]);const w=g.useCallback(async B=>{if(U.has(B)){L(P=>{const q=new Set(P);return q.delete(B),q}),o(P=>P.map(q=>q.name===B?{...q,revealedValue:void 0}:q));return}try{const q=(await Ee.getParamsRevealed(a,r,B)).params.find(te=>te.name===B);q&&(o(te=>te.map(Q=>Q.name===B?{...Q,revealedValue:q.value}:Q)),L(te=>new Set(te).add(B)))}catch{}},[a,r,U]),D=async(B,P)=>{if(!(!B.trim()||!P.trim())){v(!0),S(null);try{await Ee.setCredential(a,r,B,P),h(null),m(""),L(new Set),V()}catch(q){S(q.message)}finally{v(!1)}}},E=async()=>{if(!(!k.trim()||!T.trim())){v(!0),S(null);try{await Ee.setCredential(a,r,k.trim().toUpperCase(),T),A(""),C(""),O(!1),V()}catch(B){S(B.message)}finally{v(!1)}}};return d?n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):n.jsxs("div",{className:"mt-6",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("button",{onClick:()=>O(!M),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!M?n.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"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(B=>n.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:[n.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:B.name}),B.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:U.has(B.name)&&B.revealedValue!=null?B.revealedValue:B.maskedValue}),B.maskedValue&&n.jsx("button",{onClick:()=>w(B.name),className:"btn btn-ghost px-1",title:U.has(B.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:U.has(B.name)?n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.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"}),n.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"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:B.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:B.status==="ready"?"var(--green)":"var(--orange)"},children:B.status==="ready"?"ready":"missing"}),B.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:B.source}),f===B.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:P=>m(P.target.value),onKeyDown:P=>{P.key==="Enter"&&D(B.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>D(B.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),m("")},className:"btn btn-ghost text-[10px] px-1",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):n.jsx("button",{onClick:()=>{h(B.name),m("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},B.name))}),M&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:k,onChange:B=>A(B.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:T,onChange:B=>C(B.target.value),onKeyDown:B=>{B.key==="Enter"&&E()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),n.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>{O(!1),A(""),C("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:E,disabled:y||!k.trim()||!T.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function bk(){const{state:a}=wn(),{plugin:r,skill:i}=a,[o,d]=g.useState(null),[p,f]=g.useState(!0);return g.useEffect(()=>{Ee.getDependencies(r,i).then(d).catch(()=>{}).finally(()=>f(!1))},[r,i]),p?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(yk,{plugin:r,skill:i}),n.jsx(ag,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(ag,{plugin:r,skill:i})]})}function xv({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,d=2,p=i-d*2,f=o-d*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,v=r.map((k,A)=>{const T=d+A/(h-1)*p,C=d+f-(k-x)/y*f;return`${T.toFixed(1)},${C.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:v.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,A]=v[v.length-1].split(",");return n.jsx("circle",{cx:k,cy:A,r:2.5,fill:S})})()]})}function jk(){return n.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:n.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 Sk({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function kk({score:a,rating:r}){const i={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)"}},o=i[r]??i.minimal,d=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[d,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function wk({warning:a}){return n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:a})]})}function Ck({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function Nk(a){var o,d,p;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const m=r.get(x);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((d=h.cost)==null?void 0:d.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(p=h.skillDelta)==null?void 0:p.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...m]=f.split("/");i.push({rank:0,model:m.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const gv=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function Ek({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:gv(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(jk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(xv,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function Tk({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:gv(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-2)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(Sk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(xv,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function Rk(){const{state:a}=wn(),{plugin:r,skill:i}=a,[o,d]=g.useState("rankings"),p=`leaderboard/${r}/${i}`,f=g.useCallback(()=>Ee.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=xr(p,f),m=(h==null?void 0:h.entries)??[];g.useEffect(()=>{d("rankings")},[r,i]);const y=g.useCallback(()=>an(p),[p]);fo("leaderboard:updated",y);const v=g.useMemo(()=>Nk(m),[m]),j=v.some(A=>A.hasBaseline),S=m[0],k=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):v.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),n.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),n.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"'}),n.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",n.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),n.jsx(Ck,{active:o,onChange:d,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[m.length," sweep",m.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),k&&n.jsx(wk,{warning:k}),o==="rankings"?n.jsx(Ek,{entries:v}):n.jsx(Tk,{entries:v}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(kk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const Ak=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Mk(a){return a!=null&&Ak.includes(a)}function zk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:d}=wn(),{state:p,refreshSkills:f,clearSelection:h}=ya(),x=g.useCallback(async()=>{try{await Ee.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const k=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${k}`})}},[r.plugin,r.skill,f,h,i]);g.useEffect(()=>{const k=new URLSearchParams(window.location.search).get("panel");Mk(k)&&k!==r.activePanel&&i({type:"SET_PANEL",panel:k})},[]),g.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const k=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",k)},[r.activePanel]);const m=g.useCallback(S=>{const k=S.ctrlKey||S.metaKey;if(k&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(k&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(g.useEffect(()=>(window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)),[m]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),v=((j=p.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(qu,{state:r,isReadOnly:d,onDelete:d?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Ls,{error:aS(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(tS,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:v}),n.jsx(nS,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(TS,{}),r.activePanel==="tests"&&n.jsx(_S,{}),r.activePanel==="run"&&n.jsx(KS,{}),r.activePanel==="activation"&&n.jsx(JS,{}),r.activePanel==="history"&&n.jsx(hk,{}),r.activePanel==="leaderboard"&&n.jsx(Rk,{}),r.activePanel==="deps"&&n.jsx(bk,{}),r.activePanel==="versions"&&n.jsx(lv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function Lk(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function Nu(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function Dk(a,r,i,o){const p=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${p}/${i}/skills/${o}/SKILL.md`;case 2:return`${p}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${p}/skills/${o}/SKILL.md`}}function _k({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=g.useState("ai"),[d,p]=g.useState(null),[f,h]=g.useState(!0),{config:x}=bl(),[m,y]=g.useState(""),[v,j]=g.useState(3),[S,k]=g.useState(""),[A,T]=g.useState(""),[C,M]=g.useState(""),[O,U]=g.useState(""),[L,V]=g.useState(""),[w,D]=g.useState(""),[E,B]=g.useState("write"),[P,q]=g.useState([]),[te,Q]=g.useState(!1),[z,R]=g.useState(null),[I,Z]=g.useState(""),[Y,de]=g.useState(!1),[_,W]=g.useState(!1),[ie,ue]=g.useState(null),[ge,xe]=g.useState(null),[we,oe]=g.useState([]),Se=g.useRef(null),De=g.useRef(null),Ie=g.useRef(null),ae=g.useRef(null),[pe,fe]=g.useState(!1),[he,ve]=g.useState(!1);g.useEffect(()=>{Ee.getProjectLayout().then(Le=>{p(Le),j(Le.suggestedLayout);const gt=Le.detectedLayouts.find(Kt=>Kt.layout===Le.suggestedLayout);gt!=null&>.existingPlugins.length&&k(gt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),g.useEffect(()=>{var Le;i==="ai"&&((Le=Se.current)==null||Le.focus())},[i]),g.useEffect(()=>()=>{var Le;(Le=De.current)==null||Le.abort()},[]);const _e=g.useMemo(()=>{var Le;return d?((Le=d.detectedLayouts.find(gt=>gt.layout===v))==null?void 0:Le.existingPlugins)||[]:[]},[d,v]),re=S==="__new__"?A:S,Te=d?Dk(d.root,v,re||"{plugin}",m||"{skill}"):"",Qe=g.useMemo(()=>d?d.detectedLayouts.filter(Le=>Le.layout!==4):[],[d]),at=g.useMemo(()=>{if(!d)return null;const Le=d.detectedLayouts.find(rt=>rt.layout===2&&rt.existingPlugins.length>0),gt=d.detectedLayouts.find(rt=>rt.layout===1&&rt.existingPlugins.length>0),Kt=Le||gt;return Kt?{layout:Kt.layout,plugins:Kt.existingPlugins}:null},[d]),$t=g.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const Le=x.provider||"claude-cli",gt=x.model||"sonnet";return{provider:Le,model:gt}},[x,r]),Pt=g.useCallback(()=>{var Le;(Le=De.current)==null||Le.abort(),de(!1)},[]),lt=g.useCallback(()=>{ue(null),xe(null)},[]),St=g.useCallback(async()=>{if(ue(null),xe(null),oe([]),Ie.current=null,!I.trim()){ue("Describe what your skill should do");return}de(!0);const Le=new AbortController;De.current=Le;const{provider:gt,model:Kt}=$t();try{const rt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Lk({prompt:I.trim(),provider:gt,model:Kt,targetAgents:P})),signal:Le.signal});if(!rt.ok||!rt.body){let jt=`HTTP ${rt.status}`;try{const In=await rt.json();In.error&&(jt=In.error)}catch{}throw new Error(jt)}const Qa=rt.body.getReader(),Zn=new TextDecoder;let Nt="",kt="";for(;;){const{done:jt,value:In}=await Qa.read();if(jt)break;Nt+=Zn.decode(In,{stream:!0});const Za=Nt.split(`
|
|
75
|
-
`);Nt=Za.pop()||"";for(const Hn of Za)if(Hn.startsWith("event: "))kt=Hn.slice(7).trim();else if(Hn.startsWith("data: ")){try{const $e=JSON.parse(Hn.slice(6));if(kt==="progress")oe(Ht=>[...Ht,{phase:$e.phase,message:$e.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const Ht={prompt:I.trim(),provider:$t().provider,model:$t().model,reasoning:$e.reasoning||""};if(y($e.name),M($e.description),U($e.model||""),V($e.allowedTools||""),D($e.body),W(!0),Ie.current=Ht,o("manual"),$e.suggestedPlugin&&typeof $e.suggestedPlugin=="object"&&$e.suggestedPlugin.plugin){const Et=$e.suggestedPlugin;if(((d==null?void 0:d.detectedLayouts.flatMap(Cn=>Cn.existingPlugins))??[]).includes(Et.plugin))if(k(Et.plugin),Et.layout&&(Et.layout===1||Et.layout===2))j(Et.layout);else{const Cn=d==null?void 0:d.detectedLayouts.find(So=>So.existingPlugins.includes(Et.plugin));Cn&&(Cn.layout===1||Cn.layout===2)&&j(Cn.layout)}else k("__new__"),T(Et.plugin)}else v===3&&at&&ve(!0);const Jn={name:$e.name,plugin:re||"",layout:v,description:$e.description,model:$e.model||void 0,allowedTools:$e.allowedTools||void 0,body:$e.body,aiMeta:Ht};Ee.saveDraft(Jn).then(Et=>{fe(!0),Et!=null&&Et.dir&&(ae.current=Et.dir)}).catch(()=>{})}else kt==="error"&&(ue($e.message||$e.description||"Unknown error"),$e.category&&xe($e))}catch{}kt=""}}}catch(rt){rt.name!=="AbortError"&&ue(rt.message)}finally{de(!1),De.current=null}},[I,$t,v,at,re,d,P]),ye=g.useCallback(async()=>{if(R(null),!m.trim()){R("Skill name is required");return}if(!C.trim()){R("Description is required");return}if(v!==3&&!re.trim()){R("Plugin name is required");return}Q(!0);try{const Le=await Ee.createSkill({name:Nu(m),plugin:re||"",layout:v,description:C,model:O||void 0,allowedTools:L||void 0,body:w,aiMeta:Ie.current||void 0,draftDir:ae.current||void 0});ae.current=null,a(Le.plugin,Le.skill)}catch(Le){R(Le.message)}finally{Q(!1)}},[m,C,v,re,O,L,w,a]),At=g.useCallback(()=>{at&&(j(at.layout),k(at.plugins[0]),ve(!1))},[at]);return{mode:i,setMode:o,layout:d,layoutLoading:f,selectedLayout:v,setSelectedLayout:j,creatableLayouts:Qe,availablePlugins:_e,pathPreview:Te,plugin:S,setPlugin:k,newPlugin:A,setNewPlugin:T,effectivePlugin:re,name:m,setName:y,description:C,setDescription:M,model:O,setModel:U,allowedTools:L,setAllowedTools:V,body:w,setBody:D,bodyViewMode:E,setBodyViewMode:B,aiPrompt:I,setAiPrompt:Z,generating:
|
|
74
|
+
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Qi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Qi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[E," prompt",E!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:w,disabled:y||!C.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${E} prompts tested`,j&&n.jsx(ak,{startedAt:j})]})]})]})]}),n.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[n.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),n.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:F?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Q}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[P.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),n.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((z,R)=>n.jsx(eg,{result:z},`incorrect-${R}`))})]}),B.length>0&&n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"16 10 11 15 8 12"})]}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",B.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:B.map((z,R)=>n.jsx(eg,{result:z},`correct-${R}`))})]})]}),m&&n.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),m.autoClassifiedCount!=null&&m.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[m.autoClassifiedCount," of ",m.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(tu,{label:"Precision",value:m.precision,description:"Of all activations, how many were correct?",detail:`${m.tp} true / ${m.tp+m.fp} total activations`}),n.jsx(tu,{label:"Recall",value:m.recall,description:"Of expected activations, how many fired?",detail:`${m.tp} activated / ${m.tp+m.fn} expected`}),n.jsx(tu,{label:"Reliability",value:m.reliability,description:"Overall correct classification rate",detail:`${m.tp+m.tn} correct / ${m.total} total`})]}),n.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),n.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[n.jsx(Zi,{label:"True Positive",abbr:"TP",count:m.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Zi,{label:"False Positive",abbr:"FP",count:m.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Zi,{label:"False Negative",abbr:"FN",count:m.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Zi,{label:"True Negative",abbr:"TN",count:m.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(ek,{history:T,expanded:L,onToggle:()=>V(!L)})]})}function ek({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.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:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(tk,{run:o},o.id))})})]})}function tk({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",d=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:nk(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:d,background:`color-mix(in srgb, ${d} 10%, transparent)`},children:o})]})]})}function nk(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const d=Math.floor(o/60);if(d<60)return`${d}m ago`;const p=Math.floor(d/60);if(p<24)return`${p}h ago`;const f=Math.floor(p/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Qi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function eg({result:a}){const r=Jx[a.classification]||Jx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function tu({label:a,value:r,description:i,detail:o}){const d=Math.round(r*100),p=d>=80?"var(--green)":d>=60?"var(--yellow)":"var(--red)";return n.jsxs("div",{className:"text-center",children:[n.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:p},children:[d,"%"]}),n.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:a}),n.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:i}),n.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function Zi({abbr:a,count:r,bg:i,color:o,description:d}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:d})]})}function ak({startedAt:a}){const[r,i]=g.useState(0);return g.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const nu={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},tg={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},wu=600,Cu=180,tn=40,au=wu-tn*2,Ga=Cu-tn*2,lk=[25,50,75,100];function ng(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function rk(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function sk({entries:a,onPointClick:r}){const[i,o]=g.useState(null),d=g.useMemo(()=>[...a].reverse(),[a]);if(d.length<2)return null;const p=d.length,f=d.map((m,y)=>{const v=tn+y/(p-1)*au,j=m.passRate*100,S=tn+Ga-j/100*Ga;return{x:v,y:S,pct:j,entry:m}}),h=f.map(m=>`${m.x},${m.y}`).join(" "),x=Array.from(new Set(d.map(m=>m.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:p>=20?"auto":void 0},children:[n.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),n.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(m=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:nu[m]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:tg[m]??m})]},m))}),n.jsxs("svg",{width:wu,height:Cu,viewBox:`0 0 ${wu} ${Cu}`,style:{display:"block",overflow:"visible"},children:[lk.map(m=>{const y=tn+Ga-m/100*Ga;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+au,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[m,"%"]})]},m)}),n.jsx("line",{x1:tn,y1:tn+Ga,x2:tn+au,y2:tn+Ga,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+Ga+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((m,y)=>n.jsx("circle",{cx:m.x,cy:m.y,r:5,fill:nu[m.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:m.x,y:m.y,entry:m.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(m.entry)},y)),ik(p).map(m=>n.jsx("text",{x:f[m].x,y:tn+Ga+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:ng(d[m].timestamp)},m))]}),i&&n.jsxs("div",{style:{position:"absolute",left:i.x,top:i.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:[n.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:ng(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:nu[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:tg[i.entry.type]??i.entry.type}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(i.entry.passRate*100),"%"]})]}),n.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:rk(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function ik(a){if(a<=3)return Array.from({length:a},(o,d)=>d);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const gs=new Map;let nn=null,so=null,Ji=1e3,vs=0;function hv(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const d=gs.get(r);if(d)for(const p of d)p(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,vs>0&&(so=setTimeout(()=>{Ji=Math.min(Ji*2,3e4),hv()},Ji))},nn.onopen=()=>{Ji=1e3}}function ok(){so!=null&&(clearTimeout(so),so=null),nn==null||nn.close(),nn=null}function ck(a,r){return gs.has(a)||gs.set(a,new Set),gs.get(a).add(r),vs++,hv(),()=>{var i;(i=gs.get(a))==null||i.delete(r),vs--,vs<=0&&(vs=0,ok())}}function fo(a,r){const i=g.useRef(r);i.current=r,g.useEffect(()=>ck(a,d=>i.current(d)),[a])}function po(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function dk(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function uk({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:po(a)},children:[i,"%"]})]}),n.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${i}%`,background:po(a)}})})]})})}function fk({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,d=a.length,p=a.map((x,m)=>{const y=o+m/(d-1)*(r-o*2),v=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:v}}),f=`M ${p[0].x},${i-o} `+p.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${p[p.length-1].x},${i-o} Z`,h=p.map((x,m)=>`${m===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:p[p.length-1].x,cy:p[p.length-1].y,r:3,fill:"var(--accent)"})]})}function pk({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=g.useCallback(()=>Ee.getStats(a,r),[a,r]),{data:d,loading:p}=xr(i,o),f=g.useCallback(()=>an(i),[i]);if(fo("benchmark:complete",f),fo("history:written",f),p)return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"skeleton h-24 rounded-xl"}),n.jsx("div",{className:"skeleton h-48 rounded-xl"}),n.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!d||d.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=d.trendPoints.length>0?d.trendPoints[d.trendPoints.length-1].passRate:0,x=d.trendPoints.length>0?d.trendPoints[0].passRate:0,m=h-x,y=d.assertionStats.slice(0,10);return n.jsxs("div",{className:"space-y-4 stagger-children",children:[n.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:d.totalRuns})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:po(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color:m>=0?"var(--green)":"var(--red)"},children:[m>=0?"+":"",Math.round(m*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),n.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:d.modelStats.length})]}),d.totalCost!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:kn(d.totalCost)})]}),d.costPerRun!=null&&n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),n.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:kn(d.costPerRun)})]})]}),d.trendPoints.length>=2&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),n.jsx(fk,{points:d.trendPoints})]}),d.modelStats.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[n.jsx("thead",{children:n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),n.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),n.jsx("tbody",{children:d.modelStats.map(v=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:po(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:dk(v.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?kn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(v=>n.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:j=>{j.currentTarget.style.background="var(--surface-2)"},onMouseLeave:j=>{j.currentTarget.style.background="transparent"},onClick:()=>{},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.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:["#",v.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),n.jsx(uk,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function mk({plugin:a,skill:r}){const[i,o]=g.useState(null),[d,p]=g.useState(null),[f,h]=g.useState({}),[x,m]=g.useState({});g.useEffect(()=>{Ee.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(v){if(d===v){p(null);return}if(p(v),!f[v]){m(j=>({...j,[v]:!0}));try{const j=await Ee.getCaseHistory(a,r,v);h(S=>({...S,[v]:j}))}catch{h(j=>({...j,[v]:[]}))}finally{m(j=>({...j,[v]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(v=>{const j=f[v.id]||[],S=d===v.id,k=x[v.id],A=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:S?"var(--surface-2)":"transparent"},onMouseEnter:T=>{S||(T.currentTarget.style.background="var(--surface-2)")},onMouseLeave:T=>{S||(T.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.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:["#",v.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),j.length>=2&&n.jsx(dv,{entries:j}),A!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(A)},children:[Math.round(A*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?n.jsxs("div",{className:"p-4 flex items-center gap-2",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):j.length===0?n.jsx("div",{className:"p-4",children:n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):n.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:j.map((T,C)=>n.jsxs("div",{className:"p-4",style:{background:C===0?"var(--surface-2)":"transparent"},children:[n.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:ov(T.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:T.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:T.type==="benchmark"?"rgba(99,131,255,0.15)":T.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:T.type==="benchmark"?"#6383ff":T.type==="comparison"?"var(--purple)":"#fb923c"},children:T.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(T.pass_rate)},children:[Math.round(T.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[T.durationMs!=null&&n.jsx("span",{children:cv(T.durationMs)}),T.tokens!=null&&n.jsxs("span",{children:[T.tokens>=1e3?`${(T.tokens/1e3).toFixed(1)}k`:T.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:T.assertions.map(M=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:M.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:M.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:M.text}),M.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:M.reasoning})]})]},M.id))})]},C))})})]},v.id)})}):n.jsx("div",{className:"text-center py-12",children:n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function hk(){const{state:a,dispatch:r}=wn(),{plugin:i,skill:o}=a,[d,p]=g.useState("timeline"),[f,h]=g.useState(""),[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState([]),[k,A]=g.useState(null),[T,C]=g.useState(!1),[M,O]=g.useState(null),[U,L]=g.useState(!1),V=`history/${i}/${o}?model=${f}&type=${x}`,w=g.useCallback(()=>Ee.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:D,loading:E}=xr(V,w),B=D??[];g.useEffect(()=>{!D||D.length<2||Ee.compareRuns(i,o,D[0].timestamp,D[1].timestamp).then(z=>{const R=z.regressions.filter(I=>I.change==="regression");r({type:"SET_REGRESSIONS",regressions:R})}).catch(()=>{})},[D,i,o,r]);const P=g.useCallback(()=>an(V),[V]);fo("history:written",P);const F=g.useCallback(async z=>{if(y){S(R=>R.includes(z)?R.filter(I=>I!==z):R.length>=2?[R[1],z]:[...R,z]);return}L(!0);try{const R=await Ee.getHistoryEntry(i,o,z);O(R)}catch{}finally{L(!1)}},[i,o,y]),te=g.useCallback(async()=>{if(j.length===2){C(!0);try{const z=await Ee.compareRuns(i,o,j[0],j[1]);A(z)}catch{}finally{C(!1)}}},[i,o,j]),Q=[...new Set(B.map(z=>z.model))];return E?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"skeleton h-12 rounded-lg"}),n.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(z=>n.jsx("button",{onClick:()=>p(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:d===z?"var(--accent-muted)":"transparent",color:d===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),d==="timeline"&&n.jsxs("div",{children:[B.length>0&&n.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:n.jsx(sk,{entries:B,onPointClick:z=>F(z.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:z=>h(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),Q.map(z=>n.jsx("option",{value:z,children:z},z))]}),n.jsxs("select",{value:x,onChange:z=>m(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Types"}),n.jsx("option",{value:"benchmark",children:"Benchmark"}),n.jsx("option",{value:"comparison",children:"Comparison"}),n.jsx("option",{value:"baseline",children:"Baseline"}),n.jsx("option",{value:"model-compare",children:"Model Compare"}),n.jsx("option",{value:"improve",children:"AI Improve"}),n.jsx("option",{value:"instruct",children:"AI Edit"}),n.jsx("option",{value:"ai-generate",children:"AI Generate"}),n.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{onClick:()=>{v(!y),S([]),A(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:te,disabled:T,className:"btn btn-primary text-[12px]",children:T?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:B.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):B.map(z=>{const R=j.includes(z.timestamp);return n.jsx("button",{onClick:()=>F(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:R?"var(--accent-muted)":"var(--surface-1)",border:R?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:I=>{R||(I.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:I=>{R||(I.currentTarget.style.borderColor="var(--border-subtle)")},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:R?"var(--accent)":"var(--border-default)",background:R?"var(--accent)":"transparent"},children:R&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(z.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"var(--accent-muted)":z.type==="improve"||z.type==="instruct"?"var(--purple-muted)":z.type==="ai-generate"?"var(--green-muted)":z.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"var(--accent)":z.type==="improve"||z.type==="instruct"?"var(--purple)":z.type==="ai-generate"?"var(--green)":z.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type==="instruct"?"ai edit":z.type==="ai-generate"?"ai generate":z.type==="eval-generate"?"eval generate":z.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),z.totalCost!=null&&z.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:kn(z.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),k&&n.jsx(xk,{result:k}),M&&!y&&n.jsx(gk,{run:M,onClose:()=>O(null)})]}),d==="per-eval"&&n.jsx(mk,{plugin:i,skill:o}),d==="statistics"&&n.jsx(pk,{plugin:i,skill:o})]})}function xk({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",kn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",kn(a.runB.totalCost??null)]}),a.runA.totalCost!=null&&a.runB.totalCost!=null&&n.jsxs("span",{style:{color:a.runB.totalCost<=a.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",kn(a.runB.totalCost-a.runA.totalCost)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function gk({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(vk,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${kn(a.totalCost)}`]}),n.jsx("div",{className:"space-y-2",children:a.cases.map(i=>n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",i.eval_id," ",i.eval_name]}),n.jsxs("div",{className:"flex items-center gap-2",children:[i.cost!=null&&i.cost>0&&n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:kn(i.cost)}),n.jsx("span",{className:"text-[11px] font-semibold",style:{color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.pass_rate!=null?`${Math.round(i.pass_rate*100)}%`:i.status})]})]})},i.eval_id))})]})}function vk({run:a,onClose:r}){var p;const i=g.useMemo(()=>a.improve?jo(a.improve.original,a.improve.improved):[],[a.improve]),o=g.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),d=g.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.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:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((p=a.improve)==null?void 0:p.reasoning)&&n.jsxs("div",{className:"mx-4 mt-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--purple-muted)",border:"1px solid var(--purple-muted)",color:"var(--text-secondary)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),a.improve.reasoning]}),n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:d.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||""})]},h))})})})]})}function yk({plugin:a,skill:r}){const[i,o]=g.useState([]),[d,p]=g.useState([]),[f,h]=g.useState(!0),[x,m]=g.useState(null);g.useEffect(()=>{Ee.getDependencies(a,r).then(v=>{o(v.mcpDependencies),p(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(v,j){try{await navigator.clipboard.writeText(j),m(v),setTimeout(()=>m(null),2e3)}catch{}}return f?null:i.length===0&&d.length===0?n.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"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.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:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.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"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+d.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(v=>n.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),n.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===v.server?"var(--green)":"var(--accent)"},children:x===v.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.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"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},v.server))]}),d.length>0&&n.jsxs("div",{children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),n.jsx("div",{className:"space-y-1.5",children:d.map(v=>n.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:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.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"})}),n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function ag({plugin:a,skill:r}){const[i,o]=g.useState([]),[d,p]=g.useState(!0),[f,h]=g.useState(null),[x,m]=g.useState(""),[y,v]=g.useState(!1),[j,S]=g.useState(null),[k,A]=g.useState(""),[T,C]=g.useState(""),[M,O]=g.useState(!1),[U,L]=g.useState(new Set),V=g.useCallback(async()=>{p(!0);try{const[B,P]=await Promise.all([Ee.getCredentials(a,r).catch(()=>({credentials:[]})),Ee.getParams(a,r).catch(()=>({params:[]}))]),F=new Map(P.params.map(z=>[z.name,z])),te=new Set,Q=[];for(const z of B.credentials){te.add(z.name);const R=F.get(z.name);Q.push({name:z.name,status:z.status==="ready"||z.status==="resolved"?"ready":"missing",source:z.source,maskedValue:R==null?void 0:R.maskedValue})}for(const z of P.params)te.has(z.name)||Q.push({name:z.name,status:z.status,maskedValue:z.maskedValue});o(Q)}finally{p(!1)}},[a,r]);g.useEffect(()=>{V()},[V]);const w=g.useCallback(async B=>{if(U.has(B)){L(P=>{const F=new Set(P);return F.delete(B),F}),o(P=>P.map(F=>F.name===B?{...F,revealedValue:void 0}:F));return}try{const F=(await Ee.getParamsRevealed(a,r,B)).params.find(te=>te.name===B);F&&(o(te=>te.map(Q=>Q.name===B?{...Q,revealedValue:F.value}:Q)),L(te=>new Set(te).add(B)))}catch{}},[a,r,U]),D=async(B,P)=>{if(!(!B.trim()||!P.trim())){v(!0),S(null);try{await Ee.setCredential(a,r,B,P),h(null),m(""),L(new Set),V()}catch(F){S(F.message)}finally{v(!1)}}},E=async()=>{if(!(!k.trim()||!T.trim())){v(!0),S(null);try{await Ee.setCredential(a,r,k.trim().toUpperCase(),T),A(""),C(""),O(!1),V()}catch(B){S(B.message)}finally{v(!1)}}};return d?n.jsxs("div",{className:"mt-6",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):n.jsxs("div",{className:"mt-6",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),n.jsx("button",{onClick:()=>O(!M),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!M?n.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"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(B=>n.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:[n.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:B.name}),B.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:U.has(B.name)&&B.revealedValue!=null?B.revealedValue:B.maskedValue}),B.maskedValue&&n.jsx("button",{onClick:()=>w(B.name),className:"btn btn-ghost px-1",title:U.has(B.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:U.has(B.name)?n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.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"}),n.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"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:B.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:B.status==="ready"?"var(--green)":"var(--orange)"},children:B.status==="ready"?"ready":"missing"}),B.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:B.source}),f===B.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:P=>m(P.target.value),onKeyDown:P=>{P.key==="Enter"&&D(B.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>D(B.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),m("")},className:"btn btn-ghost text-[10px] px-1",children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):n.jsx("button",{onClick:()=>{h(B.name),m("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},B.name))}),M&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:k,onChange:B=>A(B.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:T,onChange:B=>C(B.target.value),onKeyDown:B=>{B.key==="Enter"&&E()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),n.jsxs("div",{className:"flex justify-end gap-1.5",children:[n.jsx("button",{onClick:()=>{O(!1),A(""),C("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:E,disabled:y||!k.trim()||!T.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function bk(){const{state:a}=wn(),{plugin:r,skill:i}=a,[o,d]=g.useState(null),[p,f]=g.useState(!0);return g.useEffect(()=>{Ee.getDependencies(r,i).then(d).catch(()=>{}).finally(()=>f(!1))},[r,i]),p?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),n.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(yk,{plugin:r,skill:i}),n.jsx(ag,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(ag,{plugin:r,skill:i})]})}function xv({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,d=2,p=i-d*2,f=o-d*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,v=r.map((k,A)=>{const T=d+A/(h-1)*p,C=d+f-(k-x)/y*f;return`${T.toFixed(1)},${C.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:v.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,A]=v[v.length-1].split(",");return n.jsx("circle",{cx:k,cy:A,r:2.5,fill:S})})()]})}function jk(){return n.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:n.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 Sk({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function kk({score:a,rating:r}){const i={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)"}},o=i[r]??i.minimal,d=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[d,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function wk({warning:a}){return n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.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"}),n.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),n.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:a})]})}function Ck({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function Nk(a){var o,d,p;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const m=r.get(x);m.passRates.push(h.passRate.mean),m.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,m.lastDuration=h.duration.mean,m.lastCost=((d=h.cost)==null?void 0:d.total)??null,m.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(m.lastBaselinePassRate=h.baselinePassRate.mean,m.lastSkillDelta=(p=h.skillDelta)==null?void 0:p.mean,m.lastAmplificationPct=h.amplificationPct,m.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...m]=f.split("/");i.push({rank:0,model:m.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const gv=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function Ek({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:gv(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(jk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(xv,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function Tk({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:gv(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-2)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(Sk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(xv,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function Rk(){const{state:a}=wn(),{plugin:r,skill:i}=a,[o,d]=g.useState("rankings"),p=`leaderboard/${r}/${i}`,f=g.useCallback(()=>Ee.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=xr(p,f),m=(h==null?void 0:h.entries)??[];g.useEffect(()=>{d("rankings")},[r,i]);const y=g.useCallback(()=>an(p),[p]);fo("leaderboard:updated",y);const v=g.useMemo(()=>Nk(m),[m]),j=v.some(A=>A.hasBaseline),S=m[0],k=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):v.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),n.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),n.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"'}),n.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",n.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):n.jsxs("div",{className:"p-5 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),n.jsx(Ck,{active:o,onChange:d,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[m.length," sweep",m.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),k&&n.jsx(wk,{warning:k}),o==="rankings"?n.jsx(Ek,{entries:v}):n.jsx(Tk,{entries:v}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(kk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const Ak=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Mk(a){return a!=null&&Ak.includes(a)}function zk({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:d}=wn(),{state:p,refreshSkills:f,clearSelection:h}=ya(),x=g.useCallback(async()=>{try{await Ee.deleteSkill(r.plugin,r.skill),f(),h()}catch(S){const k=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${k}`})}},[r.plugin,r.skill,f,h,i]);g.useEffect(()=>{const k=new URLSearchParams(window.location.search).get("panel");Mk(k)&&k!==r.activePanel&&i({type:"SET_PANEL",panel:k})},[]),g.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const k=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",k)},[r.activePanel]);const m=g.useCallback(S=>{const k=S.ctrlKey||S.metaKey;if(k&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(k&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(g.useEffect(()=>(window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)),[m]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),v=((j=p.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(Fu,{state:r,isReadOnly:d,onDelete:d?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Ls,{error:aS(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(tS,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:v}),n.jsx(nS,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(TS,{}),r.activePanel==="tests"&&n.jsx(_S,{}),r.activePanel==="run"&&n.jsx(KS,{}),r.activePanel==="activation"&&n.jsx(JS,{}),r.activePanel==="history"&&n.jsx(hk,{}),r.activePanel==="leaderboard"&&n.jsx(Rk,{}),r.activePanel==="deps"&&n.jsx(bk,{}),r.activePanel==="versions"&&n.jsx(lv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function Lk(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function Nu(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function Dk(a,r,i,o){const p=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${p}/${i}/skills/${o}/SKILL.md`;case 2:return`${p}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${p}/skills/${o}/SKILL.md`}}function _k({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=g.useState("ai"),[d,p]=g.useState(null),[f,h]=g.useState(!0),{config:x}=bl(),[m,y]=g.useState(""),[v,j]=g.useState(3),[S,k]=g.useState(""),[A,T]=g.useState(""),[C,M]=g.useState(""),[O,U]=g.useState(""),[L,V]=g.useState(""),[w,D]=g.useState(""),[E,B]=g.useState("write"),[P,F]=g.useState([]),[te,Q]=g.useState(!1),[z,R]=g.useState(null),[I,Z]=g.useState(""),[q,de]=g.useState(!1),[_,W]=g.useState(!1),[ie,ue]=g.useState(null),[ge,xe]=g.useState(null),[we,oe]=g.useState([]),Se=g.useRef(null),De=g.useRef(null),Ie=g.useRef(null),ae=g.useRef(null),[pe,fe]=g.useState(!1),[he,ve]=g.useState(!1);g.useEffect(()=>{Ee.getProjectLayout().then(Le=>{p(Le),j(Le.suggestedLayout);const gt=Le.detectedLayouts.find(Kt=>Kt.layout===Le.suggestedLayout);gt!=null&>.existingPlugins.length&&k(gt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),g.useEffect(()=>{var Le;i==="ai"&&((Le=Se.current)==null||Le.focus())},[i]),g.useEffect(()=>()=>{var Le;(Le=De.current)==null||Le.abort()},[]);const _e=g.useMemo(()=>{var Le;return d?((Le=d.detectedLayouts.find(gt=>gt.layout===v))==null?void 0:Le.existingPlugins)||[]:[]},[d,v]),re=S==="__new__"?A:S,Te=d?Dk(d.root,v,re||"{plugin}",m||"{skill}"):"",Qe=g.useMemo(()=>d?d.detectedLayouts.filter(Le=>Le.layout!==4):[],[d]),at=g.useMemo(()=>{if(!d)return null;const Le=d.detectedLayouts.find(rt=>rt.layout===2&&rt.existingPlugins.length>0),gt=d.detectedLayouts.find(rt=>rt.layout===1&&rt.existingPlugins.length>0),Kt=Le||gt;return Kt?{layout:Kt.layout,plugins:Kt.existingPlugins}:null},[d]),$t=g.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const Le=x.provider||"claude-cli",gt=x.model||"sonnet";return{provider:Le,model:gt}},[x,r]),Pt=g.useCallback(()=>{var Le;(Le=De.current)==null||Le.abort(),de(!1)},[]),lt=g.useCallback(()=>{ue(null),xe(null)},[]),St=g.useCallback(async()=>{if(ue(null),xe(null),oe([]),Ie.current=null,!I.trim()){ue("Describe what your skill should do");return}de(!0);const Le=new AbortController;De.current=Le;const{provider:gt,model:Kt}=$t();try{const rt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Lk({prompt:I.trim(),provider:gt,model:Kt,targetAgents:P})),signal:Le.signal});if(!rt.ok||!rt.body){let jt=`HTTP ${rt.status}`;try{const In=await rt.json();In.error&&(jt=In.error)}catch{}throw new Error(jt)}const Qa=rt.body.getReader(),Zn=new TextDecoder;let Nt="",kt="";for(;;){const{done:jt,value:In}=await Qa.read();if(jt)break;Nt+=Zn.decode(In,{stream:!0});const Za=Nt.split(`
|
|
75
|
+
`);Nt=Za.pop()||"";for(const Hn of Za)if(Hn.startsWith("event: "))kt=Hn.slice(7).trim();else if(Hn.startsWith("data: ")){try{const $e=JSON.parse(Hn.slice(6));if(kt==="progress")oe(Ht=>[...Ht,{phase:$e.phase,message:$e.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const Ht={prompt:I.trim(),provider:$t().provider,model:$t().model,reasoning:$e.reasoning||""};if(y($e.name),M($e.description),U($e.model||""),V($e.allowedTools||""),D($e.body),W(!0),Ie.current=Ht,o("manual"),$e.suggestedPlugin&&typeof $e.suggestedPlugin=="object"&&$e.suggestedPlugin.plugin){const Et=$e.suggestedPlugin;if(((d==null?void 0:d.detectedLayouts.flatMap(Cn=>Cn.existingPlugins))??[]).includes(Et.plugin))if(k(Et.plugin),Et.layout&&(Et.layout===1||Et.layout===2))j(Et.layout);else{const Cn=d==null?void 0:d.detectedLayouts.find(So=>So.existingPlugins.includes(Et.plugin));Cn&&(Cn.layout===1||Cn.layout===2)&&j(Cn.layout)}else k("__new__"),T(Et.plugin)}else v===3&&at&&ve(!0);const Jn={name:$e.name,plugin:re||"",layout:v,description:$e.description,model:$e.model||void 0,allowedTools:$e.allowedTools||void 0,body:$e.body,aiMeta:Ht};Ee.saveDraft(Jn).then(Et=>{fe(!0),Et!=null&&Et.dir&&(ae.current=Et.dir)}).catch(()=>{})}else kt==="error"&&(ue($e.message||$e.description||"Unknown error"),$e.category&&xe($e))}catch{}kt=""}}}catch(rt){rt.name!=="AbortError"&&ue(rt.message)}finally{de(!1),De.current=null}},[I,$t,v,at,re,d,P]),ye=g.useCallback(async()=>{if(R(null),!m.trim()){R("Skill name is required");return}if(!C.trim()){R("Description is required");return}if(v!==3&&!re.trim()){R("Plugin name is required");return}Q(!0);try{const Le=await Ee.createSkill({name:Nu(m),plugin:re||"",layout:v,description:C,model:O||void 0,allowedTools:L||void 0,body:w,aiMeta:Ie.current||void 0,draftDir:ae.current||void 0});ae.current=null,a(Le.plugin,Le.skill)}catch(Le){R(Le.message)}finally{Q(!1)}},[m,C,v,re,O,L,w,a]),At=g.useCallback(()=>{at&&(j(at.layout),k(at.plugins[0]),ve(!1))},[at]);return{mode:i,setMode:o,layout:d,layoutLoading:f,selectedLayout:v,setSelectedLayout:j,creatableLayouts:Qe,availablePlugins:_e,pathPreview:Te,plugin:S,setPlugin:k,newPlugin:A,setNewPlugin:T,effectivePlugin:re,name:m,setName:y,description:C,setDescription:M,model:O,setModel:U,allowedTools:L,setAllowedTools:V,body:w,setBody:D,bodyViewMode:E,setBodyViewMode:B,aiPrompt:I,setAiPrompt:Z,generating:q,aiGenerated:_,aiError:ie,aiClassifiedError:ge,aiProgress:we,promptRef:Se,handleGenerate:St,handleCancelGenerate:Pt,clearAiError:lt,targetAgents:P,setTargetAgents:F,draftSaved:pe,showPluginRecommendation:he,setShowPluginRecommendation:ve,pluginLayoutInfo:at,applyPluginRecommendation:At,creating:te,error:z,handleCreate:ye}}function vv(){return n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:n.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 Ok(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function yv({node:a,depth:r=0}){var i;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:a.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[a.type==="dir"?n.jsx(vv,{}):n.jsx(Ok,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(yv,{node:o,depth:r+1},o.name))]})}function Bk(a,r,i){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const d=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return i&&d.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:d}}function Ik({skillName:a,hasEvals:r,isDraft:i}){const o=Bk(a,r,i);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(vv,{})}),"Skill Structure"]}),n.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:n.jsx(yv,{node:o})})]})}const Fa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function lu({size:a=14,color:r="currentColor"}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.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 Hk({onCreated:a,onCancel:r}){const i=_k({onCreated:a});return n.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[n.jsxs("div",{className:"mb-5",children:[n.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),n.jsx("div",{className:"flex items-center justify-between mt-2",children:n.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsx("button",{onClick:()=>i.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:i.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:i.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(lu,{size:12}),"AI-Assisted"]})}),n.jsx("button",{onClick:()=>i.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:i.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:i.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:i.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),i.layoutLoading&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),n.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!i.layoutLoading&&i.layout&&i.mode==="ai"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:n.jsx(lu,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:o=>i.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
76
76
|
|
|
77
|
-
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Ds,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Ls,{error:i.aiClassifiedError,onRetry:i.handleGenerate,onDismiss:i.clearAiError}):n.jsxs("div",{children:[n.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:i.aiError}),n.jsx("button",{onClick:i.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[i.generating?n.jsx("button",{onClick:i.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"}):n.jsxs("button",{onClick:i.handleGenerate,disabled:!i.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:i.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:i.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:i.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(lu,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,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"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(Nu(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.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:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.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:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(Nu(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
|
|
77
|
+
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...Fa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Ds,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Ls,{error:i.aiClassifiedError,onRetry:i.handleGenerate,onDismiss:i.clearAiError}):n.jsxs("div",{children:[n.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:i.aiError}),n.jsx("button",{onClick:i.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[i.generating?n.jsx("button",{onClick:i.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"}):n.jsxs("button",{onClick:i.handleGenerate,disabled:!i.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:i.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:i.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:i.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[n.jsx(lu,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,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"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Fa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(Nu(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:Fa})]}),n.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:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.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:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(Nu(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Fa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...Fa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Fa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Fa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
|
|
78
78
|
|
|
79
79
|
You are an expert at...
|
|
80
|
-
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...qa,minHeight:"150px"}}):i.body.trim()?n.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:bo(i.body)}}):n.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:n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),n.jsx(Ik,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.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:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,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 Uk(){return n.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:n.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:[n.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"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function io({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:d}=ya(),[p,f]=g.useState(!1);return a==="no-selection"?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[n.jsx("div",{className:"mb-5",children:p?n.jsx(Uk,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.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:n.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"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.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"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.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:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,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"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>d(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Vk(a,r){const[i,o]=a.split(".").map(Number),[d,p]=r.split(".").map(Number);return d>i?"major":p>o?"minor":"patch"}const $k={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}};function Pk(){const[a,r]=g.useState([]),[i,o]=g.useState(!0),[d,p]=g.useState(new Set),[f,h]=g.useState(new Map),[x,m]=g.useState(!1),[y,v]=g.useState(new Set),[j,S]=g.useState(null),[k,A]=g.useState(null),[T,C]=g.useState(!1),M=g.useCallback(async()=>{o(!0);try{const E=await Ee.getSkillUpdates();r(E.filter(B=>B.updateAvailable))}catch{r([])}finally{o(!1)}},[]);g.useEffect(()=>{M()},[M]);const O=g.useMemo(()=>a.filter(E=>!E.pinned),[a]),U=g.useCallback(E=>{p(B=>{const P=new Set(B);return P.has(E)?P.delete(E):P.add(E),P})},[]),L=g.useCallback(()=>{d.size===O.length?p(new Set):p(new Set(O.map(E=>E.name)))},[d,O]),V=g.useCallback(()=>{const E=[...d];if(!E.length)return;m(!0),h(new Map(E.map(P=>[P,{skill:P,status:"pending"}])));const B=Ee.startBatchUpdate(E);B.addEventListener("progress",P=>{try{const q=JSON.parse(P.data);h(te=>new Map(te).set(q.skill,q))}catch{}}),B.addEventListener("done",P=>{B.close(),m(!1);try{const q=JSON.parse(P.data);S(`Updated ${q.updated??0} skills, ${q.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}M()}),B.addEventListener("error",()=>{B.close(),m(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[d,M]),w=g.useCallback(E=>{E.name.split("/").pop()||E.name;const B=E.name.split("/"),P=B.length>=3?B[B.length-2]:B[0],q=B[B.length-1];v(Q=>new Set(Q).add(E.name));const te=Ee.startSkillUpdate(P,q);te.addEventListener("done",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(E.name),z}),M()}),te.addEventListener("error",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(E.name),z})})},[M]),D=g.useCallback(async E=>{if(!E.latest)return;const B=E.name.split("/"),P=B.length>=3?B[B.length-2]:B[0],q=B[B.length-1];C(!0);try{const te=await Ee.getVersionDiff(P,q,E.installed,E.latest);A({skill:E,diff:te})}catch{A(null)}finally{C(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:M,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",O.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:M,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:V,disabled:d.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${d.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:L,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:d.size===O.length&&O.length>0?"var(--accent)":"var(--border-default)",background:d.size===O.length&&O.length>0?"var(--accent)":"transparent"},children:d.size===O.length&&O.length>0&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),n.jsx("div",{className:"space-y-2",children:a.map(E=>{const B=E.name.split("/").pop()||E.name,P=E.latest?Vk(E.installed,E.latest):"patch",q=$k[P],te=!!E.pinned,Q=y.has(E.name),z=f.get(E.name),R=d.has(E.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!te&&U(E.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:R?"var(--accent)":"var(--border-default)",background:R?"var(--accent)":"transparent",opacity:te?.4:1},children:R&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:B}),te&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:q.bg,color:q.text},children:P})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[E.installed," → ",E.latest||"?",te&&` (pinned at ${E.pinnedVersion||E.installed})`]})]}),z&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.status==="done"?"var(--green-muted)":z.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:z.status==="done"?"var(--green)":z.status==="error"?"var(--red)":"var(--yellow)"},children:[z.status,z.error&&`: ${z.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>D(E),className:"btn btn-ghost text-[11px]",disabled:T,children:"View Changes"}),n.jsx("button",{onClick:()=>w(E),disabled:te||Q||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:Q?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(z==null?void 0:z.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},E.name)})}),k&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>A(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:E=>E.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>A(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(Gu,{contentDiff:k.diff.contentDiff,fromLabel:k.diff.from,toLabel:k.diff.to,diffSummary:k.diff.diffSummary,renderContext:"inline"})]})})]})}const Gk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],yr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},br={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},qk={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},bv={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},jv={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Yk={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Fk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},Wk={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function Kk(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function Sv(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const d=Math.floor(o/60);if(d<60)return`${d} min ago`;const p=Math.floor(d/60);if(p<24)return`${p} hr ago`;const f=Math.floor(p/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Xk(a){const r=Gk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?Wk[a]:void 0;return n.jsx("span",{style:Yk,title:r,children:"—"})}function jn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:qk,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return jn(a,hr(a));if(i.path)return jn(a,n.jsx("span",{"data-path-value":"true",style:Fk,children:r}));const o=i.tabular?fr:i.mono?jv:bv;return jn(a,n.jsx("span",{style:o,children:r}))}function Qk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[Zk(a),a.origin==="installed"?Jk(a):null,ew(a),nw(a),aw(a),rw(a,r,i)]})}function Zk(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...jv,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:br,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:yr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),jn("Homepage",r),jn("Tags",i)]},"frontmatter")}function Jk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:bv,"data-agent-id":r,children:Xk(r)}):hr("Agent");return n.jsxs("section",{style:br,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:yr,children:"Source agent"}),jn("Agent",i)]},"source-agent")}function ew(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:Sv(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,d=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>tw(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:br,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:yr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),jn("Entry point",d),jn("Size",n.jsx("span",{style:fr,children:Kk(a.sizeBytes)})),jn("Last modified",r)]},"filesystem")}function tw(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function nw(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:Sv(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:br,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:yr,children:"Benchmark"}),jn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),jn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),jn("Status",i),jn("Last benchmark",o)]},"benchmark")}function aw(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:br,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:yr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(lw,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function lw(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",children:[n.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"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function rw(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:br,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:yr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(d=>{const p=sw(d,r),f=p!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:p.plugin,skill:p.skill,origin:p.origin}):void 0,m=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i({plugin:p.plugin,skill:p.skill,origin:p.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":f?"true":"false",title:f?`Open ${d}`:"Not installed",onClick:x,onKeyDown:m,style:h,children:d},d)})})]},"skill-deps")}function sw(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const d of r)if(i&&d.plugin===i&&d.skill===o||!i&&d.skill===o)return d;return null}const lg=g.memo(function({message:r,politeness:i="polite",role:o}){const d=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:d,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function iw({toast:a,onDismiss:r}){const[i,o]=g.useState(!0),d=g.useRef(null);g.useEffect(()=>(d.current=requestAnimationFrame(()=>{d.current=requestAnimationFrame(()=>o(!1))}),()=>{d.current!=null&&cancelAnimationFrame(d.current)}),[]);const p={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return n.jsxs("div",{role:a.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":a.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${p[a.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:i?"translateY(8px)":"translateY(0)",opacity:i?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{style:{flex:1,minWidth:0},children:a.message}),a.action&&n.jsx("button",{type:"button",onClick:()=>{a.action.onInvoke(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function ow({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(lg,{politeness:"polite",message:i}),n.jsx(lg,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(d=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(iw,{toast:d,onDismiss:r})},d.id))})]})}const kv=g.createContext(null);function Yu(){const a=g.useContext(kv);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function cw({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,d]=g.useState([]),[p,f]=g.useState(""),[h,x]=g.useState(""),m=g.useRef(new Map),y=g.useCallback(T=>{const C=m.current.get(T);C&&(clearTimeout(C),m.current.delete(T)),d(M=>M.filter(O=>O.id!==T))},[]),v=g.useCallback((T,C)=>{if(C<=0)return;const M=setTimeout(()=>{y(T)},C);m.current.set(T,M)},[y]),j=g.useCallback(T=>{const C=T.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,M={id:C,message:T.message,severity:T.severity??"info",durationMs:T.durationMs??i,action:T.action};return d(O=>[...O,M]),M.severity==="error"?x(M.message):f(M.message),v(C,M.durationMs),C},[i,v]),S=g.useCallback(()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear(),d([])},[]);g.useEffect(()=>{function T(C){C.key==="Escape"&&d(M=>{if(M.length===0)return M;const O=M.slice(0,r),U=O[O.length-1],L=m.current.get(U.id);return L&&(clearTimeout(L),m.current.delete(U.id)),M.filter(V=>V.id!==U.id)})}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),g.useEffect(()=>()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear()},[]);const k=o.slice(0,r),A=g.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(kv.Provider,{value:A,children:[a,n.jsx(ow,{toasts:k,onDismiss:y,liveMessage:p,liveAssertiveMessage:h})]})}function dw(a){const{toast:r}=Yu(),i=g.useRef(a);i.current=a;const o=g.useCallback(async(...d)=>{const p=i.current,f=p.snapshot();p.apply(...d),p.confirmGraceMs;const h=p.timeoutMs??5e3;let x=!1,m,y=!1;const v=p.commit(...d).then(()=>{x=!0,y=!0},k=>{x=!0,m=k??new Error("Commit failed")}),j=new Promise(k=>{setTimeout(k,h)});if(await Promise.race([v,j]),!x)m=new Error("TIMEOUT");else if(y)return;p.rollback(f);const S=typeof p.failureMessage=="function"?p.failureMessage(m):p.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...d)}}})},[r]);return{run:o}}const rg=6e4;function uw({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Yu(),[o,d]=g.useState("idle"),[p,f]=g.useState(null),[h,x]=g.useState(!1),[m,y]=g.useState(null),[v,j]=g.useState(!1),S=g.useRef(null),k=g.useRef(null),A=g.useCallback(()=>new Promise((U,L)=>{if(!a){L(new Error("No skill selected"));return}const V=Ee.startSkillUpdate(a.plugin,a.skill);S.current=V;const w=()=>{k.current&&(clearTimeout(k.current),k.current=null);try{V.close()}catch{}S.current=null};k.current=setTimeout(()=>{w(),L(new Error("TIMEOUT"))},rg),V.addEventListener("progress",D=>{try{const E=JSON.parse(D.data);typeof(E==null?void 0:E.status)=="string"&&f(E.status)}catch{}}),V.addEventListener("done",()=>{w(),d("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),U()}),V.addEventListener("error",D=>{w();let E="Stream error";try{const B=typeof D.data=="string"?JSON.parse(D.data):null;B!=null&&B.error&&(E=String(B.error))}catch{}L(new Error(E))})}),[a,r,i]),T=dw({snapshot:()=>({status:o}),apply:()=>{d("updating"),f("updating")},commit:()=>A(),rollback:U=>{d(U.status==="updating"?"idle":U.status),f(null)},failureMessage:U=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${U.message}`,timeoutMs:rg+1e3});if(g.useEffect(()=>{if(!h||m!=null||!a||!a.latestVersion)return;let U=!1;return j(!0),Ee.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(L=>{U||y(L)}).catch(()=>{U||y(null)}).finally(()=>{U||j(!1)}),()=>{U=!0}},[h,m,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),g.useEffect(()=>()=>{if(k.current&&clearTimeout(k.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const C=a.latestVersion,M=o==="updating"?"Updating…":C?`Update to ${C}`:"Update",O=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{T.run()},disabled:O,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:O?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:M}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(U=>!U),disabled:O||!C,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),p&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:p}),h&&C&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[v&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!v&&m&&n.jsx(Gu,{contentDiff:m.contentDiff,fromLabel:m.from,toLabel:m.to,diffSummary:m.diffSummary??void 0,renderContext:"inline"}),!v&&!m&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function ru(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("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:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function fw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return pw(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:d}=ya(),[p,f]=g.useState(typeof window<"u"?window.location.hash:"");if(g.useEffect(()=>{const m=()=>f(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),p==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ru,{}),n.jsx(Pk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ru,{}),n.jsx(Hk,{onCreated:(m,y)=>{o("browse"),d(),i({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(io,{variant:"error",message:r.skillsError,onRetry:d}):!r.skillsLoading&&r.skills.length===0?n.jsx(io,{variant:"no-skills"}):n.jsx(io,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(ru,{}),n.jsx(mw,{skillInfo:x,allSkills:r.skills,onSelectSkill:m=>i(m)})]})}function pw(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return gw();if(a.loadError)return vw(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return wv(r,i,a.onDetailTabChange,o)}function mw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,d]=g.useState("overview"),p=g.useMemo(()=>a?wv(a,o,d,{allSkills:r,onSelectSkill:i}):n.jsx(io,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:p})}const hw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function xw(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:hw.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function gw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function vw(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[qu({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function wv(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:qu({skill:a})}),n.jsx(uw,{skill:a}),xw(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[Qk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(Hx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(zk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(Hx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(lv,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function yw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return g.useEffect(()=>{if(!o)return;const d=setTimeout(()=>i(),1e4);return()=>clearTimeout(d)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const bw=[{name:J.shortcuts.groupNavigation,items:[{keys:"/",label:J.shortcuts.search},{keys:"j",label:J.shortcuts.moveDown},{keys:"k",label:J.shortcuts.moveUp},{keys:"Enter",label:J.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:J.shortcuts.groupActions,items:[{keys:"⌘K",label:J.shortcuts.openPalette},{keys:"?",label:J.shortcuts.openShortcuts},{keys:"⌘B",label:J.shortcuts.toggleSidebar},{keys:"E",label:J.actions.edit}]},{name:J.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:J.shortcuts.toggleTheme}]}];function jw({open:a,onClose:r,groups:i=bw,title:o=J.shortcuts.title}){const d=g.useRef(null),p=g.useRef(null);return g.useEffect(()=>{var f;if(a)return d.current=document.activeElement??null,(f=p.current)==null||f.focus(),()=>{var h,x;(x=(h=d.current)==null?void 0:h.focus)==null||x.call(h),d.current=null}},[a]),g.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=p.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:p,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function Sw(a){const r=J.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function kw({state:a,onClose:r,onAction:i,itemsOverride:o}){const d=g.useRef(null),p=g.useRef(null),[f,h]=g.useState(0),x=g.useMemo(()=>a.skill?o??Sw(a.skill):[],[a.skill,o]),m=g.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const v=8,j=220,S=44+x.length*28;let k=a.x,A=a.y;return k+j+v>window.innerWidth&&(k=Math.max(v,a.x-j)),A+S+v>window.innerHeight&&(A=Math.max(v,a.y-S)),{left:k,top:A}},[a.x,a.y,x.length]);g.useEffect(()=>{if(a.open)return p.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=d.current)==null||v.focus()}),()=>{var v,j;(j=(v=p.current)==null?void 0:v.focus)==null||j.call(v),p.current=null}},[a.open]);const y=g.useCallback(()=>{if(!a.skill)return;const v=x[f];!v||v.disabled||(i(v.action,a.skill),r())},[x,f,a.skill,i,r]);return g.useEffect(()=>{if(!a.open)return;function v(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(k=>Math.min(k+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(k=>Math.max(k-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){d.current&&S.target instanceof Node&&(d.current.contains(S.target)||r())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:d,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:x.map((v,j)=>n.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,"data-action":v.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{v.disabled||(i(v.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}const ww={"anthropic-api":{name:J.setupProviders.anthropic.name,description:J.setupProviders.anthropic.description,envVars:J.setupProviders.anthropic.envVars,keyUrl:J.setupProviders.anthropic.keyUrl,learnMoreUrl:J.setupProviders.anthropic.learnMoreUrl},openai:{name:J.setupProviders.openai.name,description:J.setupProviders.openai.description,envVars:J.setupProviders.openai.envVars,keyUrl:J.setupProviders.openai.keyUrl,learnMoreUrl:J.setupProviders.openai.learnMoreUrl},openrouter:{name:J.setupProviders.openrouter.name,description:J.setupProviders.openrouter.description,envVars:J.setupProviders.openrouter.envVars,keyUrl:J.setupProviders.openrouter.keyUrl,learnMoreUrl:J.setupProviders.openrouter.learnMoreUrl},gemini:{name:J.setupProviders.gemini.name,description:J.setupProviders.gemini.description,envVars:J.setupProviders.gemini.envVars,keyUrl:J.setupProviders.gemini.keyUrl,learnMoreUrl:J.setupProviders.gemini.learnMoreUrl},ollama:{name:J.setupProviders.ollama.name,description:J.setupProviders.ollama.description,envVars:J.setupProviders.ollama.envVars,install:[J.setupProviders.ollama.installCmd],start:[J.setupProviders.ollama.startCmd],pullExample:J.setupProviders.ollama.pullExample,learnMoreUrl:J.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:J.setupProviders.lmStudio.name,description:J.setupProviders.lmStudio.description,envVars:J.setupProviders.lmStudio.envVars,install:[J.setupProviders.lmStudio.installCmd],start:[J.setupProviders.lmStudio.startCmd],pullExample:J.setupProviders.lmStudio.pullExample,learnMoreUrl:J.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:J.setupProviders.claudeCode.name,description:J.setupProviders.claudeCode.description,envVars:[],notes:[J.setupProviders.claudeCode.loginHint,J.claudeCodeLabel.compactLabel],learnMoreUrl:J.setupProviders.claudeCode.learnMoreUrl}};function Cw(a){return a?ww[a]??null:null}function Nw({open:a,providerKey:r,onClose:i}){const o=g.useRef(null);if(g.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),g.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const d=Cw(r),p=(d==null?void 0:d.name)??J.setupDrawer.fallbackTitle;return mo.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(p),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(Ew,{title:p,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:d?n.jsx(Tw,{content:d}):n.jsx(Rw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
80
|
+
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...Fa,minHeight:"150px"}}):i.body.trim()?n.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:bo(i.body)}}):n.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:n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),n.jsx(Ik,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.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:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,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 Uk(){return n.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:n.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:[n.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"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),n.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function io({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:d}=ya(),[p,f]=g.useState(!1);return a==="no-selection"?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[n.jsx("div",{className:"mb-5",children:p?n.jsx(Uk,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.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:n.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"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.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"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.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:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,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"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>d(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Vk(a,r){const[i,o]=a.split(".").map(Number),[d,p]=r.split(".").map(Number);return d>i?"major":p>o?"minor":"patch"}const $k={major:{bg:"var(--red-muted)",text:"var(--red)"},minor:{bg:"var(--yellow-muted)",text:"var(--yellow)"},patch:{bg:"var(--green-muted)",text:"var(--green)"}};function Pk(){const[a,r]=g.useState([]),[i,o]=g.useState(!0),[d,p]=g.useState(new Set),[f,h]=g.useState(new Map),[x,m]=g.useState(!1),[y,v]=g.useState(new Set),[j,S]=g.useState(null),[k,A]=g.useState(null),[T,C]=g.useState(!1),M=g.useCallback(async()=>{o(!0);try{const E=await Ee.getSkillUpdates();r(E.filter(B=>B.updateAvailable))}catch{r([])}finally{o(!1)}},[]);g.useEffect(()=>{M()},[M]);const O=g.useMemo(()=>a.filter(E=>!E.pinned),[a]),U=g.useCallback(E=>{p(B=>{const P=new Set(B);return P.has(E)?P.delete(E):P.add(E),P})},[]),L=g.useCallback(()=>{d.size===O.length?p(new Set):p(new Set(O.map(E=>E.name)))},[d,O]),V=g.useCallback(()=>{const E=[...d];if(!E.length)return;m(!0),h(new Map(E.map(P=>[P,{skill:P,status:"pending"}])));const B=Ee.startBatchUpdate(E);B.addEventListener("progress",P=>{try{const F=JSON.parse(P.data);h(te=>new Map(te).set(F.skill,F))}catch{}}),B.addEventListener("done",P=>{B.close(),m(!1);try{const F=JSON.parse(P.data);S(`Updated ${F.updated??0} skills, ${F.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}M()}),B.addEventListener("error",()=>{B.close(),m(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[d,M]),w=g.useCallback(E=>{E.name.split("/").pop()||E.name;const B=E.name.split("/"),P=B.length>=3?B[B.length-2]:B[0],F=B[B.length-1];v(Q=>new Set(Q).add(E.name));const te=Ee.startSkillUpdate(P,F);te.addEventListener("done",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(E.name),z}),M()}),te.addEventListener("error",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(E.name),z})})},[M]),D=g.useCallback(async E=>{if(!E.latest)return;const B=E.name.split("/"),P=B.length>=3?B[B.length-2]:B[0],F=B[B.length-1];C(!0);try{const te=await Ee.getVersionDiff(P,F,E.installed,E.latest);A({skill:E,diff:te})}catch{A(null)}finally{C(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:M,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",O.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:M,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:V,disabled:d.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${d.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:L,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:d.size===O.length&&O.length>0?"var(--accent)":"var(--border-default)",background:d.size===O.length&&O.length>0?"var(--accent)":"transparent"},children:d.size===O.length&&O.length>0&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),n.jsx("div",{className:"space-y-2",children:a.map(E=>{const B=E.name.split("/").pop()||E.name,P=E.latest?Vk(E.installed,E.latest):"patch",F=$k[P],te=!!E.pinned,Q=y.has(E.name),z=f.get(E.name),R=d.has(E.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!te&&U(E.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:R?"var(--accent)":"var(--border-default)",background:R?"var(--accent)":"transparent",opacity:te?.4:1},children:R&&n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:B}),te&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:F.bg,color:F.text},children:P})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[E.installed," → ",E.latest||"?",te&&` (pinned at ${E.pinnedVersion||E.installed})`]})]}),z&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.status==="done"?"var(--green-muted)":z.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:z.status==="done"?"var(--green)":z.status==="error"?"var(--red)":"var(--yellow)"},children:[z.status,z.error&&`: ${z.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>D(E),className:"btn btn-ghost text-[11px]",disabled:T,children:"View Changes"}),n.jsx("button",{onClick:()=>w(E),disabled:te||Q||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:Q?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(z==null?void 0:z.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},E.name)})}),k&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>A(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:E=>E.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>A(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(Gu,{contentDiff:k.diff.contentDiff,fromLabel:k.diff.from,toLabel:k.diff.to,diffSummary:k.diff.diffSummary,renderContext:"inline"})]})})]})}const Gk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],yr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},br={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},Fk={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},bv={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},jv={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},qk={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Yk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},Wk={Description:"Add `description:` to the SKILL.md frontmatter to display a value here.",Version:"Add `version:` to the SKILL.md frontmatter to display a value here.",Category:"Add `category:` to the SKILL.md frontmatter to display a value here.",Author:"Add `author:` to the SKILL.md frontmatter to display a value here.",License:"Add `license:` to the SKILL.md frontmatter to display a value here.",Homepage:"Add `homepage:` to the SKILL.md frontmatter to display a value here.",Tags:"Add `tags:` to the SKILL.md frontmatter to display a value here.",Directory:"Filesystem location of this skill — not configurable via SKILL.md.","Entry point":"Add `entry-point:` to the SKILL.md frontmatter to customize; defaults to SKILL.md.","Last modified":"Filesystem mtime — updates automatically on save.","Last benchmark":"Shown after the first benchmark run completes."};function Kk(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function Sv(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const d=Math.floor(o/60);if(d<60)return`${d} min ago`;const p=Math.floor(d/60);if(p<24)return`${p} hr ago`;const f=Math.floor(p/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Xk(a){const r=Gk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?Wk[a]:void 0;return n.jsx("span",{style:qk,title:r,children:"—"})}function jn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:Fk,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return jn(a,hr(a));if(i.path)return jn(a,n.jsx("span",{"data-path-value":"true",style:Yk,children:r}));const o=i.tabular?fr:i.mono?jv:bv;return jn(a,n.jsx("span",{style:o,children:r}))}function Qk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[Zk(a),a.origin==="installed"?Jk(a):null,ew(a),nw(a),aw(a),rw(a,r,i)]})}function Zk(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...jv,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:br,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:yr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),jn("Homepage",r),jn("Tags",i)]},"frontmatter")}function Jk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:bv,"data-agent-id":r,children:Xk(r)}):hr("Agent");return n.jsxs("section",{style:br,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:yr,children:"Source agent"}),jn("Agent",i)]},"source-agent")}function ew(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:Sv(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,d=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>tw(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:br,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:yr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),jn("Entry point",d),jn("Size",n.jsx("span",{style:fr,children:Kk(a.sizeBytes)})),jn("Last modified",r)]},"filesystem")}function tw(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function nw(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:Sv(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:br,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:yr,children:"Benchmark"}),jn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),jn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),jn("Status",i),jn("Last benchmark",o)]},"benchmark")}function aw(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:br,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:yr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(lw,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function lw(){return n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",style:{color:"var(--text-secondary)",flexShrink:0},"aria-hidden":"true",children:[n.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"}),n.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function rw(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:br,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:yr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(d=>{const p=sw(d,r),f=p!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:p.plugin,skill:p.skill,origin:p.origin}):void 0,m=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),i({plugin:p.plugin,skill:p.skill,origin:p.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":f?"true":"false",title:f?`Open ${d}`:"Not installed",onClick:x,onKeyDown:m,style:h,children:d},d)})})]},"skill-deps")}function sw(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const d of r)if(i&&d.plugin===i&&d.skill===o||!i&&d.skill===o)return d;return null}const lg=g.memo(function({message:r,politeness:i="polite",role:o}){const d=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:d,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function iw({toast:a,onDismiss:r}){const[i,o]=g.useState(!0),d=g.useRef(null);g.useEffect(()=>(d.current=requestAnimationFrame(()=>{d.current=requestAnimationFrame(()=>o(!1))}),()=>{d.current!=null&&cancelAnimationFrame(d.current)}),[]);const p={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return n.jsxs("div",{role:a.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":a.severity,style:{display:"flex",alignItems:"center",gap:12,padding:"10px 12px",minWidth:240,maxWidth:360,background:"var(--bg-canvas)",color:"var(--text-primary)",border:"1px solid var(--border-default)",borderLeft:`3px solid ${p[a.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:i?"translateY(8px)":"translateY(0)",opacity:i?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{style:{flex:1,minWidth:0},children:a.message}),a.action&&n.jsx("button",{type:"button",onClick:()=>{a.action.onInvoke(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function ow({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(lg,{politeness:"polite",message:i}),n.jsx(lg,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(d=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(iw,{toast:d,onDismiss:r})},d.id))})]})}const kv=g.createContext(null);function qu(){const a=g.useContext(kv);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function cw({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,d]=g.useState([]),[p,f]=g.useState(""),[h,x]=g.useState(""),m=g.useRef(new Map),y=g.useCallback(T=>{const C=m.current.get(T);C&&(clearTimeout(C),m.current.delete(T)),d(M=>M.filter(O=>O.id!==T))},[]),v=g.useCallback((T,C)=>{if(C<=0)return;const M=setTimeout(()=>{y(T)},C);m.current.set(T,M)},[y]),j=g.useCallback(T=>{const C=T.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,M={id:C,message:T.message,severity:T.severity??"info",durationMs:T.durationMs??i,action:T.action};return d(O=>[...O,M]),M.severity==="error"?x(M.message):f(M.message),v(C,M.durationMs),C},[i,v]),S=g.useCallback(()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear(),d([])},[]);g.useEffect(()=>{function T(C){C.key==="Escape"&&d(M=>{if(M.length===0)return M;const O=M.slice(0,r),U=O[O.length-1],L=m.current.get(U.id);return L&&(clearTimeout(L),m.current.delete(U.id)),M.filter(V=>V.id!==U.id)})}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[r]),g.useEffect(()=>()=>{for(const T of m.current.values())clearTimeout(T);m.current.clear()},[]);const k=o.slice(0,r),A=g.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(kv.Provider,{value:A,children:[a,n.jsx(ow,{toasts:k,onDismiss:y,liveMessage:p,liveAssertiveMessage:h})]})}function dw(a){const{toast:r}=qu(),i=g.useRef(a);i.current=a;const o=g.useCallback(async(...d)=>{const p=i.current,f=p.snapshot();p.apply(...d),p.confirmGraceMs;const h=p.timeoutMs??5e3;let x=!1,m,y=!1;const v=p.commit(...d).then(()=>{x=!0,y=!0},k=>{x=!0,m=k??new Error("Commit failed")}),j=new Promise(k=>{setTimeout(k,h)});if(await Promise.race([v,j]),!x)m=new Error("TIMEOUT");else if(y)return;p.rollback(f);const S=typeof p.failureMessage=="function"?p.failureMessage(m):p.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...d)}}})},[r]);return{run:o}}const rg=6e4;function uw({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=qu(),[o,d]=g.useState("idle"),[p,f]=g.useState(null),[h,x]=g.useState(!1),[m,y]=g.useState(null),[v,j]=g.useState(!1),S=g.useRef(null),k=g.useRef(null),A=g.useCallback(()=>new Promise((U,L)=>{if(!a){L(new Error("No skill selected"));return}const V=Ee.startSkillUpdate(a.plugin,a.skill);S.current=V;const w=()=>{k.current&&(clearTimeout(k.current),k.current=null);try{V.close()}catch{}S.current=null};k.current=setTimeout(()=>{w(),L(new Error("TIMEOUT"))},rg),V.addEventListener("progress",D=>{try{const E=JSON.parse(D.data);typeof(E==null?void 0:E.status)=="string"&&f(E.status)}catch{}}),V.addEventListener("done",()=>{w(),d("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),U()}),V.addEventListener("error",D=>{w();let E="Stream error";try{const B=typeof D.data=="string"?JSON.parse(D.data):null;B!=null&&B.error&&(E=String(B.error))}catch{}L(new Error(E))})}),[a,r,i]),T=dw({snapshot:()=>({status:o}),apply:()=>{d("updating"),f("updating")},commit:()=>A(),rollback:U=>{d(U.status==="updating"?"idle":U.status),f(null)},failureMessage:U=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${U.message}`,timeoutMs:rg+1e3});if(g.useEffect(()=>{if(!h||m!=null||!a||!a.latestVersion)return;let U=!1;return j(!0),Ee.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(L=>{U||y(L)}).catch(()=>{U||y(null)}).finally(()=>{U||j(!1)}),()=>{U=!0}},[h,m,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),g.useEffect(()=>()=>{if(k.current&&clearTimeout(k.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const C=a.latestVersion,M=o==="updating"?"Updating…":C?`Update to ${C}`:"Update",O=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{T.run()},disabled:O,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:O?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:M}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(U=>!U),disabled:O||!C,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),p&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:p}),h&&C&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[v&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!v&&m&&n.jsx(Gu,{contentDiff:m.contentDiff,fromLabel:m.from,toLabel:m.to,diffSummary:m.diffSummary??void 0,renderContext:"inline"}),!v&&!m&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function ru(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("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:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function fw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return pw(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:d}=ya(),[p,f]=g.useState(typeof window<"u"?window.location.hash:"");if(g.useEffect(()=>{const m=()=>f(window.location.hash);return window.addEventListener("hashchange",m),()=>window.removeEventListener("hashchange",m)},[]),p==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ru,{}),n.jsx(Pk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(ru,{}),n.jsx(Hk,{onCreated:(m,y)=>{o("browse"),d(),i({plugin:m,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(io,{variant:"error",message:r.skillsError,onRetry:d}):!r.skillsLoading&&r.skills.length===0?n.jsx(io,{variant:"no-skills"}):n.jsx(io,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(m=>m.plugin===h.plugin&&m.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(ru,{}),n.jsx(mw,{skillInfo:x,allSkills:r.skills,onSelectSkill:m=>i(m)})]})}function pw(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return gw();if(a.loadError)return vw(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return wv(r,i,a.onDetailTabChange,o)}function mw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,d]=g.useState("overview"),p=g.useMemo(()=>a?wv(a,o,d,{allSkills:r,onSelectSkill:i}):n.jsx(io,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:p})}const hw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function xw(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:hw.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function gw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,color:"var(--text-primary)",margin:0,marginBottom:8},children:"Select a skill to view details"}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)",margin:0,maxWidth:420,textAlign:"center"},children:"Choose a skill from the sidebar — its frontmatter, filesystem info, and benchmark status will appear here."})]})}function vw(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Fu({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function wv(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:Fu({skill:a})}),n.jsx(uw,{skill:a}),xw(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[Qk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(Hx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(zk,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(Hx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(lv,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function yw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return g.useEffect(()=>{if(!o)return;const d=setTimeout(()=>i(),1e4);return()=>clearTimeout(d)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const bw=[{name:J.shortcuts.groupNavigation,items:[{keys:"/",label:J.shortcuts.search},{keys:"j",label:J.shortcuts.moveDown},{keys:"k",label:J.shortcuts.moveUp},{keys:"Enter",label:J.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:J.shortcuts.groupActions,items:[{keys:"⌘K",label:J.shortcuts.openPalette},{keys:"?",label:J.shortcuts.openShortcuts},{keys:"⌘B",label:J.shortcuts.toggleSidebar},{keys:"E",label:J.actions.edit}]},{name:J.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:J.shortcuts.toggleTheme}]}];function jw({open:a,onClose:r,groups:i=bw,title:o=J.shortcuts.title}){const d=g.useRef(null),p=g.useRef(null);return g.useEffect(()=>{var f;if(a)return d.current=document.activeElement??null,(f=p.current)==null||f.focus(),()=>{var h,x;(x=(h=d.current)==null?void 0:h.focus)==null||x.call(h),d.current=null}},[a]),g.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=p.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:p,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function Sw(a){const r=J.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function kw({state:a,onClose:r,onAction:i,itemsOverride:o}){const d=g.useRef(null),p=g.useRef(null),[f,h]=g.useState(0),x=g.useMemo(()=>a.skill?o??Sw(a.skill):[],[a.skill,o]),m=g.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const v=8,j=220,S=44+x.length*28;let k=a.x,A=a.y;return k+j+v>window.innerWidth&&(k=Math.max(v,a.x-j)),A+S+v>window.innerHeight&&(A=Math.max(v,a.y-S)),{left:k,top:A}},[a.x,a.y,x.length]);g.useEffect(()=>{if(a.open)return p.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=d.current)==null||v.focus()}),()=>{var v,j;(j=(v=p.current)==null?void 0:v.focus)==null||j.call(v),p.current=null}},[a.open]);const y=g.useCallback(()=>{if(!a.skill)return;const v=x[f];!v||v.disabled||(i(v.action,a.skill),r())},[x,f,a.skill,i,r]);return g.useEffect(()=>{if(!a.open)return;function v(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),h(k=>Math.min(k+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(k=>Math.max(k-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){d.current&&S.target instanceof Node&&(d.current.contains(S.target)||r())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:d,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:m.left,top:m.top,zIndex:70,minWidth:200,padding:4,background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:6,boxShadow:"0 12px 32px rgba(0,0,0,0.16)",fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",outline:"none"},children:x.map((v,j)=>n.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,"data-action":v.action,"data-selected":j===f||void 0,onMouseEnter:()=>h(j),onClick:()=>{v.disabled||(i(v.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}const ww={"anthropic-api":{name:J.setupProviders.anthropic.name,description:J.setupProviders.anthropic.description,envVars:J.setupProviders.anthropic.envVars,keyUrl:J.setupProviders.anthropic.keyUrl,learnMoreUrl:J.setupProviders.anthropic.learnMoreUrl},openai:{name:J.setupProviders.openai.name,description:J.setupProviders.openai.description,envVars:J.setupProviders.openai.envVars,keyUrl:J.setupProviders.openai.keyUrl,learnMoreUrl:J.setupProviders.openai.learnMoreUrl},openrouter:{name:J.setupProviders.openrouter.name,description:J.setupProviders.openrouter.description,envVars:J.setupProviders.openrouter.envVars,keyUrl:J.setupProviders.openrouter.keyUrl,learnMoreUrl:J.setupProviders.openrouter.learnMoreUrl},gemini:{name:J.setupProviders.gemini.name,description:J.setupProviders.gemini.description,envVars:J.setupProviders.gemini.envVars,keyUrl:J.setupProviders.gemini.keyUrl,learnMoreUrl:J.setupProviders.gemini.learnMoreUrl},ollama:{name:J.setupProviders.ollama.name,description:J.setupProviders.ollama.description,envVars:J.setupProviders.ollama.envVars,install:[J.setupProviders.ollama.installCmd],start:[J.setupProviders.ollama.startCmd],pullExample:J.setupProviders.ollama.pullExample,learnMoreUrl:J.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:J.setupProviders.lmStudio.name,description:J.setupProviders.lmStudio.description,envVars:J.setupProviders.lmStudio.envVars,install:[J.setupProviders.lmStudio.installCmd],start:[J.setupProviders.lmStudio.startCmd],pullExample:J.setupProviders.lmStudio.pullExample,learnMoreUrl:J.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:J.setupProviders.claudeCode.name,description:J.setupProviders.claudeCode.description,envVars:[],notes:[J.setupProviders.claudeCode.loginHint,J.claudeCodeLabel.compactLabel],learnMoreUrl:J.setupProviders.claudeCode.learnMoreUrl}};function Cw(a){return a?ww[a]??null:null}function Nw({open:a,providerKey:r,onClose:i}){const o=g.useRef(null);if(g.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),g.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const d=Cw(r),p=(d==null?void 0:d.name)??J.setupDrawer.fallbackTitle;return mo.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(p),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(Ew,{title:p,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:d?n.jsx(Tw,{content:d}):n.jsx(Rw,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
81
81
|
from { transform: translateX(100%); }
|
|
82
82
|
to { transform: translateX(0); }
|
|
83
83
|
}
|
|
@@ -87,5 +87,5 @@ You are an expert at...
|
|
|
87
87
|
}`})]})]}),document.body)}function Ew({title:a,onClose:r}){return n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:J.setupDrawer.title(a)}),n.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":J.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function Tw({content:a}){var r,i;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:a.description}),a.notes&&a.notes.length>0&&n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.notes.map(o=>n.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),a.envVars.length>0&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.requiredEnv}),n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.envVars.map(o=>n.jsx("li",{children:n.jsx(Aw,{name:o})},o))})]}),a.keyUrl&&n.jsx(Mw,{href:a.keyUrl,label:J.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(a.install||a.start||a.pullExample)&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.installRun}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=a.install)==null?void 0:r.map((o,d)=>n.jsx(su,{code:o},`install-${d}`)),(i=a.start)==null?void 0:i.map((o,d)=>n.jsx(su,{code:o},`start-${d}`)),a.pullExample&&n.jsx(su,{code:a.pullExample})]})]}),n.jsx("footer",{style:{marginTop:8},children:n.jsxs("a",{href:a.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[J.setupDrawer.learnMore," →"]})})]})}function Rw(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:J.setupDrawer.fallbackTitle}),n.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:J.setupDrawer.fallbackBody})]})}function Aw({name:a}){const r=async()=>{var i;try{await((i=navigator.clipboard)==null?void 0:i.writeText(a))}catch{}};return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:a}),n.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${a} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:J.setupDrawer.copy})]})}function su({code:a}){return n.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function Mw({href:a,label:r,testId:i}){return n.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer","data-testid":i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[r," →"]})}function zw(){const[a,r]=g.useState(!1),[i,o]=g.useState(null),d=g.useRef(null),p=g.useCallback((h,x)=>{var m;d.current=typeof document<"u"?document.activeElement:null,(m=x==null?void 0:x.beforeOpen)==null||m.call(x),o(h),r(!0)},[]),f=g.useCallback(()=>{r(!1);const h=d.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:p,close:f,isOpen:a,providerKey:i}}function Lw(a){const r=[],i=[],o=new Set;for(const d of a){if(d.presence==="absent"||d.health==="missing"){i.push({kind:"individual",key:d.id,agent:d});continue}if(d.sharedFolderGroup&&d.sharedFolderGroup.length>1){const p=[...d.sharedFolderGroup].sort().join("+");if(o.has(p))continue;o.add(p);const f=a.filter(h=>d.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${p}`,consumers:f,sharedFolderPath:d.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,x)=>h+x.globalCount,0)});continue}r.push({kind:"individual",key:d.id,agent:d})}return{detected:r,notDetected:i}}function Dw({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:d,onOpenSetup:p,onClose:f}){const h=g.useRef(null);g.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),g.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},v=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",y)}},[f]);const x=g.useMemo(()=>Lw(a),[a]),m=a.find(y=>y.id===i)??a.find(y=>y.id===r)??a[0];return typeof document>"u"?null:mo.createPortal(n.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":J.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[n.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[x.detected.length===0&&x.notDetected.length===0&&n.jsx(sg,{}),x.detected.map(y=>y.kind==="aggregate"?n.jsx(Ow,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??r??"")}},y.key):n.jsx(_w,{agent:y.agent,focused:y.agent.id===i,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),x.notDetected.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:J.scopePicker.notDetectedSubheading}),x.notDetected.map(y=>n.jsx(Bw,{agent:y.agent,onSetUp:()=>p(y.agent.id)},y.key))]})]}),n.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:m?n.jsx(Iw,{agent:m,activeAgentId:r,onSwitch:()=>d(m.id)}):n.jsx(sg,{})})]}),n.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
88
88
|
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
89
89
|
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
90
|
-
}`})]}),document.body)}function _w({agent:a,focused:r,active:i,onClick:o}){const d=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:d,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Ow({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Bw({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(a.displayName)})]})}function Iw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,d=a.isRemoteOnly===!0,p=o||d,f=o?"Active":d?"Remote-only":J.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:d?"Remote service — no local install":Uw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(iu,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(iu,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(iu,{label:J.scopePicker.statsLastSync,value:a.lastSync?Hw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:p,title:d?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:p?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:p?"default":"pointer",opacity:p?.5:1},children:f})]})}function iu({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function sg(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Hw(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const d=Math.round(o/60);return d<24?`${d}h ago`:`${Math.round(d/24)}d ago`}catch{return"—"}}function Uw(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function Vw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function $w({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[d,p]=g.useState(!1),[f,h]=g.useState(null),x=g.useRef(null),m=g.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=g.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),v=g.useCallback(()=>{var S;p(!1),(S=x.current)==null||S.focus()},[]),j=g.useCallback(S=>{i(S),p(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":d,onClick:()=>p(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),d&&n.jsx(Dw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),v()},onClose:v})]})}const Cv="vskill-ccode-banner-dismissed",Pw=new Set(["claude-cli","claude-code"]);function Gw(){try{return sessionStorage.getItem(Cv)==="true"}catch{return!1}}function qw(){try{sessionStorage.setItem(Cv,"true")}catch{}}function Yw({activeAgentId:a}){const[r,i]=g.useState(()=>Gw()),o=g.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),d=g.useCallback(()=>{qw(),i(!0)},[]);return!a||!Pw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:d,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function Fw(){const[a,r]=g.useState(null),[i,o]=g.useState("loading"),[d,p]=g.useState(null),f=g.useCallback(async()=>{try{const h=await Ee.getAgents();r(h),o("ready"),p(null)}catch(h){o("error"),p(h.message)}},[]);return g.useEffect(()=>{f()},[f]),g.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:d,refresh:()=>void f()}}const eo="workspace",Ww=["skills","agents"];async function Kw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Xw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Qw(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function Zw(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function ou(){for(const a of Ww)an(a)}function Jw(){const{data:a,loading:r,error:i,revalidate:o}=xr(eo,Kw),d=a,p=d==null?void 0:d.projects.find(m=>m.id===d.activeProjectId),f=g.useCallback(async m=>{await Xw(m),an(eo),ou()},[]),h=g.useCallback(async m=>{await Qw(m),an(eo),ou()},[]),x=g.useCallback(async m=>{await Zw(m),an(eo),ou()},[]);return{workspace:d,activeProject:p,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function eC({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:d}){const[p,f]=g.useState(!1),[h,x]=g.useState(!1),[m,y]=g.useState(""),[v,j]=g.useState(null),[S,k]=g.useState(null),[A,T]=g.useState(null),[C,M]=g.useState(!1),O=g.useRef(null),U=(a==null?void 0:a.projects)??[],L=U.find(E=>E.id===(a==null?void 0:a.activeProjectId));g.useEffect(()=>{if(!p)return;function E(B){O.current&&!O.current.contains(B.target)&&(f(!1),x(!1),j(null))}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);async function V(){j(null);const E=m.trim();if(!E){j("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!E.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(E)){j("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await i({path:E}),y(""),x(!1)}catch(B){const P=B instanceof Error?B.message:String(B);/does not exist/i.test(P)?j(`Path not found on disk: ${E}`):/Duplicate/i.test(P)?j("That project is already registered."):j(P)}}async function w(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const E=await window.showDirectoryPicker();y(E.name),x(!0)}catch{}else x(!0)}function D(E){if(E.length<=50)return E;const B=E.split("/");return B.length<=4?E:`${B.slice(0,3).join("/")}/…/${B.slice(-2).join("/")}`}return n.jsxs("div",{ref:O,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[n.jsxs("button",{type:"button",onClick:()=>f(E=>!E),"aria-expanded":p,"aria-haspopup":"menu",title:(L==null?void 0:L.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:p?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(L==null?void 0:L.colorDot)??"var(--text-tertiary, #999)"}}),n.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L?L.name:"No project"}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:p?"▴":"▾"})]}),p&&n.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[U.length===0&&n.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),U.length>0&&n.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:U.map(E=>{const B=d?d(E.path):!1,P=E.id===(a==null?void 0:a.activeProjectId),q=S===E.id;return n.jsxs("li",{role:"menuitem","data-stale":B?"true":"false",onMouseEnter:()=>k(E.id),onMouseLeave:()=>k(te=>te===E.id?null:te),onClick:()=>{if(!B){if(P){f(!1);return}T(E)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:B?"not-allowed":"pointer",background:q&&!B?"var(--surface-2, rgba(0,0,0,0.04))":P?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:B?.5:1,transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:E.colorDot,boxShadow:P?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:P?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.name}),P&&n.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-accent, #2f6f8f)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),n.jsx("div",{title:E.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D(E.path)}),B&&n.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),n.jsx("button",{type:"button","aria-label":`Remove ${E.name}`,onClick:te=>{te.stopPropagation(),o(E.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:q?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:te=>{te.currentTarget.style.color="var(--color-error, #b91c1c)",te.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:te=>{te.currentTarget.style.color="var(--text-tertiary)",te.currentTarget.style.backgroundColor="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),n.jsx("path",{d:"M10 11v6"}),n.jsx("path",{d:"M14 11v6"}),n.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},E.id)})}),n.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&n.jsxs("button",{type:"button",onClick:()=>void w(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-accent, #2f6f8f)",transition:"background-color 120ms ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-accent, #2f6f8f) 10%, transparent)"},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("input",{type:"text",value:m,onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&V(),E.key==="Escape"&&(x(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>{x(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void V(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),A&&n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>T(null),children:[n.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),n.jsxs("div",{onClick:E=>E.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",A.name]}),n.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),n.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${A.path}" && npx vskill@latest studio`}),n.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${A.path}" && npx vskill@latest studio`),M(!0),setTimeout(()=>M(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-accent, #2f6f8f)",borderRadius:6,background:"var(--color-accent, #2f6f8f)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:C?"Copied!":"Copy command"}),n.jsx("button",{type:"button",onClick:()=>T(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function tC(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const d=`${o.name} ${o.path}`.toLowerCase();return i.every(p=>d.includes(p))})}function nC({open:a,projects:r,onSwitch:i,onClose:o}){const[d,p]=g.useState(""),[f,h]=g.useState(0),x=g.useMemo(()=>tC(r,d),[r,d]);g.useEffect(()=>{a||(p(""),h(0))},[a]),g.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=x[f];v&&(i(v.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:d,onChange:y=>p(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,v)=>n.jsxs("li",{role:"option","aria-selected":v===f,"data-highlighted":v===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const ig=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function aC({open:a,onClose:r,initialMode:i="standalone",isClaudeCode:o,projectRoot:d,onCreated:p}){const[f,h]=g.useState("destination"),[x,m]=g.useState(i),[y,v]=g.useState(""),[j,S]=g.useState(""),[k,A]=g.useState(""),[T,C]=g.useState([]),[M,O]=g.useState(!1),[U,L]=g.useState(null);if(g.useEffect(()=>{a&&(h("destination"),m(i),v(""),S(""),A(""),L(null))},[a,i]),g.useEffect(()=>{if(!a)return;let z=!0;return fetch("/api/authoring/plugins").then(R=>R.json()).then(R=>{z&&C(R.plugins??[])}).catch(()=>{}),()=>{z=!1}},[a]),g.useEffect(()=>{if(!a)return;function z(R){R.key==="Escape"&&(R.preventDefault(),r())}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[a,r]),!a)return null;const V=T.length>0,w=o&&V,D=o,E=ig.test(y),B=x==="existing-plugin"?j.length>0:ig.test(j),P=!M&&E&&(x==="standalone"||B),q=lC(d,x,j,y);function te(){const z=new URLSearchParams;z.set("mode",x),z.set("skillName",y),k.trim()&&z.set("description",k.trim()),j&&z.set("pluginName",j);const R=`/#/create?${z.toString()}`;typeof window<"u"&&window.location.assign(R),r()}async function Q(){L(null),O(!0);try{const z=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:x,skillName:y,description:k.trim()||void 0,pluginName:x==="standalone"?void 0:j})}),R=await z.json();if(!z.ok||!R.ok){L(R.error??`Create failed: ${z.status}`);return}an("skills"),p==null||p({mode:x,skillName:y,pluginName:R.pluginName??null,skillMdPath:R.skillMdPath}),r()}catch(z){L(z instanceof Error?z.message:String(z))}finally{O(!1)}}return n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),n.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[n.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:f==="destination"?"Create a skill":"Name and describe"}),n.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",f==="destination"?"1":"2"," of 2"]})]}),f==="destination"&&n.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[n.jsx(cu,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:x==="standalone",onClick:()=>m("standalone")}),n.jsx(cu,{title:"Add to existing plugin",subtitle:w?`${T.length} plugin source${T.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!w,selected:x==="existing-plugin",onClick:()=>w&&m("existing-plugin")}),n.jsx(cu,{title:"New plugin",subtitle:D?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!D,selected:x==="new-plugin",onClick:()=>D&&m("new-plugin")})]}),f==="details"&&n.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[x==="new-plugin"&&n.jsx(to,{label:"Plugin name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:j,onChange:z=>S(z.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:no(!j||B)})}),x==="existing-plugin"&&n.jsx(to,{label:"Plugin",children:n.jsxs("select",{value:j,onChange:z=>S(z.target.value),style:{...no(!0),fontFamily:"var(--font-mono)"},children:[n.jsx("option",{value:"",children:"Select a plugin…"}),T.map(z=>n.jsx("option",{value:z.name,children:z.name},z.path))]})}),n.jsx(to,{label:"Skill name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:y,onChange:z=>v(z.target.value.trim()),placeholder:"my-new-skill",autoFocus:x!=="new-plugin",style:no(!y||E)})}),n.jsx(to,{label:"Description",hint:"One short sentence — shown in frontmatter",children:n.jsx("textarea",{value:k,onChange:z=>A(z.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...no(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),q&&n.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),q.map((z,R)=>n.jsx("div",{children:z},R))]}),U&&n.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:U})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[n.jsx("button",{type:"button",onClick:r,style:du,children:"Cancel"}),f==="destination"&&n.jsx("button",{type:"button",onClick:()=>h("details"),style:og,children:"Continue →"}),f==="details"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>h("destination"),style:du,children:"← Back"}),n.jsx("button",{type:"button",onClick:te,disabled:!P,style:{...du,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"✨ Generate with AI"}),n.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!P,style:{...og,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:M?"Creating…":"Create empty scaffold"})]})]})]})]})}function cu({title:a,subtitle:r,description:i,icon:o,selected:d,disabled:p,onClick:f}){return n.jsxs("button",{type:"button",onClick:f,disabled:p,"aria-pressed":d,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:d?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:d?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":p?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:p?"var(--text-tertiary)":"var(--text-primary)",cursor:p?"not-allowed":"pointer",opacity:p?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:a}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:i})]})]})}function to({label:a,hint:r,children:i}){return n.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:a}),r&&n.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),i]})}function no(a){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${a?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const og={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-accent, #2f6f8f)",borderRadius:6,background:"var(--color-accent, #2f6f8f)",color:"#ffffff",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},du={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function lC(a,r,i,o){const d=o||"<skill-name>",p=i||"<plugin-name>",f=a||"<project>";return r==="standalone"?[`${f}/skills/${d}/SKILL.md`]:r==="existing-plugin"?[`${f}/${p}/skills/${d}/SKILL.md`]:r==="new-plugin"?[`${f}/${p}/.claude-plugin/plugin.json`,`${f}/${p}/skills/${d}/SKILL.md`]:null}function rC({open:a,onClose:r,onInstall:i,installedNames:o}){const[d,p]=g.useState([]),[f,h]=g.useState(null),[x,m]=g.useState(null),[y,v]=g.useState(!1),[j,S]=g.useState(null);return g.useEffect(()=>{a&&(v(!0),S(null),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);p(k.marketplaces??[])}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1)))},[a]),g.useEffect(()=>{if(!f){m(null);return}v(!0),S(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(f)}`).then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);m(k)}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1))},[f]),g.useEffect(()=>{if(!a)return;function k(A){A.key==="Escape"&&r()}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a,r]),a?n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),n.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[f&&n.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),n.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:f?(x==null?void 0:x.name)??f:"Browse plugins"}),n.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),n.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&n.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),j&&n.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:j}),!f&&!y&&d.length===0&&!j&&n.jsx(sC,{}),!f&&d.map(k=>n.jsxs("button",{type:"button",onClick:()=>h(k.name),style:oC,onMouseEnter:A=>{A.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:k.name}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.source})]},k.name)),f&&x&&n.jsxs(n.Fragment,{children:[x.description&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:x.description}),x.plugins.length===0&&n.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),x.plugins.map(k=>{const A=o.has(k.name);return n.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:n.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[k.name,k.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:k.version}),k.category&&n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:k.category})]}),k.description&&n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:k.description})]}),n.jsx("button",{type:"button",disabled:A,onClick:()=>i(k.name,f),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:500,border:"none",borderRadius:4,background:A?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-accent, #2f6f8f)",color:A?"var(--text-tertiary)":"var(--color-paper, #fff)",cursor:A?"default":"pointer",fontFamily:"inherit"},children:A?"Installed":"Install"})]})},k.name)})]})]}),!f&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:n.jsx(iC,{onAdded:()=>{an("marketplaces"),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>p(k.marketplaces??[]))}})})]})]}):null}function sC(){return n.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",n.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[n.jsx("li",{children:n.jsx("code",{children:"anthropics/claude-plugins-official"})}),n.jsx("li",{children:n.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function iC({onAdded:a}){const[r,i]=g.useState(""),[o,d]=g.useState(!1),[p,f]=g.useState(null);async function h(){const x=r.trim();if(x){d(!0),f(null);try{const m=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:x})}),y=await m.json().catch(()=>({}));if(!m.ok||!y.ok){f(y.error??`Add failed (${m.status})`);return}i(""),a()}catch(m){f(m instanceof Error?m.message:String(m))}finally{d(!1)}}}return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{type:"text",value:r,onChange:x=>i(x.target.value),onKeyDown:x=>{x.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!r.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:500,border:"none",borderRadius:4,background:"var(--color-accent, #2f6f8f)",color:"var(--color-paper, #fff)",cursor:o||!r.trim()?"not-allowed":"pointer",opacity:o||!r.trim()?.5:1,fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),p&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:p})]})}const oC={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},uu=12;function cC({job:a,onDone:r}){const[i,o]=g.useState([]),[d,p]=g.useState("running"),[f,h]=g.useState(!1);if(g.useEffect(()=>{if(!a)return;o([]),p("running"),h(!1);const v=new AbortController;let j=[],S="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:a.ref}),signal:v.signal});if(!k.ok||!k.body){p("failed"),r({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const A=k.body.getReader(),T=new TextDecoder;let C="";for(;;){const{value:M,done:O}=await A.read();if(O)break;C+=T.decode(M,{stream:!0});const U=C.split(/\n\n/);C=U.pop()??"";for(const L of U){const V=L.match(/^data:\s*(.*)$/m);if(V)try{const w=JSON.parse(V[1]);w.type==="stdout"&&w.line?(j=[...j,w.line].slice(-uu),o(j)):w.type==="stderr"&&w.line?(j=[...j,`⚠ ${w.line}`].slice(-uu),o(j)):w.type==="done"?(S=w.ok?"ok":"failed",p(S),an("plugins"),an("skills"),r({ok:w.ok??!1,code:w.code??null,lines:j})):w.type==="error"&&w.error&&(j=[...j,`✘ ${w.error}`].slice(-uu),o(j))}catch{}}}S==="running"&&r({ok:!0,code:0,lines:j})}catch(k){if(k.name==="AbortError")return;p("failed"),r({ok:!1,code:null,lines:[...j,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[a==null?void 0:a.ref]),!a)return null;const x=d==="ok"?"var(--color-installed, #2F6A4A)":d==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",m=d==="ok"?"✔":d==="failed"?"✘":"…",y=d==="ok"?"Installed":d==="failed"?"Install failed":"Installing";return n.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${x}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[n.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:x,width:16,textAlign:"center"},children:d==="running"?n.jsx(dC,{}):m}),n.jsxs("span",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",a.plugin,n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",a.marketplace]})]}),!f&&i.length>0&&n.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i[i.length-1]})]}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:f?"▾":"▸"})]}),f&&n.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.length===0?"Waiting for output…":i.join(`
|
|
91
|
-
`)})]})}function dC(){return n.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:n.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const Nv="vskill.studio.prefs";function Ev(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Tv(){const a=Ev();if(!a)return{};try{const r=a.getItem(Nv);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function uC(a,r){const i=Ev();if(i)try{const d={...Tv(),[a]:r};i.setItem(Nv,JSON.stringify(d))}catch{}}function fC(a,r){const o=Tv()[a];return o===void 0?r:o}const cg={open:!1,x:0,y:0,skill:null};function pC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function mC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const hC=g.lazy(()=>Tu(()=>import("./CommandPalette-
|
|
90
|
+
}`})]}),document.body)}function _w({agent:a,focused:r,active:i,onClick:o}){const d=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:d,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Ow({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Bw({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(a.displayName)})]})}function Iw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,d=a.isRemoteOnly===!0,p=o||d,f=o?"Active":d?"Remote-only":J.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:d?"Remote service — no local install":Uw(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(iu,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(iu,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(iu,{label:J.scopePicker.statsLastSync,value:a.lastSync?Hw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:p,title:d?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:p?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:p?"default":"pointer",opacity:p?.5:1},children:f})]})}function iu({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function sg(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Hw(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const d=Math.round(o/60);return d<24?`${d}h ago`:`${Math.round(d/24)}d ago`}catch{return"—"}}function Uw(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function Vw(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function $w({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[d,p]=g.useState(!1),[f,h]=g.useState(null),x=g.useRef(null),m=g.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=g.useMemo(()=>m?m.health==="ok"?"var(--color-ok, #22c55e)":m.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[m]),v=g.useCallback(()=>{var S;p(!1),(S=x.current)==null||S.focus()},[]),j=g.useCallback(S=>{i(S),p(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":d,onClick:()=>p(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),p(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(m==null?void 0:m.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(m==null?void 0:m.installedCount)??0," · ",(m==null?void 0:m.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),d&&n.jsx(Dw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),v()},onClose:v})]})}const Cv="vskill-ccode-banner-dismissed",Pw=new Set(["claude-cli","claude-code"]);function Gw(){try{return sessionStorage.getItem(Cv)==="true"}catch{return!1}}function Fw(){try{sessionStorage.setItem(Cv,"true")}catch{}}function qw({activeAgentId:a}){const[r,i]=g.useState(()=>Gw()),o=g.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),d=g.useCallback(()=>{Fw(),i(!0)},[]);return!a||!Pw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:d,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function Yw(){const[a,r]=g.useState(null),[i,o]=g.useState("loading"),[d,p]=g.useState(null),f=g.useCallback(async()=>{try{const h=await Ee.getAgents();r(h),o("ready"),p(null)}catch(h){o("error"),p(h.message)}},[]);return g.useEffect(()=>{f()},[f]),g.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:d,refresh:()=>void f()}}const eo="workspace",Ww=["skills","agents"];async function Kw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Xw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Qw(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function Zw(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function ou(){for(const a of Ww)an(a)}function Jw(){const{data:a,loading:r,error:i,revalidate:o}=xr(eo,Kw),d=a,p=d==null?void 0:d.projects.find(m=>m.id===d.activeProjectId),f=g.useCallback(async m=>{await Xw(m),an(eo),ou()},[]),h=g.useCallback(async m=>{await Qw(m),an(eo),ou()},[]),x=g.useCallback(async m=>{await Zw(m),an(eo),ou()},[]);return{workspace:d,activeProject:p,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function eC({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:d}){const[p,f]=g.useState(!1),[h,x]=g.useState(!1),[m,y]=g.useState(""),[v,j]=g.useState(null),[S,k]=g.useState(null),[A,T]=g.useState(null),[C,M]=g.useState(!1),O=g.useRef(null),U=(a==null?void 0:a.projects)??[],L=U.find(E=>E.id===(a==null?void 0:a.activeProjectId));g.useEffect(()=>{if(!p)return;function E(B){O.current&&!O.current.contains(B.target)&&(f(!1),x(!1),j(null))}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);async function V(){j(null);const E=m.trim();if(!E){j("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!E.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(E)){j("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await i({path:E}),y(""),x(!1)}catch(B){const P=B instanceof Error?B.message:String(B);/does not exist/i.test(P)?j(`Path not found on disk: ${E}`):/Duplicate/i.test(P)?j("That project is already registered."):j(P)}}async function w(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const E=await window.showDirectoryPicker();y(E.name),x(!0)}catch{}else x(!0)}function D(E){if(E.length<=50)return E;const B=E.split("/");return B.length<=4?E:`${B.slice(0,3).join("/")}/…/${B.slice(-2).join("/")}`}return n.jsxs("div",{ref:O,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[n.jsxs("button",{type:"button",onClick:()=>f(E=>!E),"aria-expanded":p,"aria-haspopup":"menu",title:(L==null?void 0:L.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:p?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(L==null?void 0:L.colorDot)??"var(--text-tertiary, #999)"}}),n.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L?L.name:"No project"}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:p?"▴":"▾"})]}),p&&n.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[U.length===0&&n.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),U.length>0&&n.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:U.map(E=>{const B=d?d(E.path):!1,P=E.id===(a==null?void 0:a.activeProjectId),F=S===E.id;return n.jsxs("li",{role:"menuitem","data-stale":B?"true":"false",onMouseEnter:()=>k(E.id),onMouseLeave:()=>k(te=>te===E.id?null:te),onClick:()=>{if(!B){if(P){f(!1);return}T(E)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:B?"not-allowed":"pointer",background:F&&!B?"var(--surface-2, rgba(0,0,0,0.04))":P?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:B?.5:1,transition:"background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:E.colorDot,boxShadow:P?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:P?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:E.name}),P&&n.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),n.jsx("div",{title:E.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D(E.path)}),B&&n.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),n.jsx("button",{type:"button","aria-label":`Remove ${E.name}`,onClick:te=>{te.stopPropagation(),o(E.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:F?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:te=>{te.currentTarget.style.color="var(--color-error, #b91c1c)",te.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:te=>{te.currentTarget.style.color="var(--text-tertiary)",te.currentTarget.style.backgroundColor="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),n.jsx("path",{d:"M10 11v6"}),n.jsx("path",{d:"M14 11v6"}),n.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},E.id)})}),n.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&n.jsxs("button",{type:"button",onClick:()=>void w(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-action, #2F5B8E)",transition:"background-color 120ms ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("input",{type:"text",value:m,onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&V(),E.key==="Escape"&&(x(!1),j(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:()=>{x(!1),j(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void V(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),A&&n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>T(null),children:[n.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),n.jsxs("div",{onClick:E=>E.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",A.name]}),n.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),n.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${A.path}" && npx vskill@latest studio`}),n.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[n.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${A.path}" && npx vskill@latest studio`),M(!0),setTimeout(()=>M(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:C?"Copied!":"Copy command"}),n.jsx("button",{type:"button",onClick:()=>T(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function tC(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const d=`${o.name} ${o.path}`.toLowerCase();return i.every(p=>d.includes(p))})}function nC({open:a,projects:r,onSwitch:i,onClose:o}){const[d,p]=g.useState(""),[f,h]=g.useState(0),x=g.useMemo(()=>tC(r,d),[r,d]);g.useEffect(()=>{a||(p(""),h(0))},[a]),g.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const m=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=x[f];v&&(i(v.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:d,onChange:y=>p(y.target.value),onKeyDown:m,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,v)=>n.jsxs("li",{role:"option","aria-selected":v===f,"data-highlighted":v===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const ig=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function aC({open:a,onClose:r,initialMode:i="standalone",isClaudeCode:o,projectRoot:d,onCreated:p}){const[f,h]=g.useState("destination"),[x,m]=g.useState(i),[y,v]=g.useState(""),[j,S]=g.useState(""),[k,A]=g.useState(""),[T,C]=g.useState([]),[M,O]=g.useState(!1),[U,L]=g.useState(null);if(g.useEffect(()=>{a&&(h("destination"),m(i),v(""),S(""),A(""),L(null))},[a,i]),g.useEffect(()=>{if(!a)return;let z=!0;return fetch("/api/authoring/plugins").then(R=>R.json()).then(R=>{z&&C(R.plugins??[])}).catch(()=>{}),()=>{z=!1}},[a]),g.useEffect(()=>{if(!a)return;function z(R){R.key==="Escape"&&(R.preventDefault(),r())}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[a,r]),!a)return null;const V=T.length>0,w=o&&V,D=o,E=ig.test(y),B=x==="existing-plugin"?j.length>0:ig.test(j),P=!M&&E&&(x==="standalone"||B),F=lC(d,x,j,y);function te(){const z=new URLSearchParams;z.set("mode",x),z.set("skillName",y),k.trim()&&z.set("description",k.trim()),j&&z.set("pluginName",j);const R=`/#/create?${z.toString()}`;typeof window<"u"&&window.location.assign(R),r()}async function Q(){L(null),O(!0);try{const z=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:x,skillName:y,description:k.trim()||void 0,pluginName:x==="standalone"?void 0:j})}),R=await z.json();if(!z.ok||!R.ok){L(R.error??`Create failed: ${z.status}`);return}an("skills"),p==null||p({mode:x,skillName:y,pluginName:R.pluginName??null,skillMdPath:R.skillMdPath}),r()}catch(z){L(z instanceof Error?z.message:String(z))}finally{O(!1)}}return n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),n.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[n.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:f==="destination"?"Create a skill":"Name and describe"}),n.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",f==="destination"?"1":"2"," of 2"]})]}),f==="destination"&&n.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[n.jsx(cu,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:x==="standalone",onClick:()=>m("standalone")}),n.jsx(cu,{title:"Add to existing plugin",subtitle:w?`${T.length} plugin source${T.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!w,selected:x==="existing-plugin",onClick:()=>w&&m("existing-plugin")}),n.jsx(cu,{title:"New plugin",subtitle:D?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!D,selected:x==="new-plugin",onClick:()=>D&&m("new-plugin")})]}),f==="details"&&n.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[x==="new-plugin"&&n.jsx(to,{label:"Plugin name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:j,onChange:z=>S(z.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:no(!j||B)})}),x==="existing-plugin"&&n.jsx(to,{label:"Plugin",children:n.jsxs("select",{value:j,onChange:z=>S(z.target.value),style:{...no(!0),fontFamily:"var(--font-mono)"},children:[n.jsx("option",{value:"",children:"Select a plugin…"}),T.map(z=>n.jsx("option",{value:z.name,children:z.name},z.path))]})}),n.jsx(to,{label:"Skill name",hint:"kebab-case",children:n.jsx("input",{type:"text",value:y,onChange:z=>v(z.target.value.trim()),placeholder:"my-new-skill",autoFocus:x!=="new-plugin",style:no(!y||E)})}),n.jsx(to,{label:"Description",hint:"One short sentence — shown in frontmatter",children:n.jsx("textarea",{value:k,onChange:z=>A(z.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...no(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),F&&n.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[n.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),F.map((z,R)=>n.jsx("div",{children:z},R))]}),U&&n.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:U})]}),n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[n.jsx("button",{type:"button",onClick:r,style:du,children:"Cancel"}),f==="destination"&&n.jsx("button",{type:"button",onClick:()=>h("details"),style:og,children:"Continue →"}),f==="details"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:()=>h("destination"),style:du,children:"← Back"}),n.jsx("button",{type:"button",onClick:te,disabled:!P,style:{...du,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"✨ Generate with AI"}),n.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!P,style:{...og,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:M?"Creating…":"Create empty scaffold"})]})]})]})]})}function cu({title:a,subtitle:r,description:i,icon:o,selected:d,disabled:p,onClick:f}){return n.jsxs("button",{type:"button",onClick:f,disabled:p,"aria-pressed":d,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:d?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:d?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":p?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:p?"var(--text-tertiary)":"var(--text-primary)",cursor:p?"not-allowed":"pointer",opacity:p?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:a}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:r}),n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:i})]})]})}function to({label:a,hint:r,children:i}){return n.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[n.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[n.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:a}),r&&n.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:r})]}),i]})}function no(a){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${a?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const og={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},du={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function lC(a,r,i,o){const d=o||"<skill-name>",p=i||"<plugin-name>",f=a||"<project>";return r==="standalone"?[`${f}/skills/${d}/SKILL.md`]:r==="existing-plugin"?[`${f}/${p}/skills/${d}/SKILL.md`]:r==="new-plugin"?[`${f}/${p}/.claude-plugin/plugin.json`,`${f}/${p}/skills/${d}/SKILL.md`]:null}function rC({open:a,onClose:r,onInstall:i,installedNames:o}){const[d,p]=g.useState([]),[f,h]=g.useState(null),[x,m]=g.useState(null),[y,v]=g.useState(!1),[j,S]=g.useState(null);return g.useEffect(()=>{a&&(v(!0),S(null),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);p(k.marketplaces??[])}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1)))},[a]),g.useEffect(()=>{if(!f){m(null);return}v(!0),S(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(f)}`).then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);m(k)}).catch(k=>S(k instanceof Error?k.message:String(k))).finally(()=>v(!1))},[f]),g.useEffect(()=>{if(!a)return;function k(A){A.key==="Escape"&&r()}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a,r]),a?n.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[n.jsx("div",{onClick:r,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),n.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[f&&n.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),n.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:f?(x==null?void 0:x.name)??f:"Browse plugins"}),n.jsx("button",{type:"button",onClick:r,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),n.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&n.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),j&&n.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:j}),!f&&!y&&d.length===0&&!j&&n.jsx(sC,{}),!f&&d.map(k=>n.jsxs("button",{type:"button",onClick:()=>h(k.name),style:oC,onMouseEnter:A=>{A.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:A=>{A.currentTarget.style.background="transparent"},children:[n.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:k.name}),n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.source})]},k.name)),f&&x&&n.jsxs(n.Fragment,{children:[x.description&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:x.description}),x.plugins.length===0&&n.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),x.plugins.map(k=>{const A=o.has(k.name);return n.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:n.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[k.name,k.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:k.version}),k.category&&n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:k.category})]}),k.description&&n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:k.description})]}),n.jsx("button",{type:"button",disabled:A,onClick:()=>i(k.name,f),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:A?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:A?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:A?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:A?"default":"pointer",fontFamily:"inherit",boxShadow:A?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:A?"Installed":"Install"})]})},k.name)})]})]}),!f&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:n.jsx(iC,{onAdded:()=>{an("marketplaces"),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>p(k.marketplaces??[]))}})})]})]}):null}function sC(){return n.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",n.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[n.jsx("li",{children:n.jsx("code",{children:"anthropics/claude-plugins-official"})}),n.jsx("li",{children:n.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function iC({onAdded:a}){const[r,i]=g.useState(""),[o,d]=g.useState(!1),[p,f]=g.useState(null);async function h(){const x=r.trim();if(x){d(!0),f(null);try{const m=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:x})}),y=await m.json().catch(()=>({}));if(!m.ok||!y.ok){f(y.error??`Add failed (${m.status})`);return}i(""),a()}catch(m){f(m instanceof Error?m.message:String(m))}finally{d(!1)}}}return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[n.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{type:"text",value:r,onChange:x=>i(x.target.value),onKeyDown:x=>{x.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),n.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!r.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!r.trim()?"not-allowed":"pointer",opacity:o||!r.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),p&&n.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:p})]})}const oC={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},uu=12;function cC({job:a,onDone:r}){const[i,o]=g.useState([]),[d,p]=g.useState("running"),[f,h]=g.useState(!1);if(g.useEffect(()=>{if(!a)return;o([]),p("running"),h(!1);const v=new AbortController;let j=[],S="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:a.ref}),signal:v.signal});if(!k.ok||!k.body){p("failed"),r({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const A=k.body.getReader(),T=new TextDecoder;let C="";for(;;){const{value:M,done:O}=await A.read();if(O)break;C+=T.decode(M,{stream:!0});const U=C.split(/\n\n/);C=U.pop()??"";for(const L of U){const V=L.match(/^data:\s*(.*)$/m);if(V)try{const w=JSON.parse(V[1]);w.type==="stdout"&&w.line?(j=[...j,w.line].slice(-uu),o(j)):w.type==="stderr"&&w.line?(j=[...j,`⚠ ${w.line}`].slice(-uu),o(j)):w.type==="done"?(S=w.ok?"ok":"failed",p(S),an("plugins"),an("skills"),r({ok:w.ok??!1,code:w.code??null,lines:j})):w.type==="error"&&w.error&&(j=[...j,`✘ ${w.error}`].slice(-uu),o(j))}catch{}}}S==="running"&&r({ok:!0,code:0,lines:j})}catch(k){if(k.name==="AbortError")return;p("failed"),r({ok:!1,code:null,lines:[...j,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[a==null?void 0:a.ref]),!a)return null;const x=d==="ok"?"var(--color-installed, #2F6A4A)":d==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",m=d==="ok"?"✔":d==="failed"?"✘":"…",y=d==="ok"?"Installed":d==="failed"?"Install failed":"Installing";return n.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${x}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[n.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[n.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:x,width:16,textAlign:"center"},children:d==="running"?n.jsx(dC,{}):m}),n.jsxs("span",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",a.plugin,n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",a.marketplace]})]}),!f&&i.length>0&&n.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i[i.length-1]})]}),n.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:f?"▾":"▸"})]}),f&&n.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i.length===0?"Waiting for output…":i.join(`
|
|
91
|
+
`)})]})}function dC(){return n.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:n.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const Nv="vskill.studio.prefs";function Ev(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Tv(){const a=Ev();if(!a)return{};try{const r=a.getItem(Nv);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function uC(a,r){const i=Ev();if(i)try{const d={...Tv(),[a]:r};i.setItem(Nv,JSON.stringify(d))}catch{}}function fC(a,r){const o=Tv()[a];return o===void 0?r:o}const cg={open:!1,x:0,y:0,skill:null};function pC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function mC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const hC=g.lazy(()=>Tu(()=>import("./CommandPalette-BsIqE6hu.js"),__vite__mapDeps([2,1])));function xC(){return n.jsx(vb,{children:n.jsx(hb,{children:n.jsxs(cw,{children:[n.jsx(gC,{}),n.jsx(yw,{})]})})})}function gC(){var ve,_e;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:d}=ya(),{config:p}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=vg(),{toast:m}=qu(),[y,v]=g.useState(()=>D2()),[j]=g.useState(!0),[S,k]=g.useState(!1),[A,T]=g.useState(!1),[C,M]=g.useState(!1),[O,U]=g.useState("overview"),[L,V]=g.useState(cg),w=g.useCallback((re,Te)=>{V(pC(re,Te))},[]),D=Yw(),[E,B]=g.useState(()=>fC("activeAgent",null));g.useEffect(()=>{var re;!E&&((re=D.response)!=null&&re.suggested)&&B(D.response.suggested)},[E,(ve=D.response)==null?void 0:ve.suggested]);const P=g.useCallback(re=>{B(re),uC("activeAgent",re),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:re}}))},[]),F=g.useMemo(()=>D.response?Vw(D.response):[],[D.response]),{workspace:te,switchProject:Q,addProject:z,removeProject:R,activeProject:I}=Jw(),[Z,q]=g.useState(!1),[de,_]=g.useState(!1),[W,ie]=g.useState("standalone"),ue=g.useCallback((re="standalone")=>{ie(re),_(!0)},[]);g.useEffect(()=>{function re(Te){if(!(Te instanceof CustomEvent))return;const Qe=Te.detail;ue((Qe==null?void 0:Qe.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",re),()=>window.removeEventListener("studio:request-create-skill",re)},[ue]);const[ge,xe]=g.useState(!1),[we,oe]=g.useState(null);g.useEffect(()=>{function re(){xe(!0)}return window.addEventListener("studio:open-marketplace",re),()=>window.removeEventListener("studio:open-marketplace",re)},[]);const Se=g.useMemo(()=>{const re=new Set;for(const Te of a.skills)Te.source==="plugin"&&Te.pluginName&&re.add(Te.pluginName);return re},[a.skills]);bu([{key:"p",meta:!0,handler:re=>{var Qe;const Te=typeof document<"u"?document.activeElement:null;Te&&Te.tagName==="INPUT"||((Qe=re==null?void 0:re.preventDefault)==null||Qe.call(re),q(at=>!at))}}],{enabled:!0});const De=zw();g.useEffect(()=>{function re(Te){if(!(Te instanceof CustomEvent))return;const Qe=Te.detail;Qe!=null&&Qe.provider&&De.open(Qe.provider)}return window.addEventListener("studio:open-setup-drawer",re),()=>window.removeEventListener("studio:open-setup-drawer",re)},[De]);const Ie=g.useCallback(()=>{V(cg)},[]);g.useEffect(()=>{function re(Te){if(!(Te instanceof CustomEvent))return;const Qe=Te.detail;Qe!=null&&Qe.message&&m({message:Qe.message,severity:Qe.severity??"info"})}return window.addEventListener("studio:toast",re),()=>window.removeEventListener("studio:toast",re)},[m]),g.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const ae=g.useMemo(()=>a.selectedSkill?a.skills.find(re=>re.plugin===a.selectedSkill.plugin&&re.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),pe=g.useCallback(re=>{r({plugin:re.plugin,skill:re.skill,origin:re.origin})},[r]),fe=g.useMemo(()=>{if(!a.selectedSkill)return"";const re=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${re})`},[a.selectedSkill]),he=g.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>M(re=>!re)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>T(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return bu([{key:"cmd+k",handler:()=>k(re=>!re)},{key:"ctrl+k",handler:()=>k(re=>!re)},{key:"?",handler:()=>T(re=>!re)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>M(re=>!re)},{key:"ctrl+b",handler:()=>M(re=>!re)},{key:"e",handler:()=>m({message:J.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(yb,{sidebarWidth:y,sidebarHidden:C||a.isMobile&&a.mobileView==="detail",banner:n.jsx(B2,{connected:j}),liveMessage:fe,topRail:n.jsx(v0,{projectName:(p==null?void 0:p.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>k(!0),onHome:i,onRequestCreateSkill:()=>ue("standalone"),projectPickerSlot:te&&te.projects.length>0?n.jsx(eC,{workspace:te,onSwitch:Q,onAdd:z,onRemove:R}):void 0}),sidebar:n.jsx(N2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:pe,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:w,outdatedByOrigin:d,activeAgentId:E,topSlot:D.status==="ready"&&F.length>0?n.jsxs(n.Fragment,{children:[n.jsx($w,{agents:F,activeAgentId:E,onActiveAgentChange:P,onOpenSetup:re=>De.open(re)}),n.jsx(qw,{activeAgentId:E})]}):null}),resizeHandle:n.jsx(O2,{initialWidth:y??Ss,onChange:v}),main:n.jsx(fw,{selectedSkillInfo:ae,activeDetailTab:O,onDetailTabChange:U,allSkills:a.skills,onSelectSkill:pe}),statusBar:n.jsx(R0,{projectPath:(p==null?void 0:p.root)??null,modelName:(p==null?void 0:p.model)??null,health:p!=null&&p.error?"degraded":"ok",providers:(_e=p==null?void 0:p.providers)==null?void 0:_e.map(re=>{const Te=re.id;return{id:Te,label:re.label,available:re.available,kind:Te==="ollama"||Te==="lm-studio"?"start-service":Te==="anthropic"||Te==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(jw,{open:A,onClose:()=>T(!1)}),n.jsx(Nw,{open:De.isOpen,providerKey:De.providerKey,onClose:De.close}),n.jsx(kw,{state:L,onClose:Ie,onAction:(re,Te)=>mC(re,Te)}),S&&n.jsx(g.Suspense,{fallback:null,children:n.jsx(hC,{open:S,onClose:()=>k(!1),commands:he})}),n.jsx(nC,{open:Z,projects:(te==null?void 0:te.projects)??[],onSwitch:re=>{Q(re)},onClose:()=>q(!1)}),n.jsx(aC,{open:de,onClose:()=>_(!1),initialMode:W,isClaudeCode:E==="claude-code",projectRoot:(I==null?void 0:I.path)??(p==null?void 0:p.projectName)??"",onCreated:re=>{const Te=re.pluginName??"";o(),setTimeout(()=>{r({plugin:Te,skill:re.skillName,origin:"source"})},500)}}),n.jsx(rC,{open:ge,onClose:()=>xe(!1),installedNames:Se,onInstall:(re,Te)=>{oe({plugin:re,marketplace:Te,ref:`${re}@${Te}`}),xe(!1)}}),n.jsx(cC,{job:we,onDone:re=>{re.ok&&setTimeout(()=>oe(null),3e3)}})]})}const dg="vskill.migrations.scope-rename.v1",vC={own:"authoring-project",installed:"available-project",global:"available-personal"},yC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function bC(a){if(a.getItem(dg)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const d=o.match(yC);if(!d)continue;const[,p,f]=d,h=vC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${p}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:d}of r)a.getItem(o)===null&&a.setItem(o,d),a.removeItem(i);a.setItem(dg,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{bC(window.localStorage)}catch{}K1.createRoot(document.getElementById("root")).render(n.jsx(g.StrictMode,{children:n.jsx(w0,{children:n.jsx(xC,{})})}));export{n as j,g as r,J as s};
|