vskill 0.5.85 → 0.5.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,76 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CommandPalette-BAcN6Jji.js","assets/fonts-i7Lkz2zN.css"])))=>i.map(i=>d[i]);
2
- /* empty css */(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))c(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const p of m.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&c(p)}).observe(document,{childList:!0,subtree:!0});function i(d){const m={};return d.integrity&&(m.integrity=d.integrity),d.referrerPolicy&&(m.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?m.credentials="include":d.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function c(d){if(d.ep)return;d.ep=!0;const m=i(d);fetch(d.href,m)}})();function Sx(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Cu={exports:{}},os={};/**
3
- * @license React
4
- * react-jsx-runtime.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var vh;function Pg(){if(vh)return os;vh=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function i(c,d,m){var p=null;if(m!==void 0&&(p=""+m),d.key!==void 0&&(p=""+d.key),"key"in d){m={};for(var h in d)h!=="key"&&(m[h]=d[h])}else m=d;return d=m.ref,{$$typeof:a,type:c,key:p,ref:d!==void 0?d:null,props:m}}return os.Fragment=s,os.jsx=i,os.jsxs=i,os}var yh;function e1(){return yh||(yh=1,Cu.exports=Pg()),Cu.exports}var n=e1(),Eu={exports:{}},ze={};/**
11
- * @license React
12
- * react.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var gh;function t1(){if(gh)return ze;gh=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function k(R){return R===null||typeof R!="object"?null:(R=j&&R[j]||R["@@iterator"],typeof R=="function"?R:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,A={};function N(R,X,re){this.props=R,this.context=X,this.refs=A,this.updater=re||E}N.prototype.isReactComponent={},N.prototype.setState=function(R,X){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,X,"setState")},N.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function T(){}T.prototype=N.prototype;function H(R,X,re){this.props=R,this.context=X,this.refs=A,this.updater=re||E}var $=H.prototype=new T;$.constructor=H,z($,N.prototype),$.isPureReactComponent=!0;var O=Array.isArray;function K(){}var w={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function M(R,X,re){var de=re.ref;return{$$typeof:a,type:R,key:X,ref:de!==void 0?de:null,props:re}}function V(R,X){return M(R.type,X,R.props)}function I(R){return typeof R=="object"&&R!==null&&R.$$typeof===a}function Z(R){var X={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(re){return X[re]})}var ne=/\/+/g;function J(R,X){return typeof R=="object"&&R!==null&&R.key!=null?Z(""+R.key):X.toString(36)}function D(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(K,K):(R.status="pending",R.then(function(X){R.status==="pending"&&(R.status="fulfilled",R.value=X)},function(X){R.status==="pending"&&(R.status="rejected",R.reason=X)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function C(R,X,re,de,xe){var me=typeof R;(me==="undefined"||me==="boolean")&&(R=null);var Ne=!1;if(R===null)Ne=!0;else switch(me){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(R.$$typeof){case a:case s:Ne=!0;break;case b:return Ne=R._init,C(Ne(R._payload),X,re,de,xe)}}if(Ne)return xe=xe(R),Ne=de===""?"."+J(R,0):de,O(xe)?(re="",Ne!=null&&(re=Ne.replace(ne,"$&/")+"/"),C(xe,X,re,"",function(Ve){return Ve})):xe!=null&&(I(xe)&&(xe=V(xe,re+(xe.key==null||R&&R.key===xe.key?"":(""+xe.key).replace(ne,"$&/")+"/")+Ne)),X.push(xe)),1;Ne=0;var ie=de===""?".":de+":";if(O(R))for(var be=0;be<R.length;be++)de=R[be],me=ie+J(de,be),Ne+=C(de,X,re,me,xe);else if(be=k(R),typeof be=="function")for(R=be.call(R),be=0;!(de=R.next()).done;)de=de.value,me=ie+J(de,be++),Ne+=C(de,X,re,me,xe);else if(me==="object"){if(typeof R.then=="function")return C(D(R),X,re,de,xe);throw X=String(R),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function L(R,X,re){if(R==null)return R;var de=[],xe=0;return C(R,de,"","",function(me){return X.call(re,me,xe++)}),de}function ae(R){if(R._status===-1){var X=R._result;X=X(),X.then(function(re){(R._status===0||R._status===-1)&&(R._status=1,R._result=re)},function(re){(R._status===0||R._status===-1)&&(R._status=2,R._result=re)}),R._status===-1&&(R._status=0,R._result=X)}if(R._status===1)return R._result.default;throw R._result}var Q=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},pe={map:L,forEach:function(R,X,re){L(R,function(){X.apply(this,arguments)},re)},count:function(R){var X=0;return L(R,function(){X++}),X},toArray:function(R){return L(R,function(X){return X})||[]},only:function(R){if(!I(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return ze.Activity=g,ze.Children=pe,ze.Component=N,ze.Fragment=i,ze.Profiler=d,ze.PureComponent=H,ze.StrictMode=c,ze.Suspense=x,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,ze.__COMPILER_RUNTIME={__proto__:null,c:function(R){return w.H.useMemoCache(R)}},ze.cache=function(R){return function(){return R.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(R,X,re){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var de=z({},R.props),xe=R.key;if(X!=null)for(me in X.key!==void 0&&(xe=""+X.key),X)!B.call(X,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&X.ref===void 0||(de[me]=X[me]);var me=arguments.length-2;if(me===1)de.children=re;else if(1<me){for(var Ne=Array(me),ie=0;ie<me;ie++)Ne[ie]=arguments[ie+2];de.children=Ne}return M(R.type,xe,de)},ze.createContext=function(R){return R={$$typeof:p,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:m,_context:R},R},ze.createElement=function(R,X,re){var de,xe={},me=null;if(X!=null)for(de in X.key!==void 0&&(me=""+X.key),X)B.call(X,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(xe[de]=X[de]);var Ne=arguments.length-2;if(Ne===1)xe.children=re;else if(1<Ne){for(var ie=Array(Ne),be=0;be<Ne;be++)ie[be]=arguments[be+2];xe.children=ie}if(R&&R.defaultProps)for(de in Ne=R.defaultProps,Ne)xe[de]===void 0&&(xe[de]=Ne[de]);return M(R,me,xe)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(R){return{$$typeof:h,render:R}},ze.isValidElement=I,ze.lazy=function(R){return{$$typeof:b,_payload:{_status:-1,_result:R},_init:ae}},ze.memo=function(R,X){return{$$typeof:f,type:R,compare:X===void 0?null:X}},ze.startTransition=function(R){var X=w.T,re={};w.T=re;try{var de=R(),xe=w.S;xe!==null&&xe(re,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(K,Q)}catch(me){Q(me)}finally{X!==null&&re.types!==null&&(X.types=re.types),w.T=X}},ze.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},ze.use=function(R){return w.H.use(R)},ze.useActionState=function(R,X,re){return w.H.useActionState(R,X,re)},ze.useCallback=function(R,X){return w.H.useCallback(R,X)},ze.useContext=function(R){return w.H.useContext(R)},ze.useDebugValue=function(){},ze.useDeferredValue=function(R,X){return w.H.useDeferredValue(R,X)},ze.useEffect=function(R,X){return w.H.useEffect(R,X)},ze.useEffectEvent=function(R){return w.H.useEffectEvent(R)},ze.useId=function(){return w.H.useId()},ze.useImperativeHandle=function(R,X,re){return w.H.useImperativeHandle(R,X,re)},ze.useInsertionEffect=function(R,X){return w.H.useInsertionEffect(R,X)},ze.useLayoutEffect=function(R,X){return w.H.useLayoutEffect(R,X)},ze.useMemo=function(R,X){return w.H.useMemo(R,X)},ze.useOptimistic=function(R,X){return w.H.useOptimistic(R,X)},ze.useReducer=function(R,X,re){return w.H.useReducer(R,X,re)},ze.useRef=function(R){return w.H.useRef(R)},ze.useState=function(R){return w.H.useState(R)},ze.useSyncExternalStore=function(R,X,re){return w.H.useSyncExternalStore(R,X,re)},ze.useTransition=function(){return w.H.useTransition()},ze.version="19.2.4",ze}var bh;function rd(){return bh||(bh=1,Eu.exports=t1()),Eu.exports}var y=rd();const Se=Sx(y);var Tu={exports:{}},cs={},Ru={exports:{}},Au={};/**
19
- * @license React
20
- * scheduler.production.js
21
- *
22
- * Copyright (c) Meta Platforms, Inc. and affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var jh;function n1(){return jh||(jh=1,(function(a){function s(C,L){var ae=C.length;C.push(L);e:for(;0<ae;){var Q=ae-1>>>1,pe=C[Q];if(0<d(pe,L))C[Q]=L,C[ae]=pe,ae=Q;else break e}}function i(C){return C.length===0?null:C[0]}function c(C){if(C.length===0)return null;var L=C[0],ae=C.pop();if(ae!==L){C[0]=ae;e:for(var Q=0,pe=C.length,R=pe>>>1;Q<R;){var X=2*(Q+1)-1,re=C[X],de=X+1,xe=C[de];if(0>d(re,ae))de<pe&&0>d(xe,re)?(C[Q]=xe,C[de]=ae,Q=de):(C[Q]=re,C[X]=ae,Q=X);else if(de<pe&&0>d(xe,ae))C[Q]=xe,C[de]=ae,Q=de;else break e}}return L}function d(C,L){var ae=C.sortIndex-L.sortIndex;return ae!==0?ae:C.id-L.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var m=performance;a.unstable_now=function(){return m.now()}}else{var p=Date,h=p.now();a.unstable_now=function(){return p.now()-h}}var x=[],f=[],b=1,g=null,j=3,k=!1,E=!1,z=!1,A=!1,N=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function $(C){for(var L=i(f);L!==null;){if(L.callback===null)c(f);else if(L.startTime<=C)c(f),L.sortIndex=L.expirationTime,s(x,L);else break;L=i(f)}}function O(C){if(z=!1,$(C),!E)if(i(x)!==null)E=!0,K||(K=!0,Z());else{var L=i(f);L!==null&&D(O,L.startTime-C)}}var K=!1,w=-1,B=5,M=-1;function V(){return A?!0:!(a.unstable_now()-M<B)}function I(){if(A=!1,K){var C=a.unstable_now();M=C;var L=!0;try{e:{E=!1,z&&(z=!1,T(w),w=-1),k=!0;var ae=j;try{t:{for($(C),g=i(x);g!==null&&!(g.expirationTime>C&&V());){var Q=g.callback;if(typeof Q=="function"){g.callback=null,j=g.priorityLevel;var pe=Q(g.expirationTime<=C);if(C=a.unstable_now(),typeof pe=="function"){g.callback=pe,$(C),L=!0;break t}g===i(x)&&c(x),$(C)}else c(x);g=i(x)}if(g!==null)L=!0;else{var R=i(f);R!==null&&D(O,R.startTime-C),L=!1}}break e}finally{g=null,j=ae,k=!1}L=void 0}}finally{L?Z():K=!1}}}var Z;if(typeof H=="function")Z=function(){H(I)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,J=ne.port2;ne.port1.onmessage=I,Z=function(){J.postMessage(null)}}else Z=function(){N(I,0)};function D(C,L){w=N(function(){C(a.unstable_now())},L)}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(C){C.callback=null},a.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<C?Math.floor(1e3/C):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(C){switch(j){case 1:case 2:case 3:var L=3;break;default:L=j}var ae=j;j=L;try{return C()}finally{j=ae}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(C,L){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var ae=j;j=C;try{return L()}finally{j=ae}},a.unstable_scheduleCallback=function(C,L,ae){var Q=a.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?Q+ae:Q):ae=Q,C){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=ae+pe,C={id:b++,callback:L,priorityLevel:C,startTime:ae,expirationTime:pe,sortIndex:-1},ae>Q?(C.sortIndex=ae,s(f,C),i(x)===null&&C===i(f)&&(z?(T(w),w=-1):z=!0,D(O,ae-Q))):(C.sortIndex=pe,s(x,C),E||k||(E=!0,K||(K=!0,Z()))),C},a.unstable_shouldYield=V,a.unstable_wrapCallback=function(C){var L=j;return function(){var ae=j;j=L;try{return C.apply(this,arguments)}finally{j=ae}}}})(Au)),Au}var Sh;function l1(){return Sh||(Sh=1,Ru.exports=n1()),Ru.exports}var Mu={exports:{}},Wt={};/**
27
- * @license React
28
- * react-dom.production.js
29
- *
30
- * Copyright (c) Meta Platforms, Inc. and affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */var kh;function a1(){if(kh)return Wt;kh=1;var a=rd();function s(x){var f="https://react.dev/errors/"+x;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)f+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+x+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var c={d:{f:i,r:function(){throw Error(s(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 m(x,f,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:g==null?null:""+g,children:x,containerInfo:f,implementation:b}}var p=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,f){if(x==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=c,Wt.createPortal=function(x,f){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(s(299));return m(x,f,null,b)},Wt.flushSync=function(x){var f=p.T,b=c.p;try{if(p.T=null,c.p=2,x)return x()}finally{p.T=f,c.p=b,c.d.f()}},Wt.preconnect=function(x,f){typeof x=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,c.d.C(x,f))},Wt.prefetchDNS=function(x){typeof x=="string"&&c.d.D(x)},Wt.preinit=function(x,f){if(typeof x=="string"&&f&&typeof f.as=="string"){var b=f.as,g=h(b,f.crossOrigin),j=typeof f.integrity=="string"?f.integrity:void 0,k=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;b==="style"?c.d.S(x,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:k}):b==="script"&&c.d.X(x,{crossOrigin:g,integrity:j,fetchPriority:k,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Wt.preinitModule=function(x,f){if(typeof x=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var b=h(f.as,f.crossOrigin);c.d.M(x,{crossOrigin:b,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&c.d.M(x)},Wt.preload=function(x,f){if(typeof x=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var b=f.as,g=h(b,f.crossOrigin);c.d.L(x,b,{crossOrigin:g,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Wt.preloadModule=function(x,f){if(typeof x=="string")if(f){var b=h(f.as,f.crossOrigin);c.d.m(x,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:b,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else c.d.m(x)},Wt.requestFormReset=function(x){c.d.r(x)},Wt.unstable_batchedUpdates=function(x,f){return x(f)},Wt.useFormState=function(x,f,b){return p.H.useFormState(x,f,b)},Wt.useFormStatus=function(){return p.H.useHostTransitionStatus()},Wt.version="19.2.4",Wt}var Nh;function kx(){if(Nh)return Mu.exports;Nh=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(s){console.error(s)}}return a(),Mu.exports=a1(),Mu.exports}/**
35
- * @license React
36
- * react-dom-client.production.js
37
- *
38
- * Copyright (c) Meta Platforms, Inc. and affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- */var wh;function r1(){if(wh)return cs;wh=1;var a=l1(),s=rd(),i=kx();function c(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 m(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function p(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function 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(m(e)!==e)throw Error(c(188))}function f(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(c(188));return t!==e?null:e}for(var l=e,r=t;;){var o=l.return;if(o===null)break;var u=o.alternate;if(u===null){if(r=o.return,r!==null){l=r;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===l)return x(o),e;if(u===r)return x(o),t;u=u.sibling}throw Error(c(188))}if(l.return!==r.return)l=o,r=u;else{for(var v=!1,S=o.child;S;){if(S===l){v=!0,l=o,r=u;break}if(S===r){v=!0,r=o,l=u;break}S=S.sibling}if(!v){for(S=u.child;S;){if(S===l){v=!0,l=u,r=o;break}if(S===r){v=!0,r=u,l=o;break}S=S.sibling}if(!v)throw Error(c(189))}}if(l.alternate!==r)throw Error(c(190))}if(l.tag!==3)throw Error(c(188));return l.stateNode.current===l?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),z=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),H=Symbol.for("react.context"),$=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),V=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var ne=Symbol.for("react.client.reference");function J(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case z:return"Fragment";case N:return"Profiler";case A:return"StrictMode";case O:return"Suspense";case K:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case H:return e.displayName||"Context";case T:return(e._context.displayName||"Context")+".Consumer";case $: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:J(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return J(e(t))}catch{}}return null}var D=Array.isArray,C=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},Q=[],pe=-1;function R(e){return{current:e}}function X(e){0>pe||(e.current=Q[pe],Q[pe]=null,pe--)}function re(e,t){pe++,Q[pe]=e.current,e.current=t}var de=R(null),xe=R(null),me=R(null),Ne=R(null);function ie(e,t){switch(re(me,t),re(xe,e),re(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Im(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Im(t),e=Vm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(de),re(de,e)}function be(){X(de),X(xe),X(me)}function Ve(e){e.memoizedState!==null&&re(Ne,e);var t=de.current,l=Vm(t,e.type);t!==l&&(re(xe,e),re(de,l))}function Oe(e){xe.current===e&&(X(de),X(xe)),Ne.current===e&&(X(Ne),as._currentValue=ae)}var ee,ce;function oe(e){if(ee===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ee=t&&t[1]||"",ce=-1<l.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+ee+e+ce}var fe=!1;function ve(e,t){if(!e||fe)return"";fe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(F){var W=F}Reflect.construct(e,[],le)}else{try{le.call()}catch(F){W=F}e.call(le.prototype)}}else{try{throw Error()}catch(F){W=F}(le=e())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(F){if(F&&W&&typeof F.stack=="string")return[F.stack,W.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=r.DetermineComponentFrameRoot(),v=u[0],S=u[1];if(v&&S){var _=v.split(`
45
- `),Y=S.split(`
46
- `);for(o=r=0;r<_.length&&!_[r].includes("DetermineComponentFrameRoot");)r++;for(;o<Y.length&&!Y[o].includes("DetermineComponentFrameRoot");)o++;if(r===_.length||o===Y.length)for(r=_.length-1,o=Y.length-1;1<=r&&0<=o&&_[r]!==Y[o];)o--;for(;1<=r&&0<=o;r--,o--)if(_[r]!==Y[o]){if(r!==1||o!==1)do if(r--,o--,0>o||_[r]!==Y[o]){var P=`
47
- `+_[r].replace(" at new "," at ");return e.displayName&&P.includes("<anonymous>")&&(P=P.replace("<anonymous>",e.displayName)),P}while(1<=r&&0<=o);break}}}finally{fe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?oe(l):""}function Le(e,t){switch(e.tag){case 26:case 27:case 5:return oe(e.type);case 16:return oe("Lazy");case 13:return e.child!==t&&t!==null?oe("Suspense Fallback"):oe("Suspense");case 19:return oe("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 oe("Activity");default:return""}}function Ae(e){try{var t="",l=null;do t+=Le(e,l),l=e,e=e.return;while(e);return t}catch(r){return`
48
- Error generating stack: `+r.message+`
49
- `+r.stack}}var ut=Object.prototype.hasOwnProperty,Jt=a.unstable_scheduleCallback,ot=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,Gt=a.unstable_requestPaint,et=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,he=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,Me=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Xt=a.unstable_IdlePriority,tt=a.log,Wl=a.unstable_setDisableYieldValue,Zn=null,wt=null;function St(e){if(typeof tt=="function"&&Wl(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(Zn,e)}catch{}}var bt=Math.clz32?Math.clz32:Bn,On=Math.log,Zl=Math.LN2;function Bn(e){return e>>>=0,e===0?32:31-(On(e)/Zl|0)|0}var Ue=256,Ht=262144,Fn=4194304;function Ct(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 vr(e,t,l){var r=e.pendingLanes;if(r===0)return 0;var o=0,u=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var S=r&134217727;return S!==0?(r=S&~u,r!==0?o=Ct(r):(v&=S,v!==0?o=Ct(v):l||(l=S&~e,l!==0&&(o=Ct(l))))):(S=r&~u,S!==0?o=Ct(S):v!==0?o=Ct(v):l||(l=r&~e,l!==0&&(o=Ct(l)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:o}function kn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function po(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 bd(){var e=Fn;return Fn<<=1,(Fn&62914560)===0&&(Fn=4194304),e}function mo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function yr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Vv(e,t,l,r,o,u){var v=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 S=e.entanglements,_=e.expirationTimes,Y=e.hiddenUpdates;for(l=v&~l;0<l;){var P=31-bt(l),le=1<<P;S[P]=0,_[P]=-1;var W=Y[P];if(W!==null)for(Y[P]=null,P=0;P<W.length;P++){var F=W[P];F!==null&&(F.lane&=-536870913)}l&=~le}r!==0&&jd(e,r,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(v&~t))}function jd(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-bt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|l&261930}function Sd(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var r=31-bt(l),o=1<<r;o&t|e[r]&t&&(e[r]|=t),l&=~o}}function kd(e,t){var l=t&-t;return l=(l&42)!==0?1:ho(l),(l&(e.suspendedLanes|t))!==0?0:l}function ho(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 xo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Nd(){var e=L.p;return e!==0?e:(e=window.event,e===void 0?32:uh(e.type))}function wd(e,t){var l=L.p;try{return L.p=e,t()}finally{L.p=l}}var yl=Math.random().toString(36).slice(2),$t="__reactFiber$"+yl,ln="__reactProps$"+yl,ja="__reactContainer$"+yl,vo="__reactEvents$"+yl,Gv="__reactListeners$"+yl,$v="__reactHandles$"+yl,Cd="__reactResources$"+yl,gr="__reactMarker$"+yl;function yo(e){delete e[$t],delete e[ln],delete e[vo],delete e[Gv],delete e[$v]}function Sa(e){var t=e[$t];if(t)return t;for(var l=e.parentNode;l;){if(t=l[ja]||l[$t]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Xm(e);e!==null;){if(l=e[$t])return l;e=Xm(e)}return t}e=l,l=e.parentNode}return null}function ka(e){if(e=e[$t]||e[ja]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function br(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(c(33))}function Na(e){var t=e[Cd];return t||(t=e[Cd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[gr]=!0}var Ed=new Set,Td={};function Fl(e,t){wa(e,t),wa(e+"Capture",t)}function wa(e,t){for(Td[e]=t,e=0;e<t.length;e++)Ed.add(t[e])}var qv=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]*$"),Rd={},Ad={};function Yv(e){return ut.call(Ad,e)?!0:ut.call(Rd,e)?!1:qv.test(e)?Ad[e]=!0:(Rd[e]=!0,!1)}function Rs(e,t,l){if(Yv(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function As(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 Jn(e,t,l,r){if(r===null)e.removeAttribute(l);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+r)}}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 Md(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kv(e,t,l){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,u=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(v){l=""+v,u.call(this,v)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return l},setValue:function(v){l=""+v},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function go(e){if(!e._valueTracker){var t=Md(e)?"checked":"value";e._valueTracker=Kv(e,t,""+e[t])}}function zd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),r="";return e&&(r=Md(e)?e.checked?"true":"false":e.value),e=r,e!==l?(t.setValue(e),!0):!1}function Ms(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Qv=/[\n"\\]/g;function wn(e){return e.replace(Qv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function bo(e,t,l,r,o,u,v,S){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),t!=null?v==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Nn(t)):e.value!==""+Nn(t)&&(e.value=""+Nn(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?jo(e,v,Nn(t)):l!=null?jo(e,v,Nn(l)):r!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+Nn(S):e.removeAttribute("name")}function Dd(e,t,l,r,o,u,v,S){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)){go(e);return}l=l!=null?""+Nn(l):"",t=t!=null?""+Nn(t):l,S||t===e.value||(e.value=t),e.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=S?e.checked:!!r,e.defaultChecked=!!r,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),go(e)}function jo(e,t,l){t==="number"&&Ms(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Ca(e,t,l,r){if(e=e.options,t){t={};for(var o=0;o<l.length;o++)t["$"+l[o]]=!0;for(l=0;l<e.length;l++)o=t.hasOwnProperty("$"+e[l].value),e[l].selected!==o&&(e[l].selected=o),o&&r&&(e[l].defaultSelected=!0)}else{for(l=""+Nn(l),t=null,o=0;o<e.length;o++){if(e[o].value===l){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Ld(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 _d(e,t,l,r){if(t==null){if(r!=null){if(l!=null)throw Error(c(92));if(D(r)){if(1<r.length)throw Error(c(93));r=r[0]}l=r}l==null&&(l=""),t=l}l=Nn(t),e.defaultValue=l,r=e.textContent,r===l&&r!==""&&r!==null&&(e.value=r),go(e)}function Ea(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Xv=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 Od(e,t,l){var r=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,l):typeof l!="number"||l===0||Xv.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Bd(e,t,l){if(t!=null&&typeof t!="object")throw Error(c(62));if(e=e.style,l!=null){for(var r in l)!l.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&l[o]!==r&&Od(e,o,r)}else for(var u in t)t.hasOwnProperty(u)&&Od(e,u,t[u])}function So(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 Wv=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"]]),Zv=/^[\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 zs(e){return Zv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Pn(){}var ko=null;function No(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ta=null,Ra=null;function Hd(e){var t=ka(e);if(t&&(e=t.stateNode)){var l=e[ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(bo(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="'+wn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var r=l[t];if(r!==e&&r.form===e.form){var o=r[ln]||null;if(!o)throw Error(c(90));bo(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<l.length;t++)r=l[t],r.form===e.form&&zd(r)}break e;case"textarea":Ld(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Ca(e,!!l.multiple,t,!1)}}}var wo=!1;function Ud(e,t,l){if(wo)return e(t,l);wo=!0;try{var r=e(t);return r}finally{if(wo=!1,(Ta!==null||Ra!==null)&&(gi(),Ta&&(t=Ta,e=Ra,Ra=Ta=null,Hd(t),e)))for(t=0;t<e.length;t++)Hd(e[t])}}function jr(e,t){var l=e.stateNode;if(l===null)return null;var r=l[ln]||null;if(r===null)return null;l=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(c(231,t,typeof l));return l}var el=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Co=!1;if(el)try{var Sr={};Object.defineProperty(Sr,"passive",{get:function(){Co=!0}}),window.addEventListener("test",Sr,Sr),window.removeEventListener("test",Sr,Sr)}catch{Co=!1}var gl=null,Eo=null,Ds=null;function Id(){if(Ds)return Ds;var e,t=Eo,l=t.length,r,o="value"in gl?gl.value:gl.textContent,u=o.length;for(e=0;e<l&&t[e]===o[e];e++);var v=l-e;for(r=1;r<=v&&t[l-r]===o[u-r];r++);return Ds=o.slice(e,1<r?1-r:void 0)}function Ls(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 _s(){return!0}function Vd(){return!1}function an(e){function t(l,r,o,u,v){this._reactName=l,this._targetInst=o,this.type=r,this.nativeEvent=u,this.target=v,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(l=e[S],this[S]=l?l(u):u[S]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?_s:Vd,this.isPropagationStopped=Vd,this}return g(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=_s)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=_s)},persist:function(){},isPersistent:_s}),t}var Jl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Os=an(Jl),kr=g({},Jl,{view:0,detail:0}),Fv=an(kr),To,Ro,Nr,Bs=g({},kr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mo,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!==Nr&&(Nr&&e.type==="mousemove"?(To=e.screenX-Nr.screenX,Ro=e.screenY-Nr.screenY):Ro=To=0,Nr=e),To)},movementY:function(e){return"movementY"in e?e.movementY:Ro}}),Gd=an(Bs),Jv=g({},Bs,{dataTransfer:0}),Pv=an(Jv),ey=g({},kr,{relatedTarget:0}),Ao=an(ey),ty=g({},Jl,{animationName:0,elapsedTime:0,pseudoElement:0}),ny=an(ty),ly=g({},Jl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ay=an(ly),ry=g({},Jl,{data:0}),$d=an(ry),sy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},iy={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"},oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=oy[e])?!!t[e]:!1}function Mo(){return cy}var uy=g({},kr,{key:function(e){if(e.key){var t=sy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ls(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?iy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mo,charCode:function(e){return e.type==="keypress"?Ls(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ls(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),dy=an(uy),fy=g({},Bs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qd=an(fy),py=g({},kr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mo}),my=an(py),hy=g({},Jl,{propertyName:0,elapsedTime:0,pseudoElement:0}),xy=an(hy),vy=g({},Bs,{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}),yy=an(vy),gy=g({},Jl,{newState:0,oldState:0}),by=an(gy),jy=[9,13,27,32],zo=el&&"CompositionEvent"in window,wr=null;el&&"documentMode"in document&&(wr=document.documentMode);var Sy=el&&"TextEvent"in window&&!wr,Yd=el&&(!zo||wr&&8<wr&&11>=wr),Kd=" ",Qd=!1;function Xd(e,t){switch(e){case"keyup":return jy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Aa=!1;function ky(e,t){switch(e){case"compositionend":return Wd(t);case"keypress":return t.which!==32?null:(Qd=!0,Kd);case"textInput":return e=t.data,e===Kd&&Qd?null:e;default:return null}}function Ny(e,t){if(Aa)return e==="compositionend"||!zo&&Xd(e,t)?(e=Id(),Ds=Eo=gl=null,Aa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Yd&&t.locale!=="ko"?null:t.data;default:return null}}var wy={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 Zd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!wy[e.type]:t==="textarea"}function Fd(e,t,l,r){Ta?Ra?Ra.push(r):Ra=[r]:Ta=r,t=Ci(t,"onChange"),0<t.length&&(l=new Os("onChange","change",null,l,r),e.push({event:l,listeners:t}))}var Cr=null,Er=null;function Cy(e){Lm(e,0)}function Hs(e){var t=br(e);if(zd(t))return e}function Jd(e,t){if(e==="change")return t}var Pd=!1;if(el){var Do;if(el){var Lo="oninput"in document;if(!Lo){var ef=document.createElement("div");ef.setAttribute("oninput","return;"),Lo=typeof ef.oninput=="function"}Do=Lo}else Do=!1;Pd=Do&&(!document.documentMode||9<document.documentMode)}function tf(){Cr&&(Cr.detachEvent("onpropertychange",nf),Er=Cr=null)}function nf(e){if(e.propertyName==="value"&&Hs(Er)){var t=[];Fd(t,Er,e,No(e)),Ud(Cy,t)}}function Ey(e,t,l){e==="focusin"?(tf(),Cr=t,Er=l,Cr.attachEvent("onpropertychange",nf)):e==="focusout"&&tf()}function Ty(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Hs(Er)}function Ry(e,t){if(e==="click")return Hs(t)}function Ay(e,t){if(e==="input"||e==="change")return Hs(t)}function My(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dn=typeof Object.is=="function"?Object.is:My;function Tr(e,t){if(dn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),r=Object.keys(t);if(l.length!==r.length)return!1;for(r=0;r<l.length;r++){var o=l[r];if(!ut.call(t,o)||!dn(e[o],t[o]))return!1}return!0}function lf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function af(e,t){var l=lf(e);e=0;for(var r;l;){if(l.nodeType===3){if(r=e+l.textContent.length,e<=t&&r>=t)return{node:l,offset:t-e};e=r}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=lf(l)}}function rf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?rf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ms(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=Ms(e.document)}return t}function _o(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 zy=el&&"documentMode"in document&&11>=document.documentMode,Ma=null,Oo=null,Rr=null,Bo=!1;function of(e,t,l){var r=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Bo||Ma==null||Ma!==Ms(r)||(r=Ma,"selectionStart"in r&&_o(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&Tr(Rr,r)||(Rr=r,r=Ci(Oo,"onSelect"),0<r.length&&(t=new Os("onSelect","select",null,t,l),e.push({event:t,listeners:r}),t.target=Ma)))}function Pl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var za={animationend:Pl("Animation","AnimationEnd"),animationiteration:Pl("Animation","AnimationIteration"),animationstart:Pl("Animation","AnimationStart"),transitionrun:Pl("Transition","TransitionRun"),transitionstart:Pl("Transition","TransitionStart"),transitioncancel:Pl("Transition","TransitionCancel"),transitionend:Pl("Transition","TransitionEnd")},Ho={},cf={};el&&(cf=document.createElement("div").style,"AnimationEvent"in window||(delete za.animationend.animation,delete za.animationiteration.animation,delete za.animationstart.animation),"TransitionEvent"in window||delete za.transitionend.transition);function ea(e){if(Ho[e])return Ho[e];if(!za[e])return e;var t=za[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in cf)return Ho[e]=t[l];return e}var uf=ea("animationend"),df=ea("animationiteration"),ff=ea("animationstart"),Dy=ea("transitionrun"),Ly=ea("transitionstart"),_y=ea("transitioncancel"),pf=ea("transitionend"),mf=new Map,Uo="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(" ");Uo.push("scrollEnd");function Hn(e,t){mf.set(e,t),Fl(t,[e])}var Us=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)},Cn=[],Da=0,Io=0;function Is(){for(var e=Da,t=Io=Da=0;t<e;){var l=Cn[t];Cn[t++]=null;var r=Cn[t];Cn[t++]=null;var o=Cn[t];Cn[t++]=null;var u=Cn[t];if(Cn[t++]=null,r!==null&&o!==null){var v=r.pending;v===null?o.next=o:(o.next=v.next,v.next=o),r.pending=o}u!==0&&hf(l,o,u)}}function Vs(e,t,l,r){Cn[Da++]=e,Cn[Da++]=t,Cn[Da++]=l,Cn[Da++]=r,Io|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Vo(e,t,l,r){return Vs(e,t,l,r),Gs(e)}function ta(e,t){return Vs(e,null,null,t),Gs(e)}function hf(e,t,l){e.lanes|=l;var r=e.alternate;r!==null&&(r.lanes|=l);for(var o=!1,u=e.return;u!==null;)u.childLanes|=l,r=u.alternate,r!==null&&(r.childLanes|=l),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-bt(l),e=u.hiddenUpdates,r=e[o],r===null?e[o]=[t]:r.push(t),t.lane=l|536870912),u):null}function Gs(e){if(50<Fr)throw Fr=0,Zc=null,Error(c(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var La={};function Oy(e,t,l,r){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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fn(e,t,l,r){return new Oy(e,t,l,r)}function Go(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tl(e,t){var l=e.alternate;return l===null?(l=fn(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 xf(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 $s(e,t,l,r,o,u){var v=0;if(r=e,typeof e=="function")Go(e)&&(v=1);else if(typeof e=="string")v=Vg(e,l,de.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case M:return e=fn(31,l,t,o),e.elementType=M,e.lanes=u,e;case z:return na(l.children,o,u,t);case A:v=8,o|=24;break;case N:return e=fn(12,l,t,o|2),e.elementType=N,e.lanes=u,e;case O:return e=fn(13,l,t,o),e.elementType=O,e.lanes=u,e;case K:return e=fn(19,l,t,o),e.elementType=K,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:v=10;break e;case T:v=9;break e;case $:v=11;break e;case w:v=14;break e;case B:v=16,r=null;break e}v=29,l=Error(c(130,e===null?"null":typeof e,"")),r=null}return t=fn(v,l,t,o),t.elementType=e,t.type=r,t.lanes=u,t}function na(e,t,l,r){return e=fn(7,e,r,t),e.lanes=l,e}function $o(e,t,l){return e=fn(6,e,null,t),e.lanes=l,e}function vf(e){var t=fn(18,null,null,0);return t.stateNode=e,t}function qo(e,t,l){return t=fn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var yf=new WeakMap;function En(e,t){if(typeof e=="object"&&e!==null){var l=yf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Ae(t)},yf.set(e,t),t)}return{value:e,source:t,stack:Ae(t)}}var _a=[],Oa=0,qs=null,Ar=0,Tn=[],Rn=0,bl=null,$n=1,qn="";function nl(e,t){_a[Oa++]=Ar,_a[Oa++]=qs,qs=e,Ar=t}function gf(e,t,l){Tn[Rn++]=$n,Tn[Rn++]=qn,Tn[Rn++]=bl,bl=e;var r=$n;e=qn;var o=32-bt(r)-1;r&=~(1<<o),l+=1;var u=32-bt(t)+o;if(30<u){var v=o-o%5;u=(r&(1<<v)-1).toString(32),r>>=v,o-=v,$n=1<<32-bt(t)+o|l<<o|r,qn=u+e}else $n=1<<u|l<<o|r,qn=e}function Yo(e){e.return!==null&&(nl(e,1),gf(e,1,0))}function Ko(e){for(;e===qs;)qs=_a[--Oa],_a[Oa]=null,Ar=_a[--Oa],_a[Oa]=null;for(;e===bl;)bl=Tn[--Rn],Tn[Rn]=null,qn=Tn[--Rn],Tn[Rn]=null,$n=Tn[--Rn],Tn[Rn]=null}function bf(e,t){Tn[Rn++]=$n,Tn[Rn++]=qn,Tn[Rn++]=bl,$n=t.id,qn=t.overflow,bl=e}var qt=null,dt=null,Ke=!1,jl=null,An=!1,Qo=Error(c(519));function Sl(e){var t=Error(c(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Mr(En(t,e)),Qo}function jf(e){var t=e.stateNode,l=e.type,r=e.memoizedProps;switch(t[$t]=e,t[ln]=r,l){case"dialog":$e("cancel",t),$e("close",t);break;case"iframe":case"object":case"embed":$e("load",t);break;case"video":case"audio":for(l=0;l<Pr.length;l++)$e(Pr[l],t);break;case"source":$e("error",t);break;case"img":case"image":case"link":$e("error",t),$e("load",t);break;case"details":$e("toggle",t);break;case"input":$e("invalid",t),Dd(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":$e("invalid",t);break;case"textarea":$e("invalid",t),_d(t,r.value,r.defaultValue,r.children)}l=r.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||r.suppressHydrationWarning===!0||Hm(t.textContent,l)?(r.popover!=null&&($e("beforetoggle",t),$e("toggle",t)),r.onScroll!=null&&$e("scroll",t),r.onScrollEnd!=null&&$e("scrollend",t),r.onClick!=null&&(t.onclick=Pn),t=!0):t=!1,t||Sl(e,!0)}function Sf(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:An=!1;return;case 27:case 3:An=!0;return;default:qt=qt.return}}function Ba(e){if(e!==qt)return!1;if(!Ke)return Sf(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")||du(e.type,e.memoizedProps)),l=!l),l&&dt&&Sl(e),Sf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));dt=Qm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));dt=Qm(e)}else t===27?(t=dt,Ol(e.type)?(e=xu,xu=null,dt=e):dt=t):dt=qt?zn(e.stateNode.nextSibling):null;return!0}function la(){dt=qt=null,Ke=!1}function Xo(){var e=jl;return e!==null&&(cn===null?cn=e:cn.push.apply(cn,e),jl=null),e}function Mr(e){jl===null?jl=[e]:jl.push(e)}var Wo=R(null),aa=null,ll=null;function kl(e,t,l){re(Wo,t._currentValue),t._currentValue=l}function al(e){e._currentValue=Wo.current,X(Wo)}function Zo(e,t,l){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===l)break;e=e.return}}function Fo(e,t,l,r){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var v=o.child;u=u.firstContext;e:for(;u!==null;){var S=u;u=o;for(var _=0;_<t.length;_++)if(S.context===t[_]){u.lanes|=l,S=u.alternate,S!==null&&(S.lanes|=l),Zo(u.return,l,e),r||(v=null);break e}u=S.next}}else if(o.tag===18){if(v=o.return,v===null)throw Error(c(341));v.lanes|=l,u=v.alternate,u!==null&&(u.lanes|=l),Zo(v,l,e),v=null}else v=o.child;if(v!==null)v.return=o;else for(v=o;v!==null;){if(v===e){v=null;break}if(o=v.sibling,o!==null){o.return=v.return,v=o;break}v=v.return}o=v}}function Ha(e,t,l,r){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var v=o.alternate;if(v===null)throw Error(c(387));if(v=v.memoizedProps,v!==null){var S=o.type;dn(o.pendingProps.value,v.value)||(e!==null?e.push(S):e=[S])}}else if(o===Ne.current){if(v=o.alternate,v===null)throw Error(c(387));v.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(as):e=[as])}o=o.return}e!==null&&Fo(t,e,l,r),t.flags|=262144}function Ys(e){for(e=e.firstContext;e!==null;){if(!dn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ra(e){aa=e,ll=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return kf(aa,e)}function Ks(e,t){return aa===null&&ra(e),kf(e,t)}function kf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},ll===null){if(e===null)throw Error(c(308));ll=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ll=ll.next=t;return l}var By=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Hy=a.unstable_scheduleCallback,Uy=a.unstable_NormalPriority,At={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jo(){return{controller:new By,data:new Map,refCount:0}}function zr(e){e.refCount--,e.refCount===0&&Hy(Uy,function(){e.controller.abort()})}var Dr=null,Po=0,Ua=0,Ia=null;function Iy(e,t){if(Dr===null){var l=Dr=[];Po=0,Ua=nu(),Ia={status:"pending",value:void 0,then:function(r){l.push(r)}}}return Po++,t.then(Nf,Nf),t}function Nf(){if(--Po===0&&Dr!==null){Ia!==null&&(Ia.status="fulfilled");var e=Dr;Dr=null,Ua=0,Ia=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Vy(e,t){var l=[],r={status:"pending",value:null,reason:null,then:function(o){l.push(o)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var o=0;o<l.length;o++)(0,l[o])(t)},function(o){for(r.status="rejected",r.reason=o,o=0;o<l.length;o++)(0,l[o])(void 0)}),r}var wf=C.S;C.S=function(e,t){om=et(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Iy(e,t),wf!==null&&wf(e,t)};var sa=R(null);function ec(){var e=sa.current;return e!==null?e:ct.pooledCache}function Qs(e,t){t===null?re(sa,sa.current):re(sa,t.pool)}function Cf(){var e=ec();return e===null?null:{parent:At._currentValue,pool:e}}var Va=Error(c(460)),tc=Error(c(474)),Xs=Error(c(542)),Ws={then:function(){}};function Ef(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Tf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Pn,Pn),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Af(e),e;default:if(typeof t.status=="string")t.then(Pn,Pn);else{if(e=ct,e!==null&&100<e.shellSuspendCounter)throw Error(c(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=r}},function(r){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Af(e),e}throw oa=t,Va}}function ia(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(oa=l,Va):l}}var oa=null;function Rf(){if(oa===null)throw Error(c(459));var e=oa;return oa=null,e}function Af(e){if(e===Va||e===Xs)throw Error(c(483))}var Ga=null,Lr=0;function Zs(e){var t=Lr;return Lr+=1,Ga===null&&(Ga=[]),Tf(Ga,e,t)}function _r(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Fs(e,t){throw t.$$typeof===j?Error(c(525)):(e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Mf(e){function t(G,U){if(e){var q=G.deletions;q===null?(G.deletions=[U],G.flags|=16):q.push(U)}}function l(G,U){if(!e)return null;for(;U!==null;)t(G,U),U=U.sibling;return null}function r(G){for(var U=new Map;G!==null;)G.key!==null?U.set(G.key,G):U.set(G.index,G),G=G.sibling;return U}function o(G,U){return G=tl(G,U),G.index=0,G.sibling=null,G}function u(G,U,q){return G.index=q,e?(q=G.alternate,q!==null?(q=q.index,q<U?(G.flags|=67108866,U):q):(G.flags|=67108866,U)):(G.flags|=1048576,U)}function v(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function S(G,U,q,te){return U===null||U.tag!==6?(U=$o(q,G.mode,te),U.return=G,U):(U=o(U,q),U.return=G,U)}function _(G,U,q,te){var Ce=q.type;return Ce===z?P(G,U,q.props.children,te,q.key):U!==null&&(U.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&ia(Ce)===U.type)?(U=o(U,q.props),_r(U,q),U.return=G,U):(U=$s(q.type,q.key,q.props,null,G.mode,te),_r(U,q),U.return=G,U)}function Y(G,U,q,te){return U===null||U.tag!==4||U.stateNode.containerInfo!==q.containerInfo||U.stateNode.implementation!==q.implementation?(U=qo(q,G.mode,te),U.return=G,U):(U=o(U,q.children||[]),U.return=G,U)}function P(G,U,q,te,Ce){return U===null||U.tag!==7?(U=na(q,G.mode,te,Ce),U.return=G,U):(U=o(U,q),U.return=G,U)}function le(G,U,q){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=$o(""+U,G.mode,q),U.return=G,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case k:return q=$s(U.type,U.key,U.props,null,G.mode,q),_r(q,U),q.return=G,q;case E:return U=qo(U,G.mode,q),U.return=G,U;case B:return U=ia(U),le(G,U,q)}if(D(U)||Z(U))return U=na(U,G.mode,q,null),U.return=G,U;if(typeof U.then=="function")return le(G,Zs(U),q);if(U.$$typeof===H)return le(G,Ks(G,U),q);Fs(G,U)}return null}function W(G,U,q,te){var Ce=U!==null?U.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Ce!==null?null:S(G,U,""+q,te);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case k:return q.key===Ce?_(G,U,q,te):null;case E:return q.key===Ce?Y(G,U,q,te):null;case B:return q=ia(q),W(G,U,q,te)}if(D(q)||Z(q))return Ce!==null?null:P(G,U,q,te,null);if(typeof q.then=="function")return W(G,U,Zs(q),te);if(q.$$typeof===H)return W(G,U,Ks(G,q),te);Fs(G,q)}return null}function F(G,U,q,te,Ce){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return G=G.get(q)||null,S(U,G,""+te,Ce);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case k:return G=G.get(te.key===null?q:te.key)||null,_(U,G,te,Ce);case E:return G=G.get(te.key===null?q:te.key)||null,Y(U,G,te,Ce);case B:return te=ia(te),F(G,U,q,te,Ce)}if(D(te)||Z(te))return G=G.get(q)||null,P(U,G,te,Ce,null);if(typeof te.then=="function")return F(G,U,q,Zs(te),Ce);if(te.$$typeof===H)return F(G,U,q,Ks(U,te),Ce);Fs(U,te)}return null}function ge(G,U,q,te){for(var Ce=null,We=null,je=U,Be=U=0,Ye=null;je!==null&&Be<q.length;Be++){je.index>Be?(Ye=je,je=null):Ye=je.sibling;var Ze=W(G,je,q[Be],te);if(Ze===null){je===null&&(je=Ye);break}e&&je&&Ze.alternate===null&&t(G,je),U=u(Ze,U,Be),We===null?Ce=Ze:We.sibling=Ze,We=Ze,je=Ye}if(Be===q.length)return l(G,je),Ke&&nl(G,Be),Ce;if(je===null){for(;Be<q.length;Be++)je=le(G,q[Be],te),je!==null&&(U=u(je,U,Be),We===null?Ce=je:We.sibling=je,We=je);return Ke&&nl(G,Be),Ce}for(je=r(je);Be<q.length;Be++)Ye=F(je,G,Be,q[Be],te),Ye!==null&&(e&&Ye.alternate!==null&&je.delete(Ye.key===null?Be:Ye.key),U=u(Ye,U,Be),We===null?Ce=Ye:We.sibling=Ye,We=Ye);return e&&je.forEach(function(Vl){return t(G,Vl)}),Ke&&nl(G,Be),Ce}function Ee(G,U,q,te){if(q==null)throw Error(c(151));for(var Ce=null,We=null,je=U,Be=U=0,Ye=null,Ze=q.next();je!==null&&!Ze.done;Be++,Ze=q.next()){je.index>Be?(Ye=je,je=null):Ye=je.sibling;var Vl=W(G,je,Ze.value,te);if(Vl===null){je===null&&(je=Ye);break}e&&je&&Vl.alternate===null&&t(G,je),U=u(Vl,U,Be),We===null?Ce=Vl:We.sibling=Vl,We=Vl,je=Ye}if(Ze.done)return l(G,je),Ke&&nl(G,Be),Ce;if(je===null){for(;!Ze.done;Be++,Ze=q.next())Ze=le(G,Ze.value,te),Ze!==null&&(U=u(Ze,U,Be),We===null?Ce=Ze:We.sibling=Ze,We=Ze);return Ke&&nl(G,Be),Ce}for(je=r(je);!Ze.done;Be++,Ze=q.next())Ze=F(je,G,Be,Ze.value,te),Ze!==null&&(e&&Ze.alternate!==null&&je.delete(Ze.key===null?Be:Ze.key),U=u(Ze,U,Be),We===null?Ce=Ze:We.sibling=Ze,We=Ze);return e&&je.forEach(function(Jg){return t(G,Jg)}),Ke&&nl(G,Be),Ce}function st(G,U,q,te){if(typeof q=="object"&&q!==null&&q.type===z&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case k:e:{for(var Ce=q.key;U!==null;){if(U.key===Ce){if(Ce=q.type,Ce===z){if(U.tag===7){l(G,U.sibling),te=o(U,q.props.children),te.return=G,G=te;break e}}else if(U.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===B&&ia(Ce)===U.type){l(G,U.sibling),te=o(U,q.props),_r(te,q),te.return=G,G=te;break e}l(G,U);break}else t(G,U);U=U.sibling}q.type===z?(te=na(q.props.children,G.mode,te,q.key),te.return=G,G=te):(te=$s(q.type,q.key,q.props,null,G.mode,te),_r(te,q),te.return=G,G=te)}return v(G);case E:e:{for(Ce=q.key;U!==null;){if(U.key===Ce)if(U.tag===4&&U.stateNode.containerInfo===q.containerInfo&&U.stateNode.implementation===q.implementation){l(G,U.sibling),te=o(U,q.children||[]),te.return=G,G=te;break e}else{l(G,U);break}else t(G,U);U=U.sibling}te=qo(q,G.mode,te),te.return=G,G=te}return v(G);case B:return q=ia(q),st(G,U,q,te)}if(D(q))return ge(G,U,q,te);if(Z(q)){if(Ce=Z(q),typeof Ce!="function")throw Error(c(150));return q=Ce.call(q),Ee(G,U,q,te)}if(typeof q.then=="function")return st(G,U,Zs(q),te);if(q.$$typeof===H)return st(G,U,Ks(G,q),te);Fs(G,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,U!==null&&U.tag===6?(l(G,U.sibling),te=o(U,q),te.return=G,G=te):(l(G,U),te=$o(q,G.mode,te),te.return=G,G=te),v(G)):l(G,U)}return function(G,U,q,te){try{Lr=0;var Ce=st(G,U,q,te);return Ga=null,Ce}catch(je){if(je===Va||je===Xs)throw je;var We=fn(29,je,null,G.mode);return We.lanes=te,We.return=G,We}finally{}}}var ca=Mf(!0),zf=Mf(!1),Nl=!1;function nc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lc(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 wl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Cl(e,t,l){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Je&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=Gs(e),hf(e,null,l),t}return Vs(e,r,t,l),Gs(e)}function Or(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,l|=r,t.lanes=l,Sd(e,l)}}function ac(e,t){var l=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,l===r)){var o=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var v={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?o=u=v:u=u.next=v,l=l.next}while(l!==null);u===null?o=u=t:u=u.next=t}else o=u=t;l={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:r.shared,callbacks:r.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var rc=!1;function Br(){if(rc){var e=Ia;if(e!==null)throw e}}function Hr(e,t,l,r){rc=!1;var o=e.updateQueue;Nl=!1;var u=o.firstBaseUpdate,v=o.lastBaseUpdate,S=o.shared.pending;if(S!==null){o.shared.pending=null;var _=S,Y=_.next;_.next=null,v===null?u=Y:v.next=Y,v=_;var P=e.alternate;P!==null&&(P=P.updateQueue,S=P.lastBaseUpdate,S!==v&&(S===null?P.firstBaseUpdate=Y:S.next=Y,P.lastBaseUpdate=_))}if(u!==null){var le=o.baseState;v=0,P=Y=_=null,S=u;do{var W=S.lane&-536870913,F=W!==S.lane;if(F?(qe&W)===W:(r&W)===W){W!==0&&W===Ua&&(rc=!0),P!==null&&(P=P.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var ge=e,Ee=S;W=t;var st=l;switch(Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){le=ge.call(st,le,W);break e}le=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,W=typeof ge=="function"?ge.call(st,le,W):ge,W==null)break e;le=g({},le,W);break e;case 2:Nl=!0}}W=S.callback,W!==null&&(e.flags|=64,F&&(e.flags|=8192),F=o.callbacks,F===null?o.callbacks=[W]:F.push(W))}else F={lane:W,tag:S.tag,payload:S.payload,callback:S.callback,next:null},P===null?(Y=P=F,_=le):P=P.next=F,v|=W;if(S=S.next,S===null){if(S=o.shared.pending,S===null)break;F=S,S=F.next,F.next=null,o.lastBaseUpdate=F,o.shared.pending=null}}while(!0);P===null&&(_=le),o.baseState=_,o.firstBaseUpdate=Y,o.lastBaseUpdate=P,u===null&&(o.shared.lanes=0),Ml|=v,e.lanes=v,e.memoizedState=le}}function Df(e,t){if(typeof e!="function")throw Error(c(191,e));e.call(t)}function Lf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Df(l[e],t)}var $a=R(null),Js=R(0);function _f(e,t){e=pl,re(Js,e),re($a,t),pl=e|t.baseLanes}function sc(){re(Js,pl),re($a,$a.current)}function ic(){pl=Js.current,X($a),X(Js)}var pn=R(null),Mn=null;function El(e){var t=e.alternate;re(Et,Et.current&1),re(pn,e),Mn===null&&(t===null||$a.current!==null||t.memoizedState!==null)&&(Mn=e)}function oc(e){re(Et,Et.current),re(pn,e),Mn===null&&(Mn=e)}function Of(e){e.tag===22?(re(Et,Et.current),re(pn,e),Mn===null&&(Mn=e)):Tl()}function Tl(){re(Et,Et.current),re(pn,pn.current)}function mn(e){X(pn),Mn===e&&(Mn=null),X(Et)}var Et=R(0);function Ps(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||mu(l)||hu(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 rl=0,_e=null,at=null,Mt=null,ei=!1,qa=!1,ua=!1,ti=0,Ur=0,Ya=null,Gy=0;function kt(){throw Error(c(321))}function cc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!dn(e[l],t[l]))return!1;return!0}function uc(e,t,l,r,o,u){return rl=u,_e=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,C.H=e===null||e.memoizedState===null?gp:wc,ua=!1,u=l(r,o),ua=!1,qa&&(u=Hf(t,l,r,o)),Bf(e),u}function Bf(e){C.H=Gr;var t=at!==null&&at.next!==null;if(rl=0,Mt=at=_e=null,ei=!1,Ur=0,Ya=null,t)throw Error(c(300));e===null||zt||(e=e.dependencies,e!==null&&Ys(e)&&(zt=!0))}function Hf(e,t,l,r){_e=e;var o=0;do{if(qa&&(Ya=null),Ur=0,qa=!1,25<=o)throw Error(c(301));if(o+=1,Mt=at=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}C.H=bp,u=t(l,r)}while(qa);return u}function $y(){var e=C.H,t=e.useState()[0];return t=typeof t.then=="function"?Ir(t):t,e=e.useState()[0],(at!==null?at.memoizedState:null)!==e&&(_e.flags|=1024),t}function dc(){var e=ti!==0;return ti=0,e}function fc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function pc(e){if(ei){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ei=!1}rl=0,Mt=at=_e=null,qa=!1,Ur=ti=0,Ya=null}function Pt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?_e.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(at===null){var e=_e.alternate;e=e!==null?e.memoizedState:null}else e=at.next;var t=Mt===null?_e.memoizedState:Mt.next;if(t!==null)Mt=t,at=e;else{if(e===null)throw _e.alternate===null?Error(c(467)):Error(c(310));at=e,e={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},Mt===null?_e.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function ni(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ir(e){var t=Ur;return Ur+=1,Ya===null&&(Ya=[]),e=Tf(Ya,e,t),t=_e,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,C.H=t===null||t.memoizedState===null?gp:wc),e}function li(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ir(e);if(e.$$typeof===H)return Yt(e)}throw Error(c(438,String(e)))}function mc(e){var t=null,l=_e.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var r=_e.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=ni(),_e.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),r=0;r<e;r++)l[r]=V;return t.index++,l}function sl(e,t){return typeof t=="function"?t(e):t}function ai(e){var t=Tt();return hc(t,at,e)}function hc(e,t,l){var r=e.queue;if(r===null)throw Error(c(311));r.lastRenderedReducer=l;var o=e.baseQueue,u=r.pending;if(u!==null){if(o!==null){var v=o.next;o.next=u.next,u.next=v}t.baseQueue=o=u,r.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var S=v=null,_=null,Y=t,P=!1;do{var le=Y.lane&-536870913;if(le!==Y.lane?(qe&le)===le:(rl&le)===le){var W=Y.revertLane;if(W===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),le===Ua&&(P=!0);else if((rl&W)===W){Y=Y.next,W===Ua&&(P=!0);continue}else le={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},_===null?(S=_=le,v=u):_=_.next=le,_e.lanes|=W,Ml|=W;le=Y.action,ua&&l(u,le),u=Y.hasEagerState?Y.eagerState:l(u,le)}else W={lane:le,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},_===null?(S=_=W,v=u):_=_.next=W,_e.lanes|=le,Ml|=le;Y=Y.next}while(Y!==null&&Y!==t);if(_===null?v=u:_.next=S,!dn(u,e.memoizedState)&&(zt=!0,P&&(l=Ia,l!==null)))throw l;e.memoizedState=u,e.baseState=v,e.baseQueue=_,r.lastRenderedState=u}return o===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function xc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(c(311));l.lastRenderedReducer=e;var r=l.dispatch,o=l.pending,u=t.memoizedState;if(o!==null){l.pending=null;var v=o=o.next;do u=e(u,v.action),v=v.next;while(v!==o);dn(u,t.memoizedState)||(zt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),l.lastRenderedState=u}return[u,r]}function Uf(e,t,l){var r=_e,o=Tt(),u=Ke;if(u){if(l===void 0)throw Error(c(407));l=l()}else l=t();var v=!dn((at||o).memoizedState,l);if(v&&(o.memoizedState=l,zt=!0),o=o.queue,gc(Gf.bind(null,r,o,e),[e]),o.getSnapshot!==t||v||Mt!==null&&Mt.memoizedState.tag&1){if(r.flags|=2048,Ka(9,{destroy:void 0},Vf.bind(null,r,o,l,t),null),ct===null)throw Error(c(349));u||(rl&127)!==0||If(r,t,l)}return l}function If(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=_e.updateQueue,t===null?(t=ni(),_e.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Vf(e,t,l,r){t.value=l,t.getSnapshot=r,$f(t)&&qf(e)}function Gf(e,t,l){return l(function(){$f(t)&&qf(e)})}function $f(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!dn(e,l)}catch{return!0}}function qf(e){var t=ta(e,2);t!==null&&un(t,e,2)}function vc(e){var t=Pt();if(typeof e=="function"){var l=e;if(e=l(),ua){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sl,lastRenderedState:e},t}function Yf(e,t,l,r){return e.baseState=l,hc(e,at,typeof r=="function"?r:sl)}function qy(e,t,l,r,o){if(ii(e))throw Error(c(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){u.listeners.push(v)}};C.T!==null?l(!0):u.isTransition=!1,r(u),l=t.pending,l===null?(u.next=t.pending=u,Kf(t,u)):(u.next=l.next,t.pending=l.next=u)}}function Kf(e,t){var l=t.action,r=t.payload,o=e.state;if(t.isTransition){var u=C.T,v={};C.T=v;try{var S=l(o,r),_=C.S;_!==null&&_(v,S),Qf(e,t,S)}catch(Y){yc(e,t,Y)}finally{u!==null&&v.types!==null&&(u.types=v.types),C.T=u}}else try{u=l(o,r),Qf(e,t,u)}catch(Y){yc(e,t,Y)}}function Qf(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(r){Xf(e,t,r)},function(r){return yc(e,t,r)}):Xf(e,t,l)}function Xf(e,t,l){t.status="fulfilled",t.value=l,Wf(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Kf(e,l)))}function yc(e,t,l){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=l,Wf(t),t=t.next;while(t!==r)}e.action=null}function Wf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zf(e,t){return t}function Ff(e,t){if(Ke){var l=ct.formState;if(l!==null){e:{var r=_e;if(Ke){if(dt){t:{for(var o=dt,u=An;o.nodeType!==8;){if(!u){o=null;break t}if(o=zn(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){dt=zn(o.nextSibling),r=o.data==="F!";break e}}Sl(r)}r=!1}r&&(t=l[0])}}return l=Pt(),l.memoizedState=l.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zf,lastRenderedState:t},l.queue=r,l=xp.bind(null,_e,r),r.dispatch=l,r=vc(!1),u=Nc.bind(null,_e,!1,r.queue),r=Pt(),o={state:t,dispatch:null,action:e,pending:null},r.queue=o,l=qy.bind(null,_e,o,u,l),o.dispatch=l,r.memoizedState=e,[t,l,!1]}function Jf(e){var t=Tt();return Pf(t,at,e)}function Pf(e,t,l){if(t=hc(e,t,Zf)[0],e=ai(sl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Ir(t)}catch(v){throw v===Va?Xs:v}else r=t;t=Tt();var o=t.queue,u=o.dispatch;return l!==t.memoizedState&&(_e.flags|=2048,Ka(9,{destroy:void 0},Yy.bind(null,o,l),null)),[r,u,e]}function Yy(e,t){e.action=t}function ep(e){var t=Tt(),l=at;if(l!==null)return Pf(t,l,e);Tt(),t=t.memoizedState,l=Tt();var r=l.queue.dispatch;return l.memoizedState=e,[t,r,!1]}function Ka(e,t,l,r){return e={tag:e,create:l,deps:r,inst:t,next:null},t=_e.updateQueue,t===null&&(t=ni(),_e.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(r=l.next,l.next=e,e.next=r,t.lastEffect=e),e}function tp(){return Tt().memoizedState}function ri(e,t,l,r){var o=Pt();_e.flags|=e,o.memoizedState=Ka(1|t,{destroy:void 0},l,r===void 0?null:r)}function si(e,t,l,r){var o=Tt();r=r===void 0?null:r;var u=o.memoizedState.inst;at!==null&&r!==null&&cc(r,at.memoizedState.deps)?o.memoizedState=Ka(t,u,l,r):(_e.flags|=e,o.memoizedState=Ka(1|t,u,l,r))}function np(e,t){ri(8390656,8,e,t)}function gc(e,t){si(2048,8,e,t)}function Ky(e){_e.flags|=4;var t=_e.updateQueue;if(t===null)t=ni(),_e.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function lp(e){var t=Tt().memoizedState;return Ky({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(c(440));return t.impl.apply(void 0,arguments)}}function ap(e,t){return si(4,2,e,t)}function rp(e,t){return si(4,4,e,t)}function sp(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 ip(e,t,l){l=l!=null?l.concat([e]):null,si(4,4,sp.bind(null,t,e),l)}function bc(){}function op(e,t){var l=Tt();t=t===void 0?null:t;var r=l.memoizedState;return t!==null&&cc(t,r[1])?r[0]:(l.memoizedState=[e,t],e)}function cp(e,t){var l=Tt();t=t===void 0?null:t;var r=l.memoizedState;if(t!==null&&cc(t,r[1]))return r[0];if(r=e(),ua){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[r,t],r}function jc(e,t,l){return l===void 0||(rl&1073741824)!==0&&(qe&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=um(),_e.lanes|=e,Ml|=e,l)}function up(e,t,l,r){return dn(l,t)?l:$a.current!==null?(e=jc(e,l,r),dn(e,t)||(zt=!0),e):(rl&42)===0||(rl&1073741824)!==0&&(qe&261930)===0?(zt=!0,e.memoizedState=l):(e=um(),_e.lanes|=e,Ml|=e,t)}function dp(e,t,l,r,o){var u=L.p;L.p=u!==0&&8>u?u:8;var v=C.T,S={};C.T=S,Nc(e,!1,t,l);try{var _=o(),Y=C.S;if(Y!==null&&Y(S,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var P=Vy(_,r);Vr(e,t,P,vn(e))}else Vr(e,t,r,vn(e))}catch(le){Vr(e,t,{then:function(){},status:"rejected",reason:le},vn())}finally{L.p=u,v!==null&&S.types!==null&&(v.types=S.types),C.T=v}}function Qy(){}function Sc(e,t,l,r){if(e.tag!==5)throw Error(c(476));var o=fp(e).queue;dp(e,o,t,ae,l===null?Qy:function(){return pp(e),l(r)})}function fp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sl,lastRenderedState:ae},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function pp(e){var t=fp(e);t.next===null&&(t=e.alternate.memoizedState),Vr(e,t.next.queue,{},vn())}function kc(){return Yt(as)}function mp(){return Tt().memoizedState}function hp(){return Tt().memoizedState}function Xy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=vn();e=wl(l);var r=Cl(t,e,l);r!==null&&(un(r,t,l),Or(r,t,l)),t={cache:Jo()},e.payload=t;return}t=t.return}}function Wy(e,t,l){var r=vn();l={lane:r,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ii(e)?vp(t,l):(l=Vo(e,t,l,r),l!==null&&(un(l,e,r),yp(l,t,r)))}function xp(e,t,l){var r=vn();Vr(e,t,l,r)}function Vr(e,t,l,r){var o={lane:r,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ii(e))vp(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var v=t.lastRenderedState,S=u(v,l);if(o.hasEagerState=!0,o.eagerState=S,dn(S,v))return Vs(e,t,o,0),ct===null&&Is(),!1}catch{}finally{}if(l=Vo(e,t,o,r),l!==null)return un(l,e,r),yp(l,t,r),!0}return!1}function Nc(e,t,l,r){if(r={lane:2,revertLane:nu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ii(e)){if(t)throw Error(c(479))}else t=Vo(e,l,r,2),t!==null&&un(t,e,2)}function ii(e){var t=e.alternate;return e===_e||t!==null&&t===_e}function vp(e,t){qa=ei=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function yp(e,t,l){if((l&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,l|=r,t.lanes=l,Sd(e,l)}}var Gr={readContext:Yt,use:li,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useLayoutEffect:kt,useInsertionEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useSyncExternalStore:kt,useId:kt,useHostTransitionStatus:kt,useFormState:kt,useActionState:kt,useOptimistic:kt,useMemoCache:kt,useCacheRefresh:kt};Gr.useEffectEvent=kt;var gp={readContext:Yt,use:li,useCallback:function(e,t){return Pt().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:np,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,ri(4194308,4,sp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return ri(4194308,4,e,t)},useInsertionEffect:function(e,t){ri(4,2,e,t)},useMemo:function(e,t){var l=Pt();t=t===void 0?null:t;var r=e();if(ua){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[r,t],r},useReducer:function(e,t,l){var r=Pt();if(l!==void 0){var o=l(t);if(ua){St(!0);try{l(t)}finally{St(!1)}}}else o=t;return r.memoizedState=r.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},r.queue=e,e=e.dispatch=Wy.bind(null,_e,e),[r.memoizedState,e]},useRef:function(e){var t=Pt();return e={current:e},t.memoizedState=e},useState:function(e){e=vc(e);var t=e.queue,l=xp.bind(null,_e,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:bc,useDeferredValue:function(e,t){var l=Pt();return jc(l,e,t)},useTransition:function(){var e=vc(!1);return e=dp.bind(null,_e,e.queue,!0,!1),Pt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var r=_e,o=Pt();if(Ke){if(l===void 0)throw Error(c(407));l=l()}else{if(l=t(),ct===null)throw Error(c(349));(qe&127)!==0||If(r,t,l)}o.memoizedState=l;var u={value:l,getSnapshot:t};return o.queue=u,np(Gf.bind(null,r,u,e),[e]),r.flags|=2048,Ka(9,{destroy:void 0},Vf.bind(null,r,u,l,t),null),l},useId:function(){var e=Pt(),t=ct.identifierPrefix;if(Ke){var l=qn,r=$n;l=(r&~(1<<32-bt(r)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ti++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Gy++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:kc,useFormState:Ff,useActionState:Ff,useOptimistic:function(e){var t=Pt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Nc.bind(null,_e,!0,l),l.dispatch=t,[e,t]},useMemoCache:mc,useCacheRefresh:function(){return Pt().memoizedState=Xy.bind(null,_e)},useEffectEvent:function(e){var t=Pt(),l={impl:e};return t.memoizedState=l,function(){if((Je&2)!==0)throw Error(c(440));return l.impl.apply(void 0,arguments)}}},wc={readContext:Yt,use:li,useCallback:op,useContext:Yt,useEffect:gc,useImperativeHandle:ip,useInsertionEffect:ap,useLayoutEffect:rp,useMemo:cp,useReducer:ai,useRef:tp,useState:function(){return ai(sl)},useDebugValue:bc,useDeferredValue:function(e,t){var l=Tt();return up(l,at.memoizedState,e,t)},useTransition:function(){var e=ai(sl)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ir(e),t]},useSyncExternalStore:Uf,useId:mp,useHostTransitionStatus:kc,useFormState:Jf,useActionState:Jf,useOptimistic:function(e,t){var l=Tt();return Yf(l,at,e,t)},useMemoCache:mc,useCacheRefresh:hp};wc.useEffectEvent=lp;var bp={readContext:Yt,use:li,useCallback:op,useContext:Yt,useEffect:gc,useImperativeHandle:ip,useInsertionEffect:ap,useLayoutEffect:rp,useMemo:cp,useReducer:xc,useRef:tp,useState:function(){return xc(sl)},useDebugValue:bc,useDeferredValue:function(e,t){var l=Tt();return at===null?jc(l,e,t):up(l,at.memoizedState,e,t)},useTransition:function(){var e=xc(sl)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Ir(e),t]},useSyncExternalStore:Uf,useId:mp,useHostTransitionStatus:kc,useFormState:ep,useActionState:ep,useOptimistic:function(e,t){var l=Tt();return at!==null?Yf(l,at,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:mc,useCacheRefresh:hp};bp.useEffectEvent=lp;function Cc(e,t,l,r){t=e.memoizedState,l=l(r,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Ec={enqueueSetState:function(e,t,l){e=e._reactInternals;var r=vn(),o=wl(r);o.payload=t,l!=null&&(o.callback=l),t=Cl(e,o,r),t!==null&&(un(t,e,r),Or(t,e,r))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var r=vn(),o=wl(r);o.tag=1,o.payload=t,l!=null&&(o.callback=l),t=Cl(e,o,r),t!==null&&(un(t,e,r),Or(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=vn(),r=wl(l);r.tag=2,t!=null&&(r.callback=t),t=Cl(e,r,l),t!==null&&(un(t,e,l),Or(t,e,l))}};function jp(e,t,l,r,o,u,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,u,v):t.prototype&&t.prototype.isPureReactComponent?!Tr(l,r)||!Tr(o,u):!0}function Sp(e,t,l,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,r),t.state!==e&&Ec.enqueueReplaceState(t,t.state,null)}function da(e,t){var l=t;if("ref"in t){l={};for(var r in t)r!=="ref"&&(l[r]=t[r])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var o in e)l[o]===void 0&&(l[o]=e[o])}return l}function kp(e){Us(e)}function Np(e){console.error(e)}function wp(e){Us(e)}function oi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Cp(e,t,l){try{var r=e.onCaughtError;r(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Tc(e,t,l){return l=wl(l),l.tag=3,l.payload={element:null},l.callback=function(){oi(e,t)},l}function Ep(e){return e=wl(e),e.tag=3,e}function Tp(e,t,l,r){var o=l.type.getDerivedStateFromError;if(typeof o=="function"){var u=r.value;e.payload=function(){return o(u)},e.callback=function(){Cp(t,l,r)}}var v=l.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){Cp(t,l,r),typeof o!="function"&&(zl===null?zl=new Set([this]):zl.add(this));var S=r.stack;this.componentDidCatch(r.value,{componentStack:S!==null?S:""})})}function Zy(e,t,l,r,o){if(l.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=l.alternate,t!==null&&Ha(t,l,o,!0),l=pn.current,l!==null){switch(l.tag){case 31:case 13:return Mn===null?bi():l.alternate===null&&Nt===0&&(Nt=3),l.flags&=-257,l.flags|=65536,l.lanes=o,r===Ws?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([r]):t.add(r),Pc(e,r,o)),!1;case 22:return l.flags|=65536,r===Ws?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([r]):l.add(r)),Pc(e,r,o)),!1}throw Error(c(435,l.tag))}return Pc(e,r,o),bi(),!1}if(Ke)return t=pn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==Qo&&(e=Error(c(422),{cause:r}),Mr(En(e,l)))):(r!==Qo&&(t=Error(c(423),{cause:r}),Mr(En(t,l))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=En(r,l),o=Tc(e.stateNode,r,o),ac(e,o),Nt!==4&&(Nt=2)),!1;var u=Error(c(520),{cause:r});if(u=En(u,l),Zr===null?Zr=[u]:Zr.push(u),Nt!==4&&(Nt=2),t===null)return!0;r=En(r,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=o&-o,l.lanes|=e,e=Tc(l.stateNode,r,e),ac(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"&&(zl===null||!zl.has(u))))return l.flags|=65536,o&=-o,l.lanes|=o,o=Ep(o),Tp(o,e,l,r),ac(l,o),!1}l=l.return}while(l!==null);return!1}var Rc=Error(c(461)),zt=!1;function Kt(e,t,l,r){t.child=e===null?zf(t,null,l,r):ca(t,e.child,l,r)}function Rp(e,t,l,r,o){l=l.render;var u=t.ref;if("ref"in r){var v={};for(var S in r)S!=="ref"&&(v[S]=r[S])}else v=r;return ra(t),r=uc(e,t,l,v,u,o),S=dc(),e!==null&&!zt?(fc(e,t,o),il(e,t,o)):(Ke&&S&&Yo(t),t.flags|=1,Kt(e,t,r,o),t.child)}function Ap(e,t,l,r,o){if(e===null){var u=l.type;return typeof u=="function"&&!Go(u)&&u.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=u,Mp(e,t,u,r,o)):(e=$s(l.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Bc(e,o)){var v=u.memoizedProps;if(l=l.compare,l=l!==null?l:Tr,l(v,r)&&e.ref===t.ref)return il(e,t,o)}return t.flags|=1,e=tl(u,r),e.ref=t.ref,e.return=t,t.child=e}function Mp(e,t,l,r,o){if(e!==null){var u=e.memoizedProps;if(Tr(u,r)&&e.ref===t.ref)if(zt=!1,t.pendingProps=r=u,Bc(e,o))(e.flags&131072)!==0&&(zt=!0);else return t.lanes=e.lanes,il(e,t,o)}return Ac(e,t,l,r,o)}function zp(e,t,l,r){var o=r.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|l:l,e!==null){for(r=t.child=e.child,o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~u}else r=0,t.child=null;return Dp(e,t,u,l,r)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Qs(t,u!==null?u.cachePool:null),u!==null?_f(t,u):sc(),Of(t);else return r=t.lanes=536870912,Dp(e,t,u!==null?u.baseLanes|l:l,l,r)}else u!==null?(Qs(t,u.cachePool),_f(t,u),Tl(),t.memoizedState=null):(e!==null&&Qs(t,null),sc(),Tl());return Kt(e,t,o,l),t.child}function $r(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Dp(e,t,l,r,o){var u=ec();return u=u===null?null:{parent:At._currentValue,pool:u},t.memoizedState={baseLanes:l,cachePool:u},e!==null&&Qs(t,null),sc(),Of(t),e!==null&&Ha(e,t,r,!0),t.childLanes=o,null}function ci(e,t){return t=di({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Lp(e,t,l){return ca(t,e.child,null,l),e=ci(t,t.pendingProps),e.flags|=2,mn(t),t.memoizedState=null,e}function Fy(e,t,l){var r=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ke){if(r.mode==="hidden")return e=ci(t,r),t.lanes=536870912,$r(null,e);if(oc(t),(e=dt)?(e=Km(e,An),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bl!==null?{id:$n,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=vf(e),l.return=t,t.child=l,qt=t,dt=null)):e=null,e===null)throw Sl(t);return t.lanes=536870912,null}return ci(t,r)}var u=e.memoizedState;if(u!==null){var v=u.dehydrated;if(oc(t),o)if(t.flags&256)t.flags&=-257,t=Lp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(c(558));else if(zt||Ha(e,t,l,!1),o=(l&e.childLanes)!==0,zt||o){if(r=ct,r!==null&&(v=kd(r,l),v!==0&&v!==u.retryLane))throw u.retryLane=v,ta(e,v),un(r,e,v),Rc;bi(),t=Lp(e,t,l)}else e=u.treeContext,dt=zn(v.nextSibling),qt=t,Ke=!0,jl=null,An=!1,e!==null&&bf(t,e),t=ci(t,r),t.flags|=4096;return t}return e=tl(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ui(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(c(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Ac(e,t,l,r,o){return ra(t),l=uc(e,t,l,r,void 0,o),r=dc(),e!==null&&!zt?(fc(e,t,o),il(e,t,o)):(Ke&&r&&Yo(t),t.flags|=1,Kt(e,t,l,o),t.child)}function _p(e,t,l,r,o,u){return ra(t),t.updateQueue=null,l=Hf(t,r,l,o),Bf(e),r=dc(),e!==null&&!zt?(fc(e,t,u),il(e,t,u)):(Ke&&r&&Yo(t),t.flags|=1,Kt(e,t,l,u),t.child)}function Op(e,t,l,r,o){if(ra(t),t.stateNode===null){var u=La,v=l.contextType;typeof v=="object"&&v!==null&&(u=Yt(v)),u=new l(r,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Ec,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=r,u.state=t.memoizedState,u.refs={},nc(t),v=l.contextType,u.context=typeof v=="object"&&v!==null?Yt(v):La,u.state=t.memoizedState,v=l.getDerivedStateFromProps,typeof v=="function"&&(Cc(t,l,v,r),u.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(v=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),v!==u.state&&Ec.enqueueReplaceState(u,u.state,null),Hr(t,r,u,o),Br(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){u=t.stateNode;var S=t.memoizedProps,_=da(l,S);u.props=_;var Y=u.context,P=l.contextType;v=La,typeof P=="object"&&P!==null&&(v=Yt(P));var le=l.getDerivedStateFromProps;P=typeof le=="function"||typeof u.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,P||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(S||Y!==v)&&Sp(t,u,r,v),Nl=!1;var W=t.memoizedState;u.state=W,Hr(t,r,u,o),Br(),Y=t.memoizedState,S||W!==Y||Nl?(typeof le=="function"&&(Cc(t,l,le,r),Y=t.memoizedState),(_=Nl||jp(t,l,_,r,W,Y,v))?(P||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=r,t.memoizedState=Y),u.props=r,u.state=Y,u.context=v,r=_):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{u=t.stateNode,lc(e,t),v=t.memoizedProps,P=da(l,v),u.props=P,le=t.pendingProps,W=u.context,Y=l.contextType,_=La,typeof Y=="object"&&Y!==null&&(_=Yt(Y)),S=l.getDerivedStateFromProps,(Y=typeof S=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v!==le||W!==_)&&Sp(t,u,r,_),Nl=!1,W=t.memoizedState,u.state=W,Hr(t,r,u,o),Br();var F=t.memoizedState;v!==le||W!==F||Nl||e!==null&&e.dependencies!==null&&Ys(e.dependencies)?(typeof S=="function"&&(Cc(t,l,S,r),F=t.memoizedState),(P=Nl||jp(t,l,P,r,W,F,_)||e!==null&&e.dependencies!==null&&Ys(e.dependencies))?(Y||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(r,F,_),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(r,F,_)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||v===e.memoizedProps&&W===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&W===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=F),u.props=r,u.state=F,u.context=_,r=P):(typeof u.componentDidUpdate!="function"||v===e.memoizedProps&&W===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&W===e.memoizedState||(t.flags|=1024),r=!1)}return u=r,ui(e,t),r=(t.flags&128)!==0,u||r?(u=t.stateNode,l=r&&typeof l.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&r?(t.child=ca(t,e.child,null,o),t.child=ca(t,null,l,o)):Kt(e,t,l,o),t.memoizedState=u.state,e=t.child):e=il(e,t,o),e}function Bp(e,t,l,r){return la(),t.flags|=256,Kt(e,t,l,r),t.child}var Mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zc(e){return{baseLanes:e,cachePool:Cf()}}function Dc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=xn),e}function Hp(e,t,l){var r=t.pendingProps,o=!1,u=(t.flags&128)!==0,v;if((v=u)||(v=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),v&&(o=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ke){if(o?El(t):Tl(),(e=dt)?(e=Km(e,An),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bl!==null?{id:$n,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=vf(e),l.return=t,t.child=l,qt=t,dt=null)):e=null,e===null)throw Sl(t);return hu(e)?t.lanes=32:t.lanes=536870912,null}var S=r.children;return r=r.fallback,o?(Tl(),o=t.mode,S=di({mode:"hidden",children:S},o),r=na(r,o,l,null),S.return=t,r.return=t,S.sibling=r,t.child=S,r=t.child,r.memoizedState=zc(l),r.childLanes=Dc(e,v,l),t.memoizedState=Mc,$r(null,r)):(El(t),Lc(t,S))}var _=e.memoizedState;if(_!==null&&(S=_.dehydrated,S!==null)){if(u)t.flags&256?(El(t),t.flags&=-257,t=_c(e,t,l)):t.memoizedState!==null?(Tl(),t.child=e.child,t.flags|=128,t=null):(Tl(),S=r.fallback,o=t.mode,r=di({mode:"visible",children:r.children},o),S=na(S,o,l,null),S.flags|=2,r.return=t,S.return=t,r.sibling=S,t.child=r,ca(t,e.child,null,l),r=t.child,r.memoizedState=zc(l),r.childLanes=Dc(e,v,l),t.memoizedState=Mc,t=$r(null,r));else if(El(t),hu(S)){if(v=S.nextSibling&&S.nextSibling.dataset,v)var Y=v.dgst;v=Y,r=Error(c(419)),r.stack="",r.digest=v,Mr({value:r,source:null,stack:null}),t=_c(e,t,l)}else if(zt||Ha(e,t,l,!1),v=(l&e.childLanes)!==0,zt||v){if(v=ct,v!==null&&(r=kd(v,l),r!==0&&r!==_.retryLane))throw _.retryLane=r,ta(e,r),un(v,e,r),Rc;mu(S)||bi(),t=_c(e,t,l)}else mu(S)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,dt=zn(S.nextSibling),qt=t,Ke=!0,jl=null,An=!1,e!==null&&bf(t,e),t=Lc(t,r.children),t.flags|=4096);return t}return o?(Tl(),S=r.fallback,o=t.mode,_=e.child,Y=_.sibling,r=tl(_,{mode:"hidden",children:r.children}),r.subtreeFlags=_.subtreeFlags&65011712,Y!==null?S=tl(Y,S):(S=na(S,o,l,null),S.flags|=2),S.return=t,r.return=t,r.sibling=S,t.child=r,$r(null,r),r=t.child,S=e.child.memoizedState,S===null?S=zc(l):(o=S.cachePool,o!==null?(_=At._currentValue,o=o.parent!==_?{parent:_,pool:_}:o):o=Cf(),S={baseLanes:S.baseLanes|l,cachePool:o}),r.memoizedState=S,r.childLanes=Dc(e,v,l),t.memoizedState=Mc,$r(e.child,r)):(El(t),l=e.child,e=l.sibling,l=tl(l,{mode:"visible",children:r.children}),l.return=t,l.sibling=null,e!==null&&(v=t.deletions,v===null?(t.deletions=[e],t.flags|=16):v.push(e)),t.child=l,t.memoizedState=null,l)}function Lc(e,t){return t=di({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function di(e,t){return e=fn(22,e,null,t),e.lanes=0,e}function _c(e,t,l){return ca(t,e.child,null,l),e=Lc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Up(e,t,l){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zo(e.return,t,l)}function Oc(e,t,l,r,o,u){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:l,tailMode:o,treeForkCount:u}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=r,v.tail=l,v.tailMode=o,v.treeForkCount=u)}function Ip(e,t,l){var r=t.pendingProps,o=r.revealOrder,u=r.tail;r=r.children;var v=Et.current,S=(v&2)!==0;if(S?(v=v&1|2,t.flags|=128):v&=1,re(Et,v),Kt(e,t,r,l),r=Ke?Ar:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Up(e,l,t);else if(e.tag===19)Up(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(o){case"forwards":for(l=t.child,o=null;l!==null;)e=l.alternate,e!==null&&Ps(e)===null&&(o=l),l=l.sibling;l=o,l===null?(o=t.child,t.child=null):(o=l.sibling,l.sibling=null),Oc(t,!1,o,l,u,r);break;case"backwards":case"unstable_legacy-backwards":for(l=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Ps(e)===null){t.child=o;break}e=o.sibling,o.sibling=l,l=o,o=e}Oc(t,!0,l,null,u,r);break;case"together":Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function il(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Ml|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Ha(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,l=tl(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=tl(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Bc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ys(e)))}function Jy(e,t,l){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),kl(t,At,e.memoizedState.cache),la();break;case 27:case 5:Ve(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:kl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,oc(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(El(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Hp(e,t,l):(El(t),e=il(e,t,l),e!==null?e.sibling:null);El(t);break;case 19:var o=(e.flags&128)!==0;if(r=(l&t.childLanes)!==0,r||(Ha(e,t,l,!1),r=(l&t.childLanes)!==0),o){if(r)return Ip(e,t,l);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),re(Et,Et.current),r)break;return null;case 22:return t.lanes=0,zp(e,t,l,t.pendingProps);case 24:kl(t,At,e.memoizedState.cache)}return il(e,t,l)}function Vp(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)zt=!0;else{if(!Bc(e,l)&&(t.flags&128)===0)return zt=!1,Jy(e,t,l);zt=(e.flags&131072)!==0}else zt=!1,Ke&&(t.flags&1048576)!==0&&gf(t,Ar,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=ia(t.elementType),t.type=e,typeof e=="function")Go(e)?(r=da(e,r),t.tag=1,t=Op(null,t,e,r,l)):(t.tag=0,t=Ac(null,t,e,r,l));else{if(e!=null){var o=e.$$typeof;if(o===$){t.tag=11,t=Rp(null,t,e,r,l);break e}else if(o===w){t.tag=14,t=Ap(null,t,e,r,l);break e}}throw t=J(e)||e,Error(c(306,t,""))}}return t;case 0:return Ac(e,t,t.type,t.pendingProps,l);case 1:return r=t.type,o=da(r,t.pendingProps),Op(e,t,r,o,l);case 3:e:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(c(387));r=t.pendingProps;var u=t.memoizedState;o=u.element,lc(e,t),Hr(t,r,null,l);var v=t.memoizedState;if(r=v.cache,kl(t,At,r),r!==u.cache&&Fo(t,[At],l,!0),Br(),r=v.element,u.isDehydrated)if(u={element:r,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Bp(e,t,r,l);break e}else if(r!==o){o=En(Error(c(424)),t),Mr(o),t=Bp(e,t,r,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(dt=zn(e.firstChild),qt=t,Ke=!0,jl=null,An=!0,l=zf(t,null,r,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(la(),r===o){t=il(e,t,l);break e}Kt(e,t,r,l)}t=t.child}return t;case 26:return ui(e,t),e===null?(l=Jm(t.type,null,t.pendingProps,null))?t.memoizedState=l:Ke||(l=t.type,e=t.pendingProps,r=Ei(me.current).createElement(l),r[$t]=t,r[ln]=e,Qt(r,l,e),Ut(r),t.stateNode=r):t.memoizedState=Jm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ve(t),e===null&&Ke&&(r=t.stateNode=Wm(t.type,t.pendingProps,me.current),qt=t,An=!0,o=dt,Ol(t.type)?(xu=o,dt=zn(r.firstChild)):dt=o),Kt(e,t,t.pendingProps.children,l),ui(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ke&&((o=r=dt)&&(r=Tg(r,t.type,t.pendingProps,An),r!==null?(t.stateNode=r,qt=t,dt=zn(r.firstChild),An=!1,o=!0):o=!1),o||Sl(t)),Ve(t),o=t.type,u=t.pendingProps,v=e!==null?e.memoizedProps:null,r=u.children,du(o,u)?r=null:v!==null&&du(o,v)&&(t.flags|=32),t.memoizedState!==null&&(o=uc(e,t,$y,null,null,l),as._currentValue=o),ui(e,t),Kt(e,t,r,l),t.child;case 6:return e===null&&Ke&&((e=l=dt)&&(l=Rg(l,t.pendingProps,An),l!==null?(t.stateNode=l,qt=t,dt=null,e=!0):e=!1),e||Sl(t)),null;case 13:return Hp(e,t,l);case 4:return ie(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ca(t,null,r,l):Kt(e,t,r,l),t.child;case 11:return Rp(e,t,t.type,t.pendingProps,l);case 7:return Kt(e,t,t.pendingProps,l),t.child;case 8:return Kt(e,t,t.pendingProps.children,l),t.child;case 12:return Kt(e,t,t.pendingProps.children,l),t.child;case 10:return r=t.pendingProps,kl(t,t.type,r.value),Kt(e,t,r.children,l),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,ra(t),o=Yt(o),r=r(o),t.flags|=1,Kt(e,t,r,l),t.child;case 14:return Ap(e,t,t.type,t.pendingProps,l);case 15:return Mp(e,t,t.type,t.pendingProps,l);case 19:return Ip(e,t,l);case 31:return Fy(e,t,l);case 22:return zp(e,t,l,t.pendingProps);case 24:return ra(t),r=Yt(At),e===null?(o=ec(),o===null&&(o=ct,u=Jo(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=l),o=u),t.memoizedState={parent:r,cache:o},nc(t),kl(t,At,o)):((e.lanes&l)!==0&&(lc(e,t),Hr(t,null,null,l),Br()),o=e.memoizedState,u=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),kl(t,At,r)):(r=u.cache,kl(t,At,r),r!==o.cache&&Fo(t,[At],l,!0))),Kt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(c(156,t.tag))}function ol(e){e.flags|=4}function Hc(e,t,l,r,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(mm())e.flags|=8192;else throw oa=Ws,tc}else e.flags&=-16777217}function Gp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!lh(t))if(mm())e.flags|=8192;else throw oa=Ws,tc}function fi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?bd():536870912,e.lanes|=t,Za|=t)}function qr(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 r=null;l!==null;)l.alternate!==null&&(r=l),l=l.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ft(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,r=0;if(t)for(var o=e.child;o!==null;)l|=o.lanes|o.childLanes,r|=o.subtreeFlags&65011712,r|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)l|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=l,t}function Py(e,t,l){var r=t.pendingProps;switch(Ko(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ft(t),null;case 1:return ft(t),null;case 3:return l=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),al(At),be(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Ba(t)?ol(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Xo())),ft(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(ol(t),u!==null?(ft(t),Gp(t,u)):(ft(t),Hc(t,o,null,r,l))):u?u!==e.memoizedState?(ol(t),ft(t),Gp(t,u)):(ft(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&ol(t),ft(t),Hc(t,o,e,r,l)),null;case 27:if(Oe(t),l=me.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ol(t);else{if(!r){if(t.stateNode===null)throw Error(c(166));return ft(t),null}e=de.current,Ba(t)?jf(t):(e=Wm(o,r,l),t.stateNode=e,ol(t))}return ft(t),null;case 5:if(Oe(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ol(t);else{if(!r){if(t.stateNode===null)throw Error(c(166));return ft(t),null}if(u=de.current,Ba(t))jf(t);else{var v=Ei(me.current);switch(u){case 1:u=v.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=v.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=v.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=v.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=v.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof r.is=="string"?v.createElement("select",{is:r.is}):v.createElement("select"),r.multiple?u.multiple=!0:r.size&&(u.size=r.size);break;default:u=typeof r.is=="string"?v.createElement(o,{is:r.is}):v.createElement(o)}}u[$t]=t,u[ln]=r;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)u.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=u;e:switch(Qt(u,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ol(t)}}return ft(t),Hc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ol(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(c(166));if(e=me.current,Ba(t)){if(e=t.stateNode,l=t.memoizedProps,r=null,o=qt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[$t]=t,e=!!(e.nodeValue===l||r!==null&&r.suppressHydrationWarning===!0||Hm(e.nodeValue,l)),e||Sl(t,!0)}else e=Ei(e).createTextNode(r),e[$t]=t,t.stateNode=e}return ft(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ba(t),l!==null){if(e===null){if(!r)throw Error(c(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(557));e[$t]=t}else la(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),e=!1}else l=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(mn(t),t):(mn(t),null);if((t.flags&128)!==0)throw Error(c(558))}return ft(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Ba(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(c(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(c(317));o[$t]=t}else la(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ft(t),o=!1}else o=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(mn(t),t):(mn(t),null)}return mn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=r!==null,e=e!==null&&e.memoizedState!==null,l&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),u=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),u!==o&&(r.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),fi(t,t.updateQueue),ft(t),null);case 4:return be(),e===null&&su(t.stateNode.containerInfo),ft(t),null;case 10:return al(t.type),ft(t),null;case 19:if(X(Et),r=t.memoizedState,r===null)return ft(t),null;if(o=(t.flags&128)!==0,u=r.rendering,u===null)if(o)qr(r,!1);else{if(Nt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Ps(e),u!==null){for(t.flags|=128,qr(r,!1),e=u.updateQueue,t.updateQueue=e,fi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)xf(l,e),l=l.sibling;return re(Et,Et.current&1|2),Ke&&nl(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&et()>vi&&(t.flags|=128,o=!0,qr(r,!1),t.lanes=4194304)}else{if(!o)if(e=Ps(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,fi(t,e),qr(r,!0),r.tail===null&&r.tailMode==="hidden"&&!u.alternate&&!Ke)return ft(t),null}else 2*et()-r.renderingStartTime>vi&&l!==536870912&&(t.flags|=128,o=!0,qr(r,!1),t.lanes=4194304);r.isBackwards?(u.sibling=t.child,t.child=u):(e=r.last,e!==null?e.sibling=u:t.child=u,r.last=u)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=et(),e.sibling=null,l=Et.current,re(Et,o?l&1|2:l&1),Ke&&nl(t,r.treeForkCount),e):(ft(t),null);case 22:case 23:return mn(t),ic(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(l&536870912)!==0&&(t.flags&128)===0&&(ft(t),t.subtreeFlags&6&&(t.flags|=8192)):ft(t),l=t.updateQueue,l!==null&&fi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==l&&(t.flags|=2048),e!==null&&X(sa),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),al(At),ft(t),null;case 25:return null;case 30:return null}throw Error(c(156,t.tag))}function eg(e,t){switch(Ko(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return al(At),be(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Oe(t),null;case 31:if(t.memoizedState!==null){if(mn(t),t.alternate===null)throw Error(c(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(mn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));la()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(Et),null;case 4:return be(),null;case 10:return al(t.type),null;case 22:case 23:return mn(t),ic(),e!==null&&X(sa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return al(At),null;case 25:return null;default:return null}}function $p(e,t){switch(Ko(t),t.tag){case 3:al(At),be();break;case 26:case 27:case 5:Oe(t);break;case 4:be();break;case 31:t.memoizedState!==null&&mn(t);break;case 13:mn(t);break;case 19:X(Et);break;case 10:al(t.type);break;case 22:case 23:mn(t),ic(),e!==null&&X(sa);break;case 24:al(At)}}function Yr(e,t){try{var l=t.updateQueue,r=l!==null?l.lastEffect:null;if(r!==null){var o=r.next;l=o;do{if((l.tag&e)===e){r=void 0;var u=l.create,v=l.inst;r=u(),v.destroy=r}l=l.next}while(l!==o)}}catch(S){lt(t,t.return,S)}}function Rl(e,t,l){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var u=o.next;r=u;do{if((r.tag&e)===e){var v=r.inst,S=v.destroy;if(S!==void 0){v.destroy=void 0,o=t;var _=l,Y=S;try{Y()}catch(P){lt(o,_,P)}}}r=r.next}while(r!==u)}}catch(P){lt(t,t.return,P)}}function qp(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Lf(t,l)}catch(r){lt(e,e.return,r)}}}function Yp(e,t,l){l.props=da(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(r){lt(e,t,r)}}function Kr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof l=="function"?e.refCleanup=l(r):l.current=r}}catch(o){lt(e,t,o)}}function Yn(e,t){var l=e.ref,r=e.refCleanup;if(l!==null)if(typeof r=="function")try{r()}catch(o){lt(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(o){lt(e,t,o)}else l.current=null}function Kp(e){var t=e.type,l=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&r.focus();break e;case"img":l.src?r.src=l.src:l.srcSet&&(r.srcset=l.srcSet)}}catch(o){lt(e,e.return,o)}}function Uc(e,t,l){try{var r=e.stateNode;Sg(r,e.type,l,t),r[ln]=t}catch(o){lt(e,e.return,o)}}function Qp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ol(e.type)||e.tag===4}function Ic(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Qp(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&&Ol(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 Vc(e,t,l){var r=e.tag;if(r===5||r===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=Pn));else if(r!==4&&(r===27&&Ol(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Vc(e,t,l),e=e.sibling;e!==null;)Vc(e,t,l),e=e.sibling}function pi(e,t,l){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(r!==4&&(r===27&&Ol(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(pi(e,t,l),e=e.sibling;e!==null;)pi(e,t,l),e=e.sibling}function Xp(e){var t=e.stateNode,l=e.memoizedProps;try{for(var r=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Qt(t,r,l),t[$t]=e,t[ln]=l}catch(u){lt(e,e.return,u)}}var cl=!1,Dt=!1,Gc=!1,Wp=typeof WeakSet=="function"?WeakSet:Set,It=null;function tg(e,t){if(e=e.containerInfo,cu=Li,e=sf(e),_o(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var r=l.getSelection&&l.getSelection();if(r&&r.rangeCount!==0){l=r.anchorNode;var o=r.anchorOffset,u=r.focusNode;r=r.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break e}var v=0,S=-1,_=-1,Y=0,P=0,le=e,W=null;t:for(;;){for(var F;le!==l||o!==0&&le.nodeType!==3||(S=v+o),le!==u||r!==0&&le.nodeType!==3||(_=v+r),le.nodeType===3&&(v+=le.nodeValue.length),(F=le.firstChild)!==null;)W=le,le=F;for(;;){if(le===e)break t;if(W===l&&++Y===o&&(S=v),W===u&&++P===r&&(_=v),(F=le.nextSibling)!==null)break;le=W,W=le.parentNode}le=F}l=S===-1||_===-1?null:{start:S,end:_}}else l=null}l=l||{start:0,end:0}}else l=null;for(uu={focusedElem:e,selectionRange:l},Li=!1,It=t;It!==null;)if(t=It,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,It=e;else for(;It!==null;){switch(t=It,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++)o=e[l],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,l=t,o=u.memoizedProps,u=u.memoizedState,r=l.stateNode;try{var ge=da(l.type,o);e=r.getSnapshotBeforeUpdate(ge,u),r.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){lt(l,l.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)pu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":pu(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(c(163))}if(e=t.sibling,e!==null){e.return=t.return,It=e;break}It=t.return}}function Zp(e,t,l){var r=l.flags;switch(l.tag){case 0:case 11:case 15:dl(e,l),r&4&&Yr(5,l);break;case 1:if(dl(e,l),r&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(v){lt(l,l.return,v)}else{var o=da(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){lt(l,l.return,v)}}r&64&&qp(l),r&512&&Kr(l,l.return);break;case 3:if(dl(e,l),r&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{Lf(e,t)}catch(v){lt(l,l.return,v)}}break;case 27:t===null&&r&4&&Xp(l);case 26:case 5:dl(e,l),t===null&&r&4&&Kp(l),r&512&&Kr(l,l.return);break;case 12:dl(e,l);break;case 31:dl(e,l),r&4&&Pp(e,l);break;case 13:dl(e,l),r&4&&em(e,l),r&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=ug.bind(null,l),Ag(e,l))));break;case 22:if(r=l.memoizedState!==null||cl,!r){t=t!==null&&t.memoizedState!==null||Dt,o=cl;var u=Dt;cl=r,(Dt=t)&&!u?fl(e,l,(l.subtreeFlags&8772)!==0):dl(e,l),cl=o,Dt=u}break;case 30:break;default:dl(e,l)}}function Fp(e){var t=e.alternate;t!==null&&(e.alternate=null,Fp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&yo(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,rn=!1;function ul(e,t,l){for(l=l.child;l!==null;)Jp(e,t,l),l=l.sibling}function Jp(e,t,l){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Zn,l)}catch{}switch(l.tag){case 26:Dt||Yn(l,t),ul(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 r=vt,o=rn;Ol(l.type)&&(vt=l.stateNode,rn=!1),ul(e,t,l),ts(l.stateNode),vt=r,rn=o;break;case 5:Dt||Yn(l,t);case 6:if(r=vt,o=rn,vt=null,ul(e,t,l),vt=r,rn=o,vt!==null)if(rn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(u){lt(l,t,u)}else try{vt.removeChild(l.stateNode)}catch(u){lt(l,t,u)}break;case 18:vt!==null&&(rn?(e=vt,qm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),ar(e)):qm(vt,l.stateNode));break;case 4:r=vt,o=rn,vt=l.stateNode.containerInfo,rn=!0,ul(e,t,l),vt=r,rn=o;break;case 0:case 11:case 14:case 15:Rl(2,l,t),Dt||Rl(4,l,t),ul(e,t,l);break;case 1:Dt||(Yn(l,t),r=l.stateNode,typeof r.componentWillUnmount=="function"&&Yp(l,t,r)),ul(e,t,l);break;case 21:ul(e,t,l);break;case 22:Dt=(r=Dt)||l.memoizedState!==null,ul(e,t,l),Dt=r;break;default:ul(e,t,l)}}function Pp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ar(e)}catch(l){lt(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{ar(e)}catch(l){lt(t,t.return,l)}}function ng(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Wp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Wp),t;default:throw Error(c(435,e.tag))}}function mi(e,t){var l=ng(e);t.forEach(function(r){if(!l.has(r)){l.add(r);var o=dg.bind(null,e,r);r.then(o,o)}})}function sn(e,t){var l=t.deletions;if(l!==null)for(var r=0;r<l.length;r++){var o=l[r],u=e,v=t,S=v;e:for(;S!==null;){switch(S.tag){case 27:if(Ol(S.type)){vt=S.stateNode,rn=!1;break e}break;case 5:vt=S.stateNode,rn=!1;break e;case 3:case 4:vt=S.stateNode.containerInfo,rn=!0;break e}S=S.return}if(vt===null)throw Error(c(160));Jp(u,v,o),vt=null,rn=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)tm(t,e),t=t.sibling}var Un=null;function tm(e,t){var l=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sn(t,e),on(e),r&4&&(Rl(3,e,e.return),Yr(3,e),Rl(5,e,e.return));break;case 1:sn(t,e),on(e),r&512&&(Dt||l===null||Yn(l,l.return)),r&64&&cl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?r:l.concat(r))));break;case 26:var o=Un;if(sn(t,e),on(e),r&512&&(Dt||l===null||Yn(l,l.return)),r&4){var u=l!==null?l.memoizedState:null;if(r=e.memoizedState,l===null)if(r===null)if(e.stateNode===null){e:{r=e.type,l=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":u=o.getElementsByTagName("title")[0],(!u||u[gr]||u[$t]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(r),o.head.insertBefore(u,o.querySelector("head > title"))),Qt(u,r,l),u[$t]=e,Ut(u),r=u;break e;case"link":var v=th("link","href",o).get(r+(l.href||""));if(v){for(var S=0;S<v.length;S++)if(u=v[S],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)){v.splice(S,1);break t}}u=o.createElement(r),Qt(u,r,l),o.head.appendChild(u);break;case"meta":if(v=th("meta","content",o).get(r+(l.content||""))){for(S=0;S<v.length;S++)if(u=v[S],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)){v.splice(S,1);break t}}u=o.createElement(r),Qt(u,r,l),o.head.appendChild(u);break;default:throw Error(c(468,r))}u[$t]=e,Ut(u),r=u}e.stateNode=r}else nh(o,e.type,e.stateNode);else e.stateNode=eh(o,r,e.memoizedProps);else u!==r?(u===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):u.count--,r===null?nh(o,e.type,e.stateNode):eh(o,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Uc(e,e.memoizedProps,l.memoizedProps)}break;case 27:sn(t,e),on(e),r&512&&(Dt||l===null||Yn(l,l.return)),l!==null&&r&4&&Uc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(sn(t,e),on(e),r&512&&(Dt||l===null||Yn(l,l.return)),e.flags&32){o=e.stateNode;try{Ea(o,"")}catch(ge){lt(e,e.return,ge)}}r&4&&e.stateNode!=null&&(o=e.memoizedProps,Uc(e,o,l!==null?l.memoizedProps:o)),r&1024&&(Gc=!0);break;case 6:if(sn(t,e),on(e),r&4){if(e.stateNode===null)throw Error(c(162));r=e.memoizedProps,l=e.stateNode;try{l.nodeValue=r}catch(ge){lt(e,e.return,ge)}}break;case 3:if(Ai=null,o=Un,Un=Ti(t.containerInfo),sn(t,e),Un=o,on(e),r&4&&l!==null&&l.memoizedState.isDehydrated)try{ar(t.containerInfo)}catch(ge){lt(e,e.return,ge)}Gc&&(Gc=!1,nm(e));break;case 4:r=Un,Un=Ti(e.stateNode.containerInfo),sn(t,e),on(e),Un=r;break;case 12:sn(t,e),on(e);break;case 31:sn(t,e),on(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mi(e,r)));break;case 13:sn(t,e),on(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(xi=et()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mi(e,r)));break;case 22:o=e.memoizedState!==null;var _=l!==null&&l.memoizedState!==null,Y=cl,P=Dt;if(cl=Y||o,Dt=P||_,sn(t,e),Dt=P,cl=Y,on(e),r&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(l===null||_||cl||Dt||fa(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){_=l=t;try{if(u=_.stateNode,o)v=u.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{S=_.stateNode;var le=_.memoizedProps.style,W=le!=null&&le.hasOwnProperty("display")?le.display:null;S.style.display=W==null||typeof W=="boolean"?"":(""+W).trim()}}catch(ge){lt(_,_.return,ge)}}}else if(t.tag===6){if(l===null){_=t;try{_.stateNode.nodeValue=o?"":_.memoizedProps}catch(ge){lt(_,_.return,ge)}}}else if(t.tag===18){if(l===null){_=t;try{var F=_.stateNode;o?Ym(F,!0):Ym(_.stateNode,!1)}catch(ge){lt(_,_.return,ge)}}}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}r&4&&(r=e.updateQueue,r!==null&&(l=r.retryQueue,l!==null&&(r.retryQueue=null,mi(e,l))));break;case 19:sn(t,e),on(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,mi(e,r)));break;case 30:break;case 21:break;default:sn(t,e),on(e)}}function on(e){var t=e.flags;if(t&2){try{for(var l,r=e.return;r!==null;){if(Qp(r)){l=r;break}r=r.return}if(l==null)throw Error(c(160));switch(l.tag){case 27:var o=l.stateNode,u=Ic(e);pi(e,u,o);break;case 5:var v=l.stateNode;l.flags&32&&(Ea(v,""),l.flags&=-33);var S=Ic(e);pi(e,S,v);break;case 3:case 4:var _=l.stateNode.containerInfo,Y=Ic(e);Vc(e,Y,_);break;default:throw Error(c(161))}}catch(P){lt(e,e.return,P)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function nm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;nm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function dl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zp(e,t.alternate,t),t=t.sibling}function fa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rl(4,t,t.return),fa(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Yp(t,t.return,l),fa(t);break;case 27:ts(t.stateNode);case 26:case 5:Yn(t,t.return),fa(t);break;case 22:t.memoizedState===null&&fa(t);break;case 30:fa(t);break;default:fa(t)}e=e.sibling}}function fl(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,o=e,u=t,v=u.flags;switch(u.tag){case 0:case 11:case 15:fl(o,u,l),Yr(4,u);break;case 1:if(fl(o,u,l),r=u,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(Y){lt(r,r.return,Y)}if(r=u,o=r.updateQueue,o!==null){var S=r.stateNode;try{var _=o.shared.hiddenCallbacks;if(_!==null)for(o.shared.hiddenCallbacks=null,o=0;o<_.length;o++)Df(_[o],S)}catch(Y){lt(r,r.return,Y)}}l&&v&64&&qp(u),Kr(u,u.return);break;case 27:Xp(u);case 26:case 5:fl(o,u,l),l&&r===null&&v&4&&Kp(u),Kr(u,u.return);break;case 12:fl(o,u,l);break;case 31:fl(o,u,l),l&&v&4&&Pp(o,u);break;case 13:fl(o,u,l),l&&v&4&&em(o,u);break;case 22:u.memoizedState===null&&fl(o,u,l),Kr(u,u.return);break;case 30:break;default:fl(o,u,l)}t=t.sibling}}function $c(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&&zr(l))}function qc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zr(e))}function In(e,t,l,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)lm(e,t,l,r),t=t.sibling}function lm(e,t,l,r){var o=t.flags;switch(t.tag){case 0:case 11:case 15:In(e,t,l,r),o&2048&&Yr(9,t);break;case 1:In(e,t,l,r);break;case 3:In(e,t,l,r),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&zr(e)));break;case 12:if(o&2048){In(e,t,l,r),e=t.stateNode;try{var u=t.memoizedProps,v=u.id,S=u.onPostCommit;typeof S=="function"&&S(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){lt(t,t.return,_)}}else In(e,t,l,r);break;case 31:In(e,t,l,r);break;case 13:In(e,t,l,r);break;case 23:break;case 22:u=t.stateNode,v=t.alternate,t.memoizedState!==null?u._visibility&2?In(e,t,l,r):Qr(e,t):u._visibility&2?In(e,t,l,r):(u._visibility|=2,Qa(e,t,l,r,(t.subtreeFlags&10256)!==0||!1)),o&2048&&$c(v,t);break;case 24:In(e,t,l,r),o&2048&&qc(t.alternate,t);break;default:In(e,t,l,r)}}function Qa(e,t,l,r,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,v=t,S=l,_=r,Y=v.flags;switch(v.tag){case 0:case 11:case 15:Qa(u,v,S,_,o),Yr(8,v);break;case 23:break;case 22:var P=v.stateNode;v.memoizedState!==null?P._visibility&2?Qa(u,v,S,_,o):Qr(u,v):(P._visibility|=2,Qa(u,v,S,_,o)),o&&Y&2048&&$c(v.alternate,v);break;case 24:Qa(u,v,S,_,o),o&&Y&2048&&qc(v.alternate,v);break;default:Qa(u,v,S,_,o)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,r=t,o=r.flags;switch(r.tag){case 22:Qr(l,r),o&2048&&$c(r.alternate,r);break;case 24:Qr(l,r),o&2048&&qc(r.alternate,r);break;default:Qr(l,r)}t=t.sibling}}var Xr=8192;function Xa(e,t,l){if(e.subtreeFlags&Xr)for(e=e.child;e!==null;)am(e,t,l),e=e.sibling}function am(e,t,l){switch(e.tag){case 26:Xa(e,t,l),e.flags&Xr&&e.memoizedState!==null&&Gg(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Xa(e,t,l);break;case 3:case 4:var r=Un;Un=Ti(e.stateNode.containerInfo),Xa(e,t,l),Un=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Xr,Xr=16777216,Xa(e,t,l),Xr=r):Xa(e,t,l));break;default:Xa(e,t,l)}}function rm(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 Wr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var r=t[l];It=r,im(r,e)}rm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sm(e),e=e.sibling}function sm(e){switch(e.tag){case 0:case 11:case 15:Wr(e),e.flags&2048&&Rl(9,e,e.return);break;case 3:Wr(e);break;case 12:Wr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,hi(e)):Wr(e);break;default:Wr(e)}}function hi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var r=t[l];It=r,im(r,e)}rm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rl(8,t,t.return),hi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,hi(t));break;default:hi(t)}e=e.sibling}}function im(e,t){for(;It!==null;){var l=It;switch(l.tag){case 0:case 11:case 15:Rl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var r=l.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:zr(l.memoizedState.cache)}if(r=l.child,r!==null)r.return=l,It=r;else e:for(l=e;It!==null;){r=It;var o=r.sibling,u=r.return;if(Fp(r),r===l){It=null;break e}if(o!==null){o.return=u,It=o;break e}It=u}}}var lg={getCacheForType:function(e){var t=Yt(At),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Yt(At).controller.signal}},ag=typeof WeakMap=="function"?WeakMap:Map,Je=0,ct=null,Ge=null,qe=0,nt=0,hn=null,Al=!1,Wa=!1,Yc=!1,pl=0,Nt=0,Ml=0,pa=0,Kc=0,xn=0,Za=0,Zr=null,cn=null,Qc=!1,xi=0,om=0,vi=1/0,yi=null,zl=null,_t=0,Dl=null,Fa=null,ml=0,Xc=0,Wc=null,cm=null,Fr=0,Zc=null;function vn(){return(Je&2)!==0&&qe!==0?qe&-qe:C.T!==null?nu():Nd()}function um(){if(xn===0)if((qe&536870912)===0||Ke){var e=Ht;Ht<<=1,(Ht&3932160)===0&&(Ht=262144),xn=e}else xn=536870912;return e=pn.current,e!==null&&(e.flags|=32),xn}function un(e,t,l){(e===ct&&(nt===2||nt===9)||e.cancelPendingCommit!==null)&&(Ja(e,0),Ll(e,qe,xn,!1)),yr(e,l),((Je&2)===0||e!==ct)&&(e===ct&&((Je&2)===0&&(pa|=l),Nt===4&&Ll(e,qe,xn,!1)),Kn(e))}function dm(e,t,l){if((Je&6)!==0)throw Error(c(327));var r=!l&&(t&127)===0&&(t&e.expiredLanes)===0||kn(e,t),o=r?ig(e,t):Jc(e,t,!0),u=r;do{if(o===0){Wa&&!r&&Ll(e,t,0,!1);break}else{if(l=e.current.alternate,u&&!rg(l)){o=Jc(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){t=v;e:{var S=e;o=Zr;var _=S.current.memoizedState.isDehydrated;if(_&&(Ja(S,v).flags|=256),v=Jc(S,v,!1),v!==2){if(Yc&&!_){S.errorRecoveryDisabledLanes|=u,pa|=u,o=4;break e}u=cn,cn=o,u!==null&&(cn===null?cn=u:cn.push.apply(cn,u))}o=v}if(u=!1,o!==2)continue}}if(o===1){Ja(e,0),Ll(e,t,0,!0);break}e:{switch(r=e,u=o,u){case 0:case 1:throw Error(c(345));case 4:if((t&4194048)!==t)break;case 6:Ll(r,t,xn,!Al);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(c(329))}if((t&62914560)===t&&(o=xi+300-et(),10<o)){if(Ll(r,t,xn,!Al),vr(r,0,!0)!==0)break e;ml=t,r.timeoutHandle=Gm(fm.bind(null,r,l,cn,yi,Qc,t,xn,pa,Za,Al,u,"Throttled",-0,0),o);break e}fm(r,l,cn,yi,Qc,t,xn,pa,Za,Al,u,null,-0,0)}}break}while(!0);Kn(e)}function fm(e,t,l,r,o,u,v,S,_,Y,P,le,W,F){if(e.timeoutHandle=-1,le=t.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Pn},am(t,u,le);var ge=(u&62914560)===u?xi-et():(u&4194048)===u?om-et():0;if(ge=$g(le,ge),ge!==null){ml=u,e.cancelPendingCommit=ge(bm.bind(null,e,t,u,l,r,o,v,S,_,P,le,null,W,F)),Ll(e,u,v,!Y);return}}bm(e,t,u,l,r,o,v,S,_)}function rg(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 r=0;r<l.length;r++){var o=l[r],u=o.getSnapshot;o=o.value;try{if(!dn(u(),o))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 Ll(e,t,l,r){t&=~Kc,t&=~pa,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var o=t;0<o;){var u=31-bt(o),v=1<<u;r[u]=-1,o&=~v}l!==0&&jd(e,l,t)}function gi(){return(Je&6)===0?(Jr(0),!1):!0}function Fc(){if(Ge!==null){if(nt===0)var e=Ge.return;else e=Ge,ll=aa=null,pc(e),Ga=null,Lr=0,e=Ge;for(;e!==null;)$p(e.alternate,e),e=e.return;Ge=null}}function Ja(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,wg(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ml=0,Fc(),ct=e,Ge=l=tl(e.current,null),qe=t,nt=0,hn=null,Al=!1,Wa=kn(e,t),Yc=!1,Za=xn=Kc=pa=Ml=Nt=0,cn=Zr=null,Qc=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var o=31-bt(r),u=1<<o;t|=e[o],r&=~u}return pl=t,Is(),l}function pm(e,t){_e=null,C.H=Gr,t===Va||t===Xs?(t=Rf(),nt=3):t===tc?(t=Rf(),nt=4):nt=t===Rc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,hn=t,Ge===null&&(Nt=1,oi(e,En(t,e.current)))}function mm(){var e=pn.current;return e===null?!0:(qe&4194048)===qe?Mn===null:(qe&62914560)===qe||(qe&536870912)!==0?e===Mn:!1}function hm(){var e=C.H;return C.H=Gr,e===null?Gr:e}function xm(){var e=C.A;return C.A=lg,e}function bi(){Nt=4,Al||(qe&4194048)!==qe&&pn.current!==null||(Wa=!0),(Ml&134217727)===0&&(pa&134217727)===0||ct===null||Ll(ct,qe,xn,!1)}function Jc(e,t,l){var r=Je;Je|=2;var o=hm(),u=xm();(ct!==e||qe!==t)&&(yi=null,Ja(e,t)),t=!1;var v=Nt;e:do try{if(nt!==0&&Ge!==null){var S=Ge,_=hn;switch(nt){case 8:Fc(),v=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(t=!0);var Y=nt;if(nt=0,hn=null,Pa(e,S,_,Y),l&&Wa){v=0;break e}break;default:Y=nt,nt=0,hn=null,Pa(e,S,_,Y)}}sg(),v=Nt;break}catch(P){pm(e,P)}while(!0);return t&&e.shellSuspendCounter++,ll=aa=null,Je=r,C.H=o,C.A=u,Ge===null&&(ct=null,qe=0,Is()),v}function sg(){for(;Ge!==null;)vm(Ge)}function ig(e,t){var l=Je;Je|=2;var r=hm(),o=xm();ct!==e||qe!==t?(yi=null,vi=et()+500,Ja(e,t)):Wa=kn(e,t);e:do try{if(nt!==0&&Ge!==null){t=Ge;var u=hn;t:switch(nt){case 1:nt=0,hn=null,Pa(e,t,u,1);break;case 2:case 9:if(Ef(u)){nt=0,hn=null,ym(t);break}t=function(){nt!==2&&nt!==9||ct!==e||(nt=7),Kn(e)},u.then(t,t);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:Ef(u)?(nt=0,hn=null,ym(t)):(nt=0,hn=null,Pa(e,t,u,7));break;case 5:var v=null;switch(Ge.tag){case 26:v=Ge.memoizedState;case 5:case 27:var S=Ge;if(v?lh(v):S.stateNode.complete){nt=0,hn=null;var _=S.sibling;if(_!==null)Ge=_;else{var Y=S.return;Y!==null?(Ge=Y,ji(Y)):Ge=null}break t}}nt=0,hn=null,Pa(e,t,u,5);break;case 6:nt=0,hn=null,Pa(e,t,u,6);break;case 8:Fc(),Nt=6;break e;default:throw Error(c(462))}}og();break}catch(P){pm(e,P)}while(!0);return ll=aa=null,C.H=r,C.A=o,Je=l,Ge!==null?0:(ct=null,qe=0,Is(),Nt)}function og(){for(;Ge!==null&&!Vt();)vm(Ge)}function vm(e){var t=Vp(e.alternate,e,pl);e.memoizedProps=e.pendingProps,t===null?ji(e):Ge=t}function ym(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=_p(l,t,t.pendingProps,t.type,void 0,qe);break;case 11:t=_p(l,t,t.pendingProps,t.type.render,t.ref,qe);break;case 5:pc(t);default:$p(l,t),t=Ge=xf(t,pl),t=Vp(l,t,pl)}e.memoizedProps=e.pendingProps,t===null?ji(e):Ge=t}function Pa(e,t,l,r){ll=aa=null,pc(t),Ga=null,Lr=0;var o=t.return;try{if(Zy(e,o,t,l,qe)){Nt=1,oi(e,En(l,e.current)),Ge=null;return}}catch(u){if(o!==null)throw Ge=o,u;Nt=1,oi(e,En(l,e.current)),Ge=null;return}t.flags&32768?(Ke||r===1?e=!0:Wa||(qe&536870912)!==0?e=!1:(Al=e=!0,(r===2||r===9||r===3||r===6)&&(r=pn.current,r!==null&&r.tag===13&&(r.flags|=16384))),gm(t,e)):ji(t)}function ji(e){var t=e;do{if((t.flags&32768)!==0){gm(t,Al);return}e=t.return;var l=Py(t.alternate,t,pl);if(l!==null){Ge=l;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);Nt===0&&(Nt=5)}function gm(e,t){do{var l=eg(e.alternate,e);if(l!==null){l.flags&=32767,Ge=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=l}while(e!==null);Nt=6,Ge=null}function bm(e,t,l,r,o,u,v,S,_){e.cancelPendingCommit=null;do Si();while(_t!==0);if((Je&6)!==0)throw Error(c(327));if(t!==null){if(t===e.current)throw Error(c(177));if(u=t.lanes|t.childLanes,u|=Io,Vv(e,l,u,v,S,_),e===ct&&(Ge=ct=null,qe=0),Fa=t,Dl=e,ml=l,Xc=u,Wc=o,cm=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,fg(Me,function(){return wm(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=C.T,C.T=null,o=L.p,L.p=2,v=Je,Je|=4;try{tg(e,t,l)}finally{Je=v,L.p=o,C.T=r}}_t=1,jm(),Sm(),km()}}function jm(){if(_t===1){_t=0;var e=Dl,t=Fa,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=C.T,C.T=null;var r=L.p;L.p=2;var o=Je;Je|=4;try{tm(t,e);var u=uu,v=sf(e.containerInfo),S=u.focusedElem,_=u.selectionRange;if(v!==S&&S&&S.ownerDocument&&rf(S.ownerDocument.documentElement,S)){if(_!==null&&_o(S)){var Y=_.start,P=_.end;if(P===void 0&&(P=Y),"selectionStart"in S)S.selectionStart=Y,S.selectionEnd=Math.min(P,S.value.length);else{var le=S.ownerDocument||document,W=le&&le.defaultView||window;if(W.getSelection){var F=W.getSelection(),ge=S.textContent.length,Ee=Math.min(_.start,ge),st=_.end===void 0?Ee:Math.min(_.end,ge);!F.extend&&Ee>st&&(v=st,st=Ee,Ee=v);var G=af(S,Ee),U=af(S,st);if(G&&U&&(F.rangeCount!==1||F.anchorNode!==G.node||F.anchorOffset!==G.offset||F.focusNode!==U.node||F.focusOffset!==U.offset)){var q=le.createRange();q.setStart(G.node,G.offset),F.removeAllRanges(),Ee>st?(F.addRange(q),F.extend(U.node,U.offset)):(q.setEnd(U.node,U.offset),F.addRange(q))}}}}for(le=[],F=S;F=F.parentNode;)F.nodeType===1&&le.push({element:F,left:F.scrollLeft,top:F.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<le.length;S++){var te=le[S];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Li=!!cu,uu=cu=null}finally{Je=o,L.p=r,C.T=l}}e.current=t,_t=2}}function Sm(){if(_t===2){_t=0;var e=Dl,t=Fa,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=C.T,C.T=null;var r=L.p;L.p=2;var o=Je;Je|=4;try{Zp(e,t.alternate,t)}finally{Je=o,L.p=r,C.T=l}}_t=3}}function km(){if(_t===4||_t===3){_t=0,Gt();var e=Dl,t=Fa,l=ml,r=cm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Fa=Dl=null,Nm(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(zl=null),xo(l),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Zn,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=C.T,o=L.p,L.p=2,C.T=null;try{for(var u=e.onRecoverableError,v=0;v<r.length;v++){var S=r[v];u(S.value,{componentStack:S.stack})}}finally{C.T=t,L.p=o}}(ml&3)!==0&&Si(),Kn(e),o=e.pendingLanes,(l&261930)!==0&&(o&42)!==0?e===Zc?Fr++:(Fr=0,Zc=e):Fr=0,Jr(0)}}function Nm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,zr(t)))}function Si(){return jm(),Sm(),km(),wm()}function wm(){if(_t!==5)return!1;var e=Dl,t=Xc;Xc=0;var l=xo(ml),r=C.T,o=L.p;try{L.p=32>l?32:l,C.T=null,l=Wc,Wc=null;var u=Dl,v=ml;if(_t=0,Fa=Dl=null,ml=0,(Je&6)!==0)throw Error(c(331));var S=Je;if(Je|=4,sm(u.current),lm(u,u.current,v,l),Je=S,Jr(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Zn,u)}catch{}return!0}finally{L.p=o,C.T=r,Nm(e,t)}}function Cm(e,t,l){t=En(l,t),t=Tc(e.stateNode,t,2),e=Cl(e,t,2),e!==null&&(yr(e,2),Kn(e))}function lt(e,t,l){if(e.tag===3)Cm(e,e,l);else for(;t!==null;){if(t.tag===3){Cm(t,e,l);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(zl===null||!zl.has(r))){e=En(l,e),l=Ep(2),r=Cl(t,l,2),r!==null&&(Tp(l,r,t,e),yr(r,2),Kn(r));break}}t=t.return}}function Pc(e,t,l){var r=e.pingCache;if(r===null){r=e.pingCache=new ag;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(l)||(Yc=!0,o.add(l),e=cg.bind(null,e,t,l),t.then(e,e))}function cg(e,t,l){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ct===e&&(qe&l)===l&&(Nt===4||Nt===3&&(qe&62914560)===qe&&300>et()-xi?(Je&2)===0&&Ja(e,0):Kc|=l,Za===qe&&(Za=0)),Kn(e)}function Em(e,t){t===0&&(t=bd()),e=ta(e,t),e!==null&&(yr(e,t),Kn(e))}function ug(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Em(e,l)}function dg(e,t){var l=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(l=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(c(314))}r!==null&&r.delete(t),Em(e,l)}function fg(e,t){return Jt(e,t)}var ki=null,er=null,eu=!1,Ni=!1,tu=!1,_l=0;function Kn(e){e!==er&&e.next===null&&(er===null?ki=er=e:er=er.next=e),Ni=!0,eu||(eu=!0,mg())}function Jr(e,t){if(!tu&&Ni){tu=!0;do for(var l=!1,r=ki;r!==null;){if(e!==0){var o=r.pendingLanes;if(o===0)var u=0;else{var v=r.suspendedLanes,S=r.pingedLanes;u=(1<<31-bt(42|e)+1)-1,u&=o&~(v&~S),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,Mm(r,u))}else u=qe,u=vr(r,r===ct?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(u&3)===0||kn(r,u)||(l=!0,Mm(r,u));r=r.next}while(l);tu=!1}}function pg(){Tm()}function Tm(){Ni=eu=!1;var e=0;_l!==0&&Ng()&&(e=_l);for(var t=et(),l=null,r=ki;r!==null;){var o=r.next,u=Rm(r,t);u===0?(r.next=null,l===null?ki=o:l.next=o,o===null&&(er=l)):(l=r,(e!==0||(u&3)!==0)&&(Ni=!0)),r=o}_t!==0&&_t!==5||Jr(e),_l!==0&&(_l=0)}function Rm(e,t){for(var l=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var v=31-bt(u),S=1<<v,_=o[v];_===-1?((S&l)===0||(S&r)!==0)&&(o[v]=po(S,t)):_<=t&&(e.expiredLanes|=S),u&=~S}if(t=ct,l=qe,l=vr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,l===0||e===t&&(nt===2||nt===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ot(r),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||kn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(r!==null&&ot(r),xo(l)){case 2:case 8:l=Rt;break;case 32:l=Me;break;case 268435456:l=Xt;break;default:l=Me}return r=Am.bind(null,e),l=Jt(l,r),e.callbackPriority=t,e.callbackNode=l,t}return r!==null&&r!==null&&ot(r),e.callbackPriority=2,e.callbackNode=null,2}function Am(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Si()&&e.callbackNode!==l)return null;var r=qe;return r=vr(e,e===ct?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(dm(e,r,t),Rm(e,et()),e.callbackNode!=null&&e.callbackNode===l?Am.bind(null,e):null)}function Mm(e,t){if(Si())return null;dm(e,t,!0)}function mg(){Cg(function(){(Je&6)!==0?Jt(he,pg):Tm()})}function nu(){if(_l===0){var e=Ua;e===0&&(e=Ue,Ue<<=1,(Ue&261888)===0&&(Ue=256)),_l=e}return _l}function zm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:zs(""+e)}function Dm(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 hg(e,t,l,r,o){if(t==="submit"&&l&&l.stateNode===o){var u=zm((o[ln]||null).action),v=r.submitter;v&&(t=(t=v[ln]||null)?zm(t.formAction):v.getAttribute("formAction"),t!==null&&(u=t,v=null));var S=new Os("action","action",null,r,o);e.push({event:S,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(_l!==0){var _=v?Dm(o,v):new FormData(o);Sc(l,{pending:!0,data:_,method:o.method,action:u},null,_)}}else typeof u=="function"&&(S.preventDefault(),_=v?Dm(o,v):new FormData(o),Sc(l,{pending:!0,data:_,method:o.method,action:u},u,_))},currentTarget:o}]})}}for(var lu=0;lu<Uo.length;lu++){var au=Uo[lu],xg=au.toLowerCase(),vg=au[0].toUpperCase()+au.slice(1);Hn(xg,"on"+vg)}Hn(uf,"onAnimationEnd"),Hn(df,"onAnimationIteration"),Hn(ff,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(Dy,"onTransitionRun"),Hn(Ly,"onTransitionStart"),Hn(_y,"onTransitionCancel"),Hn(pf,"onTransitionEnd"),wa("onMouseEnter",["mouseout","mouseover"]),wa("onMouseLeave",["mouseout","mouseover"]),wa("onPointerEnter",["pointerout","pointerover"]),wa("onPointerLeave",["pointerout","pointerover"]),Fl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fl("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Pr="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(" "),yg=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Pr));function Lm(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var r=e[l],o=r.event;r=r.listeners;e:{var u=void 0;if(t)for(var v=r.length-1;0<=v;v--){var S=r[v],_=S.instance,Y=S.currentTarget;if(S=S.listener,_!==u&&o.isPropagationStopped())break e;u=S,o.currentTarget=Y;try{u(o)}catch(P){Us(P)}o.currentTarget=null,u=_}else for(v=0;v<r.length;v++){if(S=r[v],_=S.instance,Y=S.currentTarget,S=S.listener,_!==u&&o.isPropagationStopped())break e;u=S,o.currentTarget=Y;try{u(o)}catch(P){Us(P)}o.currentTarget=null,u=_}}}}function $e(e,t){var l=t[vo];l===void 0&&(l=t[vo]=new Set);var r=e+"__bubble";l.has(r)||(_m(t,e,2,!1),l.add(r))}function ru(e,t,l){var r=0;t&&(r|=4),_m(l,e,r,t)}var wi="_reactListening"+Math.random().toString(36).slice(2);function su(e){if(!e[wi]){e[wi]=!0,Ed.forEach(function(l){l!=="selectionchange"&&(yg.has(l)||ru(l,!1,e),ru(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wi]||(t[wi]=!0,ru("selectionchange",!1,t))}}function _m(e,t,l,r){switch(uh(t)){case 2:var o=Kg;break;case 8:o=Qg;break;default:o=ju}l=o.bind(null,t,l,e),o=void 0,!Co||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,l,{capture:!0,passive:o}):e.addEventListener(t,l,!0):o!==void 0?e.addEventListener(t,l,{passive:o}):e.addEventListener(t,l,!1)}function iu(e,t,l,r,o){var u=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var v=r.tag;if(v===3||v===4){var S=r.stateNode.containerInfo;if(S===o)break;if(v===4)for(v=r.return;v!==null;){var _=v.tag;if((_===3||_===4)&&v.stateNode.containerInfo===o)return;v=v.return}for(;S!==null;){if(v=Sa(S),v===null)return;if(_=v.tag,_===5||_===6||_===26||_===27){r=u=v;continue e}S=S.parentNode}}r=r.return}Ud(function(){var Y=u,P=No(l),le=[];e:{var W=mf.get(e);if(W!==void 0){var F=Os,ge=e;switch(e){case"keypress":if(Ls(l)===0)break e;case"keydown":case"keyup":F=dy;break;case"focusin":ge="focus",F=Ao;break;case"focusout":ge="blur",F=Ao;break;case"beforeblur":case"afterblur":F=Ao;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":F=Gd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":F=Pv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":F=my;break;case uf:case df:case ff:F=ny;break;case pf:F=xy;break;case"scroll":case"scrollend":F=Fv;break;case"wheel":F=yy;break;case"copy":case"cut":case"paste":F=ay;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":F=qd;break;case"toggle":case"beforetoggle":F=by}var Ee=(t&4)!==0,st=!Ee&&(e==="scroll"||e==="scrollend"),G=Ee?W!==null?W+"Capture":null:W;Ee=[];for(var U=Y,q;U!==null;){var te=U;if(q=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||q===null||G===null||(te=jr(U,G),te!=null&&Ee.push(es(U,te,q))),st)break;U=U.return}0<Ee.length&&(W=new F(W,ge,null,l,P),le.push({event:W,listeners:Ee}))}}if((t&7)===0){e:{if(W=e==="mouseover"||e==="pointerover",F=e==="mouseout"||e==="pointerout",W&&l!==ko&&(ge=l.relatedTarget||l.fromElement)&&(Sa(ge)||ge[ja]))break e;if((F||W)&&(W=P.window===P?P:(W=P.ownerDocument)?W.defaultView||W.parentWindow:window,F?(ge=l.relatedTarget||l.toElement,F=Y,ge=ge?Sa(ge):null,ge!==null&&(st=m(ge),Ee=ge.tag,ge!==st||Ee!==5&&Ee!==27&&Ee!==6)&&(ge=null)):(F=null,ge=Y),F!==ge)){if(Ee=Gd,te="onMouseLeave",G="onMouseEnter",U="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=qd,te="onPointerLeave",G="onPointerEnter",U="pointer"),st=F==null?W:br(F),q=ge==null?W:br(ge),W=new Ee(te,U+"leave",F,l,P),W.target=st,W.relatedTarget=q,te=null,Sa(P)===Y&&(Ee=new Ee(G,U+"enter",ge,l,P),Ee.target=q,Ee.relatedTarget=st,te=Ee),st=te,F&&ge)t:{for(Ee=gg,G=F,U=ge,q=0,te=G;te;te=Ee(te))q++;te=0;for(var Ce=U;Ce;Ce=Ee(Ce))te++;for(;0<q-te;)G=Ee(G),q--;for(;0<te-q;)U=Ee(U),te--;for(;q--;){if(G===U||U!==null&&G===U.alternate){Ee=G;break t}G=Ee(G),U=Ee(U)}Ee=null}else Ee=null;F!==null&&Om(le,W,F,Ee,!1),ge!==null&&st!==null&&Om(le,st,ge,Ee,!0)}}e:{if(W=Y?br(Y):window,F=W.nodeName&&W.nodeName.toLowerCase(),F==="select"||F==="input"&&W.type==="file")var We=Jd;else if(Zd(W))if(Pd)We=Ay;else{We=Ty;var je=Ey}else F=W.nodeName,!F||F.toLowerCase()!=="input"||W.type!=="checkbox"&&W.type!=="radio"?Y&&So(Y.elementType)&&(We=Jd):We=Ry;if(We&&(We=We(e,Y))){Fd(le,We,l,P);break e}je&&je(e,W,Y),e==="focusout"&&Y&&W.type==="number"&&Y.memoizedProps.value!=null&&jo(W,"number",W.value)}switch(je=Y?br(Y):window,e){case"focusin":(Zd(je)||je.contentEditable==="true")&&(Ma=je,Oo=Y,Rr=null);break;case"focusout":Rr=Oo=Ma=null;break;case"mousedown":Bo=!0;break;case"contextmenu":case"mouseup":case"dragend":Bo=!1,of(le,l,P);break;case"selectionchange":if(zy)break;case"keydown":case"keyup":of(le,l,P)}var Be;if(zo)e:{switch(e){case"compositionstart":var Ye="onCompositionStart";break e;case"compositionend":Ye="onCompositionEnd";break e;case"compositionupdate":Ye="onCompositionUpdate";break e}Ye=void 0}else Aa?Xd(e,l)&&(Ye="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ye="onCompositionStart");Ye&&(Yd&&l.locale!=="ko"&&(Aa||Ye!=="onCompositionStart"?Ye==="onCompositionEnd"&&Aa&&(Be=Id()):(gl=P,Eo="value"in gl?gl.value:gl.textContent,Aa=!0)),je=Ci(Y,Ye),0<je.length&&(Ye=new $d(Ye,e,null,l,P),le.push({event:Ye,listeners:je}),Be?Ye.data=Be:(Be=Wd(l),Be!==null&&(Ye.data=Be)))),(Be=Sy?ky(e,l):Ny(e,l))&&(Ye=Ci(Y,"onBeforeInput"),0<Ye.length&&(je=new $d("onBeforeInput","beforeinput",null,l,P),le.push({event:je,listeners:Ye}),je.data=Be)),hg(le,e,Y,l,P)}Lm(le,t)})}function es(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Ci(e,t){for(var l=t+"Capture",r=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=jr(e,l),o!=null&&r.unshift(es(e,o,u)),o=jr(e,t),o!=null&&r.push(es(e,o,u))),e.tag===3)return r;e=e.return}return[]}function gg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Om(e,t,l,r,o){for(var u=t._reactName,v=[];l!==null&&l!==r;){var S=l,_=S.alternate,Y=S.stateNode;if(S=S.tag,_!==null&&_===r)break;S!==5&&S!==26&&S!==27||Y===null||(_=Y,o?(Y=jr(l,u),Y!=null&&v.unshift(es(l,Y,_))):o||(Y=jr(l,u),Y!=null&&v.push(es(l,Y,_)))),l=l.return}v.length!==0&&e.push({event:t,listeners:v})}var bg=/\r\n?/g,jg=/\u0000|\uFFFD/g;function Bm(e){return(typeof e=="string"?e:""+e).replace(bg,`
50
- `).replace(jg,"")}function Hm(e,t){return t=Bm(t),Bm(e)===t}function rt(e,t,l,r,o,u){switch(l){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||Ea(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&Ea(e,""+r);break;case"className":As(e,"class",r);break;case"tabIndex":As(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":As(e,l,r);break;case"style":Bd(e,r,u);break;case"data":if(t!=="object"){As(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(l);break}r=zs(""+r),e.setAttribute(l,r);break;case"action":case"formAction":if(typeof r=="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"&&rt(e,t,"name",o.name,o,null),rt(e,t,"formEncType",o.formEncType,o,null),rt(e,t,"formMethod",o.formMethod,o,null),rt(e,t,"formTarget",o.formTarget,o,null)):(rt(e,t,"encType",o.encType,o,null),rt(e,t,"method",o.method,o,null),rt(e,t,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(l);break}r=zs(""+r),e.setAttribute(l,r);break;case"onClick":r!=null&&(e.onclick=Pn);break;case"onScroll":r!=null&&$e("scroll",e);break;case"onScrollEnd":r!=null&&$e("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(c(61));if(l=r.__html,l!=null){if(o.children!=null)throw Error(c(60));e.innerHTML=l}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}l=zs(""+r),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":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(l,""+r):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":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":r===!0?e.setAttribute(l,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(l,r):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(l,r):e.removeAttribute(l);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(l):e.setAttribute(l,r);break;case"popover":$e("beforetoggle",e),$e("toggle",e),Rs(e,"popover",r);break;case"xlinkActuate":Jn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Jn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Jn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Jn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Jn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Jn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Rs(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Wv.get(l)||l,Rs(e,l,r))}}function ou(e,t,l,r,o,u){switch(l){case"style":Bd(e,r,u);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(c(61));if(l=r.__html,l!=null){if(o.children!=null)throw Error(c(60));e.innerHTML=l}}break;case"children":typeof r=="string"?Ea(e,r):(typeof r=="number"||typeof r=="bigint")&&Ea(e,""+r);break;case"onScroll":r!=null&&$e("scroll",e);break;case"onScrollEnd":r!=null&&$e("scrollend",e);break;case"onClick":r!=null&&(e.onclick=Pn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Td.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(o=l.endsWith("Capture"),t=l.slice(2,o?l.length-7:void 0),u=e[ln]||null,u=u!=null?u[l]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof r=="function")){typeof u!="function"&&u!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,r,o);break e}l in e?e[l]=r:r===!0?e.setAttribute(l,""):Rs(e,l,r)}}}function Qt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$e("error",e),$e("load",e);var r=!1,o=!1,u;for(u in l)if(l.hasOwnProperty(u)){var v=l[u];if(v!=null)switch(u){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:rt(e,t,u,v,l,null)}}o&&rt(e,t,"srcSet",l.srcSet,l,null),r&&rt(e,t,"src",l.src,l,null);return;case"input":$e("invalid",e);var S=u=v=o=null,_=null,Y=null;for(r in l)if(l.hasOwnProperty(r)){var P=l[r];if(P!=null)switch(r){case"name":o=P;break;case"type":v=P;break;case"checked":_=P;break;case"defaultChecked":Y=P;break;case"value":u=P;break;case"defaultValue":S=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(c(137,t));break;default:rt(e,t,r,P,l,null)}}Dd(e,u,S,_,Y,v,o,!1);return;case"select":$e("invalid",e),r=v=u=null;for(o in l)if(l.hasOwnProperty(o)&&(S=l[o],S!=null))switch(o){case"value":u=S;break;case"defaultValue":v=S;break;case"multiple":r=S;default:rt(e,t,o,S,l,null)}t=u,l=v,e.multiple=!!r,t!=null?Ca(e,!!r,t,!1):l!=null&&Ca(e,!!r,l,!0);return;case"textarea":$e("invalid",e),u=o=r=null;for(v in l)if(l.hasOwnProperty(v)&&(S=l[v],S!=null))switch(v){case"value":r=S;break;case"defaultValue":o=S;break;case"children":u=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(c(91));break;default:rt(e,t,v,S,l,null)}_d(e,r,o,u);return;case"option":for(_ in l)if(l.hasOwnProperty(_)&&(r=l[_],r!=null))switch(_){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:rt(e,t,_,r,l,null)}return;case"dialog":$e("beforetoggle",e),$e("toggle",e),$e("cancel",e),$e("close",e);break;case"iframe":case"object":$e("load",e);break;case"video":case"audio":for(r=0;r<Pr.length;r++)$e(Pr[r],e);break;case"image":$e("error",e),$e("load",e);break;case"details":$e("toggle",e);break;case"embed":case"source":case"link":$e("error",e),$e("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(Y in l)if(l.hasOwnProperty(Y)&&(r=l[Y],r!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(c(137,t));default:rt(e,t,Y,r,l,null)}return;default:if(So(t)){for(P in l)l.hasOwnProperty(P)&&(r=l[P],r!==void 0&&ou(e,t,P,r,l,void 0));return}}for(S in l)l.hasOwnProperty(S)&&(r=l[S],r!=null&&rt(e,t,S,r,l,null))}function Sg(e,t,l,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,v=null,S=null,_=null,Y=null,P=null;for(F in l){var le=l[F];if(l.hasOwnProperty(F)&&le!=null)switch(F){case"checked":break;case"value":break;case"defaultValue":_=le;default:r.hasOwnProperty(F)||rt(e,t,F,null,r,le)}}for(var W in r){var F=r[W];if(le=l[W],r.hasOwnProperty(W)&&(F!=null||le!=null))switch(W){case"type":u=F;break;case"name":o=F;break;case"checked":Y=F;break;case"defaultChecked":P=F;break;case"value":v=F;break;case"defaultValue":S=F;break;case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(c(137,t));break;default:F!==le&&rt(e,t,W,F,r,le)}}bo(e,v,S,_,Y,P,u,o);return;case"select":F=v=S=W=null;for(u in l)if(_=l[u],l.hasOwnProperty(u)&&_!=null)switch(u){case"value":break;case"multiple":F=_;default:r.hasOwnProperty(u)||rt(e,t,u,null,r,_)}for(o in r)if(u=r[o],_=l[o],r.hasOwnProperty(o)&&(u!=null||_!=null))switch(o){case"value":W=u;break;case"defaultValue":S=u;break;case"multiple":v=u;default:u!==_&&rt(e,t,o,u,r,_)}t=S,l=v,r=F,W!=null?Ca(e,!!l,W,!1):!!r!=!!l&&(t!=null?Ca(e,!!l,t,!0):Ca(e,!!l,l?[]:"",!1));return;case"textarea":F=W=null;for(S in l)if(o=l[S],l.hasOwnProperty(S)&&o!=null&&!r.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:rt(e,t,S,null,r,o)}for(v in r)if(o=r[v],u=l[v],r.hasOwnProperty(v)&&(o!=null||u!=null))switch(v){case"value":W=o;break;case"defaultValue":F=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(c(91));break;default:o!==u&&rt(e,t,v,o,r,u)}Ld(e,W,F);return;case"option":for(var ge in l)if(W=l[ge],l.hasOwnProperty(ge)&&W!=null&&!r.hasOwnProperty(ge))switch(ge){case"selected":e.selected=!1;break;default:rt(e,t,ge,null,r,W)}for(_ in r)if(W=r[_],F=l[_],r.hasOwnProperty(_)&&W!==F&&(W!=null||F!=null))switch(_){case"selected":e.selected=W&&typeof W!="function"&&typeof W!="symbol";break;default:rt(e,t,_,W,r,F)}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 Ee in l)W=l[Ee],l.hasOwnProperty(Ee)&&W!=null&&!r.hasOwnProperty(Ee)&&rt(e,t,Ee,null,r,W);for(Y in r)if(W=r[Y],F=l[Y],r.hasOwnProperty(Y)&&W!==F&&(W!=null||F!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(c(137,t));break;default:rt(e,t,Y,W,r,F)}return;default:if(So(t)){for(var st in l)W=l[st],l.hasOwnProperty(st)&&W!==void 0&&!r.hasOwnProperty(st)&&ou(e,t,st,void 0,r,W);for(P in r)W=r[P],F=l[P],!r.hasOwnProperty(P)||W===F||W===void 0&&F===void 0||ou(e,t,P,W,r,F);return}}for(var G in l)W=l[G],l.hasOwnProperty(G)&&W!=null&&!r.hasOwnProperty(G)&&rt(e,t,G,null,r,W);for(le in r)W=r[le],F=l[le],!r.hasOwnProperty(le)||W===F||W==null&&F==null||rt(e,t,le,W,r,F)}function Um(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function kg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),r=0;r<l.length;r++){var o=l[r],u=o.transferSize,v=o.initiatorType,S=o.duration;if(u&&S&&Um(v)){for(v=0,S=o.responseEnd,r+=1;r<l.length;r++){var _=l[r],Y=_.startTime;if(Y>S)break;var P=_.transferSize,le=_.initiatorType;P&&Um(le)&&(_=_.responseEnd,v+=P*(_<S?1:(S-Y)/(_-Y)))}if(--r,t+=8*(u+v)/(o.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 cu=null,uu=null;function Ei(e){return e.nodeType===9?e:e.ownerDocument}function Im(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 Vm(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 du(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 fu=null;function Ng(){var e=window.event;return e&&e.type==="popstate"?e===fu?!1:(fu=e,!0):(fu=null,!1)}var Gm=typeof setTimeout=="function"?setTimeout:void 0,wg=typeof clearTimeout=="function"?clearTimeout:void 0,$m=typeof Promise=="function"?Promise:void 0,Cg=typeof queueMicrotask=="function"?queueMicrotask:typeof $m<"u"?function(e){return $m.resolve(null).then(e).catch(Eg)}:Gm;function Eg(e){setTimeout(function(){throw e})}function Ol(e){return e==="head"}function qm(e,t){var l=t,r=0;do{var o=l.nextSibling;if(e.removeChild(l),o&&o.nodeType===8)if(l=o.data,l==="/$"||l==="/&"){if(r===0){e.removeChild(o),ar(t);return}r--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")r++;else if(l==="html")ts(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ts(l);for(var u=l.firstChild;u;){var v=u.nextSibling,S=u.nodeName;u[gr]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&u.rel.toLowerCase()==="stylesheet"||l.removeChild(u),u=v}}else l==="body"&&ts(e.ownerDocument.body);l=o}while(l);ar(t)}function Ym(e,t){var l=e;e=0;do{var r=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||""),r&&r.nodeType===8)if(l=r.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=r}while(l)}function pu(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":pu(l),yo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Tg(e,t,l,r){for(;e.nodeType===1;){var o=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[gr])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!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=zn(e.nextSibling),e===null)break}return null}function Rg(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=zn(e.nextSibling),e===null))return null;return e}function Km(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=zn(e.nextSibling),e===null))return null;return e}function mu(e){return e.data==="$?"||e.data==="$~"}function hu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ag(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var r=function(){t(),l.removeEventListener("DOMContentLoaded",r)};l.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function zn(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 xu=null;function Qm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return zn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Xm(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 Wm(e,t,l){switch(t=Ei(l),e){case"html":if(e=t.documentElement,!e)throw Error(c(452));return e;case"head":if(e=t.head,!e)throw Error(c(453));return e;case"body":if(e=t.body,!e)throw Error(c(454));return e;default:throw Error(c(451))}}function ts(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);yo(e)}var Dn=new Map,Zm=new Set;function Ti(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var hl=L.d;L.d={f:Mg,r:zg,D:Dg,C:Lg,L:_g,m:Og,X:Hg,S:Bg,M:Ug};function Mg(){var e=hl.f(),t=gi();return e||t}function zg(e){var t=ka(e);t!==null&&t.tag===5&&t.type==="form"?pp(t):hl.r(e)}var tr=typeof document>"u"?null:document;function Fm(e,t,l){var r=tr;if(r&&typeof t=="string"&&t){var o=wn(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof l=="string"&&(o+='[crossorigin="'+l+'"]'),Zm.has(o)||(Zm.add(o),e={rel:e,crossOrigin:l,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),Qt(t,"link",e),Ut(t),r.head.appendChild(t)))}}function Dg(e){hl.D(e),Fm("dns-prefetch",e,null)}function Lg(e,t){hl.C(e,t),Fm("preconnect",e,t)}function _g(e,t,l){hl.L(e,t,l);var r=tr;if(r&&e&&t){var o='link[rel="preload"][as="'+wn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(o+='[imagesrcset="'+wn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(o+='[imagesizes="'+wn(l.imageSizes)+'"]')):o+='[href="'+wn(e)+'"]';var u=o;switch(t){case"style":u=nr(e);break;case"script":u=lr(e)}Dn.has(u)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Dn.set(u,e),r.querySelector(o)!==null||t==="style"&&r.querySelector(ns(u))||t==="script"&&r.querySelector(ls(u))||(t=r.createElement("link"),Qt(t,"link",e),Ut(t),r.head.appendChild(t)))}}function Og(e,t){hl.m(e,t);var l=tr;if(l&&e){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+wn(r)+'"][href="'+wn(e)+'"]',u=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=lr(e)}if(!Dn.has(u)&&(e=g({rel:"modulepreload",href:e},t),Dn.set(u,e),l.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ls(u)))return}r=l.createElement("link"),Qt(r,"link",e),Ut(r),l.head.appendChild(r)}}}function Bg(e,t,l){hl.S(e,t,l);var r=tr;if(r&&e){var o=Na(r).hoistableStyles,u=nr(e);t=t||"default";var v=o.get(u);if(!v){var S={loading:0,preload:null};if(v=r.querySelector(ns(u)))S.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Dn.get(u))&&vu(e,l);var _=v=r.createElement("link");Ut(_),Qt(_,"link",e),_._p=new Promise(function(Y,P){_.onload=Y,_.onerror=P}),_.addEventListener("load",function(){S.loading|=1}),_.addEventListener("error",function(){S.loading|=2}),S.loading|=4,Ri(v,t,r)}v={type:"stylesheet",instance:v,count:1,state:S},o.set(u,v)}}}function Hg(e,t){hl.X(e,t);var l=tr;if(l&&e){var r=Na(l).hoistableScripts,o=lr(e),u=r.get(o);u||(u=l.querySelector(ls(o)),u||(e=g({src:e,async:!0},t),(t=Dn.get(o))&&yu(e,t),u=l.createElement("script"),Ut(u),Qt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},r.set(o,u))}}function Ug(e,t){hl.M(e,t);var l=tr;if(l&&e){var r=Na(l).hoistableScripts,o=lr(e),u=r.get(o);u||(u=l.querySelector(ls(o)),u||(e=g({src:e,async:!0,type:"module"},t),(t=Dn.get(o))&&yu(e,t),u=l.createElement("script"),Ut(u),Qt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},r.set(o,u))}}function Jm(e,t,l,r){var o=(o=me.current)?Ti(o):null;if(!o)throw Error(c(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=nr(l.href),l=Na(o).hoistableStyles,r=l.get(t),r||(r={type:"style",instance:null,count:0,state:null},l.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=nr(l.href);var u=Na(o).hoistableStyles,v=u.get(e);if(v||(o=o.ownerDocument||o,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,v),(u=o.querySelector(ns(e)))&&!u._p&&(v.instance=u,v.state.loading=5),Dn.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},Dn.set(e,l),u||Ig(o,e,l,v.state))),t&&r===null)throw Error(c(528,""));return v}if(t&&r!==null)throw Error(c(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=lr(l),l=Na(o).hoistableScripts,r=l.get(t),r||(r={type:"script",instance:null,count:0,state:null},l.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(c(444,e))}}function nr(e){return'href="'+wn(e)+'"'}function ns(e){return'link[rel="stylesheet"]['+e+"]"}function Pm(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function Ig(e,t,l,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),Qt(t,"link",l),Ut(t),e.head.appendChild(t))}function lr(e){return'[src="'+wn(e)+'"]'}function ls(e){return"script[async]"+e}function eh(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+wn(l.href)+'"]');if(r)return t.instance=r,Ut(r),r;var o=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Ut(r),Qt(r,"style",o),Ri(r,l.precedence,e),t.instance=r;case"stylesheet":o=nr(l.href);var u=e.querySelector(ns(o));if(u)return t.state.loading|=4,t.instance=u,Ut(u),u;r=Pm(l),(o=Dn.get(o))&&vu(r,o),u=(e.ownerDocument||e).createElement("link"),Ut(u);var v=u;return v._p=new Promise(function(S,_){v.onload=S,v.onerror=_}),Qt(u,"link",r),t.state.loading|=4,Ri(u,l.precedence,e),t.instance=u;case"script":return u=lr(l.src),(o=e.querySelector(ls(u)))?(t.instance=o,Ut(o),o):(r=l,(o=Dn.get(u))&&(r=g({},l),yu(r,o)),e=e.ownerDocument||e,o=e.createElement("script"),Ut(o),Qt(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(c(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Ri(r,l.precedence,e));return t.instance}function Ri(e,t,l){for(var r=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,u=o,v=0;v<r.length;v++){var S=r[v];if(S.dataset.precedence===t)u=S;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function vu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function yu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ai=null;function th(e,t,l){if(Ai===null){var r=new Map,o=Ai=new Map;o.set(l,r)}else o=Ai,r=o.get(l),r||(r=new Map,o.set(l,r));if(r.has(e))return r;for(r.set(e,null),l=l.getElementsByTagName(e),o=0;o<l.length;o++){var u=l[o];if(!(u[gr]||u[$t]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var v=u.getAttribute(t)||"";v=e+v;var S=r.get(v);S?S.push(u):r.set(v,[u])}}return r}function nh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function Vg(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 lh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Gg(e,t,l,r){if(l.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var o=nr(r.href),u=t.querySelector(ns(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Mi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,Ut(u);return}u=t.ownerDocument||t,r=Pm(r),(o=Dn.get(o))&&vu(r,o),u=u.createElement("link"),Ut(u);var v=u;v._p=new Promise(function(S,_){v.onload=S,v.onerror=_}),Qt(u,"link",r),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=Mi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var gu=0;function $g(e,t){return e.stylesheets&&e.count===0&&Di(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var r=setTimeout(function(){if(e.stylesheets&&Di(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&gu===0&&(gu=62500*kg());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Di(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>gu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function Mi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Di(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zi=null;function Di(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zi=new Map,t.forEach(qg,e),zi=null,Mi.call(e))}function qg(e,t){if(!(t.state.loading&4)){var l=zi.get(e);if(l)var r=l.get(null);else{l=new Map,zi.set(e,l);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var v=o[u];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(l.set(v.dataset.precedence,v),r=v)}r&&l.set(null,r)}o=t.instance,v=o.getAttribute("data-precedence"),u=l.get(v)||r,u===r&&l.set(null,o),l.set(v,o),this.count++,r=Mi.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var as={$$typeof:H,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function Yg(e,t,l,r,o,u,v,S,_){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=mo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mo(0),this.hiddenUpdates=mo(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function ah(e,t,l,r,o,u,v,S,_,Y,P,le){return e=new Yg(e,t,l,v,_,Y,P,le,S),t=1,u===!0&&(t|=24),u=fn(3,null,null,t),e.current=u,u.stateNode=e,t=Jo(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:r,isDehydrated:l,cache:t},nc(u),e}function rh(e){return e?(e=La,e):La}function sh(e,t,l,r,o,u){o=rh(o),r.context===null?r.context=o:r.pendingContext=o,r=wl(t),r.payload={element:l},u=u===void 0?null:u,u!==null&&(r.callback=u),l=Cl(e,r,t),l!==null&&(un(l,e,t),Or(l,e,t))}function ih(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function bu(e,t){ih(e,t),(e=e.alternate)&&ih(e,t)}function oh(e){if(e.tag===13||e.tag===31){var t=ta(e,67108864);t!==null&&un(t,e,67108864),bu(e,67108864)}}function ch(e){if(e.tag===13||e.tag===31){var t=vn();t=ho(t);var l=ta(e,t);l!==null&&un(l,e,t),bu(e,t)}}var Li=!0;function Kg(e,t,l,r){var o=C.T;C.T=null;var u=L.p;try{L.p=2,ju(e,t,l,r)}finally{L.p=u,C.T=o}}function Qg(e,t,l,r){var o=C.T;C.T=null;var u=L.p;try{L.p=8,ju(e,t,l,r)}finally{L.p=u,C.T=o}}function ju(e,t,l,r){if(Li){var o=Su(r);if(o===null)iu(e,t,r,_i,l),dh(e,r);else if(Wg(o,e,t,l,r))r.stopPropagation();else if(dh(e,r),t&4&&-1<Xg.indexOf(e)){for(;o!==null;){var u=ka(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var v=Ct(u.pendingLanes);if(v!==0){var S=u;for(S.pendingLanes|=2,S.entangledLanes|=2;v;){var _=1<<31-bt(v);S.entanglements[1]|=_,v&=~_}Kn(u),(Je&6)===0&&(vi=et()+500,Jr(0))}}break;case 31:case 13:S=ta(u,2),S!==null&&un(S,u,2),gi(),bu(u,2)}if(u=Su(r),u===null&&iu(e,t,r,_i,l),u===o)break;o=u}o!==null&&r.stopPropagation()}else iu(e,t,r,null,l)}}function Su(e){return e=No(e),ku(e)}var _i=null;function ku(e){if(_i=null,e=Sa(e),e!==null){var t=m(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=p(t),e!==null)return e;e=null}else if(l===31){if(e=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 _i=e,null}function uh(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(jt()){case he:return 2;case Rt:return 8;case Me:case xt:return 32;case Xt:return 268435456;default:return 32}default:return 32}}var Nu=!1,Bl=null,Hl=null,Ul=null,rs=new Map,ss=new Map,Il=[],Xg="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 dh(e,t){switch(e){case"focusin":case"focusout":Bl=null;break;case"dragenter":case"dragleave":Hl=null;break;case"mouseover":case"mouseout":Ul=null;break;case"pointerover":case"pointerout":rs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ss.delete(t.pointerId)}}function is(e,t,l,r,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:l,eventSystemFlags:r,nativeEvent:u,targetContainers:[o]},t!==null&&(t=ka(t),t!==null&&oh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Wg(e,t,l,r,o){switch(t){case"focusin":return Bl=is(Bl,e,t,l,r,o),!0;case"dragenter":return Hl=is(Hl,e,t,l,r,o),!0;case"mouseover":return Ul=is(Ul,e,t,l,r,o),!0;case"pointerover":var u=o.pointerId;return rs.set(u,is(rs.get(u)||null,e,t,l,r,o)),!0;case"gotpointercapture":return u=o.pointerId,ss.set(u,is(ss.get(u)||null,e,t,l,r,o)),!0}return!1}function fh(e){var t=Sa(e.target);if(t!==null){var l=m(t);if(l!==null){if(t=l.tag,t===13){if(t=p(l),t!==null){e.blockedOn=t,wd(e.priority,function(){ch(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,wd(e.priority,function(){ch(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 Oi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Su(e.nativeEvent);if(l===null){l=e.nativeEvent;var r=new l.constructor(l.type,l);ko=r,l.target.dispatchEvent(r),ko=null}else return t=ka(l),t!==null&&oh(t),e.blockedOn=l,!1;t.shift()}return!0}function ph(e,t,l){Oi(e)&&l.delete(t)}function Zg(){Nu=!1,Bl!==null&&Oi(Bl)&&(Bl=null),Hl!==null&&Oi(Hl)&&(Hl=null),Ul!==null&&Oi(Ul)&&(Ul=null),rs.forEach(ph),ss.forEach(ph)}function Bi(e,t){e.blockedOn===t&&(e.blockedOn=null,Nu||(Nu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Zg)))}var Hi=null;function mh(e){Hi!==e&&(Hi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Hi===e&&(Hi=null);for(var t=0;t<e.length;t+=3){var l=e[t],r=e[t+1],o=e[t+2];if(typeof r!="function"){if(ku(r||l)===null)continue;break}var u=ka(l);u!==null&&(e.splice(t,3),t-=3,Sc(u,{pending:!0,data:o,method:l.method,action:r},r,o))}}))}function ar(e){function t(_){return Bi(_,e)}Bl!==null&&Bi(Bl,e),Hl!==null&&Bi(Hl,e),Ul!==null&&Bi(Ul,e),rs.forEach(t),ss.forEach(t);for(var l=0;l<Il.length;l++){var r=Il[l];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Il.length&&(l=Il[0],l.blockedOn===null);)fh(l),l.blockedOn===null&&Il.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(r=0;r<l.length;r+=3){var o=l[r],u=l[r+1],v=o[ln]||null;if(typeof u=="function")v||mh(l);else if(v){var S=null;if(u&&u.hasAttribute("formAction")){if(o=u,v=u[ln]||null)S=v.formAction;else if(ku(o)!==null)continue}else S=v.action;typeof S=="function"?l[r+1]=S:(l.splice(r,3),r-=3),mh(l)}}}function hh(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(v){return o=v})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),r||setTimeout(l,20)}function l(){if(!r&&!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 r=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function wu(e){this._internalRoot=e}Ui.prototype.render=wu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));var l=t.current,r=vn();sh(l,r,e,t,null,null)},Ui.prototype.unmount=wu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sh(e.current,2,null,e,null,null),gi(),t[ja]=null}};function Ui(e){this._internalRoot=e}Ui.prototype.unstable_scheduleHydration=function(e){if(e){var t=Nd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Il.length&&t!==0&&t<Il[l].priority;l++);Il.splice(l,0,e),l===0&&fh(e)}};var xh=s.version;if(xh!=="19.2.4")throw Error(c(527,xh,"19.2.4"));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=f(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var Fg={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ii=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ii.isDisabled&&Ii.supportsFiber)try{Zn=Ii.inject(Fg),wt=Ii}catch{}}return cs.createRoot=function(e,t){if(!d(e))throw Error(c(299));var l=!1,r="",o=kp,u=Np,v=wp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(v=t.onRecoverableError)),t=ah(e,1,!1,null,null,l,r,null,o,u,v,hh),e[ja]=t.current,su(e),new wu(t)},cs.hydrateRoot=function(e,t,l){if(!d(e))throw Error(c(299));var r=!1,o="",u=kp,v=Np,S=wp,_=null;return l!=null&&(l.unstable_strictMode===!0&&(r=!0),l.identifierPrefix!==void 0&&(o=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(v=l.onCaughtError),l.onRecoverableError!==void 0&&(S=l.onRecoverableError),l.formState!==void 0&&(_=l.formState)),t=ah(e,1,!0,t,l??null,r,o,_,u,v,S,hh),t.context=rh(null),l=t.current,r=vn(),r=ho(r),o=wl(r),o.callback=null,Cl(l,o,r),l=r,t.current.lanes=l,yr(t,l),Kn(t),e[ja]=t.current,su(e),new Ui(t)},cs.version="19.2.4",cs}var Ch;function s1(){if(Ch)return Tu.exports;Ch=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(s){console.error(s)}}return a(),Tu.exports=r1(),Tu.exports}var i1=s1();const o1="modulepreload",c1=function(a){return"/"+a},Eh={},Nx=function(s,i,c){let d=Promise.resolve();if(i&&i.length>0){let p=function(f){return Promise.all(f.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};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=p(i.map(f=>{if(f=c1(f),f in Eh)return;Eh[f]=!0;const b=f.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const j=document.createElement("link");if(j.rel=b?"stylesheet":o1,b||(j.as="script"),j.crossOrigin="",j.href=f,x&&j.setAttribute("nonce",x),document.head.appendChild(j),b)return new Promise((k,E)=>{j.addEventListener("load",k),j.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function m(p){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=p,window.dispatchEvent(h),!h.defaultPrevented)throw p}return d.then(p=>{for(const h of p||[])h.status==="rejected"&&m(h.reason);return s().catch(m)})},rr="";class wx extends Error{constructor(s,i){super(s),this.name="ApiError",this.status=i}}async function Qe(a,s){const i=await fetch(`${rr}${a}`,s);if(!i.ok){const c=await i.json().catch(()=>({error:i.statusText}));throw new wx(c.error||`HTTP ${i.status}`,i.status)}return i.json()}function xl(a){return typeof a=="string"&&a.length>0?a:null}function u1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function zu(a){if(!Array.isArray(a))return null;const s=a.filter(i=>typeof i=="string"&&i.length>0);return s.length>0?s:null}function d1(a){const s=a??{};let i;s.origin==="source"||s.origin==="installed"?i=s.origin:(i="source",console.warn(`[api.getSkills] skill ${String(s.plugin)}/${String(s.skill)} has invalid origin=${JSON.stringify(s.origin)}; defaulting to 'source'`));const c={plugin:typeof s.plugin=="string"?s.plugin:"",skill:typeof s.skill=="string"?s.skill:"",dir:typeof s.dir=="string"?s.dir:"",hasEvals:!!s.hasEvals,hasBenchmark:!!s.hasBenchmark,evalCount:typeof s.evalCount=="number"?s.evalCount:0,assertionCount:typeof s.assertionCount=="number"?s.assertionCount:0,benchmarkStatus:s.benchmarkStatus==="pass"||s.benchmarkStatus==="fail"||s.benchmarkStatus==="pending"||s.benchmarkStatus==="stale"||s.benchmarkStatus==="missing"?s.benchmarkStatus:"missing",lastBenchmark:typeof s.lastBenchmark=="string"?s.lastBenchmark:null,origin:i,description:xl(s.description),version:xl(s.version),category:xl(s.category),author:xl(s.author),license:xl(s.license),homepage:xl(s.homepage),tags:zu(s.tags),deps:zu(s.deps),mcpDeps:zu(s.mcpDeps),entryPoint:xl(s.entryPoint),lastModified:xl(s.lastModified),sizeBytes:u1(s.sizeBytes),sourceAgent:xl(s.sourceAgent)};return typeof s.updateAvailable=="boolean"&&(c.updateAvailable=s.updateAvailable),typeof s.currentVersion=="string"&&(c.currentVersion=s.currentVersion),typeof s.latestVersion=="string"&&(c.latestVersion=s.latestVersion),typeof s.pinnedVersion=="string"&&(c.pinnedVersion=s.pinnedVersion),c}const we={getConfig(){return Qe("/api/config")},setConfig(a,s){return Qe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:s})})},async getSkills(){const a=await Qe("/api/skills");return Array.isArray(a)?a.map(d1):[]},getSkillDetail(a,s){return Qe(`/api/skills/${a}/${s}`)},getEvals(a,s){return Qe(`/api/skills/${a}/${s}/evals`)},saveEvals(a,s,i){return Qe(`/api/skills/${a}/${s}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,s){return Qe(`/api/skills/${a}/${s}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,s){const i=await fetch(`${rr}/api/skills/${a}/${s}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const c=await i.json().catch(()=>({error:i.statusText}));throw new wx(c.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,s,i){const c=new URLSearchParams;i!=null&&i.model&&c.set("model",i.model),i!=null&&i.type&&c.set("type",i.type),i!=null&&i.from&&c.set("from",i.from),i!=null&&i.to&&c.set("to",i.to);const d=c.toString();return Qe(`/api/skills/${a}/${s}/history${d?"?"+d:""}`)},getHistoryEntry(a,s,i){return Qe(`/api/skills/${a}/${s}/history/${encodeURIComponent(i)}`)},compareRuns(a,s,i,c){return Qe(`/api/skills/${a}/${s}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(c)}`)},getCaseHistory(a,s,i,c){const d=new URLSearchParams;c&&d.set("model",c);const m=d.toString();return Qe(`/api/skills/${a}/${s}/history/case/${i}${m?"?"+m:""}`)},deleteHistoryEntry(a,s,i){return Qe(`/api/skills/${a}/${s}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,s){return Qe(`/api/skills/${a}/${s}`,{method:"DELETE"})},improveSkill(a,s,i){return Qe(`/api/skills/${a}/${s}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,s,i){return Qe(`/api/skills/${a}/${s}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,s,i){return Qe(`/api/skills/${a}/${s}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,s){return Qe(`/api/skills/${a}/${s}/stats`)},getDependencies(a,s){return Qe(`/api/skills/${a}/${s}/dependencies`)},getProjectLayout(){return Qe("/api/project-layout")},createSkill(a){return Qe("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Qe("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Qe("/api/skill-creator-status")},generateSkill(a){return Qe("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,s){return Qe(`/api/skills/${a}/${s}/files`)},getSkillFile(a,s,i){return Qe(`/api/skills/${a}/${s}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,s,i,c){return Qe(`/api/skills/${a}/${s}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:c})})},getLeaderboard(a,s){return Qe(`/api/skills/${a}/${s}/leaderboard`)},getLeaderboardEntry(a,s,i){return Qe(`/api/skills/${a}/${s}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,s,i){const c=`${rr}/api/skills/${a}/${s}/sweep`,d=new EventSource(c);return fetch(c,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),d},getCredentials(a,s){return Qe(`/api/credentials/${a}/${s}`)},setCredential(a,s,i,c){return Qe(`/api/credentials/${a}/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:c})})},getParams(a,s){return Qe(`/api/credentials/${a}/${s}/params`)},getParamsRevealed(a,s,i){const c=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Qe(`/api/credentials/${a}/${s}/params?${c}`)},searchModels(){return Qe("/api/openrouter/models")},getSkillVersions(a,s){return Qe(`/api/skills/${a}/${s}/versions`)},getVersionDiff(a,s,i,c){return Qe(`/api/skills/${a}/${s}/versions/diff?from=${i}&to=${c}`)},startBatchUpdate(a){const s=`${rr}/api/skills/batch-update`,i=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,s){const i=`${rr}/api/skills/${a}/${s}/update`,c=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),c},async getSkillUpdates(){try{const a=await fetch(`${rr}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}}};function f1(a,s){if(!s.length)return a;const i=new Map;for(const c of s){const d=c.name.split("/").pop()||c.name;i.set(d,c)}return a.map(c=>{const d=i.get(c.skill);return d?{...c,updateAvailable:d.updateAvailable,currentVersion:d.installed,latestVersion:d.latest??void 0}:c})}function p1(a){const[s,i]=y.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return y.useEffect(()=>{const c=window.matchMedia(a);i(c.matches);const d=m=>i(m.matches);return c.addEventListener("change",d),()=>c.removeEventListener("change",d)},[a]),s}const m1={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function h1(a,s){switch(s.type){case"SELECT_SKILL":return{...a,selectedSkill:s.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:s.mode,selectedSkill:s.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:s.query};case"SET_SKILLS":return{...a,skills:s.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:s.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:s.loading};case"SET_MOBILE":return{...a,isMobile:s.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:s.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const Cx=y.createContext(null);function ya(){const a=y.useContext(Cx);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function x1({children:a}){const[s,i]=y.useReducer(h1,m1),c=p1("(max-width: 767px)");y.useEffect(()=>{i({type:"SET_MOBILE",isMobile:c})},[c]);const d=y.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0}),we.getSkills().then(k=>{i({type:"SET_SKILLS",skills:k});const z=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(z){const[,A,N]=z,T=k.find(H=>H.plugin===A&&H.skill===N);T&&i({type:"SELECT_SKILL",skill:{plugin:A,skill:N,origin:T.origin}})}we.getSkillUpdates().then(A=>{A.length>0&&i({type:"SET_SKILLS",skills:f1(k,A)})}).catch(()=>{})}).catch(k=>i({type:"SET_SKILLS_ERROR",error:k.message}))},[]);y.useEffect(()=>{d()},[d]);const m=y.useCallback(k=>{i({type:"SELECT_SKILL",skill:k}),window.location.hash=`/skills/${k.plugin}/${k.skill}`},[]),p=y.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),h=y.useCallback(k=>{i({type:"SET_MODE",mode:k})},[]),x=y.useCallback(k=>{i({type:"SET_SEARCH",query:k})},[]),f=y.useCallback(k=>{i({type:"SET_MOBILE_VIEW",view:k})},[]),b=y.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),g=y.useMemo(()=>s.skills.filter(k=>k.updateAvailable).length,[s.skills]),j=y.useMemo(()=>({state:s,selectSkill:m,clearSelection:p,setMode:h,setSearch:x,setMobileView:f,refreshSkills:d,updateCount:g,dismissUpdateNotification:b}),[s,m,p,h,x,f,d,g,b]);return n.jsx(Cx.Provider,{value:j,children:a})}const v1={config:null,loading:!0};function y1(a,s){switch(s.type){case"SET_CONFIG":return{config:s.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const Ex=y.createContext(null);function Yl(){const a=y.useContext(Ex);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function g1({children:a}){const[s,i]=y.useReducer(y1,v1),c=y.useCallback(()=>{we.getConfig().then(p=>i({type:"SET_CONFIG",config:p})).catch(()=>{})},[]);y.useEffect(()=>{c()},[c]);const d=y.useCallback(async(p,h)=>{const x=await we.setConfig(p,h);return i({type:"SET_CONFIG",config:x}),x},[]),m=y.useMemo(()=>({config:s.config,loading:s.loading,updateConfig:d,refreshConfig:c}),[s,d,c]);return n.jsx(Ex.Provider,{value:m,children:a})}function b1({topRail:a,sidebar:s,main:i,statusBar:c,resizeHandle:d,banner:m,liveMessage:p,sidebarWidth:h=320,sidebarHidden:x=!1}){const f={"--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)"},b={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:f,children:[m,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:b,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:s}),!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:c}),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:p??""})]})}function j1({value:a,onChange:s}){const[i,c]=y.useState([]),[d,m]=y.useState(!1),[p,h]=y.useState(null),[x,f]=y.useState(a),[b,g]=y.useState(!1),j=y.useRef(null),k=y.useRef(void 0);y.useEffect(()=>{m(!0),we.searchModels().then(N=>c(N.models)).catch(N=>h(N instanceof Error?N.message:String(N))).finally(()=>m(!1))},[]);const E=y.useCallback(N=>{f(N),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>g(!0),300)},[]),z=y.useMemo(()=>{if(!x.trim())return i.slice(0,50);const N=x.toLowerCase();return i.filter(T=>T.id.toLowerCase().includes(N)||T.name.toLowerCase().includes(N)).slice(0,50)},[i,x]);y.useEffect(()=>{function N(T){j.current&&!j.current.contains(T.target)&&g(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[]);function A(N){var $;const T=($=N.pricing)==null?void 0:$.prompt;return T==null||T===0?"Free":`$${(T*1e6).toFixed(2)}/1M`}return n.jsxs("div",{ref:j,style:{position:"relative"},children:[n.jsx("input",{type:"text",value:x,onChange:N=>E(N.target.value),onFocus:()=>g(!0),placeholder:d?"Loading models...":"Search OpenRouter models...",className:"input-field w-full",style:{fontSize:12}}),b&&!d&&n.jsxs("div",{style:{position:"absolute",top:"100%",left:0,right:0,maxHeight:280,overflowY:"auto",background:"var(--surface-2)",border:"1px solid var(--border-default)",borderRadius:8,marginTop:4,zIndex:20,boxShadow:"0 8px 24px rgba(0,0,0,0.4)"},children:[p&&n.jsxs("div",{className:"px-3 py-2 text-[11px]",style:{color:"var(--red)"},children:["Failed to load models: ",p]}),z.length===0&&!p&&n.jsx("div",{className:"px-3 py-3 text-[11px]",style:{color:"var(--text-tertiary)"},children:"No models found"}),z.map(N=>n.jsxs("button",{onClick:()=>{s(N.id),f(N.id),g(!1)},className:"w-full text-left px-3 py-2 flex items-center justify-between transition-colors duration-100",style:{background:N.id===a?"var(--accent-muted)":"transparent",border:"none",cursor:"pointer",borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:T=>{T.currentTarget.style.background="var(--surface-3)"},onMouseLeave:T=>{T.currentTarget.style.background=N.id===a?"var(--accent-muted)":"transparent"},children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:N.name}),n.jsx("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:N.id})]}),n.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:A(N)})]},N.id))]})]})}function S1(){const{config:a,updateConfig:s,refreshConfig:i}=Yl(),[c,d]=y.useState(!1),[m,p]=y.useState(!1),h=y.useRef(null);y.useEffect(()=>{function g(j){h.current&&!h.current.contains(j.target)&&d(!1)}return c&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]);async function x(g,j){p(!0);try{await s(g.id,j.id),d(!1)}catch{i()}finally{p(!1)}}if(!a)return null;const f=N1(a),b=k1(a);return n.jsxs("div",{ref:h,className:"relative",children:[n.jsxs("button",{onClick:()=>d(!c),className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-[11px] transition-all duration-150",style:{background:c?"var(--surface-3)":"var(--surface-2)",border:`1px solid ${c?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},onMouseEnter:g=>{c||(g.currentTarget.style.borderColor="var(--accent)")},onMouseLeave:g=>{c||(g.currentTarget.style.borderColor="var(--border-subtle)")},children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:b!=null&&b.available?"var(--green)":"var(--text-tertiary)"}}),n.jsx("span",{className:"flex-1 text-left font-medium truncate",style:{color:"var(--text-primary)"},children:f}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",style:{transform:c?"rotate(180deg)":"rotate(0)",transition:"transform 0.15s ease",flexShrink:0},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),c&&n.jsxs("div",{className:"absolute top-full mt-1 left-0 right-0 rounded-xl shadow-xl z-50 overflow-hidden animate-fade-in",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",minWidth:"240px"},children:[n.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Select Model"})}),n.jsx("div",{className:"py-1 max-h-72 overflow-y-auto",children:a.providers.map(g=>n.jsxs("div",{children:[n.jsxs("div",{className:"px-3 py-1.5 flex items-center gap-2",children:[n.jsx("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:g.available?"var(--green)":"var(--text-tertiary)",opacity:g.available?1:.3}}),n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",opacity:g.available?1:.5},children:g.label})]}),g.id==="openrouter"&&g.available?n.jsx("div",{className:"px-3 py-1.5",children:n.jsx(j1,{value:a.provider==="openrouter"?a.model:"",onChange:j=>{m||x(g,{id:j,label:j})}})}):g.models.map(j=>{const k=Tx(a,g.id,j.id),E=!g.available||m;return n.jsxs("button",{onClick:()=>!E&&x(g,j),disabled:E,className:"w-full px-3 py-1.5 flex items-center gap-2.5 text-left transition-all duration-100",style:{background:k?"var(--accent-muted)":"transparent",color:E?"var(--text-tertiary)":"var(--text-primary)",opacity:E?.4:1,cursor:E?"not-allowed":"pointer"},onMouseEnter:z=>{!E&&!k&&(z.currentTarget.style.background="var(--surface-3)")},onMouseLeave:z=>{k||(z.currentTarget.style.background="transparent")},children:[n.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 flex items-center justify-center",style:{border:`2px solid ${k?"var(--accent)":"var(--border-subtle)"}`},children:k&&n.jsx("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:"var(--accent)"}})}),n.jsx("span",{className:"text-[12px]",style:{fontWeight:k?600:400},title:j.id,children:j.label})]},`${g.id}-${j.id}`)})]},g.id))})]})]})}function Tx(a,s,i){return a.provider!==s?!1:a.model===i}function k1(a){return a.providers.find(s=>s.id===a.provider)}function N1(a){for(const s of a.providers)for(const i of s.models)if(Tx(a,s.id,i.id))return i.label;return a.model}function Th(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function w1({projectName:a,selected:s,onOpenPalette:i}){const c=s?s.origin==="installed"?"Installed":"Own":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("div",{"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"}),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:s&&c&&n.jsxs(n.Fragment,{children:[n.jsx(Rh,{segment:"origin",onClick:()=>Th({scope:"origin",origin:s.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:s.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:c}),n.jsx(Ah,{}),n.jsx(Rh,{segment:"plugin",onClick:()=>Th({scope:"plugin",plugin:s.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:s.plugin}),n.jsx(Ah,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[n.jsx("span",{"data-slot":"model-selector",style:{minWidth:140},children:n.jsx(S1,{})}),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 Rh({segment:a,onClick:s,style:i,children:c}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:s,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 m=(i==null?void 0:i.color)??"var(--text-secondary)";d.currentTarget.style.color=m},children:c})}function Ah(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ao="vskill-theme";function Rx(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function C1(a,s){return a==="light"||a==="dark"?a:s?"dark":"light"}function E1(a){try{const s=a.getItem(ao);return Rx(s)}catch{return"auto"}}function T1(a,s){try{a.setItem(ao,s)}catch{}}function R1(a,s,i){a.dataset.theme=i,a.dataset.themeMode=s}function A1(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const Ax=y.createContext(null);function M1({storage:a,matchMedia:s,target:i,children:c}){const d=a??(typeof window<"u"?window.localStorage:void 0),m=s??(typeof window<"u"?window.matchMedia.bind(window):void 0),p=i??(typeof document<"u"?document.documentElement:void 0),[h,x]=y.useState(()=>d?E1(d):"auto"),[f,b]=y.useState(()=>A1(m)),g=y.useMemo(()=>C1(h,f),[h,f]);y.useEffect(()=>{p&&R1(p,h,g)},[p,h,g]),y.useEffect(()=>{if(!m)return;const E=m("(prefers-color-scheme: dark)"),z=N=>b(N.matches);if(typeof E.addEventListener=="function")return E.addEventListener("change",z),()=>E.removeEventListener("change",z);const A=E;return A.addListener(z),()=>A.removeListener(z)},[m]),y.useEffect(()=>{if(typeof window>"u")return;const E=z=>{z.key===ao&&x(Rx(z.newValue))};return window.addEventListener("storage",E),()=>window.removeEventListener("storage",E)},[]),y.useEffect(()=>{if(!m||!p)return;let E;try{E=m("(prefers-contrast: more)")}catch{return}const z=T=>{T?p.dataset.contrast="more":p.dataset.contrast==="more"&&delete p.dataset.contrast};z(E.matches);const A=T=>z(T.matches);if(typeof E.addEventListener=="function")return E.addEventListener("change",A),()=>E.removeEventListener("change",A);const N=E;return N.addListener(A),()=>N.removeListener(A)},[m,p]);const j=y.useCallback(E=>{x(E),d&&T1(d,E)},[d]),k=y.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(Ax.Provider,{value:k,children:c})}function Mx(){const a=y.useContext(Ax);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}function z1(){try{return typeof localStorage>"u"?null:localStorage.getItem(ao)}catch{return null}}function D1({projectPath:a,modelName:s,health:i="ok",onPathClick:c}){const{mode:d,resolvedTheme:m,setTheme:p}=Mx(),x=z1()==="auto",f=L1(d,m,x),b=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.jsxs("button",{type:"button",onClick:c,"aria-label":a?`Project path ${a}`:"No project path",style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"none",padding:0,color:"var(--text-secondary)",fontFamily:"var(--font-mono)",cursor:c?"pointer":"default",maxWidth:360,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a??"",children:[n.jsx(Mh,{color:"var(--text-secondary)"}),n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a??"—"})]}),n.jsx(zh,{}),n.jsx("span",{title:s??"",style:{fontFamily:"var(--font-mono)"},children:s??"—"}),n.jsx(zh,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(Mh,{color:b}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(f),"aria-label":`Switch to ${f} theme`,title:`Theme: ${d} — click for ${f}`,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(_1,{mode:d}),n.jsx("span",{style:{textTransform:"capitalize"},children:d})]})]})}function L1(a,s,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":s==="light"?"dark":"light"}function Mh({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function zh(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function _1({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"})]})}var O1=kx();const B1=Sx(O1),ro=0,Kl=1,pr=2,zx=4;function Dh(a){return()=>a}function H1(a){a()}function Dx(a,s){return i=>a(s(i))}function Lh(a,s){return()=>a(s)}function U1(a,s){return i=>a(s,i)}function sd(a){return a!==void 0}function I1(...a){return()=>{a.map(H1)}}function mr(){}function so(a,s){return s(a),a}function V1(a,s){return s(a)}function ht(...a){return a}function Pe(a,s){return a(Kl,s)}function He(a,s){a(ro,s)}function id(a){a(pr)}function gt(a){return a(zx)}function ke(a,s){return Pe(a,U1(s,ro))}function Vn(a,s){const i=a(Kl,c=>{i(),s(c)});return i}function _h(a){let s,i;return c=>d=>{s=d,i&&clearTimeout(i),i=setTimeout(()=>{c(s)},a)}}function Lx(a,s){return a===s}function mt(a=Lx){let s;return i=>c=>{a(s,c)||(s=c,i(c))}}function Re(a){return s=>i=>{a(i)&&s(i)}}function ye(a){return s=>Dx(s,a)}function Qn(a){return s=>()=>{s(a)}}function se(a,...s){const i=G1(...s);return((c,d)=>{switch(c){case pr:id(a);return;case Kl:return Pe(a,i(d))}})}function Xn(a,s){return i=>c=>{i(s=a(s,c))}}function va(a){return s=>i=>{a>0?a--:s(i)}}function vl(a){let s=null,i;return c=>d=>{s=d,!i&&(i=setTimeout(()=>{i=void 0,c(s)},a))}}function Ie(...a){const s=new Array(a.length);let i=0,c=null;const d=2**a.length-1;return a.forEach((m,p)=>{const h=2**p;Pe(m,x=>{const f=i;i|=h,s[p]=x,f!==d&&i===d&&c&&(c(),c=null)})}),m=>p=>{const h=()=>{m([p].concat(s))};i===d?h():c=h}}function G1(...a){return s=>a.reduceRight(V1,s)}function $1(a){let s,i;const c=()=>s==null?void 0:s();return function(d,m){switch(d){case Kl:return m?i===m?void 0:(c(),i=m,s=Pe(a,m),s):(c(),mr);case pr:c(),i=null;return}}}function ue(a){let s=a;const i=Xe();return((c,d)=>{switch(c){case ro:s=d;break;case Kl:{d(s);break}case zx:return s}return i(c,d)})}function Ft(a,s){return so(ue(s),i=>ke(a,i))}function Xe(){const a=[];return((s,i)=>{switch(s){case ro:a.slice().forEach(c=>{c(i)});return;case pr:a.splice(0,a.length);return;case Kl:return a.push(i),()=>{const c=a.indexOf(i);c>-1&&a.splice(c,1)}}})}function bn(a){return so(Xe(),s=>ke(a,s))}function Fe(a,s=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:s,id:q1(),singleton:i}}const q1=()=>Symbol();function Y1(a){const s=new Map,i=({constructor:c,dependencies:d,id:m,singleton:p})=>{if(p&&s.has(m))return s.get(m);const h=c(d.map(x=>i(x)));return p&&s.set(m,h),h};return i(a)}function Lt(...a){const s=Xe(),i=new Array(a.length);let c=0;const d=2**a.length-1;return a.forEach((m,p)=>{const h=2**p;Pe(m,x=>{i[p]=x,c|=h,c===d&&He(s,i)})}),function(m,p){switch(m){case pr:{id(s);return}case Kl:return c===d&&p(i),Pe(s,p)}}}function Te(a,s=Lx){return se(a,mt(s))}function Xu(...a){return function(s,i){switch(s){case pr:return;case Kl:return I1(...a.map(c=>Pe(c,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},K1={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},Q1=()=>typeof globalThis>"u"?window:globalThis,Ql=Fe(()=>{const a=ue(Bt.ERROR);return{log:ue((s,i,c=Bt.INFO)=>{const d=Q1().VIRTUOSO_LOG_LEVEL??gt(a);c>=d&&console[K1[c]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",s,i)}),logLevel:a}},[],{singleton:!0});function ga(a,s,i){return od(a,s,i).callbackRef}function od(a,s,i){const c=Se.useRef(null);let d=p=>{};const m=Se.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(p=>{const h=()=>{const x=p[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return d=p=>{p&&s?(m==null||m.observe(p),c.current=p):(c.current&&(m==null||m.unobserve(c.current)),c.current=null)},{callbackRef:d,ref:c}}function X1(a,s,i,c,d,m,p,h,x){const f=Se.useCallback(b=>{const g=W1(b.children,s,h?"offsetWidth":"offsetHeight",d);let j=b.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const k=j.lastElementChild.dataset.viewportType==="window";let E;k&&(E=j.ownerDocument.defaultView);const z=p?h?p.scrollLeft:p.scrollTop:k?h?E.scrollX||E.document.documentElement.scrollLeft:E.scrollY||E.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,A=p?h?p.scrollWidth:p.scrollHeight:k?h?E.document.documentElement.scrollWidth:E.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,N=p?h?p.offsetWidth:p.offsetHeight:k?h?E.innerWidth:E.innerHeight:h?j.offsetWidth:j.offsetHeight;c({scrollHeight:A,scrollTop:Math.max(z,0),viewportHeight:N}),m==null||m(h?Oh("column-gap",getComputedStyle(b).columnGap,d):Oh("row-gap",getComputedStyle(b).rowGap,d)),g!==null&&a(g)},[a,s,d,m,p,c,h]);return od(f,i,x)}function W1(a,s,i,c){const d=a.length;if(d===0)return null;const m=[];for(let p=0;p<d;p++){const h=a.item(p);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),f=parseFloat(h.dataset.knownSize),b=s(h,i);if(b===0&&c("Zero-sized element, this should not happen",{child:h},Bt.ERROR),b===f)continue;const g=m[m.length-1];m.length===0||g.size!==b||g.endIndex!==x-1?m.push({endIndex:x,size:b,startIndex:x}):m[m.length-1].endIndex++}return m}function Oh(a,s,i){return s!=="normal"&&(s==null?void 0:s.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,s,Bt.WARN),s==="normal"?0:parseInt(s??"0",10)}function _x(a,s,i){const c=Se.useRef(null),d=Se.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const f=x.getBoundingClientRect(),b=f.width;let g,j;if(s){const k=s.getBoundingClientRect(),E=f.top-k.top;j=k.height-Math.max(0,E),g=E+s.scrollTop}else{const k=p.current.ownerDocument.defaultView;j=k.innerHeight-Math.max(0,f.top),g=f.top+k.scrollY}c.current={listHeight:f.height,offsetTop:g,visibleHeight:j,visibleWidth:b},a(c.current)},[a,s]),{callbackRef:m,ref:p}=od(d,!0,i),h=Se.useCallback(()=>{d(p.current)},[d,p]);return Se.useEffect(()=>{var f;if(s){s.addEventListener("scroll",h);const b=new ResizeObserver(()=>{requestAnimationFrame(h)});return b.observe(s),()=>{s.removeEventListener("scroll",h),b.unobserve(s)}}const x=(f=p.current)==null?void 0:f.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,s,p]),m}const nn=Fe(()=>{const a=Xe(),s=Xe(),i=ue(0),c=Xe(),d=ue(0),m=Xe(),p=Xe(),h=ue(0),x=ue(0),f=ue(0),b=ue(0),g=Xe(),j=Xe(),k=ue(!1),E=ue(!1),z=ue(!1);return ke(se(a,ye(({scrollTop:A})=>A)),s),ke(se(a,ye(({scrollHeight:A})=>A)),p),ke(s,d),{deviation:i,fixedFooterHeight:f,fixedHeaderHeight:x,footerHeight:b,headerHeight:h,horizontalDirection:E,scrollBy:j,scrollContainerState:a,scrollHeight:p,scrollingInProgress:k,scrollTo:g,scrollTop:s,skipAnimationFrameInResizeObserver:z,smoothScrollTargetReached:c,statefulScrollTop:d,viewportHeight:m}},[],{singleton:!0}),xs={lvl:0};function Ox(a,s){const i=a.length;if(i===0)return[];let{index:c,value:d}=s(a[0]);const m=[];for(let p=1;p<i;p++){const{index:h,value:x}=s(a[p]);m.push({end:h-1,start:c,value:d}),c=h,d=x}return m.push({end:1/0,start:c,value:d}),m}function it(a){return a===xs}function vs(a,s){if(!it(a))return s===a.k?a.v:s<a.k?vs(a.l,s):vs(a.r,s)}function Gn(a,s,i="k"){if(it(a))return[-1/0,void 0];if(Number(a[i])===s)return[a.k,a.v];if(Number(a[i])<s){const c=Gn(a.r,s,i);return c[0]===-1/0?[a.k,a.v]:c}return Gn(a.l,s,i)}function yn(a,s,i){return it(a)?Ux(s,i,1):s===a.k?Ot(a,{k:s,v:i}):s<a.k?Bh(Ot(a,{l:yn(a.l,s,i)})):Bh(Ot(a,{r:yn(a.r,s,i)}))}function or(){return xs}function cr(a,s,i){if(it(a))return[];const c=Gn(a,s)[0];return Z1(Zu(a,c,i))}function Wu(a,s){if(it(a))return xs;const{k:i,l:c,r:d}=a;if(s===i){if(it(c))return d;if(it(d))return c;const[m,p]=Hx(c);return Xi(Ot(a,{k:m,l:Bx(c),v:p}))}return s<i?Xi(Ot(a,{l:Wu(c,s)})):Xi(Ot(a,{r:Wu(d,s)}))}function xa(a){return it(a)?[]:[...xa(a.l),{k:a.k,v:a.v},...xa(a.r)]}function Zu(a,s,i){if(it(a))return[];const{k:c,l:d,r:m,v:p}=a;let h=[];return c>s&&(h=h.concat(Zu(d,s,i))),c>=s&&c<=i&&h.push({k:c,v:p}),c<=i&&(h=h.concat(Zu(m,s,i))),h}function Xi(a){const{l:s,lvl:i,r:c}=a;if(c.lvl>=i-1&&s.lvl>=i-1)return a;if(i>c.lvl+1){if(Du(s))return Ix(Ot(a,{lvl:i-1}));if(!it(s)&&!it(s.r))return Ot(s.r,{l:Ot(s,{r:s.r.l}),lvl:i,r:Ot(a,{l:s.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Du(a))return Fu(Ot(a,{lvl:i-1}));if(!it(c)&&!it(c.l)){const d=c.l,m=Du(d)?c.lvl-1:c.lvl;return Ot(d,{l:Ot(a,{lvl:i-1,r:d.l}),lvl:d.lvl+1,r:Fu(Ot(c,{l:d.r,lvl:m}))})}throw new Error("Unexpected empty nodes")}function Ot(a,s){return Ux(s.k!==void 0?s.k:a.k,s.v!==void 0?s.v:a.v,s.lvl!==void 0?s.lvl:a.lvl,s.l!==void 0?s.l:a.l,s.r!==void 0?s.r:a.r)}function Bx(a){return it(a.r)?a.l:Xi(Ot(a,{r:Bx(a.r)}))}function Du(a){return it(a)||a.lvl>a.r.lvl}function Hx(a){return it(a.r)?[a.k,a.v]:Hx(a.r)}function Ux(a,s,i,c=xs,d=xs){return{k:a,l:c,lvl:i,r:d,v:s}}function Bh(a){return Fu(Ix(a))}function Ix(a){const{l:s}=a;return!it(s)&&s.lvl===a.lvl?Ot(s,{r:Ot(a,{l:s.r})}):a}function Fu(a){const{lvl:s,r:i}=a;return!it(i)&&!it(i.r)&&i.lvl===s&&i.r.lvl===s?Ot(i,{l:Ot(a,{r:i.l}),lvl:s+1}):a}function Z1(a){return Ox(a,({k:s,v:i})=>({index:s,value:i}))}function Vx(a,s){return!!(a&&a.startIndex===s.startIndex&&a.endIndex===s.endIndex)}function ys(a,s){return!!(a&&a[0]===s[0]&&a[1]===s[1])}const cd=Fe(()=>({recalcInProgress:ue(!1)}),[],{singleton:!0});function Gx(a,s,i){return a[Pi(a,s,i)]}function Pi(a,s,i,c=0){let d=a.length-1;for(;c<=d;){const m=Math.floor((c+d)/2),p=a[m],h=i(p,s);if(h===0)return m;if(h===-1){if(d-c<2)return m-1;d=m-1}else{if(d===c)return m;c=m+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${s}`)}function F1(a,s,i,c){const d=Pi(a,s,c),m=Pi(a,i,c,d);return a.slice(d,m+1)}function ql(a,s){return Math.round(a.getBoundingClientRect()[s])}function io(a){return!it(a.groupOffsetTree)}function ud({index:a},s){return s===a?0:s<a?-1:1}function J1(){return{groupIndices:[],groupOffsetTree:or(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:or()}}function P1(a,s){let i=it(a)?0:1/0;for(const c of s){const{endIndex:d,size:m,startIndex:p}=c;if(i=Math.min(i,p),it(a)){a=yn(a,0,m);continue}const h=cr(a,p-1,d+1);if(h.some(s0(c)))continue;let x=!1,f=!1;for(const{end:b,start:g,value:j}of h)x?(d>=g||m===j)&&(a=Wu(a,g)):(f=j!==m,x=!0),b>d&&d>=g&&j!==m&&(a=yn(a,d+1,j));f&&(a=yn(a,p,m))}return[a,i]}function e0(a){return typeof a.groupIndex<"u"}function t0({offset:a},s){return s===a?0:s<a?-1:1}function gs(a,s,i){if(s.length===0)return 0;const{index:c,offset:d,size:m}=Gx(s,a,ud),p=a-c,h=m*p+(p-1)*i+d;return h>0?h+i:h}function $x(a,s){if(!io(s))return a;let i=0;for(;s.groupIndices[i]<=a+i;)i++;return a+i}function qx(a,s,i){if(e0(a))return s.groupIndices[a.groupIndex]+1;const c=a.index==="LAST"?i:a.index;let d=$x(c,s);return d=Math.max(0,d,Math.min(i,d)),d}function n0(a,s,i,c=0){return c>0&&(s=Math.max(s,Gx(a,c,ud).offset)),Ox(F1(a,s,i,t0),r0)}function l0(a,[s,i,c,d]){s.length>0&&c("received item sizes",s,Bt.DEBUG);const m=a.sizeTree;let p=m,h=0;if(i.length>0&&it(m)&&s.length===2){const j=s[0].size,k=s[1].size;p=i.reduce((E,z)=>yn(yn(E,z,j),z+1,k),p)}else[p,h]=P1(p,s);if(p===m)return a;const{lastIndex:x,lastOffset:f,lastSize:b,offsetTree:g}=Ju(a.offsetTree,h,p,d);return{groupIndices:i,groupOffsetTree:i.reduce((j,k)=>yn(j,k,gs(k,g,d)),or()),lastIndex:x,lastOffset:f,lastSize:b,offsetTree:g,sizeTree:p}}function a0(a){return xa(a).map(({k:s,v:i},c,d)=>{const m=d[c+1];return{endIndex:m!==void 0?m.k-1:1/0,size:i,startIndex:s}})}function Hh(a,s){let i=0,c=0;for(;i<a;)i+=s[c+1]-s[c]-1,c++;return c-(i===a?0:1)}function Ju(a,s,i,c){let d=a,m=0,p=0,h=0,x=0;if(s!==0){x=Pi(d,s-1,ud),h=d[x].offset;const f=Gn(i,s-1);m=f[0],p=f[1],d.length&&d[x].size===Gn(i,s)[1]&&(x-=1),d=d.slice(0,x+1)}else d=[];for(const{start:f,value:b}of cr(i,s,1/0)){const g=f-m,j=g*p+h+g*c;d.push({index:f,offset:j,size:b}),m=f,h=j,p=b}return{lastIndex:m,lastOffset:h,lastSize:p,offsetTree:d}}function r0(a){return{index:a.index,value:a}}function s0(a){const{endIndex:s,size:i,startIndex:c}=a;return d=>d.start===c&&(d.end===s||d.end===1/0)&&d.value===i}const i0={offsetHeight:"height",offsetWidth:"width"},Wn=Fe(([{log:a},{recalcInProgress:s}])=>{const i=Xe(),c=Xe(),d=Ft(c,0),m=Xe(),p=Xe(),h=ue(0),x=ue([]),f=ue(void 0),b=ue(void 0),g=ue(void 0),j=ue(void 0),k=ue((w,B)=>ql(w,i0[B])),E=ue(void 0),z=ue(0),A=J1(),N=Ft(se(i,Ie(x,a,z),Xn(l0,A),mt()),A),T=Ft(se(x,mt(),Xn((w,B)=>({current:B,prev:w.current}),{current:[],prev:[]}),ye(({prev:w})=>w)),[]);ke(se(x,Re(w=>w.length>0),Ie(N,z),ye(([w,B,M])=>{const V=w.reduce((I,Z,ne)=>yn(I,Z,gs(Z,B.offsetTree,M)||ne),or());return{...B,groupIndices:w,groupOffsetTree:V}})),N),ke(se(c,Ie(N),Re(([w,{lastIndex:B}])=>w<B),ye(([w,{lastIndex:B,lastSize:M}])=>[{endIndex:B,size:M,startIndex:w}])),i),ke(f,b);const H=Ft(se(f,ye(w=>w===void 0)),!0);ke(se(b,Re(w=>w!==void 0&&it(gt(N).sizeTree)),ye(w=>{const B=gt(g),M=gt(x).length>0;return B!==void 0&&B!==0?M?[{endIndex:0,size:B,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),ke(se(j,Re(w=>w!==void 0&&w.length>0&&it(gt(N).sizeTree)),ye(w=>{const B=[];let M=w[0],V=0;for(let I=1;I<w.length;I++){const Z=w[I];Z!==M&&(B.push({endIndex:I-1,size:M,startIndex:V}),M=Z,V=I)}return B.push({endIndex:w.length-1,size:M,startIndex:V}),B})),i),ke(se(x,Ie(g,b),Re(([,w,B])=>w!==void 0&&B!==void 0),ye(([w,B,M])=>{const V=[];for(let I=0;I<w.length;I++){const Z=w[I],ne=w[I+1];V.push({startIndex:Z,endIndex:Z,size:B}),ne!==void 0&&V.push({startIndex:Z+1,endIndex:ne-1,size:M})}return V})),i);const $=bn(se(i,Ie(N),Xn(({sizes:w},[B,M])=>({changed:M!==w,sizes:M}),{changed:!1,sizes:A}),ye(w=>w.changed)));Pe(se(h,Xn((w,B)=>({diff:w.prev-B,prev:B}),{diff:0,prev:0}),ye(w=>w.diff)),w=>{const{groupIndices:B}=gt(N);if(w>0)He(s,!0),He(m,w+Hh(w,B));else if(w<0){const M=gt(T);M.length>0&&(w-=Hh(-w,M)),He(p,w)}}),Pe(se(h,Ie(a)),([w,B])=>{w<0&&B("`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},Bt.ERROR)});const O=bn(m);ke(se(m,Ie(N),ye(([w,B])=>{const M=B.groupIndices.length>0,V=[],I=B.lastSize;if(M){const Z=vs(B.sizeTree,0);let ne=0,J=0;for(;ne<w;){const C=B.groupIndices[J],L=B.groupIndices.length===J+1?1/0:B.groupIndices[J+1]-C-1;V.push({endIndex:C,size:Z,startIndex:C}),V.push({endIndex:C+1+L-1,size:I,startIndex:C+1}),J++,ne+=L+1}const D=xa(B.sizeTree);return ne!==w&&D.shift(),D.reduce((C,{k:L,v:ae})=>{let Q=C.ranges;return C.prevSize!==0&&(Q=[...C.ranges,{endIndex:L+w-1,size:C.prevSize,startIndex:C.prevIndex}]),{prevIndex:L+w,prevSize:ae,ranges:Q}},{prevIndex:w,prevSize:0,ranges:V}).ranges}return xa(B.sizeTree).reduce((Z,{k:ne,v:J})=>({prevIndex:ne+w,prevSize:J,ranges:[...Z.ranges,{endIndex:ne+w-1,size:Z.prevSize,startIndex:Z.prevIndex}]}),{prevIndex:0,prevSize:I,ranges:[]}).ranges})),i);const K=bn(se(p,Ie(N,z),ye(([w,{offsetTree:B},M])=>{const V=-w;return gs(V,B,M)})));return ke(se(p,Ie(N,z),ye(([w,B,M])=>{if(B.groupIndices.length>0){if(it(B.sizeTree))return B;let I=or();const Z=gt(T);let ne=0,J=0,D=0;for(;ne<-w;){D=Z[J];const C=Z[J+1]-D-1;J++,ne+=C+1}if(I=xa(B.sizeTree).reduce((C,{k:L,v:ae})=>yn(C,Math.max(0,L+w),ae),I),ne!==-w){const C=vs(B.sizeTree,D);I=yn(I,0,C);const L=Gn(B.sizeTree,-w+1)[1];I=yn(I,1,L)}return{...B,sizeTree:I,...Ju(B.offsetTree,0,I,M)}}const V=xa(B.sizeTree).reduce((I,{k:Z,v:ne})=>yn(I,Math.max(0,Z+w),ne),or());return{...B,sizeTree:V,...Ju(B.offsetTree,0,V,M)}})),N),{beforeUnshiftWith:O,data:E,defaultItemSize:b,firstItemIndex:h,fixedItemSize:f,fixedGroupSize:g,gap:z,groupIndices:x,heightEstimates:j,itemSize:k,listRefresh:$,shiftWith:p,shiftWithOffset:K,sizeRanges:i,sizes:N,statefulTotalCount:d,totalCount:c,trackItemSizes:H,unshiftWith:m}},ht(Ql,cd),{singleton:!0});function o0(a){return a.reduce((s,i)=>(s.groupIndices.push(s.totalCount),s.totalCount+=i+1,s),{groupIndices:[],totalCount:0})}const Yx=Fe(([{groupIndices:a,sizes:s,totalCount:i},{headerHeight:c,scrollTop:d}])=>{const m=Xe(),p=Xe(),h=bn(se(m,ye(o0)));return ke(se(h,ye(x=>x.totalCount)),i),ke(se(h,ye(x=>x.groupIndices)),a),ke(se(Lt(d,s,c),Re(([x,f])=>io(f)),ye(([x,f,b])=>Gn(f.groupOffsetTree,Math.max(x-b,0),"v")[0]),mt(),ye(x=>[x])),p),{groupCounts:m,topItemsIndexes:p}},ht(Wn,nn)),Xl=Fe(([{log:a}])=>{const s=ue(!1),i=bn(se(s,Re(c=>c),mt()));return Pe(s,c=>{c&&gt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:s}},ht(Ql),{singleton:!0}),c0=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Kx(a){const s=typeof a=="number"?{index:a}:a;return s.align||(s.align="start"),(!s.behavior||!c0)&&(s.behavior="auto"),s.offset===void 0&&(s.offset=0),s}const ks=Fe(([{gap:a,listRefresh:s,sizes:i,totalCount:c},{fixedFooterHeight:d,fixedHeaderHeight:m,footerHeight:p,headerHeight:h,scrollingInProgress:x,scrollTo:f,smoothScrollTargetReached:b,viewportHeight:g},{log:j}])=>{const k=Xe(),E=Xe(),z=ue(0);let A=null,N=null,T=null;function H(){A!==null&&(A(),A=null),T!==null&&(T(),T=null),N&&(clearTimeout(N),N=null),He(x,!1)}return ke(se(k,Ie(i,g,c,z,h,p,j),Ie(a,m,d),ye(([[$,O,K,w,B,M,V,I],Z,ne,J])=>{const D=Kx($),{align:C,behavior:L,offset:ae}=D,Q=w-1,pe=qx(D,O,Q);let R=gs(pe,O.offsetTree,Z)+M;C==="end"?(R+=ne+Gn(O.sizeTree,pe)[1]-K+J,pe===Q&&(R+=V)):C==="center"?R+=(ne+Gn(O.sizeTree,pe)[1]-K+J)/2:R-=B,ae!==void 0&&ae!==0&&(R+=ae);const X=re=>{H(),re?(I("retrying to scroll to",{location:$},Bt.DEBUG),He(k,$)):(He(E,!0),I("list did not change, scroll successful",{},Bt.DEBUG))};if(H(),L==="smooth"){let re=!1;T=Pe(s,de=>{re=re||de}),A=Vn(b,()=>{X(re)})}else A=Vn(se(s,u0(150)),X);return N=setTimeout(()=>{H()},1200),He(x,!0),I("scrolling from index to",{behavior:L,index:pe,top:R},Bt.DEBUG),{behavior:L,top:R}})),f),{scrollTargetReached:E,scrollToIndex:k,topListHeight:z}},ht(Wn,nn,Ql),{singleton:!0});function u0(a){return s=>{const i=setTimeout(()=>{s(!1)},a);return c=>{c&&(s(!0),clearTimeout(i))}}}function dd(a,s){a===0?s():requestAnimationFrame(()=>{dd(a-1,s)})}function fd(a,s){const i=s-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Ns=Fe(([{defaultItemSize:a,listRefresh:s,sizes:i},{scrollTop:c},{scrollTargetReached:d,scrollToIndex:m},{didMount:p}])=>{const h=ue(!0),x=ue(0),f=ue(!0);return ke(se(p,Ie(x),Re(([b,g])=>g!==0),Qn(!1)),h),ke(se(p,Ie(x),Re(([b,g])=>g!==0),Qn(!1)),f),Pe(se(Lt(s,p),Ie(h,i,a,f),Re(([[,b],g,{sizeTree:j},k,E])=>b&&(!it(j)||sd(k))&&!g&&!E),Ie(x)),([,b])=>{Vn(d,()=>{He(f,!0)}),dd(4,()=>{Vn(c,()=>{He(h,!0)}),He(m,b)})}),{initialItemFinalLocationReached:f,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Wn,nn,ks,Xl),{singleton:!0});function Qx(a,s){return Math.abs(a-s)<1.01}const bs="up",ps="down",d0="none",f0={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},p0=0,ws=Fe(([{footerHeight:a,headerHeight:s,scrollBy:i,scrollContainerState:c,scrollTop:d,viewportHeight:m}])=>{const p=ue(!1),h=ue(!0),x=Xe(),f=Xe(),b=ue(4),g=ue(p0),j=Ft(se(Xu(se(Te(d),va(1),Qn(!0)),se(Te(d),va(1),Qn(!1),_h(100))),mt()),!1),k=Ft(se(Xu(se(i,Qn(!0)),se(i,Qn(!1),_h(200))),mt()),!1);ke(se(Lt(Te(d),Te(g)),ye(([T,H])=>T<=H),mt()),h),ke(se(h,vl(50)),f);const E=bn(se(Lt(c,Te(m),Te(s),Te(a),Te(b)),Xn((T,[{scrollHeight:H,scrollTop:$},O,K,w,B])=>{const M=$+O-H>-B,V={scrollHeight:H,scrollTop:$,viewportHeight:O};if(M){let Z,ne;return $>T.state.scrollTop?(Z="SCROLLED_DOWN",ne=T.state.scrollTop-$):(Z="SIZE_DECREASED",ne=T.state.scrollTop-$||T.scrollTopDelta),{atBottom:!0,atBottomBecause:Z,scrollTopDelta:ne,state:V}}let I;return V.scrollHeight>T.state.scrollHeight?I="SIZE_INCREASED":O<T.state.viewportHeight?I="VIEWPORT_HEIGHT_DECREASING":$<T.state.scrollTop?I="SCROLLING_UPWARDS":I="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:I,state:V}},f0),mt((T,H)=>T!==void 0&&T.atBottom===H.atBottom))),z=Ft(se(c,Xn((T,{scrollHeight:H,scrollTop:$,viewportHeight:O})=>{if(!Qx(T.scrollHeight,H)){const K=H-($+O)<1;return T.scrollTop!==$&&K?{changed:!0,jump:T.scrollTop-$,scrollHeight:H,scrollTop:$}:{changed:!0,jump:0,scrollHeight:H,scrollTop:$}}return{changed:!1,jump:0,scrollHeight:H,scrollTop:$}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Re(T=>T.changed),ye(T=>T.jump)),0);ke(se(E,ye(T=>T.atBottom)),p),ke(se(p,vl(50)),x);const A=ue(ps);ke(se(c,ye(({scrollTop:T})=>T),mt(),Xn((T,H)=>gt(k)?{direction:T.direction,prevScrollTop:H}:{direction:H<T.prevScrollTop?bs:ps,prevScrollTop:H},{direction:ps,prevScrollTop:0}),ye(T=>T.direction)),A),ke(se(c,vl(50),Qn(d0)),A);const N=ue(0);return ke(se(j,Re(T=>!T),Qn(0)),N),ke(se(d,vl(100),Ie(j),Re(([T,H])=>H),Xn(([T,H],[$])=>[H,$],[0,0]),ye(([T,H])=>H-T)),N),{atBottomState:E,atBottomStateChange:x,atBottomThreshold:b,atTopStateChange:f,atTopThreshold:g,isAtBottom:p,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:z,scrollDirection:A,scrollVelocity:N}},ht(nn)),js="top",Ss="bottom",Uh="none";function Ih(a,s,i){return typeof a=="number"?i===bs&&s===js||i===ps&&s===Ss?a:0:i===bs?s===js?a.main:a.reverse:s===Ss?a.main:a.reverse}function Vh(a,s){return typeof a=="number"?a:a[s]??0}const pd=Fe(([{deviation:a,fixedHeaderHeight:s,headerHeight:i,scrollTop:c,viewportHeight:d}])=>{const m=Xe(),p=ue(0),h=ue(0),x=ue(0),f=Ft(se(Lt(Te(c),Te(d),Te(i),Te(m,ys),Te(x),Te(p),Te(s),Te(a),Te(h)),ye(([b,g,j,[k,E],z,A,N,T,H])=>{const $=b-T,O=A+N,K=Math.max(j-$,0);let w=Uh;const B=Vh(H,js),M=Vh(H,Ss);return k-=T,k+=j+N,E+=j+N,E-=T,k>b+O-B&&(w=bs),E<b-K+g+M&&(w=ps),w!==Uh?[Math.max($-j-Ih(z,js,w)-B,0),$-K-N+g+Ih(z,Ss,w)+M]:null}),Re(b=>b!==null),mt(ys)),[0,0]);return{increaseViewportBy:h,listBoundary:m,overscan:x,topListHeight:p,visibleRange:f}},ht(nn),{singleton:!0});function m0(a,s,i){if(io(s)){const c=$x(a,s);return[{index:Gn(s.groupOffsetTree,c)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:c,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Lu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Wi(a,s,i,c,d,m){const{lastIndex:p,lastOffset:h,lastSize:x}=d;let f=0,b=0;if(a.length>0){f=a[0].offset;const z=a[a.length-1];b=z.offset+z.size}const g=i-p,j=h+g*x+(g-1)*c,k=f,E=j-b;return{bottom:b,firstItemIndex:m,items:Gh(a,d,m),offsetBottom:E,offsetTop:f,top:k,topItems:Gh(s,d,m),topListHeight:s.reduce((z,A)=>A.size+z,0),totalCount:i}}function Xx(a,s,i,c,d,m){let p=0;if(i.groupIndices.length>0)for(const b of i.groupIndices){if(b-p>=a)break;p++}const h=a+p,x=fd(s,h),f=Array.from({length:h}).map((b,g)=>({data:m[g+x],index:g+x,offset:0,size:0}));return Wi(f,[],h,d,i,c)}function Gh(a,s,i){if(a.length===0)return[];if(!io(s))return a.map(f=>({...f,index:f.index+i,originalIndex:f.index}));const c=a[0].index,d=a[a.length-1].index,m=[],p=cr(s.groupOffsetTree,c,d);let h,x=0;for(const f of a){(!h||h.end<f.index)&&(h=p.shift(),x=s.groupIndices.indexOf(h.start));let b;f.index===h.start?b={index:x,type:"group"}:b={groupIndex:x,index:f.index-(x+1)+i},m.push({...b,data:f.data,offset:f.offset,originalIndex:f.index,size:f.size})}return m}function $h(a,s){return a===void 0?0:typeof a=="number"?a:a[s]??0}const ba=Fe(([{data:a,firstItemIndex:s,gap:i,sizes:c,totalCount:d},m,{listBoundary:p,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:f,scrolledToInitialItem:b},{topListHeight:g},j,{didMount:k},{recalcInProgress:E}])=>{const z=ue([]),A=ue(0),N=Xe(),T=ue(0);ke(m.topItemsIndexes,z);const H=Ft(se(Lt(k,E,Te(x,ys),Te(d),Te(c),Te(f),b,Te(z),Te(s),Te(i),Te(T),a),Re(([w,B,,M,,,,,,,,V])=>{const I=V!==void 0&&V.length!==M;return w&&!B&&!I}),ye(([,,[w,B],M,V,I,Z,ne,J,D,C,L])=>{var be,Ve;const ae=V,{offsetTree:Q,sizeTree:pe}=ae,R=gt(A);if(M===0)return{...Lu,totalCount:M};if(w===0&&B===0)return R===0?{...Lu,totalCount:M}:Xx(R,I,V,J,D,L||[]);if(it(pe))return R>0?null:Wi(m0(fd(I,M),ae,L),[],M,D,ae,J);const X=[];if(ne.length>0){const Oe=ne[0],ee=ne[ne.length-1];let ce=0;for(const oe of cr(pe,Oe,ee)){const fe=oe.value,ve=Math.max(oe.start,Oe),Le=Math.min(oe.end,ee);for(let Ae=ve;Ae<=Le;Ae++)X.push({data:L==null?void 0:L[Ae],index:Ae,offset:ce,size:fe}),ce+=fe}}if(!Z)return Wi([],X,M,D,ae,J);const re=ne.length>0?ne[ne.length-1]+1:0,de=n0(Q,w,B,re);if(de.length===0)return null;const xe=M-1,me=so([],Oe=>{for(const ee of de){const ce=ee.value;let oe=ce.offset,fe=ee.start;const ve=ce.size;if(ce.offset<w){fe+=Math.floor((w-ce.offset+D)/(ve+D));const Ae=fe-ee.start;oe+=Ae*ve+Ae*D}fe<re&&(oe+=(re-fe)*ve,fe=re);const Le=Math.min(ee.end,xe);for(let Ae=fe;Ae<=Le&&!(oe>=B);Ae++)Oe.push({data:L==null?void 0:L[Ae],index:Ae,offset:oe,size:ve}),oe+=ve+D}}),Ne=$h(C,js),ie=$h(C,Ss);if(me.length>0&&(Ne>0||ie>0)){const Oe=me[0],ee=me[me.length-1];if(Ne>0&&Oe.index>re){const ce=Math.min(Ne,Oe.index-re),oe=[];let fe=Oe.offset;for(let ve=Oe.index-1;ve>=Oe.index-ce;ve--){const Le=((be=cr(pe,ve,ve)[0])==null?void 0:be.value)??Oe.size;fe-=Le+D,oe.unshift({data:L==null?void 0:L[ve],index:ve,offset:fe,size:Le})}me.unshift(...oe)}if(ie>0&&ee.index<xe){const ce=Math.min(ie,xe-ee.index);let oe=ee.offset+ee.size+D;for(let fe=ee.index+1;fe<=ee.index+ce;fe++){const ve=((Ve=cr(pe,fe,fe)[0])==null?void 0:Ve.value)??ee.size;me.push({data:L==null?void 0:L[fe],index:fe,offset:oe,size:ve}),oe+=ve+D}}}return Wi(me,X,M,D,ae,J)}),Re(w=>w!==null),mt()),Lu);ke(se(a,Re(sd),ye(w=>w==null?void 0:w.length)),d),ke(se(H,ye(w=>w.topListHeight)),g),ke(g,h),ke(se(H,ye(w=>[w.top,w.bottom])),p),ke(se(H,ye(w=>w.items)),N);const $=bn(se(H,Re(({items:w})=>w.length>0),Ie(d,a),Re(([{items:w},B])=>w[w.length-1].originalIndex===B-1),ye(([,w,B])=>[w-1,B]),mt(ys),ye(([w])=>w))),O=bn(se(H,vl(200),Re(({items:w,topItems:B})=>w.length>0&&w[0].originalIndex===B.length),ye(({items:w})=>w[0].index),mt())),K=bn(se(H,Re(({items:w})=>w.length>0),ye(({items:w})=>{let B=0,M=w.length-1;for(;w[B].type==="group"&&B<M;)B++;for(;w[M].type==="group"&&M>B;)M--;return{endIndex:w[M].index,startIndex:w[B].index}}),mt(Vx)));return{endReached:$,initialItemCount:A,itemsRendered:N,listState:H,minOverscanItemCount:T,rangeChanged:K,startReached:O,topItemsIndexes:z,...j}},ht(Wn,Yx,pd,Ns,ks,ws,Xl,cd),{singleton:!0}),Wx=Fe(([{fixedFooterHeight:a,fixedHeaderHeight:s,footerHeight:i,headerHeight:c},{listState:d}])=>{const m=Xe(),p=Ft(se(Lt(i,a,c,s,d),ye(([h,x,f,b,g])=>h+x+f+b+g.offsetBottom+g.bottom)),0);return ke(Te(p),m),{totalListHeight:p,totalListHeightChanged:m}},ht(nn,ba),{singleton:!0}),h0=Fe(([{viewportHeight:a},{totalListHeight:s}])=>{const i=ue(!1),c=Ft(se(Lt(i,a,s),Re(([d])=>d),ye(([,d,m])=>Math.max(0,d-m)),vl(0),mt()),0);return{alignToBottom:i,paddingTopAddition:c}},ht(nn,Wx),{singleton:!0}),Zx=Fe(()=>({context:ue(null)})),x0=({itemBottom:a,itemTop:s,locationParams:{align:i,behavior:c,...d},viewportBottom:m,viewportTop:p})=>s<p?{...d,align:i??"start",...c!==void 0?{behavior:c}:{}}:a>m?{...d,align:i??"end",...c!==void 0?{behavior:c}:{}}:null,Fx=Fe(([{gap:a,sizes:s,totalCount:i},{fixedFooterHeight:c,fixedHeaderHeight:d,headerHeight:m,scrollingInProgress:p,scrollTop:h,viewportHeight:x},{scrollToIndex:f}])=>{const b=Xe();return ke(se(b,Ie(s,x,i,m,d,c,h),Ie(a),ye(([[g,j,k,E,z,A,N,T],H])=>{const{calculateViewLocation:$=x0,done:O,...K}=g,w=qx(g,j,E-1),B=gs(w,j.offsetTree,H)+z+A,M=B+Gn(j.sizeTree,w)[1],V=T+A,I=T+k-N,Z=$({itemBottom:M,itemTop:B,locationParams:K,viewportBottom:I,viewportTop:V});return Z!==null?O&&Vn(se(p,Re(ne=>!ne),va(gt(p)?1:2)),O):O==null||O(),Z}),Re(g=>g!==null)),f),{scrollIntoView:b}},ht(Wn,nn,ks,ba,Ql),{singleton:!0});function qh(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const v0=(a,s)=>typeof a=="function"?qh(a(s)):s&&qh(a),y0=Fe(([{listRefresh:a,totalCount:s,fixedItemSize:i,data:c},{atBottomState:d,isAtBottom:m},{scrollToIndex:p},{scrolledToInitialItem:h},{didMount:x,propsReady:f},{log:b},{scrollingInProgress:g},{context:j},{scrollIntoView:k}])=>{const E=ue(!1),z=Xe();let A=null;function N(O){He(p,{align:"end",behavior:O,index:"LAST"})}Pe(se(Lt(se(Te(s),va(1)),x),Ie(Te(E),m,h,g),ye(([[O,K],w,B,M,V])=>{let I=K&&M,Z="auto";return I&&(Z=v0(w,B||V),I=I&&Z!==!1),{followOutputBehavior:Z,shouldFollow:I,totalCount:O}}),Re(({shouldFollow:O})=>O)),({followOutputBehavior:O,totalCount:K})=>{A!==null&&(A(),A=null),gt(i)!==void 0?requestAnimationFrame(()=>{gt(b)("following output to ",{totalCount:K},Bt.DEBUG),N(O)}):A=Vn(a,()=>{gt(b)("following output to ",{totalCount:K},Bt.DEBUG),N(O),A=null})});function T(O){const K=Vn(d,w=>{O&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&A===null&&(gt(b)("scrolling to bottom due to increased size",{},Bt.DEBUG),N("auto"))});setTimeout(K,100)}Pe(se(Lt(Te(E),s,f),Re(([O,,K])=>O!==!1&&K),Xn(({value:O},[,K])=>({refreshed:O===K,value:K}),{refreshed:!1,value:0}),Re(({refreshed:O})=>O),Ie(E,s)),([,O])=>{gt(h)&&T(O!==!1)}),Pe(z,()=>{T(gt(E)!==!1)}),Pe(Lt(Te(E),d),([O,K])=>{O!==!1&&!K.atBottom&&K.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&N("auto")});const H=ue(null),$=Xe();return ke(Xu(se(Te(c),ye(O=>(O==null?void 0:O.length)??0)),se(Te(s))),$),Pe(se(Lt(se($,va(1)),x),Ie(Te(H),h,g,j),ye(([[O,K],w,B,M,V])=>K&&B&&(w==null?void 0:w({context:V,totalCount:O,scrollingInProgress:M}))),Re(O=>!!O),vl(0)),O=>{A!==null&&(A(),A=null),gt(i)!==void 0?requestAnimationFrame(()=>{gt(b)("scrolling into view",{}),He(k,O)}):A=Vn(a,()=>{gt(b)("scrolling into view",{}),He(k,O),A=null})}),{autoscrollToBottom:z,followOutput:E,scrollIntoViewOnChange:H}},ht(Wn,ws,ks,Ns,Xl,Ql,nn,Zx,Fx)),g0=Fe(([{data:a,firstItemIndex:s,gap:i,sizes:c},{initialTopMostItemIndex:d},{initialItemCount:m,listState:p},{didMount:h}])=>(ke(se(h,Ie(m),Re(([,x])=>x!==0),Ie(d,c,s,i,a),ye(([[,x],f,b,g,j,k=[]])=>Xx(x,f,b,g,j,k))),p),{}),ht(Wn,Ns,ba,Xl),{singleton:!0}),b0=Fe(([{didMount:a},{scrollTo:s},{listState:i}])=>{const c=ue(0);return Pe(se(a,Ie(c),Re(([,d])=>d!==0),ye(([,d])=>({top:d}))),d=>{Vn(se(i,va(1),Re(m=>m.items.length>1)),()=>{requestAnimationFrame(()=>{He(s,d)})})}),{initialScrollTop:c}},ht(Xl,nn,ba),{singleton:!0}),Jx=Fe(([{scrollVelocity:a}])=>{const s=ue(!1),i=Xe(),c=ue(!1);return ke(se(a,Ie(c,s,i),Re(([d,m])=>m!==!1&&m!==void 0),ye(([d,m,p,h])=>{const{enter:x,exit:f}=m;if(p){if(f(d,h))return!1}else if(x(d,h))return!0;return p}),mt()),s),Pe(se(Lt(s,a,i),Ie(c)),([[d,m,p],h])=>{d&&h!==!1&&h!==void 0&&h.change&&h.change(m,p)}),{isSeeking:s,scrollSeekConfiguration:c,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(ws),{singleton:!0}),md=Fe(([{scrollContainerState:a,scrollTo:s}])=>{const i=Xe(),c=Xe(),d=Xe(),m=ue(!1),p=ue(void 0);return ke(se(Lt(i,c),ye(([{scrollTop:h,viewportHeight:x},{offsetTop:f,listHeight:b}])=>({scrollHeight:b,scrollTop:Math.max(0,h-f),viewportHeight:x}))),a),ke(se(s,Ie(c),ye(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),d),{customScrollParent:p,useWindowScroll:m,windowScrollContainerState:i,windowScrollTo:d,windowViewportRect:c}},ht(nn)),j0=Fe(([{sizeRanges:a,sizes:s},{headerHeight:i,scrollTop:c},{initialTopMostItemIndex:d},{didMount:m},{useWindowScroll:p,windowScrollContainerState:h,windowViewportRect:x}])=>{const f=Xe(),b=ue(void 0),g=ue(null),j=ue(null);return ke(h,g),ke(x,j),Pe(se(f,Ie(s,c,p,g,j,i)),([k,E,z,A,N,T,H])=>{const $=a0(E.sizeTree);A&&N!==null&&T!==null&&(z=N.scrollTop-T.offsetTop),z-=H,k({ranges:$,scrollTop:z})}),ke(se(b,Re(sd),ye(S0)),d),ke(se(m,Ie(b),Re(([,k])=>k!==void 0),mt(),ye(([,k])=>k.ranges)),a),{getState:f,restoreStateFrom:b}},ht(Wn,nn,Ns,Xl,md));function S0(a){return{align:"start",index:0,offset:a.scrollTop}}const k0=Fe(([{topItemsIndexes:a}])=>{const s=ue(0);return ke(se(s,Re(i=>i>=0),ye(i=>Array.from({length:i}).map((c,d)=>d))),a),{topItemCount:s}},ht(ba));function Px(a){let s=!1,i;return(()=>(s||(s=!0,i=a()),i))}const N0=Px(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),w0=Fe(([{deviation:a,scrollBy:s,scrollingInProgress:i,scrollTop:c},{isAtBottom:d,isScrolling:m,lastJumpDueToItemResize:p,scrollDirection:h},{listState:x},{beforeUnshiftWith:f,gap:b,shiftWithOffset:g,sizes:j},{log:k},{recalcInProgress:E}])=>{const z=bn(se(x,Ie(p),Xn(([,N,T,H],[{bottom:$,items:O,offsetBottom:K,totalCount:w},B])=>{const M=$+K;let V=0;return T===w&&N.length>0&&O.length>0&&(O[0].originalIndex===0&&N[0].originalIndex===0||(V=M-H,V!==0&&(V+=B))),[V,O,w,M]},[0,[],0,0]),Re(([N])=>N!==0),Ie(c,h,i,d,k,E),Re(([,N,T,H,,,$])=>!$&&!H&&N!==0&&T===bs),ye(([[N],,,,,T])=>(T("Upward scrolling compensation",{amount:N},Bt.DEBUG),N))));function A(N){N>0?(He(s,{behavior:"auto",top:-N}),He(a,0)):(He(a,0),He(s,{behavior:"auto",top:-N}))}return Pe(se(z,Ie(a,m)),([N,T,H])=>{H&&N0()?He(a,T-N):A(-N)}),Pe(se(Lt(Ft(m,!1),a,E),Re(([N,T,H])=>!N&&!H&&T!==0),ye(([N,T])=>T),vl(1)),A),ke(se(g,ye(N=>({top:-N}))),s),Pe(se(f,Ie(j,b),ye(([N,{groupIndices:T,lastSize:H,sizeTree:$},O])=>{function K(I){return I*(H+O)}if(T.length===0)return K(N);let w=0;const B=vs($,0);let M=0,V=0;for(;M<N;){M++,w+=B;let I=T.length===V+1?1/0:T[V+1]-T[V]-1;M+I>N&&(w-=B,I=N-M+1),M+=I,w+=K(I),V++}return w})),N=>{He(a,N),requestAnimationFrame(()=>{He(s,{top:N}),requestAnimationFrame(()=>{He(a,0),He(E,!1)})})}),{deviation:a}},ht(nn,ws,ba,Wn,Ql,cd)),C0=Fe(([a,s,i,c,d,m,p,h,x,f,b])=>({...a,...s,...i,...c,...d,...m,...p,...h,...x,...f,...b}),ht(pd,g0,Xl,Jx,Wx,b0,h0,md,Fx,Ql,Zx)),ev=Fe(([{data:a,defaultItemSize:s,firstItemIndex:i,fixedItemSize:c,fixedGroupSize:d,gap:m,groupIndices:p,heightEstimates:h,itemSize:x,sizeRanges:f,sizes:b,statefulTotalCount:g,totalCount:j,trackItemSizes:k},{initialItemFinalLocationReached:E,initialTopMostItemIndex:z,scrolledToInitialItem:A},N,T,H,$,{scrollToIndex:O},K,{topItemCount:w},{groupCounts:B},M])=>{const{listState:V,minOverscanItemCount:I,topItemsIndexes:Z,rangeChanged:ne,...J}=$;return ke(ne,M.scrollSeekRangeChanged),ke(se(M.windowViewportRect,ye(D=>D.visibleHeight)),N.viewportHeight),{data:a,defaultItemHeight:s,firstItemIndex:i,fixedItemHeight:c,fixedGroupHeight:d,gap:m,groupCounts:B,heightEstimates:h,initialItemFinalLocationReached:E,initialTopMostItemIndex:z,scrolledToInitialItem:A,sizeRanges:f,topItemCount:w,topItemsIndexes:Z,totalCount:j,...H,groupIndices:p,itemSize:x,listState:V,minOverscanItemCount:I,scrollToIndex:O,statefulTotalCount:g,trackItemSizes:k,rangeChanged:ne,...J,...M,...N,sizes:b,...T}},ht(Wn,Ns,nn,j0,y0,ba,ks,w0,k0,Yx,C0));function E0(a,s){const i={},c={};let d=0;const m=a.length;for(;d<m;)c[a[d]]=1,d+=1;for(const p in s)Object.hasOwn(c,p)||(i[p]=s[p]);return i}const Vi=typeof document<"u"?Se.useLayoutEffect:Se.useEffect;function tv(a,s,i){const c=Object.keys(s.required||{}),d=Object.keys(s.optional||{}),m=Object.keys(s.methods||{}),p=Object.keys(s.events||{}),h=Se.createContext({});function x(A,N){A.propsReady!==void 0&&He(A.propsReady,!1);for(const T of c){const H=A[s.required[T]];He(H,N[T])}for(const T of d)if(T in N){const H=A[s.optional[T]];He(H,N[T])}A.propsReady!==void 0&&He(A.propsReady,!0)}function f(A){return m.reduce((N,T)=>(N[T]=H=>{const $=A[s.methods[T]];He($,H)},N),{})}function b(A){return p.reduce((N,T)=>(N[T]=$1(A[s.events[T]]),N),{})}const g=Se.forwardRef(function(A,N){const{children:T,...H}=A,[$]=Se.useState(()=>so(Y1(a),w=>{x(w,H)})),[O]=Se.useState(Lh(b,$));Vi(()=>{for(const w of p)w in H&&Pe(O[w],H[w]);return()=>{Object.values(O).map(id)}},[H,O,$]),Vi(()=>{x($,H)}),Se.useImperativeHandle(N,Dh(f($)));const K=i;return n.jsx(h.Provider,{value:$,children:i!==void 0?n.jsx(K,{...E0([...c,...d,...p],H),children:T}):T})}),j=A=>{const N=Se.useContext(h);return Se.useCallback(T=>{He(N[A],T)},[N,A])},k=A=>{const N=Se.useContext(h)[A],T=Se.useCallback(H=>Pe(N,H),[N]);return Se.useSyncExternalStore(T,()=>gt(N),()=>gt(N))},E=A=>{const N=Se.useContext(h)[A],[T,H]=Se.useState(Lh(gt,N));return Vi(()=>Pe(N,$=>{$!==T&&H(Dh($))}),[N,T]),T},z=parseInt(Se.version)>=18?k:E;return{Component:g,useEmitter:(A,N)=>{const T=Se.useContext(h)[A];Vi(()=>Pe(T,N),[N,T])},useEmitterValue:z,usePublisher:j}}const nv=Se.createContext(void 0),lv=Se.createContext(void 0),_u="-webkit-sticky",Yh="sticky",hd=Px(()=>{if(typeof document>"u")return Yh;const a=document.createElement("div");return a.style.position=_u,a.style.position===_u?_u:Yh}),av=typeof document<"u"?Se.useLayoutEffect:Se.useEffect;function Ou(a){return"self"in a}function T0(a){return"body"in a}function rv(a,s,i,c=mr,d,m){const p=Se.useRef(null),h=Se.useRef(null),x=Se.useRef(null),f=Se.useCallback(j=>{let k,E,z;const A=j.target;if(T0(A)||Ou(A)){const T=Ou(A)?A:A.defaultView;z=m===!0?T.scrollX:T.scrollY,k=m===!0?T.document.documentElement.scrollWidth:T.document.documentElement.scrollHeight,E=m===!0?T.innerWidth:T.innerHeight}else z=m===!0?A.scrollLeft:A.scrollTop,k=m===!0?A.scrollWidth:A.scrollHeight,E=m===!0?A.offsetWidth:A.offsetHeight;const N=()=>{a({scrollHeight:k,scrollTop:Math.max(z,0),viewportHeight:E})};j.suppressFlushSync===!0?N():B1.flushSync(N),h.current!==null&&(z===h.current||z<=0||z===k-E)&&(h.current=null,s(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,s,m]);Se.useEffect(()=>{const j=d||p.current;return c(d||p.current),f({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",f,{passive:!0}),()=>{c(null),j.removeEventListener("scroll",f)}},[p,f,i,c,d]);function b(j){const k=p.current;if(!k||(m===!0?"offsetWidth"in k&&k.offsetWidth===0:"offsetHeight"in k&&k.offsetHeight===0))return;const E=j.behavior==="smooth";let z,A,N;Ou(k)?(A=Math.max(ql(k.document.documentElement,m===!0?"width":"height"),m===!0?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight),z=m===!0?k.innerWidth:k.innerHeight,N=m===!0?window.scrollX:window.scrollY):(A=k[m===!0?"scrollWidth":"scrollHeight"],z=ql(k,m===!0?"width":"height"),N=k[m===!0?"scrollLeft":"scrollTop"]);const T=A-z;if(j.top=Math.ceil(Math.max(Math.min(T,j.top),0)),Qx(z,A)||j.top===N){a({scrollHeight:A,scrollTop:N,viewportHeight:z}),E&&s(!0);return}E?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,s(!0)},1e3)):h.current=null,m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),k.scrollTo(j)}function g(j){m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),p.current.scrollBy(j)}return{scrollByCallback:g,scrollerRef:p,scrollToCallback:b}}function xd(a){return a}const R0=Fe(()=>{const a=ue(h=>`Item ${h}`),s=ue(h=>`Group ${h}`),i=ue({}),c=ue(xd),d=ue("div"),m=ue(mr),p=(h,x=null)=>Ft(se(i,ye(f=>f[h]),mt()),x);return{components:i,computeItemKey:c,EmptyPlaceholder:p("EmptyPlaceholder"),FooterComponent:p("Footer"),GroupComponent:p("Group","div"),groupContent:s,HeaderComponent:p("Header"),HeaderFooterTag:d,ItemComponent:p("Item","div"),itemContent:a,ListComponent:p("List","div"),ScrollerComponent:p("Scroller","div"),scrollerRef:m,ScrollSeekPlaceholder:p("ScrollSeekPlaceholder"),TopItemListComponent:p("TopItemList")}}),A0=Fe(([a,s])=>({...a,...s}),ht(ev,R0)),M0=({height:a})=>n.jsx("div",{style:{height:a}}),z0={overflowAnchor:"none",position:hd(),zIndex:1},sv={overflowAnchor:"none"},D0={...sv,display:"inline-block",height:"100%"},Kh=Se.memo(function({showTopList:a=!1}){const s=De("listState"),i=Ln("sizeRanges"),c=De("useWindowScroll"),d=De("customScrollParent"),m=Ln("windowScrollContainerState"),p=Ln("scrollContainerState"),h=d||c?m:p,x=De("itemContent"),f=De("context"),b=De("groupContent"),g=De("trackItemSizes"),j=De("itemSize"),k=De("log"),E=Ln("gap"),z=De("horizontalDirection"),{callbackRef:A}=X1(i,j,g,a?mr:h,k,E,d,z,De("skipAnimationFrameInResizeObserver")),[N,T]=Se.useState(0);vd("deviation",J=>{N!==J&&T(J)});const H=De("EmptyPlaceholder"),$=De("ScrollSeekPlaceholder")??M0,O=De("ListComponent"),K=De("ItemComponent"),w=De("GroupComponent"),B=De("computeItemKey"),M=De("isSeeking"),V=De("groupIndices").length>0,I=De("alignToBottom"),Z=De("initialItemFinalLocationReached"),ne=a?{}:{boxSizing:"border-box",...z?{display:"inline-block",height:"100%",marginLeft:N!==0?N:I?"auto":0,paddingLeft:s.offsetTop,paddingRight:s.offsetBottom,whiteSpace:"nowrap"}:{marginTop:N!==0?N:I?"auto":0,paddingBottom:s.offsetBottom,paddingTop:s.offsetTop},...Z?{}:{visibility:"hidden"}};return!a&&s.totalCount===0&&H!==null&&H!==void 0?n.jsx(H,{...Zt(H,f)}):n.jsx(O,{...Zt(O,f),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:A,style:ne,children:(a?s.topItems:s.items).map(J=>{const D=J.originalIndex,C=B(D+s.firstItemIndex,J.data,f);return M?y.createElement($,{...Zt($,f),height:J.size,index:J.index,key:C,type:J.type||"item",...J.type==="group"?{}:{groupIndex:J.groupIndex}}):J.type==="group"?y.createElement(w,{...Zt(w,f),"data-index":D,"data-item-index":J.index,"data-known-size":J.size,key:C,style:z0},b(J.index,f)):y.createElement(K,{...Zt(K,f),...B0(K,J.data),"data-index":D,"data-item-group-index":J.groupIndex,"data-item-index":J.index,"data-known-size":J.size,key:C,style:z?D0:sv},V?x(J.index,J.groupIndex,J.data,f):x(J.index,J.data,f))})})}),L0={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},_0={outline:"none",overflowX:"auto",position:"relative"},oo=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),O0={position:hd(),top:0,width:"100%",zIndex:1};function Zt(a,s){if(typeof a!="string")return{context:s}}function B0(a,s){return{item:typeof a=="string"?void 0:s}}const H0=Se.memo(function(){const a=De("HeaderComponent"),s=Ln("headerHeight"),i=De("HeaderFooterTag"),c=ga(Se.useMemo(()=>m=>{s(ql(m,"height"))},[s]),!0,De("skipAnimationFrameInResizeObserver")),d=De("context");return a!=null?n.jsx(i,{ref:c,children:n.jsx(a,{...Zt(a,d)})}):null}),U0=Se.memo(function(){const a=De("FooterComponent"),s=Ln("footerHeight"),i=De("HeaderFooterTag"),c=ga(Se.useMemo(()=>m=>{s(ql(m,"height"))},[s]),!0,De("skipAnimationFrameInResizeObserver")),d=De("context");return a!=null?n.jsx(i,{ref:c,children:n.jsx(a,{...Zt(a,d)})}):null});function iv({useEmitter:a,useEmitterValue:s,usePublisher:i}){return Se.memo(function({children:c,style:d,context:m,...p}){const h=i("scrollContainerState"),x=s("ScrollerComponent"),f=i("smoothScrollTargetReached"),b=s("scrollerRef"),g=s("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:k,scrollToCallback:E}=rv(h,f,x,b,void 0,g);return a("scrollTo",E),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:k,style:{...g?_0:L0,...d},tabIndex:0,...p,...Zt(x,m),children:c})})}function ov({useEmitter:a,useEmitterValue:s,usePublisher:i}){return Se.memo(function({children:c,style:d,context:m,...p}){const h=i("windowScrollContainerState"),x=s("ScrollerComponent"),f=i("smoothScrollTargetReached"),b=s("totalListHeight"),g=s("deviation"),j=s("customScrollParent"),k=Se.useRef(null),E=s("scrollerRef"),{scrollByCallback:z,scrollerRef:A,scrollToCallback:N}=rv(h,f,x,E,j);return av(()=>{var T;return A.current=j||((T=k.current)==null?void 0:T.ownerDocument.defaultView),()=>{A.current=null}},[A,j]),a("windowScrollTo",N),a("scrollBy",z),n.jsx(x,{ref:k,"data-virtuoso-scroller":!0,style:{position:"relative",...d,...b!==0?{height:b+g}:void 0},...p,...Zt(x,m),children:c})})}const I0=({children:a})=>{const s=Se.useContext(nv),i=Ln("viewportHeight"),c=Ln("fixedItemHeight"),d=De("alignToBottom"),m=De("horizontalDirection"),p=Se.useMemo(()=>Dx(i,x=>ql(x,m?"width":"height")),[i,m]),h=ga(p,!0,De("skipAnimationFrameInResizeObserver"));return Se.useEffect(()=>{s&&(i(s.viewportHeight),c(s.itemHeight))},[s,i,c]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:oo(d),children:a})},V0=({children:a})=>{const s=Se.useContext(nv),i=Ln("windowViewportRect"),c=Ln("fixedItemHeight"),d=De("customScrollParent"),m=_x(i,d,De("skipAnimationFrameInResizeObserver")),p=De("alignToBottom");return Se.useEffect(()=>{s&&(c(s.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:s.viewportHeight,visibleWidth:100}))},[s,i,c]),n.jsx("div",{"data-viewport-type":"window",ref:m,style:oo(p),children:a})},G0=({children:a})=>{const s=De("TopItemListComponent")??"div",i=De("headerHeight"),c={...O0,marginTop:`${i}px`},d=De("context");return n.jsx(s,{style:c,...Zt(s,d),children:a})},$0=Se.memo(function(a){const s=De("useWindowScroll"),i=De("topItemsIndexes").length>0,c=De("customScrollParent"),d=De("context");return n.jsxs(c||s?K0:Y0,{...a,context:d,children:[i&&n.jsx(G0,{children:n.jsx(Kh,{showTopList:!0})}),n.jsxs(c||s?V0:I0,{children:[n.jsx(H0,{}),n.jsx(Kh,{}),n.jsx(U0,{})]})]})}),{Component:q0,useEmitter:vd,useEmitterValue:De,usePublisher:Ln}=tv(A0,{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"}},$0),Y0=iv({useEmitter:vd,useEmitterValue:De,usePublisher:Ln}),K0=ov({useEmitter:vd,useEmitterValue:De,usePublisher:Ln}),Q0=q0,X0=Fe(()=>{const a=ue(f=>n.jsxs("td",{children:["Item $",f]})),s=ue(null),i=ue(f=>n.jsxs("td",{colSpan:1e3,children:["Group ",f]})),c=ue(null),d=ue(null),m=ue({}),p=ue(xd),h=ue(mr),x=(f,b=null)=>Ft(se(m,ye(g=>g[f]),mt()),b);return{components:m,computeItemKey:p,context:s,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:d,fixedHeaderContent:c,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")}});ht(ev,X0);hd();const Qh={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},W0={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Xh,floor:eo,max:ms,min:Bu,round:Wh}=Math;function Zh(a,s,i){return Array.from({length:s-a+1}).map((c,d)=>({data:i===null?null:i[d+a],index:d+a}))}function Z0(a){return{...W0,items:a}}function Gi(a,s){return a!==void 0&&a.width===s.width&&a.height===s.height}function F0(a,s){return a!==void 0&&a.column===s.column&&a.row===s.row}const J0=Fe(([{increaseViewportBy:a,listBoundary:s,overscan:i,visibleRange:c},{footerHeight:d,headerHeight:m,scrollBy:p,scrollContainerState:h,scrollTo:x,scrollTop:f,smoothScrollTargetReached:b,viewportHeight:g},j,k,{didMount:E,propsReady:z},{customScrollParent:A,useWindowScroll:N,windowScrollContainerState:T,windowScrollTo:H,windowViewportRect:$},O])=>{const K=ue(0),w=ue(0),B=ue(Qh),M=ue({height:0,width:0}),V=ue({height:0,width:0}),I=Xe(),Z=Xe(),ne=ue(0),J=ue(null),D=ue({column:0,row:0}),C=Xe(),L=Xe(),ae=ue(!1),Q=ue(0),pe=ue(!0),R=ue(!1),X=ue(!1);Pe(se(E,Ie(Q),Re(([ie,be])=>be!==0)),()=>{He(pe,!1)}),Pe(se(Lt(E,pe,V,M,Q,R),Re(([ie,be,Ve,Oe,,ee])=>ie&&!be&&Ve.height!==0&&Oe.height!==0&&!ee)),([,,,,ie])=>{He(R,!0),dd(1,()=>{He(I,ie)}),Vn(se(f),()=>{He(s,[0,0]),He(pe,!0)})}),ke(se(L,Re(ie=>ie!=null&&ie.scrollTop>0),Qn(0)),w),Pe(se(E,Ie(L),Re(([,ie])=>ie!=null)),([,ie])=>{ie&&(He(M,ie.viewport),He(V,ie.item),He(D,ie.gap),ie.scrollTop>0&&(He(ae,!0),Vn(se(f,va(1)),be=>{He(ae,!1)}),He(x,{top:ie.scrollTop})))}),ke(se(M,ye(({height:ie})=>ie)),g),ke(se(Lt(Te(M,Gi),Te(V,Gi),Te(D,(ie,be)=>ie!==void 0&&ie.column===be.column&&ie.row===be.row),Te(f)),ye(([ie,be,Ve,Oe])=>({gap:Ve,item:be,scrollTop:Oe,viewport:ie}))),C),ke(se(Lt(Te(K),c,Te(D,F0),Te(V,Gi),Te(M,Gi),Te(J),Te(w),Te(ae),Te(pe),Te(Q)),Re(([,,,,,,,ie])=>!ie),ye(([ie,[be,Ve],Oe,ee,ce,oe,fe,,ve,Le])=>{const{column:Ae,row:ut}=Oe,{height:Jt,width:ot}=ee,{width:Vt}=ce;if(fe===0&&(ie===0||Vt===0))return Qh;if(ot===0){const tt=fd(Le,ie),Wl=tt+Math.max(fe-1,0);return Z0(Zh(tt,Wl,oe))}const Gt=cv(Vt,ot,Ae);let et,jt;ve?be===0&&Ve===0&&fe>0?(et=0,jt=fe-1):(et=Gt*eo((be+ut)/(Jt+ut)),jt=Gt*Xh((Ve+ut)/(Jt+ut))-1,jt=Bu(ie-1,ms(jt,Gt-1)),et=Bu(jt,ms(0,et))):(et=0,jt=-1);const he=Zh(et,jt,oe),{bottom:Rt,top:Me}=Fh(ce,Oe,ee,he),xt=Xh(ie/Gt),Xt=xt*Jt+(xt-1)*ut-Rt;return{bottom:Rt,itemHeight:Jt,items:he,itemWidth:ot,offsetBottom:Xt,offsetTop:Me,top:Me}})),B),ke(se(J,Re(ie=>ie!==null),ye(ie=>ie.length)),K),ke(se(Lt(M,V,B,D),Re(([ie,be,{items:Ve}])=>Ve.length>0&&be.height!==0&&ie.height!==0),ye(([ie,be,{items:Ve},Oe])=>{const{bottom:ee,top:ce}=Fh(ie,Oe,be,Ve);return[ce,ee]}),mt(ys)),s);const re=ue(!1);ke(se(f,Ie(re),ye(([ie,be])=>be||ie!==0)),re);const de=bn(se(Lt(B,K),Re(([{items:ie}])=>ie.length>0),Ie(re),Re(([[ie,be],Ve])=>{const Oe=ie.items[ie.items.length-1].index===be-1;return(Ve||ie.bottom>0&&ie.itemHeight>0&&ie.offsetBottom===0&&ie.items.length===be)&&Oe}),ye(([[,ie]])=>ie-1),mt())),xe=bn(se(Te(B),Re(({items:ie})=>ie.length>0&&ie[0].index===0),Qn(0),mt())),me=bn(se(Te(B),Ie(ae),Re(([{items:ie},be])=>ie.length>0&&!be),ye(([{items:ie}])=>({endIndex:ie[ie.length-1].index,startIndex:ie[0].index})),mt(Vx),vl(0)));ke(me,k.scrollSeekRangeChanged),ke(se(I,Ie(M,V,K,D),ye(([ie,be,Ve,Oe,ee])=>{const ce=Kx(ie),{align:oe,behavior:fe,offset:ve}=ce;let Le=ce.index;Le==="LAST"&&(Le=Oe-1),Le=ms(0,Le,Bu(Oe-1,Le));let Ae=Pu(be,ee,Ve,Le);return oe==="end"?Ae=Wh(Ae-be.height+Ve.height):oe==="center"&&(Ae=Wh(Ae-be.height/2+Ve.height/2)),ve!==void 0&&ve!==0&&(Ae+=ve),{behavior:fe,top:Ae}})),x);const Ne=Ft(se(B,ye(ie=>ie.offsetBottom+ie.bottom)),0);return ke(se($,ye(ie=>({height:ie.visibleHeight,width:ie.visibleWidth}))),M),{customScrollParent:A,data:J,deviation:ne,footerHeight:d,gap:D,headerHeight:m,increaseViewportBy:a,initialItemCount:w,itemDimensions:V,overscan:i,restoreStateFrom:L,scrollBy:p,scrollContainerState:h,scrollHeight:Z,scrollTo:x,scrollToIndex:I,scrollTop:f,smoothScrollTargetReached:b,totalCount:K,useWindowScroll:N,viewportDimensions:M,windowScrollContainerState:T,windowScrollTo:H,windowViewportRect:$,...k,gridState:B,horizontalDirection:X,initialTopMostItemIndex:Q,totalListHeight:Ne,...j,endReached:de,propsReady:z,rangeChanged:me,startReached:xe,stateChanged:C,stateRestoreInProgress:ae,...O}},ht(pd,nn,ws,Jx,Xl,md,Ql));function cv(a,s,i){return ms(1,eo((a+i)/(eo(s)+i)))}function Fh(a,s,i,c){const{height:d}=i;if(d===void 0||c.length===0)return{bottom:0,top:0};const m=Pu(a,s,i,c[0].index);return{bottom:Pu(a,s,i,c[c.length-1].index)+d,top:m}}function Pu(a,s,i,c){const d=cv(a.width,i.width,s.column),m=eo(c/d),p=m*i.height+ms(0,m-1)*s.row;return p>0?p+s.row:p}const P0=Fe(()=>{const a=ue(g=>`Item ${g}`),s=ue({}),i=ue(null),c=ue("virtuoso-grid-item"),d=ue("virtuoso-grid-list"),m=ue(xd),p=ue("div"),h=ue(mr),x=(g,j=null)=>Ft(se(s,ye(k=>k[g]),mt()),j),f=ue(!1),b=ue(!1);return ke(Te(b),f),{components:s,computeItemKey:m,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:p,itemClassName:c,ItemComponent:x("Item","div"),itemContent:a,listClassName:d,ListComponent:x("List","div"),readyStateChanged:f,reportReadyState:b,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),eb=Fe(([a,s])=>({...a,...s}),ht(J0,P0)),tb=Se.memo(function(){const a=yt("gridState"),s=yt("listClassName"),i=yt("itemClassName"),c=yt("itemContent"),d=yt("computeItemKey"),m=yt("isSeeking"),p=_n("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),f=yt("ScrollSeekPlaceholder"),b=yt("context"),g=_n("itemDimensions"),j=_n("gap"),k=yt("log"),E=yt("stateRestoreInProgress"),z=_n("reportReadyState"),A=ga(Se.useMemo(()=>N=>{const T=N.parentElement.parentElement.scrollHeight;p(T);const H=N.firstChild;if(H!==null){const{height:$,width:O}=H.getBoundingClientRect();g({height:$,width:O})}j({column:Jh("column-gap",getComputedStyle(N).columnGap,k),row:Jh("row-gap",getComputedStyle(N).rowGap,k)})},[p,g,j,k]),!0,!1);return av(()=>{a.itemHeight>0&&a.itemWidth>0&&z(!0)},[a]),E?null:n.jsx(x,{className:s,ref:A,...Zt(x,b),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(N=>{const T=d(N.index,N.data,b);return m?n.jsx(f,{...Zt(f,b),height:a.itemHeight,index:N.index,width:a.itemWidth},T):y.createElement(h,{...Zt(h,b),className:i,"data-index":N.index,key:T},c(N.index,N.data,b))})})}),nb=Se.memo(function(){const a=yt("HeaderComponent"),s=_n("headerHeight"),i=yt("headerFooterTag"),c=ga(Se.useMemo(()=>m=>{s(ql(m,"height"))},[s]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:c,children:n.jsx(a,{...Zt(a,d)})}):null}),lb=Se.memo(function(){const a=yt("FooterComponent"),s=_n("footerHeight"),i=yt("headerFooterTag"),c=ga(Se.useMemo(()=>m=>{s(ql(m,"height"))},[s]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:c,children:n.jsx(a,{...Zt(a,d)})}):null}),ab=({children:a})=>{const s=Se.useContext(lv),i=_n("itemDimensions"),c=_n("viewportDimensions"),d=ga(Se.useMemo(()=>m=>{c(m.getBoundingClientRect())},[c]),!0,!1);return Se.useEffect(()=>{s&&(c({height:s.viewportHeight,width:s.viewportWidth}),i({height:s.itemHeight,width:s.itemWidth}))},[s,c,i]),n.jsx("div",{ref:d,style:oo(!1),children:a})},rb=({children:a})=>{const s=Se.useContext(lv),i=_n("windowViewportRect"),c=_n("itemDimensions"),d=yt("customScrollParent"),m=_x(i,d,!1);return Se.useEffect(()=>{s&&(c({height:s.itemHeight,width:s.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:s.viewportHeight,visibleWidth:s.viewportWidth}))},[s,i,c]),n.jsx("div",{ref:m,style:oo(!1),children:a})},sb=Se.memo(function({...a}){const s=yt("useWindowScroll"),i=yt("customScrollParent"),c=i||s?ob:ib,d=i||s?rb:ab,m=yt("context");return n.jsx(c,{...a,...Zt(c,m),children:n.jsxs(d,{children:[n.jsx(nb,{}),n.jsx(tb,{}),n.jsx(lb,{})]})})}),{useEmitter:uv,useEmitterValue:yt,usePublisher:_n}=tv(eb,{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"}},sb),ib=iv({useEmitter:uv,useEmitterValue:yt,usePublisher:_n}),ob=ov({useEmitter:uv,useEmitterValue:yt,usePublisher:_n});function Jh(a,s,i){return s!=="normal"&&(s==null?void 0:s.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,s,Bt.WARN),s==="normal"?0:parseInt(s??"0",10)}const cb={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},ub={source:"Own",installed:"Installed"};function db(a){try{const s=localStorage.getItem(a);if(s!=null)return s==="true"}catch{}try{if(typeof sessionStorage<"u"){const s=sessionStorage.getItem(a);if(s!=null)return s==="true"}}catch{}return!1}function fb(a,s){const i=s?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function Ph({origin:a,count:s,filteredCount:i,children:c}){const d=cb[a],[m,p]=y.useState(()=>db(d)),h=y.useCallback(()=>{p(g=>{const j=!g;return fb(d,j),j})},[d]),x=ub[a],f=`sidebar-section-${a}-header`,b=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":f,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:f,type:"button","data-testid":"sidebar-section-header","aria-expanded":!m,"aria-controls":b,onClick:h,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(pb,{collapsed:m}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:x}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==s?`(${i} of ${s})`:`(${s})`})]}),!m&&n.jsx("div",{id:b,role:"group","aria-labelledby":f,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function pb({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 mb(a,s){const i=s.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function hb({value:a,onChange:s,placeholder:i="Filter skills…",validationPattern:c,validationMessage:d="Invalid filter expression"}){const m=y.useRef(null),p=y.useId(),h=!!c&&a.trim()!==""&&!c.test(a);return y.useEffect(()=>{function x(f){var j;if(f.key!=="/")return;const b=f.target;if(!b)return;const g=b.tagName;g==="INPUT"||g==="TEXTAREA"||b.isContentEditable||(f.preventDefault(),(j=m.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:m,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?p:void 0,value:a,placeholder:i,onChange:x=>s(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(s(""),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:p,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 dv({skill:a,isSelected:s,onSelect:i,onContextMenu:c}){const d=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:c?m=>{m.preventDefault(),c(m,a)}:void 0,"aria-current":s?"true":void 0,"aria-selected":!!s,"data-testid":"skill-row","data-selected":s,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:s?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:s?"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",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),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.updateAvailable&&n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",color:"var(--accent-surface)",padding:"1px 6px",border:"1px solid var(--accent-surface)",borderRadius:4,flexShrink:0,textTransform:"lowercase"},title:a.latestVersion?`Update available: ${a.latestVersion}`:"Update available",children:[n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]}),"update"]})]})}function xb({plugin:a,skills:s,selectedKey:i,onSelect:c,onContextMenu:d}){const m=[...s].sort((p,h)=>p.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${s.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:["(",s.length,")"]})]}),n.jsx("div",{role:"list",children:m.map(p=>{const h=!!i&&i.plugin===p.plugin&&i.skill===p.skill;return n.jsx("div",{role:"listitem",children:n.jsx(dv,{skill:p,isSelected:h,onSelect:()=>c(p),onContextMenu:d})},`${p.plugin}/${p.skill}`)})})]})}function vb(){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 yb(a){const s=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,c=!!a.ctrl,d=!!a.shift,m=!!a.alt,p=a.key;if(s.length>1){for(const h of s.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?c=!0:x==="shift"?d=!0:(x==="alt"||x==="option")&&(m=!0)}p=s[s.length-1]}return{key:p.length===1?p.toLowerCase():p,meta:i,ctrl:c,shift:d,alt:m,allowInInputs:!!a.allowInInputs,handler:a.handler}}function gb(a){if(!a||!(a instanceof HTMLElement))return!1;const s=a.tagName;if(s==="INPUT"||s==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function bb(a,s){const i=!!a.metaKey,c=!!a.ctrlKey,d=!!a.shiftKey,m=!!a.altKey;return i!==s.meta||c!==s.ctrl||d!==s.shift||m!==s.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===s.key}function fv(a,s={}){const{enabled:i=!0,target:c}=s,d=y.useRef([]),m=Array.isArray(a)?a:[a];d.current=m.map(yb),y.useEffect(()=>{if(!i)return;const p=c??(typeof window<"u"?window:void 0);if(!p)return;function h(x){const f=x,b=gb(f.target);for(const g of d.current){if(!bb(f,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(b&&!g.allowInInputs&&!j)){g.handler(f);return}}}return p.addEventListener("keydown",h),()=>{p.removeEventListener("keydown",h)}},[i,c])}const jb=200;function Sb(a,s){const i=[],c=[];for(const m of a)(m.origin==="installed"?c:i).push(m);function d(m){var f;const p=m.filter(b=>mb(b,s)),h={};for(const b of p)(h[f=b.plugin]||(h[f]=[])).push(b);const x=Object.entries(h).sort((b,g)=>b[0].localeCompare(g[0]));return{total:m.length,filtered:p.length,byPlugin:x}}return{own:d(i),installed:d(c)}}function kb({skills:a,selectedKey:s,onSelect:i,isLoading:c,error:d,onRetry:m,onContextMenu:p}){const[h,x]=y.useState(""),f=y.useDeferredValue(h),{own:b,installed:g}=y.useMemo(()=>Sb(a,f),[a,f]),k=b.filtered+g.filtered>=jb,E=y.useMemo(()=>{const N=T=>{const H=[];for(const[,$]of T){const O=[...$].sort((K,w)=>K.skill.localeCompare(w.skill));H.push(...O)}return H};return[...N(b.byPlugin),...N(g.byPlugin)]},[b.byPlugin,g.byPlugin]),z=y.useMemo(()=>s?E.findIndex(N=>N.plugin===s.plugin&&N.skill===s.skill):-1,[E,s]),A=y.useCallback(N=>{if(E.length===0)return;const T=z<0?N>0?0:E.length-1:Math.min(Math.max(z+N,0),E.length-1);i(E[T])},[E,z,i]);return fv([{key:"j",handler:()=>A(1)},{key:"k",handler:()=>A(-1)},{key:"Enter",handler:()=>{z>=0&&i(E[z])}}],{enabled:!c&&!d}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[n.jsx(hb,{value:h,onChange:x}),c&&n.jsx(Tb,{}),!c&&d&&n.jsx(Rb,{error:d,onRetry:m}),!c&&!d&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Ph,{origin:"source",count:b.total,filteredCount:h?b.filtered:null,children:b.filtered===0?n.jsx(wb,{queryActive:!!h}):n.jsx(ex,{items:b.byPlugin,selectedKey:s,onSelect:i,onContextMenu:p,useVirtual:k})}),n.jsx(Eb,{}),n.jsx(Ph,{origin:"installed",count:g.total,filteredCount:h?g.filtered:null,children:g.filtered===0?n.jsx(Cb,{queryActive:!!h}):n.jsx(ex,{items:g.byPlugin,selectedKey:s,onSelect:i,onContextMenu:p,useVirtual:k})})]})]})}function Nb(a){const s=[];for(const[i,c]of a){const d=[...c].sort((m,p)=>m.skill.localeCompare(p.skill));s.push({kind:"header",plugin:i,count:d.length});for(const m of d)s.push({kind:"row",skill:m})}return s}function ex({items:a,selectedKey:s,onSelect:i,onContextMenu:c,useVirtual:d}){if(d){const m=Nb(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(Q0,{overscan:4,totalCount:m.length,itemContent:p=>{const h=m[p];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,f=!!s&&s.plugin===x.plugin&&s.skill===x.skill;return n.jsx(dv,{skill:x,isSelected:f,onSelect:()=>i(x),onContextMenu:c})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([m,p])=>n.jsx(xb,{plugin:m,skills:p,selectedKey:s,onSelect:i,onContextMenu:c},m))})}function wb({queryActive:a}){return a?n.jsx(to,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(to,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(pv,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Cb({queryActive:a}){return a?n.jsx(to,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(to,{headline:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(pv,{children:"vskill install <plugin>"})," to add one."]})})}function to({headline:a,body:s}){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:s})]})}function pv({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 Eb(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function Tb(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(vb,{},a))})}function Rb({error:a,onRetry:s}){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:Ab(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})]}),s&&n.jsx("button",{type:"button",onClick:s,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 Ab(a){const s=a.split(`
51
- `)[0]??a;return s.length>80?s.slice(0,77)+"…":s}const mv=240,hv=480,xv="vskill-sidebar-width",hs=320;function yd(a){return Number.isFinite(a)?Math.round(Math.max(mv,Math.min(hv,a))):hs}function Mb(){try{const a=localStorage.getItem(xv);if(!a)return hs;const s=Number(a);return Number.isFinite(s)?yd(s):hs}catch{return hs}}function zb(a){try{localStorage.setItem(xv,String(yd(a)))}catch{}}function Db({initialWidth:a,onChange:s}){const i=y.useRef({startX:0,startWidth:a,pointerId:null}),c=y.useRef(a);return y.useEffect(()=>{c.current=a},[a]),y.useEffect(()=>{function d(p){if(i.current.pointerId==null||p.pointerId!==i.current.pointerId)return;const h=p.clientX-i.current.startX,x=yd(i.current.startWidth+h);c.current=x,s(x)}function m(p){i.current.pointerId==null||p.pointerId!==i.current.pointerId||(i.current.pointerId=null,zb(c.current))}return window.addEventListener("pointermove",d),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[s]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":mv,"aria-valuemax":hv,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:d=>{const m=d.currentTarget;i.current.startX=d.clientX,i.current.startWidth=c.current,i.current.pointerId=d.pointerId;try{m.setPointerCapture(d.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function Lb({connected:a,hint:s,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…"}),s&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:s}),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 vv(a){if(a!==void 0)try{return JSON.stringify(a)}catch(s){console.error("Failed to serialize request body:",s);try{const i=new WeakSet;return JSON.stringify(a,(c,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 Hu(){const[a,s]=y.useState([]),[i,c]=y.useState(!1),[d,m]=y.useState(!1),[p,h]=y.useState(null),x=y.useRef(null),f=y.useCallback(async(g,j)=>{s([]),c(!0),m(!1),h(null);const k=new AbortController;x.current=k;try{const E=vv(j),z=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:E,signal:k.signal});if(!z.ok||!z.body){let $=`HTTP ${z.status}`;try{const O=await z.json();O.error&&($=O.error)}catch{}throw new Error($)}const A=z.body.getReader(),N=new TextDecoder;let T="",H="";for(;;){const{done:$,value:O}=await A.read();if($)break;T+=N.decode(O,{stream:!0});const K=T.split(`
52
- `);T=K.pop()||"";for(const w of K)if(w.startsWith("event: "))H=w.slice(7).trim();else if(w.startsWith("data: ")){try{const B=JSON.parse(w.slice(6)),M={event:H,data:B};H==="done"?(m(!0),s(V=>[...V,M])):s(V=>[...V,M])}catch{}H=""}}}catch(E){E.name!=="AbortError"&&h(E.message)}finally{c(!1),x.current=null}},[]),b=y.useCallback(()=>{var g;(g=x.current)==null||g.abort()},[]);return{events:a,running:i,done:d,error:p,start:f,stop:b}}function _b(a){const s=y.useRef(a);s.current=a;const[i,c]=y.useState(new Set),d=y.useRef(new Map),m=y.useCallback(async(f,b,g)=>{var k;(k=d.current.get(f))==null||k.abort();const j=new AbortController;d.current.set(f,j),c(E=>{const z=new Set(E);return z.add(f),z});try{const E=vv(g),z=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:E,signal:j.signal});if(!z.ok||!z.body){let $=`HTTP ${z.status}`;try{const O=await z.json();O.error&&($=O.error)}catch{}throw new Error($)}const A=z.body.getReader(),N=new TextDecoder;let T="",H="";for(;;){const{done:$,value:O}=await A.read();if($)break;T+=N.decode(O,{stream:!0});const K=T.split(`
53
- `);T=K.pop()||"";for(const w of K)if(w.startsWith("event: "))H=w.slice(7).trim();else if(w.startsWith("data: ")){try{const B=JSON.parse(w.slice(6)),M={event:H,data:B};s.current.onEvent(f,M)}catch{}H=""}}s.current.onDone(f)}catch(E){E.name!=="AbortError"&&s.current.onError(f,E.message)}finally{c(E=>{const z=new Set(E);return z.delete(f),z}),d.current.delete(f)}},[]),p=y.useCallback(f=>{var b;(b=d.current.get(f))==null||b.abort()},[]),h=y.useCallback(()=>{for(const f of d.current.values())f.abort()},[]),x=i.size>0;return{runningSet:i,startCase:m,stopCase:p,stopAll:h,isAnyCaseRunning:x}}const Ob={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 Bb(a,s){var i,c;switch(s.type){case"SET_LOADING":return{...a,loading:s.loading};case"SET_ERROR":return{...a,error:s.error};case"INIT_DATA":{const d=new Map;if(s.benchmark)for(const p of s.benchmark.cases)d.set(p.eval_id,{status:p.status,passRate:p.pass_rate,errorMessage:p.error_message||void 0,durationMs:p.durationMs,tokens:p.tokens,output:p.output,assertions:p.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const m=((c=(i=s.evals)==null?void 0:i.evals[0])==null?void 0:c.id)??null;return{...a,skillContent:s.skillContent,savedContent:s.skillContent,isDirty:!1,evals:s.evals,evalsError:s.evalsError??null,latestBenchmark:s.benchmark,inlineResults:d,selectedCaseId:m,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:s.panel};case"SET_CONTENT":return{...a,skillContent:s.content,isDirty:s.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:s.evals};case"SELECT_CASE":return{...a,selectedCaseId:s.caseId};case"CASE_RUN_START":{const d=new Map(a.caseRunStates);return d.set(s.caseId,{status:"running",startedAt:Date.now(),mode:s.mode}),{...a,caseRunStates:d,runMode:s.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const d=new Map(a.caseRunStates),m=d.get(s.caseId);d.set(s.caseId,{status:"complete",mode:m==null?void 0:m.mode});const p=new Map(a.inlineResults);return p.set(s.caseId,s.result),{...a,caseRunStates:d,inlineResults:p}}case"CASE_RUN_ERROR":{const d=new Map(a.caseRunStates),m=d.get(s.caseId);d.set(s.caseId,{status:"error",mode:m==null?void 0:m.mode});const p=new Map(a.inlineResults);return p.set(s.caseId,{status:"error",errorMessage:s.error,assertions:[]}),{...a,caseRunStates:d,inlineResults:p}}case"CASE_RUN_CANCEL":{const d=new Map(a.caseRunStates),m=d.get(s.caseId);return d.set(s.caseId,{status:"cancelled",mode:m==null?void 0:m.mode}),{...a,caseRunStates:d}}case"BULK_RUN_START":{const d=new Map(a.caseRunStates);for(const m of s.caseIds)d.set(m,{status:"queued",mode:s.mode});return{...a,caseRunStates:d,bulkRunActive:!0,runMode:s.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:s.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const d=new Map(a.caseRunStates);for(const[m,p]of d)(p.status==="running"||p.status==="queued")&&d.set(m,{status:"cancelled"});return{...a,caseRunStates:d,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const d=new Map(a.inlineResults);return d.set(s.evalId,s.result),{...a,inlineResults:d}}case"OPEN_IMPROVE":return{...a,improveTarget:s.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,s.entry]};case"AI_EDIT_RESULT":{const d=s.evalChanges??[],m=new Map;for(let p=0;p<d.length;p++)m.set(p,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:s.improved,reasoning:s.reasoning,evalChanges:d},aiEditEvalChanges:d,aiEditEvalSelections:m}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:s.message,aiEditClassifiedError:s.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,s.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:s.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:s.classified};case"TOGGLE_EVAL_CHANGE":{const d=new Map(a.aiEditEvalSelections);return d.set(s.index,!d.get(s.index)),{...a,aiEditEvalSelections:d}}case"SELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const m of d.keys())d.set(m,!0);return{...a,aiEditEvalSelections:d}}case"DESELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const m of d.keys())d.set(m,!1);return{...a,aiEditEvalSelections:d}}case"SET_EVALS_RETRY":return{...a,aiEditEvalsRetry:s.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:s.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:s.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,s.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:s.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${s.index}/${s.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:s.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:s.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:s.runs,activationHistoryLoading:!1};default:return a}}function Hb(a){if(a==="unit"||a==="integration")return a}function Ub(a,s){const i=s.data;if(s.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),s.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),s.event==="assertion_result"){const c={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(d=>d.assertion_id===c.assertion_id)||a.assertions.push(c)}s.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 yv=y.createContext(null);function Sn(){const a=y.useContext(yv);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function tx({plugin:a,skill:s,origin:i,children:c}){const d=i==="installed",[m,p]=y.useReducer(Bb,{...Ob,plugin:a,skill:s}),h=y.useRef(new Set),x=y.useRef(new Set),f=y.useRef(new Map),b=y.useCallback((ee,ce)=>{let oe=f.current.get(ee);oe||(oe={assertions:[]},f.current.set(ee,oe)),Ub(oe,ce),p({type:"UPDATE_INLINE_RESULT",evalId:ee,result:{...oe,assertions:[...oe.assertions]}})},[]),g=y.useCallback(ee=>{if(x.current.has(ee))return;x.current.add(ee);const ce=f.current.get(ee)??{assertions:[]};p({type:"CASE_RUN_COMPLETE",caseId:ee,result:{...ce,assertions:[...ce.assertions]}}),h.current.has(ee)&&(h.current.delete(ee),h.current.size===0&&we.getLatestBenchmark(a,s).then(oe=>p({type:"BULK_RUN_COMPLETE",benchmark:oe})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,s]),j=y.useCallback((ee,ce)=>{x.current.has(ee)||(x.current.add(ee),p({type:"CASE_RUN_ERROR",caseId:ee,error:ce}),h.current.has(ee)&&(h.current.delete(ee),h.current.size===0&&we.getLatestBenchmark(a,s).then(oe=>p({type:"BULK_RUN_COMPLETE",benchmark:oe})).catch(()=>p({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,s]),{startCase:k,stopCase:E,stopAll:z}=_b({onEvent:b,onDone:g,onError:j});y.useEffect(()=>()=>{z()},[z]);const A=y.useCallback(async()=>{try{const ee=await fetch(`/api/skills/${a}/${s}/activation-history`);if(!ee.ok){if(ee.status===404){p({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const ce=await ee.json();p({type:"ACTIVATION_HISTORY_LOADED",runs:ce.runs||[]})}catch{}},[a,s]);y.useEffect(()=>{let ee=!1;async function ce(){try{const[oe,fe,ve]=await Promise.allSettled([we.getSkillDetail(a,s),we.getEvals(a,s),we.getLatestBenchmark(a,s)]);if(ee)return;let Le=null,Ae=null;if(fe.status==="fulfilled")Le=fe.value;else{const ut=fe.reason;(ut==null?void 0:ut.status)!==404&&(Ae=(ut==null?void 0:ut.message)??"Failed to load test cases")}p({type:"INIT_DATA",skillContent:oe.status==="fulfilled"?oe.value.skillContent:"",evals:Le,evalsError:Ae,benchmark:ve.status==="fulfilled"?ve.value:null})}catch(oe){ee||p({type:"SET_ERROR",error:oe.message})}}return ce(),A(),()=>{ee=!0}},[a,s,A]);const N=y.useCallback(async()=>{if(!d)try{await we.applyImprovement(a,s,m.skillContent),p({type:"CONTENT_SAVED"})}catch(ee){p({type:"SET_ERROR",error:ee.message})}},[d,a,s,m.skillContent]),T=y.useCallback(async ee=>{if(!d)try{const ce=await we.saveEvals(a,s,ee);p({type:"SET_EVALS",evals:ce})}catch(ce){p({type:"SET_ERROR",error:ce.message})}},[d,a,s]),H=y.useCallback((ee,ce="benchmark")=>{if(d)return;const oe=m.caseRunStates.get(ee);if((oe==null?void 0:oe.status)!=="running")if(f.current.delete(ee),x.current.delete(ee),p({type:"CASE_RUN_START",caseId:ee,mode:ce}),ce==="comparison"){const fe=`/api/skills/${a}/${s}/compare`;k(ee,fe,{eval_ids:[ee]})}else{const fe=`/api/skills/${a}/${s}/benchmark/case/${ee}`;k(ee,fe,ce==="baseline"?{baseline_only:!0}:void 0)}},[d,a,s,m.caseRunStates,k]),$=y.useCallback((ee="benchmark")=>{var fe;if(d)return;const ce=((fe=m.evals)==null?void 0:fe.evals)??[];if(ce.length===0)return;const oe=ce.map(ve=>ve.id);for(const ve of oe)f.current.delete(ve),x.current.delete(ve);p({type:"BULK_RUN_START",caseIds:oe,mode:ee}),h.current=new Set(oe);for(const ve of oe)if(ee==="comparison")k(ve,`/api/skills/${a}/${s}/compare`,{eval_ids:[ve]});else{const Le=`/api/skills/${a}/${s}/benchmark/case/${ve}`;k(ve,Le,ee==="baseline"?{baseline_only:!0}:void 0)}},[d,a,s,m.evals,k]),O=y.useCallback(ee=>{E(ee),p({type:"CASE_RUN_CANCEL",caseId:ee}),h.current.delete(ee),x.current.add(ee)},[E]),K=y.useCallback(()=>{z(),p({type:"CANCEL_ALL"}),h.current.clear()},[z]),w=y.useCallback(async(ee,ce)=>{p({type:"OPEN_IMPROVE",evalId:ee})},[]),B=y.useCallback(async(ee,ce)=>{try{await we.applyImprovement(a,s,ce),p({type:"SET_CONTENT",content:ce}),p({type:"CONTENT_SAVED"}),p({type:"CLOSE_IMPROVE"}),H(ee,"benchmark")}catch(oe){p({type:"SET_ERROR",error:oe.message})}},[a,s,H]),M=Hu(),V=y.useRef(null),I=y.useRef(0);y.useEffect(()=>{const ee=M.events;for(let ce=I.current;ce<ee.length;ce++){const oe=ee[ce],fe=oe.data;if(oe.event==="progress"&&p({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:fe.phase,message:fe.message}}),oe.event==="done"){const ve=fe.improved,Le=fe.reasoning,Ae=fe.evalChanges??[];p({type:"AI_EDIT_RESULT",improved:ve,reasoning:Le,evalChanges:Ae})}if(oe.event==="error"){const ve=fe;p({type:"AI_EDIT_ERROR",message:ve.description||"Unknown error",classified:ve})}}I.current=ee.length},[M.events]),y.useEffect(()=>{M.error&&p({type:"AI_EDIT_ERROR",message:M.error})},[M.error]),y.useEffect(()=>()=>{M.stop()},[M.stop]);const Z=y.useCallback(async(ee,ce,oe)=>{d||(I.current=0,p({type:"AI_EDIT_LOADING"}),V.current=M.stop,M.start(`/api/skills/${a}/${s}/improve?sse`,{mode:"instruct",instruction:ee,content:m.skillContent,evals:m.evals??{skill_name:s,evals:[]},provider:ce,model:oe}))},[d,a,s,m.skillContent,m.evals,M]),ne=y.useCallback(()=>{M.stop(),p({type:"AI_EDIT_ERROR",message:"Cancelled"})},[M]),J=y.useCallback(async()=>{const ee=m.aiEditResult;if(ee!=null&&ee.improved)try{if(await we.applyImprovement(a,s,ee.improved),p({type:"SET_CONTENT",content:ee.improved}),p({type:"CONTENT_SAVED"}),m.aiEditEvalChanges.length>0&&Array.from(m.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:oe}=await Nx(async()=>{const{mergeEvalChanges:Le}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Le}},[]),fe=m.evals??{skill_name:s,evals:[]},ve=oe(fe,m.aiEditEvalChanges,m.aiEditEvalSelections);try{const Le=await we.saveEvals(a,s,ve);p({type:"SET_EVALS",evals:Le})}catch(Le){p({type:"SET_EVALS_RETRY",evalsFile:ve}),p({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Le.message}. You can retry from the AI Edit panel.`});return}}p({type:"CLOSE_AI_EDIT"})}catch(ce){p({type:"SET_ERROR",error:ce.message})}},[a,s,m.aiEditResult,m.evals,m.aiEditEvalChanges,m.aiEditEvalSelections]),D=y.useCallback(()=>{p({type:"CLOSE_AI_EDIT"})},[]),C=y.useCallback(ee=>{p({type:"TOGGLE_EVAL_CHANGE",index:ee})},[]),L=y.useCallback(()=>{p({type:"SELECT_ALL_EVAL_CHANGES"})},[]),ae=y.useCallback(()=>{p({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Q=y.useCallback(async()=>{const ee=m.aiEditEvalsRetry;if(ee)try{const ce=await we.saveEvals(a,s,ee);p({type:"SET_EVALS",evals:ce}),p({type:"SET_ERROR",error:null}),p({type:"CLOSE_AI_EDIT"})}catch(ce){p({type:"SET_ERROR",error:`Retry failed: ${ce.message}`})}},[a,s,m.aiEditEvalsRetry]),pe=y.useCallback(async()=>{try{const ee=await we.getSkillDetail(a,s);p({type:"SET_CONTENT",content:ee.skillContent}),p({type:"CONTENT_SAVED"})}catch{}},[a,s]),{config:R}=Yl(),X=Hu(),re=y.useRef(0);y.useEffect(()=>{const ee=X.events;for(let ce=re.current;ce<ee.length;ce++){const oe=ee[ce],fe=oe.data;if(oe.event==="progress"&&p({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:fe.phase,message:fe.message}}),oe.event==="done"){const ve=fe;we.saveEvals(a,s,ve).then(Le=>p({type:"GENERATE_EVALS_DONE",evals:Le})).catch(Le=>p({type:"SET_ERROR",error:Le.message}))}oe.event==="error"&&p({type:"GENERATE_EVALS_ERROR",classified:fe})}re.current=ee.length},[X.events,a,s]),y.useEffect(()=>{X.error&&p({type:"SET_ERROR",error:X.error})},[X.error]),y.useEffect(()=>()=>{X.stop()},[X.stop]);const de=y.useCallback(async ee=>{if(d)return;re.current=0,p({type:"GENERATE_EVALS_START"});const ce={};R!=null&&R.provider&&(ce.provider=R.provider),R!=null&&R.model&&(ce.model=R.model);const oe=Hb(ee==null?void 0:ee.testType);oe&&(ce.testType=oe),X.start(`/api/skills/${a}/${s}/generate-evals?sse`,Object.keys(ce).length>0?ce:void 0)},[d,a,s,X,R]),xe=Hu(),me=y.useRef(0);y.useEffect(()=>()=>{xe.stop()},[xe.stop]),y.useEffect(()=>{const ee=xe.events;for(let ce=me.current;ce<ee.length;ce++){const oe=ee[ce];if(oe.event==="classifying"){const fe=oe.data;p({type:"ACTIVATION_CLASSIFYING",index:fe.index,total:fe.total})}if(oe.event==="prompt_result"&&p({type:"ACTIVATION_RESULT",result:oe.data}),oe.event==="done"){Ne.current&&(clearTimeout(Ne.current),Ne.current=null);const fe=oe.data;if(fe.error)p({type:"ACTIVATION_ERROR",error:fe.error});else{p({type:"ACTIVATION_DONE",summary:fe});const ve={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(R==null?void 0:R.model)||"unknown",provider:(R==null?void 0:R.provider)||"unknown",promptCount:fe.total,summary:{precision:fe.precision,recall:fe.recall,reliability:fe.reliability,tp:fe.tp,tn:fe.tn,fp:fe.fp,fn:fe.fn}};p({type:"ACTIVATION_HISTORY_LOADED",runs:[ve,...m.activationHistory??[]]})}}}me.current=ee.length},[xe.events,R,m.activationHistory]),y.useEffect(()=>{xe.error&&(Ne.current&&(clearTimeout(Ne.current),Ne.current=null),p({type:"ACTIVATION_ERROR",error:xe.error}))},[xe.error]);const Ne=y.useRef(null),ie=y.useCallback(()=>{Ne.current&&(clearTimeout(Ne.current),Ne.current=null),xe.stop(),p({type:"ACTIVATION_CANCEL",totalPrompts:0})},[xe]),be=y.useCallback(ee=>{const oe=ee.trim().split(`
54
- `).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"});me.current=0,p({type:"ACTIVATION_START"}),p({type:"SET_ACTIVATION_PROMPTS",prompts:ee});const fe={prompts:oe};R!=null&&R.provider&&(fe.provider=R.provider),R!=null&&R.model&&(fe.model=R.model),xe.start(`/api/skills/${a}/${s}/activation-test`,fe),Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{xe.stop(),p({type:"ACTIVATION_TIMEOUT"}),Ne.current=null},12e4)},[a,s,xe,R]),Ve=y.useCallback(async(ee=8)=>{p({type:"GENERATE_PROMPTS_START"});try{const ce={count:ee};R!=null&&R.provider&&(ce.provider=R.provider),R!=null&&R.model&&(ce.model=R.model);const oe=await fetch(`/api/skills/${a}/${s}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)});if(!oe.ok){let ot=`HTTP ${oe.status}`;try{const Vt=await oe.json();Vt.error&&(ot=Vt.error)}catch{}throw new Error(ot)}const fe=oe.body.getReader(),ve=new TextDecoder;let Le="",Ae="",ut=[];for(;;){const{done:ot,value:Vt}=await fe.read();if(ot)break;Le+=ve.decode(Vt,{stream:!0});const Gt=Le.split(`
55
- `);Le=Gt.pop()||"";for(const et of Gt)if(et.startsWith("event: "))Ae=et.slice(7).trim();else if(et.startsWith("data: ")){try{const jt=JSON.parse(et.slice(6));if(Ae==="done"){if(jt.error)throw new Error(jt.error);ut=jt.prompts||[]}if(Ae==="error")throw new Error(jt.message||jt.description||"Generation failed")}catch(jt){if(!(jt instanceof SyntaxError))throw jt}Ae=""}}const Jt=ut.map(ot=>`${ot.expected==="should_activate"?"+":"!"}${ot.prompt}`).join(`
56
- `);p({type:"SET_ACTIVATION_PROMPTS",prompts:Jt}),p({type:"GENERATE_PROMPTS_DONE"})}catch(ce){p({type:"GENERATE_PROMPTS_ERROR",error:ce.message})}},[a,s,R]),Oe=y.useMemo(()=>({state:m,dispatch:p,isReadOnly:d,saveContent:N,saveEvals:T,runCase:H,runAll:$,cancelCase:O,cancelAll:K,improveForCase:w,applyImproveAndRerun:B,refreshSkillContent:pe,generateEvals:de,runActivationTest:be,cancelActivation:ie,generateActivationPrompts:Ve,fetchActivationHistory:A,submitAiEdit:Z,cancelAiEdit:ne,applyAiEdit:J,discardAiEdit:D,toggleEvalChange:C,selectAllEvalChanges:L,deselectAllEvalChanges:ae,retryEvalsSave:Q}),[m,d,N,T,H,$,O,K,w,B,pe,de,be,ie,Ve,A,Z,ne,J,D,C,L,ae,Q]);return n.jsx(yv.Provider,{value:Oe,children:c})}const Zi=new Map,ha=new Map,us=new Map;function Cs(a){Zi.delete(a),ha.delete(a);const s=us.get(a);if(s)for(const i of s)i()}function co(a,s,i={}){const{ttl:c=3e4,enabled:d=!0}=i,[,m]=y.useState(0),p=y.useRef(!0),h=y.useRef(a);h.current=a;const x=()=>Cs(a);y.useEffect(()=>(p.current=!0,()=>{p.current=!1}),[]),y.useEffect(()=>{if(!d)return;const j=()=>{p.current&&m(k=>k+1)};return us.has(a)||us.set(a,new Set),us.get(a).add(j),()=>{var k;(k=us.get(a))==null||k.delete(j)}},[a,d]),y.useEffect(()=>{if(!d)return;const j=Zi.get(a);if(!(!j||Date.now()-j.fetchedAt>c))return;if(ha.has(a)){const A=ha.get(a),N=()=>{p.current&&h.current===a&&m(T=>T+1)};A.subscribers.push(N);return}const E={promise:Promise.resolve(),subscribers:[]},z=s().then(A=>{Zi.set(a,{data:A,fetchedAt:Date.now()}),ha.delete(a),p.current&&h.current===a&&m(N=>N+1);for(const N of E.subscribers)N()},A=>{ha.delete(a),p.current&&h.current===a&&m(N=>N+1);for(const N of E.subscribers)N();throw A});E.promise=z,ha.set(a,E)},[a,s,c,d]);const f=Zi.get(a),b=d&&!f&&ha.has(a);return{data:f==null?void 0:f.data,loading:b||d&&!f,error:void 0,revalidate:x}}function Ib(a){if(!a)return[];const s=a.split(`
57
- `),i=[];for(const c of s)if(!(c.startsWith("--- ")||c.startsWith("+++ "))){if(c.startsWith("@@")){i.push({type:"header",content:c});continue}if(c.startsWith("+")){i.push({type:"add",content:c.slice(1)});continue}if(c.startsWith("-")){i.push({type:"remove",content:c.slice(1)});continue}(c.startsWith(" ")||c===""&&i.length>0)&&i.push({type:"context",content:c.startsWith(" ")?c.slice(1):""})}return i}function gv({contentDiff:a,fromLabel:s,toLabel:i,diffSummary:c,maxHeight:d=480,collapsible:m=!1,renderContext:p="inline",onRetry:h}){const[x,f]=y.useState(m),[b,g]=y.useState("unified"),j=y.useRef(null),k=y.useRef(null),E=y.useMemo(()=>Ib(a),[a]),z=y.useMemo(()=>{const O=E.filter(w=>w.type==="add").length,K=E.filter(w=>w.type==="remove").length;return{added:O,removed:K}},[E]),A=y.useMemo(()=>{let O=0,K=0;return E.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(O++,{...w,origNum:O,newNum:null}):w.type==="add"?(K++,{...w,origNum:null,newNum:K}):(O++,K++,{...w,origNum:O,newNum:K}))},[E]),N=y.useMemo(()=>{const O=[],K=[];for(const w of A)if(w.type==="remove")O.push(w);else if(w.type==="add")K.push(w);else{for(;O.length<K.length;)O.push({type:"context",content:"",origNum:null,newNum:null});for(;K.length<O.length;)K.push({type:"context",content:"",origNum:null,newNum:null});O.push(w),K.push(w)}for(;O.length<K.length;)O.push({type:"context",content:"",origNum:null,newNum:null});for(;K.length<O.length;)K.push({type:"context",content:"",origNum:null,newNum:null});return{left:O,right:K}},[A]),T=y.useCallback(O=>{const K=O==="left"?j.current:k.current,w=O==="left"?k.current:j.current;K&&w&&(w.scrollTop=K.scrollTop)},[]);if(!a||E.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 H=p==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",$=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:[s," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",z.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",z.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>g(b==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:b==="unified"?"Side-by-side":"Unified"}),m&&n.jsx("button",{onClick:()=>f(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),c&&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:c}),!x&&(b==="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:A.map((O,K)=>n.jsxs("tr",{style:{background:O.type==="add"?"rgba(34,197,94,0.08)":O.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:O.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:O.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:O.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:O.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:O.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:O.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:O.type==="add"?"var(--green)":O.type==="remove"?"var(--red)":"transparent",borderRight:O.type==="add"?"2px solid var(--green)":O.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:O.type==="add"?"+":O.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:O.type==="add"?"var(--green)":O.type==="remove"?"var(--red)":"var(--text-secondary)"},children:O.content||"​"})]},K))})})}):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:()=>T("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:N.left.map((O,K)=>n.jsxs("tr",{style:{background:O.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:O.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:O.type==="remove"?"var(--red)":"var(--text-secondary)"},children:O.content||"​"})]},K))})})}),n.jsx("div",{ref:k,style:{maxHeight:d,overflowY:"auto"},onScroll:()=>T("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:N.right.map((O,K)=>n.jsxs("tr",{style:{background:O.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:O.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:O.type==="add"?"var(--green)":"var(--text-secondary)"},children:O.content||"​"})]},K))})})})]}))]});return p==="modal"?n.jsx("div",{className:H,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:$})}):$}const nx={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 Vb(a,s){return a?a.length>s?a.slice(0,s)+"…":a:""}function bv(){const{state:a}=Sn(),{plugin:s,skill:i}=a,{refreshSkills:c,updateCount:d}=ya(),m=`versions/${s}/${i}`,p=y.useCallback(()=>we.getSkillVersions(s,i),[s,i]),{data:h,loading:x}=co(m,p),[f,b]=y.useState(null),[g,j]=y.useState(null),[k,E]=y.useState(null),[z,A]=y.useState(!1),[N,T]=y.useState("idle"),[H,$]=y.useState(null),O=y.useRef(null),K=y.useRef(null),w=y.useMemo(()=>(h==null?void 0:h.find(J=>J.isInstalled))??null,[h]),B=y.useMemo(()=>(h==null?void 0:h[0])??null,[h]),M=w&&B&&w.version!==B.version,V=y.useCallback(J=>{f?!g&&J!==f?j(J):(b(J),j(null),E(null)):(b(J),E(null))},[f,g]),I=y.useCallback(async(J,D)=>{A(!0);try{const C=await we.getVersionDiff(s,i,J,D);E(C)}catch{E(null)}finally{A(!1)}},[s,i]);y.useEffect(()=>{if(f&&g){const J=h||[],D=J.findIndex(Q=>Q.version===f),C=J.findIndex(Q=>Q.version===g),[L,ae]=D>C?[f,g]:[g,f];I(L,ae)}},[f,g,h,I]);const Z=y.useCallback(()=>{!w||!B||(b(w.version),j(B.version))},[w,B]),ne=y.useCallback(()=>{T("updating"),$(null);const J=we.startSkillUpdate(s,i);O.current=J,J.addEventListener("progress",D=>{try{switch(JSON.parse(D.data).status){case"scanning":T("scanning");break;case"installing":T("installing");break;case"done":T("done");break}}catch{T("error"),$("Unexpected response from server")}}),J.addEventListener("done",()=>{J.close(),O.current=null,c(),Cs(m),T("done")}),J.addEventListener("error",D=>{const C=D;let L="Connection lost";if(C.data)try{L=JSON.parse(C.data).error||"Update failed"}catch{}T("error"),$(L),J.close(),O.current=null})},[s,i,m,c]);return y.useEffect(()=>()=>{O.current&&(O.current.close(),O.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:[M&&n.jsx("button",{onClick:Z,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),M&&N!=="done"&&(N==="error"?n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:H||"Update failed"}),n.jsx("button",{onClick:ne,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:ne,disabled:N!=="idle",className:"btn btn-primary text-[11px]",children:N==="idle"?`Update to ${B==null?void 0:B.version}`:N==="updating"?"Starting update...":N==="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,")"]})]})]}),f&&!g&&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 ",f]}),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(J=>{const D=nx[J.certTier]||nx.COMMUNITY,C=J.version===f||J.version===g,L=J.isInstalled;return n.jsxs("button",{onClick:()=>V(J.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:C?"var(--accent-muted)":"transparent",border:C?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:ae=>{C||(ae.currentTarget.style.background="var(--surface-1)")},onMouseLeave:ae=>{C||(ae.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:L?10:8,height:L?10:8,background:L?"var(--accent)":"var(--surface-3)",border:L?"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:J.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:D.bg,color:D.text},children:J.certTier}),L&&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(J.createdAt).toLocaleDateString()})]}),J.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:Vb(J.diffSummary,80)})]},J.version)})}),n.jsx("div",{ref:K,style:{height:1}})]}),z&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),k&&!z&&n.jsx("div",{className:"mt-4",children:n.jsx(gv,{contentDiff:k.contentDiff,fromLabel:k.from,toLabel:k.to,diffSummary:k.diffSummary,renderContext:"inline",onRetry:()=>f&&g&&I(k.from,k.to)})})]})}function Gb(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function $b(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}const qb={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,s)=>`${a} of ${s}`},Yb={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"},Kb={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"},Qb={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."},Xb={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"},Wb={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"},Zb={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."},Fb={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Jb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Pb={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},pt={sidebar:qb,shell:Yb,detail:Kb,actions:Qb,palette:Xb,shortcuts:Wb,toasts:Zb,connection:Fb,forms:Jb,errors:Pb};function lx(a,s="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:s}}))}function gd(a){return a.skill?t2({skill:a.skill}):n2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function e2(a,s=48){if(a.length<=s)return a;const i=a.slice(0,12),c=a.slice(a.length-(s-12-1));return`${i}…${c}`}function t2({skill:a}){const[s,i]=y.useState(!1),c=y.useCallback(async()=>{var p;try{await((p=navigator.clipboard)==null?void 0:p.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),lx(pt.toasts.pathCopied,"info")}catch{lx(pt.toasts.permissionDenied,"error")}},[a.dir]),d=a.origin==="installed"?"Installed":"Own",m=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:m}}),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.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:c,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:e2(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:c,"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"})]}),s?"Copied":"Copy"]})]})]})}function n2({state:a,isReadOnly:s,onDelete:i}){const{plugin:c,skill:d,evals:m,latestBenchmark:p,isDirty:h,caseRunStates:x,regressions:f,iterationCount:b}=a,g=Array.from(x.values()).some(N=>N.status==="running"||N.status==="queued"),j=p==null?void 0:p.overall_pass_rate,k=(m==null?void 0:m.evals.reduce((N,T)=>N+T.assertions.length,0))??0,E=(m==null?void 0:m.evals.length)??0,z=Gb(j),A=$b(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:c}),n.jsx(l2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:d}),s&&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"}),g&&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:[!s&&i&&n.jsx("button",{disabled:g,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:g?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:g?.4:1,borderRadius:4},onMouseEnter:N=>{g||(N.currentTarget.style.color="var(--red)")},onMouseLeave:N=>{N.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(a2,{})}),f.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"})]}),f.length," regression",f.length>1?"s":""]}),b>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",b]}),n.jsx("span",{className:"pill",style:{background:A,color:z},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[E," case",E!==1?"s":""," / ",k," assert",k!==1?"s":""]})]})]})}function l2(){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 a2(){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 r2=[{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 s2({id:a}){const s={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",{...s,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",{...s,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",{...s,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...s,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",{...s,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",{...s,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",{...s,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",{...s,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 i2({activePanel:a,onPanelChange:s,isDirty:i,isRunning:c,hasRegressions:d,isActivationRunning:m,hasUpdate:p}){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:r2.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(f=>{const b=a===f.id,g=f.id==="editor"&&i||f.id==="run"&&c||f.id==="activation"&&m||f.id==="history"&&d||f.id==="versions"&&p,j=f.id==="run"||f.id==="activation"?"var(--accent)":f.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>s(f.id),title:`${f.label} (Ctrl+${f.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:b?"var(--text-primary)":"var(--text-tertiary)",borderBottom:b?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:b?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:k=>{b||(k.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:k=>{b||(k.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(s2,{id:f.id}),f.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},f.id)})]},h.label))})}const ax={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 Es({error:a,onRetry:s,onDismiss:i}){const[c,d]=y.useState(null),m=y.useRef(null);y.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?d(Math.ceil(a.retryAfterMs/1e3)):d(null),()=>{m.current&&clearInterval(m.current)}),[a]),y.useEffect(()=>{if(!(c==null||c<=0))return m.current=setInterval(()=>{d(x=>x==null||x<=1?(m.current&&clearInterval(m.current),0):x-1)},1e3),()=>{m.current&&clearInterval(m.current)}},[c!=null&&c>0]);const p=ax[a.category]||ax.unknown,h=c!=null&&c>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${p.color} 30%, transparent)`,background:`color-mix(in srgb, ${p.color} 6%, var(--surface-1))`},children:[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:p.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:p.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}),(s||c!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:s&&n.jsx("button",{onClick:s,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${c}s`:"Retry"})})]})]})}class o2 extends y.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s,i){console.error("ErrorBoundary caught:",s,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 c2(a){const s=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(s)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(s)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(s)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(s)?{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(s)?{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(s)?{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(s)?{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 u2(a){const s=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!s)return{metadata:{},body:a};const i=s[1],c=s[2].trim(),d={},m=i.split(`
58
- `);let p="",h=!1;for(const x of m){const f=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(f&&p&&h){const j=f[1],k=f[2].trim();let E=d[p];if((typeof E!="object"||Array.isArray(E))&&(E={},d[p]=E),!k)E[j]=[];else{const z=k.match(/^\[(.+)\]$/);z?E[j]=z[1].split(",").map(A=>A.trim().replace(/^["']|["']$/g,"")).filter(Boolean):E[j]=k.replace(/^["']|["']$/g,"")}continue}const b=x.match(/^\s+-\s+(.+)$/);if(b&&p){h=!1;const j=d[p];Array.isArray(j)?j.push(b[1].trim().replace(/^["']|["']$/g,"")):d[p]=[b[1].trim().replace(/^["']|["']$/g,"")];continue}const g=x.match(/^([\w-]+):\s*(.*)$/);if(g){p=g[1];const j=g[2].trim();if(h=!1,!j){d[p]={},h=!0;continue}const k=j.match(/^\[(.+)\]$/);if(k){d[p]=k[1].split(",").map(E=>E.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}d[p]=j.replace(/^["']|["']$/g,"")}}return{metadata:d,body:c}}function uo(a){if(!a)return"";try{let s=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=d2(s);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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function d2(a){const s=a.split(`
59
- `),i=[];let c=0;for(;c<s.length;)if(s[c].trim().startsWith("|")&&c+1<s.length&&s[c+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(s[c+1])){const d=rx(s[c]);c+=2;const m=[];for(;c<s.length&&s[c].trim().startsWith("|");)m.push(rx(s[c])),c++;const p='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',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 f of d)x+=`<th ${p}>${f}</th>`;x+="</tr></thead><tbody>";for(const f of m){x+="<tr>";for(const b of f)x+=`<td ${h}>${b}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(s[c]),c++;return i.join(`
60
- `)}function rx(a){return a.split("|").map(s=>s.trim()).filter(s=>s.length>0)}function fo(a,s){const i=a.split(`
61
- `),c=s.split(`
62
- `);if(i.length>1e3||c.length>1e3)return[...i.map(b=>({type:"unchanged",content:b}))];const d=i.length,m=c.length,p=Array.from({length:d+1},()=>new Array(m+1).fill(0));for(let b=1;b<=d;b++)for(let g=1;g<=m;g++)i[b-1]===c[g-1]?p[b][g]=p[b-1][g-1]+1:p[b][g]=Math.max(p[b-1][g],p[b][g-1]);const h=[];let x=d,f=m;for(;x>0||f>0;)x>0&&f>0&&i[x-1]===c[f-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,f--):f>0&&(x===0||p[x][f-1]>=p[x-1][f])?(h.push({type:"added",content:c[f-1]}),f--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function f2(a,s){if(s&&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 c=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:c.has(a)?"var(--accent)":"var(--green)"}})}function Ts({entries:a,isRunning:s}){const[i,c]=y.useState(!1),d=y.useRef(null);return y.useEffect(()=>{d.current&&!i&&(d.current.scrollTop=d.current.scrollHeight)},[a,i]),a.length===0&&!s?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>c(!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:m=>{m.currentTarget.style.color="var(--text-primary)"},onMouseLeave:m=>{m.currentTarget.style.color="var(--text-tertiary)"},children:[n.jsxs("span",{className:"flex items-center gap-2",children:[s&&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((m,p)=>{const h=p===a.length-1&&s,x=p===0?"0s":`+${((m.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:[f2(m.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:m.message}),m.current!=null&&m.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",m.current,"/",m.total,"]"]})]},p)})})]})}function p2({plugin:a,skill:s,skillContent:i,onApplied:c}){const[d,m]=y.useState("closed"),{config:p}=Yl(),[h,x]=y.useState("claude-cli"),[f,b]=y.useState("opus"),[g,j]=y.useState([]),[k,E]=y.useState(""),[z,A]=y.useState(""),[N,T]=y.useState(null),[H,$]=y.useState(null),[O,K]=y.useState([]),[w,B]=y.useState(!1),M=y.useRef(null);y.useEffect(()=>{if(!p)return;p.providers.find(L=>L.id==="claude-cli"&&L.available)&&(x("claude-cli"),b("opus"))},[p]),y.useEffect(()=>()=>{var C;(C=M.current)==null||C.abort()},[]);function V(){return p==null?void 0:p.providers.find(C=>C.id===h&&C.available)}const I=y.useCallback(()=>{var C;(C=M.current)==null||C.abort(),m("open")},[]);async function Z(){m("loading"),T(null),$(null),K([]);const C=new AbortController;M.current=C;try{const L=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(s)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:f}),signal:C.signal});if(!L.ok||!L.body){let X=`HTTP ${L.status}`;try{const re=await L.json();re.error&&(X=re.error)}catch{}throw new Error(X)}const ae=L.body.getReader(),Q=new TextDecoder;let pe="",R="";for(;;){const{done:X,value:re}=await ae.read();if(X)break;pe+=Q.decode(re,{stream:!0});const de=pe.split(`
63
- `);pe=de.pop()||"";for(const xe of de)if(xe.startsWith("event: "))R=xe.slice(7).trim();else if(xe.startsWith("data: ")){try{const me=JSON.parse(xe.slice(6));R==="progress"?K(Ne=>[...Ne,{phase:me.phase,message:me.message,timestamp:Date.now()}]):R==="done"||R==="complete"?(E(me.improved),A(me.reasoning||""),j(fo(me.original||i,me.improved)),m("diff_shown")):R==="error"&&(T(me.message||me.description||"Unknown error"),me.category&&$(me),m("open"))}catch{}R=""}}}catch(L){L.name!=="AbortError"&&(T(L.message),m("open"))}finally{M.current=null}}async function ne(){B(!0);try{await we.applyImprovement(a,s,k),c(k),m("closed")}catch(C){T(C.message)}finally{B(!1)}}function J(){m("closed"),j([]),E(""),A(""),T(null)}if(d==="closed")return n.jsxs("button",{onClick:()=>m("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 D=V();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:J,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:C=>{C.currentTarget.style.background="var(--surface-3)"},onMouseLeave:C=>{C.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:C=>{x(C.target.value);const L=p==null?void 0:p.providers.find(ae=>ae.id===C.target.value);L!=null&&L.models[0]&&b(L.models[0].id)},disabled:d==="loading",children:p==null?void 0:p.providers.filter(C=>C.available).map(C=>n.jsx("option",{value:C.id,children:C.label},C.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:f,onChange:C=>b(C.target.value),disabled:d==="loading",children:D==null?void 0:D.models.map(C=>n.jsx("option",{value:C.id,children:C.label},C.id))})]}),d==="loading"?n.jsx("button",{onClick:I,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:Z,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),d==="loading"&&O.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Ts,{entries:O,isRunning:!0})})]}),N&&n.jsx("div",{className:"mb-4",children:H?n.jsx(Es,{error:H,onRetry:Z,onDismiss:()=>{T(null),$(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:N})}),d==="diff_shown"&&n.jsxs(n.Fragment,{children:[z&&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: "}),z]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((C,L)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:C.type==="added"?"rgba(34,197,94,0.1)":C.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:C.type==="added"?"var(--green)":C.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:C.type==="added"?"3px solid var(--green)":C.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:C.type==="added"?"+":C.type==="removed"?"-":" "}),C.content]},L))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:ne,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:J,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const sx={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"}},m2={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function h2({change:a,index:s,selected:i,onToggle:c,originalEval:d}){var g;const[m,p]=y.useState(!1),h=sx[a.action]??sx.add,x=m2[a.action]??"var(--border-subtle)",f=a.action==="remove"?(d==null?void 0:d.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",b=y.useCallback(()=>c(s),[c,s]);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:b,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:f}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>p(!m),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:m?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),m&&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(x2,{evalCase:a.eval}),a.action==="modify"&&a.eval&&d&&n.jsx(v2,{original:d,proposed:a.eval}),a.action==="remove"&&d&&n.jsx(y2,{evalCase:d})]})]})}function x2({evalCase:a}){var s;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(ed,{label:"Prompt",value:a.prompt}),n.jsx(ed,{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 (",((s=a.assertions)==null?void 0:s.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 v2({original:a,proposed:s}){const i=[];a.name!==s.name&&i.push({label:"Name",old:a.name,new:s.name}),a.prompt!==s.prompt&&i.push({label:"Prompt",old:a.prompt,new:s.prompt}),a.expected_output!==s.expected_output&&i.push({label:"Expected",old:a.expected_output,new:s.expected_output});const c=a.assertions??[],d=s.assertions??[],m=new Set(c.map(f=>f.text)),p=new Set(d.map(f=>f.text)),h=d.filter(f=>!m.has(f.text)),x=c.filter(f=>!p.has(f.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(f=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:f.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:["- ",td(f.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",td(f.new,120)]})]})]},f.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(f=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",f.text]},f.id)),h.map(f=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",f.text]},f.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 y2({evalCase:a}){var s;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(ed,{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 (",((s=a.assertions)==null?void 0:s.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 ed({label:a,value:s}){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:td(s,300)})]})}function td(a,s){return a.length>s?a.slice(0,s)+"...":a}const ix={remove:0,modify:1,add:2};function g2({changes:a,selections:s,currentEvals:i,onToggle:c,onSelectAll:d,onDeselectAll:m}){if(a.length===0)return null;const p=a.map((x,f)=>({change:x,originalIndex:f}));p.sort((x,f)=>(ix[x.change.action]??2)-(ix[f.change.action]??2));const h=Array.from(s.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:m,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:p.map(({change:x,originalIndex:f})=>n.jsx(h2,{change:x,index:f,selected:s.get(f)??!1,onToggle:c,originalEval:x.evalId!=null?i.find(b=>b.id===x.evalId):void 0},f))})]})}function b2(){var C;const{state:a,dispatch:s,submitAiEdit:i,applyAiEdit:c,discardAiEdit:d,cancelAiEdit:m,toggleEvalChange:p,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:f}=Sn(),{aiEditLoading:b,aiEditResult:g,aiEditError:j,aiEditClassifiedError:k,aiEditProgress:E,aiEditEvalChanges:z,aiEditEvalSelections:A,aiEditEvalsRetry:N}=a,[T,H]=y.useState(""),{config:$}=Yl(),[O,K]=y.useState("claude-cli"),[w,B]=y.useState("opus"),M=y.useRef(null);y.useEffect(()=>{var L;(L=M.current)==null||L.focus()},[]),y.useEffect(()=>{if(!$)return;$.providers.find(ae=>ae.id==="claude-cli"&&ae.available)&&(K("claude-cli"),B("opus"))},[$]);const V=$==null?void 0:$.providers.find(L=>L.id===O&&L.available),I=y.useCallback(()=>{const L=T.trim();!L||b||i(L,O,w)},[T,b,i,O,w]),Z=y.useCallback(L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),I()),L.key==="Escape"&&(L.preventDefault(),b?m():d())},[I,b,m,d]),ne=y.useCallback(()=>{s({type:"CLOSE_AI_EDIT"}),s({type:"OPEN_AI_EDIT"})},[s]),J=g?fo(a.skillContent,g.improved):[],D=((C=a.evals)==null?void 0:C.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:L=>{L.currentTarget.style.background="var(--surface-3)"},onMouseLeave:L=>{L.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:[!g&&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:M,value:T,onChange:L=>H(L.target.value),onKeyDown:Z,placeholder:"e.g., Add an error handling section...",disabled:b,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:L=>{const ae=L.currentTarget;ae.style.height="auto",ae.style.height=Math.min(ae.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:O,onChange:L=>{K(L.target.value);const ae=$==null?void 0:$.providers.find(Q=>Q.id===L.target.value);ae!=null&&ae.models[0]&&B(ae.models[0].id)},disabled:b,style:{width:"100%"},children:$==null?void 0:$.providers.filter(L=>L.available).map(L=>n.jsx("option",{value:L.id,children:L.label},L.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:L=>B(L.target.value),disabled:b,style:{width:"100%"},children:V==null?void 0:V.models.map(L=>n.jsx("option",{value:L.id,children:L.label},L.id))})]}),b?n.jsx("button",{onClick:m,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):n.jsx("button",{onClick:I,disabled:!T.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),b&&E.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Ts,{entries:E,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:k?n.jsx(Es,{error:k,onRetry:ne,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})}),g&&n.jsxs("div",{className:"animate-fade-in",children:[g.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: "}),g.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:J.map((L,ae)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:L.type==="added"?"rgba(34,197,94,0.1)":L.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:L.type==="added"?"var(--green)":L.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:L.type==="added"?"3px solid var(--green)":L.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:L.type==="added"?"+":L.type==="removed"?"-":" "}),L.content]},ae))}),n.jsx(g2,{changes:z,selections:A,currentEvals:D,onToggle:p,onSelectAll:h,onDeselectAll:x}),N&&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:f,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:c,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:ne,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function j2(a,s){const[i,c]=y.useState([]),[d,m]=y.useState("SKILL.md"),[p,h]=y.useState(null),[x,f]=y.useState(!1),[b,g]=y.useState(null),j=y.useCallback(async()=>{try{const z=await we.getSkillFiles(a,s);c(z.files)}catch{c([])}},[a,s]);y.useEffect(()=>{m("SKILL.md"),h(null),g(null),j()},[a,s,j]);const k=y.useCallback(async z=>{if(m(z),z==="SKILL.md"){h(null),g(null);return}f(!0),g(null);try{const A=await we.getSkillFile(a,s,z);h(A)}catch(A){g(`Unable to open file: ${A.message}`),h(null)}finally{f(!1)}},[a,s]),E=y.useCallback(()=>{j()},[j]);return{files:i,activeFile:d,secondaryContent:p,loading:x,error:b,selectFile:k,refresh:E,isSkillMd:d==="SKILL.md"}}function S2(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function k2(a){const s=[],i=new Map;for(const c of a){const d=c.path.split("/"),p={name:d[d.length-1],path:c.path,type:c.type,size:c.size,children:[]};i.set(c.path,p)}for(const c of a){const d=c.path.split("/");if(d.length===1){const m=i.get(c.path);m&&s.push(m)}else{const m=d.slice(0,-1).join("/"),p=i.get(m),h=i.get(c.path);p&&h&&p.children.push(h)}}return s}function jv({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 N2(){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 w2(){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 kv({node:a,depth:s,activeFile:i,onSelect:c}){const[d,m]=y.useState(!0),p=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>m(!d),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+s*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(jv,{expanded:d}),n.jsx(Sv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),d&&a.children.map(h=>n.jsx(kv,{node:h,depth:s+1,activeFile:i,onSelect:c},h.path))]}):n.jsxs("button",{onClick:()=>c(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+s*14}px`,paddingTop:2,paddingBottom:2,background:p?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:p?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(N2,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:S2(a.size)})]})}function C2({files:a,activeFile:s,onSelect:i,onRefresh:c}){const[d,m]=y.useState(!1),p=y.useMemo(()=>k2(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:()=>m(!d),children:[n.jsx(jv,{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:s}),n.jsx("button",{onClick:h=>{h.stopPropagation(),c()},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(w2,{})})]}),d&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:p.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):p.map(h=>n.jsx(kv,{node:h,depth:0,activeFile:s,onSelect:i},h.path))})]})}function $i(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function E2(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function T2(a){const s=a.toLowerCase();return s.endsWith(".json")?"json":s.endsWith(".md")?"md":"other"}function ox({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 cx({content:a,fileType:s}){if(s==="json"){const i=E2(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 s==="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:uo(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 ux(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").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,c)=>`: <span style="color:#fb923c">${c}</span>`).replace(/:\s*(true|false|null)/g,(i,c)=>`: <span style="color:#a855f7">${c}</span>`)}catch{return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function R2({file:a,loading:s,error:i,viewMode:c,plugin:d,skill:m,onSaved:p,onDirtyChange:h}){const[x,f]=y.useState(c),[b,g]=y.useState(!1),[j,k]=y.useState(""),[E,z]=y.useState(!1),[A,N]=y.useState(null),T=c!==x?c:x;y.useEffect(()=>{h==null||h(b)},[b,h]);const H=y.useCallback(()=>{(a==null?void 0:a.content)!=null&&(k(a.content),g(!0))},[a]),$=y.useCallback(()=>{g(!1)},[]),O=y.useCallback(async()=>{if(!(!d||!m||!a)){z(!0);try{await we.saveSkillFile(d,m,a.path,j),N("Saved"),g(!1),p==null||p(),setTimeout(()=>N(null),2e3)}catch(B){N(`Save failed: ${B.message}`),setTimeout(()=>N(null),3e3)}finally{z(!1)}}},[d,m,a,j,p]);if(y.useEffect(()=>{if(!b)return;const B=M=>{(M.ctrlKey||M.metaKey)&&M.key==="s"&&(M.preventDefault(),O())};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[b,O]),s)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 (",$i(a.size),") — cannot be displayed"]});const K=a.content??"",w=T2(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 ",$i(512*1024)," — ",$i(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(B=>n.jsx("button",{onClick:()=>f(B),style:{padding:"2px 8px",fontSize:11,background:T===B?"var(--accent-muted)":"none",color:T===B?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:B},B)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[$i(a.size),d&&m&&!a.binary&&!b&&n.jsx("button",{onClick:H,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),b&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:O,disabled:E,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:E?.6:1},children:E?"Saving...":"Save"}),n.jsx("button",{onClick:$,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),A&&n.jsx("div",{style:{padding:"4px 12px",background:A.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:A.startsWith("Save failed")?"var(--red)":"var(--green)"},children:A}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:b?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:B=>k(B.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:O,disabled:E,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:E?.6:1},children:E?"Saving...":"Save"}),n.jsx("button",{onClick:$,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):T==="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(ox,{content:K})}),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:ux(K)}}):n.jsx(cx,{content:K,fileType:w})})]}):T==="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:ux(K)}}):n.jsx(cx,{content:K,fileType:w}):n.jsx(ox,{content:K})})]})}function A2({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 M2({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 z2({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 D2({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 Uu({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 L2(){const{state:a,dispatch:s,saveContent:i,isReadOnly:c}=Sn(),{plugin:d,skill:m,skillContent:p,isDirty:h,improveTarget:x,aiEditOpen:f}=a,[b,g]=y.useState("split"),[j,k]=y.useState(!1),E=y.useRef(null),[z,A]=y.useState(!1),[N,T]=y.useState(""),[H,$]=y.useState(!1),[O,K]=y.useState(null),[w,B]=y.useState([]),[M,V]=y.useState([]),[I,Z]=y.useState(null),ne=y.useRef(null),{config:J}=Yl(),{files:D,activeFile:C,secondaryContent:L,loading:ae,error:Q,selectFile:pe,refresh:R,isSkillMd:X}=j2(d??"",m??""),[re,de]=y.useState(!1),xe=y.useCallback(he=>{re&&!window.confirm("You have unsaved changes. Discard?")||pe(he)},[re,pe]);y.useEffect(()=>()=>{var he;(he=ne.current)==null||he.abort()},[]);const{metadata:me,body:Ne}=u2(p),ie=me["allowed-tools"],be=Array.isArray(ie)?ie:typeof ie=="string"?[ie]:[],Ve=me.name,Oe=me.description,ee=me.metadata,ce=typeof ee=="object"&&!Array.isArray(ee)?ee:null,oe=me.version||(ce==null?void 0:ce.version),fe=me.tags||(ce==null?void 0:ce.tags),ve=Array.isArray(fe)?fe:typeof fe=="string"?fe.split(",").map(he=>he.trim()).filter(Boolean):[],Le=new Set(["name","description","metadata","allowed-tools","version","tags"]),Ae=Object.entries(me).filter(([he])=>!Le.has(he)),ut=y.useCallback(async()=>{k(!0),await i(),k(!1)},[i]),Jt=y.useCallback(he=>{(he.ctrlKey||he.metaKey)&&he.key==="s"&&(he.preventDefault(),he.stopPropagation(),h&&ut()),(he.ctrlKey||he.metaKey)&&he.key==="k"&&(he.preventDefault(),he.stopPropagation(),s({type:f?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,ut,f,s]),ot=y.useCallback(async()=>{var Rt,Me;if(!N.trim())return;(Rt=ne.current)==null||Rt.abort();const he=new AbortController;ne.current=he,$(!0),Z(null),V([]),K(null),B([]);try{const xt=(J==null?void 0:J.provider)||"claude-cli",Xt=(J==null?void 0:J.model)||"sonnet",tt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:N,provider:xt,model:Xt}),signal:he.signal});if(!tt.ok||!tt.body){let bt=`HTTP ${tt.status}`;try{const On=await tt.json();On.error&&(bt=On.error)}catch{}throw new Error(bt)}const Wl=tt.body.getReader(),Zn=new TextDecoder;let wt="",St="";for(;;){const{done:bt,value:On}=await Wl.read();if(bt)break;wt+=Zn.decode(On,{stream:!0});const Zl=wt.split(`
64
- `);wt=Zl.pop()||"";for(const Bn of Zl)if(Bn.startsWith("event: "))St=Bn.slice(7).trim();else if(Bn.startsWith("data: ")){try{const Ue=JSON.parse(Bn.slice(6));if(St==="progress")V(Ht=>[...Ht,{phase:Ue.phase,message:Ue.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ht=["---"];Ue.name&&Ht.push(`name: ${Ue.name}`),Ue.description&&Ht.push(`description: "${Ue.description.replace(/"/g,'\\"')}"`),Ue.model&&Ht.push(`model: ${Ue.model}`),(Me=Ue.allowedTools)!=null&&Me.trim()&&Ht.push(`allowed-tools: ${Ue.allowedTools.trim()}`),Ht.push("---","",Ue.body||"");const Fn=Ht.join(`
65
- `);K(Fn),B(fo(p,Fn)),$(!1)}else St==="error"&&(Z(Ue.message||Ue.description||"Generation failed"),$(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&Z(xt.message)}finally{$(!1),ne.current=null}},[N,J,p]),Vt=y.useCallback(()=>{O&&s({type:"SET_CONTENT",content:O}),A(!1),K(null),B([]),T(""),V([])},[O,s]),Gt=y.useCallback(()=>{A(!1),K(null),B([]),T(""),V([]),Z(null)},[]),et=y.useCallback(()=>{var he;z?((he=ne.current)==null||he.abort(),Gt()):(f&&s({type:"CLOSE_AI_EDIT"}),A(!0))},[z,f,s,Gt]),jt=[{mode:"raw",icon:n.jsx(A2,{}),label:"Editor"},{mode:"split",icon:n.jsx(M2,{}),label:"Split"},{mode:"preview",icon:n.jsx(z2,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Jt,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:jt.map(({mode:he,icon:Rt,label:Me})=>n.jsxs("button",{onClick:()=>g(he),title:Me,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:b===he?"var(--surface-4)":"transparent",color:b===he?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:b===he?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:Me})]},he))}),X?c?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:()=>{f?s({type:"CLOSE_AI_EDIT"}):(z&&Gt(),s({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:f?600:400,border:"none",cursor:"pointer",color:f?"var(--purple)":"var(--text-tertiary)",background:f?"var(--purple-muted)":"transparent"},children:[n.jsx(D2,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:et,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:z?600:400,border:"none",cursor:"pointer",color:z?"var(--purple)":"var(--text-tertiary)",background:z?"var(--purple-muted)":"transparent"},children:[n.jsx(Uu,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>s({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:ut,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&&m&&n.jsx(C2,{files:D,activeFile:C,onSelect:xe,onRefresh:R}),!X&&n.jsx(R2,{file:L,loading:ae,error:Q,viewMode:b,plugin:d??void 0,skill:m??void 0,onSaved:()=>{pe(C),R()},onDirtyChange:de}),X&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:b==="raw"||b==="preview"?"1fr":"1fr 1fr"},children:[b!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:b==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:E,value:p,onChange:he=>{c||s({type:"SET_CONTENT",content:he.target.value})},onKeyDown:Jt,spellCheck:!1,readOnly:c,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:c?.7:1}})}),b!=="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:[(Ve||oe||Oe)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ve&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ve}),oe&&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",oe]})]}),Oe&&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:Oe})]}),ve.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ve.map(he=>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:he},he))}),be.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"}),be.map(he=>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:he},he))]})}),Ae.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Ae.map(([he,Rt],Me)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Xt,tt])=>`${Xt}: ${Array.isArray(tt)?tt.join(", "):tt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:Me>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:he}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},he)})}),(Ve||Oe||ve.length>0||be.length>0||Ae.length>0)&&Ne&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),Ne&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:uo(Ne)}})]})})]}),X&&f&&n.jsx(b2,{}),X&&z&&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:[!O&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Uu,{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:N,onChange:he=>T(he.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:H,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:H?.5:1},onKeyDown:he=>{he.key==="Enter"&&(he.ctrlKey||he.metaKey)&&N.trim()&&!H&&(he.preventDefault(),ot())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[H?n.jsx("button",{onClick:()=>{var he;(he=ne.current)==null||he.abort(),$(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ot,disabled:!N.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:Gt,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),H&&M.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Ts,{entries:M,isRunning:!0})}),I&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[I,n.jsx("button",{onClick:ot,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),O&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Uu,{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((he,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:he.type==="added"?"var(--green-muted)":he.type==="removed"?"var(--red-muted)":"transparent",color:he.type==="added"?"var(--green)":he.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:he.type==="added"?"3px solid var(--green)":he.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:he.type==="added"?"+":he.type==="removed"?"-":" "}),he.content]},Rt))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("button",{onClick:Vt,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:Gt,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),X&&x!==null&&d&&m&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(p2,{plugin:d,skill:m,skillContent:p,onApplied:he=>{s({type:"SET_CONTENT",content:he}),s({type:"CONTENT_SAVED"}),s({type:"CLOSE_IMPROVE"})}})})]})}function sr(a){return a.testType==="integration"?"integration":"unit"}function dr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function Nv(a){const s=new Date(a);return s.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function wv(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const _2=new Set(["benchmark","comparison","baseline"]);function dx(a,s,i,c){return a.map(({rate:d,idx:m,total:p})=>{const h=c+m/(p-1)*(s-c*2),x=c+(i-c*2)-d*(i-c*2);return`${h},${x}`})}function Cv({entries:a}){const s=a.filter(g=>_2.has(g.type)).slice().reverse(),i=s.map((g,j,k)=>({rate:g.pass_rate,idx:j,total:k.length})).filter((g,j)=>{const k=s[j].type;return k==="benchmark"||k==="comparison"}),c=s.flatMap((g,j)=>g.type==="baseline"?[{rate:g.pass_rate,idx:j,total:s.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:j,total:s.length}]:[]);if(i.length<2&&c.length<2)return null;const d=80,m=24,p=2,h=i.length>=2?dx(i,d,m,p):[],x=c.length>=2?dx(c,d,m,p):[],f=h[h.length-1],b=x[x.length-1];return n.jsxs("svg",{width:d,height:m,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"}),b&&n.jsx("circle",{cx:parseFloat(b.split(",")[0]),cy:parseFloat(b.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),f&&n.jsx("circle",{cx:parseFloat(f.split(",")[0]),cy:parseFloat(f.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Ev(a,s,i){const c=isNaN(s)?0:s,d=[],m=[],p=[];if((a==="PASS"||a==="EFFECTIVE")&&c>=.7){const f=d.length>0?` Met criteria: ${d.map(b=>b.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${c.toFixed(2)}): evaluation met expectations.${f}`}}if(a==="FAIL"||a==="DEGRADING"){const f=m.length>0?` Failed criteria: ${m.map(g=>g.criterion).join(", ")}.`:"",b=[...m.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...p.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return b.length===0&&b.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${c.toFixed(2)}): evaluation did not meet expectations.${f}`,recommendations:b}}if(a==="INEFFECTIVE"){if(c<.2){const b=[...m.map(g=>`Rework "${g.criterion}" — currently at ${g.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${a} (score ${c.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:b}}const f=[...m.map(b=>`Rework "${b.criterion}" — currently at ${b.score.toFixed(2)}`),...p.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return f.length===0&&f.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${c.toFixed(2)}): below expectations but showing some capability.`,recommendations:f}}if(a==="MARGINAL"){const f=[...p.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`),...m.map(b=>`Improve "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return f.length===0&&f.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 ${c.toFixed(2)}): moderate improvement detected.`,recommendations:f}}if(a==="EMERGING"){const f=[...m.map(b=>`Improve "${b.criterion}" (score: ${b.score.toFixed(2)})`),...p.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return f.length===0&&f.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 ${c.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:f}}const h=d.length>0?` Passing: ${d.map(f=>f.criterion).join(", ")}.`:"",x=p.length>0?` Needs improvement: ${p.map(f=>f.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${c.toFixed(2)}): mixed results.${h}${x}`}}const Tv={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function O2(a){return Object.hasOwn(Tv,a)}function B2(a){return O2(a)?Tv[a]:a}function H2(){const{state:a}=Sn(),{plugin:s,skill:i}=a,[c,d]=y.useState([]),[m,p]=y.useState([]),[h,x]=y.useState(!0),[f,b]=y.useState(null),[g,j]=y.useState(new Set),[k,E]=y.useState({}),[z,A]=y.useState(null),[N,T]=y.useState(""),[H,$]=y.useState(!1),[O,K]=y.useState(""),[w,B]=y.useState(""),M=y.useCallback(async()=>{x(!0),b(null);try{const[D,C]=await Promise.all([we.getCredentials(s,i),we.getParams(s,i)]);d(D.credentials),p(C.params)}catch(D){b(D instanceof Error?D.message:"Failed to load parameters"),d([]),p([])}finally{x(!1)}},[s,i]);y.useEffect(()=>{M()},[M]);const V=y.useCallback(async(D,C)=>{$(!0),b(null);try{await we.setCredential(s,i,D,C),A(null),T(""),await M()}catch(L){b(L instanceof Error?L.message:`Failed to save ${D}`)}finally{$(!1)}},[s,i,M]),I=y.useCallback(async()=>{const D=O.trim().toUpperCase(),C=w.trim();if(!(!D||!C)){$(!0),b(null);try{await we.setCredential(s,i,D,C),K(""),B(""),await M()}catch(L){b(L instanceof Error?L.message:`Failed to add ${D}`)}finally{$(!1)}}},[s,i,O,w,M]),Z=y.useCallback(async D=>{if(g.has(D)){j(C=>{const L=new Set(C);return L.delete(D),L}),E(C=>{const L={...C};return delete L[D],L});return}try{const L=(await we.getParamsRevealed(s,i,D)).params.find(ae=>ae.name===D);L!=null&&L.value&&(E(ae=>({...ae,[D]:L.value})),j(ae=>new Set(ae).add(D)))}catch{}},[s,i,g]),ne=new Set(c.map(D=>D.name)),J=[...c.map(D=>{const C=m.find(L=>L.name===D.name);return{name:D.name,status:D.status,maskedValue:(C==null?void 0:C.maskedValue)??""}}),...m.filter(D=>!ne.has(D.name)).map(D=>({name:D.name,status:D.status,maskedValue:D.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"}),f&&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:f}),h&&J.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&J.length===0&&!f&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),J.map(D=>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:D.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:D.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:D.status==="ready"?"var(--green)":"var(--red)"},children:D.status}),(D.maskedValue||D.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(D.name)?k[D.name]??D.maskedValue:D.maskedValue||"***",n.jsx("button",{onClick:()=>Z(D.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(D.name)?"Hide":"Reveal"} value for ${D.name}`,children:g.has(D.name)?"hide":"show"})]}),z===D.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:N,onChange:C=>T(C.target.value),onKeyDown:C=>{C.key==="Enter"&&N.trim()&&V(D.name,N)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${D.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>V(D.name,N),disabled:H||!N.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{A(null),T("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{A(D.name),T("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},D.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:O,onChange:D=>K(D.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:D=>B(D.target.value),onKeyDown:D=>{D.key==="Enter"&&O.trim()&&w.trim()&&I()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:I,disabled:H||!O.trim()||!w.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:H?"not-allowed":"pointer"},children:"Add"})]})]})]})}function U2(a,s,i){const[c,d]=y.useState(null),[m,p]=y.useState(!1),h=y.useRef("");y.useEffect(()=>{const f=`${a}/${s}/${i}`;h.current!==f&&(h.current=f,p(!0),we.getCaseHistory(a,s,i).then(b=>d(b)).catch(()=>d([])).finally(()=>p(!1)))},[a,s,i]);const x=y.useCallback(()=>{p(!0),h.current="",we.getCaseHistory(a,s,i).then(f=>d(f)).catch(()=>d([])).finally(()=>p(!1))},[a,s,i]);return{entries:c,loading:m,refetch:x}}function I2(a,s,i){const c={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return c;const m=i.slice(0,10).map(x=>x.assertions.find(f=>f.id===a)).filter(Boolean);if(m.length>=2){const f=m.filter(b=>b.pass).length/m.length;f>=.3&&f<=.7&&(c.flaky=!0)}const p=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(p&&h){const x=p.assertions.find(b=>b.id===a),f=h.assertions.find(b=>b.id===a);x!=null&&x.pass&&(f!=null&&f.pass)&&(c.nonDiscriminating=!0)}if(s&&!s.pass&&i.length>=1){const f=i[0].assertions.find(b=>b.id===a);f!=null&&f.pass&&(c.regression=!0)}return c}function V2(){var ae;const{state:a,dispatch:s,saveEvals:i,runCase:c,runAll:d,cancelCase:m,cancelAll:p,generateEvals:h,isReadOnly:x}=Sn(),{evals:f,evalsError:b,selectedCaseId:g,inlineResults:j,caseRunStates:k,generateEvalsLoading:E,generateEvalsProgress:z,generateEvalsError:A}=a,N=y.useMemo(()=>{for(const Q of k.values())if(Q.status==="running"||Q.status==="queued")return!0;return!1},[k]),[T,H]=y.useState(!1),[$,O]=y.useState("all"),K={skill_name:a.skill,evals:[]},w=f??K,B=w.evals,M=y.useMemo(()=>$==="all"?B:B.filter(Q=>sr(Q)===$),[$,B]),V=M.find(Q=>Q.id===g)??null;y.useEffect(()=>{g!==null&&!M.find(Q=>Q.id===g)&&s({type:"SELECT_CASE",caseId:M.length>0?M[0].id:null})},[M,g,s]);const[I,Z]=y.useState([]),ne=y.useMemo(()=>B.some(Q=>sr(Q)==="integration"),[B]);y.useEffect(()=>{ne&&we.getCredentials(a.plugin,a.skill).then(Q=>Z(Q.credentials)).catch(()=>Z([]))},[a.plugin,a.skill,ne]);const J=y.useMemo(()=>new Set(I.filter(Q=>Q.status==="missing").map(Q=>Q.name)),[I]),[D,C]=y.useState(!1),L=y.useCallback(Q=>{C(!1),h(Q?{testType:Q}:void 0)},[h]);return!f||B.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:b?"var(--red-muted)":"var(--accent-muted)"},children:b?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:b?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:b}),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:()=>H(!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:()=>L("unit"),disabled:E||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:E?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:()=>C(!D),disabled:E||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"})})})]}),D&&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:()=>L("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"})})]})]}),E&&z.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ts,{entries:z,isRunning:!0})}),A&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Es,{error:A,onRetry:()=>L()})}),T&&n.jsx(fx,{evals:w,onSave:Q=>{i(Q),H(!1)},onCancel:()=>H(!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 (",M.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:N?n.jsx("button",{onClick:p,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:M.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>d("comparison"),disabled:M.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:()=>O(Q),style:{padding:"2px 8px",fontSize:10,fontWeight:$===Q?600:400,background:$===Q?"var(--accent-muted)":"transparent",color:$===Q?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Q==="all"?`All (${B.length})`:Q==="unit"?`Unit (${B.filter(pe=>sr(pe)==="unit").length})`:`Integration (${B.filter(pe=>sr(pe)==="integration").length})`},Q))}),n.jsxs("div",{className:"py-1",children:[M.length===0&&B.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",$==="all"?"":$+" ","tests yet"]}),M.map(Q=>{var re;const pe=j.get(Q.id),R=g===Q.id,X=sr(Q);return n.jsxs("button",{onClick:()=>s({type:"SELECT_CASE",caseId:Q.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:R?"var(--accent-muted)":"transparent",borderLeft:R?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:de=>{R||(de.currentTarget.style.background="var(--surface-2)")},onMouseLeave:de=>{R||(de.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:R?"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:X==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:X==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:X==="unit"?"U":"I"}),X==="integration"&&((re=Q.requiredCredentials)==null?void 0:re.some(de=>J.has(de)))&&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(Rv,{result:pe})]}),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":"",(pe==null?void 0:pe.passRate)!=null&&n.jsx(q2,{passRate:pe.passRate})]})]},Q.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&n.jsx("button",{onClick:()=>H(!0),className:"w-full py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{border:"1px dashed var(--border-default)",color:"var(--text-tertiary)",background:"transparent"},onMouseEnter: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(H2,{})})]}),n.jsx("div",{className:"overflow-auto",children:V?n.jsx(G2,{evalCase:V,result:j.get(V.id),evals:f,caseStatus:((ae=k.get(V.id))==null?void 0:ae.status)??"idle",onSaveEvals:i,onRun:Q=>c(Q,"benchmark"),onCompare:Q=>c(Q,"comparison"),onCancel:Q=>m(Q),onImprove:Q=>s({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"})}),T&&n.jsx(fx,{evals:w,onSave:Q=>{i(Q),H(!1)},onCancel:()=>H(!1)})]})}function G2({evalCase:a,result:s,evals:i,caseStatus:c,onSaveEvals:d,onRun:m,onCompare:p,onCancel:h,onImprove:x}){const{state:f,isReadOnly:b}=Sn(),{plugin:g,skill:j}=f,{entries:k,loading:E}=U2(g,j,a.id),[z,A]=y.useState(!1),[N,T]=y.useState(a.prompt),[H,$]=y.useState(!1),[O,K]=y.useState(a.expected_output);y.useState(()=>{T(a.prompt),K(a.expected_output)});const w=y.useCallback(Q=>{d({...i,evals:i.evals.map(pe=>pe.id===Q.id?Q:pe)})},[i,d]),B=y.useCallback(()=>{w({...a,prompt:N}),A(!1)},[a,N,w]),M=y.useCallback(()=>{w({...a,expected_output:O}),$(!1)},[a,O,w]),V=y.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),I=y.useCallback((Q,pe)=>{w({...a,assertions:a.assertions.map(R=>R.id===Q?{...R,text:pe}:R)})},[a,w]),Z=y.useCallback(Q=>{w({...a,assertions:a.assertions.filter(pe=>pe.id!==Q)})},[a,w]),ne=y.useCallback(()=>{confirm("Delete this test case?")&&d({...i,evals:i.evals.filter(Q=>Q.id!==a.id)})},[i,a.id,d]),J=s&&s.assertions.length>0&&s.assertions.every(Q=>Q.pass),D=s&&s.assertions.some(Q=>!Q.pass),C=sr(a),L=a.requiredCredentials??[],ae=C==="integration"&&L.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]}),b?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:C==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:C==="unit"?"var(--accent)":"var(--orange)"},children:C==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((C==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:pe,requirements:R,cleanup:X,...re}=a;w({...re,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${C==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:C==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:C==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:C==="unit"?"Unit":"Integration"}),n.jsx(Rv,{result:s})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[c==="running"||c==="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:()=>m(a.id),disabled:b,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>p(a.id),disabled:b,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),D&&!b&&c!=="running"&&c!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!b&&c!=="running"&&c!=="queued"&&n.jsx("button",{onClick:ne,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"})]})})]})]}),b&&C==="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"})]}),J&&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"})]}),ae&&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:L.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))})]}),!b&&C==="integration"&&n.jsx(Q2,{evalCase:a,onUpdate:w}),n.jsx(qi,{title:"Prompt",children:z?n.jsxs("div",{children:[n.jsx("textarea",{value:N,onChange:Q=>T(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:B,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{T(a.prompt),A(!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:b?"default":"pointer"},onClick:()=>{b||A(!0)},onMouseEnter:Q=>{b||(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:b?"No prompt":"Click to edit prompt..."})})}),n.jsx(qi,{title:"Expected Output",children:H?n.jsxs("div",{children:[n.jsx("textarea",{value:O,onChange:Q=>K(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:M,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{K(a.expected_output),$(!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:b?"default":"pointer"},onClick:()=>{b||$(!0)},onMouseEnter:Q=>{b||(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:b?"No expected output":"Click to edit expected output..."})})}),n.jsx(qi,{title:`Assertions (${a.assertions.length})`,action:b?void 0:n.jsx("button",{onClick:V,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 pe=s==null?void 0:s.assertions.find(X=>X.assertion_id===Q.id),R=I2(Q.id,pe,k);return n.jsx($2,{assertion:Q,result:pe,badges:R,isReadOnly:b,onUpdate:X=>I(Q.id,X),onDelete:()=>Z(Q.id)},Q.id)})})}),(s==null?void 0:s.output)&&n.jsx(Y2,{output:s.output,durationMs:s.durationMs,tokens:s.tokens}),s&&s.passRate!=null&&s.passRate<.2&&(()=>{const Q=Ev("INEFFECTIVE",s.passRate);return Q.recommendations&&Q.recommendations.length>0?n.jsx(qi,{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((pe,R)=>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:"•"}),pe]},R))})]})}):null})(),n.jsx(K2,{evalId:a.id,sharedEntries:k,sharedLoading:E})]},a.id)}function $2({assertion:a,result:s,badges:i,isReadOnly:c,onUpdate:d,onDelete:m}){const[p,h]=y.useState(!1),[x,f]=y.useState(a.text),[b,g]=y.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:[s?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:s.pass?"var(--green-muted)":"var(--red-muted)"},children:s.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."})]}),p?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:k=>f(k.target.value),onKeyDown:k=>{k.key==="Enter"&&j(),k.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:c?"default":"pointer"},onClick:()=>{c||(f(a.text),h(!0))},children:a.text}),(s==null?void 0:s.reasoning)&&n.jsx("button",{onClick:()=>g(!b),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:b?"Hide reasoning":"Show reasoning"}),b&&(s==null?void 0:s.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:s.reasoning})]}),!c&&n.jsx("button",{onClick:m,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:k=>{k.currentTarget.style.color="var(--red)",k.currentTarget.style.opacity="1"},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)",k.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 qi({title:a,action:s,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}),s]}),i]})}function Rv({result:a}){const[s,i]=y.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 c=a.status==="pass",d=a.passRate??0,p=Ev(c?"PASS":"FAIL",d);return n.jsxs("span",{className:"pill text-[10px]",style:{background:c?"var(--green-muted)":"var(--red-muted)",color:c?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":s?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,s&&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:p.explanation})]})}function q2({passRate:a}){const s=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:`${s}%`,background:s>=80?"var(--green)":s>=50?"var(--yellow)":"var(--red)"}})})})}function Y2({output:a,durationMs:s,tokens:i}){const[c,d]=y.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>d(!c),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:c?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",s!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(s/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),c&&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 Iu(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Vu({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:Nv(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:dr(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:wv(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 s=a.pass_rate-a.baselinePassRate,i=s>.001?"skill":s<-.001?"baseline":"tie",c=s>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:s>=0?"var(--green)":"var(--red)"},children:[c,(s*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(s=>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:s.pass?"var(--green-muted)":"var(--red-muted)"},children:s.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:s.text})]},s.id))})]})}function K2({evalId:a,sharedEntries:s,sharedLoading:i}){const{state:c,dispatch:d}=Sn(),{plugin:m,skill:p}=c,[h,x]=y.useState(!0),f=s??null,b=i??!1,g=y.useCallback(()=>{x(z=>!z)},[]),j=f?f.slice(0,10):[],k=j.some(z=>{const A=Iu(z.type);return A==="left"||A==="full"}),E=j.some(z=>{const A=Iu(z.type);return A==="right"||A==="full"});return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:g,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",f&&f.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",f.length," run",f.length!==1?"s":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:b?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..."})]}):!f||f.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(Cv,{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"}),!k&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!E&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((z,A)=>{const N=Iu(z.type);return N==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Vu,{entry:z})},A):N==="left"?n.jsxs(y.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Vu,{entry:z})}),n.jsx("div",{style:{gridColumn:"2"}})]},A):n.jsxs(y.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(Vu,{entry:z})})]},A)})]}),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:z=>{z.currentTarget.style.textDecoration="underline"},onMouseLeave:z=>{z.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function fx({evals:a,onSave:s,onCancel:i}){const[c,d]=y.useState(""),[m,p]=y.useState(""),[h,x]=y.useState(""),[f,b]=y.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=y.useState("unit"),[k,E]=y.useState(""),[z,A]=y.useState([]),[N,T]=y.useState(""),[H,$]=y.useState(""),O=Math.max(0,...a.evals.map(M=>M.id))+1,K=M=>{j(M),M==="unit"&&(A([]),E(""),T(""),$(""))},w=()=>{const M=k.trim().toUpperCase();M&&!z.includes(M)&&A([...z,M]),E("")},B=()=>{if(!c.trim()||!m.trim())return;const M={id:O,name:c.trim(),prompt:m.trim(),expected_output:h.trim(),files:[],assertions:f.filter(V=>V.text.trim()),...g==="integration"?{testType:"integration",...z.length>0?{requiredCredentials:z}:{},...N||H?{requirements:{...N?{platform:N}:{},...H?{chromeProfile:H}:{}}}:{}}:{}};s({...a,evals:[...a.evals,M]})};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(M=>n.jsx("button",{onClick:()=>K(M),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===M?M==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:g===M?M==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:M},M))})]}),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:c,onChange:M=>d(M.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:m,onChange:M=>p(M.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:M=>x(M.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"}),f.map((M,V)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:M.text,onChange:I=>b(f.map((Z,ne)=>ne===V?{...Z,text:I.target.value}:Z)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),f.length>1&&n.jsx("button",{onClick:()=>b(f.filter((I,Z)=>Z!==V)),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"})]})})]},M.id)),n.jsx("button",{onClick:()=>b([...f,{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--accent)"},children:"+ Add Assertion"})]}),g==="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:z.map(M=>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:[M,n.jsx("button",{onClick:()=>A(z.filter(V=>V!==M)),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"})]})})]},M))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:k,onChange:M=>E(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.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:N,onChange:M=>T(M.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:H,onChange:M=>$(M.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:B,disabled:!c.trim()||!m.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function Q2({evalCase:a,onUpdate:s}){var p,h;const[i,c]=y.useState(""),d=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&s({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),c("")},m=x=>{const f=(a.requiredCredentials??[]).filter(b=>b!==x);s({...a,requiredCredentials:f.length>0?f: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:()=>m(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=>c(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:((p=a.requirements)==null?void 0:p.platform)??"",onChange:x=>s({...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=>s({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function jn(a,s){return s==="free"?"Free":s==="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 Av(a,s){return a==null||s==null?"N/A":`${a.toLocaleString("en-US")} in / ${s.toLocaleString("en-US")} out`}function X2(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function W2(a,s){let i="";if(s){const d=new Date(s);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 Z2(a,s,i){const c=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${c}`;const d=Math.round(Math.abs(a)*s);if(d===0)return`Your skill performs the same as the baseline across ${i} ${c}`;const m=a>0?"more":"fewer";return`Your skill passes ${d} ${m} assertions across ${i} ${c}`}function px(a,s){const i=c=>{const d=c/5*100;return isFinite(d)?Math.round(Math.min(100,Math.max(0,d))):0};return{skill:i(a),baseline:i(s)}}function F2(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function J2(a,s){const i=a+s,c=i*10,d=i*25,m=p=>p>=60?`${Math.round(p/60)}m`:`${p}s`;return`${m(c)}–${m(d)}`}const P2={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function ej(a,s){if(!a)return null;const i=P2[a];if(i==null||i===0)return null;const c=i*s*.5,d=i*s*2;return`${jn(c)}–${jn(d)}`}function tj(){const{state:a,runCase:s,runAll:i,cancelCase:c,cancelAll:d,isReadOnly:m}=Sn(),{evals:p,caseRunStates:h,bulkRunActive:x,latestBenchmark:f,inlineResults:b}=a,{config:g}=Yl(),j=(p==null?void 0:p.evals)??[],k=y.useMemo(()=>{for(const w of h.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[h]),E=j.filter(w=>{const B=h.get(w.id);return B&&(B.status==="complete"||B.status==="error"||B.status==="cancelled")}).length,z=j.filter(w=>{const B=h.get(w.id);return B&&(B.status==="running"||B.status==="queued")}).length,A=y.useRef(null),[N,T]=y.useState(0);y.useEffect(()=>{if(k&&!A.current&&(A.current=Date.now()),!k){A.current=null,T(0);return}const w=setInterval(()=>{A.current&&T(Math.round((Date.now()-A.current)/1e3))},1e3);return()=>clearInterval(w)},[k]);const H=j.reduce((w,B)=>w+B.assertions.length,0),$=j.length+H,O=y.useMemo(()=>J2(j.length,H),[j.length,H]),K=y.useMemo(()=>ej((g==null?void 0:g.provider)??null,$),[g==null?void 0:g.provider,$]);return n.jsxs("div",{className:"p-5",children:[m&&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"}),k&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[z," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[k&&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||k||m,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||k||m,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||k||m,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!k&&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: ",O]}),K&&n.jsxs("span",{children:["Est. cost: ",K]}),!K&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!K&&(g==null?void 0:g.provider)&&(g.provider==="ollama"||g.provider==="lm-studio"||g.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),k&&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: ",E,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(E/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:`${E/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: ",N>=60?`${Math.floor(N/60)}m ${N%60}s`:`${N}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",O]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(w=>{const B=b.get(w.id),M=h.get(w.id),V=(M==null?void 0:M.status)??"idle",I=f==null?void 0:f.cases.find(Z=>Z.eval_id===w.id);return n.jsx(lj,{name:w.name,evalId:w.id,result:B,caseCost:I==null?void 0:I.cost,caseBillingMode:I==null?void 0:I.billingMode,caseInputTokens:I==null?void 0:I.inputTokens,caseOutputTokens:I==null?void 0:I.outputTokens,caseStatus:V,runMode:(M==null?void 0:M.mode)??null,comparisonDetail:I==null?void 0:I.comparisonDetail,isReadOnly:m,onRun:Z=>s(Z,"benchmark"),onBaseline:Z=>s(Z,"baseline"),onCompare:Z=>s(Z,"comparison"),onCancel:Z=>c(Z)},w.id)})}),!k&&f&&f.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:X2(f.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(f.overall_pass_rate??0)>=.8?"var(--green)":(f.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:f.overall_pass_rate!=null?`${Math.round(f.overall_pass_rate*100)}%`:"--"})]}),f.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(f.totalDurationMs/1e3).toFixed(1),"s",f.model&&` | Model: ${f.model}`,f.totalInputTokens!=null&&f.totalOutputTokens!=null&&` | Tokens: ${Av(f.totalInputTokens,f.totalOutputTokens)}`,f.totalCost!=null&&` | Cost: ${jn(f.totalCost)}`]}),f.overall_pass_rate>=.9999&&!f.comparison&&n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||m,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"})]}),f.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=W2(f.model,f.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(mx,{label:"Skill",value:f.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(mx,{label:"Baseline",value:f.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:f.comparison.delta>0?"var(--green)":f.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",f.comparison.delta>0?"+":"",(f.comparison.delta*100).toFixed(1),"%",f.verdict&&` | ${B2(f.verdict)}`]}),(()=>{const w=f.cases.reduce((M,V)=>M+V.assertions.length,0),B=Z2(f.comparison.delta,w,f.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:B})})()]})]})]})}const nj={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 lj({name:a,evalId:s,result:i,caseCost:c,caseBillingMode:d,caseInputTokens:m,caseOutputTokens:p,caseStatus:h,runMode:x,comparisonDetail:f,isReadOnly:b,onRun:g,onBaseline:j,onCompare:k,onCancel:E}){const[z,A]=y.useState(!1),N=h==="running"||h==="queued",T=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:N?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:N?"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:["#",s," ",a]}),x&&(N||T)&&(()=>{const H=nj[x];return H?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:H.bg,color:H.color,padding:"1px 6px"},children:H.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[N?n.jsx("button",{onClick:()=>E(s),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:()=>k(s),disabled:b,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(s),disabled:b,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(s),disabled:b,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}),m!=null&&p!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Av(m,p)}),c!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:jn(c,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(H=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:H.pass?"var(--green)":"var(--red)"},children:H.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:H.text})]},H.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>A(!z),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:z?"Hide output":"Show output"}),z&&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})]}),f&&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 H=px(f.skillContentScore,f.baselineContentScore),$=px(f.skillStructureScore,f.baselineStructureScore),O=F2(f.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",H.skill,"% / Baseline ",H.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",$.skill,"% / Baseline ",$.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsx("span",{style:{color:O.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:O.text})]})})()})})}),i&&i.errorMessage&&n.jsx(aj,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Gu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function aj({errorMessage:a,classifiedError:s}){const[i,c]=y.useState(!1),d=(s==null?void 0:s.title)??"Error",m=s==null?void 0:s.hint,p=s?Gu[s.category]??Gu.unknown:Gu.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:p}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:d}),n.jsx("button",{onClick:()=>c(!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"})]}),m&&n.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:m}),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 mx({label:a,value:s,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(s*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:`${s*100}%`,background:i}})})]})}const hx={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 rj(){const{state:a,dispatch:s,runActivationTest:i,cancelActivation:c,generateActivationPrompts:d}=Sn(),{plugin:m,skill:p,activationPrompts:h,activationResults:x,activationSummary:f,activationRunning:b,activationError:g,activationStartedAt:j,activationClassifyingStatus:k,generatingPrompts:E,generatingPromptsError:z,activationHistory:A}=a,[N,T]=y.useState(h),[H,$]=y.useState(null),[O,K]=y.useState(!1);y.useEffect(()=>{h&&h!==N&&T(h)},[h]),y.useEffect(()=>{s({type:"SET_ACTIVATION_PROMPTS",prompts:N})},[N,s]),y.useEffect(()=>{fetch(`/api/skills/${m}/${p}/description`).then(D=>D.json()).then(D=>$(D.rawContent||D.description||null)).catch(()=>$(null))},[m,p]);function w(){i(N)}function B(){d(8)}const M=N.trim().split(`
66
- `).filter(Boolean).length,V=x.filter(D=>D.classification==="TP"||D.classification==="TN"),I=x.filter(D=>D.classification==="FP"||D.classification==="FN"),Z=(H==null?void 0:H.replace(/^---[\s\S]*?---\s*/,"").trim())??null,ne=N.trim().length>0,J=Z?uo(Z):"";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:B,disabled:E||!Z||b,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:E?"var(--surface-3)":"var(--surface-2)",color:Z?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:Z?1:.5,cursor:Z?"pointer":"not-allowed"},title:Z?void 0:"No skill description available",onMouseEnter:D=>{Z&&!E&&(D.currentTarget.style.background="var(--surface-3)")},onMouseLeave:D=>{E||(D.currentTarget.style.background="var(--surface-2)")},children:E?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"})}),ne?"Regenerate":"Generate"," Test Prompts"]})})})]}),!Z&&!b&&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."}),z&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:z}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:N,onChange:D=>T(D.target.value),placeholder:`How do I write a unit test?
67
- What edge cases should I test?
68
- +Deploy this to production
69
- !What's the weather like today?
70
- !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(Yi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Yi,{}),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(Yi,{}),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(Yi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[M," prompt",M!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:w,disabled:b||!N.trim(),className:"btn btn-primary",children:b?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"]})}),b&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:c,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k||`${x.length} / ${M} prompts tested`,j&&n.jsx(cj,{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:Z?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:J}}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),g&&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:g}),b&&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:[I.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 (",I.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:I.map((D,C)=>n.jsx(xx,{result:D},`incorrect-${C}`))})]}),V.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 (",V.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:V.map((D,C)=>n.jsx(xx,{result:D},`correct-${C}`))})]})]}),f&&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"}),f.autoClassifiedCount!=null&&f.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[f.autoClassifiedCount," of ",f.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx($u,{label:"Precision",value:f.precision,description:"Of all activations, how many were correct?",detail:`${f.tp} true / ${f.tp+f.fp} total activations`}),n.jsx($u,{label:"Recall",value:f.recall,description:"Of expected activations, how many fired?",detail:`${f.tp} activated / ${f.tp+f.fn} expected`}),n.jsx($u,{label:"Reliability",value:f.reliability,description:"Overall correct classification rate",detail:`${f.tp+f.tn} correct / ${f.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(Ki,{label:"True Positive",abbr:"TP",count:f.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Ki,{label:"False Positive",abbr:"FP",count:f.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Ki,{label:"False Negative",abbr:"FN",count:f.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Ki,{label:"True Negative",abbr:"TN",count:f.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(sj,{history:A,expanded:O,onToggle:()=>K(!O)})]})}function sj({history:a,expanded:s,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:s?"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:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),s&&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(c=>n.jsx(ij,{run:c},c.id))})})]})}function ij({run:a}){const s=Math.round(a.summary.reliability*100),i=s>=80?"var(--green)":s>=60?"var(--yellow)":"var(--red)",c=s>=80?"Good":s>=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:oj(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:[s,"%"]}),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:c})]})]})}function oj(a){const s=Date.now(),i=new Date(a).getTime(),c=Math.floor((s-i)/1e3);if(c<60)return"just now";const d=Math.floor(c/60);if(d<60)return`${d}m ago`;const m=Math.floor(d/60);if(m<24)return`${m}h ago`;const p=Math.floor(m/24);return p<7?`${p}d ago`:new Date(a).toLocaleDateString()}function Yi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function xx({result:a}){const s=hx[a.classification]||hx.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:s.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, ${s.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:s.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:s.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:s.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 $u({label:a,value:s,description:i,detail:c}){const d=Math.round(s*100),m=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:m},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:c})]})}function Ki({abbr:a,count:s,bg:i,color:c,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:c},children:s}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:c},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:d})]})}function cj({startedAt:a}){const[s,i]=y.useState(0);return y.useEffect(()=>{const c=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(c)},[a]),n.jsxs("span",{className:"ml-2",children:["(",s,"s)"]})}const qu={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},vx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},nd=600,ld=180,en=40,Yu=nd-en*2,Gl=ld-en*2,uj=[25,50,75,100];function yx(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function dj(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function fj({entries:a,onPointClick:s}){const[i,c]=y.useState(null),d=y.useMemo(()=>[...a].reverse(),[a]);if(d.length<2)return null;const m=d.length,p=d.map((f,b)=>{const g=en+b/(m-1)*Yu,j=f.passRate*100,k=en+Gl-j/100*Gl;return{x:g,y:k,pct:j,entry:f}}),h=p.map(f=>`${f.x},${f.y}`).join(" "),x=Array.from(new Set(d.map(f=>f.type)));return n.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:m>=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(f=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:qu[f]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:vx[f]??f})]},f))}),n.jsxs("svg",{width:nd,height:ld,viewBox:`0 0 ${nd} ${ld}`,style:{display:"block",overflow:"visible"},children:[uj.map(f=>{const b=en+Gl-f/100*Gl;return n.jsxs("g",{children:[n.jsx("line",{x1:en,y1:b,x2:en+Yu,y2:b,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:en-8,y:b+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[f,"%"]})]},f)}),n.jsx("line",{x1:en,y1:en+Gl,x2:en+Yu,y2:en+Gl,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:en-8,y:en+Gl+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"}),p.map((f,b)=>n.jsx("circle",{cx:f.x,cy:f.y,r:5,fill:qu[f.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:g=>{g.currentTarget.setAttribute("r","7"),c({x:f.x,y:f.y,entry:f.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),c(null)},onClick:()=>s==null?void 0:s(f.entry)},b)),pj(m).map(f=>n.jsx("text",{x:p[f].x,y:en+Gl+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:yx(d[f].timestamp)},f))]}),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:yx(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:qu[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:vx[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:dj(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function pj(a){if(a<=3)return Array.from({length:a},(c,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 s=Math.ceil(a/10),i=[0];for(let c=s;c<a-1;c+=s)i.push(c);return i.push(a-1),i}const ds=new Map;let tn=null,Fi=null,Qi=1e3,fs=0;function Mv(){if(tn)return;tn=new EventSource("/api/events");const a=s=>i=>{let c={};try{c=i.data?JSON.parse(i.data):{}}catch{}const d=ds.get(s);if(d)for(const m of d)m(c)};tn.addEventListener("benchmark:complete",a("benchmark:complete")),tn.addEventListener("history:written",a("history:written")),tn.addEventListener("leaderboard:updated",a("leaderboard:updated")),tn.onerror=()=>{tn==null||tn.close(),tn=null,fs>0&&(Fi=setTimeout(()=>{Qi=Math.min(Qi*2,3e4),Mv()},Qi))},tn.onopen=()=>{Qi=1e3}}function mj(){Fi!=null&&(clearTimeout(Fi),Fi=null),tn==null||tn.close(),tn=null}function hj(a,s){return ds.has(a)||ds.set(a,new Set),ds.get(a).add(s),fs++,Mv(),()=>{var i;(i=ds.get(a))==null||i.delete(s),fs--,fs<=0&&(fs=0,mj())}}function no(a,s){const i=y.useRef(s);i.current=s,y.useEffect(()=>hj(a,d=>i.current(d)),[a])}function lo(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function xj(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function vj({rate:a,label:s}){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:s}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:lo(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:lo(a)}})})]})})}function yj({points:a}){if(a.length<2)return null;const s=200,i=48,c=4,d=a.length,m=a.map((x,f)=>{const b=c+f/(d-1)*(s-c*2),g=c+(i-c*2)-x.passRate*(i-c*2);return{x:b,y:g}}),p=`M ${m[0].x},${i-c} `+m.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${m[m.length-1].x},${i-c} Z`,h=m.map((x,f)=>`${f===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:s,height:i,style:{display:"block"},children:[n.jsx("path",{d:p,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:m[m.length-1].x,cy:m[m.length-1].y,r:3,fill:"var(--accent)"})]})}function gj({plugin:a,skill:s}){const i=`stats/${a}/${s}`,c=y.useCallback(()=>we.getStats(a,s),[a,s]),{data:d,loading:m}=co(i,c),p=y.useCallback(()=>Cs(i),[i]);if(no("benchmark:complete",p),no("history:written",p),m)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,f=h-x,b=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:lo(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:f>=0?"var(--green)":"var(--red)"},children:[f>=0?"+":"",Math.round(f*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:jn(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:jn(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(yj,{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(g=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:g.model}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.runs}),n.jsx("td",{style:{padding:"8px",textAlign:"center"},children:n.jsxs("span",{className:"font-semibold",style:{color:lo(g.avgPassRate)},children:[Math.round(g.avgPassRate*100),"%"]})}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:xj(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?jn(g.avgCost):"N/A"})]},g.model))})]})]}),b.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:b.map(g=>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:["#",g.evalId]}),n.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:g.evalName}),n.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[g.totalRuns," runs"]})]}),n.jsx(vj,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function bj({plugin:a,skill:s}){const[i,c]=y.useState(null),[d,m]=y.useState(null),[p,h]=y.useState({}),[x,f]=y.useState({});y.useEffect(()=>{we.getEvals(a,s).then(c).catch(()=>c(null))},[a,s]);async function b(g){if(d===g){m(null);return}if(m(g),!p[g]){f(j=>({...j,[g]:!0}));try{const j=await we.getCaseHistory(a,s,g);h(k=>({...k,[g]:j}))}catch{h(j=>({...j,[g]:[]}))}finally{f(j=>({...j,[g]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(g=>{const j=p[g.id]||[],k=d===g.id,E=x[g.id],z=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>b(g.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:k?"var(--surface-2)":"transparent"},onMouseEnter:A=>{k||(A.currentTarget.style.background="var(--surface-2)")},onMouseLeave:A=>{k||(A.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:k?"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:["#",g.id]}),n.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:g.name}),j.length>=2&&n.jsx(Cv,{entries:j}),z!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:dr(z)},children:[Math.round(z*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"]})]}),k&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:E?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((A,N)=>n.jsxs("div",{className:"p-4",style:{background:N===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:Nv(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"?"rgba(99,131,255,0.15)":A.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:A.type==="benchmark"?"#6383ff":A.type==="comparison"?"var(--purple)":"#fb923c"},children:A.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:dr(A.pass_rate)},children:[Math.round(A.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:[A.durationMs!=null&&n.jsx("span",{children:wv(A.durationMs)}),A.tokens!=null&&n.jsxs("span",{children:[A.tokens>=1e3?`${(A.tokens/1e3).toFixed(1)}k`:A.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:A.assertions.map(T=>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:T.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:T.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:T.text}),T.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:T.reasoning})]})]},T.id))})]},N))})})]},g.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 jj(){const{state:a,dispatch:s}=Sn(),{plugin:i,skill:c}=a,[d,m]=y.useState("timeline"),[p,h]=y.useState(""),[x,f]=y.useState(""),[b,g]=y.useState(!1),[j,k]=y.useState([]),[E,z]=y.useState(null),[A,N]=y.useState(!1),[T,H]=y.useState(null),[$,O]=y.useState(!1),K=`history/${i}/${c}?model=${p}&type=${x}`,w=y.useCallback(()=>we.getHistory(i,c,{model:p||void 0,type:x||void 0}),[i,c,p,x]),{data:B,loading:M}=co(K,w),V=B??[];y.useEffect(()=>{!B||B.length<2||we.compareRuns(i,c,B[0].timestamp,B[1].timestamp).then(D=>{const C=D.regressions.filter(L=>L.change==="regression");s({type:"SET_REGRESSIONS",regressions:C})}).catch(()=>{})},[B,i,c,s]);const I=y.useCallback(()=>Cs(K),[K]);no("history:written",I);const Z=y.useCallback(async D=>{if(b){k(C=>C.includes(D)?C.filter(L=>L!==D):C.length>=2?[C[1],D]:[...C,D]);return}O(!0);try{const C=await we.getHistoryEntry(i,c,D);H(C)}catch{}finally{O(!1)}},[i,c,b]),ne=y.useCallback(async()=>{if(j.length===2){N(!0);try{const D=await we.compareRuns(i,c,j[0],j[1]);z(D)}catch{}finally{N(!1)}}},[i,c,j]),J=[...new Set(V.map(D=>D.model))];return M?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(D=>n.jsx("button",{onClick:()=>m(D),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:d===D?"var(--accent-muted)":"transparent",color:d===D?"var(--accent)":"var(--text-tertiary)"},children:D==="timeline"?"Timeline":D==="per-eval"?"Per Eval":"Statistics"},D))}),d==="timeline"&&n.jsxs("div",{children:[V.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(fj,{entries:V,onPointClick:D=>Z(D.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:p,onChange:D=>h(D.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),J.map(D=>n.jsx("option",{value:D,children:D},D))]}),n.jsxs("select",{value:x,onChange:D=>f(D.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:()=>{g(!b),k([]),z(null)},className:`btn text-[12px] ${b?"btn-primary":"btn-secondary"}`,children:b?"Exit Compare":"Compare Runs"}),b&&j.length===2&&n.jsx("button",{onClick:ne,disabled:A,className:"btn btn-primary text-[12px]",children:A?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:V.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):V.map(D=>{const C=j.includes(D.timestamp);return n.jsx("button",{onClick:()=>Z(D.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:C?"var(--accent-muted)":"var(--surface-1)",border:C?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:L=>{C||(L.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:L=>{C||(L.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:[b&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:C?"var(--accent)":"var(--border-default)",background:C?"var(--accent)":"transparent"},children:C&&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(D.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:D.type==="comparison"?"var(--purple-muted)":D.type==="baseline"?"var(--surface-3)":D.type==="model-compare"?"var(--accent-muted)":D.type==="improve"||D.type==="instruct"?"var(--purple-muted)":D.type==="ai-generate"?"var(--green-muted)":D.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:D.type==="comparison"?"var(--purple)":D.type==="baseline"?"var(--text-tertiary)":D.type==="model-compare"?"var(--accent)":D.type==="improve"||D.type==="instruct"?"var(--purple)":D.type==="ai-generate"?"var(--green)":D.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:D.type==="model-compare"?"model compare":D.type==="improve"?"ai improve":D.type==="instruct"?"ai edit":D.type==="ai-generate"?"ai generate":D.type==="eval-generate"?"eval generate":D.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:D.model}),D.totalCost!=null&&D.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:jn(D.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:D.passRate>=.8?"var(--green)":D.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(D.passRate*100),"%"]})]})]})},D.timestamp)})}),E&&n.jsx(Sj,{result:E}),T&&!b&&n.jsx(kj,{run:T,onClose:()=>H(null)})]}),d==="per-eval"&&n.jsx(bj,{plugin:i,skill:c}),d==="statistics"&&n.jsx(gj,{plugin:i,skill:c})]})}function Sj({result:a}){const s=a.regressions.filter(c=>c.change==="regression"),i=a.regressions.filter(c=>c.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: ",jn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",jn(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: ",jn(a.runB.totalCost-a.runA.totalCost)]})]}),s.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 (",s.length,")"]}),s.map(c=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",c.evalId," ",c.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:c.assertionId})," (was passing, now failing)"]},`${c.evalId}-${c.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(c=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",c.evalId," ",c.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:c.assertionId})," (was failing, now passing)"]},`${c.evalId}-${c.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(c=>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:["#",c.eval_id," ",c.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:c.passRateA!=null?c.passRateA>=.8?"var(--green)":c.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:c.passRateA!=null?`${Math.round(c.passRateA*100)}%`:c.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:c.passRateB!=null?c.passRateB>=.8?"var(--green)":c.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:c.passRateB!=null?`${Math.round(c.passRateB*100)}%`:c.statusB})]},c.eval_id))})]})})]})}function kj({run:a,onClose:s}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(Nj,{run:a,onClose:s}):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:s,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: ${jn(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:jn(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 Nj({run:a,onClose:s}){var m;const i=y.useMemo(()=>a.improve?fo(a.improve.original,a.improve.improved):[],[a.improve]),c=y.useMemo(()=>{const p=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:p,removed:h}},[i]),d=y.useMemo(()=>{let p=0,h=0;return i.map(x=>x.type==="removed"?(p++,{...x,origNum:p,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(p++,h++,{...x,origNum:p,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:["+",c.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",c.removed]})]}),n.jsx("button",{onClick:s,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:p=>{p.currentTarget.style.background="var(--surface-3)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},children: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"})]})})]})]}),((m=a.improve)==null?void 0:m.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((p,h)=>n.jsxs("tr",{style:{background:p.type==="added"?"var(--green-muted)":p.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:p.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:p.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:p.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:p.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"transparent",borderRight:p.type==="added"?"2px solid var(--green)":p.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:p.type==="added"?"+":p.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:p.type==="added"?"var(--green)":p.type==="removed"?"var(--red)":"var(--text-secondary)"},children:p.content||"​"})]},h))})})})]})}function wj({plugin:a,skill:s}){const[i,c]=y.useState([]),[d,m]=y.useState([]),[p,h]=y.useState(!0),[x,f]=y.useState(null);y.useEffect(()=>{we.getDependencies(a,s).then(g=>{c(g.mcpDependencies),m(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,s]);async function b(g,j){try{await navigator.clipboard.writeText(j),f(g),setTimeout(()=>f(null),2e3)}catch{}}return p?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(g=>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:g.server}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.transport})]}),n.jsx("button",{onClick:()=>b(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===g.server?"var(--green)":"var(--accent)"},children:x===g.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:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.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))})]},g.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(g=>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:g.name}),n.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:g.source==="frontmatter"?"frontmatter":"referenced"})]},g.name))})]})]})]})}function gx({plugin:a,skill:s}){const[i,c]=y.useState([]),[d,m]=y.useState(!0),[p,h]=y.useState(null),[x,f]=y.useState(""),[b,g]=y.useState(!1),[j,k]=y.useState(null),[E,z]=y.useState(""),[A,N]=y.useState(""),[T,H]=y.useState(!1),[$,O]=y.useState(new Set),K=y.useCallback(async()=>{m(!0);try{const[V,I]=await Promise.all([we.getCredentials(a,s).catch(()=>({credentials:[]})),we.getParams(a,s).catch(()=>({params:[]}))]),Z=new Map(I.params.map(D=>[D.name,D])),ne=new Set,J=[];for(const D of V.credentials){ne.add(D.name);const C=Z.get(D.name);J.push({name:D.name,status:D.status==="ready"||D.status==="resolved"?"ready":"missing",source:D.source,maskedValue:C==null?void 0:C.maskedValue})}for(const D of I.params)ne.has(D.name)||J.push({name:D.name,status:D.status,maskedValue:D.maskedValue});c(J)}finally{m(!1)}},[a,s]);y.useEffect(()=>{K()},[K]);const w=y.useCallback(async V=>{if($.has(V)){O(I=>{const Z=new Set(I);return Z.delete(V),Z}),c(I=>I.map(Z=>Z.name===V?{...Z,revealedValue:void 0}:Z));return}try{const Z=(await we.getParamsRevealed(a,s,V)).params.find(ne=>ne.name===V);Z&&(c(ne=>ne.map(J=>J.name===V?{...J,revealedValue:Z.value}:J)),O(ne=>new Set(ne).add(V)))}catch{}},[a,s,$]),B=async(V,I)=>{if(!(!V.trim()||!I.trim())){g(!0),k(null);try{await we.setCredential(a,s,V,I),h(null),f(""),O(new Set),K()}catch(Z){k(Z.message)}finally{g(!1)}}},M=async()=>{if(!(!E.trim()||!A.trim())){g(!0),k(null);try{await we.setCredential(a,s,E.trim().toUpperCase(),A),z(""),N(""),H(!1),K()}catch(V){k(V.message)}finally{g(!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:()=>H(!T),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&&!T?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(V=>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:V.name}),V.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:$.has(V.name)&&V.revealedValue!=null?V.revealedValue:V.maskedValue}),V.maskedValue&&n.jsx("button",{onClick:()=>w(V.name),className:"btn btn-ghost px-1",title:$.has(V.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:$.has(V.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:V.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:V.status==="ready"?"var(--green)":"var(--orange)"},children:V.status==="ready"?"ready":"missing"}),V.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:V.source}),p===V.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:I=>f(I.target.value),onKeyDown:I=>{I.key==="Enter"&&B(V.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>B(V.name,x),disabled:b||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:b?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),f("")},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(V.name),f("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},V.name))}),T&&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:E,onChange:V=>z(V.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:A,onChange:V=>N(V.target.value),onKeyDown:V=>{V.key==="Enter"&&M()},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:()=>{H(!1),z(""),N("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:M,disabled:b||!E.trim()||!A.trim(),className:"btn btn-primary text-[10px]",children:b?"Saving...":"Save"})]})]})]})}function Cj(){const{state:a}=Sn(),{plugin:s,skill:i}=a,[c,d]=y.useState(null),[m,p]=y.useState(!0);return y.useEffect(()=>{we.getDependencies(s,i).then(d).catch(()=>{}).finally(()=>p(!1))},[s,i]),m?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"})]}):c?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(wj,{plugin:s,skill:i}),n.jsx(gx,{plugin:s,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(gx,{plugin:s,skill:i})]})}function zv({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const s=a.slice(-10),i=80,c=24,d=2,m=i-d*2,p=c-d*2,h=s.length,x=Math.min(...s),b=Math.max(...s)-x||1,g=s.map((E,z)=>{const A=d+z/(h-1)*m,N=d+p-(E-x)/b*p;return`${A.toFixed(1)},${N.toFixed(1)}`}),j=s[s.length-1],k=dr(j);return n.jsxs("svg",{width:i,height:c,viewBox:`0 0 ${i} ${c}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:k,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[E,z]=g[g.length-1].split(",");return n.jsx("circle",{cx:E,cy:z,r:2.5,fill:k})})()]})}function Ej(){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 Tj({pct:a}){const s=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",c=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:s,fontSize:10,fontWeight:600},children:[c,a.toFixed(1),"%"]})}function Rj({score:a,rating:s}){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)"}},c=i[s]??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:c.bg,color:c.fg,fontSize:11,fontWeight:600},children:[d,a.toFixed(1),"% (",s.toUpperCase(),")"]})]})}function Aj({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 Mj({active:a,onChange:s,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:()=>s("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:()=>s("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 zj(a){var c,d,m;if(a.length===0)return[];const s=new Map;for(const p of a)for(const h of p.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;s.has(x)||s.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 f=s.get(x);f.passRates.push(h.passRate.mean),f.lastRubric=((c=h.rubricScore)==null?void 0:c.mean)??null,f.lastDuration=h.duration.mean,f.lastCost=((d=h.cost)==null?void 0:d.total)??null,f.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(f.lastBaselinePassRate=h.baselinePassRate.mean,f.lastSkillDelta=(m=h.skillDelta)==null?void 0:m.mean,f.lastAmplificationPct=h.amplificationPct,f.hasBaseline=!0)}const i=[];for(const[p,h]of s){const[x,...f]=p.split("/");i.push({rank:0,model:f.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((p,h)=>{const x=p.compositeScore??p.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((p,h)=>{p.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const Dv=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function Dj({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(s=>n.jsx("th",{style:Dv(s==="#"?"center":"left"),children:s},s))})}),n.jsx("tbody",{children:a.map(s=>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:s.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:s.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider}),s.isBest&&n.jsx(Ej,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:dr(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:s.rubricScore!=null?s.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:s.duration<1e3?`${Math.round(s.duration)}ms`:`${(s.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:s.cost!=null?`$${s.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(zv,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function Lj({entries:a}){const s=[...a].filter(i=>i.hasBaseline).sort((i,c)=>(c.amplificationPct??0)-(i.amplificationPct??0));return s.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:Dv(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:s.map((i,c)=>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:c+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:dr(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(Tj,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(zv,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function _j(){const{state:a}=Sn(),{plugin:s,skill:i}=a,[c,d]=y.useState("rankings"),m=`leaderboard/${s}/${i}`,p=y.useCallback(()=>we.getLeaderboard(s,i),[s,i]),{data:h,loading:x,error:f}=co(m,p),b=(h==null?void 0:h.entries)??[],g=(f==null?void 0:f.message)??null;y.useEffect(()=>{d("rankings")},[s,i]);const j=y.useCallback(()=>Cs(m),[m]);no("leaderboard:updated",j);const k=y.useMemo(()=>zj(b),[b]),E=k.some(N=>N.hasBaseline),z=b[0],A=z==null?void 0:z.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g?n.jsx("div",{className:"flex items-center justify-center h-full px-8",children:n.jsxs("div",{className:"text-center",children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Failed to load leaderboard"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:g})]})}):k.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(Mj,{active:c,onChange:d,hasBaseline:E})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[b.length," sweep",b.length!==1?"s":""," · ",k.length," model",k.length!==1?"s":""]})]}),A&&n.jsx(Aj,{warning:A}),c==="rankings"?n.jsx(Dj,{entries:k}):n.jsx(Lj,{entries:k}),c==="amplification"&&(z==null?void 0:z.skillQualityScore)!=null&&(z==null?void 0:z.skillQualityRating)&&n.jsx(Rj,{score:z.skillQualityScore,rating:z.skillQualityRating})]})}const Oj=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Bj(a){return a!=null&&Oj.includes(a)}function Hj({hideHeader:a=!1}={}){var j;const{state:s,dispatch:i,saveContent:c,isReadOnly:d}=Sn(),{state:m,refreshSkills:p,clearSelection:h}=ya(),x=y.useCallback(async()=>{try{await we.deleteSkill(s.plugin,s.skill),p(),h()}catch(k){const E=k instanceof Error?k.message:String(k);i({type:"SET_ERROR",error:`Failed to delete skill: ${E}`})}},[s.plugin,s.skill,p,h,i]);y.useEffect(()=>{const E=new URLSearchParams(window.location.search).get("panel");Bj(E)&&E!==s.activePanel&&i({type:"SET_PANEL",panel:E})},[]),y.useEffect(()=>{const k=new URLSearchParams(window.location.search);k.set("panel",s.activePanel);const E=`${window.location.pathname}?${k.toString()}${window.location.hash}`;history.replaceState(null,"",E)},[s.activePanel]);const f=y.useCallback(k=>{const E=k.ctrlKey||k.metaKey;if(E&&k.key>="1"&&k.key<="8"){k.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(k.key)-1]});return}if(E&&k.key==="s"&&!k.shiftKey){k.preventDefault(),s.isDirty&&c();return}},[s.isDirty,c,i]);if(y.useEffect(()=>(window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)),[f]),s.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 b=Array.from(s.caseRunStates.values()).some(k=>k.status==="running"||k.status==="queued"),g=((j=m.skills.find(k=>k.skill===s.skill&&k.plugin===s.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(gd,{state:s,isReadOnly:d,onDelete:d?void 0:x}),s.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Es,{error:c2(s.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(i2,{activePanel:s.activePanel,onPanelChange:k=>i({type:"SET_PANEL",panel:k}),isDirty:s.isDirty,isRunning:b,hasRegressions:s.regressions.length>0,isActivationRunning:s.activationRunning,hasUpdate:g}),n.jsx(o2,{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:[s.activePanel==="editor"&&n.jsx(L2,{}),s.activePanel==="tests"&&n.jsx(V2,{}),s.activePanel==="run"&&n.jsx(tj,{}),s.activePanel==="activation"&&n.jsx(rj,{}),s.activePanel==="history"&&n.jsx(jj,{}),s.activePanel==="leaderboard"&&n.jsx(_j,{}),s.activePanel==="deps"&&n.jsx(Cj,{}),s.activePanel==="versions"&&n.jsx(bv,{})]},s.activePanel)})},`${s.plugin}/${s.skill}`)]})}function Uj(a){const s={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(s.targetAgents=a.targetAgents),s}function ad(a,s=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return s&&(i=i.replace(/^-+|-+$/g,"")),i}function Ij(a,s,i,c){const m=`.../${a.split("/").slice(-2).join("/")}`;switch(s){case 1:return`${m}/${i}/skills/${c}/SKILL.md`;case 2:return`${m}/plugins/${i}/skills/${c}/SKILL.md`;case 3:return`${m}/skills/${c}/SKILL.md`}}function Vj({onCreated:a,resolveAiConfigOverride:s}){const[i,c]=y.useState("ai"),[d,m]=y.useState(null),[p,h]=y.useState(!0),{config:x}=Yl(),[f,b]=y.useState(""),[g,j]=y.useState(3),[k,E]=y.useState(""),[z,A]=y.useState(""),[N,T]=y.useState(""),[H,$]=y.useState(""),[O,K]=y.useState(""),[w,B]=y.useState(""),[M,V]=y.useState("write"),[I,Z]=y.useState([]),[ne,J]=y.useState(!1),[D,C]=y.useState(null),[L,ae]=y.useState(""),[Q,pe]=y.useState(!1),[R,X]=y.useState(!1),[re,de]=y.useState(null),[xe,me]=y.useState(null),[Ne,ie]=y.useState([]),be=y.useRef(null),Ve=y.useRef(null),Oe=y.useRef(null),ee=y.useRef(null),[ce,oe]=y.useState(!1),[fe,ve]=y.useState(!1);y.useEffect(()=>{we.getProjectLayout().then(Me=>{m(Me),j(Me.suggestedLayout);const xt=Me.detectedLayouts.find(Xt=>Xt.layout===Me.suggestedLayout);xt!=null&&xt.existingPlugins.length&&E(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),y.useEffect(()=>{var Me;i==="ai"&&((Me=be.current)==null||Me.focus())},[i]),y.useEffect(()=>()=>{var Me;(Me=Ve.current)==null||Me.abort()},[]);const Le=y.useMemo(()=>{var Me;return d?((Me=d.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:Me.existingPlugins)||[]:[]},[d,g]),Ae=k==="__new__"?z:k,ut=d?Ij(d.root,g,Ae||"{plugin}",f||"{skill}"):"",Jt=y.useMemo(()=>d?d.detectedLayouts.filter(Me=>Me.layout!==4):[],[d]),ot=y.useMemo(()=>{if(!d)return null;const Me=d.detectedLayouts.find(tt=>tt.layout===2&&tt.existingPlugins.length>0),xt=d.detectedLayouts.find(tt=>tt.layout===1&&tt.existingPlugins.length>0),Xt=Me||xt;return Xt?{layout:Xt.layout,plugins:Xt.existingPlugins}:null},[d]),Vt=y.useCallback(()=>{if(s)return s();if(!x)return{provider:"claude-cli",model:"sonnet"};const Me=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:Me,model:xt}},[x,s]),Gt=y.useCallback(()=>{var Me;(Me=Ve.current)==null||Me.abort(),pe(!1)},[]),et=y.useCallback(()=>{de(null),me(null)},[]),jt=y.useCallback(async()=>{if(de(null),me(null),ie([]),Oe.current=null,!L.trim()){de("Describe what your skill should do");return}pe(!0);const Me=new AbortController;Ve.current=Me;const{provider:xt,model:Xt}=Vt();try{const tt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Uj({prompt:L.trim(),provider:xt,model:Xt,targetAgents:I})),signal:Me.signal});if(!tt.ok||!tt.body){let bt=`HTTP ${tt.status}`;try{const On=await tt.json();On.error&&(bt=On.error)}catch{}throw new Error(bt)}const Wl=tt.body.getReader(),Zn=new TextDecoder;let wt="",St="";for(;;){const{done:bt,value:On}=await Wl.read();if(bt)break;wt+=Zn.decode(On,{stream:!0});const Zl=wt.split(`
71
- `);wt=Zl.pop()||"";for(const Bn of Zl)if(Bn.startsWith("event: "))St=Bn.slice(7).trim();else if(Bn.startsWith("data: ")){try{const Ue=JSON.parse(Bn.slice(6));if(St==="progress")ie(Ht=>[...Ht,{phase:Ue.phase,message:Ue.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ht={prompt:L.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ue.reasoning||""};if(b(Ue.name),T(Ue.description),$(Ue.model||""),K(Ue.allowedTools||""),B(Ue.body),X(!0),Oe.current=Ht,c("manual"),Ue.suggestedPlugin&&typeof Ue.suggestedPlugin=="object"&&Ue.suggestedPlugin.plugin){const Ct=Ue.suggestedPlugin;if(((d==null?void 0:d.detectedLayouts.flatMap(kn=>kn.existingPlugins))??[]).includes(Ct.plugin))if(E(Ct.plugin),Ct.layout&&(Ct.layout===1||Ct.layout===2))j(Ct.layout);else{const kn=d==null?void 0:d.detectedLayouts.find(po=>po.existingPlugins.includes(Ct.plugin));kn&&(kn.layout===1||kn.layout===2)&&j(kn.layout)}else E("__new__"),A(Ct.plugin)}else g===3&&ot&&ve(!0);const Fn={name:Ue.name,plugin:Ae||"",layout:g,description:Ue.description,model:Ue.model||void 0,allowedTools:Ue.allowedTools||void 0,body:Ue.body,aiMeta:Ht};we.saveDraft(Fn).then(Ct=>{oe(!0),Ct!=null&&Ct.dir&&(ee.current=Ct.dir)}).catch(()=>{})}else St==="error"&&(de(Ue.message||Ue.description||"Unknown error"),Ue.category&&me(Ue))}catch{}St=""}}}catch(tt){tt.name!=="AbortError"&&de(tt.message)}finally{pe(!1),Ve.current=null}},[L,Vt,g,ot,Ae,d,I]),he=y.useCallback(async()=>{if(C(null),!f.trim()){C("Skill name is required");return}if(!N.trim()){C("Description is required");return}if(g!==3&&!Ae.trim()){C("Plugin name is required");return}J(!0);try{const Me=await we.createSkill({name:ad(f),plugin:Ae||"",layout:g,description:N,model:H||void 0,allowedTools:O||void 0,body:w,aiMeta:Oe.current||void 0,draftDir:ee.current||void 0});ee.current=null,a(Me.plugin,Me.skill)}catch(Me){C(Me.message)}finally{J(!1)}},[f,N,g,Ae,H,O,w,a]),Rt=y.useCallback(()=>{ot&&(j(ot.layout),E(ot.plugins[0]),ve(!1))},[ot]);return{mode:i,setMode:c,layout:d,layoutLoading:p,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Jt,availablePlugins:Le,pathPreview:ut,plugin:k,setPlugin:E,newPlugin:z,setNewPlugin:A,effectivePlugin:Ae,name:f,setName:b,description:N,setDescription:T,model:H,setModel:$,allowedTools:O,setAllowedTools:K,body:w,setBody:B,bodyViewMode:M,setBodyViewMode:V,aiPrompt:L,setAiPrompt:ae,generating:Q,aiGenerated:R,aiError:re,aiClassifiedError:xe,aiProgress:Ne,promptRef:be,handleGenerate:jt,handleCancelGenerate:Gt,clearAiError:et,targetAgents:I,setTargetAgents:Z,draftSaved:ce,showPluginRecommendation:fe,setShowPluginRecommendation:ve,pluginLayoutInfo:ot,applyPluginRecommendation:Rt,creating:ne,error:D,handleCreate:he}}function Lv(){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 Gj(){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 _v({node:a,depth:s=0}){var i;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${s*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(Lv,{}):n.jsx(Gj,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(c=>n.jsx(_v,{node:c,depth:s+1},c.name))]})}function $j(a,s,i){const c=[];s&&c.push({name:"evals.json",type:"file"}),c.push({name:"history",type:"dir"});const d=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:c}];return i&&d.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:d}}function qj({skillName:a,hasEvals:s,isDraft:i}){const c=$j(a,s,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(Lv,{})}),"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(_v,{node:c})})]})}const $l={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Ku({size:a=14,color:s="currentColor"}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:s,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 Yj({onCreated:a,onCancel:s}){const i=Vj({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(Ku,{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(Ku,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:c=>i.setAiPrompt(c.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
72
-
73
- 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:{...$l,minHeight:"120px"},onKeyDown:c=>{c.key==="Enter"&&(c.metaKey||c.ctrlKey)&&(c.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(Ts,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Es,{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(Ku,{size:14}),"Generate"]}),n.jsx("button",{onClick:s,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(c=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(c.layout),i.setPlugin(c.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===c.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===c.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===c.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:c.label},c.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:c=>{i.setPlugin(c.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:$l,children:[i.availablePlugins.map(c=>n.jsx("option",{value:c,children:c},c)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:c=>i.setNewPlugin(ad(c.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:$l})]}),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:c=>i.setName(ad(c.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:$l})]}),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:c=>i.setDescription(c.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...$l,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:c=>i.setModel(c.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:$l,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:c=>i.setAllowedTools(c.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:$l})]})]})]}),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(c=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(c),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===c?"var(--surface-4)":"transparent",color:i.bodyViewMode===c?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===c?600:400,border:"none",cursor:"pointer"},children:[c==="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:c==="write"?"Write":"Preview"})]},c))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:c=>i.setBody(c.target.value),placeholder:`# /my-skill
74
-
75
- You are an expert at...
76
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...$l,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:uo(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(qj,{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:s,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 Kj(){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 Ji({variant:a,message:s,onRetry:i}){const{setMode:c,setSearch:d}=ya(),[m,p]=y.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:m?n.jsx(Kj,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>p(!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:()=>c("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:s||"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 Qj(a,s){const[i,c]=a.split(".").map(Number),[d,m]=s.split(".").map(Number);return d>i?"major":m>c?"minor":"patch"}const Xj={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 Wj(){const[a,s]=y.useState([]),[i,c]=y.useState(!0),[d,m]=y.useState(new Set),[p,h]=y.useState(new Map),[x,f]=y.useState(!1),[b,g]=y.useState(new Set),[j,k]=y.useState(null),[E,z]=y.useState(null),[A,N]=y.useState(!1),T=y.useCallback(async()=>{c(!0);try{const M=await we.getSkillUpdates();s(M.filter(V=>V.updateAvailable))}catch{s([])}finally{c(!1)}},[]);y.useEffect(()=>{T()},[T]);const H=y.useMemo(()=>a.filter(M=>!M.pinned),[a]),$=y.useCallback(M=>{m(V=>{const I=new Set(V);return I.has(M)?I.delete(M):I.add(M),I})},[]),O=y.useCallback(()=>{d.size===H.length?m(new Set):m(new Set(H.map(M=>M.name)))},[d,H]),K=y.useCallback(()=>{const M=[...d];if(!M.length)return;f(!0),h(new Map(M.map(I=>[I,{skill:I,status:"pending"}])));const V=we.startBatchUpdate(M);V.addEventListener("progress",I=>{try{const Z=JSON.parse(I.data);h(ne=>new Map(ne).set(Z.skill,Z))}catch{}}),V.addEventListener("done",I=>{V.close(),f(!1);try{const Z=JSON.parse(I.data);k(`Updated ${Z.updated??0} skills, ${Z.failed??0} failed`),setTimeout(()=>k(null),5e3)}catch{}T()}),V.addEventListener("error",()=>{V.close(),f(!1),k("Batch update failed"),setTimeout(()=>k(null),5e3)})},[d,T]),w=y.useCallback(M=>{M.name.split("/").pop()||M.name;const V=M.name.split("/"),I=V.length>=3?V[V.length-2]:V[0],Z=V[V.length-1];g(J=>new Set(J).add(M.name));const ne=we.startSkillUpdate(I,Z);ne.addEventListener("done",()=>{ne.close(),g(J=>{const D=new Set(J);return D.delete(M.name),D}),T()}),ne.addEventListener("error",()=>{ne.close(),g(J=>{const D=new Set(J);return D.delete(M.name),D})})},[T]),B=y.useCallback(async M=>{if(!M.latest)return;const V=M.name.split("/"),I=V.length>=3?V[V.length-2]:V[0],Z=V[V.length-1];N(!0);try{const ne=await we.getVersionDiff(I,Z,M.installed,M.latest);z({skill:M,diff:ne})}catch{z(null)}finally{N(!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:T,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 (",H.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:T,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:K,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:O,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===H.length&&H.length>0?"var(--accent)":"var(--border-default)",background:d.size===H.length&&H.length>0?"var(--accent)":"transparent"},children:d.size===H.length&&H.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(M=>{const V=M.name.split("/").pop()||M.name,I=M.latest?Qj(M.installed,M.latest):"patch",Z=Xj[I],ne=!!M.pinned,J=b.has(M.name),D=p.get(M.name),C=d.has(M.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:ne?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!ne&&$(M.name),disabled:ne,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:ne?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:C?"var(--accent)":"var(--border-default)",background:C?"var(--accent)":"transparent",opacity:ne?.4:1},children:C&&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:V}),ne&&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:Z.bg,color:Z.text},children:I})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[M.installed," → ",M.latest||"?",ne&&` (pinned at ${M.pinnedVersion||M.installed})`]})]}),D&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:D.status==="done"?"var(--green-muted)":D.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:D.status==="done"?"var(--green)":D.status==="error"?"var(--red)":"var(--yellow)"},children:[D.status,D.error&&`: ${D.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>B(M),className:"btn btn-ghost text-[11px]",disabled:A,children:"View Changes"}),n.jsx("button",{onClick:()=>w(M),disabled:ne||J||x,title:ne?"Pinned — unpin from CLI to update":"",className:`btn ${ne?"btn-ghost":"btn-primary"} text-[11px]`,children:J?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(D==null?void 0:D.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},M.name)})}),E&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>z(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:M=>M.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>z(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(gv,{contentDiff:E.diff.contentDiff,fromLabel:E.diff.from,toLabel:E.diff.to,diffSummary:E.diff.diffSummary,renderContext:"inline"})]})})]})}const Zj=[{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",displayName:"GitHub Copilot",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!0,detectInstalled:"which github-copilot",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}},{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:"Amazon",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}},{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}},{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}},{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}}],hr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},xr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},Fj={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},Ov={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},Bv={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},ur={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Jj={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},Pj={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},eS={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 tS(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const s=a/1024;if(s<1024)return s>=10?`${Math.round(s)} KB`:`${s.toFixed(1).replace(/\.0$/,"")} KB`;const i=s/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function Hv(a){if(!a)return"—";const s=new Date(a);if(Number.isNaN(s.getTime()))return a;const i=Date.now()-s.getTime(),c=Math.floor(i/1e3);if(c<60)return"just now";const d=Math.floor(c/60);if(d<60)return`${d} min ago`;const m=Math.floor(d/60);if(m<24)return`${m} hr ago`;const p=Math.floor(m/24);if(p<30)return`${p} day${p===1?"":"s"} ago`;const h=Math.floor(p/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 nS(a){const s=Zj.find(i=>i.id===a);return(s==null?void 0:s.displayName)??a}function fr(a){const s=a?eS[a]:void 0;return n.jsx("span",{style:Jj,title:s,children:"—"})}function gn(a,s,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:Fj,children:a}),n.jsx("span",{style:{minWidth:0},children:s})]},a)}function ir(a,s,i={}){if(s==null||s==="")return gn(a,fr(a));if(i.path)return gn(a,n.jsx("span",{"data-path-value":"true",style:Pj,children:s}));const c=i.tabular?ur:i.mono?Bv:Ov;return gn(a,n.jsx("span",{style:c,children:s}))}function lS({skill:a,allSkills:s=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[aS(a),a.origin==="installed"?rS(a):null,sS(a),oS(a),cS(a),dS(a,s,i)]})}function aS(a){const s=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...Bv,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:c=>{c.currentTarget.style.textDecoration="underline"},onMouseLeave:c=>{c.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:"↗"})]}):fr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(c=>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:c},c))}):fr("Tags");return n.jsxs("section",{style:xr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:hr,children:"Frontmatter"}),ir("Description",a.description??null),ir("Version",a.version??null,{tabular:!0}),ir("Category",a.category??null),ir("Author",a.author??null),ir("License",a.license??null),gn("Homepage",s),gn("Tags",i)]},"frontmatter")}function rS(a){const s=a.sourceAgent,i=s?n.jsx("span",{style:Ov,"data-agent-id":s,children:nS(s)}):fr("Agent");return n.jsxs("section",{style:xr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:hr,children:"Source agent"}),gn("Agent",i)]},"source-agent")}function sS(a){const s=a.lastModified?n.jsx("span",{style:ur,title:a.lastModified,children:Hv(a.lastModified)}):fr("Last modified"),i=a.entryPoint??"SKILL.md",c=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,d=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${c}`,"aria-label":`Copy entry-point path ${c} to clipboard`,onClick:()=>iS(c),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:xr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:hr,children:"Filesystem"}),ir("Directory",a.dir||null,{path:!0}),gn("Entry point",d),gn("Size",n.jsx("span",{style:ur,children:tS(a.sizeBytes)})),gn("Last modified",s)]},"filesystem")}function iS(a){var s;try{(s=navigator.clipboard)==null||s.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function oS(a){const s=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:s}}),a.benchmarkStatus]}),c=a.lastBenchmark?n.jsx("span",{style:ur,title:a.lastBenchmark,children:Hv(a.lastBenchmark)}):fr("Last benchmark");return n.jsxs("section",{style:xr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:hr,children:"Benchmark"}),gn("Eval count",n.jsx("span",{style:ur,children:a.evalCount})),gn("Assertions",n.jsx("span",{style:ur,children:a.assertionCount})),gn("Status",i),gn("Last benchmark",c)]},"benchmark")}function cS(a){const s=a.mcpDeps??[];return n.jsxs("section",{style:xr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:hr,children:"MCP dependencies"}),s.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:s.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(uS,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function uS(){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 dS(a,s,i){const c=a.deps??[];return n.jsxs("section",{style:xr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:hr,children:"Skill dependencies"}),c.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:c.map(d=>{const m=fS(d,s),p=m!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:p?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:p?"pointer":"help"},x=p&&i?()=>i({plugin:m.plugin,skill:m.skill,origin:m.origin}):void 0,f=p&&i?b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),i({plugin:m.plugin,skill:m.skill,origin:m.origin}))}:void 0;return n.jsx("button",{type:"button","data-chip":"skill-dep","data-present":p?"true":"false",title:p?`Open ${d}`:"Not installed",onClick:x,onKeyDown:f,style:h,children:d},d)})})]},"skill-deps")}function fS(a,s){const[i,c]=a.includes("/")?a.split("/"):["",a];for(const d of s)if(i&&d.plugin===i&&d.skill===c||!i&&d.skill===c)return d;return null}function Qu(){const{state:a,setMobileView:s}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>s("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 pS(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return mS(a);const{state:s,selectSkill:i,setMode:c,refreshSkills:d}=ya(),[m,p]=y.useState(typeof window<"u"?window.location.hash:"");if(y.useEffect(()=>{const f=()=>p(window.location.hash);return window.addEventListener("hashchange",f),()=>window.removeEventListener("hashchange",f)},[]),m==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(Qu,{}),n.jsx(Wj,{})]});if(s.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(Qu,{}),n.jsx(Yj,{onCreated:(f,b)=>{c("browse"),d(),i({plugin:f,skill:b,origin:"source"})},onCancel:()=>c("browse")})]});if(!s.selectedSkill)return s.skillsError?n.jsx(Ji,{variant:"error",message:s.skillsError,onRetry:d}):!s.skillsLoading&&s.skills.length===0?n.jsx(Ji,{variant:"no-skills"}):n.jsx(Ji,{variant:"no-selection"});const h=s.selectedSkill,x=s.skills.find(f=>f.plugin===h.plugin&&f.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(Qu,{}),n.jsx(hS,{skillInfo:x,allSkills:s.skills,onSelectSkill:f=>i(f)})]})}function mS(a){const s=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(s==null)return yS();if(a.loadError)return gS(s,a.loadError);const c=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return Uv(s,i,a.onDetailTabChange,c)}function hS({skillInfo:a,allSkills:s,onSelectSkill:i}){const[c,d]=y.useState("overview"),m=y.useMemo(()=>a?Uv(a,c,d,{allSkills:s,onSelectSkill:i}):n.jsx(Ji,{variant:"no-selection"}),[a,c,s,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:m})}const xS=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function vS(a,s){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:xS.map(i=>{const c=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":c,tabIndex:c?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>s==null?void 0:s(i.id),style:{background:"transparent",border:"none",borderBottom:c?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:c?500:400,color:c?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function yS(){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 gS(a,s){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[gd({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:s}),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 Uv(a,s,i,c){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:gd({skill:a})}),vS(s,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${s}`,"aria-labelledby":`detail-tab-${s}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[s==="overview"&&n.jsxs(n.Fragment,{children:[lS({skill:a,allSkills:(c==null?void 0:c.allSkills)??[],onSelectSkill:c==null?void 0:c.onSelectSkill}),c!=null&&n.jsx(tx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(Hj,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),s==="versions"&&c!=null&&n.jsx(tx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(bv,{})})},`${a.plugin}/${a.skill}-versions`),s==="versions"&&c==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 bS(){const{updateCount:a,state:s,dismissUpdateNotification:i}=ya(),c=a>0&&!s.updateNotificationDismissed;return y.useEffect(()=>{if(!c)return;const d=setTimeout(()=>i(),1e4);return()=>clearTimeout(d)},[c,i]),c?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 bx=y.memo(function({message:s,politeness:i="polite",role:c}){const d=c??(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:s})});function jS({toast:a,onDismiss:s}){const[i,c]=y.useState(!0),d=y.useRef(null);y.useEffect(()=>(d.current=requestAnimationFrame(()=>{d.current=requestAnimationFrame(()=>c(!1))}),()=>{d.current!=null&&cancelAnimationFrame(d.current)}),[]);const m={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 ${m[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(),s(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:()=>s(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function SS({toasts:a,onDismiss:s,liveMessage:i,liveAssertiveMessage:c}){return n.jsxs(n.Fragment,{children:[n.jsx(bx,{politeness:"polite",message:i}),n.jsx(bx,{politeness:"assertive",message:c}),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(jS,{toast:d,onDismiss:s})},d.id))})]})}const Iv=y.createContext(null);function kS(){const a=y.useContext(Iv);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function NS({children:a,maxVisible:s=4,defaultDurationMs:i=4e3}){const[c,d]=y.useState([]),[m,p]=y.useState(""),[h,x]=y.useState(""),f=y.useRef(new Map),b=y.useCallback(A=>{const N=f.current.get(A);N&&(clearTimeout(N),f.current.delete(A)),d(T=>T.filter(H=>H.id!==A))},[]),g=y.useCallback((A,N)=>{if(N<=0)return;const T=setTimeout(()=>{b(A)},N);f.current.set(A,T)},[b]),j=y.useCallback(A=>{const N=A.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,T={id:N,message:A.message,severity:A.severity??"info",durationMs:A.durationMs??i,action:A.action};return d(H=>[...H,T]),T.severity==="error"?x(T.message):p(T.message),g(N,T.durationMs),N},[i,g]),k=y.useCallback(()=>{for(const A of f.current.values())clearTimeout(A);f.current.clear(),d([])},[]);y.useEffect(()=>{function A(N){N.key==="Escape"&&d(T=>{if(T.length===0)return T;const H=T.slice(0,s),$=H[H.length-1],O=f.current.get($.id);return O&&(clearTimeout(O),f.current.delete($.id)),T.filter(K=>K.id!==$.id)})}return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[s]),y.useEffect(()=>()=>{for(const A of f.current.values())clearTimeout(A);f.current.clear()},[]);const E=c.slice(0,s),z=y.useMemo(()=>({toast:j,dismiss:b,clear:k}),[j,b,k]);return n.jsxs(Iv.Provider,{value:z,children:[a,n.jsx(SS,{toasts:E,onDismiss:b,liveMessage:m,liveAssertiveMessage:h})]})}const wS=[{name:pt.shortcuts.groupNavigation,items:[{keys:"/",label:pt.shortcuts.search},{keys:"j",label:pt.shortcuts.moveDown},{keys:"k",label:pt.shortcuts.moveUp},{keys:"Enter",label:pt.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:pt.shortcuts.groupActions,items:[{keys:"⌘K",label:pt.shortcuts.openPalette},{keys:"?",label:pt.shortcuts.openShortcuts},{keys:"⌘B",label:pt.shortcuts.toggleSidebar},{keys:"E",label:pt.actions.edit}]},{name:pt.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:pt.shortcuts.toggleTheme}]}];function CS({open:a,onClose:s,groups:i=wS,title:c=pt.shortcuts.title}){const d=y.useRef(null),m=y.useRef(null);return y.useEffect(()=>{var p;if(a)return d.current=document.activeElement??null,(p=m.current)==null||p.focus(),()=>{var h,x;(x=(h=d.current)==null?void 0:h.focus)==null||x.call(h),d.current=null}},[a]),y.useEffect(()=>{if(!a)return;function p(h){var x;if(h.key==="Escape"){h.preventDefault(),s();return}h.key==="Tab"&&(h.preventDefault(),(x=m.current)==null||x.focus())}return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[a,s]),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:p=>{p.target===p.currentTarget&&s()},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:c}),n.jsx("button",{ref:m,type:"button","aria-label":"Close",onClick:s,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(p=>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:p.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:p.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})]},`${p.name}:${h.keys}`))})]},p.name))]})}):null}function ES(a){const s=pt.actions,i=[{action:"open",label:s.open},{action:"copy-path",label:s.copyPath},{action:"reveal",label:s.revealInEditor},{action:"run-benchmark",label:s.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:s.edit},{action:"duplicate",label:s.duplicate}];const c=[...i];return a.updateAvailable&&c.push({action:"update",label:s.update}),c.push({action:"uninstall",label:s.uninstall}),c}function TS({state:a,onClose:s,onAction:i,itemsOverride:c}){const d=y.useRef(null),m=y.useRef(null),[p,h]=y.useState(0),x=y.useMemo(()=>a.skill?c??ES(a.skill):[],[a.skill,c]),f=y.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,k=44+x.length*28;let E=a.x,z=a.y;return E+j+g>window.innerWidth&&(E=Math.max(g,a.x-j)),z+k+g>window.innerHeight&&(z=Math.max(g,a.y-k)),{left:E,top:z}},[a.x,a.y,x.length]);y.useEffect(()=>{if(a.open)return m.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=d.current)==null||g.focus()}),()=>{var g,j;(j=(g=m.current)==null?void 0:g.focus)==null||j.call(g),m.current=null}},[a.open]);const b=y.useCallback(()=>{if(!a.skill)return;const g=x[p];!g||g.disabled||(i(g.action,a.skill),s())},[x,p,a.skill,i,s]);return y.useEffect(()=>{if(!a.open)return;function g(k){if(k.key==="Escape"){k.preventDefault(),s();return}if(k.key==="ArrowDown"){k.preventDefault(),h(E=>Math.min(E+1,Math.max(x.length-1,0)));return}if(k.key==="ArrowUp"){k.preventDefault(),h(E=>Math.max(E-1,0));return}if(k.key==="Enter"||k.key===" "){k.preventDefault(),b();return}}function j(k){d.current&&k.target instanceof Node&&(d.current.contains(k.target)||s())}return window.addEventListener("keydown",g,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",g,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,s,x.length,b]),!a.open||!a.skill?null:n.jsx("div",{ref:d,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:f.left,top:f.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((g,j)=>n.jsx("div",{role:"menuitem","aria-disabled":g.disabled||void 0,"data-action":g.action,"data-selected":j===p||void 0,onMouseEnter:()=>h(j),onClick:()=>{g.disabled||(i(g.action,a.skill),s())},style:{padding:"5px 10px",borderRadius:4,cursor:g.disabled?"default":"pointer",opacity:g.disabled?.5:1,background:j===p?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:g.label},g.action))})}const jx={open:!1,x:0,y:0,skill:null};function RS(a,s){return{open:!0,x:a.clientX,y:a.clientY,skill:s}}function ma(a,s="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:s}}))}function AS(a,s){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(s.dir)}catch{ma(pt.toasts.permissionDenied,"error");return}ma(pt.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":ma(pt.actions.editPlaceholder,"info");return;case"run-benchmark":ma(pt.toasts.benchmarkQueued,"info");return;case"duplicate":ma(pt.toasts.skillDuplicated,"info");return;case"update":ma(pt.toasts.skillUpdated,"info");return;case"uninstall":ma(pt.actions.editPlaceholder,"info");return;default:return}}const MS=y.lazy(()=>Nx(()=>import("./CommandPalette-BAcN6Jji.js"),__vite__mapDeps([0,1])));function zS(){return n.jsx(g1,{children:n.jsx(x1,{children:n.jsxs(NS,{children:[n.jsx(DS,{}),n.jsx(bS,{})]})})})}function DS(){const{state:a,selectSkill:s,refreshSkills:i}=ya(),{config:c}=Yl(),{mode:d,resolvedTheme:m,setTheme:p}=Mx(),{toast:h}=kS(),[x,f]=y.useState(()=>Mb()),[b]=y.useState(!0),[g,j]=y.useState(!1),[k,E]=y.useState(!1),[z,A]=y.useState(!1),[N,T]=y.useState("overview"),[H,$]=y.useState(jx),O=y.useCallback((I,Z)=>{$(RS(I,Z))},[]),K=y.useCallback(()=>{$(jx)},[]);y.useEffect(()=>{function I(Z){if(!(Z instanceof CustomEvent))return;const ne=Z.detail;ne!=null&&ne.message&&h({message:ne.message,severity:ne.severity??"info"})}return window.addEventListener("studio:toast",I),()=>window.removeEventListener("studio:toast",I)},[h]),y.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${x}px`)},[x]);const w=y.useMemo(()=>a.selectedSkill?a.skills.find(I=>I.plugin===a.selectedSkill.plugin&&I.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),B=y.useCallback(I=>{s({plugin:I.plugin,skill:I.skill,origin:I.origin})},[s]),M=y.useMemo(()=>{if(!a.selectedSkill)return"";const I=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${I})`},[a.selectedSkill]),V=y.useMemo(()=>[{id:"switch-theme",label:pt.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>p(d==="light"?"dark":d==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>A(I=>!I)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>E(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>i()}],[d,p,i]);return fv([{key:"cmd+k",handler:()=>j(I=>!I)},{key:"ctrl+k",handler:()=>j(I=>!I)},{key:"?",handler:()=>E(I=>!I)},{key:"cmd+shift+d",handler:()=>p(m==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>p(m==="light"?"dark":"light")},{key:"cmd+b",handler:()=>A(I=>!I)},{key:"ctrl+b",handler:()=>A(I=>!I)},{key:"e",handler:()=>h({message:pt.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(b1,{sidebarWidth:x,sidebarHidden:z||a.isMobile&&a.mobileView==="detail",banner:n.jsx(Lb,{connected:b}),liveMessage:M,topRail:n.jsx(w1,{projectName:(c==null?void 0:c.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>j(!0)}),sidebar:n.jsx(kb,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:B,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:i,onContextMenu:O}),resizeHandle:n.jsx(Db,{initialWidth:x??hs,onChange:f}),main:n.jsx(pS,{selectedSkillInfo:w,activeDetailTab:N,onDetailTabChange:T,allSkills:a.skills,onSelectSkill:B}),statusBar:n.jsx(D1,{projectPath:(c==null?void 0:c.root)??null,modelName:(c==null?void 0:c.model)??null,health:c!=null&&c.error?"degraded":"ok"})}),n.jsx(CS,{open:k,onClose:()=>E(!1)}),n.jsx(TS,{state:H,onClose:K,onAction:(I,Z)=>AS(I,Z)}),g&&n.jsx(y.Suspense,{fallback:null,children:n.jsx(MS,{open:g,onClose:()=>j(!1),commands:V})})]})}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(s=>{for(const i of s.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}i1.createRoot(document.getElementById("root")).render(n.jsx(y.StrictMode,{children:n.jsx(M1,{children:n.jsx(zS,{})})}));export{n as j,y as r,pt as s};