vskill 0.5.86 → 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,79 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-E99dDGz-.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-BYCtdLfL.js"])))=>i.map(i=>d[i]);
2
- /* empty css */(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))o(d);new MutationObserver(d=>{for(const m of d)if(m.type==="childList")for(const f of m.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).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 o(d){if(d.ep)return;d.ep=!0;const m=i(d);fetch(d.href,m)}})();function Ox(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Eu={exports:{}},cs={};/**
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 wh;function p1(){if(wh)return cs;wh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,d,m){var f=null;if(m!==void 0&&(f=""+m),d.key!==void 0&&(f=""+d.key),"key"in d){m={};for(var x in d)x!=="key"&&(m[x]=d[x])}else m=d;return d=m.ref,{$$typeof:a,type:o,key:f,ref:d!==void 0?d:null,props:m}}return cs.Fragment=r,cs.jsx=i,cs.jsxs=i,cs}var Nh;function m1(){return Nh||(Nh=1,Eu.exports=p1()),Eu.exports}var n=m1(),Tu={exports:{}},De={};/**
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 Ch;function h1(){if(Ch)return De;Ch=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),f=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function S(z){return z===null||typeof z!="object"?null:(z=j&&z[j]||z["@@iterator"],typeof z=="function"?z:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,E={};function N(z,X,re){this.props=z,this.context=X,this.refs=E,this.updater=re||C}N.prototype.isReactComponent={},N.prototype.setState=function(z,X){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,X,"setState")},N.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function R(){}R.prototype=N.prototype;function L(z,X,re){this.props=z,this.context=X,this.refs=E,this.updater=re||C}var I=L.prototype=new R;I.constructor=L,A(I,N.prototype),I.isPureReactComponent=!0;var O=Array.isArray;function $(){}var w={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function M(z,X,re){var de=re.ref;return{$$typeof:a,type:z,key:X,ref:de!==void 0?de:null,props:re}}function U(z,X){return M(z.type,X,z.props)}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===a}function W(z){var X={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(re){return X[re]})}var P=/\/+/g;function F(z,X){return typeof z=="object"&&z!==null&&z.key!=null?W(""+z.key):X.toString(36)}function _(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then($,$):(z.status="pending",z.then(function(X){z.status==="pending"&&(z.status="fulfilled",z.value=X)},function(X){z.status==="pending"&&(z.status="rejected",z.reason=X)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function T(z,X,re,de,xe){var me=typeof z;(me==="undefined"||me==="boolean")&&(z=null);var Ne=!1;if(z===null)Ne=!0;else switch(me){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(z.$$typeof){case a:case r:Ne=!0;break;case b:return Ne=z._init,T(Ne(z._payload),X,re,de,xe)}}if(Ne)return xe=xe(z),Ne=de===""?"."+F(z,0):de,O(xe)?(re="",Ne!=null&&(re=Ne.replace(P,"$&/")+"/"),T(xe,X,re,"",function($e){return $e})):xe!=null&&(q(xe)&&(xe=U(xe,re+(xe.key==null||z&&z.key===xe.key?"":(""+xe.key).replace(P,"$&/")+"/")+Ne)),X.push(xe)),1;Ne=0;var ie=de===""?".":de+":";if(O(z))for(var je=0;je<z.length;je++)de=z[je],me=ie+F(de,je),Ne+=T(de,X,re,me,xe);else if(je=S(z),typeof je=="function")for(z=je.call(z),je=0;!(de=z.next()).done;)de=de.value,me=ie+F(de,je++),Ne+=T(de,X,re,me,xe);else if(me==="object"){if(typeof z.then=="function")return T(_(z),X,re,de,xe);throw X=String(z),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return Ne}function B(z,X,re){if(z==null)return z;var de=[],xe=0;return T(z,de,"","",function(me){return X.call(re,me,xe++)}),de}function le(z){if(z._status===-1){var X=z._result;X=X(),X.then(function(re){(z._status===0||z._status===-1)&&(z._status=1,z._result=re)},function(re){(z._status===0||z._status===-1)&&(z._status=2,z._result=re)}),z._status===-1&&(z._status=0,z._result=X)}if(z._status===1)return z._result.default;throw z._result}var Q=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},pe={map:B,forEach:function(z,X,re){B(z,function(){X.apply(this,arguments)},re)},count:function(z){var X=0;return B(z,function(){X++}),X},toArray:function(z){return B(z,function(X){return X})||[]},only:function(z){if(!q(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return De.Activity=g,De.Children=pe,De.Component=N,De.Fragment=i,De.Profiler=d,De.PureComponent=L,De.StrictMode=o,De.Suspense=h,De.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,De.__COMPILER_RUNTIME={__proto__:null,c:function(z){return w.H.useMemoCache(z)}},De.cache=function(z){return function(){return z.apply(null,arguments)}},De.cacheSignal=function(){return null},De.cloneElement=function(z,X,re){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var de=A({},z.props),xe=z.key;if(X!=null)for(me in X.key!==void 0&&(xe=""+X.key),X)!D.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(z.type,xe,de)},De.createContext=function(z){return z={$$typeof:f,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:m,_context:z},z},De.createElement=function(z,X,re){var de,xe={},me=null;if(X!=null)for(de in X.key!==void 0&&(me=""+X.key),X)D.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),je=0;je<Ne;je++)ie[je]=arguments[je+2];xe.children=ie}if(z&&z.defaultProps)for(de in Ne=z.defaultProps,Ne)xe[de]===void 0&&(xe[de]=Ne[de]);return M(z,me,xe)},De.createRef=function(){return{current:null}},De.forwardRef=function(z){return{$$typeof:x,render:z}},De.isValidElement=q,De.lazy=function(z){return{$$typeof:b,_payload:{_status:-1,_result:z},_init:le}},De.memo=function(z,X){return{$$typeof:p,type:z,compare:X===void 0?null:X}},De.startTransition=function(z){var X=w.T,re={};w.T=re;try{var de=z(),xe=w.S;xe!==null&&xe(re,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then($,Q)}catch(me){Q(me)}finally{X!==null&&re.types!==null&&(X.types=re.types),w.T=X}},De.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},De.use=function(z){return w.H.use(z)},De.useActionState=function(z,X,re){return w.H.useActionState(z,X,re)},De.useCallback=function(z,X){return w.H.useCallback(z,X)},De.useContext=function(z){return w.H.useContext(z)},De.useDebugValue=function(){},De.useDeferredValue=function(z,X){return w.H.useDeferredValue(z,X)},De.useEffect=function(z,X){return w.H.useEffect(z,X)},De.useEffectEvent=function(z){return w.H.useEffectEvent(z)},De.useId=function(){return w.H.useId()},De.useImperativeHandle=function(z,X,re){return w.H.useImperativeHandle(z,X,re)},De.useInsertionEffect=function(z,X){return w.H.useInsertionEffect(z,X)},De.useLayoutEffect=function(z,X){return w.H.useLayoutEffect(z,X)},De.useMemo=function(z,X){return w.H.useMemo(z,X)},De.useOptimistic=function(z,X){return w.H.useOptimistic(z,X)},De.useReducer=function(z,X,re){return w.H.useReducer(z,X,re)},De.useRef=function(z){return w.H.useRef(z)},De.useState=function(z){return w.H.useState(z)},De.useSyncExternalStore=function(z,X,re){return w.H.useSyncExternalStore(z,X,re)},De.useTransition=function(){return w.H.useTransition()},De.version="19.2.4",De}var Eh;function cd(){return Eh||(Eh=1,Tu.exports=h1()),Tu.exports}var v=cd();const ke=Ox(v);var Ru={exports:{}},us={},Au={exports:{}},Mu={};/**
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 Th;function x1(){return Th||(Th=1,(function(a){function r(T,B){var le=T.length;T.push(B);e:for(;0<le;){var Q=le-1>>>1,pe=T[Q];if(0<d(pe,B))T[Q]=B,T[le]=pe,le=Q;else break e}}function i(T){return T.length===0?null:T[0]}function o(T){if(T.length===0)return null;var B=T[0],le=T.pop();if(le!==B){T[0]=le;e:for(var Q=0,pe=T.length,z=pe>>>1;Q<z;){var X=2*(Q+1)-1,re=T[X],de=X+1,xe=T[de];if(0>d(re,le))de<pe&&0>d(xe,re)?(T[Q]=xe,T[de]=le,Q=de):(T[Q]=re,T[X]=le,Q=X);else if(de<pe&&0>d(xe,le))T[Q]=xe,T[de]=le,Q=de;else break e}}return B}function d(T,B){var le=T.sortIndex-B.sortIndex;return le!==0?le:T.id-B.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 f=Date,x=f.now();a.unstable_now=function(){return f.now()-x}}var h=[],p=[],b=1,g=null,j=3,S=!1,C=!1,A=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function I(T){for(var B=i(p);B!==null;){if(B.callback===null)o(p);else if(B.startTime<=T)o(p),B.sortIndex=B.expirationTime,r(h,B);else break;B=i(p)}}function O(T){if(A=!1,I(T),!C)if(i(h)!==null)C=!0,$||($=!0,W());else{var B=i(p);B!==null&&_(O,B.startTime-T)}}var $=!1,w=-1,D=5,M=-1;function U(){return E?!0:!(a.unstable_now()-M<D)}function q(){if(E=!1,$){var T=a.unstable_now();M=T;var B=!0;try{e:{C=!1,A&&(A=!1,R(w),w=-1),S=!0;var le=j;try{t:{for(I(T),g=i(h);g!==null&&!(g.expirationTime>T&&U());){var Q=g.callback;if(typeof Q=="function"){g.callback=null,j=g.priorityLevel;var pe=Q(g.expirationTime<=T);if(T=a.unstable_now(),typeof pe=="function"){g.callback=pe,I(T),B=!0;break t}g===i(h)&&o(h),I(T)}else o(h);g=i(h)}if(g!==null)B=!0;else{var z=i(p);z!==null&&_(O,z.startTime-T),B=!1}}break e}finally{g=null,j=le,S=!1}B=void 0}}finally{B?W():$=!1}}}var W;if(typeof L=="function")W=function(){L(q)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,F=P.port2;P.port1.onmessage=q,W=function(){F.postMessage(null)}}else W=function(){N(q,0)};function _(T,B){w=N(function(){T(a.unstable_now())},B)}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(T){T.callback=null},a.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<T?Math.floor(1e3/T):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(T){switch(j){case 1:case 2:case 3:var B=3;break;default:B=j}var le=j;j=B;try{return T()}finally{j=le}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(T,B){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var le=j;j=T;try{return B()}finally{j=le}},a.unstable_scheduleCallback=function(T,B,le){var Q=a.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?Q+le:Q):le=Q,T){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=le+pe,T={id:b++,callback:B,priorityLevel:T,startTime:le,expirationTime:pe,sortIndex:-1},le>Q?(T.sortIndex=le,r(p,T),i(h)===null&&T===i(p)&&(A?(R(w),w=-1):A=!0,_(O,le-Q))):(T.sortIndex=pe,r(h,T),C||S||(C=!0,$||($=!0,W()))),T},a.unstable_shouldYield=U,a.unstable_wrapCallback=function(T){var B=j;return function(){var le=j;j=B;try{return T.apply(this,arguments)}finally{j=le}}}})(Mu)),Mu}var Rh;function v1(){return Rh||(Rh=1,Au.exports=x1()),Au.exports}var zu={exports:{}},Xt={};/**
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 Ah;function y1(){if(Ah)return Xt;Ah=1;var a=cd();function r(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+h+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var o={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},d=Symbol.for("react.portal");function m(h,p,b){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:g==null?null:""+g,children:h,containerInfo:p,implementation:b}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function x(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Xt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Xt.createPortal=function(h,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(r(299));return m(h,p,null,b)},Xt.flushSync=function(h){var p=f.T,b=o.p;try{if(f.T=null,o.p=2,h)return h()}finally{f.T=p,o.p=b,o.d.f()}},Xt.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(h,p))},Xt.prefetchDNS=function(h){typeof h=="string"&&o.d.D(h)},Xt.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var b=p.as,g=x(b,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?o.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:S}):b==="script"&&o.d.X(h,{crossOrigin:g,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Xt.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=x(p.as,p.crossOrigin);o.d.M(h,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(h)},Xt.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,g=x(b,p.crossOrigin);o.d.L(h,b,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Xt.preloadModule=function(h,p){if(typeof h=="string")if(p){var b=x(p.as,p.crossOrigin);o.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(h)},Xt.requestFormReset=function(h){o.d.r(h)},Xt.unstable_batchedUpdates=function(h,p){return h(p)},Xt.useFormState=function(h,p,b){return f.H.useFormState(h,p,b)},Xt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Xt.version="19.2.4",Xt}var Mh;function Bx(){if(Mh)return zu.exports;Mh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),zu.exports=y1(),zu.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 zh;function g1(){if(zh)return us;zh=1;var a=v1(),r=cd(),i=Bx();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function 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 f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(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 h(e){if(m(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=m(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,s=t;;){var c=l.return;if(c===null)break;var u=c.alternate;if(u===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===l)return h(c),e;if(u===s)return h(c),t;u=u.sibling}throw Error(o(188))}if(l.return!==s.return)l=c,s=u;else{for(var y=!1,k=c.child;k;){if(k===l){y=!0,l=c,s=u;break}if(k===s){y=!0,s=c,l=u;break}k=k.sibling}if(!y){for(k=u.child;k;){if(k===l){y=!0,l=u,s=c;break}if(k===s){y=!0,s=u,l=c;break}k=k.sibling}if(!y)throw Error(o(189))}}if(l.alternate!==s)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function 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"),S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),L=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var P=Symbol.for("react.client.reference");function F(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===P?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case N:return"Profiler";case E:return"StrictMode";case O:return"Suspense";case $:return"SuspenseList";case M:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case L:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case I: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:F(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return F(e(t))}catch{}}return null}var _=Array.isArray,T=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},Q=[],pe=-1;function z(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=z(null),xe=z(null),me=z(null),Ne=z(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)?Wm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wm(t),e=Qm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(de),re(de,e)}function je(){X(de),X(xe),X(me)}function $e(e){e.memoizedState!==null&&re(Ne,e);var t=de.current,l=Qm(t,e.type);t!==l&&(re(xe,e),re(de,l))}function Be(e){xe.current===e&&(X(de),X(xe)),Ne.current===e&&(X(Ne),rs._currentValue=le)}var te,ce;function oe(e){if(te===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);te=t&&t[1]||"",ce=-1<l.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+te+e+ce}var fe=!1;function ye(e,t){if(!e||fe)return"";fe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(J){var Z=J}Reflect.construct(e,[],ae)}else{try{ae.call()}catch(J){Z=J}e.call(ae.prototype)}}else{try{throw Error()}catch(J){Z=J}(ae=e())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(J){if(J&&Z&&typeof J.stack=="string")return[J.stack,Z.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),y=u[0],k=u[1];if(y&&k){var H=y.split(`
45
- `),K=k.split(`
46
- `);for(c=s=0;s<H.length&&!H[s].includes("DetermineComponentFrameRoot");)s++;for(;c<K.length&&!K[c].includes("DetermineComponentFrameRoot");)c++;if(s===H.length||c===K.length)for(s=H.length-1,c=K.length-1;1<=s&&0<=c&&H[s]!==K[c];)c--;for(;1<=s&&0<=c;s--,c--)if(H[s]!==K[c]){if(s!==1||c!==1)do if(s--,c--,0>c||H[s]!==K[c]){var ee=`
47
- `+H[s].replace(" at new "," at ");return e.displayName&&ee.includes("<anonymous>")&&(ee=ee.replace("<anonymous>",e.displayName)),ee}while(1<=s&&0<=c);break}}}finally{fe=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?oe(l):""}function _e(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 ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return oe("Activity");default:return""}}function Me(e){try{var t="",l=null;do t+=_e(e,l),l=e,e=e.return;while(e);return t}catch(s){return`
48
- Error generating stack: `+s.message+`
49
- `+s.stack}}var dt=Object.prototype.hasOwnProperty,Pt=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,$t=a.unstable_requestPaint,tt=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,he=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,ze=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Qt=a.unstable_IdlePriority,nt=a.log,Xa=a.unstable_setDisableYieldValue,Fn=null,Nt=null;function St(e){if(typeof nt=="function"&&Xa(e),Nt&&typeof Nt.setStrictMode=="function")try{Nt.setStrictMode(Fn,e)}catch{}}var bt=Math.clz32?Math.clz32:Bn,On=Math.log,Fa=Math.LN2;function Bn(e){return e>>>=0,e===0?32:31-(On(e)/Fa|0)|0}var Ie=256,Ht=262144,Zn=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 yr(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var k=s&134217727;return k!==0?(s=k&~u,s!==0?c=Ct(s):(y&=k,y!==0?c=Ct(y):l||(l=k&~e,l!==0&&(c=Ct(l))))):(k=s&~u,k!==0?c=Ct(k):y!==0?c=Ct(y):l||(l=s&~e,l!==0&&(c=Ct(l)))),c===0?0:t!==0&&t!==c&&(t&u)===0&&(u=c&-c,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:c}function kn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mo(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 Ed(){var e=Zn;return Zn<<=1,(Zn&62914560)===0&&(Zn=4194304),e}function ho(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function gr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ty(e,t,l,s,c,u){var y=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 k=e.entanglements,H=e.expirationTimes,K=e.hiddenUpdates;for(l=y&~l;0<l;){var ee=31-bt(l),ae=1<<ee;k[ee]=0,H[ee]=-1;var Z=K[ee];if(Z!==null)for(K[ee]=null,ee=0;ee<Z.length;ee++){var J=Z[ee];J!==null&&(J.lane&=-536870913)}l&=~ae}s!==0&&Td(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(y&~t))}function Td(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-bt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|l&261930}function Rd(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var s=31-bt(l),c=1<<s;c&t|e[s]&t&&(e[s]|=t),l&=~c}}function Ad(e,t){var l=t&-t;return l=(l&42)!==0?1:xo(l),(l&(e.suspendedLanes|t))!==0?0:l}function xo(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 vo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Md(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:vh(e.type))}function zd(e,t){var l=B.p;try{return B.p=e,t()}finally{B.p=l}}var ga=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ga,an="__reactProps$"+ga,jl="__reactContainer$"+ga,yo="__reactEvents$"+ga,ny="__reactListeners$"+ga,ay="__reactHandles$"+ga,Dd="__reactResources$"+ga,br="__reactMarker$"+ga;function go(e){delete e[Gt],delete e[an],delete e[yo],delete e[ny],delete e[ay]}function Sl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[jl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=th(e);e!==null;){if(l=e[Gt])return l;e=th(e)}return t}e=l,l=e.parentNode}return null}function kl(e){if(e=e[Gt]||e[jl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function jr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function wl(e){var t=e[Dd];return t||(t=e[Dd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ut(e){e[br]=!0}var Ld=new Set,_d={};function Za(e,t){Nl(e,t),Nl(e+"Capture",t)}function Nl(e,t){for(_d[e]=t,e=0;e<t.length;e++)Ld.add(t[e])}var ly=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]*$"),Od={},Bd={};function ry(e){return dt.call(Bd,e)?!0:dt.call(Od,e)?!1:ly.test(e)?Bd[e]=!0:(Od[e]=!0,!1)}function As(e,t,l){if(ry(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Ms(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 Pn(e,t,l,s){if(s===null)e.removeAttribute(l);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+s)}}function wn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sy(e,t,l){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){l=""+y,u.call(this,y)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function bo(e){if(!e._valueTracker){var t=Hd(e)?"checked":"value";e._valueTracker=sy(e,t,""+e[t])}}function Ud(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=Hd(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function zs(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 iy=/[\n"\\]/g;function Nn(e){return e.replace(iy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function jo(e,t,l,s,c,u,y,k){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+wn(t)):e.value!==""+wn(t)&&(e.value=""+wn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?So(e,y,wn(t)):l!=null?So(e,y,wn(l)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.name=""+wn(k):e.removeAttribute("name")}function Id(e,t,l,s,c,u,y,k){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)){bo(e);return}l=l!=null?""+wn(l):"",t=t!=null?""+wn(t):l,k||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=k?e.checked:!!s,e.defaultChecked=!!s,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),bo(e)}function So(e,t,l){t==="number"&&zs(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Cl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+wn(l),t=null,c=0;c<e.length;c++){if(e[c].value===l){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Vd(e,t,l){if(t!=null&&(t=""+wn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+wn(l):""}function $d(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(_(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=wn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),bo(e)}function El(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var oy=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 Gd(e,t,l){var s=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,l):typeof l!="number"||l===0||oy.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function qd(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var s in l)!l.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var c in t)s=t[c],t.hasOwnProperty(c)&&l[c]!==s&&Gd(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&Gd(e,u,t[u])}function ko(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 cy=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"]]),uy=/^[\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 Ds(e){return uy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var wo=null;function No(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Tl=null,Rl=null;function Yd(e){var t=kl(e);if(t&&(e=t.stateNode)){var l=e[an]||null;e:switch(e=t.stateNode,t.type){case"input":if(jo(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="'+Nn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var s=l[t];if(s!==e&&s.form===e.form){var c=s[an]||null;if(!c)throw Error(o(90));jo(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<l.length;t++)s=l[t],s.form===e.form&&Ud(s)}break e;case"textarea":Vd(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Cl(e,!!l.multiple,t,!1)}}}var Co=!1;function Kd(e,t,l){if(Co)return e(t,l);Co=!0;try{var s=e(t);return s}finally{if(Co=!1,(Tl!==null||Rl!==null)&&(bi(),Tl&&(t=Tl,e=Rl,Rl=Tl=null,Yd(t),e)))for(t=0;t<e.length;t++)Yd(e[t])}}function Sr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[an]||null;if(s===null)return null;l=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var ea=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eo=!1;if(ea)try{var kr={};Object.defineProperty(kr,"passive",{get:function(){Eo=!0}}),window.addEventListener("test",kr,kr),window.removeEventListener("test",kr,kr)}catch{Eo=!1}var ba=null,To=null,Ls=null;function Wd(){if(Ls)return Ls;var e,t=To,l=t.length,s,c="value"in ba?ba.value:ba.textContent,u=c.length;for(e=0;e<l&&t[e]===c[e];e++);var y=l-e;for(s=1;s<=y&&t[l-s]===c[u-s];s++);return Ls=c.slice(e,1<s?1-s:void 0)}function _s(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 Os(){return!0}function Qd(){return!1}function ln(e){function t(l,s,c,u,y){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=y,this.currentTarget=null;for(var k in e)e.hasOwnProperty(k)&&(l=e[k],this[k]=l?l(u):u[k]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Os:Qd,this.isPropagationStopped=Qd,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=Os)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Os)},persist:function(){},isPersistent:Os}),t}var Pa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bs=ln(Pa),wr=g({},Pa,{view:0,detail:0}),dy=ln(wr),Ro,Ao,Nr,Hs=g({},wr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zo,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"?(Ro=e.screenX-Nr.screenX,Ao=e.screenY-Nr.screenY):Ao=Ro=0,Nr=e),Ro)},movementY:function(e){return"movementY"in e?e.movementY:Ao}}),Xd=ln(Hs),fy=g({},Hs,{dataTransfer:0}),py=ln(fy),my=g({},wr,{relatedTarget:0}),Mo=ln(my),hy=g({},Pa,{animationName:0,elapsedTime:0,pseudoElement:0}),xy=ln(hy),vy=g({},Pa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yy=ln(vy),gy=g({},Pa,{data:0}),Fd=ln(gy),by={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jy={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"},Sy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ky(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Sy[e])?!!t[e]:!1}function zo(){return ky}var wy=g({},wr,{key:function(e){if(e.key){var t=by[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=_s(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?jy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zo,charCode:function(e){return e.type==="keypress"?_s(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?_s(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ny=ln(wy),Cy=g({},Hs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zd=ln(Cy),Ey=g({},wr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zo}),Ty=ln(Ey),Ry=g({},Pa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ay=ln(Ry),My=g({},Hs,{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}),zy=ln(My),Dy=g({},Pa,{newState:0,oldState:0}),Ly=ln(Dy),_y=[9,13,27,32],Do=ea&&"CompositionEvent"in window,Cr=null;ea&&"documentMode"in document&&(Cr=document.documentMode);var Oy=ea&&"TextEvent"in window&&!Cr,Pd=ea&&(!Do||Cr&&8<Cr&&11>=Cr),Jd=" ",ef=!1;function tf(e,t){switch(e){case"keyup":return _y.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Al=!1;function By(e,t){switch(e){case"compositionend":return nf(t);case"keypress":return t.which!==32?null:(ef=!0,Jd);case"textInput":return e=t.data,e===Jd&&ef?null:e;default:return null}}function Hy(e,t){if(Al)return e==="compositionend"||!Do&&tf(e,t)?(e=Wd(),Ls=To=ba=null,Al=!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 Pd&&t.locale!=="ko"?null:t.data;default:return null}}var Uy={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 af(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Uy[e.type]:t==="textarea"}function lf(e,t,l,s){Tl?Rl?Rl.push(s):Rl=[s]:Tl=s,t=Ei(t,"onChange"),0<t.length&&(l=new Bs("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Er=null,Tr=null;function Iy(e){Vm(e,0)}function Us(e){var t=jr(e);if(Ud(t))return e}function rf(e,t){if(e==="change")return t}var sf=!1;if(ea){var Lo;if(ea){var _o="oninput"in document;if(!_o){var of=document.createElement("div");of.setAttribute("oninput","return;"),_o=typeof of.oninput=="function"}Lo=_o}else Lo=!1;sf=Lo&&(!document.documentMode||9<document.documentMode)}function cf(){Er&&(Er.detachEvent("onpropertychange",uf),Tr=Er=null)}function uf(e){if(e.propertyName==="value"&&Us(Tr)){var t=[];lf(t,Tr,e,No(e)),Kd(Iy,t)}}function Vy(e,t,l){e==="focusin"?(cf(),Er=t,Tr=l,Er.attachEvent("onpropertychange",uf)):e==="focusout"&&cf()}function $y(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Us(Tr)}function Gy(e,t){if(e==="click")return Us(t)}function qy(e,t){if(e==="input"||e==="change")return Us(t)}function Yy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dn=typeof Object.is=="function"?Object.is:Yy;function Rr(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),s=Object.keys(t);if(l.length!==s.length)return!1;for(s=0;s<l.length;s++){var c=l[s];if(!dt.call(t,c)||!dn(e[c],t[c]))return!1}return!0}function df(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ff(e,t){var l=df(e);e=0;for(var s;l;){if(l.nodeType===3){if(s=e+l.textContent.length,e<=t&&s>=t)return{node:l,offset:t-e};e=s}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=df(l)}}function pf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zs(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=zs(e.document)}return t}function Oo(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 Ky=ea&&"documentMode"in document&&11>=document.documentMode,Ml=null,Bo=null,Ar=null,Ho=!1;function hf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Ho||Ml==null||Ml!==zs(s)||(s=Ml,"selectionStart"in s&&Oo(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ar&&Rr(Ar,s)||(Ar=s,s=Ei(Bo,"onSelect"),0<s.length&&(t=new Bs("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=Ml)))}function Ja(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var zl={animationend:Ja("Animation","AnimationEnd"),animationiteration:Ja("Animation","AnimationIteration"),animationstart:Ja("Animation","AnimationStart"),transitionrun:Ja("Transition","TransitionRun"),transitionstart:Ja("Transition","TransitionStart"),transitioncancel:Ja("Transition","TransitionCancel"),transitionend:Ja("Transition","TransitionEnd")},Uo={},xf={};ea&&(xf=document.createElement("div").style,"AnimationEvent"in window||(delete zl.animationend.animation,delete zl.animationiteration.animation,delete zl.animationstart.animation),"TransitionEvent"in window||delete zl.transitionend.transition);function el(e){if(Uo[e])return Uo[e];if(!zl[e])return e;var t=zl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in xf)return Uo[e]=t[l];return e}var vf=el("animationend"),yf=el("animationiteration"),gf=el("animationstart"),Wy=el("transitionrun"),Qy=el("transitionstart"),Xy=el("transitioncancel"),bf=el("transitionend"),jf=new Map,Io="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(" ");Io.push("scrollEnd");function Hn(e,t){jf.set(e,t),Za(t,[e])}var Is=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=[],Dl=0,Vo=0;function Vs(){for(var e=Dl,t=Vo=Dl=0;t<e;){var l=Cn[t];Cn[t++]=null;var s=Cn[t];Cn[t++]=null;var c=Cn[t];Cn[t++]=null;var u=Cn[t];if(Cn[t++]=null,s!==null&&c!==null){var y=s.pending;y===null?c.next=c:(c.next=y.next,y.next=c),s.pending=c}u!==0&&Sf(l,c,u)}}function $s(e,t,l,s){Cn[Dl++]=e,Cn[Dl++]=t,Cn[Dl++]=l,Cn[Dl++]=s,Vo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function $o(e,t,l,s){return $s(e,t,l,s),Gs(e)}function tl(e,t){return $s(e,null,null,t),Gs(e)}function Sf(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,u=e.return;u!==null;)u.childLanes|=l,s=u.alternate,s!==null&&(s.childLanes|=l),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-bt(l),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),u):null}function Gs(e){if(50<Pr)throw Pr=0,Zc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ll={};function Fy(e,t,l,s){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fn(e,t,l,s){return new Fy(e,t,l,s)}function Go(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ta(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 kf(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 qs(e,t,l,s,c,u){var y=0;if(s=e,typeof e=="function")Go(e)&&(y=1);else if(typeof e=="string")y=t1(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,c),e.elementType=M,e.lanes=u,e;case A:return nl(l.children,c,u,t);case E:y=8,c|=24;break;case N:return e=fn(12,l,t,c|2),e.elementType=N,e.lanes=u,e;case O:return e=fn(13,l,t,c),e.elementType=O,e.lanes=u,e;case $:return e=fn(19,l,t,c),e.elementType=$,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:y=10;break e;case R:y=9;break e;case I:y=11;break e;case w:y=14;break e;case D:y=16,s=null;break e}y=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=fn(y,l,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function nl(e,t,l,s){return e=fn(7,e,s,t),e.lanes=l,e}function qo(e,t,l){return e=fn(6,e,null,t),e.lanes=l,e}function wf(e){var t=fn(18,null,null,0);return t.stateNode=e,t}function Yo(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 Nf=new WeakMap;function En(e,t){if(typeof e=="object"&&e!==null){var l=Nf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},Nf.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var _l=[],Ol=0,Ys=null,Mr=0,Tn=[],Rn=0,ja=null,Gn=1,qn="";function na(e,t){_l[Ol++]=Mr,_l[Ol++]=Ys,Ys=e,Mr=t}function Cf(e,t,l){Tn[Rn++]=Gn,Tn[Rn++]=qn,Tn[Rn++]=ja,ja=e;var s=Gn;e=qn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var u=32-bt(t)+c;if(30<u){var y=c-c%5;u=(s&(1<<y)-1).toString(32),s>>=y,c-=y,Gn=1<<32-bt(t)+c|l<<c|s,qn=u+e}else Gn=1<<u|l<<c|s,qn=e}function Ko(e){e.return!==null&&(na(e,1),Cf(e,1,0))}function Wo(e){for(;e===Ys;)Ys=_l[--Ol],_l[Ol]=null,Mr=_l[--Ol],_l[Ol]=null;for(;e===ja;)ja=Tn[--Rn],Tn[Rn]=null,qn=Tn[--Rn],Tn[Rn]=null,Gn=Tn[--Rn],Tn[Rn]=null}function Ef(e,t){Tn[Rn++]=Gn,Tn[Rn++]=qn,Tn[Rn++]=ja,Gn=t.id,qn=t.overflow,ja=e}var qt=null,ft=null,We=!1,Sa=null,An=!1,Qo=Error(o(519));function ka(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw zr(En(t,e)),Qo}function Tf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[an]=s,l){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(l=0;l<es.length;l++)qe(es[l],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),Id(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),$d(t,s.value,s.defaultValue,s.children)}l=s.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||s.suppressHydrationWarning===!0||Ym(t.textContent,l)?(s.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),s.onScroll!=null&&qe("scroll",t),s.onScrollEnd!=null&&qe("scrollend",t),s.onClick!=null&&(t.onclick=Jn),t=!0):t=!1,t||ka(e,!0)}function Rf(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 Bl(e){if(e!==qt)return!1;if(!We)return Rf(e),We=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||fu(e.type,e.memoizedProps)),l=!l),l&&ft&&ka(e),Rf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=eh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=eh(e)}else t===27?(t=ft,Ba(e.type)?(e=vu,vu=null,ft=e):ft=t):ft=qt?zn(e.stateNode.nextSibling):null;return!0}function al(){ft=qt=null,We=!1}function Xo(){var e=Sa;return e!==null&&(cn===null?cn=e:cn.push.apply(cn,e),Sa=null),e}function zr(e){Sa===null?Sa=[e]:Sa.push(e)}var Fo=z(null),ll=null,aa=null;function wa(e,t,l){re(Fo,t._currentValue),t._currentValue=l}function la(e){e._currentValue=Fo.current,X(Fo)}function Zo(e,t,l){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===l)break;e=e.return}}function Po(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var y=c.child;u=u.firstContext;e:for(;u!==null;){var k=u;u=c;for(var H=0;H<t.length;H++)if(k.context===t[H]){u.lanes|=l,k=u.alternate,k!==null&&(k.lanes|=l),Zo(u.return,l,e),s||(y=null);break e}u=k.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(o(341));y.lanes|=l,u=y.alternate,u!==null&&(u.lanes|=l),Zo(y,l,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function Hl(e,t,l,s){e=null;for(var c=t,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(o(387));if(y=y.memoizedProps,y!==null){var k=c.type;dn(c.pendingProps.value,y.value)||(e!==null?e.push(k):e=[k])}}else if(c===Ne.current){if(y=c.alternate,y===null)throw Error(o(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(rs):e=[rs])}c=c.return}e!==null&&Po(t,e,l,s),t.flags|=262144}function Ks(e){for(e=e.firstContext;e!==null;){if(!dn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function rl(e){ll=e,aa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return Af(ll,e)}function Ws(e,t){return ll===null&&rl(e),Af(e,t)}function Af(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},aa===null){if(e===null)throw Error(o(308));aa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else aa=aa.next=t;return l}var Zy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},Py=a.unstable_scheduleCallback,Jy=a.unstable_NormalPriority,At={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Jo(){return{controller:new Zy,data:new Map,refCount:0}}function Dr(e){e.refCount--,e.refCount===0&&Py(Jy,function(){e.controller.abort()})}var Lr=null,ec=0,Ul=0,Il=null;function eg(e,t){if(Lr===null){var l=Lr=[];ec=0,Ul=au(),Il={status:"pending",value:void 0,then:function(s){l.push(s)}}}return ec++,t.then(Mf,Mf),t}function Mf(){if(--ec===0&&Lr!==null){Il!==null&&(Il.status="fulfilled");var e=Lr;Lr=null,Ul=0,Il=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function tg(e,t){var l=[],s={status:"pending",value:null,reason:null,then:function(c){l.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<l.length;c++)(0,l[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<l.length;c++)(0,l[c])(void 0)}),s}var zf=T.S;T.S=function(e,t){hm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&eg(e,t),zf!==null&&zf(e,t)};var sl=z(null);function tc(){var e=sl.current;return e!==null?e:ut.pooledCache}function Qs(e,t){t===null?re(sl,sl.current):re(sl,t.pool)}function Df(){var e=tc();return e===null?null:{parent:At._currentValue,pool:e}}var Vl=Error(o(460)),nc=Error(o(474)),Xs=Error(o(542)),Fs={then:function(){}};function Lf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function _f(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Jn,Jn),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bf(e),e;default:if(typeof t.status=="string")t.then(Jn,Jn);else{if(e=ut,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=s}},function(s){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bf(e),e}throw ol=t,Vl}}function il(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ol=l,Vl):l}}var ol=null;function Of(){if(ol===null)throw Error(o(459));var e=ol;return ol=null,e}function Bf(e){if(e===Vl||e===Xs)throw Error(o(483))}var $l=null,_r=0;function Zs(e){var t=_r;return _r+=1,$l===null&&($l=[]),_f($l,e,t)}function Or(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ps(e,t){throw t.$$typeof===j?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Hf(e){function t(G,V){if(e){var Y=G.deletions;Y===null?(G.deletions=[V],G.flags|=16):Y.push(V)}}function l(G,V){if(!e)return null;for(;V!==null;)t(G,V),V=V.sibling;return null}function s(G){for(var V=new Map;G!==null;)G.key!==null?V.set(G.key,G):V.set(G.index,G),G=G.sibling;return V}function c(G,V){return G=ta(G,V),G.index=0,G.sibling=null,G}function u(G,V,Y){return G.index=Y,e?(Y=G.alternate,Y!==null?(Y=Y.index,Y<V?(G.flags|=67108866,V):Y):(G.flags|=67108866,V)):(G.flags|=1048576,V)}function y(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function k(G,V,Y,ne){return V===null||V.tag!==6?(V=qo(Y,G.mode,ne),V.return=G,V):(V=c(V,Y),V.return=G,V)}function H(G,V,Y,ne){var Ee=Y.type;return Ee===A?ee(G,V,Y.props.children,ne,Y.key):V!==null&&(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&il(Ee)===V.type)?(V=c(V,Y.props),Or(V,Y),V.return=G,V):(V=qs(Y.type,Y.key,Y.props,null,G.mode,ne),Or(V,Y),V.return=G,V)}function K(G,V,Y,ne){return V===null||V.tag!==4||V.stateNode.containerInfo!==Y.containerInfo||V.stateNode.implementation!==Y.implementation?(V=Yo(Y,G.mode,ne),V.return=G,V):(V=c(V,Y.children||[]),V.return=G,V)}function ee(G,V,Y,ne,Ee){return V===null||V.tag!==7?(V=nl(Y,G.mode,ne,Ee),V.return=G,V):(V=c(V,Y),V.return=G,V)}function ae(G,V,Y){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=qo(""+V,G.mode,Y),V.return=G,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return Y=qs(V.type,V.key,V.props,null,G.mode,Y),Or(Y,V),Y.return=G,Y;case C:return V=Yo(V,G.mode,Y),V.return=G,V;case D:return V=il(V),ae(G,V,Y)}if(_(V)||W(V))return V=nl(V,G.mode,Y,null),V.return=G,V;if(typeof V.then=="function")return ae(G,Zs(V),Y);if(V.$$typeof===L)return ae(G,Ws(G,V),Y);Ps(G,V)}return null}function Z(G,V,Y,ne){var Ee=V!==null?V.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Ee!==null?null:k(G,V,""+Y,ne);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:return Y.key===Ee?H(G,V,Y,ne):null;case C:return Y.key===Ee?K(G,V,Y,ne):null;case D:return Y=il(Y),Z(G,V,Y,ne)}if(_(Y)||W(Y))return Ee!==null?null:ee(G,V,Y,ne,null);if(typeof Y.then=="function")return Z(G,V,Zs(Y),ne);if(Y.$$typeof===L)return Z(G,V,Ws(G,Y),ne);Ps(G,Y)}return null}function J(G,V,Y,ne,Ee){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return G=G.get(Y)||null,k(V,G,""+ne,Ee);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return G=G.get(ne.key===null?Y:ne.key)||null,H(V,G,ne,Ee);case C:return G=G.get(ne.key===null?Y:ne.key)||null,K(V,G,ne,Ee);case D:return ne=il(ne),J(G,V,Y,ne,Ee)}if(_(ne)||W(ne))return G=G.get(Y)||null,ee(V,G,ne,Ee,null);if(typeof ne.then=="function")return J(G,V,Y,Zs(ne),Ee);if(ne.$$typeof===L)return J(G,V,Y,Ws(V,ne),Ee);Ps(V,ne)}return null}function be(G,V,Y,ne){for(var Ee=null,Fe=null,Se=V,He=V=0,Ke=null;Se!==null&&He<Y.length;He++){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var Ze=Z(G,Se,Y[He],ne);if(Ze===null){Se===null&&(Se=Ke);break}e&&Se&&Ze.alternate===null&&t(G,Se),V=u(Ze,V,He),Fe===null?Ee=Ze:Fe.sibling=Ze,Fe=Ze,Se=Ke}if(He===Y.length)return l(G,Se),We&&na(G,He),Ee;if(Se===null){for(;He<Y.length;He++)Se=ae(G,Y[He],ne),Se!==null&&(V=u(Se,V,He),Fe===null?Ee=Se:Fe.sibling=Se,Fe=Se);return We&&na(G,He),Ee}for(Se=s(Se);He<Y.length;He++)Ke=J(Se,G,He,Y[He],ne),Ke!==null&&(e&&Ke.alternate!==null&&Se.delete(Ke.key===null?He:Ke.key),V=u(Ke,V,He),Fe===null?Ee=Ke:Fe.sibling=Ke,Fe=Ke);return e&&Se.forEach(function($a){return t(G,$a)}),We&&na(G,He),Ee}function Te(G,V,Y,ne){if(Y==null)throw Error(o(151));for(var Ee=null,Fe=null,Se=V,He=V=0,Ke=null,Ze=Y.next();Se!==null&&!Ze.done;He++,Ze=Y.next()){Se.index>He?(Ke=Se,Se=null):Ke=Se.sibling;var $a=Z(G,Se,Ze.value,ne);if($a===null){Se===null&&(Se=Ke);break}e&&Se&&$a.alternate===null&&t(G,Se),V=u($a,V,He),Fe===null?Ee=$a:Fe.sibling=$a,Fe=$a,Se=Ke}if(Ze.done)return l(G,Se),We&&na(G,He),Ee;if(Se===null){for(;!Ze.done;He++,Ze=Y.next())Ze=ae(G,Ze.value,ne),Ze!==null&&(V=u(Ze,V,He),Fe===null?Ee=Ze:Fe.sibling=Ze,Fe=Ze);return We&&na(G,He),Ee}for(Se=s(Se);!Ze.done;He++,Ze=Y.next())Ze=J(Se,G,He,Ze.value,ne),Ze!==null&&(e&&Ze.alternate!==null&&Se.delete(Ze.key===null?He:Ze.key),V=u(Ze,V,He),Fe===null?Ee=Ze:Fe.sibling=Ze,Fe=Ze);return e&&Se.forEach(function(f1){return t(G,f1)}),We&&na(G,He),Ee}function it(G,V,Y,ne){if(typeof Y=="object"&&Y!==null&&Y.type===A&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case S:e:{for(var Ee=Y.key;V!==null;){if(V.key===Ee){if(Ee=Y.type,Ee===A){if(V.tag===7){l(G,V.sibling),ne=c(V,Y.props.children),ne.return=G,G=ne;break e}}else if(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===D&&il(Ee)===V.type){l(G,V.sibling),ne=c(V,Y.props),Or(ne,Y),ne.return=G,G=ne;break e}l(G,V);break}else t(G,V);V=V.sibling}Y.type===A?(ne=nl(Y.props.children,G.mode,ne,Y.key),ne.return=G,G=ne):(ne=qs(Y.type,Y.key,Y.props,null,G.mode,ne),Or(ne,Y),ne.return=G,G=ne)}return y(G);case C:e:{for(Ee=Y.key;V!==null;){if(V.key===Ee)if(V.tag===4&&V.stateNode.containerInfo===Y.containerInfo&&V.stateNode.implementation===Y.implementation){l(G,V.sibling),ne=c(V,Y.children||[]),ne.return=G,G=ne;break e}else{l(G,V);break}else t(G,V);V=V.sibling}ne=Yo(Y,G.mode,ne),ne.return=G,G=ne}return y(G);case D:return Y=il(Y),it(G,V,Y,ne)}if(_(Y))return be(G,V,Y,ne);if(W(Y)){if(Ee=W(Y),typeof Ee!="function")throw Error(o(150));return Y=Ee.call(Y),Te(G,V,Y,ne)}if(typeof Y.then=="function")return it(G,V,Zs(Y),ne);if(Y.$$typeof===L)return it(G,V,Ws(G,Y),ne);Ps(G,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,V!==null&&V.tag===6?(l(G,V.sibling),ne=c(V,Y),ne.return=G,G=ne):(l(G,V),ne=qo(Y,G.mode,ne),ne.return=G,G=ne),y(G)):l(G,V)}return function(G,V,Y,ne){try{_r=0;var Ee=it(G,V,Y,ne);return $l=null,Ee}catch(Se){if(Se===Vl||Se===Xs)throw Se;var Fe=fn(29,Se,null,G.mode);return Fe.lanes=ne,Fe.return=G,Fe}finally{}}}var cl=Hf(!0),Uf=Hf(!1),Na=!1;function ac(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 Ca(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ea(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Gs(e),Sf(e,null,l),t}return $s(e,s,t,l),Gs(e)}function Br(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Rd(e,l)}}function rc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var y={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?c=u=y:u=u.next=y,l=l.next}while(l!==null);u===null?c=u=t:u=u.next=t}else c=u=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var sc=!1;function Hr(){if(sc){var e=Il;if(e!==null)throw e}}function Ur(e,t,l,s){sc=!1;var c=e.updateQueue;Na=!1;var u=c.firstBaseUpdate,y=c.lastBaseUpdate,k=c.shared.pending;if(k!==null){c.shared.pending=null;var H=k,K=H.next;H.next=null,y===null?u=K:y.next=K,y=H;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,k=ee.lastBaseUpdate,k!==y&&(k===null?ee.firstBaseUpdate=K:k.next=K,ee.lastBaseUpdate=H))}if(u!==null){var ae=c.baseState;y=0,ee=K=H=null,k=u;do{var Z=k.lane&-536870913,J=Z!==k.lane;if(J?(Ye&Z)===Z:(s&Z)===Z){Z!==0&&Z===Ul&&(sc=!0),ee!==null&&(ee=ee.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var be=e,Te=k;Z=t;var it=l;switch(Te.tag){case 1:if(be=Te.payload,typeof be=="function"){ae=be.call(it,ae,Z);break e}ae=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Te.payload,Z=typeof be=="function"?be.call(it,ae,Z):be,Z==null)break e;ae=g({},ae,Z);break e;case 2:Na=!0}}Z=k.callback,Z!==null&&(e.flags|=64,J&&(e.flags|=8192),J=c.callbacks,J===null?c.callbacks=[Z]:J.push(Z))}else J={lane:Z,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ee===null?(K=ee=J,H=ae):ee=ee.next=J,y|=Z;if(k=k.next,k===null){if(k=c.shared.pending,k===null)break;J=k,k=J.next,J.next=null,c.lastBaseUpdate=J,c.shared.pending=null}}while(!0);ee===null&&(H=ae),c.baseState=H,c.firstBaseUpdate=K,c.lastBaseUpdate=ee,u===null&&(c.shared.lanes=0),za|=y,e.lanes=y,e.memoizedState=ae}}function If(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Vf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)If(l[e],t)}var Gl=z(null),Js=z(0);function $f(e,t){e=pa,re(Js,e),re(Gl,t),pa=e|t.baseLanes}function ic(){re(Js,pa),re(Gl,Gl.current)}function oc(){pa=Js.current,X(Gl),X(Js)}var pn=z(null),Mn=null;function Ta(e){var t=e.alternate;re(Et,Et.current&1),re(pn,e),Mn===null&&(t===null||Gl.current!==null||t.memoizedState!==null)&&(Mn=e)}function cc(e){re(Et,Et.current),re(pn,e),Mn===null&&(Mn=e)}function Gf(e){e.tag===22?(re(Et,Et.current),re(pn,e),Mn===null&&(Mn=e)):Ra()}function Ra(){re(Et,Et.current),re(pn,pn.current)}function mn(e){X(pn),Mn===e&&(Mn=null),X(Et)}var Et=z(0);function ei(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||hu(l)||xu(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 ra=0,Oe=null,rt=null,Mt=null,ti=!1,ql=!1,ul=!1,ni=0,Ir=0,Yl=null,ng=0;function kt(){throw Error(o(321))}function uc(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 dc(e,t,l,s,c,u){return ra=u,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?Cp:Cc,ul=!1,u=l(s,c),ul=!1,ql&&(u=Yf(t,l,s,c)),qf(e),u}function qf(e){T.H=Gr;var t=rt!==null&&rt.next!==null;if(ra=0,Mt=rt=Oe=null,ti=!1,Ir=0,Yl=null,t)throw Error(o(300));e===null||zt||(e=e.dependencies,e!==null&&Ks(e)&&(zt=!0))}function Yf(e,t,l,s){Oe=e;var c=0;do{if(ql&&(Yl=null),Ir=0,ql=!1,25<=c)throw Error(o(301));if(c+=1,Mt=rt=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}T.H=Ep,u=t(l,s)}while(ql);return u}function ag(){var e=T.H,t=e.useState()[0];return t=typeof t.then=="function"?Vr(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Oe.flags|=1024),t}function fc(){var e=ni!==0;return ni=0,e}function pc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function mc(e){if(ti){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ti=!1}ra=0,Mt=rt=Oe=null,ql=!1,Ir=ni=0,Yl=null}function Jt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e,Mt}function Tt(){if(rt===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=rt.next;var t=Mt===null?Oe.memoizedState:Mt.next;if(t!==null)Mt=t,rt=e;else{if(e===null)throw Oe.alternate===null?Error(o(467)):Error(o(310));rt=e,e={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Mt===null?Oe.memoizedState=Mt=e:Mt=Mt.next=e}return Mt}function ai(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vr(e){var t=Ir;return Ir+=1,Yl===null&&(Yl=[]),e=_f(Yl,e,t),t=Oe,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?Cp:Cc),e}function li(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Vr(e);if(e.$$typeof===L)return Yt(e)}throw Error(o(438,String(e)))}function hc(e){var t=null,l=Oe.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var s=Oe.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=ai(),Oe.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),s=0;s<e;s++)l[s]=U;return t.index++,l}function sa(e,t){return typeof t=="function"?t(e):t}function ri(e){var t=Tt();return xc(t,rt,e)}function xc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,u=s.pending;if(u!==null){if(c!==null){var y=c.next;c.next=u.next,u.next=y}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var k=y=null,H=null,K=t,ee=!1;do{var ae=K.lane&-536870913;if(ae!==K.lane?(Ye&ae)===ae:(ra&ae)===ae){var Z=K.revertLane;if(Z===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),ae===Ul&&(ee=!0);else if((ra&Z)===Z){K=K.next,Z===Ul&&(ee=!0);continue}else ae={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(k=H=ae,y=u):H=H.next=ae,Oe.lanes|=Z,za|=Z;ae=K.action,ul&&l(u,ae),u=K.hasEagerState?K.eagerState:l(u,ae)}else Z={lane:ae,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},H===null?(k=H=Z,y=u):H=H.next=Z,Oe.lanes|=ae,za|=ae;K=K.next}while(K!==null&&K!==t);if(H===null?y=u:H.next=k,!dn(u,e.memoizedState)&&(zt=!0,ee&&(l=Il,l!==null)))throw l;e.memoizedState=u,e.baseState=y,e.baseQueue=H,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function vc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,u=t.memoizedState;if(c!==null){l.pending=null;var y=c=c.next;do u=e(u,y.action),y=y.next;while(y!==c);dn(u,t.memoizedState)||(zt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),l.lastRenderedState=u}return[u,s]}function Kf(e,t,l){var s=Oe,c=Tt(),u=We;if(u){if(l===void 0)throw Error(o(407));l=l()}else l=t();var y=!dn((rt||c).memoizedState,l);if(y&&(c.memoizedState=l,zt=!0),c=c.queue,bc(Xf.bind(null,s,c,e),[e]),c.getSnapshot!==t||y||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Kl(9,{destroy:void 0},Qf.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));u||(ra&127)!==0||Wf(s,t,l)}return l}function Wf(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Oe.updateQueue,t===null?(t=ai(),Oe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Qf(e,t,l,s){t.value=l,t.getSnapshot=s,Ff(t)&&Zf(e)}function Xf(e,t,l){return l(function(){Ff(t)&&Zf(e)})}function Ff(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!dn(e,l)}catch{return!0}}function Zf(e){var t=tl(e,2);t!==null&&un(t,e,2)}function yc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),ul){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:e},t}function Pf(e,t,l,s){return e.baseState=l,xc(e,rt,typeof s=="function"?s:sa)}function lg(e,t,l,s,c){if(oi(e))throw Error(o(485));if(e=t.action,e!==null){var u={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){u.listeners.push(y)}};T.T!==null?l(!0):u.isTransition=!1,s(u),l=t.pending,l===null?(u.next=t.pending=u,Jf(t,u)):(u.next=l.next,t.pending=l.next=u)}}function Jf(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=T.T,y={};T.T=y;try{var k=l(c,s),H=T.S;H!==null&&H(y,k),ep(e,t,k)}catch(K){gc(e,t,K)}finally{u!==null&&y.types!==null&&(u.types=y.types),T.T=u}}else try{u=l(c,s),ep(e,t,u)}catch(K){gc(e,t,K)}}function ep(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){tp(e,t,s)},function(s){return gc(e,t,s)}):tp(e,t,l)}function tp(e,t,l){t.status="fulfilled",t.value=l,np(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Jf(e,l)))}function gc(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,np(t),t=t.next;while(t!==s)}e.action=null}function np(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ap(e,t){return t}function lp(e,t){if(We){var l=ut.formState;if(l!==null){e:{var s=Oe;if(We){if(ft){t:{for(var c=ft,u=An;c.nodeType!==8;){if(!u){c=null;break t}if(c=zn(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){ft=zn(c.nextSibling),s=c.data==="F!";break e}}ka(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ap,lastRenderedState:t},l.queue=s,l=kp.bind(null,Oe,s),s.dispatch=l,s=yc(!1),u=Nc.bind(null,Oe,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=lg.bind(null,Oe,c,u,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function rp(e){var t=Tt();return sp(t,rt,e)}function sp(e,t,l){if(t=xc(e,t,ap)[0],e=ri(sa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Vr(t)}catch(y){throw y===Vl?Xs:y}else s=t;t=Tt();var c=t.queue,u=c.dispatch;return l!==t.memoizedState&&(Oe.flags|=2048,Kl(9,{destroy:void 0},rg.bind(null,c,l),null)),[s,u,e]}function rg(e,t){e.action=t}function ip(e){var t=Tt(),l=rt;if(l!==null)return sp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Kl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=ai(),Oe.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(s=l.next,l.next=e,e.next=s,t.lastEffect=e),e}function op(){return Tt().memoizedState}function si(e,t,l,s){var c=Jt();Oe.flags|=e,c.memoizedState=Kl(1|t,{destroy:void 0},l,s===void 0?null:s)}function ii(e,t,l,s){var c=Tt();s=s===void 0?null:s;var u=c.memoizedState.inst;rt!==null&&s!==null&&uc(s,rt.memoizedState.deps)?c.memoizedState=Kl(t,u,l,s):(Oe.flags|=e,c.memoizedState=Kl(1|t,u,l,s))}function cp(e,t){si(8390656,8,e,t)}function bc(e,t){ii(2048,8,e,t)}function sg(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=ai(),Oe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function up(e){var t=Tt().memoizedState;return sg({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function dp(e,t){return ii(4,2,e,t)}function fp(e,t){return ii(4,4,e,t)}function pp(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 mp(e,t,l){l=l!=null?l.concat([e]):null,ii(4,4,pp.bind(null,t,e),l)}function jc(){}function hp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&uc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function xp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&uc(t,s[1]))return s[0];if(s=e(),ul){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function Sc(e,t,l){return l===void 0||(ra&1073741824)!==0&&(Ye&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=vm(),Oe.lanes|=e,za|=e,l)}function vp(e,t,l,s){return dn(l,t)?l:Gl.current!==null?(e=Sc(e,l,s),dn(e,t)||(zt=!0),e):(ra&42)===0||(ra&1073741824)!==0&&(Ye&261930)===0?(zt=!0,e.memoizedState=l):(e=vm(),Oe.lanes|=e,za|=e,t)}function yp(e,t,l,s,c){var u=B.p;B.p=u!==0&&8>u?u:8;var y=T.T,k={};T.T=k,Nc(e,!1,t,l);try{var H=c(),K=T.S;if(K!==null&&K(k,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var ee=tg(H,s);$r(e,t,ee,vn(e))}else $r(e,t,s,vn(e))}catch(ae){$r(e,t,{then:function(){},status:"rejected",reason:ae},vn())}finally{B.p=u,y!==null&&k.types!==null&&(y.types=k.types),T.T=y}}function ig(){}function kc(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=gp(e).queue;yp(e,c,t,le,l===null?ig:function(){return bp(e),l(s)})}function gp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:le,baseState:le,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:le},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bp(e){var t=gp(e);t.next===null&&(t=e.alternate.memoizedState),$r(e,t.next.queue,{},vn())}function wc(){return Yt(rs)}function jp(){return Tt().memoizedState}function Sp(){return Tt().memoizedState}function og(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=vn();e=Ca(l);var s=Ea(t,e,l);s!==null&&(un(s,t,l),Br(s,t,l)),t={cache:Jo()},e.payload=t;return}t=t.return}}function cg(e,t,l){var s=vn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},oi(e)?wp(t,l):(l=$o(e,t,l,s),l!==null&&(un(l,e,s),Np(l,t,s)))}function kp(e,t,l){var s=vn();$r(e,t,l,s)}function $r(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(oi(e))wp(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var y=t.lastRenderedState,k=u(y,l);if(c.hasEagerState=!0,c.eagerState=k,dn(k,y))return $s(e,t,c,0),ut===null&&Vs(),!1}catch{}finally{}if(l=$o(e,t,c,s),l!==null)return un(l,e,s),Np(l,t,s),!0}return!1}function Nc(e,t,l,s){if(s={lane:2,revertLane:au(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},oi(e)){if(t)throw Error(o(479))}else t=$o(e,l,s,2),t!==null&&un(t,e,2)}function oi(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function wp(e,t){ql=ti=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Np(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Rd(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 Cp={readContext:Yt,use:li,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:cp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,si(4194308,4,pp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return si(4194308,4,e,t)},useInsertionEffect:function(e,t){si(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(ul){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s},useReducer:function(e,t,l){var s=Jt();if(l!==void 0){var c=l(t);if(ul){St(!0);try{l(t)}finally{St(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=cg.bind(null,Oe,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=yc(e);var t=e.queue,l=kp.bind(null,Oe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:jc,useDeferredValue:function(e,t){var l=Jt();return Sc(l,e,t)},useTransition:function(){var e=yc(!1);return e=yp.bind(null,Oe,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Oe,c=Jt();if(We){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ut===null)throw Error(o(349));(Ye&127)!==0||Wf(s,t,l)}c.memoizedState=l;var u={value:l,getSnapshot:t};return c.queue=u,cp(Xf.bind(null,s,u,e),[e]),s.flags|=2048,Kl(9,{destroy:void 0},Qf.bind(null,s,u,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(We){var l=qn,s=Gn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ni++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=ng++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:wc,useFormState:lp,useActionState:lp,useOptimistic:function(e){var t=Jt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=Nc.bind(null,Oe,!0,l),l.dispatch=t,[e,t]},useMemoCache:hc,useCacheRefresh:function(){return Jt().memoizedState=og.bind(null,Oe)},useEffectEvent:function(e){var t=Jt(),l={impl:e};return t.memoizedState=l,function(){if((Je&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Cc={readContext:Yt,use:li,useCallback:hp,useContext:Yt,useEffect:bc,useImperativeHandle:mp,useInsertionEffect:dp,useLayoutEffect:fp,useMemo:xp,useReducer:ri,useRef:op,useState:function(){return ri(sa)},useDebugValue:jc,useDeferredValue:function(e,t){var l=Tt();return vp(l,rt.memoizedState,e,t)},useTransition:function(){var e=ri(sa)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Vr(e),t]},useSyncExternalStore:Kf,useId:jp,useHostTransitionStatus:wc,useFormState:rp,useActionState:rp,useOptimistic:function(e,t){var l=Tt();return Pf(l,rt,e,t)},useMemoCache:hc,useCacheRefresh:Sp};Cc.useEffectEvent=up;var Ep={readContext:Yt,use:li,useCallback:hp,useContext:Yt,useEffect:bc,useImperativeHandle:mp,useInsertionEffect:dp,useLayoutEffect:fp,useMemo:xp,useReducer:vc,useRef:op,useState:function(){return vc(sa)},useDebugValue:jc,useDeferredValue:function(e,t){var l=Tt();return rt===null?Sc(l,e,t):vp(l,rt.memoizedState,e,t)},useTransition:function(){var e=vc(sa)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Vr(e),t]},useSyncExternalStore:Kf,useId:jp,useHostTransitionStatus:wc,useFormState:ip,useActionState:ip,useOptimistic:function(e,t){var l=Tt();return rt!==null?Pf(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:hc,useCacheRefresh:Sp};Ep.useEffectEvent=up;function Ec(e,t,l,s){t=e.memoizedState,l=l(s,t),l=l==null?t:g({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var Tc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=vn(),c=Ca(s);c.payload=t,l!=null&&(c.callback=l),t=Ea(e,c,s),t!==null&&(un(t,e,s),Br(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=vn(),c=Ca(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ea(e,c,s),t!==null&&(un(t,e,s),Br(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=vn(),s=Ca(l);s.tag=2,t!=null&&(s.callback=t),t=Ea(e,s,l),t!==null&&(un(t,e,l),Br(t,e,l))}};function Tp(e,t,l,s,c,u,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,y):t.prototype&&t.prototype.isPureReactComponent?!Rr(l,s)||!Rr(c,u):!0}function Rp(e,t,l,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,s),t.state!==e&&Tc.enqueueReplaceState(t,t.state,null)}function dl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Ap(e){Is(e)}function Mp(e){console.error(e)}function zp(e){Is(e)}function ci(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Dp(e,t,l){try{var s=e.onCaughtError;s(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Rc(e,t,l){return l=Ca(l),l.tag=3,l.payload={element:null},l.callback=function(){ci(e,t)},l}function Lp(e){return e=Ca(e),e.tag=3,e}function _p(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var u=s.value;e.payload=function(){return c(u)},e.callback=function(){Dp(t,l,s)}}var y=l.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){Dp(t,l,s),typeof c!="function"&&(Da===null?Da=new Set([this]):Da.add(this));var k=s.stack;this.componentDidCatch(s.value,{componentStack:k!==null?k:""})})}function ug(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Hl(t,l,c,!0),l=pn.current,l!==null){switch(l.tag){case 31:case 13:return Mn===null?ji():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===Fs?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),eu(e,s,c)),!1;case 22:return l.flags|=65536,s===Fs?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([s]):l.add(s)),eu(e,s,c)),!1}throw Error(o(435,l.tag))}return eu(e,s,c),ji(),!1}if(We)return t=pn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Qo&&(e=Error(o(422),{cause:s}),zr(En(e,l)))):(s!==Qo&&(t=Error(o(423),{cause:s}),zr(En(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=En(s,l),c=Rc(e.stateNode,s,c),rc(e,c),wt!==4&&(wt=2)),!1;var u=Error(o(520),{cause:s});if(u=En(u,l),Zr===null?Zr=[u]:Zr.push(u),wt!==4&&(wt=2),t===null)return!0;s=En(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=Rc(l.stateNode,s,e),rc(l,e),!1;case 1:if(t=l.type,u=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Da===null||!Da.has(u))))return l.flags|=65536,c&=-c,l.lanes|=c,c=Lp(c),_p(c,e,l,s),rc(l,c),!1}l=l.return}while(l!==null);return!1}var Ac=Error(o(461)),zt=!1;function Kt(e,t,l,s){t.child=e===null?Uf(t,null,l,s):cl(t,e.child,l,s)}function Op(e,t,l,s,c){l=l.render;var u=t.ref;if("ref"in s){var y={};for(var k in s)k!=="ref"&&(y[k]=s[k])}else y=s;return rl(t),s=dc(e,t,l,y,u,c),k=fc(),e!==null&&!zt?(pc(e,t,c),ia(e,t,c)):(We&&k&&Ko(t),t.flags|=1,Kt(e,t,s,c),t.child)}function Bp(e,t,l,s,c){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,Hp(e,t,u,s,c)):(e=qs(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!Hc(e,c)){var y=u.memoizedProps;if(l=l.compare,l=l!==null?l:Rr,l(y,s)&&e.ref===t.ref)return ia(e,t,c)}return t.flags|=1,e=ta(u,s),e.ref=t.ref,e.return=t,t.child=e}function Hp(e,t,l,s,c){if(e!==null){var u=e.memoizedProps;if(Rr(u,s)&&e.ref===t.ref)if(zt=!1,t.pendingProps=s=u,Hc(e,c))(e.flags&131072)!==0&&(zt=!0);else return t.lanes=e.lanes,ia(e,t,c)}return Mc(e,t,l,s,c)}function Up(e,t,l,s){var c=s.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|l:l,e!==null){for(s=t.child=e.child,c=0;s!==null;)c=c|s.lanes|s.childLanes,s=s.sibling;s=c&~u}else s=0,t.child=null;return Ip(e,t,u,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Qs(t,u!==null?u.cachePool:null),u!==null?$f(t,u):ic(),Gf(t);else return s=t.lanes=536870912,Ip(e,t,u!==null?u.baseLanes|l:l,l,s)}else u!==null?(Qs(t,u.cachePool),$f(t,u),Ra(),t.memoizedState=null):(e!==null&&Qs(t,null),ic(),Ra());return Kt(e,t,c,l),t.child}function qr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ip(e,t,l,s,c){var u=tc();return u=u===null?null:{parent:At._currentValue,pool:u},t.memoizedState={baseLanes:l,cachePool:u},e!==null&&Qs(t,null),ic(),Gf(t),e!==null&&Hl(e,t,s,!0),t.childLanes=c,null}function ui(e,t){return t=fi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Vp(e,t,l){return cl(t,e.child,null,l),e=ui(t,t.pendingProps),e.flags|=2,mn(t),t.memoizedState=null,e}function dg(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(We){if(s.mode==="hidden")return e=ui(t,s),t.lanes=536870912,qr(null,e);if(cc(t),(e=ft)?(e=Jm(e,An),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ja!==null?{id:Gn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=wf(e),l.return=t,t.child=l,qt=t,ft=null)):e=null,e===null)throw ka(t);return t.lanes=536870912,null}return ui(t,s)}var u=e.memoizedState;if(u!==null){var y=u.dehydrated;if(cc(t),c)if(t.flags&256)t.flags&=-257,t=Vp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(zt||Hl(e,t,l,!1),c=(l&e.childLanes)!==0,zt||c){if(s=ut,s!==null&&(y=Ad(s,l),y!==0&&y!==u.retryLane))throw u.retryLane=y,tl(e,y),un(s,e,y),Ac;ji(),t=Vp(e,t,l)}else e=u.treeContext,ft=zn(y.nextSibling),qt=t,We=!0,Sa=null,An=!1,e!==null&&Ef(t,e),t=ui(t,s),t.flags|=4096;return t}return e=ta(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function di(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function Mc(e,t,l,s,c){return rl(t),l=dc(e,t,l,s,void 0,c),s=fc(),e!==null&&!zt?(pc(e,t,c),ia(e,t,c)):(We&&s&&Ko(t),t.flags|=1,Kt(e,t,l,c),t.child)}function $p(e,t,l,s,c,u){return rl(t),t.updateQueue=null,l=Yf(t,s,l,c),qf(e),s=fc(),e!==null&&!zt?(pc(e,t,u),ia(e,t,u)):(We&&s&&Ko(t),t.flags|=1,Kt(e,t,l,u),t.child)}function Gp(e,t,l,s,c){if(rl(t),t.stateNode===null){var u=Ll,y=l.contextType;typeof y=="object"&&y!==null&&(u=Yt(y)),u=new l(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Tc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},ac(t),y=l.contextType,u.context=typeof y=="object"&&y!==null?Yt(y):Ll,u.state=t.memoizedState,y=l.getDerivedStateFromProps,typeof y=="function"&&(Ec(t,l,y,s),u.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(y=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),y!==u.state&&Tc.enqueueReplaceState(u,u.state,null),Ur(t,s,u,c),Hr(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var k=t.memoizedProps,H=dl(l,k);u.props=H;var K=u.context,ee=l.contextType;y=Ll,typeof ee=="object"&&ee!==null&&(y=Yt(ee));var ae=l.getDerivedStateFromProps;ee=typeof ae=="function"||typeof u.getSnapshotBeforeUpdate=="function",k=t.pendingProps!==k,ee||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(k||K!==y)&&Rp(t,u,s,y),Na=!1;var Z=t.memoizedState;u.state=Z,Ur(t,s,u,c),Hr(),K=t.memoizedState,k||Z!==K||Na?(typeof ae=="function"&&(Ec(t,l,ae,s),K=t.memoizedState),(H=Na||Tp(t,l,H,s,Z,K,y))?(ee||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=K),u.props=s,u.state=K,u.context=y,s=H):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,lc(e,t),y=t.memoizedProps,ee=dl(l,y),u.props=ee,ae=t.pendingProps,Z=u.context,K=l.contextType,H=Ll,typeof K=="object"&&K!==null&&(H=Yt(K)),k=l.getDerivedStateFromProps,(K=typeof k=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(y!==ae||Z!==H)&&Rp(t,u,s,H),Na=!1,Z=t.memoizedState,u.state=Z,Ur(t,s,u,c),Hr();var J=t.memoizedState;y!==ae||Z!==J||Na||e!==null&&e.dependencies!==null&&Ks(e.dependencies)?(typeof k=="function"&&(Ec(t,l,k,s),J=t.memoizedState),(ee=Na||Tp(t,l,ee,s,Z,J,H)||e!==null&&e.dependencies!==null&&Ks(e.dependencies))?(K||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,J,H),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,J,H)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=J),u.props=s,u.state=J,u.context=H,s=ee):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,di(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=cl(t,e.child,null,c),t.child=cl(t,null,l,c)):Kt(e,t,l,c),t.memoizedState=u.state,e=t.child):e=ia(e,t,c),e}function qp(e,t,l,s){return al(),t.flags|=256,Kt(e,t,l,s),t.child}var zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Dc(e){return{baseLanes:e,cachePool:Df()}}function Lc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=xn),e}function Yp(e,t,l){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,y;if((y=u)||(y=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(We){if(c?Ta(t):Ra(),(e=ft)?(e=Jm(e,An),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ja!==null?{id:Gn,overflow:qn}:null,retryLane:536870912,hydrationErrors:null},l=wf(e),l.return=t,t.child=l,qt=t,ft=null)):e=null,e===null)throw ka(t);return xu(e)?t.lanes=32:t.lanes=536870912,null}var k=s.children;return s=s.fallback,c?(Ra(),c=t.mode,k=fi({mode:"hidden",children:k},c),s=nl(s,c,l,null),k.return=t,s.return=t,k.sibling=s,t.child=k,s=t.child,s.memoizedState=Dc(l),s.childLanes=Lc(e,y,l),t.memoizedState=zc,qr(null,s)):(Ta(t),_c(t,k))}var H=e.memoizedState;if(H!==null&&(k=H.dehydrated,k!==null)){if(u)t.flags&256?(Ta(t),t.flags&=-257,t=Oc(e,t,l)):t.memoizedState!==null?(Ra(),t.child=e.child,t.flags|=128,t=null):(Ra(),k=s.fallback,c=t.mode,s=fi({mode:"visible",children:s.children},c),k=nl(k,c,l,null),k.flags|=2,s.return=t,k.return=t,s.sibling=k,t.child=s,cl(t,e.child,null,l),s=t.child,s.memoizedState=Dc(l),s.childLanes=Lc(e,y,l),t.memoizedState=zc,t=qr(null,s));else if(Ta(t),xu(k)){if(y=k.nextSibling&&k.nextSibling.dataset,y)var K=y.dgst;y=K,s=Error(o(419)),s.stack="",s.digest=y,zr({value:s,source:null,stack:null}),t=Oc(e,t,l)}else if(zt||Hl(e,t,l,!1),y=(l&e.childLanes)!==0,zt||y){if(y=ut,y!==null&&(s=Ad(y,l),s!==0&&s!==H.retryLane))throw H.retryLane=s,tl(e,s),un(y,e,s),Ac;hu(k)||ji(),t=Oc(e,t,l)}else hu(k)?(t.flags|=192,t.child=e.child,t=null):(e=H.treeContext,ft=zn(k.nextSibling),qt=t,We=!0,Sa=null,An=!1,e!==null&&Ef(t,e),t=_c(t,s.children),t.flags|=4096);return t}return c?(Ra(),k=s.fallback,c=t.mode,H=e.child,K=H.sibling,s=ta(H,{mode:"hidden",children:s.children}),s.subtreeFlags=H.subtreeFlags&65011712,K!==null?k=ta(K,k):(k=nl(k,c,l,null),k.flags|=2),k.return=t,s.return=t,s.sibling=k,t.child=s,qr(null,s),s=t.child,k=e.child.memoizedState,k===null?k=Dc(l):(c=k.cachePool,c!==null?(H=At._currentValue,c=c.parent!==H?{parent:H,pool:H}:c):c=Df(),k={baseLanes:k.baseLanes|l,cachePool:c}),s.memoizedState=k,s.childLanes=Lc(e,y,l),t.memoizedState=zc,qr(e.child,s)):(Ta(t),l=e.child,e=l.sibling,l=ta(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=l,t.memoizedState=null,l)}function _c(e,t){return t=fi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function fi(e,t){return e=fn(22,e,null,t),e.lanes=0,e}function Oc(e,t,l){return cl(t,e.child,null,l),e=_c(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Kp(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Zo(e.return,t,l)}function Bc(e,t,l,s,c,u){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:u}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=s,y.tail=l,y.tailMode=c,y.treeForkCount=u)}function Wp(e,t,l){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var y=Et.current,k=(y&2)!==0;if(k?(y=y&1|2,t.flags|=128):y&=1,re(Et,y),Kt(e,t,s,l),s=We?Mr:0,!k&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Kp(e,l,t);else if(e.tag===19)Kp(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(l=t.child,c=null;l!==null;)e=l.alternate,e!==null&&ei(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),Bc(t,!1,c,l,u,s);break;case"backwards":case"unstable_legacy-backwards":for(l=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&ei(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}Bc(t,!0,l,null,u,s);break;case"together":Bc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ia(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),za|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Hl(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=ta(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=ta(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function Hc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Ks(e)))}function fg(e,t,l){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),wa(t,At,e.memoizedState.cache),al();break;case 27:case 5:$e(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:wa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,cc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ta(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Yp(e,t,l):(Ta(t),e=ia(e,t,l),e!==null?e.sibling:null);Ta(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Hl(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return Wp(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),re(Et,Et.current),s)break;return null;case 22:return t.lanes=0,Up(e,t,l,t.pendingProps);case 24:wa(t,At,e.memoizedState.cache)}return ia(e,t,l)}function Qp(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)zt=!0;else{if(!Hc(e,l)&&(t.flags&128)===0)return zt=!1,fg(e,t,l);zt=(e.flags&131072)!==0}else zt=!1,We&&(t.flags&1048576)!==0&&Cf(t,Mr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=il(t.elementType),t.type=e,typeof e=="function")Go(e)?(s=dl(e,s),t.tag=1,t=Gp(null,t,e,s,l)):(t.tag=0,t=Mc(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===I){t.tag=11,t=Op(null,t,e,s,l);break e}else if(c===w){t.tag=14,t=Bp(null,t,e,s,l);break e}}throw t=F(e)||e,Error(o(306,t,""))}}return t;case 0:return Mc(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=dl(s,t.pendingProps),Gp(e,t,s,c,l);case 3:e:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,lc(e,t),Ur(t,s,null,l);var y=t.memoizedState;if(s=y.cache,wa(t,At,s),s!==u.cache&&Po(t,[At],l,!0),Hr(),s=y.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=qp(e,t,s,l);break e}else if(s!==c){c=En(Error(o(424)),t),zr(c),t=qp(e,t,s,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ft=zn(e.firstChild),qt=t,We=!0,Sa=null,An=!0,l=Uf(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(al(),s===c){t=ia(e,t,l);break e}Kt(e,t,s,l)}t=t.child}return t;case 26:return di(e,t),e===null?(l=rh(t.type,null,t.pendingProps,null))?t.memoizedState=l:We||(l=t.type,e=t.pendingProps,s=Ti(me.current).createElement(l),s[Gt]=t,s[an]=e,Wt(s,l,e),Ut(s),t.stateNode=s):t.memoizedState=rh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return $e(t),e===null&&We&&(s=t.stateNode=nh(t.type,t.pendingProps,me.current),qt=t,An=!0,c=ft,Ba(t.type)?(vu=c,ft=zn(s.firstChild)):ft=c),Kt(e,t,t.pendingProps.children,l),di(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&We&&((c=s=ft)&&(s=$g(s,t.type,t.pendingProps,An),s!==null?(t.stateNode=s,qt=t,ft=zn(s.firstChild),An=!1,c=!0):c=!1),c||ka(t)),$e(t),c=t.type,u=t.pendingProps,y=e!==null?e.memoizedProps:null,s=u.children,fu(c,u)?s=null:y!==null&&fu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=dc(e,t,ag,null,null,l),rs._currentValue=c),di(e,t),Kt(e,t,s,l),t.child;case 6:return e===null&&We&&((e=l=ft)&&(l=Gg(l,t.pendingProps,An),l!==null?(t.stateNode=l,qt=t,ft=null,e=!0):e=!1),e||ka(t)),null;case 13:return Yp(e,t,l);case 4:return ie(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=cl(t,null,s,l):Kt(e,t,s,l),t.child;case 11:return Op(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 s=t.pendingProps,wa(t,t.type,s.value),Kt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,rl(t),c=Yt(c),s=s(c),t.flags|=1,Kt(e,t,s,l),t.child;case 14:return Bp(e,t,t.type,t.pendingProps,l);case 15:return Hp(e,t,t.type,t.pendingProps,l);case 19:return Wp(e,t,l);case 31:return dg(e,t,l);case 22:return Up(e,t,l,t.pendingProps);case 24:return rl(t),s=Yt(At),e===null?(c=tc(),c===null&&(c=ut,u=Jo(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=l),c=u),t.memoizedState={parent:s,cache:c},ac(t),wa(t,At,c)):((e.lanes&l)!==0&&(lc(e,t),Ur(t,null,null,l),Hr()),c=e.memoizedState,u=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),wa(t,At,s)):(s=u.cache,wa(t,At,s),s!==c.cache&&Po(t,[At],l,!0))),Kt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function oa(e){e.flags|=4}function Uc(e,t,l,s,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(jm())e.flags|=8192;else throw ol=Fs,nc}else e.flags&=-16777217}function Xp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!uh(t))if(jm())e.flags|=8192;else throw ol=Fs,nc}function pi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ed():536870912,e.lanes|=t,Fl|=t)}function Yr(e,t){if(!We)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var s=null;l!==null;)l.alternate!==null&&(s=l),l=l.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function pt(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,s=0;if(t)for(var c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags&65011712,s|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)l|=c.lanes|c.childLanes,s|=c.subtreeFlags,s|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=s,e.childLanes=l,t}function pg(e,t,l){var s=t.pendingProps;switch(Wo(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(t),null;case 1:return pt(t),null;case 3:return l=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),la(At),je(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Bl(t)?oa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Xo())),pt(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(oa(t),u!==null?(pt(t),Xp(t,u)):(pt(t),Uc(t,c,null,s,l))):u?u!==e.memoizedState?(oa(t),pt(t),Xp(t,u)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&oa(t),pt(t),Uc(t,c,e,s,l)),null;case 27:if(Be(t),l=me.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&oa(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=de.current,Bl(t)?Tf(t):(e=nh(c,s,l),t.stateNode=e,oa(t))}return pt(t),null;case 5:if(Be(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&oa(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(u=de.current,Bl(t))Tf(t);else{var y=Ti(me.current);switch(u){case 1:u=y.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=y.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=y.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=y.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?y.createElement("select",{is:s.is}):y.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?y.createElement(c,{is:s.is}):y.createElement(c)}}u[Gt]=t,u[an]=s;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)u.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=u;e:switch(Wt(u,c,s),c){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&oa(t)}}return pt(t),Uc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&oa(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=me.current,Bl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=qt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||Ym(e.nodeValue,l)),e||ka(t,!0)}else e=Ti(e).createTextNode(s),e[Gt]=t,t.stateNode=e}return pt(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(s=Bl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(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(o(558))}return pt(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=Bl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else al(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=Xo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(mn(t),t):(mn(t),null)}return mn(t),(t.flags&128)!==0?(t.lanes=l,t):(l=s!==null,e=e!==null&&e.memoizedState!==null,l&&(s=t.child,c=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(c=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),pi(t,t.updateQueue),pt(t),null);case 4:return je(),e===null&&iu(t.stateNode.containerInfo),pt(t),null;case 10:return la(t.type),pt(t),null;case 19:if(X(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)Yr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=ei(e),u!==null){for(t.flags|=128,Yr(s,!1),e=u.updateQueue,t.updateQueue=e,pi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)kf(l,e),l=l.sibling;return re(Et,Et.current&1|2),We&&na(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>yi&&(t.flags|=128,c=!0,Yr(s,!1),t.lanes=4194304)}else{if(!c)if(e=ei(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,pi(t,e),Yr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!We)return pt(t),null}else 2*tt()-s.renderingStartTime>yi&&l!==536870912&&(t.flags|=128,c=!0,Yr(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,l=Et.current,re(Et,c?l&1|2:l&1),We&&na(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return mn(t),oc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(l&536870912)!==0&&(t.flags&128)===0&&(pt(t),t.subtreeFlags&6&&(t.flags|=8192)):pt(t),l=t.updateQueue,l!==null&&pi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&X(sl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),la(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function mg(e,t){switch(Wo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return la(At),je(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Be(t),null;case 31:if(t.memoizedState!==null){if(mn(t),t.alternate===null)throw Error(o(340));al()}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(o(340));al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return X(Et),null;case 4:return je(),null;case 10:return la(t.type),null;case 22:case 23:return mn(t),oc(),e!==null&&X(sl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return la(At),null;case 25:return null;default:return null}}function Fp(e,t){switch(Wo(t),t.tag){case 3:la(At),je();break;case 26:case 27:case 5:Be(t);break;case 4:je();break;case 31:t.memoizedState!==null&&mn(t);break;case 13:mn(t);break;case 19:X(Et);break;case 10:la(t.type);break;case 22:case 23:mn(t),oc(),e!==null&&X(sl);break;case 24:la(At)}}function Kr(e,t){try{var l=t.updateQueue,s=l!==null?l.lastEffect:null;if(s!==null){var c=s.next;l=c;do{if((l.tag&e)===e){s=void 0;var u=l.create,y=l.inst;s=u(),y.destroy=s}l=l.next}while(l!==c)}}catch(k){lt(t,t.return,k)}}function Aa(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var u=c.next;s=u;do{if((s.tag&e)===e){var y=s.inst,k=y.destroy;if(k!==void 0){y.destroy=void 0,c=t;var H=l,K=k;try{K()}catch(ee){lt(c,H,ee)}}}s=s.next}while(s!==u)}}catch(ee){lt(t,t.return,ee)}}function Zp(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Vf(t,l)}catch(s){lt(e,e.return,s)}}}function Pp(e,t,l){l.props=dl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(s){lt(e,t,s)}}function Wr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof l=="function"?e.refCleanup=l(s):l.current=s}}catch(c){lt(e,t,c)}}function Yn(e,t){var l=e.ref,s=e.refCleanup;if(l!==null)if(typeof s=="function")try{s()}catch(c){lt(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(c){lt(e,t,c)}else l.current=null}function Jp(e){var t=e.type,l=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&s.focus();break e;case"img":l.src?s.src=l.src:l.srcSet&&(s.srcset=l.srcSet)}}catch(c){lt(e,e.return,c)}}function Ic(e,t,l){try{var s=e.stateNode;Og(s,e.type,l,t),s[an]=t}catch(c){lt(e,e.return,c)}}function em(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ba(e.type)||e.tag===4}function Vc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||em(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&&Ba(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 $c(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Jn));else if(s!==4&&(s===27&&Ba(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,l),e=e.sibling;e!==null;)$c(e,t,l),e=e.sibling}function mi(e,t,l){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(s!==4&&(s===27&&Ba(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(mi(e,t,l),e=e.sibling;e!==null;)mi(e,t,l),e=e.sibling}function tm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Wt(t,s,l),t[Gt]=e,t[an]=l}catch(u){lt(e,e.return,u)}}var ca=!1,Dt=!1,Gc=!1,nm=typeof WeakSet=="function"?WeakSet:Set,It=null;function hg(e,t){if(e=e.containerInfo,uu=_i,e=mf(e),Oo(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var s=l.getSelection&&l.getSelection();if(s&&s.rangeCount!==0){l=s.anchorNode;var c=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break e}var y=0,k=-1,H=-1,K=0,ee=0,ae=e,Z=null;t:for(;;){for(var J;ae!==l||c!==0&&ae.nodeType!==3||(k=y+c),ae!==u||s!==0&&ae.nodeType!==3||(H=y+s),ae.nodeType===3&&(y+=ae.nodeValue.length),(J=ae.firstChild)!==null;)Z=ae,ae=J;for(;;){if(ae===e)break t;if(Z===l&&++K===c&&(k=y),Z===u&&++ee===s&&(H=y),(J=ae.nextSibling)!==null)break;ae=Z,Z=ae.parentNode}ae=J}l=k===-1||H===-1?null:{start:k,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(du={focusedElem:e,selectionRange:l},_i=!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++)c=e[l],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,l=t,c=u.memoizedProps,u=u.memoizedState,s=l.stateNode;try{var be=dl(l.type,c);e=s.getSnapshotBeforeUpdate(be,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(Te){lt(l,l.return,Te)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)mu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":mu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,It=e;break}It=t.return}}function am(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:da(e,l),s&4&&Kr(5,l);break;case 1:if(da(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(y){lt(l,l.return,y)}else{var c=dl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){lt(l,l.return,y)}}s&64&&Zp(l),s&512&&Wr(l,l.return);break;case 3:if(da(e,l),s&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Vf(e,t)}catch(y){lt(l,l.return,y)}}break;case 27:t===null&&s&4&&tm(l);case 26:case 5:da(e,l),t===null&&s&4&&Jp(l),s&512&&Wr(l,l.return);break;case 12:da(e,l);break;case 31:da(e,l),s&4&&sm(e,l);break;case 13:da(e,l),s&4&&im(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=wg.bind(null,l),qg(e,l))));break;case 22:if(s=l.memoizedState!==null||ca,!s){t=t!==null&&t.memoizedState!==null||Dt,c=ca;var u=Dt;ca=s,(Dt=t)&&!u?fa(e,l,(l.subtreeFlags&8772)!==0):da(e,l),ca=c,Dt=u}break;case 30:break;default:da(e,l)}}function lm(e){var t=e.alternate;t!==null&&(e.alternate=null,lm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&go(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 ua(e,t,l){for(l=l.child;l!==null;)rm(e,t,l),l=l.sibling}function rm(e,t,l){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(Fn,l)}catch{}switch(l.tag){case 26:Dt||Yn(l,t),ua(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Dt||Yn(l,t);var s=vt,c=rn;Ba(l.type)&&(vt=l.stateNode,rn=!1),ua(e,t,l),ns(l.stateNode),vt=s,rn=c;break;case 5:Dt||Yn(l,t);case 6:if(s=vt,c=rn,vt=null,ua(e,t,l),vt=s,rn=c,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,Zm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),lr(e)):Zm(vt,l.stateNode));break;case 4:s=vt,c=rn,vt=l.stateNode.containerInfo,rn=!0,ua(e,t,l),vt=s,rn=c;break;case 0:case 11:case 14:case 15:Aa(2,l,t),Dt||Aa(4,l,t),ua(e,t,l);break;case 1:Dt||(Yn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&Pp(l,t,s)),ua(e,t,l);break;case 21:ua(e,t,l);break;case 22:Dt=(s=Dt)||l.memoizedState!==null,ua(e,t,l),Dt=s;break;default:ua(e,t,l)}}function sm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{lr(e)}catch(l){lt(t,t.return,l)}}}function im(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{lr(e)}catch(l){lt(t,t.return,l)}}function xg(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new nm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new nm),t;default:throw Error(o(435,e.tag))}}function hi(e,t){var l=xg(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=Ng.bind(null,e,s);s.then(c,c)}})}function sn(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],u=e,y=t,k=y;e:for(;k!==null;){switch(k.tag){case 27:if(Ba(k.type)){vt=k.stateNode,rn=!1;break e}break;case 5:vt=k.stateNode,rn=!1;break e;case 3:case 4:vt=k.stateNode.containerInfo,rn=!0;break e}k=k.return}if(vt===null)throw Error(o(160));rm(u,y,c),vt=null,rn=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)om(t,e),t=t.sibling}var Un=null;function om(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:sn(t,e),on(e),s&4&&(Aa(3,e,e.return),Kr(3,e),Aa(5,e,e.return));break;case 1:sn(t,e),on(e),s&512&&(Dt||l===null||Yn(l,l.return)),s&64&&ca&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=Un;if(sn(t,e),on(e),s&512&&(Dt||l===null||Yn(l,l.return)),s&4){var u=l!==null?l.memoizedState:null;if(s=e.memoizedState,l===null)if(s===null)if(e.stateNode===null){e:{s=e.type,l=e.memoizedProps,c=c.ownerDocument||c;t:switch(s){case"title":u=c.getElementsByTagName("title")[0],(!u||u[br]||u[Gt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),Wt(u,s,l),u[Gt]=e,Ut(u),s=u;break e;case"link":var y=oh("link","href",c).get(s+(l.href||""));if(y){for(var k=0;k<y.length;k++)if(u=y[k],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)){y.splice(k,1);break t}}u=c.createElement(s),Wt(u,s,l),c.head.appendChild(u);break;case"meta":if(y=oh("meta","content",c).get(s+(l.content||""))){for(k=0;k<y.length;k++)if(u=y[k],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)){y.splice(k,1);break t}}u=c.createElement(s),Wt(u,s,l),c.head.appendChild(u);break;default:throw Error(o(468,s))}u[Gt]=e,Ut(u),s=u}e.stateNode=s}else ch(c,e.type,e.stateNode);else e.stateNode=ih(c,s,e.memoizedProps);else u!==s?(u===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):u.count--,s===null?ch(c,e.type,e.stateNode):ih(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Ic(e,e.memoizedProps,l.memoizedProps)}break;case 27:sn(t,e),on(e),s&512&&(Dt||l===null||Yn(l,l.return)),l!==null&&s&4&&Ic(e,e.memoizedProps,l.memoizedProps);break;case 5:if(sn(t,e),on(e),s&512&&(Dt||l===null||Yn(l,l.return)),e.flags&32){c=e.stateNode;try{El(c,"")}catch(be){lt(e,e.return,be)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,Ic(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Gc=!0);break;case 6:if(sn(t,e),on(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(be){lt(e,e.return,be)}}break;case 3:if(Mi=null,c=Un,Un=Ri(t.containerInfo),sn(t,e),Un=c,on(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{lr(t.containerInfo)}catch(be){lt(e,e.return,be)}Gc&&(Gc=!1,cm(e));break;case 4:s=Un,Un=Ri(e.stateNode.containerInfo),sn(t,e),on(e),Un=s;break;case 12:sn(t,e),on(e);break;case 31:sn(t,e),on(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,hi(e,s)));break;case 13:sn(t,e),on(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(vi=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,hi(e,s)));break;case 22:c=e.memoizedState!==null;var H=l!==null&&l.memoizedState!==null,K=ca,ee=Dt;if(ca=K||c,Dt=ee||H,sn(t,e),Dt=ee,ca=K,on(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||H||ca||Dt||fl(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){H=l=t;try{if(u=H.stateNode,c)y=u.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{k=H.stateNode;var ae=H.memoizedProps.style,Z=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;k.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(be){lt(H,H.return,be)}}}else if(t.tag===6){if(l===null){H=t;try{H.stateNode.nodeValue=c?"":H.memoizedProps}catch(be){lt(H,H.return,be)}}}else if(t.tag===18){if(l===null){H=t;try{var J=H.stateNode;c?Pm(J,!0):Pm(H.stateNode,!1)}catch(be){lt(H,H.return,be)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,hi(e,l))));break;case 19:sn(t,e),on(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,hi(e,s)));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,s=e.return;s!==null;){if(em(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,u=Vc(e);mi(e,u,c);break;case 5:var y=l.stateNode;l.flags&32&&(El(y,""),l.flags&=-33);var k=Vc(e);mi(e,k,y);break;case 3:case 4:var H=l.stateNode.containerInfo,K=Vc(e);$c(e,K,H);break;default:throw Error(o(161))}}catch(ee){lt(e,e.return,ee)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function cm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;cm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function da(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)am(e,t.alternate,t),t=t.sibling}function fl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Aa(4,t,t.return),fl(t);break;case 1:Yn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Pp(t,t.return,l),fl(t);break;case 27:ns(t.stateNode);case 26:case 5:Yn(t,t.return),fl(t);break;case 22:t.memoizedState===null&&fl(t);break;case 30:fl(t);break;default:fl(t)}e=e.sibling}}function fa(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,y=u.flags;switch(u.tag){case 0:case 11:case 15:fa(c,u,l),Kr(4,u);break;case 1:if(fa(c,u,l),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(K){lt(s,s.return,K)}if(s=u,c=s.updateQueue,c!==null){var k=s.stateNode;try{var H=c.shared.hiddenCallbacks;if(H!==null)for(c.shared.hiddenCallbacks=null,c=0;c<H.length;c++)If(H[c],k)}catch(K){lt(s,s.return,K)}}l&&y&64&&Zp(u),Wr(u,u.return);break;case 27:tm(u);case 26:case 5:fa(c,u,l),l&&s===null&&y&4&&Jp(u),Wr(u,u.return);break;case 12:fa(c,u,l);break;case 31:fa(c,u,l),l&&y&4&&sm(c,u);break;case 13:fa(c,u,l),l&&y&4&&im(c,u);break;case 22:u.memoizedState===null&&fa(c,u,l),Wr(u,u.return);break;case 30:break;default:fa(c,u,l)}t=t.sibling}}function qc(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&&Dr(l))}function Yc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Dr(e))}function In(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)um(e,t,l,s),t=t.sibling}function um(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:In(e,t,l,s),c&2048&&Kr(9,t);break;case 1:In(e,t,l,s);break;case 3:In(e,t,l,s),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Dr(e)));break;case 12:if(c&2048){In(e,t,l,s),e=t.stateNode;try{var u=t.memoizedProps,y=u.id,k=u.onPostCommit;typeof k=="function"&&k(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(H){lt(t,t.return,H)}}else In(e,t,l,s);break;case 31:In(e,t,l,s);break;case 13:In(e,t,l,s);break;case 23:break;case 22:u=t.stateNode,y=t.alternate,t.memoizedState!==null?u._visibility&2?In(e,t,l,s):Qr(e,t):u._visibility&2?In(e,t,l,s):(u._visibility|=2,Wl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&qc(y,t);break;case 24:In(e,t,l,s),c&2048&&Yc(t.alternate,t);break;default:In(e,t,l,s)}}function Wl(e,t,l,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,y=t,k=l,H=s,K=y.flags;switch(y.tag){case 0:case 11:case 15:Wl(u,y,k,H,c),Kr(8,y);break;case 23:break;case 22:var ee=y.stateNode;y.memoizedState!==null?ee._visibility&2?Wl(u,y,k,H,c):Qr(u,y):(ee._visibility|=2,Wl(u,y,k,H,c)),c&&K&2048&&qc(y.alternate,y);break;case 24:Wl(u,y,k,H,c),c&&K&2048&&Yc(y.alternate,y);break;default:Wl(u,y,k,H,c)}t=t.sibling}}function Qr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,s=t,c=s.flags;switch(s.tag){case 22:Qr(l,s),c&2048&&qc(s.alternate,s);break;case 24:Qr(l,s),c&2048&&Yc(s.alternate,s);break;default:Qr(l,s)}t=t.sibling}}var Xr=8192;function Ql(e,t,l){if(e.subtreeFlags&Xr)for(e=e.child;e!==null;)dm(e,t,l),e=e.sibling}function dm(e,t,l){switch(e.tag){case 26:Ql(e,t,l),e.flags&Xr&&e.memoizedState!==null&&n1(l,Un,e.memoizedState,e.memoizedProps);break;case 5:Ql(e,t,l);break;case 3:case 4:var s=Un;Un=Ri(e.stateNode.containerInfo),Ql(e,t,l),Un=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Xr,Xr=16777216,Ql(e,t,l),Xr=s):Ql(e,t,l));break;default:Ql(e,t,l)}}function fm(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 Fr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];It=s,mm(s,e)}fm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)pm(e),e=e.sibling}function pm(e){switch(e.tag){case 0:case 11:case 15:Fr(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:Fr(e);break;case 12:Fr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,xi(e)):Fr(e);break;default:Fr(e)}}function xi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var s=t[l];It=s,mm(s,e)}fm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Aa(8,t,t.return),xi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,xi(t));break;default:xi(t)}e=e.sibling}}function mm(e,t){for(;It!==null;){var l=It;switch(l.tag){case 0:case 11:case 15:Aa(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Dr(l.memoizedState.cache)}if(s=l.child,s!==null)s.return=l,It=s;else e:for(l=e;It!==null;){s=It;var c=s.sibling,u=s.return;if(lm(s),s===l){It=null;break e}if(c!==null){c.return=u,It=c;break e}It=u}}}var vg={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}},yg=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,Ge=null,Ye=0,at=0,hn=null,Ma=!1,Xl=!1,Kc=!1,pa=0,wt=0,za=0,pl=0,Wc=0,xn=0,Fl=0,Zr=null,cn=null,Qc=!1,vi=0,hm=0,yi=1/0,gi=null,Da=null,_t=0,La=null,Zl=null,ma=0,Xc=0,Fc=null,xm=null,Pr=0,Zc=null;function vn(){return(Je&2)!==0&&Ye!==0?Ye&-Ye:T.T!==null?au():Md()}function vm(){if(xn===0)if((Ye&536870912)===0||We){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===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(Pl(e,0),_a(e,Ye,xn,!1)),gr(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(pl|=l),wt===4&&_a(e,Ye,xn,!1)),Kn(e))}function ym(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||kn(e,t),c=s?jg(e,t):Jc(e,t,!0),u=s;do{if(c===0){Xl&&!s&&_a(e,t,0,!1);break}else{if(l=e.current.alternate,u&&!gg(l)){c=Jc(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var k=e;c=Zr;var H=k.current.memoizedState.isDehydrated;if(H&&(Pl(k,y).flags|=256),y=Jc(k,y,!1),y!==2){if(Kc&&!H){k.errorRecoveryDisabledLanes|=u,pl|=u,c=4;break e}u=cn,cn=c,u!==null&&(cn===null?cn=u:cn.push.apply(cn,u))}c=y}if(u=!1,c!==2)continue}}if(c===1){Pl(e,0),_a(e,t,0,!0);break}e:{switch(s=e,u=c,u){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:_a(s,t,xn,!Ma);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=vi+300-tt(),10<c)){if(_a(s,t,xn,!Ma),yr(s,0,!0)!==0)break e;ma=t,s.timeoutHandle=Xm(gm.bind(null,s,l,cn,gi,Qc,t,xn,pl,Fl,Ma,u,"Throttled",-0,0),c);break e}gm(s,l,cn,gi,Qc,t,xn,pl,Fl,Ma,u,null,-0,0)}}break}while(!0);Kn(e)}function gm(e,t,l,s,c,u,y,k,H,K,ee,ae,Z,J){if(e.timeoutHandle=-1,ae=t.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},dm(t,u,ae);var be=(u&62914560)===u?vi-tt():(u&4194048)===u?hm-tt():0;if(be=a1(ae,be),be!==null){ma=u,e.cancelPendingCommit=be(Em.bind(null,e,t,u,l,s,c,y,k,H,ee,ae,null,Z,J)),_a(e,u,y,!K);return}}Em(e,t,u,l,s,c,y,k,H)}function gg(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var s=0;s<l.length;s++){var c=l[s],u=c.getSnapshot;c=c.value;try{if(!dn(u(),c))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _a(e,t,l,s){t&=~Wc,t&=~pl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-bt(c),y=1<<u;s[u]=-1,c&=~y}l!==0&&Td(e,l,t)}function bi(){return(Je&6)===0?(Jr(0),!1):!0}function Pc(){if(Ge!==null){if(at===0)var e=Ge.return;else e=Ge,aa=ll=null,mc(e),$l=null,_r=0,e=Ge;for(;e!==null;)Fp(e.alternate,e),e=e.return;Ge=null}}function Pl(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Ug(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ma=0,Pc(),ut=e,Ge=l=ta(e.current,null),Ye=t,at=0,hn=null,Ma=!1,Xl=kn(e,t),Kc=!1,Fl=xn=Wc=pl=za=wt=0,cn=Zr=null,Qc=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var c=31-bt(s),u=1<<c;t|=e[c],s&=~u}return pa=t,Vs(),l}function bm(e,t){Oe=null,T.H=Gr,t===Vl||t===Xs?(t=Of(),at=3):t===nc?(t=Of(),at=4):at=t===Ac?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,hn=t,Ge===null&&(wt=1,ci(e,En(t,e.current)))}function jm(){var e=pn.current;return e===null?!0:(Ye&4194048)===Ye?Mn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?e===Mn:!1}function Sm(){var e=T.H;return T.H=Gr,e===null?Gr:e}function km(){var e=T.A;return T.A=vg,e}function ji(){wt=4,Ma||(Ye&4194048)!==Ye&&pn.current!==null||(Xl=!0),(za&134217727)===0&&(pl&134217727)===0||ut===null||_a(ut,Ye,xn,!1)}function Jc(e,t,l){var s=Je;Je|=2;var c=Sm(),u=km();(ut!==e||Ye!==t)&&(gi=null,Pl(e,t)),t=!1;var y=wt;e:do try{if(at!==0&&Ge!==null){var k=Ge,H=hn;switch(at){case 8:Pc(),y=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(t=!0);var K=at;if(at=0,hn=null,Jl(e,k,H,K),l&&Xl){y=0;break e}break;default:K=at,at=0,hn=null,Jl(e,k,H,K)}}bg(),y=wt;break}catch(ee){bm(e,ee)}while(!0);return t&&e.shellSuspendCounter++,aa=ll=null,Je=s,T.H=c,T.A=u,Ge===null&&(ut=null,Ye=0,Vs()),y}function bg(){for(;Ge!==null;)wm(Ge)}function jg(e,t){var l=Je;Je|=2;var s=Sm(),c=km();ut!==e||Ye!==t?(gi=null,yi=tt()+500,Pl(e,t)):Xl=kn(e,t);e:do try{if(at!==0&&Ge!==null){t=Ge;var u=hn;t:switch(at){case 1:at=0,hn=null,Jl(e,t,u,1);break;case 2:case 9:if(Lf(u)){at=0,hn=null,Nm(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Kn(e)},u.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:Lf(u)?(at=0,hn=null,Nm(t)):(at=0,hn=null,Jl(e,t,u,7));break;case 5:var y=null;switch(Ge.tag){case 26:y=Ge.memoizedState;case 5:case 27:var k=Ge;if(y?uh(y):k.stateNode.complete){at=0,hn=null;var H=k.sibling;if(H!==null)Ge=H;else{var K=k.return;K!==null?(Ge=K,Si(K)):Ge=null}break t}}at=0,hn=null,Jl(e,t,u,5);break;case 6:at=0,hn=null,Jl(e,t,u,6);break;case 8:Pc(),wt=6;break e;default:throw Error(o(462))}}Sg();break}catch(ee){bm(e,ee)}while(!0);return aa=ll=null,T.H=s,T.A=c,Je=l,Ge!==null?0:(ut=null,Ye=0,Vs(),wt)}function Sg(){for(;Ge!==null&&!Vt();)wm(Ge)}function wm(e){var t=Qp(e.alternate,e,pa);e.memoizedProps=e.pendingProps,t===null?Si(e):Ge=t}function Nm(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=$p(l,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=$p(l,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:mc(t);default:Fp(l,t),t=Ge=kf(t,pa),t=Qp(l,t,pa)}e.memoizedProps=e.pendingProps,t===null?Si(e):Ge=t}function Jl(e,t,l,s){aa=ll=null,mc(t),$l=null,_r=0;var c=t.return;try{if(ug(e,c,t,l,Ye)){wt=1,ci(e,En(l,e.current)),Ge=null;return}}catch(u){if(c!==null)throw Ge=c,u;wt=1,ci(e,En(l,e.current)),Ge=null;return}t.flags&32768?(We||s===1?e=!0:Xl||(Ye&536870912)!==0?e=!1:(Ma=e=!0,(s===2||s===9||s===3||s===6)&&(s=pn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Cm(t,e)):Si(t)}function Si(e){var t=e;do{if((t.flags&32768)!==0){Cm(t,Ma);return}e=t.return;var l=pg(t.alternate,t,pa);if(l!==null){Ge=l;return}if(t=t.sibling,t!==null){Ge=t;return}Ge=t=e}while(t!==null);wt===0&&(wt=5)}function Cm(e,t){do{var l=mg(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);wt=6,Ge=null}function Em(e,t,l,s,c,u,y,k,H){e.cancelPendingCommit=null;do ki();while(_t!==0);if((Je&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(u=t.lanes|t.childLanes,u|=Vo,ty(e,l,u,y,k,H),e===ut&&(Ge=ut=null,Ye=0),Zl=t,La=e,ma=l,Xc=u,Fc=c,xm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cg(ze,function(){return zm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=T.T,T.T=null,c=B.p,B.p=2,y=Je,Je|=4;try{hg(e,t,l)}finally{Je=y,B.p=c,T.T=s}}_t=1,Tm(),Rm(),Am()}}function Tm(){if(_t===1){_t=0;var e=La,t=Zl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{om(t,e);var u=du,y=mf(e.containerInfo),k=u.focusedElem,H=u.selectionRange;if(y!==k&&k&&k.ownerDocument&&pf(k.ownerDocument.documentElement,k)){if(H!==null&&Oo(k)){var K=H.start,ee=H.end;if(ee===void 0&&(ee=K),"selectionStart"in k)k.selectionStart=K,k.selectionEnd=Math.min(ee,k.value.length);else{var ae=k.ownerDocument||document,Z=ae&&ae.defaultView||window;if(Z.getSelection){var J=Z.getSelection(),be=k.textContent.length,Te=Math.min(H.start,be),it=H.end===void 0?Te:Math.min(H.end,be);!J.extend&&Te>it&&(y=it,it=Te,Te=y);var G=ff(k,Te),V=ff(k,it);if(G&&V&&(J.rangeCount!==1||J.anchorNode!==G.node||J.anchorOffset!==G.offset||J.focusNode!==V.node||J.focusOffset!==V.offset)){var Y=ae.createRange();Y.setStart(G.node,G.offset),J.removeAllRanges(),Te>it?(J.addRange(Y),J.extend(V.node,V.offset)):(Y.setEnd(V.node,V.offset),J.addRange(Y))}}}}for(ae=[],J=k;J=J.parentNode;)J.nodeType===1&&ae.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<ae.length;k++){var ne=ae[k];ne.element.scrollLeft=ne.left,ne.element.scrollTop=ne.top}}_i=!!uu,du=uu=null}finally{Je=c,B.p=s,T.T=l}}e.current=t,_t=2}}function Rm(){if(_t===2){_t=0;var e=La,t=Zl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{am(e,t.alternate,t)}finally{Je=c,B.p=s,T.T=l}}_t=3}}function Am(){if(_t===4||_t===3){_t=0,$t();var e=La,t=Zl,l=ma,s=xm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Zl=La=null,Mm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Da=null),vo(l),t=t.stateNode,Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(Fn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=T.T,c=B.p,B.p=2,T.T=null;try{for(var u=e.onRecoverableError,y=0;y<s.length;y++){var k=s[y];u(k.value,{componentStack:k.stack})}}finally{T.T=t,B.p=c}}(ma&3)!==0&&ki(),Kn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===Zc?Pr++:(Pr=0,Zc=e):Pr=0,Jr(0)}}function Mm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Dr(t)))}function ki(){return Tm(),Rm(),Am(),zm()}function zm(){if(_t!==5)return!1;var e=La,t=Xc;Xc=0;var l=vo(ma),s=T.T,c=B.p;try{B.p=32>l?32:l,T.T=null,l=Fc,Fc=null;var u=La,y=ma;if(_t=0,Zl=La=null,ma=0,(Je&6)!==0)throw Error(o(331));var k=Je;if(Je|=4,pm(u.current),um(u,u.current,y,l),Je=k,Jr(0,!1),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(Fn,u)}catch{}return!0}finally{B.p=c,T.T=s,Mm(e,t)}}function Dm(e,t,l){t=En(l,t),t=Rc(e.stateNode,t,2),e=Ea(e,t,2),e!==null&&(gr(e,2),Kn(e))}function lt(e,t,l){if(e.tag===3)Dm(e,e,l);else for(;t!==null;){if(t.tag===3){Dm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Da===null||!Da.has(s))){e=En(l,e),l=Lp(2),s=Ea(t,l,2),s!==null&&(_p(l,s,t,e),gr(s,2),Kn(s));break}}t=t.return}}function eu(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new yg;var c=new Set;s.set(t,c)}else c=s.get(t),c===void 0&&(c=new Set,s.set(t,c));c.has(l)||(Kc=!0,c.add(l),e=kg.bind(null,e,t,l),t.then(e,e))}function kg(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ut===e&&(Ye&l)===l&&(wt===4||wt===3&&(Ye&62914560)===Ye&&300>tt()-vi?(Je&2)===0&&Pl(e,0):Wc|=l,Fl===Ye&&(Fl=0)),Kn(e)}function Lm(e,t){t===0&&(t=Ed()),e=tl(e,t),e!==null&&(gr(e,t),Kn(e))}function wg(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Lm(e,l)}function Ng(e,t){var l=0;switch(e.tag){case 31:case 13:var s=e.stateNode,c=e.memoizedState;c!==null&&(l=c.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(o(314))}s!==null&&s.delete(t),Lm(e,l)}function Cg(e,t){return Pt(e,t)}var wi=null,er=null,tu=!1,Ni=!1,nu=!1,Oa=0;function Kn(e){e!==er&&e.next===null&&(er===null?wi=er=e:er=er.next=e),Ni=!0,tu||(tu=!0,Tg())}function Jr(e,t){if(!nu&&Ni){nu=!0;do for(var l=!1,s=wi;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var y=s.suspendedLanes,k=s.pingedLanes;u=(1<<31-bt(42|e)+1)-1,u&=c&~(y&~k),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,Hm(s,u))}else u=Ye,u=yr(s,s===ut?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||kn(s,u)||(l=!0,Hm(s,u));s=s.next}while(l);nu=!1}}function Eg(){_m()}function _m(){Ni=tu=!1;var e=0;Oa!==0&&Hg()&&(e=Oa);for(var t=tt(),l=null,s=wi;s!==null;){var c=s.next,u=Om(s,t);u===0?(s.next=null,l===null?wi=c:l.next=c,c===null&&(er=l)):(l=s,(e!==0||(u&3)!==0)&&(Ni=!0)),s=c}_t!==0&&_t!==5||Jr(e),Oa!==0&&(Oa=0)}function Om(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var y=31-bt(u),k=1<<y,H=c[y];H===-1?((k&l)===0||(k&s)!==0)&&(c[y]=mo(k,t)):H<=t&&(e.expiredLanes|=k),u&=~k}if(t=ut,l=Ye,l=yr(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,l===0||e===t&&(at===2||at===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&ct(s),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||kn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),vo(l)){case 2:case 8:l=Rt;break;case 32:l=ze;break;case 268435456:l=Qt;break;default:l=ze}return s=Bm.bind(null,e),l=Pt(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function Bm(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(ki()&&e.callbackNode!==l)return null;var s=Ye;return s=yr(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(ym(e,s,t),Om(e,tt()),e.callbackNode!=null&&e.callbackNode===l?Bm.bind(null,e):null)}function Hm(e,t){if(ki())return null;ym(e,t,!0)}function Tg(){Ig(function(){(Je&6)!==0?Pt(he,Eg):_m()})}function au(){if(Oa===0){var e=Ul;e===0&&(e=Ie,Ie<<=1,(Ie&261888)===0&&(Ie=256)),Oa=e}return Oa}function Um(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ds(""+e)}function Im(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 Rg(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var u=Um((c[an]||null).action),y=s.submitter;y&&(t=(t=y[an]||null)?Um(t.formAction):y.getAttribute("formAction"),t!==null&&(u=t,y=null));var k=new Bs("action","action",null,s,c);e.push({event:k,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Oa!==0){var H=y?Im(c,y):new FormData(c);kc(l,{pending:!0,data:H,method:c.method,action:u},null,H)}}else typeof u=="function"&&(k.preventDefault(),H=y?Im(c,y):new FormData(c),kc(l,{pending:!0,data:H,method:c.method,action:u},u,H))},currentTarget:c}]})}}for(var lu=0;lu<Io.length;lu++){var ru=Io[lu],Ag=ru.toLowerCase(),Mg=ru[0].toUpperCase()+ru.slice(1);Hn(Ag,"on"+Mg)}Hn(vf,"onAnimationEnd"),Hn(yf,"onAnimationIteration"),Hn(gf,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(Wy,"onTransitionRun"),Hn(Qy,"onTransitionStart"),Hn(Xy,"onTransitionCancel"),Hn(bf,"onTransitionEnd"),Nl("onMouseEnter",["mouseout","mouseover"]),Nl("onMouseLeave",["mouseout","mouseover"]),Nl("onPointerEnter",["pointerout","pointerover"]),Nl("onPointerLeave",["pointerout","pointerover"]),Za("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Za("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Za("onBeforeInput",["compositionend","keypress","textInput","paste"]),Za("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Za("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Za("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var es="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(" "),zg=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(es));function Vm(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var s=e[l],c=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var y=s.length-1;0<=y;y--){var k=s[y],H=k.instance,K=k.currentTarget;if(k=k.listener,H!==u&&c.isPropagationStopped())break e;u=k,c.currentTarget=K;try{u(c)}catch(ee){Is(ee)}c.currentTarget=null,u=H}else for(y=0;y<s.length;y++){if(k=s[y],H=k.instance,K=k.currentTarget,k=k.listener,H!==u&&c.isPropagationStopped())break e;u=k,c.currentTarget=K;try{u(c)}catch(ee){Is(ee)}c.currentTarget=null,u=H}}}}function qe(e,t){var l=t[yo];l===void 0&&(l=t[yo]=new Set);var s=e+"__bubble";l.has(s)||($m(t,e,2,!1),l.add(s))}function su(e,t,l){var s=0;t&&(s|=4),$m(l,e,s,t)}var Ci="_reactListening"+Math.random().toString(36).slice(2);function iu(e){if(!e[Ci]){e[Ci]=!0,Ld.forEach(function(l){l!=="selectionchange"&&(zg.has(l)||su(l,!1,e),su(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ci]||(t[Ci]=!0,su("selectionchange",!1,t))}}function $m(e,t,l,s){switch(vh(t)){case 2:var c=s1;break;case 8:c=i1;break;default:c=Su}l=c.bind(null,t,l,e),c=void 0,!Eo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),s?c!==void 0?e.addEventListener(t,l,{capture:!0,passive:c}):e.addEventListener(t,l,!0):c!==void 0?e.addEventListener(t,l,{passive:c}):e.addEventListener(t,l,!1)}function ou(e,t,l,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var y=s.tag;if(y===3||y===4){var k=s.stateNode.containerInfo;if(k===c)break;if(y===4)for(y=s.return;y!==null;){var H=y.tag;if((H===3||H===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;k!==null;){if(y=Sl(k),y===null)return;if(H=y.tag,H===5||H===6||H===26||H===27){s=u=y;continue e}k=k.parentNode}}s=s.return}Kd(function(){var K=u,ee=No(l),ae=[];e:{var Z=jf.get(e);if(Z!==void 0){var J=Bs,be=e;switch(e){case"keypress":if(_s(l)===0)break e;case"keydown":case"keyup":J=Ny;break;case"focusin":be="focus",J=Mo;break;case"focusout":be="blur",J=Mo;break;case"beforeblur":case"afterblur":J=Mo;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":J=Xd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Ty;break;case vf:case yf:case gf:J=xy;break;case bf:J=Ay;break;case"scroll":case"scrollend":J=dy;break;case"wheel":J=zy;break;case"copy":case"cut":case"paste":J=yy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Zd;break;case"toggle":case"beforetoggle":J=Ly}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),G=Te?Z!==null?Z+"Capture":null:Z;Te=[];for(var V=K,Y;V!==null;){var ne=V;if(Y=ne.stateNode,ne=ne.tag,ne!==5&&ne!==26&&ne!==27||Y===null||G===null||(ne=Sr(V,G),ne!=null&&Te.push(ts(V,ne,Y))),it)break;V=V.return}0<Te.length&&(Z=new J(Z,be,null,l,ee),ae.push({event:Z,listeners:Te}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",Z&&l!==wo&&(be=l.relatedTarget||l.fromElement)&&(Sl(be)||be[jl]))break e;if((J||Z)&&(Z=ee.window===ee?ee:(Z=ee.ownerDocument)?Z.defaultView||Z.parentWindow:window,J?(be=l.relatedTarget||l.toElement,J=K,be=be?Sl(be):null,be!==null&&(it=m(be),Te=be.tag,be!==it||Te!==5&&Te!==27&&Te!==6)&&(be=null)):(J=null,be=K),J!==be)){if(Te=Xd,ne="onMouseLeave",G="onMouseEnter",V="mouse",(e==="pointerout"||e==="pointerover")&&(Te=Zd,ne="onPointerLeave",G="onPointerEnter",V="pointer"),it=J==null?Z:jr(J),Y=be==null?Z:jr(be),Z=new Te(ne,V+"leave",J,l,ee),Z.target=it,Z.relatedTarget=Y,ne=null,Sl(ee)===K&&(Te=new Te(G,V+"enter",be,l,ee),Te.target=Y,Te.relatedTarget=it,ne=Te),it=ne,J&&be)t:{for(Te=Dg,G=J,V=be,Y=0,ne=G;ne;ne=Te(ne))Y++;ne=0;for(var Ee=V;Ee;Ee=Te(Ee))ne++;for(;0<Y-ne;)G=Te(G),Y--;for(;0<ne-Y;)V=Te(V),ne--;for(;Y--;){if(G===V||V!==null&&G===V.alternate){Te=G;break t}G=Te(G),V=Te(V)}Te=null}else Te=null;J!==null&&Gm(ae,Z,J,Te,!1),be!==null&&it!==null&&Gm(ae,it,be,Te,!0)}}e:{if(Z=K?jr(K):window,J=Z.nodeName&&Z.nodeName.toLowerCase(),J==="select"||J==="input"&&Z.type==="file")var Fe=rf;else if(af(Z))if(sf)Fe=qy;else{Fe=$y;var Se=Vy}else J=Z.nodeName,!J||J.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?K&&ko(K.elementType)&&(Fe=rf):Fe=Gy;if(Fe&&(Fe=Fe(e,K))){lf(ae,Fe,l,ee);break e}Se&&Se(e,Z,K),e==="focusout"&&K&&Z.type==="number"&&K.memoizedProps.value!=null&&So(Z,"number",Z.value)}switch(Se=K?jr(K):window,e){case"focusin":(af(Se)||Se.contentEditable==="true")&&(Ml=Se,Bo=K,Ar=null);break;case"focusout":Ar=Bo=Ml=null;break;case"mousedown":Ho=!0;break;case"contextmenu":case"mouseup":case"dragend":Ho=!1,hf(ae,l,ee);break;case"selectionchange":if(Ky)break;case"keydown":case"keyup":hf(ae,l,ee)}var He;if(Do)e:{switch(e){case"compositionstart":var Ke="onCompositionStart";break e;case"compositionend":Ke="onCompositionEnd";break e;case"compositionupdate":Ke="onCompositionUpdate";break e}Ke=void 0}else Al?tf(e,l)&&(Ke="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ke="onCompositionStart");Ke&&(Pd&&l.locale!=="ko"&&(Al||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Al&&(He=Wd()):(ba=ee,To="value"in ba?ba.value:ba.textContent,Al=!0)),Se=Ei(K,Ke),0<Se.length&&(Ke=new Fd(Ke,e,null,l,ee),ae.push({event:Ke,listeners:Se}),He?Ke.data=He:(He=nf(l),He!==null&&(Ke.data=He)))),(He=Oy?By(e,l):Hy(e,l))&&(Ke=Ei(K,"onBeforeInput"),0<Ke.length&&(Se=new Fd("onBeforeInput","beforeinput",null,l,ee),ae.push({event:Se,listeners:Ke}),Se.data=He)),Rg(ae,e,K,l,ee)}Vm(ae,t)})}function ts(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Ei(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=Sr(e,l),c!=null&&s.unshift(ts(e,c,u)),c=Sr(e,t),c!=null&&s.push(ts(e,c,u))),e.tag===3)return s;e=e.return}return[]}function Dg(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Gm(e,t,l,s,c){for(var u=t._reactName,y=[];l!==null&&l!==s;){var k=l,H=k.alternate,K=k.stateNode;if(k=k.tag,H!==null&&H===s)break;k!==5&&k!==26&&k!==27||K===null||(H=K,c?(K=Sr(l,u),K!=null&&y.unshift(ts(l,K,H))):c||(K=Sr(l,u),K!=null&&y.push(ts(l,K,H)))),l=l.return}y.length!==0&&e.push({event:t,listeners:y})}var Lg=/\r\n?/g,_g=/\u0000|\uFFFD/g;function qm(e){return(typeof e=="string"?e:""+e).replace(Lg,`
50
- `).replace(_g,"")}function Ym(e,t){return t=qm(t),qm(e)===t}function st(e,t,l,s,c,u){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||El(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&El(e,""+s);break;case"className":Ms(e,"class",s);break;case"tabIndex":Ms(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Ms(e,l,s);break;case"style":qd(e,s,u);break;case"data":if(t!=="object"){Ms(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Ds(""+s),e.setAttribute(l,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(l==="formAction"?(t!=="input"&&st(e,t,"name",c.name,c,null),st(e,t,"formEncType",c.formEncType,c,null),st(e,t,"formMethod",c.formMethod,c,null),st(e,t,"formTarget",c.formTarget,c,null)):(st(e,t,"encType",c.encType,c,null),st(e,t,"method",c.method,c,null),st(e,t,"target",c.target,c,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(l);break}s=Ds(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=Jn);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Ds(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":qe("beforetoggle",e),qe("toggle",e),As(e,"popover",s);break;case"xlinkActuate":Pn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Pn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Pn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Pn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Pn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Pn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Pn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Pn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Pn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":As(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=cy.get(l)||l,As(e,l,s))}}function cu(e,t,l,s,c,u){switch(l){case"style":qd(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?El(e,s):(typeof s=="number"||typeof s=="bigint")&&El(e,""+s);break;case"onScroll":s!=null&&qe("scroll",e);break;case"onScrollEnd":s!=null&&qe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_d.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),u=e[an]||null,u=u!=null?u[l]:null,typeof u=="function"&&e.removeEventListener(t,u,c),typeof s=="function")){typeof u!="function"&&u!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,s,c);break e}l in e?e[l]=s:s===!0?e.setAttribute(l,""):As(e,l,s)}}}function Wt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var s=!1,c=!1,u;for(u in l)if(l.hasOwnProperty(u)){var y=l[u];if(y!=null)switch(u){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,u,y,l,null)}}c&&st(e,t,"srcSet",l.srcSet,l,null),s&&st(e,t,"src",l.src,l,null);return;case"input":qe("invalid",e);var k=u=y=c=null,H=null,K=null;for(s in l)if(l.hasOwnProperty(s)){var ee=l[s];if(ee!=null)switch(s){case"name":c=ee;break;case"type":y=ee;break;case"checked":H=ee;break;case"defaultChecked":K=ee;break;case"value":u=ee;break;case"defaultValue":k=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:st(e,t,s,ee,l,null)}}Id(e,u,k,H,K,y,c,!1);return;case"select":qe("invalid",e),s=y=u=null;for(c in l)if(l.hasOwnProperty(c)&&(k=l[c],k!=null))switch(c){case"value":u=k;break;case"defaultValue":y=k;break;case"multiple":s=k;default:st(e,t,c,k,l,null)}t=u,l=y,e.multiple=!!s,t!=null?Cl(e,!!s,t,!1):l!=null&&Cl(e,!!s,l,!0);return;case"textarea":qe("invalid",e),u=c=s=null;for(y in l)if(l.hasOwnProperty(y)&&(k=l[y],k!=null))switch(y){case"value":s=k;break;case"defaultValue":c=k;break;case"children":u=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(o(91));break;default:st(e,t,y,k,l,null)}$d(e,s,c,u);return;case"option":for(H in l)if(l.hasOwnProperty(H)&&(s=l[H],s!=null))switch(H){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:st(e,t,H,s,l,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(s=0;s<es.length;s++)qe(es[s],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in l)if(l.hasOwnProperty(K)&&(s=l[K],s!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,K,s,l,null)}return;default:if(ko(t)){for(ee in l)l.hasOwnProperty(ee)&&(s=l[ee],s!==void 0&&cu(e,t,ee,s,l,void 0));return}}for(k in l)l.hasOwnProperty(k)&&(s=l[k],s!=null&&st(e,t,k,s,l,null))}function Og(e,t,l,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,y=null,k=null,H=null,K=null,ee=null;for(J in l){var ae=l[J];if(l.hasOwnProperty(J)&&ae!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":H=ae;default:s.hasOwnProperty(J)||st(e,t,J,null,s,ae)}}for(var Z in s){var J=s[Z];if(ae=l[Z],s.hasOwnProperty(Z)&&(J!=null||ae!=null))switch(Z){case"type":u=J;break;case"name":c=J;break;case"checked":K=J;break;case"defaultChecked":ee=J;break;case"value":y=J;break;case"defaultValue":k=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,t));break;default:J!==ae&&st(e,t,Z,J,s,ae)}}jo(e,y,k,H,K,ee,u,c);return;case"select":J=y=k=Z=null;for(u in l)if(H=l[u],l.hasOwnProperty(u)&&H!=null)switch(u){case"value":break;case"multiple":J=H;default:s.hasOwnProperty(u)||st(e,t,u,null,s,H)}for(c in s)if(u=s[c],H=l[c],s.hasOwnProperty(c)&&(u!=null||H!=null))switch(c){case"value":Z=u;break;case"defaultValue":k=u;break;case"multiple":y=u;default:u!==H&&st(e,t,c,u,s,H)}t=k,l=y,s=J,Z!=null?Cl(e,!!l,Z,!1):!!s!=!!l&&(t!=null?Cl(e,!!l,t,!0):Cl(e,!!l,l?[]:"",!1));return;case"textarea":J=Z=null;for(k in l)if(c=l[k],l.hasOwnProperty(k)&&c!=null&&!s.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:st(e,t,k,null,s,c)}for(y in s)if(c=s[y],u=l[y],s.hasOwnProperty(y)&&(c!=null||u!=null))switch(y){case"value":Z=c;break;case"defaultValue":J=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==u&&st(e,t,y,c,s,u)}Vd(e,Z,J);return;case"option":for(var be in l)if(Z=l[be],l.hasOwnProperty(be)&&Z!=null&&!s.hasOwnProperty(be))switch(be){case"selected":e.selected=!1;break;default:st(e,t,be,null,s,Z)}for(H in s)if(Z=s[H],J=l[H],s.hasOwnProperty(H)&&Z!==J&&(Z!=null||J!=null))switch(H){case"selected":e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:st(e,t,H,Z,s,J)}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 Te in l)Z=l[Te],l.hasOwnProperty(Te)&&Z!=null&&!s.hasOwnProperty(Te)&&st(e,t,Te,null,s,Z);for(K in s)if(Z=s[K],J=l[K],s.hasOwnProperty(K)&&Z!==J&&(Z!=null||J!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:st(e,t,K,Z,s,J)}return;default:if(ko(t)){for(var it in l)Z=l[it],l.hasOwnProperty(it)&&Z!==void 0&&!s.hasOwnProperty(it)&&cu(e,t,it,void 0,s,Z);for(ee in s)Z=s[ee],J=l[ee],!s.hasOwnProperty(ee)||Z===J||Z===void 0&&J===void 0||cu(e,t,ee,Z,s,J);return}}for(var G in l)Z=l[G],l.hasOwnProperty(G)&&Z!=null&&!s.hasOwnProperty(G)&&st(e,t,G,null,s,Z);for(ae in s)Z=s[ae],J=l[ae],!s.hasOwnProperty(ae)||Z===J||Z==null&&J==null||st(e,t,ae,Z,s,J)}function Km(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bg(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),s=0;s<l.length;s++){var c=l[s],u=c.transferSize,y=c.initiatorType,k=c.duration;if(u&&k&&Km(y)){for(y=0,k=c.responseEnd,s+=1;s<l.length;s++){var H=l[s],K=H.startTime;if(K>k)break;var ee=H.transferSize,ae=H.initiatorType;ee&&Km(ae)&&(H=H.responseEnd,y+=ee*(H<k?1:(k-K)/(H-K)))}if(--s,t+=8*(u+y)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var uu=null,du=null;function Ti(e){return e.nodeType===9?e:e.ownerDocument}function Wm(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 Qm(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 fu(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 pu=null;function Hg(){var e=window.event;return e&&e.type==="popstate"?e===pu?!1:(pu=e,!0):(pu=null,!1)}var Xm=typeof setTimeout=="function"?setTimeout:void 0,Ug=typeof clearTimeout=="function"?clearTimeout:void 0,Fm=typeof Promise=="function"?Promise:void 0,Ig=typeof queueMicrotask=="function"?queueMicrotask:typeof Fm<"u"?function(e){return Fm.resolve(null).then(e).catch(Vg)}:Xm;function Vg(e){setTimeout(function(){throw e})}function Ba(e){return e==="head"}function Zm(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),lr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")ns(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ns(l);for(var u=l.firstChild;u;){var y=u.nextSibling,k=u.nodeName;u[br]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&u.rel.toLowerCase()==="stylesheet"||l.removeChild(u),u=y}}else l==="body"&&ns(e.ownerDocument.body);l=c}while(l);lr(t)}function Pm(e,t){var l=e;e=0;do{var s=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),s&&s.nodeType===8)if(l=s.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=s}while(l)}function mu(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":mu(l),go(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function $g(e,t,l,s){for(;e.nodeType===1;){var c=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[br])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=zn(e.nextSibling),e===null)break}return null}function Gg(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 Jm(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 hu(e){return e.data==="$?"||e.data==="$~"}function xu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function qg(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var s=function(){t(),l.removeEventListener("DOMContentLoaded",s)};l.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function 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 vu=null;function eh(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 th(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 nh(e,t,l){switch(t=Ti(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function ns(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);go(e)}var Dn=new Map,ah=new Set;function Ri(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ha=B.d;B.d={f:Yg,r:Kg,D:Wg,C:Qg,L:Xg,m:Fg,X:Pg,S:Zg,M:Jg};function Yg(){var e=ha.f(),t=bi();return e||t}function Kg(e){var t=kl(e);t!==null&&t.tag===5&&t.type==="form"?bp(t):ha.r(e)}var tr=typeof document>"u"?null:document;function lh(e,t,l){var s=tr;if(s&&typeof t=="string"&&t){var c=Nn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),ah.has(c)||(ah.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Wt(t,"link",e),Ut(t),s.head.appendChild(t)))}}function Wg(e){ha.D(e),lh("dns-prefetch",e,null)}function Qg(e,t){ha.C(e,t),lh("preconnect",e,t)}function Xg(e,t,l){ha.L(e,t,l);var s=tr;if(s&&e&&t){var c='link[rel="preload"][as="'+Nn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(c+='[imagesrcset="'+Nn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(c+='[imagesizes="'+Nn(l.imageSizes)+'"]')):c+='[href="'+Nn(e)+'"]';var u=c;switch(t){case"style":u=nr(e);break;case"script":u=ar(e)}Dn.has(u)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Dn.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(as(u))||t==="script"&&s.querySelector(ls(u))||(t=s.createElement("link"),Wt(t,"link",e),Ut(t),s.head.appendChild(t)))}}function Fg(e,t){ha.m(e,t);var l=tr;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=ar(e)}if(!Dn.has(u)&&(e=g({rel:"modulepreload",href:e},t),Dn.set(u,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ls(u)))return}s=l.createElement("link"),Wt(s,"link",e),Ut(s),l.head.appendChild(s)}}}function Zg(e,t,l){ha.S(e,t,l);var s=tr;if(s&&e){var c=wl(s).hoistableStyles,u=nr(e);t=t||"default";var y=c.get(u);if(!y){var k={loading:0,preload:null};if(y=s.querySelector(as(u)))k.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Dn.get(u))&&yu(e,l);var H=y=s.createElement("link");Ut(H),Wt(H,"link",e),H._p=new Promise(function(K,ee){H.onload=K,H.onerror=ee}),H.addEventListener("load",function(){k.loading|=1}),H.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Ai(y,t,s)}y={type:"stylesheet",instance:y,count:1,state:k},c.set(u,y)}}}function Pg(e,t){ha.X(e,t);var l=tr;if(l&&e){var s=wl(l).hoistableScripts,c=ar(e),u=s.get(c);u||(u=l.querySelector(ls(c)),u||(e=g({src:e,async:!0},t),(t=Dn.get(c))&&gu(e,t),u=l.createElement("script"),Ut(u),Wt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function Jg(e,t){ha.M(e,t);var l=tr;if(l&&e){var s=wl(l).hoistableScripts,c=ar(e),u=s.get(c);u||(u=l.querySelector(ls(c)),u||(e=g({src:e,async:!0,type:"module"},t),(t=Dn.get(c))&&gu(e,t),u=l.createElement("script"),Ut(u),Wt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function rh(e,t,l,s){var c=(c=me.current)?Ri(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=nr(l.href),l=wl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=nr(l.href);var u=wl(c).hoistableStyles,y=u.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,y),(u=c.querySelector(as(e)))&&!u._p&&(y.instance=u,y.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||e1(c,e,l,y.state))),t&&s===null)throw Error(o(528,""));return y}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ar(l),l=wl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function nr(e){return'href="'+Nn(e)+'"'}function as(e){return'link[rel="stylesheet"]['+e+"]"}function sh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function e1(e,t,l,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Wt(t,"link",l),Ut(t),e.head.appendChild(t))}function ar(e){return'[src="'+Nn(e)+'"]'}function ls(e){return"script[async]"+e}function ih(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Nn(l.href)+'"]');if(s)return t.instance=s,Ut(s),s;var c=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Ut(s),Wt(s,"style",c),Ai(s,l.precedence,e),t.instance=s;case"stylesheet":c=nr(l.href);var u=e.querySelector(as(c));if(u)return t.state.loading|=4,t.instance=u,Ut(u),u;s=sh(l),(c=Dn.get(c))&&yu(s,c),u=(e.ownerDocument||e).createElement("link"),Ut(u);var y=u;return y._p=new Promise(function(k,H){y.onload=k,y.onerror=H}),Wt(u,"link",s),t.state.loading|=4,Ai(u,l.precedence,e),t.instance=u;case"script":return u=ar(l.src),(c=e.querySelector(ls(u)))?(t.instance=c,Ut(c),c):(s=l,(c=Dn.get(u))&&(s=g({},l),gu(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ut(c),Wt(c,"link",s),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,Ai(s,l.precedence,e));return t.instance}function Ai(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,u=c,y=0;y<s.length;y++){var k=s[y];if(k.dataset.precedence===t)u=k;else if(u!==c)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function yu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function gu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Mi=null;function oh(e,t,l){if(Mi===null){var s=new Map,c=Mi=new Map;c.set(l,s)}else c=Mi,s=c.get(l),s||(s=new Map,c.set(l,s));if(s.has(e))return s;for(s.set(e,null),l=l.getElementsByTagName(e),c=0;c<l.length;c++){var u=l[c];if(!(u[br]||u[Gt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var y=u.getAttribute(t)||"";y=e+y;var k=s.get(y);k?k.push(u):s.set(y,[u])}}return s}function ch(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function t1(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 uh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function n1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=nr(s.href),u=t.querySelector(as(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,Ut(u);return}u=t.ownerDocument||t,s=sh(s),(c=Dn.get(c))&&yu(s,c),u=u.createElement("link"),Ut(u);var y=u;y._p=new Promise(function(k,H){y.onload=k,y.onerror=H}),Wt(u,"link",s),l.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=zi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var bu=0;function a1(e,t){return e.stylesheets&&e.count===0&&Li(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Li(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&bu===0&&(bu=62500*Bg());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Li(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>bu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function zi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Li(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Di=null;function Li(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Di=new Map,t.forEach(l1,e),Di=null,zi.call(e))}function l1(e,t){if(!(t.state.loading&4)){var l=Di.get(e);if(l)var s=l.get(null);else{l=new Map,Di.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var y=c[u];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(l.set(y.dataset.precedence,y),s=y)}s&&l.set(null,s)}c=t.instance,y=c.getAttribute("data-precedence"),u=l.get(y)||s,u===s&&l.set(null,c),l.set(y,c),this.count++,s=zi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),u?u.parentNode.insertBefore(c,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var rs={$$typeof:L,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function r1(e,t,l,s,c,u,y,k,H){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ho(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ho(0),this.hiddenUpdates=ho(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function dh(e,t,l,s,c,u,y,k,H,K,ee,ae){return e=new r1(e,t,l,y,H,K,ee,ae,k),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:s,isDehydrated:l,cache:t},ac(u),e}function fh(e){return e?(e=Ll,e):Ll}function ph(e,t,l,s,c,u){c=fh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ca(t),s.payload={element:l},u=u===void 0?null:u,u!==null&&(s.callback=u),l=Ea(e,s,t),l!==null&&(un(l,e,t),Br(l,e,t))}function mh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ju(e,t){mh(e,t),(e=e.alternate)&&mh(e,t)}function hh(e){if(e.tag===13||e.tag===31){var t=tl(e,67108864);t!==null&&un(t,e,67108864),ju(e,67108864)}}function xh(e){if(e.tag===13||e.tag===31){var t=vn();t=xo(t);var l=tl(e,t);l!==null&&un(l,e,t),ju(e,t)}}var _i=!0;function s1(e,t,l,s){var c=T.T;T.T=null;var u=B.p;try{B.p=2,Su(e,t,l,s)}finally{B.p=u,T.T=c}}function i1(e,t,l,s){var c=T.T;T.T=null;var u=B.p;try{B.p=8,Su(e,t,l,s)}finally{B.p=u,T.T=c}}function Su(e,t,l,s){if(_i){var c=ku(s);if(c===null)ou(e,t,s,Oi,l),yh(e,s);else if(c1(c,e,t,l,s))s.stopPropagation();else if(yh(e,s),t&4&&-1<o1.indexOf(e)){for(;c!==null;){var u=kl(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var y=Ct(u.pendingLanes);if(y!==0){var k=u;for(k.pendingLanes|=2,k.entangledLanes|=2;y;){var H=1<<31-bt(y);k.entanglements[1]|=H,y&=~H}Kn(u),(Je&6)===0&&(yi=tt()+500,Jr(0))}}break;case 31:case 13:k=tl(u,2),k!==null&&un(k,u,2),bi(),ju(u,2)}if(u=ku(s),u===null&&ou(e,t,s,Oi,l),u===c)break;c=u}c!==null&&s.stopPropagation()}else ou(e,t,s,null,l)}}function ku(e){return e=No(e),wu(e)}var Oi=null;function wu(e){if(Oi=null,e=Sl(e),e!==null){var t=m(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=x(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 Oi=e,null}function vh(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 ze:case xt:return 32;case Qt:return 268435456;default:return 32}default:return 32}}var Nu=!1,Ha=null,Ua=null,Ia=null,ss=new Map,is=new Map,Va=[],o1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function yh(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Ia=null;break;case"pointerover":case"pointerout":ss.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":is.delete(t.pointerId)}}function os(e,t,l,s,c,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:u,targetContainers:[c]},t!==null&&(t=kl(t),t!==null&&hh(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function c1(e,t,l,s,c){switch(t){case"focusin":return Ha=os(Ha,e,t,l,s,c),!0;case"dragenter":return Ua=os(Ua,e,t,l,s,c),!0;case"mouseover":return Ia=os(Ia,e,t,l,s,c),!0;case"pointerover":var u=c.pointerId;return ss.set(u,os(ss.get(u)||null,e,t,l,s,c)),!0;case"gotpointercapture":return u=c.pointerId,is.set(u,os(is.get(u)||null,e,t,l,s,c)),!0}return!1}function gh(e){var t=Sl(e.target);if(t!==null){var l=m(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,zd(e.priority,function(){xh(l)});return}}else if(t===31){if(t=x(l),t!==null){e.blockedOn=t,zd(e.priority,function(){xh(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 Bi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=ku(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);wo=s,l.target.dispatchEvent(s),wo=null}else return t=kl(l),t!==null&&hh(t),e.blockedOn=l,!1;t.shift()}return!0}function bh(e,t,l){Bi(e)&&l.delete(t)}function u1(){Nu=!1,Ha!==null&&Bi(Ha)&&(Ha=null),Ua!==null&&Bi(Ua)&&(Ua=null),Ia!==null&&Bi(Ia)&&(Ia=null),ss.forEach(bh),is.forEach(bh)}function Hi(e,t){e.blockedOn===t&&(e.blockedOn=null,Nu||(Nu=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,u1)))}var Ui=null;function jh(e){Ui!==e&&(Ui=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Ui===e&&(Ui=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(wu(s||l)===null)continue;break}var u=kl(l);u!==null&&(e.splice(t,3),t-=3,kc(u,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function lr(e){function t(H){return Hi(H,e)}Ha!==null&&Hi(Ha,e),Ua!==null&&Hi(Ua,e),Ia!==null&&Hi(Ia,e),ss.forEach(t),is.forEach(t);for(var l=0;l<Va.length;l++){var s=Va[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Va.length&&(l=Va[0],l.blockedOn===null);)gh(l),l.blockedOn===null&&Va.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],u=l[s+1],y=c[an]||null;if(typeof u=="function")y||jh(l);else if(y){var k=null;if(u&&u.hasAttribute("formAction")){if(c=u,y=u[an]||null)k=y.formAction;else if(wu(c)!==null)continue}else k=y.action;typeof k=="function"?l[s+1]=k:(l.splice(s,3),s-=3),jh(l)}}}function Sh(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(y){return c=y})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Cu(e){this._internalRoot=e}Ii.prototype.render=Cu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=vn();ph(l,s,e,t,null,null)},Ii.prototype.unmount=Cu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ph(e.current,2,null,e,null,null),bi(),t[jl]=null}};function Ii(e){this._internalRoot=e}Ii.prototype.unstable_scheduleHydration=function(e){if(e){var t=Md();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Va.length&&t!==0&&t<Va[l].priority;l++);Va.splice(l,0,e),l===0&&gh(e)}};var kh=r.version;if(kh!=="19.2.4")throw Error(o(527,kh,"19.2.4"));B.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=p(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var d1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Vi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Vi.isDisabled&&Vi.supportsFiber)try{Fn=Vi.inject(d1),Nt=Vi}catch{}}return us.createRoot=function(e,t){if(!d(e))throw Error(o(299));var l=!1,s="",c=Ap,u=Mp,y=zp;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=dh(e,1,!1,null,null,l,s,null,c,u,y,Sh),e[jl]=t.current,iu(e),new Cu(t)},us.hydrateRoot=function(e,t,l){if(!d(e))throw Error(o(299));var s=!1,c="",u=Ap,y=Mp,k=zp,H=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(k=l.onRecoverableError),l.formState!==void 0&&(H=l.formState)),t=dh(e,1,!0,t,l??null,s,c,H,u,y,k,Sh),t.context=fh(null),l=t.current,s=vn(),s=xo(s),c=Ca(s),c.callback=null,Ea(l,c,s),l=s,t.current.lanes=l,gr(t,l),Kn(t),e[jl]=t.current,iu(e),new Ii(t)},us.version="19.2.4",us}var Dh;function b1(){if(Dh)return Ru.exports;Dh=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(r){console.error(r)}}return a(),Ru.exports=g1(),Ru.exports}var j1=b1();const S1="modulepreload",k1=function(a){return"/"+a},Lh={},ud=function(r,i,o){let d=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const x=document.querySelector("meta[property=csp-nonce]"),h=(x==null?void 0:x.nonce)||(x==null?void 0:x.getAttribute("nonce"));d=f(i.map(p=>{if(p=k1(p),p in Lh)return;Lh[p]=!0;const b=p.endsWith(".css"),g=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const j=document.createElement("link");if(j.rel=b?"stylesheet":S1,b||(j.as="script"),j.crossOrigin="",j.href=p,h&&j.setAttribute("nonce",h),document.head.appendChild(j),b)return new Promise((S,C)=>{j.addEventListener("load",S),j.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function m(f){const x=new Event("vite:preloadError",{cancelable:!0});if(x.payload=f,window.dispatchEvent(x),!x.defaultPrevented)throw f}return d.then(f=>{for(const x of f||[])x.status==="rejected"&&m(x.reason);return r().catch(m)})},sr="";class Hx extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Qe(a,r){const i=await fetch(`${sr}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new Hx(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function xa(a){return typeof a=="string"&&a.length>0?a:null}function w1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Du(a){if(!Array.isArray(a))return null;const r=a.filter(i=>typeof i=="string"&&i.length>0);return r.length>0?r:null}function N1(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));const o={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:i,description:xa(r.description),version:xa(r.version),category:xa(r.category),author:xa(r.author),license:xa(r.license),homepage:xa(r.homepage),tags:Du(r.tags),deps:Du(r.deps),mcpDeps:Du(r.mcpDeps),entryPoint:xa(r.entryPoint),lastModified:xa(r.lastModified),sizeBytes:w1(r.sizeBytes),sourceAgent:xa(r.sourceAgent)};return typeof r.updateAvailable=="boolean"&&(o.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(o.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(o.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(o.pinnedVersion=r.pinnedVersion),o}const Ce={getConfig(){return Qe("/api/config")},setConfig(a,r){return Qe("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(){const a=await Qe("/api/skills");return Array.isArray(a)?a.map(N1):[]},getSkillDetail(a,r){return Qe(`/api/skills/${a}/${r}`)},getEvals(a,r){return Qe(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Qe(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Qe(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${sr}/api/skills/${a}/${r}/benchmark/latest`);if(i.status===404)return null;if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new Hx(o.error||`HTTP ${i.status}`,i.status)}return i.json()},getHistory(a,r,i){const o=new URLSearchParams;i!=null&&i.model&&o.set("model",i.model),i!=null&&i.type&&o.set("type",i.type),i!=null&&i.from&&o.set("from",i.from),i!=null&&i.to&&o.set("to",i.to);const d=o.toString();return Qe(`/api/skills/${a}/${r}/history${d?"?"+d:""}`)},getHistoryEntry(a,r,i){return Qe(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Qe(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const d=new URLSearchParams;o&&d.set("model",o);const m=d.toString();return Qe(`/api/skills/${a}/${r}/history/case/${i}${m?"?"+m:""}`)},deleteHistoryEntry(a,r,i){return Qe(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Qe(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Qe(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Qe(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Qe(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Qe(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Qe(`/api/skills/${a}/${r}/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,r){return Qe(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Qe(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Qe(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Qe(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Qe(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${sr}/api/skills/${a}/${r}/sweep`,d=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),d},getCredentials(a,r){return Qe(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Qe(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Qe(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Qe(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Qe("/api/openrouter/models")},getSkillVersions(a,r){return Qe(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Qe(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${sr}/api/skills/batch-update`,i=new EventSource(r);return fetch(r,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:a})}),i},startSkillUpdate(a,r){const i=`${sr}/api/skills/${a}/${r}/update`,o=new EventSource(i);return fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const a=await fetch(`${sr}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}}};function C1(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const d=o.name.split("/").pop()||o.name;i.set(d,o)}return a.map(o=>{const d=i.get(o.skill);return d?{...o,updateAvailable:d.updateAvailable,currentVersion:d.installed,latestVersion:d.latest??void 0}:o})}function E1(a){const[r,i]=v.useState(()=>typeof window>"u"?!1:window.matchMedia(a).matches);return v.useEffect(()=>{const o=window.matchMedia(a);i(o.matches);const d=m=>i(m.matches);return o.addEventListener("change",d),()=>o.removeEventListener("change",d)},[a]),r}const T1=3e5,R1=500,A1=15e3,M1=6e4;function z1(a){const r=new Map;for(const i of a){const o=i.name.split("/").pop()||i.name;r.set(o,i)}return r}function D1(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function L1(a){a()}function _1(a){const r=T1,i=R1,o=A1,d=M1,[m,f]=v.useState([]),[x,h]=v.useState(()=>new Map),[p,b]=v.useState(0),[g,j]=v.useState(!1),[S,C]=v.useState(null),[A,E]=v.useState(null),N=v.useRef(null),R=v.useRef(null),L=v.useRef(null),I=v.useRef(null),O=v.useRef(!0),$=v.useCallback(async()=>{j(!0);const U=new AbortController,q=setTimeout(()=>U.abort(),o);try{const W=await Promise.race([Ce.getSkillUpdates(),new Promise((P,F)=>{U.signal.addEventListener("abort",()=>{F(new Error("TIMEOUT"))})})]);if(W==="TIMEOUT")throw new Error("TIMEOUT");if(!O.current)return;f(W),h(z1(W)),b(D1(W)),R.current=Date.now(),C(R.current),E(null)}catch(W){if(!O.current)return;E(W instanceof Error?W:new Error(String(W)))}finally{clearTimeout(q),O.current&&j(!1)}},[o]),w=v.useCallback(()=>{if(N.current)return N.current;const U=$().finally(()=>{N.current=null});return N.current=U,U},[$]),D=v.useCallback(()=>{L.current==null&&(L.current=setInterval(()=>{w()},r))},[r,w]),M=v.useCallback(()=>{L.current!=null&&(clearInterval(L.current),L.current=null)},[]);return v.useEffect(()=>{O.current=!0,(R.current==null||Date.now()-R.current>d)&&L1(()=>void w()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const W=()=>{if(I.current&&(clearTimeout(I.current),I.current=null),document.visibilityState==="hidden"){M();return}I.current=setTimeout(()=>{I.current=null,(R.current==null||Date.now()-R.current>d)&&w(),D()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",W),()=>{O.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",W),I.current&&clearTimeout(I.current),M()}},[]),{updates:m,updatesMap:x,updateCount:p,isRefreshing:g,lastFetchAt:S,error:A,refresh:w}}const O1={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function B1(a,r){switch(r.type){case"SELECT_SKILL":return{...a,selectedSkill:r.skill,mode:"browse",mobileView:a.isMobile?"detail":a.mobileView};case"CLEAR_SELECTION":return{...a,selectedSkill:null};case"SET_MODE":return{...a,mode:r.mode,selectedSkill:r.mode==="create"?null:a.selectedSkill};case"SET_SEARCH":return{...a,searchQuery:r.query};case"SET_SKILLS":return{...a,skills:r.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...a,skillsError:r.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...a,skillsLoading:r.loading};case"SET_MOBILE":return{...a,isMobile:r.isMobile};case"SET_MOBILE_VIEW":return{...a,mobileView:r.view};case"DISMISS_UPDATE_NOTIFICATION":return{...a,updateNotificationDismissed:!0};default:return a}}const Ux=v.createContext(null);function ya(){const a=v.useContext(Ux);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function H1({children:a}){const[r,i]=v.useReducer(B1,O1),o=E1("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const d=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0}),Ce.getSkills().then(L=>{i({type:"SET_SKILLS",skills:L});const O=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(O){const[,$,w]=O,D=L.find(M=>M.plugin===$&&M.skill===w);D&&i({type:"SELECT_SKILL",skill:{plugin:$,skill:w,origin:D.origin}})}}).catch(L=>i({type:"SET_SKILLS_ERROR",error:L.message}))},[]);v.useEffect(()=>{d()},[d]);const m=v.useCallback(L=>{i({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),f=v.useCallback(()=>{i({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),x=v.useCallback(L=>{i({type:"SET_MODE",mode:L})},[]),h=v.useCallback(L=>{i({type:"SET_SEARCH",query:L})},[]),p=v.useCallback(L=>{i({type:"SET_MOBILE_VIEW",view:L})},[]),b=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),g=_1(),j=v.useMemo(()=>{const L=r.skills.map(I=>{if(!I.updateAvailable&&I.latestVersion===void 0)return I;const O={...I};return delete O.updateAvailable,delete O.currentVersion,delete O.latestVersion,O});return C1(L,g.updates)},[r.skills,g.updates]),S=v.useMemo(()=>{const L={source:0,installed:0};for(const I of j)I.updateAvailable&&(L[I.origin]+=1);return L},[j]),C=v.useMemo(()=>({...r,skills:j}),[r,j]),A=g.updateCount,E=g.refresh,N=g.isRefreshing,R=v.useMemo(()=>({state:C,selectSkill:m,clearSelection:f,setMode:x,setSearch:h,setMobileView:p,refreshSkills:d,updateCount:A,dismissUpdateNotification:b,updates:g.updates,outdatedByOrigin:S,isRefreshingUpdates:N,refreshUpdates:E}),[C,m,f,x,h,p,d,A,b,g.updates,S,N,E]);return n.jsx(Ux.Provider,{value:R,children:a})}const U1={config:null,loading:!0};function I1(a,r){switch(r.type){case"SET_CONFIG":return{config:r.config,loading:!1};case"SET_LOADING":return{...a,loading:!0};default:return a}}const Ix=v.createContext(null);function yl(){const a=v.useContext(Ix);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function V1({children:a}){const[r,i]=v.useReducer(I1,U1),o=v.useCallback(()=>{Ce.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);v.useEffect(()=>{o()},[o]);const d=v.useCallback(async(f,x)=>{const h=await Ce.setConfig(f,x);return i({type:"SET_CONFIG",config:h}),h},[]),m=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:d,refreshConfig:o}),[r,d,o]);return n.jsx(Ix.Provider,{value:m,children:a})}function $1({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:d,banner:m,liveMessage:f,sidebarWidth:x=320,sidebarHidden:h=!1}){const p={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${x}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:h?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style:p,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:[!h&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:d?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!h&&d,n.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:i})]}),n.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),n.jsx("div",{"aria-live":"polite",role:"status",style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},children:f??""})]})}var Vx=Bx();const G1=Ox(Vx),_h=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],q1={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},Y1={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},K1={"claude-cli":"cli-install",anthropic:"api-key",openrouter:"api-key",cursor:"cli-install","codex-cli":"cli-install","gemini-cli":"cli-install",copilot:"cli-install",zed:"cli-install",ollama:"start-service","lm-studio":"start-service"},W1={"claude-cli":"subscription",anthropic:"per-token",openrouter:"per-token",cursor:"subscription","codex-cli":"subscription","gemini-cli":"subscription",copilot:"subscription",zed:"subscription",ollama:"free","lm-studio":"free"};function Q1(a,r){var x,h;const i=q1[a.id]??null,o=Y1[a.id]??null,d=i?!!((x=r==null?void 0:r.wrapperFolders)!=null&&x[i]):!1,m=o?!!((h=r==null?void 0:r.binaries)!=null&&h[o]):!0,f=a.models.map(p=>({id:p.id,displayName:p.label,billingMode:W1[a.id]??"per-token"}));return{id:a.id,displayName:X1(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:d,binaryAvailable:m,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:K1[a.id]??null,models:f}}function X1(a,r){return{"claude-cli":"Claude Code",anthropic:"Anthropic API",openrouter:"OpenRouter",cursor:"Cursor","codex-cli":"Codex CLI","gemini-cli":"Gemini CLI",copilot:"GitHub Copilot",zed:"Zed",ollama:"Ollama","lm-studio":"LM Studio"}[a]??r}function F1(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of _h){const d=r.get(o);d&&i.push(d)}for(const o of a)_h.includes(o.id)||i.push(o);return i}function Z1(a){const[r,i]=v.useState(null),[o,d]=v.useState("loading"),[m,f]=v.useState(null),x=v.useRef(null),h=v.useRef(0),p=v.useCallback(async()=>{try{const C=await fetch("/api/config");if(!C.ok)throw new Error(`/api/config returned ${C.status}`);const A=await C.json(),E=F1((A.providers||[]).map(N=>Q1(N,A.detection)));i({agents:E,activeAgent:A.provider??null,activeModel:A.model??null}),d("ready"),f(null)}catch(C){d("error"),f(C.message)}},[]);v.useEffect(()=>{p()},[p]);const b=v.useCallback(async()=>{const C=Date.now();if(!(C-h.current<5*6e4))try{const A=await fetch("/api/openrouter/models");if(!A.ok)return;const E=await A.json();h.current=C,i(N=>{if(!N)return N;const R=N.agents.map(L=>{if(L.id!=="openrouter")return L;const I=E.models.map($=>({id:$.id,displayName:$.name,contextWindow:$.contextWindow,pricing:$.pricing,billingMode:"per-token"}));return{...L,models:I,catalogAgeMs:E.ageSec?E.ageSec*1e3:0,cacheStale:!!E.stale}});return{...N,agents:R}}),E.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(E.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(C=>{x.current=C,C==="openrouter"&&b()},[b]),j=v.useCallback(()=>{h.current=0,p()},[p]),S=v.useCallback(async(C,A)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:C,model:A})})).ok&&i(N=>N&&{...N,activeAgent:C,activeModel:A})},[]);return{status:o,catalog:r,error:m,focusAgent:g,refresh:j,activeAgentId:(r==null?void 0:r.activeAgent)??null,activeModelId:(r==null?void 0:r.activeModel)??null,setActive:S}}function Lu({variant:a,label:r,onActivate:i,installUrl:o}){function d(f){if(f.stopPropagation(),a==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}i()}function m(f){(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:d,onKeyDown:m,className:"inline-flex items-center gap-1.5 px-0 py-0 text-[11px] font-medium",style:{color:"var(--accent, var(--text-primary))",background:"transparent",border:"none",cursor:"pointer"},"aria-label":r,children:r})}function Zu({unlocked:a=!1,size:r=10}){return a?n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):n.jsxs("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[n.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),n.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const P1={sectionOwn:"Own",sectionInstalled:"Installed",searchPlaceholder:"Search skills",searchShortcutHint:"Press / to search",emptyOwnHeadline:"No skills yet.",emptyOwnBody:"Run vskill new <name> to create one.",emptyInstalledHeadline:"No installed skills.",emptyInstalledBody:"Run vskill install <plugin> to add one.",emptyFilteredHeadline:"No matches in this section.",emptyFilteredBody:"Clear the search or try another query.",loadErrorHeadline:"Couldn't load skills.",loadErrorRetry:"Retry",duplicateBadge:"synced from Own",updateAvailableBadge:"Update available",countBadgeFiltered:(a,r)=>`${a} of ${r}`},J1={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"},e0={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"},t0={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."},n0={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"},a0={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"},l0={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."},r0={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},s0={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},i0={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},o0={triggerLabel:"Agent and model",popoverTitle:"Select agent and model",footerHint:"↑↓ navigate · Enter select · Esc close",settingsButton:"Settings",keyboardShortcut:"⌘K",noModelsYet:"No models yet.",searchPlaceholder:"Search 300+ models…",noMatches:a=>`No models match "${a}"`,clearSearch:"Clear",currentlyActive:"Currently active"},c0={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start service →"}},u0={subscriptionBilling:"· subscription",free:"· free"},d0={title:"Settings",sectionApiKeys:"API Keys",sectionStorage:"Storage",banner:"Keys are stored locally on this device only. Never synced, never committed to git, never transmitted off-device except to the provider's own API.",storageBrowser:"Browser storage (default)",storageKeychain:"macOS Keychain (recommended)",storageDarwinOnly:"macOS Keychain is only available on macOS",show:"Show",hide:"Hide",paste:"Paste",save:"Save",remove:"Remove",removeConfirm:a=>`Remove ${a} API key?`,keyStoredAt:a=>`Key stored locally — updated ${a}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:a=>`This doesn't look like a typical ${a} key. Save anyway?`,keySaved:a=>`${a} API key saved (local only, never synced)`,keyRemoved:a=>`${a} API key removed`},f0={providersLabel:"Providers",providerSummary:(a,r)=>`${a}/${r} providers`,locked:a=>`${a} — locked. Click to add a key.`,lockedCli:a=>`${a} — locked. Click for install instructions.`,unlocked:a=>`${a} — unlocked.`},ve={sidebar:P1,shell:J1,detail:e0,actions:t0,palette:n0,shortcuts:a0,toasts:l0,connection:r0,forms:s0,errors:i0,picker:o0,providers:c0,models:u0,settings:d0,statusBar:f0},Oh=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function p0({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:d,onOpenSettings:m}){const f=a.filter(h=>Oh.has(h.id)),x=a.filter(h=>!Oh.has(h.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(h=>n.jsx(Bh,{agent:h,isActive:h.id===r,isFocused:h.id===i,onFocus:o,onSelect:d,onOpenSettings:m},h.id)),x.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),x.map(h=>n.jsx(Bh,{agent:h,isActive:h.id===r,isFocused:h.id===i,onFocus:o,onSelect:d,onOpenSettings:m},h.id))]})}function Bh({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:d,onOpenSettings:m}){const{providers:f}=ve,x={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},h={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},p={height:36,padding:"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(p.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>d(a.id),style:p,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(Zu,{unlocked:!0,size:10}):n.jsx(Zu,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:ve.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Lu,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>m(a.id)}),!a.available&&a.ctaType==="cli-install"&&h[a.id]&&n.jsx(Lu,{variant:"cli-install",label:h[a.id].label,installUrl:h[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Lu,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>m(a.id)}),x[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:x[a.id]})]})}function m0(a,r,i,o){const f=a>=80,x=v.useRef(null),[h,p]=v.useState(0),b=v.useCallback(S=>{p(S.currentTarget.scrollTop)},[]),{visibleStart:g,visibleEnd:j}=v.useMemo(()=>{if(!f)return{visibleStart:0,visibleEnd:a};const S=Math.max(0,Math.floor(h/r)-4),C=Math.ceil(i/r)+8,A=Math.min(a,S+C);return{visibleStart:S,visibleEnd:A}},[f,h,r,i,a,4]);return{visibleStart:g,visibleEnd:j,totalHeight:a*r,offsetTop:g*r,virtualised:f,containerProps:{onScroll:b,ref:x,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const $x=44,h0=352,x0=60;function v0(a){var m,f;const r=a.contextWindow?a.contextWindow>=1e6?`${Math.round(a.contextWindow/1e6)}M`:a.contextWindow>=1e3?`${Math.round(a.contextWindow/1e3)}k`:String(a.contextWindow):null;if(a.billingMode==="subscription")return r?`${r} ctx ${ve.models.subscriptionBilling}`:ve.models.subscriptionBilling.trim();if(a.billingMode==="free")return r?`local · ${r} ctx · free`:"local · free";const i=((m=a.pricing)==null?void 0:m.prompt)??0,o=((f=a.pricing)==null?void 0:f.completion)??0,d=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${d}`:d}function y0(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(d=>d.displayName.toLowerCase().includes(i)).sort((d,m)=>{const f=d.displayName.toLowerCase().indexOf(i),x=m.displayName.toLowerCase().indexOf(i);return f!==x?f-x:d.displayName.length-m.displayName.length})}function g0({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[d,m]=v.useState(""),[f,x]=v.useState(""),h=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>x(d),x0);return()=>clearTimeout(g)},[d]),v.useEffect(()=>{a.id==="openrouter"&&a.available&&h.current&&h.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:ve.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:ve.providers.openrouter.addKeyCta})]});const p=v.useMemo(()=>y0(a.models,f),[a.models,f]),b=m0(p.length,$x,h0);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:h,type:"text",placeholder:ve.picker.searchPlaceholder,value:d,onChange:g=>m(g.target.value),"data-testid":"model-search-input","aria-label":ve.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),p.length===0&&f?n.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[n.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:ve.picker.noMatches(f)}),n.jsx("button",{type:"button",onClick:()=>m(""),style:{padding:"4px 8px",background:"transparent",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:ve.picker.clearSearch})]}):p.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:ve.picker.noModelsYet}):n.jsx("div",{...b.containerProps,children:n.jsx("div",{style:{height:b.virtualised?b.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:b.virtualised?`translateY(${b.offsetTop}px)`:void 0},children:p.slice(b.visibleStart,b.visibleEnd).map(g=>n.jsx(b0,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function b0({model:a,isActive:r,onSelect:i}){const o=v0(a);return n.jsxs("button",{type:"button",role:"option","aria-selected":r,"data-testid":`model-row-${a.id}`,onClick:i,title:a.id,style:{width:"100%",height:$x,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:r?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",textAlign:"left"},children:[n.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:o})]})}const Hh={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function j0(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[d,m]=v.useState(null),f=v.useCallback(async()=>{o(!0);try{const p=await fetch("/api/settings/keys");if(!p.ok)throw new Error(`GET /api/settings/keys returned ${p.status}`);const b=await p.json();r({...Hh,...b}),m(null)}catch(p){m(p.message),r(Hh)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const x=v.useCallback(async(p,b,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:b,tier:g})});if(!j.ok){const C=await j.json().catch(()=>({error:j.statusText}));throw new Error(C.error||`POST /api/settings/keys returned ${j.status}`)}const S=await j.json();return await f(),S},[f]),h=v.useCallback(async p=>{const b=await fetch(`/api/settings/keys/${p}`,{method:"DELETE"});if(!b.ok)throw new Error(`DELETE /api/settings/keys/${p} returned ${b.status}`);await f()},[f]);return{state:a,loading:i,error:d,save:x,remove:h,refresh:f}}const S0=[{id:"anthropic",name:ve.providers.anthropic.name,keyIssuanceUrl:ve.providers.anthropic.keyIssuanceUrl,prefix:ve.providers.anthropic.keyPrefix},{id:"openrouter",name:ve.providers.openrouter.name,keyIssuanceUrl:ve.providers.openrouter.keyIssuanceUrl,prefix:ve.providers.openrouter.keyPrefix}];function k0(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function w0(a){const r=Date.now()-new Date(a).getTime();return r<6e4?"just now":r<36e5?`${Math.round(r/6e4)}m ago`:r<864e5?`${Math.round(r/36e5)}h ago`:new Date(a).toLocaleString()}function N0({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:d,save:m,remove:f}=j0(),[x,h]=v.useState("browser"),p=v.useRef(null),b=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const C=document.activeElement,A=setTimeout(()=>{var R;const E=i?`input[data-provider="${i}"]`:"input[data-provider]",N=(R=p.current)==null?void 0:R.querySelector(E);N==null||N.focus()},0);return()=>{var E;clearTimeout(A),(E=C==null?void 0:C.focus)==null||E.call(C)}},[a,i]),v.useEffect(()=>{if(!a)return;const C=A=>{if(A.key==="Escape"){A.preventDefault(),r();return}if(A.key==="Tab"&&p.current){const E=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(E.length===0)return;const N=E[0],R=E[E.length-1];A.shiftKey&&document.activeElement===N?(A.preventDefault(),R.focus()):!A.shiftKey&&document.activeElement===R&&(A.preventDefault(),N.focus())}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[a,r]),!a)return null;const S=k0();return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:C=>{C.target===C.currentTarget&&r()},children:n.jsxs("div",{ref:p,style:{background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,width:560,maxHeight:"80vh",overflowY:"auto",padding:20,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",color:"var(--text-primary)"},onClick:C=>C.stopPropagation(),children:[n.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:ve.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:ve.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:ve.settings.sectionApiKeys}),S0.map(C=>n.jsx(C0,{providerId:C.id,providerName:C.name,keyIssuanceUrl:C.keyIssuanceUrl,prefix:C.prefix,metadata:d==null?void 0:d[C.id],tier:x,onSave:async A=>{const E=await m(C.id,A,x);return o==null||o(ve.settings.keySaved(C.name)),E},onRemove:async()=>{await f(C.id),o==null||o(ve.settings.keyRemoved(C.name))},inputRef:C.id===(i??"anthropic")?b:void 0},C.id))]}),n.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[n.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:ve.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:x==="browser",onChange:()=>h("browser")}),ve.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:x==="keychain",onChange:()=>h("keychain")}),ve.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[ve.settings.storageBrowser,n.jsxs("span",{title:ve.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",ve.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function C0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:d,onSave:m,onRemove:f,inputRef:x}){const[h,p]=v.useState(""),[b,g]=v.useState(!1),[j,S]=v.useState(!1),[C,A]=v.useState(!1),[E,N]=v.useState(null),R=h.trim(),L=R.length===0,I=R.length>0&&!R.startsWith(o),O=v.useCallback(async()=>{if(!L){S(!0);try{const D=await m(R);D.warning?N(D.warning):N(null),p("")}finally{S(!1)}}},[L,m,R]),$=v.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const M=await navigator.clipboard.readText();p(M)}catch{}},[]),w=v.useCallback(async()=>{A(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:x,type:b?"text":"password",value:h,onChange:D=>{p(D.target.value),N(null)},"data-provider":a,placeholder:`Paste ${r} key`,style:{flex:1,padding:"6px 8px",border:"1px solid var(--border-subtle)",borderRadius:4,background:"var(--surface-2, var(--bg-surface))",color:"var(--text-primary)",fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"}}),n.jsx("button",{type:"button",onClick:()=>g(!b),style:rr,children:b?ve.settings.hide:ve.settings.show}),n.jsx("button",{type:"button",onClick:$,style:rr,children:ve.settings.paste})]}),L&&h.length>0&&n.jsx("div",{role:"status",style:E0,children:ve.settings.enterNonEmpty}),I&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:Uh,children:ve.settings.prefixWarn(r)}),E&&n.jsx("div",{role:"status",style:Uh,children:E}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:O,disabled:L||j,"data-testid":`save-${a}`,style:{...rr,background:L?"var(--surface-2)":"var(--accent, var(--color-accent))",color:L?"var(--text-muted)":"white",cursor:L?"not-allowed":"pointer"},children:ve.settings.save}),(d==null?void 0:d.stored)&&n.jsx(n.Fragment,{children:C?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:ve.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:w,"data-testid":`remove-confirm-${a}`,style:{...rr,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>A(!1),style:rr,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>A(!0),"data-testid":`remove-${a}`,style:{...rr,color:"var(--text-muted)"},children:ve.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:d!=null&&d.stored&&d.updatedAt?ve.settings.keyStoredAt(w0(d.updatedAt)):ve.settings.noKey})]})]})}const rr={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},E0={fontSize:11,color:"var(--danger, #b33)"},Uh={fontSize:11,color:"var(--warning, var(--text-muted))"};function T0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function R0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:d}=Z1({onStaleCatalog:(D,M)=>{const U=Math.round(M/6e4);a==null||a(`Using cached ${D} catalog (${U} min old)`)}}),[m,f]=v.useState(!1),[x,h]=v.useState(!1),[p,b]=v.useState(),[g,j]=v.useState(null),[S,C]=v.useState("agents"),A=v.useRef(null);v.useRef(null),v.useEffect(()=>{var D;i&&!g&&j(i.activeAgent??((D=i.agents[0])==null?void 0:D.id)??null)},[i,g]);const E=(i==null?void 0:i.agents)??[],N=v.useMemo(()=>E.find(D=>D.id===g)??E[0],[E,g]),R=v.useCallback(()=>{var D;f(!0),C("agents"),j((i==null?void 0:i.activeAgent)??((D=E[0])==null?void 0:D.id)??null)},[i,E]),L=v.useCallback(()=>{var D;f(!1),(D=A.current)==null||D.focus()},[]);v.useEffect(()=>{const D=M=>{var q;if(!(M.metaKey||M.ctrlKey)||M.key.toLowerCase()!=="k")return;const U=(q=document.activeElement)==null?void 0:q.tagName;U==="INPUT"||U==="TEXTAREA"||(M.preventDefault(),f(W=>!W))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),v.useEffect(()=>{if(!m)return;const D=U=>{if(U.key==="Escape"){U.preventDefault(),L();return}if(U.key==="ArrowDown"){U.preventDefault(),M(1);return}if(U.key==="ArrowUp"){U.preventDefault(),M(-1);return}if(U.key==="ArrowRight"&&S==="agents"){U.preventDefault(),C("models");return}if(U.key==="ArrowLeft"&&S==="models"){U.preventDefault(),C("agents");return}if(U.key==="Enter"){U.preventDefault(),S==="agents"&&N?C("models"):S==="models"&&N&&N.models[0]&&(d(N.id,N.models[0].id),L());return}};function M(U){if(S==="agents"){const q=E.findIndex(P=>P.id===g),W=E[Math.max(0,Math.min(E.length-1,q+U))];W&&(j(W.id),o(W.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[m,S,E,g,N,L,o,d]);const I=v.useCallback(D=>{b(D==="anthropic"||D==="openrouter"?D:void 0),h(!0),f(!1)},[]),O=E.find(D=>D.id===(i==null?void 0:i.activeAgent)),$=O==null?void 0:O.models.find(D=>D.id===(i==null?void 0:i.activeModel)),w=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const D=(O==null?void 0:O.displayName)??"Agent",M=($==null?void 0:$.displayName)??i.activeModel??"Model";return`${D} · ${M}`},[r,i,O,$]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:A,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>m?L():R(),"aria-haspopup":"listbox","aria-expanded":m,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:O!=null&&O.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:w})]}),m&&typeof document<"u"&&Vx.createPortal(n.jsxs(A0,{reducedMotion:T0(),onClickOutside:L,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(p0,{agents:E,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:D=>{j(D),o(D)},onSelect:D=>{j(D),o(D),C("models")},onOpenSettings:I}),N&&n.jsx(g0,{agent:N,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:D=>{d(N.id,D),L()},onOpenSettings:I})]}),n.jsxs("div",{style:{height:32,borderTop:"1px solid var(--border-default, var(--border-subtle))",padding:"0 12px",display:"flex",alignItems:"center",justifyContent:"space-between",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},children:[n.jsx("button",{type:"button",onClick:()=>I(),"data-testid":"picker-footer-settings",style:{background:"transparent",border:"none",color:"var(--text-primary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ve.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:ve.picker.footerHint})]})]}),document.body),n.jsx(N0,{open:x,onClose:()=>h(!1),initialProvider:p,onToast:a})]})}function A0({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const d=m=>{o.current&&!o.current.contains(m.target)&&i()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
51
- from { opacity: 0; transform: translateX(-50%) translateY(2px); }
52
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
53
- }`})]})}const M0="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='currentColor'%20stroke-width='1.75'%20stroke-linecap='round'%20stroke-linejoin='round'%20aria-hidden='true'%20focusable='false'%3e%3cpath%20d='M5.5%2017h11l-1.2-1.8a2%202%200%200%201-.3-1.1V10a4%204%200%201%200-8%200v4.1a2%202%200%200%201-.3%201.1L5.5%2017Z'%20/%3e%3cpath%20d='M10%2020a2%202%200%200%200%204%200'%20/%3e%3ccircle%20cx='17'%20cy='7'%20r='2.2'%20fill='currentColor'%20stroke='none'%20/%3e%3c/svg%3e",z0=v.lazy(()=>ud(()=>import("./UpdateDropdown-E99dDGz-.js"),__vite__mapDeps([0,1])));function D0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:d}=ya(),[m,f]=v.useState(!1),x=v.useRef(null),h=v.useCallback(()=>f(!1),[]),p=a>0?"var(--text-primary)":"var(--text-secondary)",b=a>9?"9+":String(a),g=a===0?"No updates available":`${a} updates available, open summary`;return n.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[n.jsxs("button",{ref:x,type:"button","data-testid":"update-bell","aria-label":g,"aria-haspopup":"dialog","aria-expanded":m,onClick:()=>f(j=>!j),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:26,width:26,padding:0,borderRadius:4,border:"1px solid transparent",background:"transparent",color:p,cursor:"pointer"},children:[n.jsx("img",{src:M0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:b})]}),m&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(z0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),C=S.length>=2?S[S.length-2]:S[0],A=S[S.length-1];d({plugin:C,skill:A,origin:"installed"}),h()},onViewAll:()=>{window.location.hash="#/updates",h()},onClose:h,anchorRef:x})})]})}function Ih(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function L0({projectName:a,selected:r,onOpenPalette:i}){const o=r?r.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:r&&o&&n.jsxs(n.Fragment,{children:[n.jsx(Vh,{segment:"origin",onClick:()=>Ih({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:o}),n.jsx($h,{}),n.jsx(Vh,{segment:"plugin",onClick:()=>Ih({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx($h,{}),n.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.skill})]})}),n.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[n.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:n.jsx(R0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(D0,{})}),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 Vh({segment:a,onClick:r,style:i,children:o}){return n.jsx("button",{type:"button","data-breadcrumb-segment":a,onClick:r,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...i},onMouseEnter:d=>{d.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:d=>{const m=(i==null?void 0:i.color)??"var(--text-secondary)";d.currentTarget.style.color=m},children:o})}function $h(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const ro="vskill-theme";function Gx(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function _0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function O0(a){try{const r=a.getItem(ro);return Gx(r)}catch{return"auto"}}function B0(a,r){try{a.setItem(ro,r)}catch{}}function H0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function U0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const qx=v.createContext(null);function I0({storage:a,matchMedia:r,target:i,children:o}){const d=a??(typeof window<"u"?window.localStorage:void 0),m=r??(typeof window<"u"?window.matchMedia.bind(window):void 0),f=i??(typeof document<"u"?document.documentElement:void 0),[x,h]=v.useState(()=>d?O0(d):"auto"),[p,b]=v.useState(()=>U0(m)),g=v.useMemo(()=>_0(x,p),[x,p]);v.useEffect(()=>{f&&H0(f,x,g)},[f,x,g]),v.useEffect(()=>{if(!m)return;const C=m("(prefers-color-scheme: dark)"),A=N=>b(N.matches);if(typeof C.addEventListener=="function")return C.addEventListener("change",A),()=>C.removeEventListener("change",A);const E=C;return E.addListener(A),()=>E.removeListener(A)},[m]),v.useEffect(()=>{if(typeof window>"u")return;const C=A=>{A.key===ro&&h(Gx(A.newValue))};return window.addEventListener("storage",C),()=>window.removeEventListener("storage",C)},[]),v.useEffect(()=>{if(!m||!f)return;let C;try{C=m("(prefers-contrast: more)")}catch{return}const A=R=>{R?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};A(C.matches);const E=R=>A(R.matches);if(typeof C.addEventListener=="function")return C.addEventListener("change",E),()=>C.removeEventListener("change",E);const N=C;return N.addListener(E),()=>N.removeListener(E)},[m,f]);const j=v.useCallback(C=>{h(C),d&&B0(d,C)},[d]),S=v.useMemo(()=>({mode:x,resolvedTheme:g,setTheme:j}),[x,g,j]);return n.jsx(qx.Provider,{value:S,children:o})}function Yx(){const a=v.useContext(qx);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const Gh=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function V0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of Gh){const d=r.get(o);d&&i.push(d)}for(const o of a)Gh.includes(o.id)||i.push(o);return i}function $0(a){const[r,i]=v.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${a}px)`).matches);return v.useEffect(()=>{var m;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${a}px)`),d=()=>i(o.matches);return(m=o.addEventListener)==null||m.call(o,"change",d),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",d)}},[a]),r}function G0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=V0(a),d=$0(640),[m,f]=v.useState(!1),x=v.useCallback(h=>{h.available||h.kind==="api-key"?r==null||r(h.id):i==null||i(h.id)},[r,i]);if(d){const h=o.filter(p=>p.available).length;return n.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[n.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>f(!m),"aria-label":ve.statusBar.providerSummary(h,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:ve.statusBar.providerSummary(h,o.length)}),m&&n.jsx("div",{role:"menu",style:{position:"absolute",bottom:"120%",right:0,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,padding:6,minWidth:180,display:"flex",flexDirection:"column",gap:2,zIndex:80},children:o.map(p=>n.jsx(qh,{p,onClick:x},p.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(h=>n.jsx(qh,{p:h,onClick:x,compact:!0},h.id))})}function qh({p:a,onClick:r,compact:i}){const o=a.available?ve.statusBar.unlocked(a.label):a.kind==="cli-install"?ve.statusBar.lockedCli(a.label):ve.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(Zu,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function q0(){try{return typeof localStorage>"u"?null:localStorage.getItem(ro)}catch{return null}}function Y0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:d,onOpenProviderSettings:m,onOpenProviderInstallHelp:f}){const{mode:x,resolvedTheme:h,setTheme:p}=Yx(),g=q0()==="auto",j=K0(x,h,g),S=i==="down"||i==="degraded"?"var(--status-own)":"var(--status-installed)";return n.jsxs("div",{role:"contentinfo",style:{display:"flex",alignItems:"center",gap:12,height:"100%",width:"100%",padding:"0 12px",fontSize:11,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.jsxs("button",{type:"button",onClick:o,"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:o?"pointer":"default",maxWidth:360,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a??"",children:[n.jsx(Yh,{color:"var(--text-secondary)"}),n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:a??"—"})]}),n.jsx(_u,{}),n.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(_u,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(Yh,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),d&&d.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(_u,{}),n.jsx(G0,{providers:d,onOpenSettings:m,onOpenInstallHelp:f})]}),n.jsx("div",{style:{flex:1}}),n.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(j),"aria-label":`Switch to ${j} theme`,title:`Theme: ${x} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(W0,{mode:x}),n.jsx("span",{style:{textTransform:"capitalize"},children:x})]})]})}function K0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function Yh({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function _u(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function W0({mode:a}){return a==="dark"?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):a==="light"?n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const so=0,Ka=1,mr=2,Kx=4;function Kh(a){return()=>a}function Q0(a){a()}function Wx(a,r){return i=>a(r(i))}function Wh(a,r){return()=>a(r)}function X0(a,r){return i=>a(r,i)}function dd(a){return a!==void 0}function F0(...a){return()=>{a.map(Q0)}}function hr(){}function io(a,r){return r(a),a}function Z0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Ka,r)}function Ue(a,r){a(so,r)}function fd(a){a(mr)}function gt(a){return a(Kx)}function we(a,r){return et(a,X0(r,so))}function Vn(a,r){const i=a(Ka,o=>{i(),r(o)});return i}function Qh(a){let r,i;return o=>d=>{r=d,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function Qx(a,r){return a===r}function mt(a=Qx){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function ge(a){return r=>Wx(r,a)}function Wn(a){return r=>()=>{r(a)}}function se(a,...r){const i=P0(...r);return((o,d)=>{switch(o){case mr:fd(a);return;case Ka:return et(a,i(d))}})}function Qn(a,r){return i=>o=>{i(r=a(r,o))}}function vl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>d=>{r=d,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function Ve(...a){const r=new Array(a.length);let i=0,o=null;const d=2**a.length-1;return a.forEach((m,f)=>{const x=2**f;et(m,h=>{const p=i;i|=x,r[f]=h,p!==d&&i===d&&o&&(o(),o=null)})}),m=>f=>{const x=()=>{m([f].concat(r))};i===d?x():o=x}}function P0(...a){return r=>a.reduceRight(Z0,r)}function J0(a){let r,i;const o=()=>r==null?void 0:r();return function(d,m){switch(d){case Ka:return m?i===m?void 0:(o(),i=m,r=et(a,m),r):(o(),hr);case mr:o(),i=null;return}}}function ue(a){let r=a;const i=Xe();return((o,d)=>{switch(o){case so:r=d;break;case Ka:{d(r);break}case Kx:return r}return i(o,d)})}function Zt(a,r){return io(ue(r),i=>we(a,i))}function Xe(){const a=[];return((r,i)=>{switch(r){case so:a.slice().forEach(o=>{o(i)});return;case mr:a.splice(0,a.length);return;case Ka:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function bn(a){return io(Xe(),r=>we(a,r))}function Pe(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:eb(),singleton:i}}const eb=()=>Symbol();function tb(a){const r=new Map,i=({constructor:o,dependencies:d,id:m,singleton:f})=>{if(f&&r.has(m))return r.get(m);const x=o(d.map(h=>i(h)));return f&&r.set(m,x),x};return i(a)}function Lt(...a){const r=Xe(),i=new Array(a.length);let o=0;const d=2**a.length-1;return a.forEach((m,f)=>{const x=2**f;et(m,h=>{i[f]=h,o|=x,o===d&&Ue(r,i)})}),function(m,f){switch(m){case mr:{fd(r);return}case Ka:return o===d&&f(i),et(r,f)}}}function Re(a,r=Qx){return se(a,mt(r))}function Pu(...a){return function(r,i){switch(r){case mr:return;case Ka:return F0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},nb={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},ab=()=>typeof globalThis>"u"?window:globalThis,Wa=Pe(()=>{const a=ue(Bt.ERROR);return{log:ue((r,i,o=Bt.INFO)=>{const d=ab().VIRTUOSO_LOG_LEVEL??gt(a);o>=d&&console[nb[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function gl(a,r,i){return pd(a,r,i).callbackRef}function pd(a,r,i){const o=ke.useRef(null);let d=f=>{};const m=ke.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const x=()=>{const h=f[0].target;h.offsetParent!==null&&a(h)};i?x():requestAnimationFrame(x)}):null,[a,i]);return d=f=>{f&&r?(m==null||m.observe(f),o.current=f):(o.current&&(m==null||m.unobserve(o.current)),o.current=null)},{callbackRef:d,ref:o}}function lb(a,r,i,o,d,m,f,x,h){const p=ke.useCallback(b=>{const g=rb(b.children,r,x?"offsetWidth":"offsetHeight",d);let j=b.parentElement;for(;j.dataset.virtuosoScroller===void 0;)j=j.parentElement;const S=j.lastElementChild.dataset.viewportType==="window";let C;S&&(C=j.ownerDocument.defaultView);const A=f?x?f.scrollLeft:f.scrollTop:S?x?C.scrollX||C.document.documentElement.scrollLeft:C.scrollY||C.document.documentElement.scrollTop:x?j.scrollLeft:j.scrollTop,E=f?x?f.scrollWidth:f.scrollHeight:S?x?C.document.documentElement.scrollWidth:C.document.documentElement.scrollHeight:x?j.scrollWidth:j.scrollHeight,N=f?x?f.offsetWidth:f.offsetHeight:S?x?C.innerWidth:C.innerHeight:x?j.offsetWidth:j.offsetHeight;o({scrollHeight:E,scrollTop:Math.max(A,0),viewportHeight:N}),m==null||m(x?Xh("column-gap",getComputedStyle(b).columnGap,d):Xh("row-gap",getComputedStyle(b).rowGap,d)),g!==null&&a(g)},[a,r,d,m,f,o,x]);return pd(p,i,h)}function rb(a,r,i,o){const d=a.length;if(d===0)return null;const m=[];for(let f=0;f<d;f++){const x=a.item(f);if(x.dataset.index===void 0)continue;const h=parseInt(x.dataset.index),p=parseFloat(x.dataset.knownSize),b=r(x,i);if(b===0&&o("Zero-sized element, this should not happen",{child:x},Bt.ERROR),b===p)continue;const g=m[m.length-1];m.length===0||g.size!==b||g.endIndex!==h-1?m.push({endIndex:h,size:b,startIndex:h}):m[m.length-1].endIndex++}return m}function Xh(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}function Xx(a,r,i){const o=ke.useRef(null),d=ke.useCallback(h=>{if(!(h!=null&&h.offsetParent))return;const p=h.getBoundingClientRect(),b=p.width;let g,j;if(r){const S=r.getBoundingClientRect(),C=p.top-S.top;j=S.height-Math.max(0,C),g=C+r.scrollTop}else{const S=f.current.ownerDocument.defaultView;j=S.innerHeight-Math.max(0,p.top),g=p.top+S.scrollY}o.current={listHeight:p.height,offsetTop:g,visibleHeight:j,visibleWidth:b},a(o.current)},[a,r]),{callbackRef:m,ref:f}=pd(d,!0,i),x=ke.useCallback(()=>{d(f.current)},[d,f]);return ke.useEffect(()=>{var p;if(r){r.addEventListener("scroll",x);const b=new ResizeObserver(()=>{requestAnimationFrame(x)});return b.observe(r),()=>{r.removeEventListener("scroll",x),b.unobserve(r)}}const h=(p=f.current)==null?void 0:p.ownerDocument.defaultView;return h==null||h.addEventListener("scroll",x),h==null||h.addEventListener("resize",x),()=>{h==null||h.removeEventListener("scroll",x),h==null||h.removeEventListener("resize",x)}},[x,r,f]),m}const nn=Pe(()=>{const a=Xe(),r=Xe(),i=ue(0),o=Xe(),d=ue(0),m=Xe(),f=Xe(),x=ue(0),h=ue(0),p=ue(0),b=ue(0),g=Xe(),j=Xe(),S=ue(!1),C=ue(!1),A=ue(!1);return we(se(a,ge(({scrollTop:E})=>E)),r),we(se(a,ge(({scrollHeight:E})=>E)),f),we(r,d),{deviation:i,fixedFooterHeight:p,fixedHeaderHeight:h,footerHeight:b,headerHeight:x,horizontalDirection:C,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:A,smoothScrollTargetReached:o,statefulScrollTop:d,viewportHeight:m}},[],{singleton:!0}),vs={lvl:0};function Fx(a,r){const i=a.length;if(i===0)return[];let{index:o,value:d}=r(a[0]);const m=[];for(let f=1;f<i;f++){const{index:x,value:h}=r(a[f]);m.push({end:x-1,start:o,value:d}),o=x,d=h}return m.push({end:1/0,start:o,value:d}),m}function ot(a){return a===vs}function ys(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?ys(a.l,r):ys(a.r,r)}function $n(a,r,i="k"){if(ot(a))return[-1/0,void 0];if(Number(a[i])===r)return[a.k,a.v];if(Number(a[i])<r){const o=$n(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return $n(a.l,r,i)}function yn(a,r,i){return ot(a)?Jx(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?Fh(Ot(a,{l:yn(a.l,r,i)})):Fh(Ot(a,{r:yn(a.r,r,i)}))}function cr(){return vs}function ur(a,r,i){if(ot(a))return[];const o=$n(a,r)[0];return sb(ed(a,o,i))}function Ju(a,r){if(ot(a))return vs;const{k:i,l:o,r:d}=a;if(r===i){if(ot(o))return d;if(ot(d))return o;const[m,f]=Px(o);return Xi(Ot(a,{k:m,l:Zx(o),v:f}))}return r<i?Xi(Ot(a,{l:Ju(o,r)})):Xi(Ot(a,{r:Ju(d,r)}))}function xl(a){return ot(a)?[]:[...xl(a.l),{k:a.k,v:a.v},...xl(a.r)]}function ed(a,r,i){if(ot(a))return[];const{k:o,l:d,r:m,v:f}=a;let x=[];return o>r&&(x=x.concat(ed(d,r,i))),o>=r&&o<=i&&x.push({k:o,v:f}),o<=i&&(x=x.concat(ed(m,r,i))),x}function Xi(a){const{l:r,lvl:i,r:o}=a;if(o.lvl>=i-1&&r.lvl>=i-1)return a;if(i>o.lvl+1){if(Ou(r))return ev(Ot(a,{lvl:i-1}));if(!ot(r)&&!ot(r.r))return Ot(r.r,{l:Ot(r,{r:r.r.l}),lvl:i,r:Ot(a,{l:r.r.r,lvl:i-1})});throw new Error("Unexpected empty nodes")}if(Ou(a))return td(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const d=o.l,m=Ou(d)?o.lvl-1:o.lvl;return Ot(d,{l:Ot(a,{lvl:i-1,r:d.l}),lvl:d.lvl+1,r:td(Ot(o,{l:d.r,lvl:m}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return Jx(r.k!==void 0?r.k:a.k,r.v!==void 0?r.v:a.v,r.lvl!==void 0?r.lvl:a.lvl,r.l!==void 0?r.l:a.l,r.r!==void 0?r.r:a.r)}function Zx(a){return ot(a.r)?a.l:Xi(Ot(a,{r:Zx(a.r)}))}function Ou(a){return ot(a)||a.lvl>a.r.lvl}function Px(a){return ot(a.r)?[a.k,a.v]:Px(a.r)}function Jx(a,r,i,o=vs,d=vs){return{k:a,l:o,lvl:i,r:d,v:r}}function Fh(a){return td(ev(a))}function ev(a){const{l:r}=a;return!ot(r)&&r.lvl===a.lvl?Ot(r,{r:Ot(a,{l:r.r})}):a}function td(a){const{lvl:r,r:i}=a;return!ot(i)&&!ot(i.r)&&i.lvl===r&&i.r.lvl===r?Ot(i,{l:Ot(a,{r:i.l}),lvl:r+1}):a}function sb(a){return Fx(a,({k:r,v:i})=>({index:r,value:i}))}function tv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function gs(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const md=Pe(()=>({recalcInProgress:ue(!1)}),[],{singleton:!0});function nv(a,r,i){return a[eo(a,r,i)]}function eo(a,r,i,o=0){let d=a.length-1;for(;o<=d;){const m=Math.floor((o+d)/2),f=a[m],x=i(f,r);if(x===0)return m;if(x===-1){if(d-o<2)return m-1;d=m-1}else{if(d===o)return m;o=m+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function ib(a,r,i,o){const d=eo(a,r,o),m=eo(a,i,o,d);return a.slice(d,m+1)}function Ya(a,r){return Math.round(a.getBoundingClientRect()[r])}function oo(a){return!ot(a.groupOffsetTree)}function hd({index:a},r){return r===a?0:r<a?-1:1}function ob(){return{groupIndices:[],groupOffsetTree:cr(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:cr()}}function cb(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:d,size:m,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,m);continue}const x=ur(a,f-1,d+1);if(x.some(xb(o)))continue;let h=!1,p=!1;for(const{end:b,start:g,value:j}of x)h?(d>=g||m===j)&&(a=Ju(a,g)):(p=j!==m,h=!0),b>d&&d>=g&&j!==m&&(a=yn(a,d+1,j));p&&(a=yn(a,f,m))}return[a,i]}function ub(a){return typeof a.groupIndex<"u"}function db({offset:a},r){return r===a?0:r<a?-1:1}function bs(a,r,i){if(r.length===0)return 0;const{index:o,offset:d,size:m}=nv(r,a,hd),f=a-o,x=m*f+(f-1)*i+d;return x>0?x+i:x}function av(a,r){if(!oo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function lv(a,r,i){if(ub(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let d=av(o,r);return d=Math.max(0,d,Math.min(i,d)),d}function fb(a,r,i,o=0){return o>0&&(r=Math.max(r,nv(a,o,hd).offset)),Fx(ib(a,r,i,db),hb)}function pb(a,[r,i,o,d]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const m=a.sizeTree;let f=m,x=0;if(i.length>0&&ot(m)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((C,A)=>yn(yn(C,A,j),A+1,S),f)}else[f,x]=cb(f,r);if(f===m)return a;const{lastIndex:h,lastOffset:p,lastSize:b,offsetTree:g}=nd(a.offsetTree,x,f,d);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,bs(S,g,d)),cr()),lastIndex:h,lastOffset:p,lastSize:b,offsetTree:g,sizeTree:f}}function mb(a){return xl(a).map(({k:r,v:i},o,d)=>{const m=d[o+1];return{endIndex:m!==void 0?m.k-1:1/0,size:i,startIndex:r}})}function Zh(a,r){let i=0,o=0;for(;i<a;)i+=r[o+1]-r[o]-1,o++;return o-(i===a?0:1)}function nd(a,r,i,o){let d=a,m=0,f=0,x=0,h=0;if(r!==0){h=eo(d,r-1,hd),x=d[h].offset;const p=$n(i,r-1);m=p[0],f=p[1],d.length&&d[h].size===$n(i,r)[1]&&(h-=1),d=d.slice(0,h+1)}else d=[];for(const{start:p,value:b}of ur(i,r,1/0)){const g=p-m,j=g*f+x+g*o;d.push({index:p,offset:j,size:b}),m=p,x=j,f=b}return{lastIndex:m,lastOffset:x,lastSize:f,offsetTree:d}}function hb(a){return{index:a.index,value:a}}function xb(a){const{endIndex:r,size:i,startIndex:o}=a;return d=>d.start===o&&(d.end===r||d.end===1/0)&&d.value===i}const vb={offsetHeight:"height",offsetWidth:"width"},Xn=Pe(([{log:a},{recalcInProgress:r}])=>{const i=Xe(),o=Xe(),d=Zt(o,0),m=Xe(),f=Xe(),x=ue(0),h=ue([]),p=ue(void 0),b=ue(void 0),g=ue(void 0),j=ue(void 0),S=ue((w,D)=>Ya(w,vb[D])),C=ue(void 0),A=ue(0),E=ob(),N=Zt(se(i,Ve(h,a,A),Qn(pb,E),mt()),E),R=Zt(se(h,mt(),Qn((w,D)=>({current:D,prev:w.current}),{current:[],prev:[]}),ge(({prev:w})=>w)),[]);we(se(h,Ae(w=>w.length>0),Ve(N,A),ge(([w,D,M])=>{const U=w.reduce((q,W,P)=>yn(q,W,bs(W,D.offsetTree,M)||P),cr());return{...D,groupIndices:w,groupOffsetTree:U}})),N),we(se(o,Ve(N),Ae(([w,{lastIndex:D}])=>w<D),ge(([w,{lastIndex:D,lastSize:M}])=>[{endIndex:D,size:M,startIndex:w}])),i),we(p,b);const L=Zt(se(p,ge(w=>w===void 0)),!0);we(se(b,Ae(w=>w!==void 0&&ot(gt(N).sizeTree)),ge(w=>{const D=gt(g),M=gt(h).length>0;return D!==void 0&&D!==0?M?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),i),we(se(j,Ae(w=>w!==void 0&&w.length>0&&ot(gt(N).sizeTree)),ge(w=>{const D=[];let M=w[0],U=0;for(let q=1;q<w.length;q++){const W=w[q];W!==M&&(D.push({endIndex:q-1,size:M,startIndex:U}),M=W,U=q)}return D.push({endIndex:w.length-1,size:M,startIndex:U}),D})),i),we(se(h,Ve(g,b),Ae(([,w,D])=>w!==void 0&&D!==void 0),ge(([w,D,M])=>{const U=[];for(let q=0;q<w.length;q++){const W=w[q],P=w[q+1];U.push({startIndex:W,endIndex:W,size:D}),P!==void 0&&U.push({startIndex:W+1,endIndex:P-1,size:M})}return U})),i);const I=bn(se(i,Ve(N),Qn(({sizes:w},[D,M])=>({changed:M!==w,sizes:M}),{changed:!1,sizes:E}),ge(w=>w.changed)));et(se(x,Qn((w,D)=>({diff:w.prev-D,prev:D}),{diff:0,prev:0}),ge(w=>w.diff)),w=>{const{groupIndices:D}=gt(N);if(w>0)Ue(r,!0),Ue(m,w+Zh(w,D));else if(w<0){const M=gt(R);M.length>0&&(w-=Zh(-w,M)),Ue(f,w)}}),et(se(x,Ve(a)),([w,D])=>{w<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:x},Bt.ERROR)});const O=bn(m);we(se(m,Ve(N),ge(([w,D])=>{const M=D.groupIndices.length>0,U=[],q=D.lastSize;if(M){const W=ys(D.sizeTree,0);let P=0,F=0;for(;P<w;){const T=D.groupIndices[F],B=D.groupIndices.length===F+1?1/0:D.groupIndices[F+1]-T-1;U.push({endIndex:T,size:W,startIndex:T}),U.push({endIndex:T+1+B-1,size:q,startIndex:T+1}),F++,P+=B+1}const _=xl(D.sizeTree);return P!==w&&_.shift(),_.reduce((T,{k:B,v:le})=>{let Q=T.ranges;return T.prevSize!==0&&(Q=[...T.ranges,{endIndex:B+w-1,size:T.prevSize,startIndex:T.prevIndex}]),{prevIndex:B+w,prevSize:le,ranges:Q}},{prevIndex:w,prevSize:0,ranges:U}).ranges}return xl(D.sizeTree).reduce((W,{k:P,v:F})=>({prevIndex:P+w,prevSize:F,ranges:[...W.ranges,{endIndex:P+w-1,size:W.prevSize,startIndex:W.prevIndex}]}),{prevIndex:0,prevSize:q,ranges:[]}).ranges})),i);const $=bn(se(f,Ve(N,A),ge(([w,{offsetTree:D},M])=>{const U=-w;return bs(U,D,M)})));return we(se(f,Ve(N,A),ge(([w,D,M])=>{if(D.groupIndices.length>0){if(ot(D.sizeTree))return D;let q=cr();const W=gt(R);let P=0,F=0,_=0;for(;P<-w;){_=W[F];const T=W[F+1]-_-1;F++,P+=T+1}if(q=xl(D.sizeTree).reduce((T,{k:B,v:le})=>yn(T,Math.max(0,B+w),le),q),P!==-w){const T=ys(D.sizeTree,_);q=yn(q,0,T);const B=$n(D.sizeTree,-w+1)[1];q=yn(q,1,B)}return{...D,sizeTree:q,...nd(D.offsetTree,0,q,M)}}const U=xl(D.sizeTree).reduce((q,{k:W,v:P})=>yn(q,Math.max(0,W+w),P),cr());return{...D,sizeTree:U,...nd(D.offsetTree,0,U,M)}})),N),{beforeUnshiftWith:O,data:C,defaultItemSize:b,firstItemIndex:x,fixedItemSize:p,fixedGroupSize:g,gap:A,groupIndices:h,heightEstimates:j,itemSize:S,listRefresh:I,shiftWith:f,shiftWithOffset:$,sizeRanges:i,sizes:N,statefulTotalCount:d,totalCount:o,trackItemSizes:L,unshiftWith:m}},ht(Wa,md),{singleton:!0});function yb(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const rv=Pe(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:d}])=>{const m=Xe(),f=Xe(),x=bn(se(m,ge(yb)));return we(se(x,ge(h=>h.totalCount)),i),we(se(x,ge(h=>h.groupIndices)),a),we(se(Lt(d,r,o),Ae(([h,p])=>oo(p)),ge(([h,p,b])=>$n(p.groupOffsetTree,Math.max(h-b,0),"v")[0]),mt(),ge(h=>[h])),f),{groupCounts:m,topItemsIndexes:f}},ht(Xn,nn)),Qa=Pe(([{log:a}])=>{const r=ue(!1),i=bn(se(r,Ae(o=>o),mt()));return et(r,o=>{o&&gt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Wa),{singleton:!0}),gb=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function sv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!gb)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const ws=Pe(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:d,fixedHeaderHeight:m,footerHeight:f,headerHeight:x,scrollingInProgress:h,scrollTo:p,smoothScrollTargetReached:b,viewportHeight:g},{log:j}])=>{const S=Xe(),C=Xe(),A=ue(0);let E=null,N=null,R=null;function L(){E!==null&&(E(),E=null),R!==null&&(R(),R=null),N&&(clearTimeout(N),N=null),Ue(h,!1)}return we(se(S,Ve(i,g,o,A,x,f,j),Ve(a,m,d),ge(([[I,O,$,w,D,M,U,q],W,P,F])=>{const _=sv(I),{align:T,behavior:B,offset:le}=_,Q=w-1,pe=lv(_,O,Q);let z=bs(pe,O.offsetTree,W)+M;T==="end"?(z+=P+$n(O.sizeTree,pe)[1]-$+F,pe===Q&&(z+=U)):T==="center"?z+=(P+$n(O.sizeTree,pe)[1]-$+F)/2:z-=D,le!==void 0&&le!==0&&(z+=le);const X=re=>{L(),re?(q("retrying to scroll to",{location:I},Bt.DEBUG),Ue(S,I)):(Ue(C,!0),q("list did not change, scroll successful",{},Bt.DEBUG))};if(L(),B==="smooth"){let re=!1;R=et(r,de=>{re=re||de}),E=Vn(b,()=>{X(re)})}else E=Vn(se(r,bb(150)),X);return N=setTimeout(()=>{L()},1200),Ue(h,!0),q("scrolling from index to",{behavior:B,index:pe,top:z},Bt.DEBUG),{behavior:B,top:z}})),p),{scrollTargetReached:C,scrollToIndex:S,topListHeight:A}},ht(Xn,nn,Wa),{singleton:!0});function bb(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function xd(a,r){a===0?r():requestAnimationFrame(()=>{xd(a-1,r)})}function vd(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Ns=Pe(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:d,scrollToIndex:m},{didMount:f}])=>{const x=ue(!0),h=ue(0),p=ue(!0);return we(se(f,Ve(h),Ae(([b,g])=>g!==0),Wn(!1)),x),we(se(f,Ve(h),Ae(([b,g])=>g!==0),Wn(!1)),p),et(se(Lt(r,f),Ve(x,i,a,p),Ae(([[,b],g,{sizeTree:j},S,C])=>b&&(!ot(j)||dd(S))&&!g&&!C),Ve(h)),([,b])=>{Vn(d,()=>{Ue(p,!0)}),xd(4,()=>{Vn(o,()=>{Ue(x,!0)}),Ue(m,b)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:h,scrolledToInitialItem:x}},ht(Xn,nn,ws,Qa),{singleton:!0});function iv(a,r){return Math.abs(a-r)<1.01}const js="up",ms="down",jb="none",Sb={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},kb=0,Cs=Pe(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:d,viewportHeight:m}])=>{const f=ue(!1),x=ue(!0),h=Xe(),p=Xe(),b=ue(4),g=ue(kb),j=Zt(se(Pu(se(Re(d),vl(1),Wn(!0)),se(Re(d),vl(1),Wn(!1),Qh(100))),mt()),!1),S=Zt(se(Pu(se(i,Wn(!0)),se(i,Wn(!1),Qh(200))),mt()),!1);we(se(Lt(Re(d),Re(g)),ge(([R,L])=>R<=L),mt()),x),we(se(x,va(50)),p);const C=bn(se(Lt(o,Re(m),Re(r),Re(a),Re(b)),Qn((R,[{scrollHeight:L,scrollTop:I},O,$,w,D])=>{const M=I+O-L>-D,U={scrollHeight:L,scrollTop:I,viewportHeight:O};if(M){let W,P;return I>R.state.scrollTop?(W="SCROLLED_DOWN",P=R.state.scrollTop-I):(W="SIZE_DECREASED",P=R.state.scrollTop-I||R.scrollTopDelta),{atBottom:!0,atBottomBecause:W,scrollTopDelta:P,state:U}}let q;return U.scrollHeight>R.state.scrollHeight?q="SIZE_INCREASED":O<R.state.viewportHeight?q="VIEWPORT_HEIGHT_DECREASING":I<R.state.scrollTop?q="SCROLLING_UPWARDS":q="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:q,state:U}},Sb),mt((R,L)=>R!==void 0&&R.atBottom===L.atBottom))),A=Zt(se(o,Qn((R,{scrollHeight:L,scrollTop:I,viewportHeight:O})=>{if(!iv(R.scrollHeight,L)){const $=L-(I+O)<1;return R.scrollTop!==I&&$?{changed:!0,jump:R.scrollTop-I,scrollHeight:L,scrollTop:I}:{changed:!0,jump:0,scrollHeight:L,scrollTop:I}}return{changed:!1,jump:0,scrollHeight:L,scrollTop:I}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Ae(R=>R.changed),ge(R=>R.jump)),0);we(se(C,ge(R=>R.atBottom)),f),we(se(f,va(50)),h);const E=ue(ms);we(se(o,ge(({scrollTop:R})=>R),mt(),Qn((R,L)=>gt(S)?{direction:R.direction,prevScrollTop:L}:{direction:L<R.prevScrollTop?js:ms,prevScrollTop:L},{direction:ms,prevScrollTop:0}),ge(R=>R.direction)),E),we(se(o,va(50),Wn(jb)),E);const N=ue(0);return we(se(j,Ae(R=>!R),Wn(0)),N),we(se(d,va(100),Ve(j),Ae(([R,L])=>L),Qn(([R,L],[I])=>[L,I],[0,0]),ge(([R,L])=>L-R)),N),{atBottomState:C,atBottomStateChange:h,atBottomThreshold:b,atTopStateChange:p,atTopThreshold:g,isAtBottom:f,isAtTop:x,isScrolling:j,lastJumpDueToItemResize:A,scrollDirection:E,scrollVelocity:N}},ht(nn)),Ss="top",ks="bottom",Ph="none";function Jh(a,r,i){return typeof a=="number"?i===js&&r===Ss||i===ms&&r===ks?a:0:i===js?r===Ss?a.main:a.reverse:r===ks?a.main:a.reverse}function ex(a,r){return typeof a=="number"?a:a[r]??0}const yd=Pe(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:d}])=>{const m=Xe(),f=ue(0),x=ue(0),h=ue(0),p=Zt(se(Lt(Re(o),Re(d),Re(i),Re(m,gs),Re(h),Re(f),Re(r),Re(a),Re(x)),ge(([b,g,j,[S,C],A,E,N,R,L])=>{const I=b-R,O=E+N,$=Math.max(j-I,0);let w=Ph;const D=ex(L,Ss),M=ex(L,ks);return S-=R,S+=j+N,C+=j+N,C-=R,S>b+O-D&&(w=js),C<b-$+g+M&&(w=ms),w!==Ph?[Math.max(I-j-Jh(A,Ss,w)-D,0),I-$-N+g+Jh(A,ks,w)+M]:null}),Ae(b=>b!==null),mt(gs)),[0,0]);return{increaseViewportBy:x,listBoundary:m,overscan:h,topListHeight:f,visibleRange:p}},ht(nn),{singleton:!0});function wb(a,r,i){if(oo(r)){const o=av(a,r);return[{index:$n(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Bu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function Fi(a,r,i,o,d,m){const{lastIndex:f,lastOffset:x,lastSize:h}=d;let p=0,b=0;if(a.length>0){p=a[0].offset;const A=a[a.length-1];b=A.offset+A.size}const g=i-f,j=x+g*h+(g-1)*o,S=p,C=j-b;return{bottom:b,firstItemIndex:m,items:tx(a,d,m),offsetBottom:C,offsetTop:p,top:S,topItems:tx(r,d,m),topListHeight:r.reduce((A,E)=>E.size+A,0),totalCount:i}}function ov(a,r,i,o,d,m){let f=0;if(i.groupIndices.length>0)for(const b of i.groupIndices){if(b-f>=a)break;f++}const x=a+f,h=vd(r,x),p=Array.from({length:x}).map((b,g)=>({data:m[g+h],index:g+h,offset:0,size:0}));return Fi(p,[],x,d,i,o)}function tx(a,r,i){if(a.length===0)return[];if(!oo(r))return a.map(p=>({...p,index:p.index+i,originalIndex:p.index}));const o=a[0].index,d=a[a.length-1].index,m=[],f=ur(r.groupOffsetTree,o,d);let x,h=0;for(const p of a){(!x||x.end<p.index)&&(x=f.shift(),h=r.groupIndices.indexOf(x.start));let b;p.index===x.start?b={index:h,type:"group"}:b={groupIndex:h,index:p.index-(h+1)+i},m.push({...b,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return m}function nx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const bl=Pe(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:d},m,{listBoundary:f,topListHeight:x,visibleRange:h},{initialTopMostItemIndex:p,scrolledToInitialItem:b},{topListHeight:g},j,{didMount:S},{recalcInProgress:C}])=>{const A=ue([]),E=ue(0),N=Xe(),R=ue(0);we(m.topItemsIndexes,A);const L=Zt(se(Lt(S,C,Re(h,gs),Re(d),Re(o),Re(p),b,Re(A),Re(r),Re(i),Re(R),a),Ae(([w,D,,M,,,,,,,,U])=>{const q=U!==void 0&&U.length!==M;return w&&!D&&!q}),ge(([,,[w,D],M,U,q,W,P,F,_,T,B])=>{var je,$e;const le=U,{offsetTree:Q,sizeTree:pe}=le,z=gt(E);if(M===0)return{...Bu,totalCount:M};if(w===0&&D===0)return z===0?{...Bu,totalCount:M}:ov(z,q,U,F,_,B||[]);if(ot(pe))return z>0?null:Fi(wb(vd(q,M),le,B),[],M,_,le,F);const X=[];if(P.length>0){const Be=P[0],te=P[P.length-1];let ce=0;for(const oe of ur(pe,Be,te)){const fe=oe.value,ye=Math.max(oe.start,Be),_e=Math.min(oe.end,te);for(let Me=ye;Me<=_e;Me++)X.push({data:B==null?void 0:B[Me],index:Me,offset:ce,size:fe}),ce+=fe}}if(!W)return Fi([],X,M,_,le,F);const re=P.length>0?P[P.length-1]+1:0,de=fb(Q,w,D,re);if(de.length===0)return null;const xe=M-1,me=io([],Be=>{for(const te of de){const ce=te.value;let oe=ce.offset,fe=te.start;const ye=ce.size;if(ce.offset<w){fe+=Math.floor((w-ce.offset+_)/(ye+_));const Me=fe-te.start;oe+=Me*ye+Me*_}fe<re&&(oe+=(re-fe)*ye,fe=re);const _e=Math.min(te.end,xe);for(let Me=fe;Me<=_e&&!(oe>=D);Me++)Be.push({data:B==null?void 0:B[Me],index:Me,offset:oe,size:ye}),oe+=ye+_}}),Ne=nx(T,Ss),ie=nx(T,ks);if(me.length>0&&(Ne>0||ie>0)){const Be=me[0],te=me[me.length-1];if(Ne>0&&Be.index>re){const ce=Math.min(Ne,Be.index-re),oe=[];let fe=Be.offset;for(let ye=Be.index-1;ye>=Be.index-ce;ye--){const _e=((je=ur(pe,ye,ye)[0])==null?void 0:je.value)??Be.size;fe-=_e+_,oe.unshift({data:B==null?void 0:B[ye],index:ye,offset:fe,size:_e})}me.unshift(...oe)}if(ie>0&&te.index<xe){const ce=Math.min(ie,xe-te.index);let oe=te.offset+te.size+_;for(let fe=te.index+1;fe<=te.index+ce;fe++){const ye=(($e=ur(pe,fe,fe)[0])==null?void 0:$e.value)??te.size;me.push({data:B==null?void 0:B[fe],index:fe,offset:oe,size:ye}),oe+=ye+_}}}return Fi(me,X,M,_,le,F)}),Ae(w=>w!==null),mt()),Bu);we(se(a,Ae(dd),ge(w=>w==null?void 0:w.length)),d),we(se(L,ge(w=>w.topListHeight)),g),we(g,x),we(se(L,ge(w=>[w.top,w.bottom])),f),we(se(L,ge(w=>w.items)),N);const I=bn(se(L,Ae(({items:w})=>w.length>0),Ve(d,a),Ae(([{items:w},D])=>w[w.length-1].originalIndex===D-1),ge(([,w,D])=>[w-1,D]),mt(gs),ge(([w])=>w))),O=bn(se(L,va(200),Ae(({items:w,topItems:D})=>w.length>0&&w[0].originalIndex===D.length),ge(({items:w})=>w[0].index),mt())),$=bn(se(L,Ae(({items:w})=>w.length>0),ge(({items:w})=>{let D=0,M=w.length-1;for(;w[D].type==="group"&&D<M;)D++;for(;w[M].type==="group"&&M>D;)M--;return{endIndex:w[M].index,startIndex:w[D].index}}),mt(tv)));return{endReached:I,initialItemCount:E,itemsRendered:N,listState:L,minOverscanItemCount:R,rangeChanged:$,startReached:O,topItemsIndexes:A,...j}},ht(Xn,rv,yd,Ns,ws,Cs,Qa,md),{singleton:!0}),cv=Pe(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:d}])=>{const m=Xe(),f=Zt(se(Lt(i,a,o,r,d),ge(([x,h,p,b,g])=>x+h+p+b+g.offsetBottom+g.bottom)),0);return we(Re(f),m),{totalListHeight:f,totalListHeightChanged:m}},ht(nn,bl),{singleton:!0}),Nb=Pe(([{viewportHeight:a},{totalListHeight:r}])=>{const i=ue(!1),o=Zt(se(Lt(i,a,r),Ae(([d])=>d),ge(([,d,m])=>Math.max(0,d-m)),va(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(nn,cv),{singleton:!0}),uv=Pe(()=>({context:ue(null)})),Cb=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...d},viewportBottom:m,viewportTop:f})=>r<f?{...d,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>m?{...d,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,dv=Pe(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:d,headerHeight:m,scrollingInProgress:f,scrollTop:x,viewportHeight:h},{scrollToIndex:p}])=>{const b=Xe();return we(se(b,Ve(r,h,i,m,d,o,x),Ve(a),ge(([[g,j,S,C,A,E,N,R],L])=>{const{calculateViewLocation:I=Cb,done:O,...$}=g,w=lv(g,j,C-1),D=bs(w,j.offsetTree,L)+A+E,M=D+$n(j.sizeTree,w)[1],U=R+E,q=R+S-N,W=I({itemBottom:M,itemTop:D,locationParams:$,viewportBottom:q,viewportTop:U});return W!==null?O&&Vn(se(f,Ae(P=>!P),vl(gt(f)?1:2)),O):O==null||O(),W}),Ae(g=>g!==null)),p),{scrollIntoView:b}},ht(Xn,nn,ws,bl,Wa),{singleton:!0});function ax(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const Eb=(a,r)=>typeof a=="function"?ax(a(r)):r&&ax(a),Tb=Pe(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:d,isAtBottom:m},{scrollToIndex:f},{scrolledToInitialItem:x},{didMount:h,propsReady:p},{log:b},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const C=ue(!1),A=Xe();let E=null;function N(O){Ue(f,{align:"end",behavior:O,index:"LAST"})}et(se(Lt(se(Re(r),vl(1)),h),Ve(Re(C),m,x,g),ge(([[O,$],w,D,M,U])=>{let q=$&&M,W="auto";return q&&(W=Eb(w,D||U),q=q&&W!==!1),{followOutputBehavior:W,shouldFollow:q,totalCount:O}}),Ae(({shouldFollow:O})=>O)),({followOutputBehavior:O,totalCount:$})=>{E!==null&&(E(),E=null),gt(i)!==void 0?requestAnimationFrame(()=>{gt(b)("following output to ",{totalCount:$},Bt.DEBUG),N(O)}):E=Vn(a,()=>{gt(b)("following output to ",{totalCount:$},Bt.DEBUG),N(O),E=null})});function R(O){const $=Vn(d,w=>{O&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&E===null&&(gt(b)("scrolling to bottom due to increased size",{},Bt.DEBUG),N("auto"))});setTimeout($,100)}et(se(Lt(Re(C),r,p),Ae(([O,,$])=>O!==!1&&$),Qn(({value:O},[,$])=>({refreshed:O===$,value:$}),{refreshed:!1,value:0}),Ae(({refreshed:O})=>O),Ve(C,r)),([,O])=>{gt(x)&&R(O!==!1)}),et(A,()=>{R(gt(C)!==!1)}),et(Lt(Re(C),d),([O,$])=>{O!==!1&&!$.atBottom&&$.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&N("auto")});const L=ue(null),I=Xe();return we(Pu(se(Re(o),ge(O=>(O==null?void 0:O.length)??0)),se(Re(r))),I),et(se(Lt(se(I,vl(1)),h),Ve(Re(L),x,g,j),ge(([[O,$],w,D,M,U])=>$&&D&&(w==null?void 0:w({context:U,totalCount:O,scrollingInProgress:M}))),Ae(O=>!!O),va(0)),O=>{E!==null&&(E(),E=null),gt(i)!==void 0?requestAnimationFrame(()=>{gt(b)("scrolling into view",{}),Ue(S,O)}):E=Vn(a,()=>{gt(b)("scrolling into view",{}),Ue(S,O),E=null})}),{autoscrollToBottom:A,followOutput:C,scrollIntoViewOnChange:L}},ht(Xn,Cs,ws,Ns,Qa,Wa,nn,uv,dv)),Rb=Pe(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:d},{initialItemCount:m,listState:f},{didMount:x}])=>(we(se(x,Ve(m),Ae(([,h])=>h!==0),Ve(d,o,r,i,a),ge(([[,h],p,b,g,j,S=[]])=>ov(h,p,b,g,j,S))),f),{}),ht(Xn,Ns,bl,Qa),{singleton:!0}),Ab=Pe(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=ue(0);return et(se(a,Ve(o),Ae(([,d])=>d!==0),ge(([,d])=>({top:d}))),d=>{Vn(se(i,vl(1),Ae(m=>m.items.length>1)),()=>{requestAnimationFrame(()=>{Ue(r,d)})})}),{initialScrollTop:o}},ht(Qa,nn,bl),{singleton:!0}),fv=Pe(([{scrollVelocity:a}])=>{const r=ue(!1),i=Xe(),o=ue(!1);return we(se(a,Ve(o,r,i),Ae(([d,m])=>m!==!1&&m!==void 0),ge(([d,m,f,x])=>{const{enter:h,exit:p}=m;if(f){if(p(d,x))return!1}else if(h(d,x))return!0;return f}),mt()),r),et(se(Lt(r,a,i),Ve(o)),([[d,m,f],x])=>{d&&x!==!1&&x!==void 0&&x.change&&x.change(m,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(Cs),{singleton:!0}),gd=Pe(([{scrollContainerState:a,scrollTo:r}])=>{const i=Xe(),o=Xe(),d=Xe(),m=ue(!1),f=ue(void 0);return we(se(Lt(i,o),ge(([{scrollTop:x,viewportHeight:h},{offsetTop:p,listHeight:b}])=>({scrollHeight:b,scrollTop:Math.max(0,x-p),viewportHeight:h}))),a),we(se(r,Ve(o),ge(([x,{offsetTop:h}])=>({...x,top:x.top+h}))),d),{customScrollParent:f,useWindowScroll:m,windowScrollContainerState:i,windowScrollTo:d,windowViewportRect:o}},ht(nn)),Mb=Pe(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:d},{didMount:m},{useWindowScroll:f,windowScrollContainerState:x,windowViewportRect:h}])=>{const p=Xe(),b=ue(void 0),g=ue(null),j=ue(null);return we(x,g),we(h,j),et(se(p,Ve(r,o,f,g,j,i)),([S,C,A,E,N,R,L])=>{const I=mb(C.sizeTree);E&&N!==null&&R!==null&&(A=N.scrollTop-R.offsetTop),A-=L,S({ranges:I,scrollTop:A})}),we(se(b,Ae(dd),ge(zb)),d),we(se(m,Ve(b),Ae(([,S])=>S!==void 0),mt(),ge(([,S])=>S.ranges)),a),{getState:p,restoreStateFrom:b}},ht(Xn,nn,Ns,Qa,gd));function zb(a){return{align:"start",index:0,offset:a.scrollTop}}const Db=Pe(([{topItemsIndexes:a}])=>{const r=ue(0);return we(se(r,Ae(i=>i>=0),ge(i=>Array.from({length:i}).map((o,d)=>d))),a),{topItemCount:r}},ht(bl));function pv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const Lb=pv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),_b=Pe(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:d,isScrolling:m,lastJumpDueToItemResize:f,scrollDirection:x},{listState:h},{beforeUnshiftWith:p,gap:b,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:C}])=>{const A=bn(se(h,Ve(f),Qn(([,N,R,L],[{bottom:I,items:O,offsetBottom:$,totalCount:w},D])=>{const M=I+$;let U=0;return R===w&&N.length>0&&O.length>0&&(O[0].originalIndex===0&&N[0].originalIndex===0||(U=M-L,U!==0&&(U+=D))),[U,O,w,M]},[0,[],0,0]),Ae(([N])=>N!==0),Ve(o,x,i,d,S,C),Ae(([,N,R,L,,,I])=>!I&&!L&&N!==0&&R===js),ge(([[N],,,,,R])=>(R("Upward scrolling compensation",{amount:N},Bt.DEBUG),N))));function E(N){N>0?(Ue(r,{behavior:"auto",top:-N}),Ue(a,0)):(Ue(a,0),Ue(r,{behavior:"auto",top:-N}))}return et(se(A,Ve(a,m)),([N,R,L])=>{L&&Lb()?Ue(a,R-N):E(-N)}),et(se(Lt(Zt(m,!1),a,C),Ae(([N,R,L])=>!N&&!L&&R!==0),ge(([N,R])=>R),va(1)),E),we(se(g,ge(N=>({top:-N}))),r),et(se(p,Ve(j,b),ge(([N,{groupIndices:R,lastSize:L,sizeTree:I},O])=>{function $(q){return q*(L+O)}if(R.length===0)return $(N);let w=0;const D=ys(I,0);let M=0,U=0;for(;M<N;){M++,w+=D;let q=R.length===U+1?1/0:R[U+1]-R[U]-1;M+q>N&&(w-=D,q=N-M+1),M+=q,w+=$(q),U++}return w})),N=>{Ue(a,N),requestAnimationFrame(()=>{Ue(r,{top:N}),requestAnimationFrame(()=>{Ue(a,0),Ue(C,!1)})})}),{deviation:a}},ht(nn,Cs,bl,Xn,Wa,md)),Ob=Pe(([a,r,i,o,d,m,f,x,h,p,b])=>({...a,...r,...i,...o,...d,...m,...f,...x,...h,...p,...b}),ht(yd,Rb,Qa,fv,cv,Ab,Nb,gd,dv,Wa,uv)),mv=Pe(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:d,gap:m,groupIndices:f,heightEstimates:x,itemSize:h,sizeRanges:p,sizes:b,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:C,initialTopMostItemIndex:A,scrolledToInitialItem:E},N,R,L,I,{scrollToIndex:O},$,{topItemCount:w},{groupCounts:D},M])=>{const{listState:U,minOverscanItemCount:q,topItemsIndexes:W,rangeChanged:P,...F}=I;return we(P,M.scrollSeekRangeChanged),we(se(M.windowViewportRect,ge(_=>_.visibleHeight)),N.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:d,gap:m,groupCounts:D,heightEstimates:x,initialItemFinalLocationReached:C,initialTopMostItemIndex:A,scrolledToInitialItem:E,sizeRanges:p,topItemCount:w,topItemsIndexes:W,totalCount:j,...L,groupIndices:f,itemSize:h,listState:U,minOverscanItemCount:q,scrollToIndex:O,statefulTotalCount:g,trackItemSizes:S,rangeChanged:P,...F,...M,...N,sizes:b,...R}},ht(Xn,Ns,nn,Mb,Tb,bl,ws,_b,Db,rv,Ob));function Bb(a,r){const i={},o={};let d=0;const m=a.length;for(;d<m;)o[a[d]]=1,d+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const $i=typeof document<"u"?ke.useLayoutEffect:ke.useEffect;function hv(a,r,i){const o=Object.keys(r.required||{}),d=Object.keys(r.optional||{}),m=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),x=ke.createContext({});function h(E,N){E.propsReady!==void 0&&Ue(E.propsReady,!1);for(const R of o){const L=E[r.required[R]];Ue(L,N[R])}for(const R of d)if(R in N){const L=E[r.optional[R]];Ue(L,N[R])}E.propsReady!==void 0&&Ue(E.propsReady,!0)}function p(E){return m.reduce((N,R)=>(N[R]=L=>{const I=E[r.methods[R]];Ue(I,L)},N),{})}function b(E){return f.reduce((N,R)=>(N[R]=J0(E[r.events[R]]),N),{})}const g=ke.forwardRef(function(E,N){const{children:R,...L}=E,[I]=ke.useState(()=>io(tb(a),w=>{h(w,L)})),[O]=ke.useState(Wh(b,I));$i(()=>{for(const w of f)w in L&&et(O[w],L[w]);return()=>{Object.values(O).map(fd)}},[L,O,I]),$i(()=>{h(I,L)}),ke.useImperativeHandle(N,Kh(p(I)));const $=i;return n.jsx(x.Provider,{value:I,children:i!==void 0?n.jsx($,{...Bb([...o,...d,...f],L),children:R}):R})}),j=E=>{const N=ke.useContext(x);return ke.useCallback(R=>{Ue(N[E],R)},[N,E])},S=E=>{const N=ke.useContext(x)[E],R=ke.useCallback(L=>et(N,L),[N]);return ke.useSyncExternalStore(R,()=>gt(N),()=>gt(N))},C=E=>{const N=ke.useContext(x)[E],[R,L]=ke.useState(Wh(gt,N));return $i(()=>et(N,I=>{I!==R&&L(Kh(I))}),[N,R]),R},A=parseInt(ke.version)>=18?S:C;return{Component:g,useEmitter:(E,N)=>{const R=ke.useContext(x)[E];$i(()=>et(R,N),[N,R])},useEmitterValue:A,usePublisher:j}}const xv=ke.createContext(void 0),vv=ke.createContext(void 0),Hu="-webkit-sticky",lx="sticky",bd=pv(()=>{if(typeof document>"u")return lx;const a=document.createElement("div");return a.style.position=Hu,a.style.position===Hu?Hu:lx}),yv=typeof document<"u"?ke.useLayoutEffect:ke.useEffect;function Uu(a){return"self"in a}function Hb(a){return"body"in a}function gv(a,r,i,o=hr,d,m){const f=ke.useRef(null),x=ke.useRef(null),h=ke.useRef(null),p=ke.useCallback(j=>{let S,C,A;const E=j.target;if(Hb(E)||Uu(E)){const R=Uu(E)?E:E.defaultView;A=m===!0?R.scrollX:R.scrollY,S=m===!0?R.document.documentElement.scrollWidth:R.document.documentElement.scrollHeight,C=m===!0?R.innerWidth:R.innerHeight}else A=m===!0?E.scrollLeft:E.scrollTop,S=m===!0?E.scrollWidth:E.scrollHeight,C=m===!0?E.offsetWidth:E.offsetHeight;const N=()=>{a({scrollHeight:S,scrollTop:Math.max(A,0),viewportHeight:C})};j.suppressFlushSync===!0?N():G1.flushSync(N),x.current!==null&&(A===x.current||A<=0||A===S-C)&&(x.current=null,r(!0),h.current&&(clearTimeout(h.current),h.current=null))},[a,r,m]);ke.useEffect(()=>{const j=d||f.current;return o(d||f.current),p({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",p,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",p)}},[f,p,i,o,d]);function b(j){const S=f.current;if(!S||(m===!0?"offsetWidth"in S&&S.offsetWidth===0:"offsetHeight"in S&&S.offsetHeight===0))return;const C=j.behavior==="smooth";let A,E,N;Uu(S)?(E=Math.max(Ya(S.document.documentElement,m===!0?"width":"height"),m===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),A=m===!0?S.innerWidth:S.innerHeight,N=m===!0?window.scrollX:window.scrollY):(E=S[m===!0?"scrollWidth":"scrollHeight"],A=Ya(S,m===!0?"width":"height"),N=S[m===!0?"scrollLeft":"scrollTop"]);const R=E-A;if(j.top=Math.ceil(Math.max(Math.min(R,j.top),0)),iv(A,E)||j.top===N){a({scrollHeight:E,scrollTop:N,viewportHeight:A}),C&&r(!0);return}C?(x.current=j.top,h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,x.current=null,r(!0)},1e3)):x.current=null,m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},left:j.top}),S.scrollTo(j)}function g(j){m===!0&&(j={...j.behavior!==void 0?{behavior:j.behavior}:{},...j.top!==void 0?{left:j.top}:{}}),f.current.scrollBy(j)}return{scrollByCallback:g,scrollerRef:f,scrollToCallback:b}}function jd(a){return a}const Ub=Pe(()=>{const a=ue(x=>`Item ${x}`),r=ue(x=>`Group ${x}`),i=ue({}),o=ue(jd),d=ue("div"),m=ue(hr),f=(x,h=null)=>Zt(se(i,ge(p=>p[x]),mt()),h);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:d,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:m,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),Ib=Pe(([a,r])=>({...a,...r}),ht(mv,Ub)),Vb=({height:a})=>n.jsx("div",{style:{height:a}}),$b={overflowAnchor:"none",position:bd(),zIndex:1},bv={overflowAnchor:"none"},Gb={...bv,display:"inline-block",height:"100%"},rx=ke.memo(function({showTopList:a=!1}){const r=Le("listState"),i=Ln("sizeRanges"),o=Le("useWindowScroll"),d=Le("customScrollParent"),m=Ln("windowScrollContainerState"),f=Ln("scrollContainerState"),x=d||o?m:f,h=Le("itemContent"),p=Le("context"),b=Le("groupContent"),g=Le("trackItemSizes"),j=Le("itemSize"),S=Le("log"),C=Ln("gap"),A=Le("horizontalDirection"),{callbackRef:E}=lb(i,j,g,a?hr:x,S,C,d,A,Le("skipAnimationFrameInResizeObserver")),[N,R]=ke.useState(0);Sd("deviation",F=>{N!==F&&R(F)});const L=Le("EmptyPlaceholder"),I=Le("ScrollSeekPlaceholder")??Vb,O=Le("ListComponent"),$=Le("ItemComponent"),w=Le("GroupComponent"),D=Le("computeItemKey"),M=Le("isSeeking"),U=Le("groupIndices").length>0,q=Le("alignToBottom"),W=Le("initialItemFinalLocationReached"),P=a?{}:{boxSizing:"border-box",...A?{display:"inline-block",height:"100%",marginLeft:N!==0?N:q?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:N!==0?N:q?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...W?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&L!==null&&L!==void 0?n.jsx(L,{...Ft(L,p)}):n.jsx(O,{...Ft(O,p),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:P,children:(a?r.topItems:r.items).map(F=>{const _=F.originalIndex,T=D(_+r.firstItemIndex,F.data,p);return M?v.createElement(I,{...Ft(I,p),height:F.size,index:F.index,key:T,type:F.type||"item",...F.type==="group"?{}:{groupIndex:F.groupIndex}}):F.type==="group"?v.createElement(w,{...Ft(w,p),"data-index":_,"data-item-index":F.index,"data-known-size":F.size,key:T,style:$b},b(F.index,p)):v.createElement($,{...Ft($,p),...Wb($,F.data),"data-index":_,"data-item-group-index":F.groupIndex,"data-item-index":F.index,"data-known-size":F.size,key:T,style:A?Gb:bv},U?h(F.index,F.groupIndex,F.data,p):h(F.index,F.data,p))})})}),qb={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Yb={outline:"none",overflowX:"auto",position:"relative"},co=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Kb={position:bd(),top:0,width:"100%",zIndex:1};function Ft(a,r){if(typeof a!="string")return{context:r}}function Wb(a,r){return{item:typeof a=="string"?void 0:r}}const Qb=ke.memo(function(){const a=Le("HeaderComponent"),r=Ln("headerHeight"),i=Le("HeaderFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),d=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Ft(a,d)})}):null}),Xb=ke.memo(function(){const a=Le("FooterComponent"),r=Ln("footerHeight"),i=Le("HeaderFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),d=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Ft(a,d)})}):null});function jv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return ke.memo(function({children:o,style:d,context:m,...f}){const x=i("scrollContainerState"),h=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),b=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:C}=gv(x,p,h,b,void 0,g);return a("scrollTo",C),a("scrollBy",j),n.jsx(h,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?Yb:qb,...d},tabIndex:0,...f,...Ft(h,m),children:o})})}function Sv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return ke.memo(function({children:o,style:d,context:m,...f}){const x=i("windowScrollContainerState"),h=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),b=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=ke.useRef(null),C=r("scrollerRef"),{scrollByCallback:A,scrollerRef:E,scrollToCallback:N}=gv(x,p,h,C,j);return yv(()=>{var R;return E.current=j||((R=S.current)==null?void 0:R.ownerDocument.defaultView),()=>{E.current=null}},[E,j]),a("windowScrollTo",N),a("scrollBy",A),n.jsx(h,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...d,...b!==0?{height:b+g}:void 0},...f,...Ft(h,m),children:o})})}const Fb=({children:a})=>{const r=ke.useContext(xv),i=Ln("viewportHeight"),o=Ln("fixedItemHeight"),d=Le("alignToBottom"),m=Le("horizontalDirection"),f=ke.useMemo(()=>Wx(i,h=>Ya(h,m?"width":"height")),[i,m]),x=gl(f,!0,Le("skipAnimationFrameInResizeObserver"));return ke.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:x,style:co(d),children:a})},Zb=({children:a})=>{const r=ke.useContext(xv),i=Ln("windowViewportRect"),o=Ln("fixedItemHeight"),d=Le("customScrollParent"),m=Xx(i,d,Le("skipAnimationFrameInResizeObserver")),f=Le("alignToBottom");return ke.useEffect(()=>{r&&(o(r.itemHeight),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:100}))},[r,i,o]),n.jsx("div",{"data-viewport-type":"window",ref:m,style:co(f),children:a})},Pb=({children:a})=>{const r=Le("TopItemListComponent")??"div",i=Le("headerHeight"),o={...Kb,marginTop:`${i}px`},d=Le("context");return n.jsx(r,{style:o,...Ft(r,d),children:a})},Jb=ke.memo(function(a){const r=Le("useWindowScroll"),i=Le("topItemsIndexes").length>0,o=Le("customScrollParent"),d=Le("context");return n.jsxs(o||r?n2:t2,{...a,context:d,children:[i&&n.jsx(Pb,{children:n.jsx(rx,{showTopList:!0})}),n.jsxs(o||r?Zb:Fb,{children:[n.jsx(Qb,{}),n.jsx(rx,{}),n.jsx(Xb,{})]})]})}),{Component:e2,useEmitter:Sd,useEmitterValue:Le,usePublisher:Ln}=hv(Ib,{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"}},Jb),t2=jv({useEmitter:Sd,useEmitterValue:Le,usePublisher:Ln}),n2=Sv({useEmitter:Sd,useEmitterValue:Le,usePublisher:Ln}),a2=e2,l2=Pe(()=>{const a=ue(p=>n.jsxs("td",{children:["Item $",p]})),r=ue(null),i=ue(p=>n.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=ue(null),d=ue(null),m=ue({}),f=ue(jd),x=ue(hr),h=(p,b=null)=>Zt(se(m,ge(g=>g[p]),mt()),b);return{components:m,computeItemKey:f,context:r,EmptyPlaceholder:h("EmptyPlaceholder"),FillerRow:h("FillerRow"),fixedFooterContent:d,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:h("Scroller","div"),scrollerRef:x,ScrollSeekPlaceholder:h("ScrollSeekPlaceholder"),TableBodyComponent:h("TableBody","tbody"),TableComponent:h("Table","table"),TableFooterComponent:h("TableFoot","tfoot"),TableHeadComponent:h("TableHead","thead"),TableRowComponent:h("TableRow","tr"),GroupComponent:h("Group","tr")}});ht(mv,l2);bd();const sx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},r2={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:ix,floor:to,max:hs,min:Iu,round:ox}=Math;function cx(a,r,i){return Array.from({length:r-a+1}).map((o,d)=>({data:i===null?null:i[d+a],index:d+a}))}function s2(a){return{...r2,items:a}}function Gi(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function i2(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const o2=Pe(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:d,headerHeight:m,scrollBy:f,scrollContainerState:x,scrollTo:h,scrollTop:p,smoothScrollTargetReached:b,viewportHeight:g},j,S,{didMount:C,propsReady:A},{customScrollParent:E,useWindowScroll:N,windowScrollContainerState:R,windowScrollTo:L,windowViewportRect:I},O])=>{const $=ue(0),w=ue(0),D=ue(sx),M=ue({height:0,width:0}),U=ue({height:0,width:0}),q=Xe(),W=Xe(),P=ue(0),F=ue(null),_=ue({column:0,row:0}),T=Xe(),B=Xe(),le=ue(!1),Q=ue(0),pe=ue(!0),z=ue(!1),X=ue(!1);et(se(C,Ve(Q),Ae(([ie,je])=>je!==0)),()=>{Ue(pe,!1)}),et(se(Lt(C,pe,U,M,Q,z),Ae(([ie,je,$e,Be,,te])=>ie&&!je&&$e.height!==0&&Be.height!==0&&!te)),([,,,,ie])=>{Ue(z,!0),xd(1,()=>{Ue(q,ie)}),Vn(se(p),()=>{Ue(r,[0,0]),Ue(pe,!0)})}),we(se(B,Ae(ie=>ie!=null&&ie.scrollTop>0),Wn(0)),w),et(se(C,Ve(B),Ae(([,ie])=>ie!=null)),([,ie])=>{ie&&(Ue(M,ie.viewport),Ue(U,ie.item),Ue(_,ie.gap),ie.scrollTop>0&&(Ue(le,!0),Vn(se(p,vl(1)),je=>{Ue(le,!1)}),Ue(h,{top:ie.scrollTop})))}),we(se(M,ge(({height:ie})=>ie)),g),we(se(Lt(Re(M,Gi),Re(U,Gi),Re(_,(ie,je)=>ie!==void 0&&ie.column===je.column&&ie.row===je.row),Re(p)),ge(([ie,je,$e,Be])=>({gap:$e,item:je,scrollTop:Be,viewport:ie}))),T),we(se(Lt(Re($),o,Re(_,i2),Re(U,Gi),Re(M,Gi),Re(F),Re(w),Re(le),Re(pe),Re(Q)),Ae(([,,,,,,,ie])=>!ie),ge(([ie,[je,$e],Be,te,ce,oe,fe,,ye,_e])=>{const{column:Me,row:dt}=Be,{height:Pt,width:ct}=te,{width:Vt}=ce;if(fe===0&&(ie===0||Vt===0))return sx;if(ct===0){const nt=vd(_e,ie),Xa=nt+Math.max(fe-1,0);return s2(cx(nt,Xa,oe))}const $t=kv(Vt,ct,Me);let tt,jt;ye?je===0&&$e===0&&fe>0?(tt=0,jt=fe-1):(tt=$t*to((je+dt)/(Pt+dt)),jt=$t*ix(($e+dt)/(Pt+dt))-1,jt=Iu(ie-1,hs(jt,$t-1)),tt=Iu(jt,hs(0,tt))):(tt=0,jt=-1);const he=cx(tt,jt,oe),{bottom:Rt,top:ze}=ux(ce,Be,te,he),xt=ix(ie/$t),Qt=xt*Pt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Pt,items:he,itemWidth:ct,offsetBottom:Qt,offsetTop:ze,top:ze}})),D),we(se(F,Ae(ie=>ie!==null),ge(ie=>ie.length)),$),we(se(Lt(M,U,D,_),Ae(([ie,je,{items:$e}])=>$e.length>0&&je.height!==0&&ie.height!==0),ge(([ie,je,{items:$e},Be])=>{const{bottom:te,top:ce}=ux(ie,Be,je,$e);return[ce,te]}),mt(gs)),r);const re=ue(!1);we(se(p,Ve(re),ge(([ie,je])=>je||ie!==0)),re);const de=bn(se(Lt(D,$),Ae(([{items:ie}])=>ie.length>0),Ve(re),Ae(([[ie,je],$e])=>{const Be=ie.items[ie.items.length-1].index===je-1;return($e||ie.bottom>0&&ie.itemHeight>0&&ie.offsetBottom===0&&ie.items.length===je)&&Be}),ge(([[,ie]])=>ie-1),mt())),xe=bn(se(Re(D),Ae(({items:ie})=>ie.length>0&&ie[0].index===0),Wn(0),mt())),me=bn(se(Re(D),Ve(le),Ae(([{items:ie},je])=>ie.length>0&&!je),ge(([{items:ie}])=>({endIndex:ie[ie.length-1].index,startIndex:ie[0].index})),mt(tv),va(0)));we(me,S.scrollSeekRangeChanged),we(se(q,Ve(M,U,$,_),ge(([ie,je,$e,Be,te])=>{const ce=sv(ie),{align:oe,behavior:fe,offset:ye}=ce;let _e=ce.index;_e==="LAST"&&(_e=Be-1),_e=hs(0,_e,Iu(Be-1,_e));let Me=ad(je,te,$e,_e);return oe==="end"?Me=ox(Me-je.height+$e.height):oe==="center"&&(Me=ox(Me-je.height/2+$e.height/2)),ye!==void 0&&ye!==0&&(Me+=ye),{behavior:fe,top:Me}})),h);const Ne=Zt(se(D,ge(ie=>ie.offsetBottom+ie.bottom)),0);return we(se(I,ge(ie=>({height:ie.visibleHeight,width:ie.visibleWidth}))),M),{customScrollParent:E,data:F,deviation:P,footerHeight:d,gap:_,headerHeight:m,increaseViewportBy:a,initialItemCount:w,itemDimensions:U,overscan:i,restoreStateFrom:B,scrollBy:f,scrollContainerState:x,scrollHeight:W,scrollTo:h,scrollToIndex:q,scrollTop:p,smoothScrollTargetReached:b,totalCount:$,useWindowScroll:N,viewportDimensions:M,windowScrollContainerState:R,windowScrollTo:L,windowViewportRect:I,...S,gridState:D,horizontalDirection:X,initialTopMostItemIndex:Q,totalListHeight:Ne,...j,endReached:de,propsReady:A,rangeChanged:me,startReached:xe,stateChanged:T,stateRestoreInProgress:le,...O}},ht(yd,nn,Cs,fv,Qa,gd,Wa));function kv(a,r,i){return hs(1,to((a+i)/(to(r)+i)))}function ux(a,r,i,o){const{height:d}=i;if(d===void 0||o.length===0)return{bottom:0,top:0};const m=ad(a,r,i,o[0].index);return{bottom:ad(a,r,i,o[o.length-1].index)+d,top:m}}function ad(a,r,i,o){const d=kv(a.width,i.width,r.column),m=to(o/d),f=m*i.height+hs(0,m-1)*r.row;return f>0?f+r.row:f}const c2=Pe(()=>{const a=ue(g=>`Item ${g}`),r=ue({}),i=ue(null),o=ue("virtuoso-grid-item"),d=ue("virtuoso-grid-list"),m=ue(jd),f=ue("div"),x=ue(hr),h=(g,j=null)=>Zt(se(r,ge(S=>S[g]),mt()),j),p=ue(!1),b=ue(!1);return we(Re(b),p),{components:r,computeItemKey:m,context:i,FooterComponent:h("Footer"),HeaderComponent:h("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:h("Item","div"),itemContent:a,listClassName:d,ListComponent:h("List","div"),readyStateChanged:p,reportReadyState:b,ScrollerComponent:h("Scroller","div"),scrollerRef:x,ScrollSeekPlaceholder:h("ScrollSeekPlaceholder","div")}}),u2=Pe(([a,r])=>({...a,...r}),ht(o2,c2)),d2=ke.memo(function(){const a=yt("gridState"),r=yt("listClassName"),i=yt("itemClassName"),o=yt("itemContent"),d=yt("computeItemKey"),m=yt("isSeeking"),f=_n("scrollHeight"),x=yt("ItemComponent"),h=yt("ListComponent"),p=yt("ScrollSeekPlaceholder"),b=yt("context"),g=_n("itemDimensions"),j=_n("gap"),S=yt("log"),C=yt("stateRestoreInProgress"),A=_n("reportReadyState"),E=gl(ke.useMemo(()=>N=>{const R=N.parentElement.parentElement.scrollHeight;f(R);const L=N.firstChild;if(L!==null){const{height:I,width:O}=L.getBoundingClientRect();g({height:I,width:O})}j({column:dx("column-gap",getComputedStyle(N).columnGap,S),row:dx("row-gap",getComputedStyle(N).rowGap,S)})},[f,g,j,S]),!0,!1);return yv(()=>{a.itemHeight>0&&a.itemWidth>0&&A(!0)},[a]),C?null:n.jsx(h,{className:r,ref:E,...Ft(h,b),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(N=>{const R=d(N.index,N.data,b);return m?n.jsx(p,{...Ft(p,b),height:a.itemHeight,index:N.index,width:a.itemWidth},R):v.createElement(x,{...Ft(x,b),className:i,"data-index":N.index,key:R},o(N.index,N.data,b))})})}),f2=ke.memo(function(){const a=yt("HeaderComponent"),r=_n("headerHeight"),i=yt("headerFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Ft(a,d)})}):null}),p2=ke.memo(function(){const a=yt("FooterComponent"),r=_n("footerHeight"),i=yt("headerFooterTag"),o=gl(ke.useMemo(()=>m=>{r(Ya(m,"height"))},[r]),!0,!1),d=yt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Ft(a,d)})}):null}),m2=({children:a})=>{const r=ke.useContext(vv),i=_n("itemDimensions"),o=_n("viewportDimensions"),d=gl(ke.useMemo(()=>m=>{o(m.getBoundingClientRect())},[o]),!0,!1);return ke.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:d,style:co(!1),children:a})},h2=({children:a})=>{const r=ke.useContext(vv),i=_n("windowViewportRect"),o=_n("itemDimensions"),d=yt("customScrollParent"),m=Xx(i,d,!1);return ke.useEffect(()=>{r&&(o({height:r.itemHeight,width:r.itemWidth}),i({listHeight:0,offsetTop:0,visibleHeight:r.viewportHeight,visibleWidth:r.viewportWidth}))},[r,i,o]),n.jsx("div",{ref:m,style:co(!1),children:a})},x2=ke.memo(function({...a}){const r=yt("useWindowScroll"),i=yt("customScrollParent"),o=i||r?y2:v2,d=i||r?h2:m2,m=yt("context");return n.jsx(o,{...a,...Ft(o,m),children:n.jsxs(d,{children:[n.jsx(f2,{}),n.jsx(d2,{}),n.jsx(p2,{})]})})}),{useEmitter:wv,useEmitterValue:yt,usePublisher:_n}=hv(u2,{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"}},x2),v2=jv({useEmitter:wv,useEmitterValue:yt,usePublisher:_n}),y2=Sv({useEmitter:wv,useEmitterValue:yt,usePublisher:_n});function dx(a,r,i){return r!=="normal"&&(r==null?void 0:r.endsWith("px"))!==!0&&i(`${a} was not resolved to pixel value correctly`,r,Bt.WARN),r==="normal"?0:parseInt(r??"0",10)}const g2={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Nv={source:"Own",installed:"Installed"};function b2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}try{if(typeof sessionStorage<"u"){const r=sessionStorage.getItem(a);if(r!=null)return r==="true"}}catch{}return!1}function j2(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function fx({origin:a,count:r,filteredCount:i,updateCount:o,children:d}){const m=g2[a],[f,x]=v.useState(()=>b2(m)),h=v.useCallback(()=>{x(j=>{const S=!j;return j2(m,S),S})},[m]),p=Nv[a],b=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":b,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:b,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":g,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(k2,{collapsed:f}),n.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),n.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:i!=null&&i!==r?`(${i} of ${r})`:`(${r})`}),o!=null&&o>0&&n.jsx(S2,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":b,style:{display:"flex",flexDirection:"column",minHeight:0},children:d})]})}function S2({origin:a,updateCount:r}){const[i,o]=v.useState(!1),d=Nv[a].toLowerCase(),m=`${r} updates available in ${d} section, view all`;return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":m,onClick:f=>{f.stopPropagation(),window.location.hash="#/updates"},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),f.stopPropagation(),window.location.hash="#/updates")},onFocus:()=>o(!0),onBlur:()=>o(!1),style:{display:"inline-flex",alignItems:"center",gap:2,fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3,outline:i?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[r," updates",n.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function k2({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 w2(a,r){const i=r.trim().toLowerCase();return i?a.skill.toLowerCase().includes(i)||a.plugin.toLowerCase().includes(i)||a.dir.toLowerCase().includes(i):!0}function N2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:d="Invalid filter expression"}){const m=v.useRef(null),f=v.useId(),x=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function h(p){var j;if(p.key!=="/")return;const b=p.target;if(!b)return;const g=b.tagName;g==="INPUT"||g==="TEXTAREA"||b.isContentEditable||(p.preventDefault(),(j=m.current)==null||j.focus())}return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[]),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":x?!0:void 0,"aria-describedby":x?f:void 0,value:a,placeholder:i,onChange:h=>r(h.currentTarget.value),onKeyDown:h=>{h.key==="Escape"&&(r(""),h.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"}}),x&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:d}),n.jsx("kbd",{"aria-hidden":"true",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",border:"1px solid var(--border-default)",padding:"1px 5px",borderRadius:3,display:a?"none":"inline-block"},children:"/"})]})}function C2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function E2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const d=a.origin==="installed"?"var(--status-installed)":"var(--status-own)";return n.jsxs("button",{type:"button",onClick:i,onContextMenu:o?m=>{m.preventDefault(),o(m,a)}:void 0,"aria-current":r?"true":void 0,"aria-selected":!!r,"data-testid":"skill-row","data-selected":r,"data-origin":a.origin,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:r?"inset 2px 0 0 var(--color-accent, var(--accent-surface))":"none",border:"none",borderRadius:0,color:"var(--text-primary)",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,textAlign:"left",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease), box-shadow var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",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}),n.jsx(C2,{skill:a})]})}const Cv=v.memo(E2);function T2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:d}){const m=[...r].sort((f,x)=>f.skill.localeCompare(x.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:m.map(f=>{const x=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(Cv,{skill:f,isSelected:x,onSelect:()=>o(f),onContextMenu:d})},`${f.plugin}/${f.skill}`)})})]})}function R2(){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 A2(a){const r=a.key.split("+").map(x=>x.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,d=!!a.shift,m=!!a.alt,f=a.key;if(r.length>1){for(const x of r.slice(0,-1)){const h=x.toLowerCase();h==="cmd"||h==="meta"||h==="⌘"?i=!0:h==="ctrl"||h==="control"?o=!0:h==="shift"?d=!0:(h==="alt"||h==="option")&&(m=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:d,alt:m,allowInInputs:!!a.allowInInputs,handler:a.handler}}function M2(a){if(!a||!(a instanceof HTMLElement))return!1;const r=a.tagName;if(r==="INPUT"||r==="TEXTAREA"||a.isContentEditable)return!0;const i=a.getAttribute("contenteditable");return i!=null&&i!=="false"||a.getAttribute("role")==="textbox"}function z2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,d=!!a.shiftKey,m=!!a.altKey;return i!==r.meta||o!==r.ctrl||d!==r.shift||m!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function Ev(a,r={}){const{enabled:i=!0,target:o}=r,d=v.useRef([]),m=Array.isArray(a)?a:[a];d.current=m.map(A2),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function x(h){const p=h,b=M2(p.target);for(const g of d.current){if(!z2(p,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(b&&!g.allowInInputs&&!j)){g.handler(p);return}}}return f.addEventListener("keydown",x),()=>{f.removeEventListener("keydown",x)}},[i,o])}const D2=200;function L2(a,r){const i=[],o=[];for(const m of a)(m.origin==="installed"?o:i).push(m);function d(m){var p;const f=m.filter(b=>w2(b,r)),x={};for(const b of f)(x[p=b.plugin]||(x[p]=[])).push(b);const h=Object.entries(x).sort((b,g)=>b[0].localeCompare(g[0]));return{total:m.length,filtered:f.length,byPlugin:h}}return{own:d(i),installed:d(o)}}function _2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:d,onRetry:m,onContextMenu:f,outdatedByOrigin:x}){const[h,p]=v.useState(""),b=v.useDeferredValue(h),{own:g,installed:j}=v.useMemo(()=>L2(a,b),[a,b]),C=g.filtered+j.filtered>=D2,A=v.useMemo(()=>{const R=L=>{const I=[];for(const[,O]of L){const $=[...O].sort((w,D)=>w.skill.localeCompare(D.skill));I.push(...$)}return I};return[...R(g.byPlugin),...R(j.byPlugin)]},[g.byPlugin,j.byPlugin]),E=v.useMemo(()=>r?A.findIndex(R=>R.plugin===r.plugin&&R.skill===r.skill):-1,[A,r]),N=v.useCallback(R=>{if(A.length===0)return;const L=E<0?R>0?0:A.length-1:Math.min(Math.max(E+R,0),A.length-1);i(A[L])},[A,E,i]);return Ev([{key:"j",handler:()=>N(1)},{key:"k",handler:()=>N(-1)},{key:"Enter",handler:()=>{E>=0&&i(A[E])}}],{enabled:!o&&!d}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[n.jsx(N2,{value:h,onChange:p}),o&&n.jsx(I2,{}),!o&&d&&n.jsx(V2,{error:d,onRetry:m}),!o&&!d&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(fx,{origin:"source",count:g.total,filteredCount:h?g.filtered:null,updateCount:x==null?void 0:x.source,children:g.filtered===0?n.jsx(B2,{queryActive:!!h}):n.jsx(px,{items:g.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:C})}),n.jsx(U2,{}),n.jsx(fx,{origin:"installed",count:j.total,filteredCount:h?j.filtered:null,updateCount:x==null?void 0:x.installed,children:j.filtered===0?n.jsx(H2,{queryActive:!!h}):n.jsx(px,{items:j.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:C})})]})]})}function O2(a){const r=[];for(const[i,o]of a){const d=[...o].sort((m,f)=>m.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:d.length});for(const m of d)r.push({kind:"row",skill:m})}return r}function px({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:d}){if(d){const m=O2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(a2,{overscan:4,totalCount:m.length,itemContent:f=>{const x=m[f];if(!x)return null;if(x.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:x.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",x.count,")"]})]});const h=x.skill,p=!!r&&r.plugin===h.plugin&&r.skill===h.skill;return n.jsx(Cv,{skill:h,isSelected:p,onSelect:()=>i(h),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([m,f])=>n.jsx(T2,{plugin:m,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},m))})}function B2({queryActive:a}){return a?n.jsx(no,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(no,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(Tv,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function H2({queryActive:a}){return a?n.jsx(no,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(no,{headline:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Tv,{children:"vskill install <plugin>"})," to add one."]})})}function no({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function Tv({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 U2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function I2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(R2,{},a))})}function V2({error:a,onRetry:r}){return n.jsxs("div",{role:"alert",style:{margin:"12px 14px",padding:12,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-canvas)",color:"var(--text-primary)",fontSize:12},children:[n.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),n.jsxs("details",{children:[n.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:$2(a)}),n.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:a})]}),r&&n.jsx("button",{type:"button",onClick:r,style:{marginTop:8,background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"4px 10px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry"})]})}function $2(a){const r=a.split(`
54
- `)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const Rv=240,Av=480,Mv="vskill-sidebar-width",xs=320;function kd(a){return Number.isFinite(a)?Math.round(Math.max(Rv,Math.min(Av,a))):xs}function G2(){try{const a=localStorage.getItem(Mv);if(!a)return xs;const r=Number(a);return Number.isFinite(r)?kd(r):xs}catch{return xs}}function q2(a){try{localStorage.setItem(Mv,String(kd(a)))}catch{}}function Y2({initialWidth:a,onChange:r}){const i=v.useRef({startX:0,startWidth:a,pointerId:null}),o=v.useRef(a);return v.useEffect(()=>{o.current=a},[a]),v.useEffect(()=>{function d(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const x=f.clientX-i.current.startX,h=kd(i.current.startWidth+x);o.current=h,r(h)}function m(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,q2(o.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)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":Rv,"aria-valuemax":Av,"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=o.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 K2({connected:a,hint:r,onRetry:i}){return a?null:n.jsxs("aside",{"aria-live":"assertive",role:"alert",style:{display:"flex",alignItems:"center",gap:10,padding:"6px 12px",background:"color-mix(in srgb, var(--status-own) 15%, transparent)",borderBottom:"1px solid var(--border-default)",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),n.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),r&&n.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:r}),n.jsx("div",{style:{flex:1}}),i&&n.jsx("button",{type:"button",onClick:i,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:"Retry now"})]})}function zv(a){if(a!==void 0)try{return JSON.stringify(a)}catch(r){console.error("Failed to serialize request body:",r);try{const i=new WeakSet;return JSON.stringify(a,(o,d)=>{if(typeof d=="object"&&d!==null){if(i.has(d))return"[Circular]";i.add(d)}return d})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Vu(){const[a,r]=v.useState([]),[i,o]=v.useState(!1),[d,m]=v.useState(!1),[f,x]=v.useState(null),h=v.useRef(null),p=v.useCallback(async(g,j)=>{r([]),o(!0),m(!1),x(null);const S=new AbortController;h.current=S;try{const C=zv(j),A=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:C,signal:S.signal});if(!A.ok||!A.body){let I=`HTTP ${A.status}`;try{const O=await A.json();O.error&&(I=O.error)}catch{}throw new Error(I)}const E=A.body.getReader(),N=new TextDecoder;let R="",L="";for(;;){const{done:I,value:O}=await E.read();if(I)break;R+=N.decode(O,{stream:!0});const $=R.split(`
55
- `);R=$.pop()||"";for(const w of $)if(w.startsWith("event: "))L=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),M={event:L,data:D};L==="done"?(m(!0),r(U=>[...U,M])):r(U=>[...U,M])}catch{}L=""}}}catch(C){C.name!=="AbortError"&&x(C.message)}finally{o(!1),h.current=null}},[]),b=v.useCallback(()=>{var g;(g=h.current)==null||g.abort()},[]);return{events:a,running:i,done:d,error:f,start:p,stop:b}}function W2(a){const r=v.useRef(a);r.current=a;const[i,o]=v.useState(new Set),d=v.useRef(new Map),m=v.useCallback(async(p,b,g)=>{var S;(S=d.current.get(p))==null||S.abort();const j=new AbortController;d.current.set(p,j),o(C=>{const A=new Set(C);return A.add(p),A});try{const C=zv(g),A=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:C,signal:j.signal});if(!A.ok||!A.body){let I=`HTTP ${A.status}`;try{const O=await A.json();O.error&&(I=O.error)}catch{}throw new Error(I)}const E=A.body.getReader(),N=new TextDecoder;let R="",L="";for(;;){const{done:I,value:O}=await E.read();if(I)break;R+=N.decode(O,{stream:!0});const $=R.split(`
56
- `);R=$.pop()||"";for(const w of $)if(w.startsWith("event: "))L=w.slice(7).trim();else if(w.startsWith("data: ")){try{const D=JSON.parse(w.slice(6)),M={event:L,data:D};r.current.onEvent(p,M)}catch{}L=""}}r.current.onDone(p)}catch(C){C.name!=="AbortError"&&r.current.onError(p,C.message)}finally{o(C=>{const A=new Set(C);return A.delete(p),A}),d.current.delete(p)}},[]),f=v.useCallback(p=>{var b;(b=d.current.get(p))==null||b.abort()},[]),x=v.useCallback(()=>{for(const p of d.current.values())p.abort()},[]),h=i.size>0;return{runningSet:i,startCase:m,stopCase:f,stopAll:x,isAnyCaseRunning:h}}const Q2={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 X2(a,r){var i,o;switch(r.type){case"SET_LOADING":return{...a,loading:r.loading};case"SET_ERROR":return{...a,error:r.error};case"INIT_DATA":{const d=new Map;if(r.benchmark)for(const f of r.benchmark.cases)d.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(x=>({assertion_id:x.id,text:x.text,pass:x.pass,reasoning:x.reasoning}))});const m=((o=(i=r.evals)==null?void 0:i.evals[0])==null?void 0:o.id)??null;return{...a,skillContent:r.skillContent,savedContent:r.skillContent,isDirty:!1,evals:r.evals,evalsError:r.evalsError??null,latestBenchmark:r.benchmark,inlineResults:d,selectedCaseId:m,loading:!1,error:null}}case"SET_PANEL":return{...a,activePanel:r.panel};case"SET_CONTENT":return{...a,skillContent:r.content,isDirty:r.content!==a.savedContent};case"CONTENT_SAVED":return{...a,savedContent:a.skillContent,isDirty:!1};case"SET_EVALS":return{...a,evals:r.evals};case"SELECT_CASE":return{...a,selectedCaseId:r.caseId};case"CASE_RUN_START":{const d=new Map(a.caseRunStates);return d.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:d,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const d=new Map(a.caseRunStates),m=d.get(r.caseId);d.set(r.caseId,{status:"complete",mode:m==null?void 0:m.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,r.result),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_ERROR":{const d=new Map(a.caseRunStates),m=d.get(r.caseId);d.set(r.caseId,{status:"error",mode:m==null?void 0:m.mode});const f=new Map(a.inlineResults);return f.set(r.caseId,{status:"error",errorMessage:r.error,assertions:[]}),{...a,caseRunStates:d,inlineResults:f}}case"CASE_RUN_CANCEL":{const d=new Map(a.caseRunStates),m=d.get(r.caseId);return d.set(r.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 r.caseIds)d.set(m,{status:"queued",mode:r.mode});return{...a,caseRunStates:d,bulkRunActive:!0,runMode:r.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...a,bulkRunActive:!1,latestBenchmark:r.benchmark??a.latestBenchmark,iterationCount:a.iterationCount+1};case"CANCEL_ALL":{const d=new Map(a.caseRunStates);for(const[m,f]of d)(f.status==="running"||f.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(r.evalId,r.result),{...a,inlineResults:d}}case"OPEN_IMPROVE":return{...a,improveTarget:r.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...a,improveTarget:null};case"OPEN_AI_EDIT":return{...a,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...a,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...a,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...a,aiEditProgress:[...a.aiEditProgress,r.entry]};case"AI_EDIT_RESULT":{const d=r.evalChanges??[],m=new Map;for(let f=0;f<d.length;f++)m.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:d},aiEditEvalChanges:d,aiEditEvalSelections:m}}case"AI_EDIT_ERROR":return{...a,aiEditLoading:!1,aiEditError:r.message,aiEditClassifiedError:r.classified??null};case"GENERATE_EVALS_START":return{...a,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...a,generateEvalsProgress:[...a.generateEvalsProgress,r.entry]};case"GENERATE_EVALS_DONE":return{...a,generateEvalsLoading:!1,evals:r.evals};case"GENERATE_EVALS_ERROR":return{...a,generateEvalsLoading:!1,generateEvalsError:r.classified};case"TOGGLE_EVAL_CHANGE":{const d=new Map(a.aiEditEvalSelections);return d.set(r.index,!d.get(r.index)),{...a,aiEditEvalSelections:d}}case"SELECT_ALL_EVAL_CHANGES":{const d=new Map(a.aiEditEvalSelections);for(const 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:r.evalsFile};case"SET_REGRESSIONS":return{...a,regressions:r.regressions};case"INCREMENT_ITERATION":return{...a,iterationCount:a.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...a,activationPrompts:r.prompts};case"ACTIVATION_START":return{...a,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...a,activationResults:[...a.activationResults,r.result]};case"ACTIVATION_DONE":return{...a,activationRunning:!1,activationSummary:r.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...a,activationClassifyingStatus:`Classifying prompt ${r.index}/${r.total}...`};case"ACTIVATION_ERROR":return{...a,activationRunning:!1,activationError:r.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...a,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...a,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...a,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...a,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...a,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...a,generatingPrompts:!1,generatingPromptsError:r.error};case"ACTIVATION_HISTORY_LOADED":return{...a,activationHistory:r.runs,activationHistoryLoading:!1};default:return a}}function F2(a){if(a==="unit"||a==="integration")return a}function Z2(a,r){const i=r.data;if(r.event==="output_ready"&&(a.output=i.output,i.durationMs!=null&&(a.durationMs=i.durationMs),i.tokens!=null&&(a.tokens=i.tokens)),r.event==="outputs_ready"&&(a.output=i.skillOutput,i.skillDurationMs!=null&&(a.durationMs=i.skillDurationMs),i.skillTokens!=null&&(a.tokens=i.skillTokens)),r.event==="assertion_result"){const o={assertion_id:i.assertion_id,text:i.text,pass:i.pass,reasoning:i.reasoning};a.assertions.find(d=>d.assertion_id===o.assertion_id)||a.assertions.push(o)}r.event==="case_complete"&&(a.status=i.status,a.passRate=i.pass_rate,a.errorMessage=i.error_message||void 0,a.classifiedError=i.classified_error||void 0)}const Dv=v.createContext(null);function Sn(){const a=v.useContext(Dv);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function mx({plugin:a,skill:r,origin:i,children:o}){const d=i==="installed",[m,f]=v.useReducer(X2,{...Q2,plugin:a,skill:r}),x=v.useRef(new Set),h=v.useRef(new Set),p=v.useRef(new Map),b=v.useCallback((te,ce)=>{let oe=p.current.get(te);oe||(oe={assertions:[]},p.current.set(te,oe)),Z2(oe,ce),f({type:"UPDATE_INLINE_RESULT",evalId:te,result:{...oe,assertions:[...oe.assertions]}})},[]),g=v.useCallback(te=>{if(h.current.has(te))return;h.current.add(te);const ce=p.current.get(te)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:te,result:{...ce,assertions:[...ce.assertions]}}),x.current.has(te)&&(x.current.delete(te),x.current.size===0&&Ce.getLatestBenchmark(a,r).then(oe=>f({type:"BULK_RUN_COMPLETE",benchmark:oe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((te,ce)=>{h.current.has(te)||(h.current.add(te),f({type:"CASE_RUN_ERROR",caseId:te,error:ce}),x.current.has(te)&&(x.current.delete(te),x.current.size===0&&Ce.getLatestBenchmark(a,r).then(oe=>f({type:"BULK_RUN_COMPLETE",benchmark:oe})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:C,stopAll:A}=W2({onEvent:b,onDone:g,onError:j});v.useEffect(()=>()=>{A()},[A]);const E=v.useCallback(async()=>{try{const te=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!te.ok){if(te.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const ce=await te.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:ce.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let te=!1;async function ce(){try{const[oe,fe,ye]=await Promise.allSettled([Ce.getSkillDetail(a,r),Ce.getEvals(a,r),Ce.getLatestBenchmark(a,r)]);if(te)return;let _e=null,Me=null;if(fe.status==="fulfilled")_e=fe.value;else{const dt=fe.reason;(dt==null?void 0:dt.status)!==404&&(Me=(dt==null?void 0:dt.message)??"Failed to load test cases")}f({type:"INIT_DATA",skillContent:oe.status==="fulfilled"?oe.value.skillContent:"",evals:_e,evalsError:Me,benchmark:ye.status==="fulfilled"?ye.value:null})}catch(oe){te||f({type:"SET_ERROR",error:oe.message})}}return ce(),E(),()=>{te=!0}},[a,r,E]);const N=v.useCallback(async()=>{if(!d)try{await Ce.applyImprovement(a,r,m.skillContent),f({type:"CONTENT_SAVED"})}catch(te){f({type:"SET_ERROR",error:te.message})}},[d,a,r,m.skillContent]),R=v.useCallback(async te=>{if(!d)try{const ce=await Ce.saveEvals(a,r,te);f({type:"SET_EVALS",evals:ce})}catch(ce){f({type:"SET_ERROR",error:ce.message})}},[d,a,r]),L=v.useCallback((te,ce="benchmark")=>{if(d)return;const oe=m.caseRunStates.get(te);if((oe==null?void 0:oe.status)!=="running")if(p.current.delete(te),h.current.delete(te),f({type:"CASE_RUN_START",caseId:te,mode:ce}),ce==="comparison"){const fe=`/api/skills/${a}/${r}/compare`;S(te,fe,{eval_ids:[te]})}else{const fe=`/api/skills/${a}/${r}/benchmark/case/${te}`;S(te,fe,ce==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,m.caseRunStates,S]),I=v.useCallback((te="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(ye=>ye.id);for(const ye of oe)p.current.delete(ye),h.current.delete(ye);f({type:"BULK_RUN_START",caseIds:oe,mode:te}),x.current=new Set(oe);for(const ye of oe)if(te==="comparison")S(ye,`/api/skills/${a}/${r}/compare`,{eval_ids:[ye]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${ye}`;S(ye,_e,te==="baseline"?{baseline_only:!0}:void 0)}},[d,a,r,m.evals,S]),O=v.useCallback(te=>{C(te),f({type:"CASE_RUN_CANCEL",caseId:te}),x.current.delete(te),h.current.add(te)},[C]),$=v.useCallback(()=>{A(),f({type:"CANCEL_ALL"}),x.current.clear()},[A]),w=v.useCallback(async(te,ce)=>{f({type:"OPEN_IMPROVE",evalId:te})},[]),D=v.useCallback(async(te,ce)=>{try{await Ce.applyImprovement(a,r,ce),f({type:"SET_CONTENT",content:ce}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),L(te,"benchmark")}catch(oe){f({type:"SET_ERROR",error:oe.message})}},[a,r,L]),M=Vu(),U=v.useRef(null),q=v.useRef(0);v.useEffect(()=>{const te=M.events;for(let ce=q.current;ce<te.length;ce++){const oe=te[ce],fe=oe.data;if(oe.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:fe.phase,message:fe.message}}),oe.event==="done"){const ye=fe.improved,_e=fe.reasoning,Me=fe.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:ye,reasoning:_e,evalChanges:Me})}if(oe.event==="error"){const ye=fe;f({type:"AI_EDIT_ERROR",message:ye.description||"Unknown error",classified:ye})}}q.current=te.length},[M.events]),v.useEffect(()=>{M.error&&f({type:"AI_EDIT_ERROR",message:M.error})},[M.error]),v.useEffect(()=>()=>{M.stop()},[M.stop]);const W=v.useCallback(async(te,ce,oe)=>{d||(q.current=0,f({type:"AI_EDIT_LOADING"}),U.current=M.stop,M.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:te,content:m.skillContent,evals:m.evals??{skill_name:r,evals:[]},provider:ce,model:oe}))},[d,a,r,m.skillContent,m.evals,M]),P=v.useCallback(()=>{M.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[M]),F=v.useCallback(async()=>{const te=m.aiEditResult;if(te!=null&&te.improved)try{if(await Ce.applyImprovement(a,r,te.improved),f({type:"SET_CONTENT",content:te.improved}),f({type:"CONTENT_SAVED"}),m.aiEditEvalChanges.length>0&&Array.from(m.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:oe}=await ud(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),fe=m.evals??{skill_name:r,evals:[]},ye=oe(fe,m.aiEditEvalChanges,m.aiEditEvalSelections);try{const _e=await Ce.saveEvals(a,r,ye);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:ye}),f({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${_e.message}. You can retry from the AI Edit panel.`});return}}f({type:"CLOSE_AI_EDIT"})}catch(ce){f({type:"SET_ERROR",error:ce.message})}},[a,r,m.aiEditResult,m.evals,m.aiEditEvalChanges,m.aiEditEvalSelections]),_=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),T=v.useCallback(te=>{f({type:"TOGGLE_EVAL_CHANGE",index:te})},[]),B=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),le=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Q=v.useCallback(async()=>{const te=m.aiEditEvalsRetry;if(te)try{const ce=await Ce.saveEvals(a,r,te);f({type:"SET_EVALS",evals:ce}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(ce){f({type:"SET_ERROR",error:`Retry failed: ${ce.message}`})}},[a,r,m.aiEditEvalsRetry]),pe=v.useCallback(async()=>{try{const te=await Ce.getSkillDetail(a,r);f({type:"SET_CONTENT",content:te.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:z}=yl(),X=Vu(),re=v.useRef(0);v.useEffect(()=>{const te=X.events;for(let ce=re.current;ce<te.length;ce++){const oe=te[ce],fe=oe.data;if(oe.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:fe.phase,message:fe.message}}),oe.event==="done"){const ye=fe;Ce.saveEvals(a,r,ye).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}oe.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:fe})}re.current=te.length},[X.events,a,r]),v.useEffect(()=>{X.error&&f({type:"SET_ERROR",error:X.error})},[X.error]),v.useEffect(()=>()=>{X.stop()},[X.stop]);const de=v.useCallback(async te=>{if(d)return;re.current=0,f({type:"GENERATE_EVALS_START"});const ce={};z!=null&&z.provider&&(ce.provider=z.provider),z!=null&&z.model&&(ce.model=z.model);const oe=F2(te==null?void 0:te.testType);oe&&(ce.testType=oe),X.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(ce).length>0?ce:void 0)},[d,a,r,X,z]),xe=Vu(),me=v.useRef(0);v.useEffect(()=>()=>{xe.stop()},[xe.stop]),v.useEffect(()=>{const te=xe.events;for(let ce=me.current;ce<te.length;ce++){const oe=te[ce];if(oe.event==="classifying"){const fe=oe.data;f({type:"ACTIVATION_CLASSIFYING",index:fe.index,total:fe.total})}if(oe.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:oe.data}),oe.event==="done"){Ne.current&&(clearTimeout(Ne.current),Ne.current=null);const fe=oe.data;if(fe.error)f({type:"ACTIVATION_ERROR",error:fe.error});else{f({type:"ACTIVATION_DONE",summary:fe});const ye={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(z==null?void 0:z.model)||"unknown",provider:(z==null?void 0:z.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}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[ye,...m.activationHistory??[]]})}}}me.current=te.length},[xe.events,z,m.activationHistory]),v.useEffect(()=>{xe.error&&(Ne.current&&(clearTimeout(Ne.current),Ne.current=null),f({type:"ACTIVATION_ERROR",error:xe.error}))},[xe.error]);const Ne=v.useRef(null),ie=v.useCallback(()=>{Ne.current&&(clearTimeout(Ne.current),Ne.current=null),xe.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[xe]),je=v.useCallback(te=>{const oe=te.trim().split(`
57
- `).filter(Boolean).map(ye=>ye.startsWith("!")?{prompt:ye.slice(1).trim(),expected:"should_not_activate"}:ye.startsWith("+")?{prompt:ye.slice(1).trim(),expected:"should_activate"}:{prompt:ye.trim(),expected:"auto"});me.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:te});const fe={prompts:oe};z!=null&&z.provider&&(fe.provider=z.provider),z!=null&&z.model&&(fe.model=z.model),xe.start(`/api/skills/${a}/${r}/activation-test`,fe),Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{xe.stop(),f({type:"ACTIVATION_TIMEOUT"}),Ne.current=null},12e4)},[a,r,xe,z]),$e=v.useCallback(async(te=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const ce={count:te};z!=null&&z.provider&&(ce.provider=z.provider),z!=null&&z.model&&(ce.model=z.model);const oe=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ce)});if(!oe.ok){let ct=`HTTP ${oe.status}`;try{const Vt=await oe.json();Vt.error&&(ct=Vt.error)}catch{}throw new Error(ct)}const fe=oe.body.getReader(),ye=new TextDecoder;let _e="",Me="",dt=[];for(;;){const{done:ct,value:Vt}=await fe.read();if(ct)break;_e+=ye.decode(Vt,{stream:!0});const $t=_e.split(`
58
- `);_e=$t.pop()||"";for(const tt of $t)if(tt.startsWith("event: "))Me=tt.slice(7).trim();else if(tt.startsWith("data: ")){try{const jt=JSON.parse(tt.slice(6));if(Me==="done"){if(jt.error)throw new Error(jt.error);dt=jt.prompts||[]}if(Me==="error")throw new Error(jt.message||jt.description||"Generation failed")}catch(jt){if(!(jt instanceof SyntaxError))throw jt}Me=""}}const Pt=dt.map(ct=>`${ct.expected==="should_activate"?"+":"!"}${ct.prompt}`).join(`
59
- `);f({type:"SET_ACTIVATION_PROMPTS",prompts:Pt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(ce){f({type:"GENERATE_PROMPTS_ERROR",error:ce.message})}},[a,r,z]),Be=v.useMemo(()=>({state:m,dispatch:f,isReadOnly:d,saveContent:N,saveEvals:R,runCase:L,runAll:I,cancelCase:O,cancelAll:$,improveForCase:w,applyImproveAndRerun:D,refreshSkillContent:pe,generateEvals:de,runActivationTest:je,cancelActivation:ie,generateActivationPrompts:$e,fetchActivationHistory:E,submitAiEdit:W,cancelAiEdit:P,applyAiEdit:F,discardAiEdit:_,toggleEvalChange:T,selectAllEvalChanges:B,deselectAllEvalChanges:le,retryEvalsSave:Q}),[m,d,N,R,L,I,O,$,w,D,pe,de,je,ie,$e,E,W,P,F,_,T,B,le,Q]);return n.jsx(Dv.Provider,{value:Be,children:o})}const Zi=new Map,hl=new Map,ds=new Map;function Es(a){Zi.delete(a),hl.delete(a);const r=ds.get(a);if(r)for(const i of r)i()}function uo(a,r,i={}){const{ttl:o=3e4,enabled:d=!0}=i,[,m]=v.useState(0),f=v.useRef(!0),x=v.useRef(a);x.current=a;const h=()=>Es(a);v.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),v.useEffect(()=>{if(!d)return;const j=()=>{f.current&&m(S=>S+1)};return ds.has(a)||ds.set(a,new Set),ds.get(a).add(j),()=>{var S;(S=ds.get(a))==null||S.delete(j)}},[a,d]),v.useEffect(()=>{if(!d)return;const j=Zi.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(hl.has(a)){const E=hl.get(a),N=()=>{f.current&&x.current===a&&m(R=>R+1)};E.subscribers.push(N);return}const C={promise:Promise.resolve(),subscribers:[]},A=r().then(E=>{Zi.set(a,{data:E,fetchedAt:Date.now()}),hl.delete(a),f.current&&x.current===a&&m(N=>N+1);for(const N of C.subscribers)N()},E=>{hl.delete(a),f.current&&x.current===a&&m(N=>N+1);for(const N of C.subscribers)N();throw E});C.promise=A,hl.set(a,C)},[a,r,o,d]);const p=Zi.get(a),b=d&&!p&&hl.has(a);return{data:p==null?void 0:p.data,loading:b||d&&!p,error:void 0,revalidate:h}}function P2(a){if(!a)return[];const r=a.split(`
60
- `),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function wd({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:d=480,collapsible:m=!1,renderContext:f="inline",onRetry:x}){const[h,p]=v.useState(m),[b,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),C=v.useMemo(()=>P2(a),[a]),A=v.useMemo(()=>{const O=C.filter(w=>w.type==="add").length,$=C.filter(w=>w.type==="remove").length;return{added:O,removed:$}},[C]),E=v.useMemo(()=>{let O=0,$=0;return C.filter(w=>w.type!=="header").map(w=>w.type==="remove"?(O++,{...w,origNum:O,newNum:null}):w.type==="add"?($++,{...w,origNum:null,newNum:$}):(O++,$++,{...w,origNum:O,newNum:$}))},[C]),N=v.useMemo(()=>{const O=[],$=[];for(const w of E)if(w.type==="remove")O.push(w);else if(w.type==="add")$.push(w);else{for(;O.length<$.length;)O.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<O.length;)$.push({type:"context",content:"",origNum:null,newNum:null});O.push(w),$.push(w)}for(;O.length<$.length;)O.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<O.length;)$.push({type:"context",content:"",origNum:null,newNum:null});return{left:O,right:$}},[E]),R=v.useCallback(O=>{const $=O==="left"?j.current:S.current,w=O==="left"?S.current:j.current;$&&w&&(w.scrollTop=$.scrollTop)},[]);if(!a||C.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."}),x&&n.jsx("button",{onClick:x,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const L=f==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",I=n.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[r," → ",i]}),n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",A.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",A.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>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:()=>p(!h),className:"btn btn-ghost text-[11px]",children:h?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!h&&(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:E.map((O,$)=>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||"​"})]},$))})})}):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:()=>R("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,$)=>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||"​"})]},$))})})}),n.jsx("div",{ref:S,style:{maxHeight:d,overflowY:"auto"},onScroll:()=>R("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,$)=>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||"​"})]},$))})})})]}))]});return f==="modal"?n.jsx("div",{className:L,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:I})}):I}const hx={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 J2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function Lv(){const{state:a}=Sn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:d}=ya(),m=`versions/${r}/${i}`,f=v.useCallback(()=>Ce.getSkillVersions(r,i),[r,i]),{data:x,loading:h}=uo(m,f),[p,b]=v.useState(null),[g,j]=v.useState(null),[S,C]=v.useState(null),[A,E]=v.useState(!1),[N,R]=v.useState("idle"),[L,I]=v.useState(null),O=v.useRef(null),$=v.useRef(null),w=v.useMemo(()=>(x==null?void 0:x.find(F=>F.isInstalled))??null,[x]),D=v.useMemo(()=>(x==null?void 0:x[0])??null,[x]),M=w&&D&&w.version!==D.version,U=v.useCallback(F=>{p?!g&&F!==p?j(F):(b(F),j(null),C(null)):(b(F),C(null))},[p,g]),q=v.useCallback(async(F,_)=>{E(!0);try{const T=await Ce.getVersionDiff(r,i,F,_);C(T)}catch{C(null)}finally{E(!1)}},[r,i]);v.useEffect(()=>{if(p&&g){const F=x||[],_=F.findIndex(Q=>Q.version===p),T=F.findIndex(Q=>Q.version===g),[B,le]=_>T?[p,g]:[g,p];q(B,le)}},[p,g,x,q]);const W=v.useCallback(()=>{!w||!D||(b(w.version),j(D.version))},[w,D]),P=v.useCallback(()=>{R("updating"),I(null);const F=Ce.startSkillUpdate(r,i);O.current=F,F.addEventListener("progress",_=>{try{switch(JSON.parse(_.data).status){case"scanning":R("scanning");break;case"installing":R("installing");break;case"done":R("done");break}}catch{R("error"),I("Unexpected response from server")}}),F.addEventListener("done",()=>{F.close(),O.current=null,o(),Es(m),R("done")}),F.addEventListener("error",_=>{const T=_;let B="Connection lost";if(T.data)try{B=JSON.parse(T.data).error||"Update failed"}catch{}R("error"),I(B),F.close(),O.current=null})},[r,i,m,o]);return v.useEffect(()=>()=>{O.current&&(O.current.close(),O.current=null)},[]),h?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"})]})]}):!x||x.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:W,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:L||"Update failed"}),n.jsx("button",{onClick:P,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:P,disabled:N!=="idle",className:"btn btn-primary text-[11px]",children:N==="idle"?`Update to ${D==null?void 0:D.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,")"]})]})]}),p&&!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 ",p]}),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:x.map(F=>{const _=hx[F.certTier]||hx.COMMUNITY,T=F.version===p||F.version===g,B=F.isInstalled;return n.jsxs("button",{onClick:()=>U(F.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:T?"var(--accent-muted)":"transparent",border:T?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:le=>{T||(le.currentTarget.style.background="var(--surface-1)")},onMouseLeave:le=>{T||(le.currentTarget.style.background="transparent")},children:[n.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:B?10:8,height:B?10:8,background:B?"var(--accent)":"var(--surface-3)",border:B?"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:F.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.bg,color:_.text},children:F.certTier}),B&&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(F.createdAt).toLocaleDateString()})]}),F.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:J2(F.diffSummary,80)})]},F.version)})}),n.jsx("div",{ref:$,style:{height:1}})]}),A&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!A&&n.jsx("div",{className:"mt-4",children:n.jsx(wd,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>p&&g&&q(S.from,S.to)})})]})}function ej(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function tj(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function xx(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Nd(a){return a.skill?aj({skill:a.skill}):lj({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function nj(a,r=48){if(a.length<=r)return a;const i=a.slice(0,12),o=a.slice(a.length-(r-12-1));return`${i}…${o}`}function aj({skill:a}){const[r,i]=v.useState(!1),o=v.useCallback(async()=>{var f;try{await((f=navigator.clipboard)==null?void 0:f.writeText(a.dir)),i(!0),setTimeout(()=>i(!1),1500),xx(ve.toasts.pathCopied,"info")}catch{xx(ve.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:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:nj(a.dir||"—")}),n.jsxs("button",{"data-testid":"detail-header-copy-path",type:"button",onClick:o,"aria-label":"Copy skill path to clipboard",style:{display:"inline-flex",alignItems:"center",gap:4,padding:"2px 8px",background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:11,cursor:"pointer"},children:[n.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),r?"Copied":"Copy"]})]})]})}function lj({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:d,evals:m,latestBenchmark:f,isDirty:x,caseRunStates:h,regressions:p,iterationCount:b}=a,g=Array.from(h.values()).some(N=>N.status==="running"||N.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(m==null?void 0:m.evals.reduce((N,R)=>N+R.assertions.length,0))??0,C=(m==null?void 0:m.evals.length)??0,A=ej(j),E=tj(j);return n.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[n.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),n.jsx(rj,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:d}),r&&n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),x&&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:[!r&&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(sj,{})}),p.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"})]}),p.length," regression",p.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:E,color:A},children:j!=null?`${Math.round(j*100)}%`:"--"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[C," case",C!==1?"s":""," / ",S," assert",S!==1?"s":""]})]})]})}function rj(){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 sj(){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 ij=[{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 oj({id:a}){const r={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(a){case"editor":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return n.jsx("svg",{...r,children:n.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return n.jsxs("svg",{...r,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]});case"deps":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return n.jsxs("svg",{...r,children:[n.jsx("path",{d:"M12 8v4l3 3"}),n.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function cj({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:d,isActivationRunning:m,hasUpdate:f}){return n.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:ij.map((x,h)=>n.jsxs("div",{className:"flex items-center",children:[h>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),x.tabs.map(p=>{const b=a===p.id,g=p.id==="editor"&&i||p.id==="run"&&o||p.id==="activation"&&m||p.id==="history"&&d||p.id==="versions"&&f,j=p.id==="run"||p.id==="activation"?"var(--accent)":p.id==="history"?"var(--red)":"var(--yellow)";return n.jsxs("button",{onClick:()=>r(p.id),title:`${p.label} (Ctrl+${p.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:S=>{b||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{b||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(oj,{id:p.id}),p.label,g&&n.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:j}})]},p.id)})]},x.label))})}const vx={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 Ts({error:a,onRetry:r,onDismiss:i}){const[o,d]=v.useState(null),m=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?d(Math.ceil(a.retryAfterMs/1e3)):d(null),()=>{m.current&&clearInterval(m.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return m.current=setInterval(()=>{d(h=>h==null||h<=1?(m.current&&clearInterval(m.current),0):h-1)},1e3),()=>{m.current&&clearInterval(m.current)}},[o!=null&&o>0]);const f=vx[a.category]||vx.unknown,x=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:x,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:x?.5:1},children:x?`Retry in ${o}s`:"Retry"})})]})]})}class uj extends v.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,i){console.error("ErrorBoundary caught:",r,i.componentStack)}render(){return this.state.hasError?n.jsxs("div",{style:{padding:24,textAlign:"center"},children:[n.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),n.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),n.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function dj(a){const r=a.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(r)?{category:"rate_limit",title:"Rate Limit",description:a,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(r)?{category:"auth",title:"Authentication Failed",description:a,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(r)?{category:"timeout",title:"Request Timed Out",description:a,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(r)?{category:"model_not_found",title:"Model Not Found",description:a,hint:"The selected model is not available. Try switching to a different model in the dropdown above.",retryable:!1}:/context.?(?:window|length)|token.?(?:limit|count|exceed)|too (?:long|large)|maximum.?context|input.?too.?long|prompt.?too.?(?:long|large)/.test(r)?{category:"context_window",title:"Content Too Large",description:a,hint:"Reduce SKILL.md size or move detailed content to references/ files.",retryable:!1}:/enoent|command not found|502|503|service.?unavailable|connection.?refused|econnrefused|server.?error/.test(r)?{category:"provider_unavailable",title:"Provider Unavailable",description:a,hint:"Check that the provider is installed and running.",retryable:!1}:/syntaxerror|json\.?parse|parse.?error|failed to parse|not valid json|unexpected token/.test(r)?{category:"parse_error",title:"Response Parse Error",description:a,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:a,hint:"",retryable:!1}}function fj(a){const r=a.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!r)return{metadata:{},body:a};const i=r[1],o=r[2].trim(),d={},m=i.split(`
61
- `);let f="",x=!1;for(const h of m){const p=h.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&f&&x){const j=p[1],S=p[2].trim();let C=d[f];if((typeof C!="object"||Array.isArray(C))&&(C={},d[f]=C),!S)C[j]=[];else{const A=S.match(/^\[(.+)\]$/);A?C[j]=A[1].split(",").map(E=>E.trim().replace(/^["']|["']$/g,"")).filter(Boolean):C[j]=S.replace(/^["']|["']$/g,"")}continue}const b=h.match(/^\s+-\s+(.+)$/);if(b&&f){x=!1;const j=d[f];Array.isArray(j)?j.push(b[1].trim().replace(/^["']|["']$/g,"")):d[f]=[b[1].trim().replace(/^["']|["']$/g,"")];continue}const g=h.match(/^([\w-]+):\s*(.*)$/);if(g){f=g[1];const j=g[2].trim();if(x=!1,!j){d[f]={},x=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){d[f]=S[1].split(",").map(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}d[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:d,body:o}}function fo(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=pj(r);return i=i.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),i=i.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),i=i.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),i=i.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),i=i.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),i=i.replace(/\n/g,"<br/>"),i}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function pj(a){const r=a.split(`
62
- `),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const d=yx(r[o]);o+=2;const m=[];for(;o<r.length&&r[o].trim().startsWith("|");)m.push(yx(r[o])),o++;const f='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',x='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let h='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';h+="<thead><tr>";for(const p of d)h+=`<th ${f}>${p}</th>`;h+="</tr></thead><tbody>";for(const p of m){h+="<tr>";for(const b of p)h+=`<td ${x}>${b}</td>`;h+="</tr>"}h+="</tbody></table>",i.push(h)}else i.push(r[o]),o++;return i.join(`
63
- `)}function yx(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function po(a,r){const i=a.split(`
64
- `),o=r.split(`
65
- `);if(i.length>1e3||o.length>1e3)return[...i.map(b=>({type:"unchanged",content:b}))];const d=i.length,m=o.length,f=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]===o[g-1]?f[b][g]=f[b-1][g-1]+1:f[b][g]=Math.max(f[b-1][g],f[b][g-1]);const x=[];let h=d,p=m;for(;h>0||p>0;)h>0&&p>0&&i[h-1]===o[p-1]?(x.push({type:"unchanged",content:i[h-1]}),h--,p--):p>0&&(h===0||f[h][p-1]>=f[h-1][p])?(x.push({type:"added",content:o[p-1]}),p--):(x.push({type:"removed",content:i[h-1]}),h--);return x.reverse()}function mj(a,r){if(r&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(a))return n.jsx("div",{className:"spinner",style:{width:10,height:10,flexShrink:0}});const o=new Set(["generating","comparing","preparing","generating_skill","generating_baseline","scoring","action_items"]);return n.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(a)?"var(--accent)":"var(--green)"}})}function Rs({entries:a,isRunning:r}){const[i,o]=v.useState(!1),d=v.useRef(null);return v.useEffect(()=>{d.current&&!i&&(d.current.scrollTop=d.current.scrollHeight)},[a,i]),a.length===0&&!r?null:n.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("button",{onClick:()=>o(!i),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter: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:[r&&n.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",a.length,")"]}),n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:i?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!i&&n.jsx("div",{ref:d,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((m,f)=>{const x=f===a.length-1&&r,h=f===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:x?1:.7},children:[mj(m.phase,x),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:h}),n.jsx("span",{style:{color:x?"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,"]"]})]},f)})})]})}function hj({plugin:a,skill:r,skillContent:i,onApplied:o}){const[d,m]=v.useState("closed"),{config:f}=yl(),[x,h]=v.useState("claude-cli"),[p,b]=v.useState("opus"),[g,j]=v.useState([]),[S,C]=v.useState(""),[A,E]=v.useState(""),[N,R]=v.useState(null),[L,I]=v.useState(null),[O,$]=v.useState([]),[w,D]=v.useState(!1),M=v.useRef(null);v.useEffect(()=>{if(!f)return;f.providers.find(B=>B.id==="claude-cli"&&B.available)&&(h("claude-cli"),b("opus"))},[f]),v.useEffect(()=>()=>{var T;(T=M.current)==null||T.abort()},[]);function U(){return f==null?void 0:f.providers.find(T=>T.id===x&&T.available)}const q=v.useCallback(()=>{var T;(T=M.current)==null||T.abort(),m("open")},[]);async function W(){m("loading"),R(null),I(null),$([]);const T=new AbortController;M.current=T;try{const B=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:x,model:p}),signal:T.signal});if(!B.ok||!B.body){let X=`HTTP ${B.status}`;try{const re=await B.json();re.error&&(X=re.error)}catch{}throw new Error(X)}const le=B.body.getReader(),Q=new TextDecoder;let pe="",z="";for(;;){const{done:X,value:re}=await le.read();if(X)break;pe+=Q.decode(re,{stream:!0});const de=pe.split(`
66
- `);pe=de.pop()||"";for(const xe of de)if(xe.startsWith("event: "))z=xe.slice(7).trim();else if(xe.startsWith("data: ")){try{const me=JSON.parse(xe.slice(6));z==="progress"?$(Ne=>[...Ne,{phase:me.phase,message:me.message,timestamp:Date.now()}]):z==="done"||z==="complete"?(C(me.improved),E(me.reasoning||""),j(po(me.original||i,me.improved)),m("diff_shown")):z==="error"&&(R(me.message||me.description||"Unknown error"),me.category&&I(me),m("open"))}catch{}z=""}}}catch(B){B.name!=="AbortError"&&(R(B.message),m("open"))}finally{M.current=null}}async function P(){D(!0);try{await Ce.applyImprovement(a,r,S),o(S),m("closed")}catch(T){R(T.message)}finally{D(!1)}}function F(){m("closed"),j([]),C(""),E(""),R(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 _=U();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:F,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:T=>{T.currentTarget.style.background="var(--surface-3)"},onMouseLeave:T=>{T.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:x,onChange:T=>{h(T.target.value);const B=f==null?void 0:f.providers.find(le=>le.id===T.target.value);B!=null&&B.models[0]&&b(B.models[0].id)},disabled:d==="loading",children:f==null?void 0:f.providers.filter(T=>T.available).map(T=>n.jsx("option",{value:T.id,children:T.label},T.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:p,onChange:T=>b(T.target.value),disabled:d==="loading",children:_==null?void 0:_.models.map(T=>n.jsx("option",{value:T.id,children:T.label},T.id))})]}),d==="loading"?n.jsx("button",{onClick:q,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:W,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),d==="loading"&&O.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(Rs,{entries:O,isRunning:!0})})]}),N&&n.jsx("div",{className:"mb-4",children:L?n.jsx(Ts,{error:L,onRetry:W,onDismiss:()=>{R(null),I(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:[A&&n.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[n.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),A]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((T,B)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:T.type==="added"?"rgba(34,197,94,0.1)":T.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:T.type==="added"?"var(--green)":T.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:T.type==="added"?"3px solid var(--green)":T.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:T.type==="added"?"+":T.type==="removed"?"-":" "}),T.content]},B))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:P,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:F,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const gx={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},xj={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function vj({change:a,index:r,selected:i,onToggle:o,originalEval:d}){var g;const[m,f]=v.useState(!1),x=gx[a.action]??gx.add,h=xj[a.action]??"var(--border-subtle)",p=a.action==="remove"?(d==null?void 0:d.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",b=v.useCallback(()=>o(r),[o,r]);return n.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${h}`,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:x.bg,color:x.color,padding:"1px 6px"},children:x.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),n.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:a.reason}),n.jsx("button",{onClick:()=>f(!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(yj,{evalCase:a.eval}),a.action==="modify"&&a.eval&&d&&n.jsx(gj,{original:d,proposed:a.eval}),a.action==="remove"&&d&&n.jsx(bj,{evalCase:d})]})]})}function yj({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(ld,{label:"Prompt",value:a.prompt}),n.jsx(ld,{label:"Expected",value:a.expected_output}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-1",children:(a.assertions??[]).map(i=>n.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[n.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",i.text]},i.id))})]})]})}function gj({original:a,proposed:r}){const i=[];a.name!==r.name&&i.push({label:"Name",old:a.name,new:r.name}),a.prompt!==r.prompt&&i.push({label:"Prompt",old:a.prompt,new:r.prompt}),a.expected_output!==r.expected_output&&i.push({label:"Expected",old:a.expected_output,new:r.expected_output});const o=a.assertions??[],d=r.assertions??[],m=new Set(o.map(p=>p.text)),f=new Set(d.map(p=>p.text)),x=d.filter(p=>!m.has(p.text)),h=o.filter(p=>!f.has(p.text));return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[i.map(p=>n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.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:["- ",rd(p.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",rd(p.new,120)]})]})]},p.label)),(x.length>0||h.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:[h.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),x.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),i.length===0&&x.length===0&&h.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function bj({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(ld,{label:"Prompt",value:a.prompt}),n.jsxs("div",{children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((r=a.assertions)==null?void 0:r.length)??0,")"]}),n.jsx("div",{className:"mt-1 space-y-0.5",children:(a.assertions??[]).map(i=>n.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:i.text},i.id))})]})]})}function ld({label:a,value:r}){return n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),n.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:rd(r,300)})]})}function rd(a,r){return a.length>r?a.slice(0,r)+"...":a}const bx={remove:0,modify:1,add:2};function jj({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:d,onDeselectAll:m}){if(a.length===0)return null;const f=a.map((h,p)=>({change:h,originalIndex:p}));f.sort((h,p)=>(bx[h.change.action]??2)-(bx[p.change.action]??2));const x=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",x,"/",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:h=>{h.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:h=>{h.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:h=>{h.currentTarget.style.background="var(--surface-3)"},onMouseLeave:h=>{h.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:h,originalIndex:p})=>n.jsx(vj,{change:h,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:h.evalId!=null?i.find(b=>b.id===h.evalId):void 0},p))})]})}function Sj(){var T;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:d,cancelAiEdit:m,toggleEvalChange:f,selectAllEvalChanges:x,deselectAllEvalChanges:h,retryEvalsSave:p}=Sn(),{aiEditLoading:b,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:C,aiEditEvalChanges:A,aiEditEvalSelections:E,aiEditEvalsRetry:N}=a,[R,L]=v.useState(""),{config:I}=yl(),[O,$]=v.useState("claude-cli"),[w,D]=v.useState("opus"),M=v.useRef(null);v.useEffect(()=>{var B;(B=M.current)==null||B.focus()},[]),v.useEffect(()=>{if(!I)return;I.providers.find(le=>le.id==="claude-cli"&&le.available)&&($("claude-cli"),D("opus"))},[I]);const U=I==null?void 0:I.providers.find(B=>B.id===O&&B.available),q=v.useCallback(()=>{const B=R.trim();!B||b||i(B,O,w)},[R,b,i,O,w]),W=v.useCallback(B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),q()),B.key==="Escape"&&(B.preventDefault(),b?m():d())},[q,b,m,d]),P=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),F=g?po(a.skillContent,g.improved):[],_=((T=a.evals)==null?void 0:T.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:B=>{B.currentTarget.style.background="var(--surface-3)"},onMouseLeave:B=>{B.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:R,onChange:B=>L(B.target.value),onKeyDown:W,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:B=>{const le=B.currentTarget;le.style.height="auto",le.style.height=Math.min(le.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:B=>{$(B.target.value);const le=I==null?void 0:I.providers.find(Q=>Q.id===B.target.value);le!=null&&le.models[0]&&D(le.models[0].id)},disabled:b,style:{width:"100%"},children:I==null?void 0:I.providers.filter(B=>B.available).map(B=>n.jsx("option",{value:B.id,children:B.label},B.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:B=>D(B.target.value),disabled:b,style:{width:"100%"},children:U==null?void 0:U.models.map(B=>n.jsx("option",{value:B.id,children:B.label},B.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:q,disabled:!R.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),b&&C.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(Rs,{entries:C,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(Ts,{error:S,onRetry:P,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:F.map((B,le)=>n.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:B.type==="added"?"rgba(34,197,94,0.1)":B.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:B.type==="added"?"var(--green)":B.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:B.type==="added"?"3px solid var(--green)":B.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:B.type==="added"?"+":B.type==="removed"?"-":" "}),B.content]},le))}),n.jsx(jj,{changes:A,selections:E,currentEvals:_,onToggle:f,onSelectAll:x,onDeselectAll:h}),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:p,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),n.jsxs("div",{className:"flex gap-2 mt-3",children:[n.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[n.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),n.jsx("button",{onClick:d,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:P,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function kj(a,r){const[i,o]=v.useState([]),[d,m]=v.useState("SKILL.md"),[f,x]=v.useState(null),[h,p]=v.useState(!1),[b,g]=v.useState(null),j=v.useCallback(async()=>{try{const A=await Ce.getSkillFiles(a,r);o(A.files)}catch{o([])}},[a,r]);v.useEffect(()=>{m("SKILL.md"),x(null),g(null),j()},[a,r,j]);const S=v.useCallback(async A=>{if(m(A),A==="SKILL.md"){x(null),g(null);return}p(!0),g(null);try{const E=await Ce.getSkillFile(a,r,A);x(E)}catch(E){g(`Unable to open file: ${E.message}`),x(null)}finally{p(!1)}},[a,r]),C=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:d,secondaryContent:f,loading:h,error:b,selectFile:S,refresh:C,isSkillMd:d==="SKILL.md"}}function wj(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function Nj(a){const r=[],i=new Map;for(const o of a){const d=o.path.split("/"),f={name:d[d.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const d=o.path.split("/");if(d.length===1){const m=i.get(o.path);m&&r.push(m)}else{const m=d.slice(0,-1).join("/"),f=i.get(m),x=i.get(o.path);f&&x&&f.children.push(x)}}return r}function _v({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 Ov(){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 Cj(){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 Ej(){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 Bv({node:a,depth:r,activeFile:i,onSelect:o}){const[d,m]=v.useState(!0),f=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+r*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[n.jsx(_v,{expanded:d}),n.jsx(Ov,{}),n.jsxs("span",{children:[a.name,"/"]})]}),d&&a.children.map(x=>n.jsx(Bv,{node:x,depth:r+1,activeFile:i,onSelect:o},x.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(Cj,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:wj(a.size)})]})}function Tj({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[d,m]=v.useState(!1),f=v.useMemo(()=>Nj(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(_v,{expanded:d}),n.jsx(Ov,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:x=>{x.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:n.jsx(Ej,{})})]}),d&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(x=>n.jsx(Bv,{node:x,depth:0,activeFile:r,onSelect:i},x.path))})]})}function qi(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function Rj(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function Aj(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function jx({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 Sx({content:a,fileType:r}){if(r==="json"){const i=Rj(a);return n.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:i})}return r==="md"?n.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:fo(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 kx(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,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function Mj({file:a,loading:r,error:i,viewMode:o,plugin:d,skill:m,onSaved:f,onDirtyChange:x}){const[h,p]=v.useState(o),[b,g]=v.useState(!1),[j,S]=v.useState(""),[C,A]=v.useState(!1),[E,N]=v.useState(null),R=o!==h?o:h;v.useEffect(()=>{x==null||x(b)},[b,x]);const L=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),I=v.useCallback(()=>{g(!1)},[]),O=v.useCallback(async()=>{if(!(!d||!m||!a)){A(!0);try{await Ce.saveSkillFile(d,m,a.path,j),N("Saved"),g(!1),f==null||f(),setTimeout(()=>N(null),2e3)}catch(D){N(`Save failed: ${D.message}`),setTimeout(()=>N(null),3e3)}finally{A(!1)}}},[d,m,a,j,f]);if(v.useEffect(()=>{if(!b)return;const D=M=>{(M.ctrlKey||M.metaKey)&&M.key==="s"&&(M.preventDefault(),O())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[b,O]),r)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(i)return n.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:n.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[n.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),n.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:i})]})});if(!a)return null;if(a.binary)return n.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",qi(a.size),") — cannot be displayed"]});const $=a.content??"",w=Aj(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 ",qi(512*1024)," — ",qi(a.size)," total"]}),n.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(w==="md"||w==="json")&&["raw","split","preview"].map(D=>n.jsx("button",{onClick:()=>p(D),style:{padding:"2px 8px",fontSize:11,background:R===D?"var(--accent-muted)":"none",color:R===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[qi(a.size),d&&m&&!a.binary&&!b&&n.jsx("button",{onClick:L,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:C,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:C?.6:1},children:C?"Saving...":"Save"}),n.jsx("button",{onClick:I,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),E&&n.jsx("div",{style:{padding:"4px 12px",background:E.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:E.startsWith("Save failed")?"var(--red)":"var(--green)"},children:E}),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:D=>S(D.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),n.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[n.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),n.jsx("button",{onClick:O,disabled:C,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:C?.6:1},children:C?"Saving...":"Save"}),n.jsx("button",{onClick:I,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):R==="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(jx,{content:$})}),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:kx($)}}):n.jsx(Sx,{content:$,fileType:w})})]}):R==="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:kx($)}}):n.jsx(Sx,{content:$,fileType:w}):n.jsx(jx,{content:$})})]})}function zj({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 Dj({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 Lj({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 _j({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 $u({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 Oj(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=Sn(),{plugin:d,skill:m,skillContent:f,isDirty:x,improveTarget:h,aiEditOpen:p}=a,[b,g]=v.useState("split"),[j,S]=v.useState(!1),C=v.useRef(null),[A,E]=v.useState(!1),[N,R]=v.useState(""),[L,I]=v.useState(!1),[O,$]=v.useState(null),[w,D]=v.useState([]),[M,U]=v.useState([]),[q,W]=v.useState(null),P=v.useRef(null),{config:F}=yl(),{files:_,activeFile:T,secondaryContent:B,loading:le,error:Q,selectFile:pe,refresh:z,isSkillMd:X}=kj(d??"",m??""),[re,de]=v.useState(!1),xe=v.useCallback(he=>{re&&!window.confirm("You have unsaved changes. Discard?")||pe(he)},[re,pe]);v.useEffect(()=>()=>{var he;(he=P.current)==null||he.abort()},[]);const{metadata:me,body:Ne}=fj(f),ie=me["allowed-tools"],je=Array.isArray(ie)?ie:typeof ie=="string"?[ie]:[],$e=me.name,Be=me.description,te=me.metadata,ce=typeof te=="object"&&!Array.isArray(te)?te:null,oe=me.version||(ce==null?void 0:ce.version),fe=me.tags||(ce==null?void 0:ce.tags),ye=Array.isArray(fe)?fe:typeof fe=="string"?fe.split(",").map(he=>he.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(me).filter(([he])=>!_e.has(he)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Pt=v.useCallback(he=>{(he.ctrlKey||he.metaKey)&&he.key==="s"&&(he.preventDefault(),he.stopPropagation(),x&&dt()),(he.ctrlKey||he.metaKey)&&he.key==="k"&&(he.preventDefault(),he.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[x,dt,p,r]),ct=v.useCallback(async()=>{var Rt,ze;if(!N.trim())return;(Rt=P.current)==null||Rt.abort();const he=new AbortController;P.current=he,I(!0),W(null),U([]),$(null),D([]);try{const xt=(F==null?void 0:F.provider)||"claude-cli",Qt=(F==null?void 0:F.model)||"sonnet",nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:N,provider:xt,model:Qt}),signal:he.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const On=await nt.json();On.error&&(bt=On.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Fn=new TextDecoder;let Nt="",St="";for(;;){const{done:bt,value:On}=await Xa.read();if(bt)break;Nt+=Fn.decode(On,{stream:!0});const Fa=Nt.split(`
67
- `);Nt=Fa.pop()||"";for(const Bn of Fa)if(Bn.startsWith("event: "))St=Bn.slice(7).trim();else if(Bn.startsWith("data: ")){try{const Ie=JSON.parse(Bn.slice(6));if(St==="progress")U(Ht=>[...Ht,{phase:Ie.phase,message:Ie.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ht=["---"];Ie.name&&Ht.push(`name: ${Ie.name}`),Ie.description&&Ht.push(`description: "${Ie.description.replace(/"/g,'\\"')}"`),Ie.model&&Ht.push(`model: ${Ie.model}`),(ze=Ie.allowedTools)!=null&&ze.trim()&&Ht.push(`allowed-tools: ${Ie.allowedTools.trim()}`),Ht.push("---","",Ie.body||"");const Zn=Ht.join(`
68
- `);$(Zn),D(po(f,Zn)),I(!1)}else St==="error"&&(W(Ie.message||Ie.description||"Generation failed"),I(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&W(xt.message)}finally{I(!1),P.current=null}},[N,F,f]),Vt=v.useCallback(()=>{O&&r({type:"SET_CONTENT",content:O}),E(!1),$(null),D([]),R(""),U([])},[O,r]),$t=v.useCallback(()=>{E(!1),$(null),D([]),R(""),U([]),W(null)},[]),tt=v.useCallback(()=>{var he;A?((he=P.current)==null||he.abort(),$t()):(p&&r({type:"CLOSE_AI_EDIT"}),E(!0))},[A,p,r,$t]),jt=[{mode:"raw",icon:n.jsx(zj,{}),label:"Editor"},{mode:"split",icon:n.jsx(Dj,{}),label:"Split"},{mode:"preview",icon:n.jsx(Lj,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Pt,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:ze})=>n.jsxs("button",{onClick:()=>g(he),title:ze,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:ze})]},he))}),X?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{p?r({type:"CLOSE_AI_EDIT"}):(A&&$t(),r({type:"OPEN_AI_EDIT"}))},title:"Edit with AI (Ctrl+K)",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:p?600:400,border:"none",cursor:"pointer",color:p?"var(--purple)":"var(--text-tertiary)",background:p?"var(--purple-muted)":"transparent"},children:[n.jsx(_j,{size:13}),n.jsx("span",{children:"AI Edit"})]}),n.jsxs("button",{onClick:tt,title:"Regenerate skill from prompt",className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"4px 10px",fontSize:11,fontWeight:A?600:400,border:"none",cursor:"pointer",color:A?"var(--purple)":"var(--text-tertiary)",background:A?"var(--purple-muted)":"transparent"},children:[n.jsx($u,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),x&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:dt,disabled:!x||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(Tj,{files:_,activeFile:T,onSelect:xe,onRefresh:z}),!X&&n.jsx(Mj,{file:B,loading:le,error:Q,viewMode:b,plugin:d??void 0,skill:m??void 0,onSaved:()=>{pe(T),z()},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:C,value:f,onChange:he=>{o||r({type:"SET_CONTENT",content:he.target.value})},onKeyDown:Pt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),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:[($e||oe||Be)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[$e&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:$e}),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]})]}),Be&&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:Be})]}),ye.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.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))}),je.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"}),je.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))]})}),Me.length>0&&n.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Me.map(([he,Rt],ze)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Qt,nt])=>`${Qt}: ${Array.isArray(nt)?nt.join(", "):nt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:ze>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)})}),($e||Be||ye.length>0||je.length>0||Me.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:fo(Ne)}})]})})]}),X&&p&&n.jsx(Sj,{}),X&&A&&n.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:n.jsxs("div",{className:"px-4 py-3",children:[!O&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx($u,{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=>R(he.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:L,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:L?.5:1},onKeyDown:he=>{he.key==="Enter"&&(he.ctrlKey||he.metaKey)&&N.trim()&&!L&&(he.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[L?n.jsx("button",{onClick:()=>{var he;(he=P.current)==null||he.abort(),I(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!N.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),n.jsx("button",{onClick:$t,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),L&&M.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(Rs,{entries:M,isRunning:!0})}),q&&n.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[q,n.jsx("button",{onClick:ct,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($u,{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:$t,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),X&&h!==null&&d&&m&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(hj,{plugin:d,skill:m,skillContent:f,onApplied:he=>{r({type:"SET_CONTENT",content:he}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function ir(a){return a.testType==="integration"?"integration":"unit"}function fr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function Hv(a){const r=new Date(a);return r.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+r.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function Uv(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const Bj=new Set(["benchmark","comparison","baseline"]);function wx(a,r,i,o){return a.map(({rate:d,idx:m,total:f})=>{const x=o+m/(f-1)*(r-o*2),h=o+(i-o*2)-d*(i-o*2);return`${x},${h}`})}function Iv({entries:a}){const r=a.filter(g=>Bj.has(g.type)).slice().reverse(),i=r.map((g,j,S)=>({rate:g.pass_rate,idx:j,total:S.length})).filter((g,j)=>{const S=r[j].type;return S==="benchmark"||S==="comparison"}),o=r.flatMap((g,j)=>g.type==="baseline"?[{rate:g.pass_rate,idx:j,total:r.length}]:g.type==="comparison"&&g.baselinePassRate!=null?[{rate:g.baselinePassRate,idx:j,total:r.length}]:[]);if(i.length<2&&o.length<2)return null;const d=80,m=24,f=2,x=i.length>=2?wx(i,d,m,f):[],h=o.length>=2?wx(o,d,m,f):[],p=x[x.length-1],b=h[h.length-1];return n.jsxs("svg",{width:d,height:m,style:{display:"block",flexShrink:0},children:[h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),x.length>0&&n.jsx("polyline",{points:x.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)"}),p&&n.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function Vv(a,r,i){const o=isNaN(r)?0:r,d=[],m=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const p=d.length>0?` Met criteria: ${d.map(b=>b.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(a==="FAIL"||a==="DEGRADING"){const p=m.length>0?` Failed criteria: ${m.map(g=>g.criterion).join(", ")}.`:"",b=[...m.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.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 ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:b}}if(a==="INEFFECTIVE"){if(o<.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 ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:b}}const p=[...m.map(b=>`Rework "${b.criterion}" — currently at ${b.score.toFixed(2)}`),...f.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return p.length===0&&p.push("Consider restructuring your prompt approach"),{explanation:`${a} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(a==="MARGINAL"){const p=[...f.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`),...m.map(b=>`Improve "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return p.length===0&&p.push(d.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${a} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(a==="EMERGING"){const p=[...m.map(b=>`Improve "${b.criterion}" (score: ${b.score.toFixed(2)})`),...f.map(b=>`Strengthen "${b.criterion}" (score: ${b.score.toFixed(2)})`)];return p.length===0&&p.push(d.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Add more specific guidance to your prompt instructions"),{explanation:`${a} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const x=d.length>0?` Passing: ${d.map(p=>p.criterion).join(", ")}.`:"",h=f.length>0?` Needs improvement: ${f.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${x}${h}`}}const $v={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function Hj(a){return Object.hasOwn($v,a)}function Uj(a){return Hj(a)?$v[a]:a}function Ij(){const{state:a}=Sn(),{plugin:r,skill:i}=a,[o,d]=v.useState([]),[m,f]=v.useState([]),[x,h]=v.useState(!0),[p,b]=v.useState(null),[g,j]=v.useState(new Set),[S,C]=v.useState({}),[A,E]=v.useState(null),[N,R]=v.useState(""),[L,I]=v.useState(!1),[O,$]=v.useState(""),[w,D]=v.useState(""),M=v.useCallback(async()=>{h(!0),b(null);try{const[_,T]=await Promise.all([Ce.getCredentials(r,i),Ce.getParams(r,i)]);d(_.credentials),f(T.params)}catch(_){b(_ instanceof Error?_.message:"Failed to load parameters"),d([]),f([])}finally{h(!1)}},[r,i]);v.useEffect(()=>{M()},[M]);const U=v.useCallback(async(_,T)=>{I(!0),b(null);try{await Ce.setCredential(r,i,_,T),E(null),R(""),await M()}catch(B){b(B instanceof Error?B.message:`Failed to save ${_}`)}finally{I(!1)}},[r,i,M]),q=v.useCallback(async()=>{const _=O.trim().toUpperCase(),T=w.trim();if(!(!_||!T)){I(!0),b(null);try{await Ce.setCredential(r,i,_,T),$(""),D(""),await M()}catch(B){b(B instanceof Error?B.message:`Failed to add ${_}`)}finally{I(!1)}}},[r,i,O,w,M]),W=v.useCallback(async _=>{if(g.has(_)){j(T=>{const B=new Set(T);return B.delete(_),B}),C(T=>{const B={...T};return delete B[_],B});return}try{const B=(await Ce.getParamsRevealed(r,i,_)).params.find(le=>le.name===_);B!=null&&B.value&&(C(le=>({...le,[_]:B.value})),j(le=>new Set(le).add(_)))}catch{}},[r,i,g]),P=new Set(o.map(_=>_.name)),F=[...o.map(_=>{const T=m.find(B=>B.name===_.name);return{name:_.name,status:_.status,maskedValue:(T==null?void 0:T.maskedValue)??""}}),...m.filter(_=>!P.has(_.name)).map(_=>({name:_.name,status:_.status,maskedValue:_.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"}),p&&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:p}),x&&F.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!x&&F.length===0&&!p&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),F.map(_=>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:_.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:_.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:_.status==="ready"?"var(--green)":"var(--red)"},children:_.status}),(_.maskedValue||_.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(_.name)?S[_.name]??_.maskedValue:_.maskedValue||"***",n.jsx("button",{onClick:()=>W(_.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(_.name)?"Hide":"Reveal"} value for ${_.name}`,children:g.has(_.name)?"hide":"show"})]}),A===_.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:N,onChange:T=>R(T.target.value),onKeyDown:T=>{T.key==="Enter"&&N.trim()&&U(_.name,N)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${_.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>U(_.name,N),disabled:L||!N.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{E(null),R("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{E(_.name),R("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},_.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:_=>$(_.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(_.target.value),onKeyDown:_=>{_.key==="Enter"&&O.trim()&&w.trim()&&q()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),n.jsx("button",{onClick:q,disabled:L||!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:L?"not-allowed":"pointer"},children:"Add"})]})]})]})}function Vj(a,r,i){const[o,d]=v.useState(null),[m,f]=v.useState(!1),x=v.useRef("");v.useEffect(()=>{const p=`${a}/${r}/${i}`;x.current!==p&&(x.current=p,f(!0),Ce.getCaseHistory(a,r,i).then(b=>d(b)).catch(()=>d([])).finally(()=>f(!1)))},[a,r,i]);const h=v.useCallback(()=>{f(!0),x.current="",Ce.getCaseHistory(a,r,i).then(p=>d(p)).catch(()=>d([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:m,refetch:h}}function $j(a,r,i){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!i||i.length===0)return o;const m=i.slice(0,10).map(h=>h.assertions.find(p=>p.id===a)).filter(Boolean);if(m.length>=2){const p=m.filter(b=>b.pass).length/m.length;p>=.3&&p<=.7&&(o.flaky=!0)}const f=i.find(h=>h.type==="benchmark"),x=i.find(h=>h.type==="baseline");if(f&&x){const h=f.assertions.find(b=>b.id===a),p=x.assertions.find(b=>b.id===a);h!=null&&h.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const p=i[0].assertions.find(b=>b.id===a);p!=null&&p.pass&&(o.regression=!0)}return o}function Gj(){var le;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:d,cancelCase:m,cancelAll:f,generateEvals:x,isReadOnly:h}=Sn(),{evals:p,evalsError:b,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:C,generateEvalsProgress:A,generateEvalsError:E}=a,N=v.useMemo(()=>{for(const Q of S.values())if(Q.status==="running"||Q.status==="queued")return!0;return!1},[S]),[R,L]=v.useState(!1),[I,O]=v.useState("all"),$={skill_name:a.skill,evals:[]},w=p??$,D=w.evals,M=v.useMemo(()=>I==="all"?D:D.filter(Q=>ir(Q)===I),[I,D]),U=M.find(Q=>Q.id===g)??null;v.useEffect(()=>{g!==null&&!M.find(Q=>Q.id===g)&&r({type:"SELECT_CASE",caseId:M.length>0?M[0].id:null})},[M,g,r]);const[q,W]=v.useState([]),P=v.useMemo(()=>D.some(Q=>ir(Q)==="integration"),[D]);v.useEffect(()=>{P&&Ce.getCredentials(a.plugin,a.skill).then(Q=>W(Q.credentials)).catch(()=>W([]))},[a.plugin,a.skill,P]);const F=v.useMemo(()=>new Set(q.filter(Q=>Q.status==="missing").map(Q=>Q.name)),[q]),[_,T]=v.useState(!1),B=v.useCallback(Q=>{T(!1),x(Q?{testType:Q}:void 0)},[x]);return!p||D.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background: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:()=>L(!0),disabled:h,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:()=>B("unit"),disabled:C||h,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:C?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:()=>T(!_),disabled:C||h,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"})})})]}),_&&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:()=>B("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"})})]})]}),C&&A.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Rs,{entries:A,isRunning:!0})}),E&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ts,{error:E,onRetry:()=>B()})}),R&&n.jsx(Nx,{evals:w,onSave:Q=>{i(Q),L(!1)},onCancel:()=>L(!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:f,className:"btn text-[10px] px-2 py-0.5",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel All"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>d("benchmark"),disabled:M.length===0||h,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>d("comparison"),disabled:M.length===0||h,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:I===Q?600:400,background:I===Q?"var(--accent-muted)":"transparent",color:I===Q?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Q==="all"?`All (${D.length})`:Q==="unit"?`Unit (${D.filter(pe=>ir(pe)==="unit").length})`:`Integration (${D.filter(pe=>ir(pe)==="integration").length})`},Q))}),n.jsxs("div",{className:"py-1",children:[M.length===0&&D.length>0&&n.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",I==="all"?"":I+" ","tests yet"]}),M.map(Q=>{var re;const pe=j.get(Q.id),z=g===Q.id,X=ir(Q);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:Q.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:z?"var(--accent-muted)":"transparent",borderLeft:z?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:de=>{z||(de.currentTarget.style.background="var(--surface-2)")},onMouseLeave:de=>{z||(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:z?"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=>F.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(Gv,{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(Kj,{passRate:pe.passRate})]})]},Q.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!h&&n.jsx("button",{onClick:()=>L(!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(Ij,{})})]}),n.jsx("div",{className:"overflow-auto",children:U?n.jsx(qj,{evalCase:U,result:j.get(U.id),evals:p,caseStatus:((le=S.get(U.id))==null?void 0:le.status)??"idle",onSaveEvals:i,onRun:Q=>o(Q,"benchmark"),onCompare:Q=>o(Q,"comparison"),onCancel:Q=>m(Q),onImprove:Q=>r({type:"OPEN_IMPROVE",evalId:Q})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),R&&n.jsx(Nx,{evals:w,onSave:Q=>{i(Q),L(!1)},onCancel:()=>L(!1)})]})}function qj({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:d,onRun:m,onCompare:f,onCancel:x,onImprove:h}){const{state:p,isReadOnly:b}=Sn(),{plugin:g,skill:j}=p,{entries:S,loading:C}=Vj(g,j,a.id),[A,E]=v.useState(!1),[N,R]=v.useState(a.prompt),[L,I]=v.useState(!1),[O,$]=v.useState(a.expected_output);v.useState(()=>{R(a.prompt),$(a.expected_output)});const w=v.useCallback(Q=>{d({...i,evals:i.evals.map(pe=>pe.id===Q.id?Q:pe)})},[i,d]),D=v.useCallback(()=>{w({...a,prompt:N}),E(!1)},[a,N,w]),M=v.useCallback(()=>{w({...a,expected_output:O}),I(!1)},[a,O,w]),U=v.useCallback(()=>{w({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,w]),q=v.useCallback((Q,pe)=>{w({...a,assertions:a.assertions.map(z=>z.id===Q?{...z,text:pe}:z)})},[a,w]),W=v.useCallback(Q=>{w({...a,assertions:a.assertions.filter(pe=>pe.id!==Q)})},[a,w]),P=v.useCallback(()=>{confirm("Delete this test case?")&&d({...i,evals:i.evals.filter(Q=>Q.id!==a.id)})},[i,a.id,d]),F=r&&r.assertions.length>0&&r.assertions.every(Q=>Q.pass),_=r&&r.assertions.some(Q=>!Q.pass),T=ir(a),B=a.requiredCredentials??[],le=T==="integration"&&B.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:T==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:T==="unit"?"var(--accent)":"var(--orange)"},children:T==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((T==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:pe,requirements:z,cleanup:X,...re}=a;w({...re,testType:"unit"})}else w({...a,testType:"integration"})},title:`Click to switch to ${T==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:T==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:T==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:T==="unit"?"Unit":"Integration"}),n.jsx(Gv,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>x(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:()=>f(a.id),disabled:b,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),_&&!b&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>h(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!b&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:P,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&&T==="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"})]}),F&&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"})]}),le&&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:B.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&&T==="integration"&&n.jsx(Xj,{evalCase:a,onUpdate:w}),n.jsx(Yi,{title:"Prompt",children:A?n.jsxs("div",{children:[n.jsx("textarea",{value:N,onChange:Q=>R(Q.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:D,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{R(a.prompt),E(!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||E(!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(Yi,{title:"Expected Output",children:L?n.jsxs("div",{children:[n.jsx("textarea",{value:O,onChange:Q=>$(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:()=>{$(a.expected_output),I(!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||I(!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(Yi,{title:`Assertions (${a.assertions.length})`,action:b?void 0:n.jsx("button",{onClick:U,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=r==null?void 0:r.assertions.find(X=>X.assertion_id===Q.id),z=$j(Q.id,pe,S);return n.jsx(Yj,{assertion:Q,result:pe,badges:z,isReadOnly:b,onUpdate:X=>q(Q.id,X),onDelete:()=>W(Q.id)},Q.id)})})}),(r==null?void 0:r.output)&&n.jsx(Wj,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const Q=Vv("INEFFECTIVE",r.passRate);return Q.recommendations&&Q.recommendations.length>0?n.jsx(Yi,{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,z)=>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]},z))})]})}):null})(),n.jsx(Qj,{evalId:a.id,sharedEntries:S,sharedLoading:C})]},a.id)}function Yj({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:d,onDelete:m}){const[f,x]=v.useState(!1),[h,p]=v.useState(a.text),[b,g]=v.useState(!1),j=()=>{d(h),x(!1)};return n.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(i==null?void 0:i.regression)&&n.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:h,onChange:S=>p(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&x(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(a.text),x(!0))},children:a.text}),(r==null?void 0:r.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&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick:m,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:S=>{S.currentTarget.style.color="var(--red)",S.currentTarget.style.opacity="1"},onMouseLeave:S=>{S.currentTarget.style.color="var(--text-tertiary)",S.currentTarget.style.opacity=""},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function Yi({title:a,action:r,children:i}){return n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:a}),r]}),i]})}function Gv({result:a}){const[r,i]=v.useState(!1);if(!a||a.status==null)return n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=a.status==="pass",d=a.passRate??0,f=Vv(o?"PASS":"FAIL",d);return n.jsxs("span",{className:"pill text-[10px]",style:{background:o?"var(--green-muted)":"var(--red-muted)",color:o?"var(--green)":"var(--red)",position:"relative",cursor:"default"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),"aria-describedby":r?"verdict-tooltip":void 0,children:[a.passRate!=null?`${Math.round(a.passRate*100)}%`:a.status,r&&n.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:f.explanation})]})}function Kj({passRate:a}){const r=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-1",children:n.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:n.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:r>=80?"var(--green)":r>=50?"var(--yellow)":"var(--red)"}})})})}function Wj({output:a,durationMs:r,tokens:i}){const[o,d]=v.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>d(!o),className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:o?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",r!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",(r/1e3).toFixed(1),"s)"]}),i!=null&&n.jsxs("span",{style:{fontWeight:400},children:["(",i," tokens)"]})]}),o&&n.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})]})}function Gu(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function qu({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:Hv(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:fr(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:Uv(a.durationMs)}),a.tokens!=null&&n.jsxs("span",{children:[a.tokens>=1e3?`${(a.tokens/1e3).toFixed(1)}k`:a.tokens," tok"]})]}),a.type==="comparison"&&a.baselinePassRate!=null&&(()=>{const r=a.pass_rate-a.baselinePassRate,i=r>.001?"skill":r<-.001?"baseline":"tie",o=r>0?"+":"",d=i==="skill"?"var(--green)":i==="baseline"?"var(--red)":"var(--text-tertiary)";return n.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color:r>=0?"var(--green)":"var(--red)"},children:[o,(r*100).toFixed(1),"%"]}),n.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:d},children:i})]})})(),n.jsx("div",{className:"space-y-0.5",children:a.assertions.map(r=>n.jsxs("div",{className:"flex items-start gap-1.5",children:[n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:r.text})]},r.id))})]})}function Qj({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:d}=Sn(),{plugin:m,skill:f}=o,[x,h]=v.useState(!0),p=r??null,b=i??!1,g=v.useCallback(()=>{h(A=>!A)},[]),j=p?p.slice(0,10):[],S=j.some(A=>{const E=Gu(A.type);return E==="left"||E==="full"}),C=j.some(A=>{const E=Gu(A.type);return E==="right"||E==="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:x?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease"},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&n.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),x&&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..."})]}):!p||p.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(Iv,{entries:j})}),n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!S&&n.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!C&&n.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),j.map((A,E)=>{const N=Gu(A.type);return N==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(qu,{entry:A})},E):N==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(qu,{entry:A})}),n.jsx("div",{style:{gridColumn:"2"}})]},E):n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"}}),n.jsx("div",{style:{gridColumn:"2"},children:n.jsx(qu,{entry:A})})]},E)})]}),n.jsx("button",{onClick:()=>d({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:A=>{A.currentTarget.style.textDecoration="underline"},onMouseLeave:A=>{A.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Nx({evals:a,onSave:r,onCancel:i}){const[o,d]=v.useState(""),[m,f]=v.useState(""),[x,h]=v.useState(""),[p,b]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,C]=v.useState(""),[A,E]=v.useState([]),[N,R]=v.useState(""),[L,I]=v.useState(""),O=Math.max(0,...a.evals.map(M=>M.id))+1,$=M=>{j(M),M==="unit"&&(E([]),C(""),R(""),I(""))},w=()=>{const M=S.trim().toUpperCase();M&&!A.includes(M)&&E([...A,M]),C("")},D=()=>{if(!o.trim()||!m.trim())return;const M={id:O,name:o.trim(),prompt:m.trim(),expected_output:x.trim(),files:[],assertions:p.filter(U=>U.text.trim()),...g==="integration"?{testType:"integration",...A.length>0?{requiredCredentials:A}:{},...N||L?{requirements:{...N?{platform:N}:{},...L?{chromeProfile:L}:{}}}:{}}:{}};r({...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:()=>$(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:o,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=>f(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:x,onChange:M=>h(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"}),p.map((M,U)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:M.text,onChange:q=>b(p.map((W,P)=>P===U?{...W,text:q.target.value}:W)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&n.jsx("button",{onClick:()=>b(p.filter((q,W)=>W!==U)),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([...p,{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:A.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:()=>E(A.filter(U=>U!==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:S,onChange:M=>C(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=>R(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:L,onChange:M=>I(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:D,disabled:!o.trim()||!m.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function Xj({evalCase:a,onUpdate:r}){var f,x;const[i,o]=v.useState(""),d=()=>{const h=i.trim().toUpperCase();h&&!(a.requiredCredentials??[]).includes(h)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],h]}),o("")},m=h=>{const p=(a.requiredCredentials??[]).filter(b=>b!==h);r({...a,requiredCredentials:p.length>0?p: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(h=>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:[h,n.jsx("button",{onClick:()=>m(h),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"})]})})]},h))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:h=>o(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),d())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:d,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:h=>r({...a,requirements:{...a.requirements,platform:h.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:((x=a.requirements)==null?void 0:x.chromeProfile)??"",onChange:h=>r({...a,requirements:{...a.requirements,chromeProfile:h.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function jn(a,r){return r==="free"?"Free":r==="subscription"&&a==null?"Subscription":a==null?"N/A":a>=1?`$${a.toFixed(2)}`:a===0?"$0.00":a>=.001?`$${a.toFixed(4)}`:`$${a.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function qv(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function Fj(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function Zj(a,r){let i="";if(r){const d=new Date(r);isNaN(d.getTime())||(i=d.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function Pj(a,r,i){const o=i===1?"test case":"test cases";if(a===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const d=Math.round(Math.abs(a)*r);if(d===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const m=a>0?"more":"fewer";return`Your skill passes ${d} ${m} assertions across ${i} ${o}`}function Cx(a,r){const i=o=>{const d=o/5*100;return isFinite(d)?Math.round(Math.min(100,Math.max(0,d))):0};return{skill:i(a),baseline:i(r)}}function Jj(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function eS(a,r){const i=a+r,o=i*10,d=i*25,m=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${m(o)}–${m(d)}`}const tS={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function nS(a,r){if(!a)return null;const i=tS[a];if(i==null||i===0)return null;const o=i*r*.5,d=i*r*2;return`${jn(o)}–${jn(d)}`}function aS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:d,isReadOnly:m}=Sn(),{evals:f,caseRunStates:x,bulkRunActive:h,latestBenchmark:p,inlineResults:b}=a,{config:g}=yl(),j=(f==null?void 0:f.evals)??[],S=v.useMemo(()=>{for(const w of x.values())if(w.status==="running"||w.status==="queued")return!0;return!1},[x]),C=j.filter(w=>{const D=x.get(w.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,A=j.filter(w=>{const D=x.get(w.id);return D&&(D.status==="running"||D.status==="queued")}).length,E=v.useRef(null),[N,R]=v.useState(0);v.useEffect(()=>{if(S&&!E.current&&(E.current=Date.now()),!S){E.current=null,R(0);return}const w=setInterval(()=>{E.current&&R(Math.round((Date.now()-E.current)/1e3))},1e3);return()=>clearInterval(w)},[S]);const L=j.reduce((w,D)=>w+D.assertions.length,0),I=j.length+L,O=v.useMemo(()=>eS(j.length,L),[j.length,L]),$=v.useMemo(()=>nS((g==null?void 0:g.provider)??null,I),[g==null?void 0:g.provider,I]);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"}),S&&n.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[A," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:d,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),n.jsx("button",{onClick:()=>i("comparison"),disabled:j.length===0||S||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||S||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||S||m,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!S&&j.length>0&&n.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("span",{children:["Est. duration: ",O]}),$&&n.jsxs("span",{children:["Est. cost: ",$]}),!$&&(g==null?void 0:g.provider)&&(g.provider==="claude-cli"||g.provider==="codex-cli")&&n.jsx("span",{children:"Cost: Subscription"}),!$&&(g==null?void 0:g.provider)&&(g.provider==="ollama"||g.provider==="lm-studio"||g.provider==="gemini-cli")&&n.jsx("span",{children:"Cost: Free"})]})]}),S&&j.length>0&&n.jsxs("div",{className:"mb-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",C,"/",j.length," cases"]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(C/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:`${C/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 D=b.get(w.id),M=x.get(w.id),U=(M==null?void 0:M.status)??"idle",q=p==null?void 0:p.cases.find(W=>W.eval_id===w.id);return n.jsx(rS,{name:w.name,evalId:w.id,result:D,caseCost:q==null?void 0:q.cost,caseBillingMode:q==null?void 0:q.billingMode,caseInputTokens:q==null?void 0:q.inputTokens,caseOutputTokens:q==null?void 0:q.outputTokens,caseStatus:U,runMode:(M==null?void 0:M.mode)??null,comparisonDetail:q==null?void 0:q.comparisonDetail,isReadOnly:m,onRun:W=>r(W,"benchmark"),onBaseline:W=>r(W,"baseline"),onCompare:W=>r(W,"comparison"),onCancel:W=>o(W)},w.id)})}),!S&&p&&p.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:Fj(p.type)}),n.jsx("span",{className:"text-[20px] font-bold",style:{color:(p.overall_pass_rate??0)>=.8?"var(--green)":(p.overall_pass_rate??0)>=.5?"var(--yellow)":"var(--red)"},children:p.overall_pass_rate!=null?`${Math.round(p.overall_pass_rate*100)}%`:"--"})]}),p.totalDurationMs!=null&&n.jsxs("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:["Total: ",(p.totalDurationMs/1e3).toFixed(1),"s",p.model&&` | Model: ${p.model}`,p.totalInputTokens!=null&&p.totalOutputTokens!=null&&` | Tokens: ${qv(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${jn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.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"})]}),p.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=Zj(p.model,p.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(Ex,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Ex,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),n.jsxs("div",{className:"mt-3 text-[12px] font-medium",style:{color:p.comparison.delta>0?"var(--green)":p.comparison.delta<0?"var(--red)":"var(--text-tertiary)"},children:["Delta: ",p.comparison.delta>0?"+":"",(p.comparison.delta*100).toFixed(1),"%",p.verdict&&` | ${Uj(p.verdict)}`]}),(()=>{const w=p.cases.reduce((M,U)=>M+U.assertions.length,0),D=Pj(p.comparison.delta,w,p.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const lS={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 rS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:d,caseInputTokens:m,caseOutputTokens:f,caseStatus:x,runMode:h,comparisonDetail:p,isReadOnly:b,onRun:g,onBaseline:j,onCompare:S,onCancel:C}){const[A,E]=v.useState(!1),N=x==="running"||x==="queued",R=x==="complete"||x==="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:[x==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),x==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),h&&(N||R)&&(()=>{const L=lS[h];return L?n.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:L.bg,color:L.color,padding:"1px 6px"},children:L.label}):null})()]}),n.jsxs("div",{className:"flex items-center gap-2",children:[N?n.jsx("button",{onClick:()=>C(r),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>S(r),disabled:b,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:b,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),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&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:qv(m,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:jn(o,d)}),x==="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(L=>n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{style:{color:L.pass?"var(--green)":"var(--red)"},children:L.pass?"PASS":"FAIL"}),n.jsx("span",{style:{color:"var(--text-secondary)"},children:L.text})]},L.assertion_id))}),i.output&&n.jsx("button",{onClick:()=>E(!A),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:A?"Hide output":"Show output"}),A&&i.output&&n.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:i.output})]}),p&&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 L=Cx(p.skillContentScore,p.baselineContentScore),I=Cx(p.skillStructureScore,p.baselineStructureScore),O=Jj(p.winner);return n.jsxs(n.Fragment,{children:[n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",L.skill,"% / Baseline ",L.baseline,"%"]}),n.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),n.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",I.skill,"% / Baseline ",I.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(sS,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Yu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function sS({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),d=(r==null?void 0:r.title)??"Error",m=r==null?void 0:r.hint,f=r?Yu[r.category]??Yu.unknown:Yu.unknown;return n.jsx("div",{className:"px-4 pb-3",children:n.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[n.jsx("span",{style:{fontSize:12},children:f}),n.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:d}),n.jsx("button",{onClick:()=>o(!i),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:i?"Hide details":"Details"})]}),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 Ex({label:a,value:r,color:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:a}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i},children:[Math.round(r*100),"%"]})]}),n.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:n.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${r*100}%`,background:i}})})]})}const Tx={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 iS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:d}=Sn(),{plugin:m,skill:f,activationPrompts:x,activationResults:h,activationSummary:p,activationRunning:b,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:C,generatingPromptsError:A,activationHistory:E}=a,[N,R]=v.useState(x),[L,I]=v.useState(null),[O,$]=v.useState(!1);v.useEffect(()=>{x&&x!==N&&R(x)},[x]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:N})},[N,r]),v.useEffect(()=>{fetch(`/api/skills/${m}/${f}/description`).then(_=>_.json()).then(_=>I(_.rawContent||_.description||null)).catch(()=>I(null))},[m,f]);function w(){i(N)}function D(){d(8)}const M=N.trim().split(`
69
- `).filter(Boolean).length,U=h.filter(_=>_.classification==="TP"||_.classification==="TN"),q=h.filter(_=>_.classification==="FP"||_.classification==="FN"),W=(L==null?void 0:L.replace(/^---[\s\S]*?---\s*/,"").trim())??null,P=N.trim().length>0,F=W?fo(W):"";return n.jsxs("div",{className:"p-5 space-y-5",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),n.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),n.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[n.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),n.jsx("div",{className:"flex gap-1.5",children:n.jsx("button",{onClick:D,disabled:C||!W||b,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:C?"var(--surface-3)":"var(--surface-2)",color:W?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:W?1:.5,cursor:W?"pointer":"not-allowed"},title:W?void 0:"No skill description available",onMouseEnter:_=>{W&&!C&&(_.currentTarget.style.background="var(--surface-3)")},onMouseLeave:_=>{C||(_.currentTarget.style.background="var(--surface-2)")},children:C?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"})}),P?"Regenerate":"Generate"," Test Prompts"]})})})]}),!W&&!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."}),A&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:A}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:N,onChange:_=>R(_.target.value),placeholder:`How do I write a unit test?
70
- What edge cases should I test?
71
- +Deploy this to production
72
- !What's the weather like today?
73
- !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(Ki,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Ki,{}),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(Ki,{}),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(Ki,{}),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:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${h.length} / ${M} prompts tested`,j&&n.jsx(dS,{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:W?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:F}}):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&&h.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..."})]}),h.length>0&&n.jsxs("div",{className:"space-y-5",children:[q.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 (",q.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:q.map((_,T)=>n.jsx(Rx,{result:_},`incorrect-${T}`))})]}),U.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 (",U.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:U.map((_,T)=>n.jsx(Rx,{result:_},`correct-${T}`))})]})]}),p&&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"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:[p.autoClassifiedCount," of ",p.total," prompts auto-classified from skill name and tags"]}),n.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[n.jsx(Ku,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),n.jsx(Ku,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),n.jsx(Ku,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.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(Wi,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Wi,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Wi,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Wi,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(oS,{history:E,expanded:O,onToggle:()=>$(!O)})]})}function oS({history:a,expanded:r,onToggle:i}){return a===null?null:n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:r?"1px solid var(--border-subtle)":"none"},onClick:i,children:[n.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",a.length>0&&n.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",a.length," run",a.length!==1?"s":"",")"]})]}),n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),r&&n.jsx("div",{className:"px-4 py-3",children:a.length===0?n.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):n.jsx("div",{className:"space-y-2",children:a.map(o=>n.jsx(cS,{run:o},o.id))})})]})}function cS({run:a}){const r=Math.round(a.summary.reliability*100),i=r>=80?"var(--green)":r>=60?"var(--yellow)":"var(--red)",o=r>=80?"Good":r>=60?"Needs Work":"Poor",d=i;return n.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[n.jsx("div",{className:"flex-1 min-w-0",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:uS(a.timestamp)}),n.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:a.model||a.provider}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.promptCount," prompts"]})]})}),n.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:i,fontVariantNumeric:"tabular-nums"},children:[r,"%"]}),n.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:d,background:`color-mix(in srgb, ${d} 10%, transparent)`},children:o})]})]})}function uS(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const d=Math.floor(o/60);if(d<60)return`${d}m ago`;const m=Math.floor(d/60);if(m<24)return`${m}h ago`;const f=Math.floor(m/24);return f<7?`${f}d ago`:new Date(a).toLocaleDateString()}function Ki(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Rx({result:a}){const r=Tx[a.classification]||Tx.FN,i=a.classification==="TP"||a.classification==="TN";return n.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:r.bg,border:"1px solid transparent"},children:[n.jsx("div",{className:"flex-shrink-0 mt-0.5",children:n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${r.text} 20%, transparent)`},children:i?n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:r.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1",children:n.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:a.prompt})}),n.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[n.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:r.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:a.classification}),n.jsx("span",{style:{color:a.activate?"var(--green)":"var(--text-tertiary)"},children:a.activate?"Activated":"Silent"}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",a.expected==="should_activate"?"activate":"stay silent"]}),n.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[a.confidence," confidence"]}),a.autoClassified&&n.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),a.reasoning&&n.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:a.reasoning})]})]})}function Ku({label:a,value:r,description:i,detail:o}){const d=Math.round(r*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:o})]})}function Wi({abbr:a,count:r,bg:i,color:o,description:d}){return n.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:i},children:[n.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:r}),n.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:a}),n.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:d})]})}function dS({startedAt:a}){const[r,i]=v.useState(0);return v.useEffect(()=>{const o=setInterval(()=>i(Math.floor((Date.now()-a)/1e3)),1e3);return()=>clearInterval(o)},[a]),n.jsxs("span",{className:"ml-2",children:["(",r,"s)"]})}const Wu={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Ax={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},sd=600,id=180,en=40,Qu=sd-en*2,Ga=id-en*2,fS=[25,50,75,100];function Mx(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function pS(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function mS({entries:a,onPointClick:r}){const[i,o]=v.useState(null),d=v.useMemo(()=>[...a].reverse(),[a]);if(d.length<2)return null;const m=d.length,f=d.map((p,b)=>{const g=en+b/(m-1)*Qu,j=p.passRate*100,S=en+Ga-j/100*Ga;return{x:g,y:S,pct:j,entry:p}}),x=f.map(p=>`${p.x},${p.y}`).join(" "),h=Array.from(new Set(d.map(p=>p.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:h.map(p=>n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Wu[p]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Ax[p]??p})]},p))}),n.jsxs("svg",{width:sd,height:id,viewBox:`0 0 ${sd} ${id}`,style:{display:"block",overflow:"visible"},children:[fS.map(p=>{const b=en+Ga-p/100*Ga;return n.jsxs("g",{children:[n.jsx("line",{x1:en,y1:b,x2:en+Qu,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:[p,"%"]})]},p)}),n.jsx("line",{x1:en,y1:en+Ga,x2:en+Qu,y2:en+Ga,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:en-8,y:en+Ga+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:x,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((p,b)=>n.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Wu[p.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"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:g=>{g.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>r==null?void 0:r(p.entry)},b)),hS(m).map(p=>n.jsx("text",{x:f[p].x,y:en+Ga+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Mx(d[p].timestamp)},p))]}),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:Mx(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:Wu[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Ax[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:pS(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function hS(a){if(a<=3)return Array.from({length:a},(o,d)=>d);if(a<=6)return[0,Math.floor(a/2),a-1];if(a<20)return[0,Math.floor(a/3),Math.floor(2*a/3),a-1];const r=Math.ceil(a/10),i=[0];for(let o=r;o<a-1;o+=r)i.push(o);return i.push(a-1),i}const fs=new Map;let tn=null,Pi=null,Qi=1e3,ps=0;function Yv(){if(tn)return;tn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const d=fs.get(r);if(d)for(const m of d)m(o)};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,ps>0&&(Pi=setTimeout(()=>{Qi=Math.min(Qi*2,3e4),Yv()},Qi))},tn.onopen=()=>{Qi=1e3}}function xS(){Pi!=null&&(clearTimeout(Pi),Pi=null),tn==null||tn.close(),tn=null}function vS(a,r){return fs.has(a)||fs.set(a,new Set),fs.get(a).add(r),ps++,Yv(),()=>{var i;(i=fs.get(a))==null||i.delete(r),ps--,ps<=0&&(ps=0,xS())}}function ao(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>vS(a,d=>i.current(d)),[a])}function lo(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function yS(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function gS({rate:a,label:r}){const i=Math.round(a*100);return n.jsx("div",{className:"flex items-center gap-3",children:n.jsxs("div",{className:"flex-1",children:[n.jsxs("div",{className:"flex items-center justify-between mb-1",children:[n.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:r}),n.jsxs("span",{className:"text-[11px] font-semibold",style:{color: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 bS({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,d=a.length,m=a.map((h,p)=>{const b=o+p/(d-1)*(r-o*2),g=o+(i-o*2)-h.passRate*(i-o*2);return{x:b,y:g}}),f=`M ${m[0].x},${i-o} `+m.map(h=>`L ${h.x},${h.y}`).join(" ")+` L ${m[m.length-1].x},${i-o} Z`,x=m.map((h,p)=>`${p===0?"M":"L"} ${h.x},${h.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:x,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 jS({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ce.getStats(a,r),[a,r]),{data:d,loading:m}=uo(i,o),f=v.useCallback(()=>Es(i),[i]);if(ao("benchmark:complete",f),ao("history:written",f),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 x=d.trendPoints.length>0?d.trendPoints[d.trendPoints.length-1].passRate:0,h=d.trendPoints.length>0?d.trendPoints[0].passRate:0,p=x-h,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(x)},children:[Math.round(x*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:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*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(bS,{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:yS(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(gS,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function SS({plugin:a,skill:r}){const[i,o]=v.useState(null),[d,m]=v.useState(null),[f,x]=v.useState({}),[h,p]=v.useState({});v.useEffect(()=>{Ce.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function b(g){if(d===g){m(null);return}if(m(g),!f[g]){p(j=>({...j,[g]:!0}));try{const j=await Ce.getCaseHistory(a,r,g);x(S=>({...S,[g]:j}))}catch{x(j=>({...j,[g]:[]}))}finally{p(j=>({...j,[g]:!1}))}}}return i?n.jsx("div",{className:"space-y-2 stagger-children",children:i.evals.map(g=>{const j=f[g.id]||[],S=d===g.id,C=h[g.id],A=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:S?"var(--surface-2)":"transparent"},onMouseEnter:E=>{S||(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{S||(E.currentTarget.style.background="transparent")},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:S?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:n.jsx("polyline",{points:"9 18 15 12 9 6"})}),n.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",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(Iv,{entries:j}),A!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:fr(A)},children:[Math.round(A*100),"%"]}),j.length>0&&n.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[j.length," runs"]})]}),S&&n.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:C?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((E,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:Hv(E.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:E.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:E.type==="benchmark"?"rgba(99,131,255,0.15)":E.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:E.type==="benchmark"?"#6383ff":E.type==="comparison"?"var(--purple)":"#fb923c"},children:E.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:fr(E.pass_rate)},children:[Math.round(E.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:[E.durationMs!=null&&n.jsx("span",{children:Uv(E.durationMs)}),E.tokens!=null&&n.jsxs("span",{children:[E.tokens>=1e3?`${(E.tokens/1e3).toFixed(1)}k`:E.tokens," tok"]})]}),n.jsx("div",{className:"space-y-1",children:E.assertions.map(R=>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:R.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:R.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:R.text}),R.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:R.reasoning})]})]},R.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 kS(){const{state:a,dispatch:r}=Sn(),{plugin:i,skill:o}=a,[d,m]=v.useState("timeline"),[f,x]=v.useState(""),[h,p]=v.useState(""),[b,g]=v.useState(!1),[j,S]=v.useState([]),[C,A]=v.useState(null),[E,N]=v.useState(!1),[R,L]=v.useState(null),[I,O]=v.useState(!1),$=`history/${i}/${o}?model=${f}&type=${h}`,w=v.useCallback(()=>Ce.getHistory(i,o,{model:f||void 0,type:h||void 0}),[i,o,f,h]),{data:D,loading:M}=uo($,w),U=D??[];v.useEffect(()=>{!D||D.length<2||Ce.compareRuns(i,o,D[0].timestamp,D[1].timestamp).then(_=>{const T=_.regressions.filter(B=>B.change==="regression");r({type:"SET_REGRESSIONS",regressions:T})}).catch(()=>{})},[D,i,o,r]);const q=v.useCallback(()=>Es($),[$]);ao("history:written",q);const W=v.useCallback(async _=>{if(b){S(T=>T.includes(_)?T.filter(B=>B!==_):T.length>=2?[T[1],_]:[...T,_]);return}O(!0);try{const T=await Ce.getHistoryEntry(i,o,_);L(T)}catch{}finally{O(!1)}},[i,o,b]),P=v.useCallback(async()=>{if(j.length===2){N(!0);try{const _=await Ce.compareRuns(i,o,j[0],j[1]);A(_)}catch{}finally{N(!1)}}},[i,o,j]),F=[...new Set(U.map(_=>_.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(_=>n.jsx("button",{onClick:()=>m(_),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:d===_?"var(--accent-muted)":"transparent",color:d===_?"var(--accent)":"var(--text-tertiary)"},children:_==="timeline"?"Timeline":_==="per-eval"?"Per Eval":"Statistics"},_))}),d==="timeline"&&n.jsxs("div",{children:[U.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(mS,{entries:U,onPointClick:_=>W(_.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:_=>x(_.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),F.map(_=>n.jsx("option",{value:_,children:_},_))]}),n.jsxs("select",{value:h,onChange:_=>p(_.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),S([]),A(null)},className:`btn text-[12px] ${b?"btn-primary":"btn-secondary"}`,children:b?"Exit Compare":"Compare Runs"}),b&&j.length===2&&n.jsx("button",{onClick:P,disabled:E,className:"btn btn-primary text-[12px]",children:E?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:U.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):U.map(_=>{const T=j.includes(_.timestamp);return n.jsx("button",{onClick:()=>W(_.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:T?"var(--accent-muted)":"var(--surface-1)",border:T?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:B=>{T||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{T||(B.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:T?"var(--accent)":"var(--border-default)",background:T?"var(--accent)":"transparent"},children:T&&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(_.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:_.type==="comparison"?"var(--purple-muted)":_.type==="baseline"?"var(--surface-3)":_.type==="model-compare"?"var(--accent-muted)":_.type==="improve"||_.type==="instruct"?"var(--purple-muted)":_.type==="ai-generate"?"var(--green-muted)":_.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:_.type==="comparison"?"var(--purple)":_.type==="baseline"?"var(--text-tertiary)":_.type==="model-compare"?"var(--accent)":_.type==="improve"||_.type==="instruct"?"var(--purple)":_.type==="ai-generate"?"var(--green)":_.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:_.type==="model-compare"?"model compare":_.type==="improve"?"ai improve":_.type==="instruct"?"ai edit":_.type==="ai-generate"?"ai generate":_.type==="eval-generate"?"eval generate":_.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:_.model}),_.totalCost!=null&&_.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:jn(_.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:_.passRate>=.8?"var(--green)":_.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(_.passRate*100),"%"]})]})]})},_.timestamp)})}),C&&n.jsx(wS,{result:C}),R&&!b&&n.jsx(NS,{run:R,onClose:()=>L(null)})]}),d==="per-eval"&&n.jsx(SS,{plugin:i,skill:o}),d==="statistics"&&n.jsx(jS,{plugin:i,skill:o})]})}function wS({result:a}){const r=a.regressions.filter(o=>o.change==="regression"),i=a.regressions.filter(o=>o.change==="improvement");return n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(a.runA.timestamp).toLocaleDateString()," vs ",new Date(a.runB.timestamp).toLocaleDateString()]}),(a.runA.totalCost!=null||a.runB.totalCost!=null)&&n.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[n.jsxs("span",{children:["Run A cost: ",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)]})]}),r.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",r.length,")"]}),r.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),i.length>0&&n.jsxs("div",{className:"mb-3",children:[n.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",i.length,")"]}),i.map(o=>n.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",n.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),n.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:n.jsxs("table",{className:"w-full text-[12px]",children:[n.jsx("thead",{children:n.jsxs("tr",{style:{background:"var(--surface-2)"},children:[n.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),n.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),n.jsx("tbody",{children:a.caseDiffs.map(o=>n.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[n.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateA!=null?o.passRateA>=.8?"var(--green)":o.passRateA>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateA!=null?`${Math.round(o.passRateA*100)}%`:o.statusA}),n.jsx("td",{className:"text-right px-3 py-2",style:{color:o.passRateB!=null?o.passRateB>=.8?"var(--green)":o.passRateB>=.5?"var(--yellow)":"var(--red)":"var(--text-tertiary)"},children:o.passRateB!=null?`${Math.round(o.passRateB*100)}%`:o.statusB})]},o.eval_id))})]})})]})}function NS({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(CS,{run:a,onClose:r}):n.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(a.timestamp).toLocaleString()]}),n.jsx("button",{onClick:r,className:"btn btn-ghost text-[11px]",children:"Close"})]}),n.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",a.model," | Cases: ",a.cases.length," | Pass Rate: ",a.overall_pass_rate!=null?`${Math.round(a.overall_pass_rate*100)}%`:"--",a.totalCost!=null&&a.totalCost>0&&` | Cost: ${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 CS({run:a,onClose:r}){var m;const i=v.useMemo(()=>a.improve?po(a.improve.original,a.improve.improved):[],[a.improve]),o=v.useMemo(()=>{const f=i.filter(h=>h.type==="added").length,x=i.filter(h=>h.type==="removed").length;return{added:f,removed:x}},[i]),d=v.useMemo(()=>{let f=0,x=0;return i.map(h=>h.type==="removed"?(f++,{...h,origNum:f,newNum:null}):h.type==="added"?(x++,{...h,origNum:null,newNum:x}):(f++,x++,{...h,origNum:f,newNum:x}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((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((f,x)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||"​"})]},x))})})})]})}function ES({plugin:a,skill:r}){const[i,o]=v.useState([]),[d,m]=v.useState([]),[f,x]=v.useState(!0),[h,p]=v.useState(null);v.useEffect(()=>{Ce.getDependencies(a,r).then(g=>{o(g.mcpDependencies),m(g.skillDependencies)}).catch(()=>{}).finally(()=>x(!1))},[a,r]);async function b(g,j){try{await navigator.clipboard.writeText(j),p(g),setTimeout(()=>p(null),2e3)}catch{}}return f?null:i.length===0&&d.length===0?n.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):n.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:i.length+d.length})]}),n.jsxs("div",{className:"px-5 py-4",children:[i.length>0&&n.jsxs("div",{className:"space-y-3 mb-4",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),i.map(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:h===g.server?"var(--green)":"var(--accent)"},children:h===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 zx({plugin:a,skill:r}){const[i,o]=v.useState([]),[d,m]=v.useState(!0),[f,x]=v.useState(null),[h,p]=v.useState(""),[b,g]=v.useState(!1),[j,S]=v.useState(null),[C,A]=v.useState(""),[E,N]=v.useState(""),[R,L]=v.useState(!1),[I,O]=v.useState(new Set),$=v.useCallback(async()=>{m(!0);try{const[U,q]=await Promise.all([Ce.getCredentials(a,r).catch(()=>({credentials:[]})),Ce.getParams(a,r).catch(()=>({params:[]}))]),W=new Map(q.params.map(_=>[_.name,_])),P=new Set,F=[];for(const _ of U.credentials){P.add(_.name);const T=W.get(_.name);F.push({name:_.name,status:_.status==="ready"||_.status==="resolved"?"ready":"missing",source:_.source,maskedValue:T==null?void 0:T.maskedValue})}for(const _ of q.params)P.has(_.name)||F.push({name:_.name,status:_.status,maskedValue:_.maskedValue});o(F)}finally{m(!1)}},[a,r]);v.useEffect(()=>{$()},[$]);const w=v.useCallback(async U=>{if(I.has(U)){O(q=>{const W=new Set(q);return W.delete(U),W}),o(q=>q.map(W=>W.name===U?{...W,revealedValue:void 0}:W));return}try{const W=(await Ce.getParamsRevealed(a,r,U)).params.find(P=>P.name===U);W&&(o(P=>P.map(F=>F.name===U?{...F,revealedValue:W.value}:F)),O(P=>new Set(P).add(U)))}catch{}},[a,r,I]),D=async(U,q)=>{if(!(!U.trim()||!q.trim())){g(!0),S(null);try{await Ce.setCredential(a,r,U,q),x(null),p(""),O(new Set),$()}catch(W){S(W.message)}finally{g(!1)}}},M=async()=>{if(!(!C.trim()||!E.trim())){g(!0),S(null);try{await Ce.setCredential(a,r,C.trim().toUpperCase(),E),A(""),N(""),L(!1),$()}catch(U){S(U.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:()=>L(!R),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&&!R?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(U=>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:U.name}),U.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:I.has(U.name)&&U.revealedValue!=null?U.revealedValue:U.maskedValue}),U.maskedValue&&n.jsx("button",{onClick:()=>w(U.name),className:"btn btn-ghost px-1",title:I.has(U.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:I.has(U.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:U.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:U.status==="ready"?"var(--green)":"var(--orange)"},children:U.status==="ready"?"ready":"missing"}),U.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:U.source}),f===U.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:h,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&D(U.name,h)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>D(U.name,h),disabled:b||!h.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:b?"...":"Save"}),n.jsx("button",{onClick:()=>{x(null),p("")},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:()=>{x(U.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},U.name))}),R&&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:C,onChange:U=>A(U.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:E,onChange:U=>N(U.target.value),onKeyDown:U=>{U.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:()=>{L(!1),A(""),N("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:M,disabled:b||!C.trim()||!E.trim(),className:"btn btn-primary text-[10px]",children:b?"Saving...":"Save"})]})]})]})}function TS(){const{state:a}=Sn(),{plugin:r,skill:i}=a,[o,d]=v.useState(null),[m,f]=v.useState(!0);return v.useEffect(()=>{Ce.getDependencies(r,i).then(d).catch(()=>{}).finally(()=>f(!1))},[r,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"})]}):o?n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx(ES,{plugin:r,skill:i}),n.jsx(zx,{plugin:r,skill:i})]}):n.jsxs("div",{className:"p-5 max-w-3xl",children:[n.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),n.jsx(zx,{plugin:r,skill:i})]})}function Kv({data:a}){if(a.length<2)return n.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const r=a.slice(-10),i=80,o=24,d=2,m=i-d*2,f=o-d*2,x=r.length,h=Math.min(...r),b=Math.max(...r)-h||1,g=r.map((C,A)=>{const E=d+A/(x-1)*m,N=d+f-(C-h)/b*f;return`${E.toFixed(1)},${N.toFixed(1)}`}),j=r[r.length-1],S=fr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[C,A]=g[g.length-1].split(",");return n.jsx("circle",{cx:C,cy:A,r:2.5,fill:S})})()]})}function RS(){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 AS({pct:a}){const r=a>=10?"var(--green)":a>=0?"var(--yellow)":"var(--red)",i=a>=10?"var(--green-muted)":a>=0?"var(--yellow-muted)":"var(--red-muted)",o=a>=0?"+":"";return n.jsxs("span",{className:"pill",style:{background:i,color:r,fontSize:10,fontWeight:600},children:[o,a.toFixed(1),"%"]})}function MS({score:a,rating:r}){const i={excellent:{bg:"var(--green-muted)",fg:"var(--green)"},good:{bg:"var(--green-muted)",fg:"var(--green)"},marginal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},minimal:{bg:"var(--yellow-muted)",fg:"var(--yellow)"},harmful:{bg:"var(--red-muted)",fg:"var(--red)"}},o=i[r]??i.minimal,d=a>=0?"+":"";return n.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),n.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[d,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function zS({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 DS({active:a,onChange:r,hasBaseline:i}){return n.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[n.jsx("button",{onClick:()=>r("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="rankings"?"var(--surface-3)":"transparent",color:a==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),n.jsx("button",{onClick:()=>r("amplification"),disabled:!i,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:a==="amplification"?"var(--surface-3)":"transparent",color:i&&a==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:i?1:.5,cursor:i?"pointer":"not-allowed"},title:i?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function LS(a){var o,d,m;if(a.length===0)return[];const r=new Map;for(const f of a)for(const x of f.models){if(x.status==="error")continue;const h=`${x.provider}/${x.model}`;r.has(h)||r.set(h,{provider:x.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const p=r.get(h);p.passRates.push(x.passRate.mean),p.lastRubric=((o=x.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=x.duration.mean,p.lastCost=((d=x.cost)==null?void 0:d.total)??null,p.lastCompositeScore=x.compositeScore,x.baselinePassRate!=null&&(p.lastBaselinePassRate=x.baselinePassRate.mean,p.lastSkillDelta=(m=x.skillDelta)==null?void 0:m.mean,p.lastAmplificationPct=x.amplificationPct,p.hasBaseline=!0)}const i=[];for(const[f,x]of r){const[h,...p]=f.split("/");i.push({rank:0,model:p.join("/"),provider:h,passRate:x.passRates[x.passRates.length-1],rubricScore:x.lastRubric,duration:x.lastDuration,cost:x.lastCost,sparklineData:x.passRates,isBest:!1,baselinePassRate:x.lastBaselinePassRate,skillDelta:x.lastSkillDelta,amplificationPct:x.lastAmplificationPct,compositeScore:x.lastCompositeScore,hasBaseline:x.hasBaseline})}return i.sort((f,x)=>{const h=f.compositeScore??f.passRate;return(x.compositeScore??x.passRate)-h}),i.forEach((f,x)=>{f.rank=x+1}),i.length>0&&(i[0].isBest=!0),i}const Wv=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function _S({entries:a}){return n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(r=>n.jsx("th",{style:Wv(r==="#"?"center":"left"),children:r},r))})}),n.jsx("tbody",{children:a.map(r=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:i=>{i.currentTarget.style.background="var(--surface-2)"},onMouseLeave:i=>{i.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:r.rank}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:r.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:r.provider}),r.isBest&&n.jsx(RS,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:fr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(Kv,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function OS({entries:a}){const r=[...a].filter(i=>i.hasBaseline).sort((i,o)=>(o.amplificationPct??0)-(i.amplificationPct??0));return r.length===0?n.jsx("div",{className:"flex items-center justify-center py-8",children:n.jsx("div",{className:"text-center",children:n.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",n.jsx("code",{children:"--baseline"})," flag."]})})}):n.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:n.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[n.jsx("thead",{children:n.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(i=>n.jsx("th",{style:Wv(i==="#"?"center":"left"),children:i},i))})}),n.jsx("tbody",{children:r.map((i,o)=>n.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-2)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:fr(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(AS,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(Kv,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function BS(){const{state:a}=Sn(),{plugin:r,skill:i}=a,[o,d]=v.useState("rankings"),m=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ce.getLeaderboard(r,i),[r,i]),{data:x,loading:h,error:p}=uo(m,f),b=(x==null?void 0:x.entries)??[],g=(p==null?void 0:p.message)??null;v.useEffect(()=>{d("rankings")},[r,i]);const j=v.useCallback(()=>Es(m),[m]);ao("leaderboard:updated",j);const S=v.useMemo(()=>LS(b),[b]),C=S.some(N=>N.hasBaseline),A=b[0],E=A==null?void 0:A.judgeBiasWarning;return h?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})]})}):S.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(DS,{active:o,onChange:d,hasBaseline:C})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[b.length," sweep",b.length!==1?"s":""," · ",S.length," model",S.length!==1?"s":""]})]}),E&&n.jsx(zS,{warning:E}),o==="rankings"?n.jsx(_S,{entries:S}):n.jsx(OS,{entries:S}),o==="amplification"&&(A==null?void 0:A.skillQualityScore)!=null&&(A==null?void 0:A.skillQualityRating)&&n.jsx(MS,{score:A.skillQualityScore,rating:A.skillQualityRating})]})}const HS=["editor","tests","run","activation","history","leaderboard","deps","versions"];function US(a){return a!=null&&HS.includes(a)}function IS({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:d}=Sn(),{state:m,refreshSkills:f,clearSelection:x}=ya(),h=v.useCallback(async()=>{try{await Ce.deleteSkill(r.plugin,r.skill),f(),x()}catch(S){const C=S instanceof Error?S.message:String(S);i({type:"SET_ERROR",error:`Failed to delete skill: ${C}`})}},[r.plugin,r.skill,f,x,i]);v.useEffect(()=>{const C=new URLSearchParams(window.location.search).get("panel");US(C)&&C!==r.activePanel&&i({type:"SET_PANEL",panel:C})},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);S.set("panel",r.activePanel);const C=`${window.location.pathname}?${S.toString()}${window.location.hash}`;history.replaceState(null,"",C)},[r.activePanel]);const p=v.useCallback(S=>{const C=S.ctrlKey||S.metaKey;if(C&&S.key>="1"&&S.key<="8"){S.preventDefault(),i({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(S.key)-1]});return}if(C&&S.key==="s"&&!S.shiftKey){S.preventDefault(),r.isDirty&&o();return}},[r.isDirty,o,i]);if(v.useEffect(()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)),[p]),r.loading)return n.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[n.jsx("div",{className:"spinner spinner-lg"}),n.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const b=Array.from(r.caseRunStates.values()).some(S=>S.status==="running"||S.status==="queued"),g=((j=m.skills.find(S=>S.skill===r.skill&&S.plugin===r.plugin))==null?void 0:j.updateAvailable)??!1;return n.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!a&&n.jsx(Nd,{state:r,isReadOnly:d,onDelete:d?void 0:h}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Ts,{error:dj(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(cj,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:b,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(uj,{children:n.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[r.activePanel==="editor"&&n.jsx(Oj,{}),r.activePanel==="tests"&&n.jsx(Gj,{}),r.activePanel==="run"&&n.jsx(aS,{}),r.activePanel==="activation"&&n.jsx(iS,{}),r.activePanel==="history"&&n.jsx(kS,{}),r.activePanel==="leaderboard"&&n.jsx(BS,{}),r.activePanel==="deps"&&n.jsx(TS,{}),r.activePanel==="versions"&&n.jsx(Lv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function VS(a){const r={prompt:a.prompt,provider:a.provider,model:a.model};return a.targetAgents&&a.targetAgents.length>0&&(r.targetAgents=a.targetAgents),r}function od(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function $S(a,r,i,o){const m=`.../${a.split("/").slice(-2).join("/")}`;switch(r){case 1:return`${m}/${i}/skills/${o}/SKILL.md`;case 2:return`${m}/plugins/${i}/skills/${o}/SKILL.md`;case 3:return`${m}/skills/${o}/SKILL.md`}}function GS({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[d,m]=v.useState(null),[f,x]=v.useState(!0),{config:h}=yl(),[p,b]=v.useState(""),[g,j]=v.useState(3),[S,C]=v.useState(""),[A,E]=v.useState(""),[N,R]=v.useState(""),[L,I]=v.useState(""),[O,$]=v.useState(""),[w,D]=v.useState(""),[M,U]=v.useState("write"),[q,W]=v.useState([]),[P,F]=v.useState(!1),[_,T]=v.useState(null),[B,le]=v.useState(""),[Q,pe]=v.useState(!1),[z,X]=v.useState(!1),[re,de]=v.useState(null),[xe,me]=v.useState(null),[Ne,ie]=v.useState([]),je=v.useRef(null),$e=v.useRef(null),Be=v.useRef(null),te=v.useRef(null),[ce,oe]=v.useState(!1),[fe,ye]=v.useState(!1);v.useEffect(()=>{Ce.getProjectLayout().then(ze=>{m(ze),j(ze.suggestedLayout);const xt=ze.detectedLayouts.find(Qt=>Qt.layout===ze.suggestedLayout);xt!=null&&xt.existingPlugins.length&&C(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>x(!1))},[]),v.useEffect(()=>{var ze;i==="ai"&&((ze=je.current)==null||ze.focus())},[i]),v.useEffect(()=>()=>{var ze;(ze=$e.current)==null||ze.abort()},[]);const _e=v.useMemo(()=>{var ze;return d?((ze=d.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:ze.existingPlugins)||[]:[]},[d,g]),Me=S==="__new__"?A:S,dt=d?$S(d.root,g,Me||"{plugin}",p||"{skill}"):"",Pt=v.useMemo(()=>d?d.detectedLayouts.filter(ze=>ze.layout!==4):[],[d]),ct=v.useMemo(()=>{if(!d)return null;const ze=d.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=d.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Qt=ze||xt;return Qt?{layout:Qt.layout,plugins:Qt.existingPlugins}:null},[d]),Vt=v.useCallback(()=>{if(r)return r();if(!h)return{provider:"claude-cli",model:"sonnet"};const ze=h.provider||"claude-cli",xt=h.model||"sonnet";return{provider:ze,model:xt}},[h,r]),$t=v.useCallback(()=>{var ze;(ze=$e.current)==null||ze.abort(),pe(!1)},[]),tt=v.useCallback(()=>{de(null),me(null)},[]),jt=v.useCallback(async()=>{if(de(null),me(null),ie([]),Be.current=null,!B.trim()){de("Describe what your skill should do");return}pe(!0);const ze=new AbortController;$e.current=ze;const{provider:xt,model:Qt}=Vt();try{const nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(VS({prompt:B.trim(),provider:xt,model:Qt,targetAgents:q})),signal:ze.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const On=await nt.json();On.error&&(bt=On.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Fn=new TextDecoder;let Nt="",St="";for(;;){const{done:bt,value:On}=await Xa.read();if(bt)break;Nt+=Fn.decode(On,{stream:!0});const Fa=Nt.split(`
74
- `);Nt=Fa.pop()||"";for(const Bn of Fa)if(Bn.startsWith("event: "))St=Bn.slice(7).trim();else if(Bn.startsWith("data: ")){try{const Ie=JSON.parse(Bn.slice(6));if(St==="progress")ie(Ht=>[...Ht,{phase:Ie.phase,message:Ie.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ht={prompt:B.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ie.reasoning||""};if(b(Ie.name),R(Ie.description),I(Ie.model||""),$(Ie.allowedTools||""),D(Ie.body),X(!0),Be.current=Ht,o("manual"),Ie.suggestedPlugin&&typeof Ie.suggestedPlugin=="object"&&Ie.suggestedPlugin.plugin){const Ct=Ie.suggestedPlugin;if(((d==null?void 0:d.detectedLayouts.flatMap(kn=>kn.existingPlugins))??[]).includes(Ct.plugin))if(C(Ct.plugin),Ct.layout&&(Ct.layout===1||Ct.layout===2))j(Ct.layout);else{const kn=d==null?void 0:d.detectedLayouts.find(mo=>mo.existingPlugins.includes(Ct.plugin));kn&&(kn.layout===1||kn.layout===2)&&j(kn.layout)}else C("__new__"),E(Ct.plugin)}else g===3&&ct&&ye(!0);const Zn={name:Ie.name,plugin:Me||"",layout:g,description:Ie.description,model:Ie.model||void 0,allowedTools:Ie.allowedTools||void 0,body:Ie.body,aiMeta:Ht};Ce.saveDraft(Zn).then(Ct=>{oe(!0),Ct!=null&&Ct.dir&&(te.current=Ct.dir)}).catch(()=>{})}else St==="error"&&(de(Ie.message||Ie.description||"Unknown error"),Ie.category&&me(Ie))}catch{}St=""}}}catch(nt){nt.name!=="AbortError"&&de(nt.message)}finally{pe(!1),$e.current=null}},[B,Vt,g,ct,Me,d,q]),he=v.useCallback(async()=>{if(T(null),!p.trim()){T("Skill name is required");return}if(!N.trim()){T("Description is required");return}if(g!==3&&!Me.trim()){T("Plugin name is required");return}F(!0);try{const ze=await Ce.createSkill({name:od(p),plugin:Me||"",layout:g,description:N,model:L||void 0,allowedTools:O||void 0,body:w,aiMeta:Be.current||void 0,draftDir:te.current||void 0});te.current=null,a(ze.plugin,ze.skill)}catch(ze){T(ze.message)}finally{F(!1)}},[p,N,g,Me,L,O,w,a]),Rt=v.useCallback(()=>{ct&&(j(ct.layout),C(ct.plugins[0]),ye(!1))},[ct]);return{mode:i,setMode:o,layout:d,layoutLoading:f,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Pt,availablePlugins:_e,pathPreview:dt,plugin:S,setPlugin:C,newPlugin:A,setNewPlugin:E,effectivePlugin:Me,name:p,setName:b,description:N,setDescription:R,model:L,setModel:I,allowedTools:O,setAllowedTools:$,body:w,setBody:D,bodyViewMode:M,setBodyViewMode:U,aiPrompt:B,setAiPrompt:le,generating:Q,aiGenerated:z,aiError:re,aiClassifiedError:xe,aiProgress:Ne,promptRef:je,handleGenerate:jt,handleCancelGenerate:$t,clearAiError:tt,targetAgents:q,setTargetAgents:W,draftSaved:ce,showPluginRecommendation:fe,setShowPluginRecommendation:ye,pluginLayoutInfo:ct,applyPluginRecommendation:Rt,creating:P,error:_,handleCreate:he}}function Qv(){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 qS(){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 Xv({node:a,depth:r=0}){var i;return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${r*16}px`,color:a.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[a.type==="dir"?n.jsx(Qv,{}):n.jsx(qS,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(Xv,{node:o,depth:r+1},o.name))]})}function YS(a,r,i){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const d=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return i&&d.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:d}}function KS({skillName:a,hasEvals:r,isDraft:i}){const o=YS(a,r,i);return n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[n.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsx(Qv,{})}),"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(Xv,{node:o})})]})}const qa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Xu({size:a=14,color:r="currentColor"}){return n.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function WS({onCreated:a,onCancel:r}){const i=GS({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(Xu,{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(Xu,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:o=>i.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
75
-
76
- Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),i.handleGenerate())}}),n.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),i.generating&&i.aiProgress.length>0&&n.jsx(Rs,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Ts,{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(Xu,{size:14}),"Generate"]}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"}),!i.generating&&n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",n.jsx("button",{onClick:()=>i.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!i.layoutLoading&&i.layout&&i.mode==="manual"&&n.jsxs("div",{className:"space-y-4 animate-fade-in",children:[n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),i.creatableLayouts.length>1&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),n.jsx("div",{className:"flex gap-2",children:i.creatableLayouts.map(o=>n.jsx("button",{onClick:()=>{i.setSelectedLayout(o.layout),i.setPlugin(o.existingPlugins[0]||""),i.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:i.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:i.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${i.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),i.selectedLayout!==3&&n.jsxs("div",{className:"mb-3",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),n.jsxs("select",{value:i.plugin,onChange:o=>{i.setPlugin(o.target.value),i.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[i.availablePlugins.map(o=>n.jsx("option",{value:o,children:o},o)),n.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),i.plugin==="__new__"&&n.jsx("input",{type:"text",value:i.newPlugin,onChange:o=>i.setNewPlugin(od(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:i.pathPreview})]}),i.showPluginRecommendation&&i.pluginLayoutInfo&&i.selectedLayout===3&&n.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),n.jsxs("span",{children:["Plugins detected (",n.jsx("strong",{children:i.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:i.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),n.jsx("button",{onClick:()=>i.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("input",{type:"text",value:i.name,onChange:o=>i.setName(od(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]}),n.jsxs("div",{className:"mb-3",children:[n.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",n.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),n.jsx("textarea",{value:i.description,onChange:o=>i.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...qa,minHeight:"72px"}})]}),n.jsxs("div",{className:"flex gap-3",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),n.jsxs("select",{value:i.model,onChange:o=>i.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa,children:[n.jsx("option",{value:"",children:"Any"}),n.jsx("option",{value:"opus",children:"Opus"}),n.jsx("option",{value:"sonnet",children:"Sonnet"}),n.jsx("option",{value:"haiku",children:"Haiku"})]})]}),n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),n.jsx("input",{type:"text",value:i.allowedTools,onChange:o=>i.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:qa})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
77
-
78
- You are an expert at...
79
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...qa,minHeight:"150px"}}):i.body.trim()?n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:fo(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(KS,{skillName:i.name||"{skill}",hasEvals:!1,isDraft:i.draftSaved}),i.error&&n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:i.error}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:i.handleCreate,disabled:i.creating||!i.name||!i.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:i.creating||!i.name||!i.description?"var(--surface-3)":"var(--accent)",color:i.creating||!i.name||!i.description?"var(--text-tertiary)":"#fff",cursor:i.creating||!i.name||!i.description?"not-allowed":"pointer",border:"none"},children:i.creating?"Creating...":"Create Skill"}),n.jsx("button",{onClick:r,className:"px-4 py-2.5 rounded-lg text-[13px] font-medium",style:{color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]})]})]})}function QS(){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:r,onRetry:i}){const{setMode:o,setSearch:d}=ya(),[m,f]=v.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(QS,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:x=>{x.currentTarget.style.opacity="0.9"},onMouseLeave:x=>{x.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>d(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function XS(a,r){const[i,o]=a.split(".").map(Number),[d,m]=r.split(".").map(Number);return d>i?"major":m>o?"minor":"patch"}const FS={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 ZS(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[d,m]=v.useState(new Set),[f,x]=v.useState(new Map),[h,p]=v.useState(!1),[b,g]=v.useState(new Set),[j,S]=v.useState(null),[C,A]=v.useState(null),[E,N]=v.useState(!1),R=v.useCallback(async()=>{o(!0);try{const M=await Ce.getSkillUpdates();r(M.filter(U=>U.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{R()},[R]);const L=v.useMemo(()=>a.filter(M=>!M.pinned),[a]),I=v.useCallback(M=>{m(U=>{const q=new Set(U);return q.has(M)?q.delete(M):q.add(M),q})},[]),O=v.useCallback(()=>{d.size===L.length?m(new Set):m(new Set(L.map(M=>M.name)))},[d,L]),$=v.useCallback(()=>{const M=[...d];if(!M.length)return;p(!0),x(new Map(M.map(q=>[q,{skill:q,status:"pending"}])));const U=Ce.startBatchUpdate(M);U.addEventListener("progress",q=>{try{const W=JSON.parse(q.data);x(P=>new Map(P).set(W.skill,W))}catch{}}),U.addEventListener("done",q=>{U.close(),p(!1);try{const W=JSON.parse(q.data);S(`Updated ${W.updated??0} skills, ${W.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}R()}),U.addEventListener("error",()=>{U.close(),p(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[d,R]),w=v.useCallback(M=>{M.name.split("/").pop()||M.name;const U=M.name.split("/"),q=U.length>=3?U[U.length-2]:U[0],W=U[U.length-1];g(F=>new Set(F).add(M.name));const P=Ce.startSkillUpdate(q,W);P.addEventListener("done",()=>{P.close(),g(F=>{const _=new Set(F);return _.delete(M.name),_}),R()}),P.addEventListener("error",()=>{P.close(),g(F=>{const _=new Set(F);return _.delete(M.name),_})})},[R]),D=v.useCallback(async M=>{if(!M.latest)return;const U=M.name.split("/"),q=U.length>=3?U[U.length-2]:U[0],W=U[U.length-1];N(!0);try{const P=await Ce.getVersionDiff(q,W,M.installed,M.latest);A({skill:M,diff:P})}catch{A(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:R,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 (",L.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:R,className:"btn btn-ghost text-[12px]",disabled:h,children:"Refresh"}),n.jsx("button",{onClick:$,disabled:d.size===0||h,className:"btn btn-primary text-[12px]",children:h?"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===L.length&&L.length>0?"var(--accent)":"var(--border-default)",background:d.size===L.length&&L.length>0?"var(--accent)":"transparent"},children:d.size===L.length&&L.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 U=M.name.split("/").pop()||M.name,q=M.latest?XS(M.installed,M.latest):"patch",W=FS[q],P=!!M.pinned,F=b.has(M.name),_=f.get(M.name),T=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:P?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!P&&I(M.name),disabled:P,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:P?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:T?"var(--accent)":"var(--border-default)",background:T?"var(--accent)":"transparent",opacity:P?.4:1},children:T&&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:U}),P&&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:W.bg,color:W.text},children:q})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[M.installed," → ",M.latest||"?",P&&` (pinned at ${M.pinnedVersion||M.installed})`]})]}),_&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:_.status==="done"?"var(--green-muted)":_.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:_.status==="done"?"var(--green)":_.status==="error"?"var(--red)":"var(--yellow)"},children:[_.status,_.error&&`: ${_.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>D(M),className:"btn btn-ghost text-[11px]",disabled:E,children:"View Changes"}),n.jsx("button",{onClick:()=>w(M),disabled:P||F||h,title:P?"Pinned — unpin from CLI to update":"",className:`btn ${P?"btn-ghost":"btn-primary"} text-[11px]`,children:F?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(_==null?void 0:_.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},M.name)})}),C&&n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>A(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:M=>M.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>A(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(wd,{contentDiff:C.diff.contentDiff,fromLabel:C.diff.from,toLabel:C.diff.to,diffSummary:C.diff.diffSummary,renderContext:"inline"})]})})]})}const PS=[{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}}],xr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},vr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},JS={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},Fv={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},Zv={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},dr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},ek={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},tk={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},nk={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 ak(a){if(a==null||!Number.isFinite(a))return"—";if(a<1024)return`${a} B`;const r=a/1024;if(r<1024)return r>=10?`${Math.round(r)} KB`:`${r.toFixed(1).replace(/\.0$/,"")} KB`;const i=r/1024;return i>=10?`${Math.round(i)} MB`:`${i.toFixed(1).replace(/\.0$/,"")} MB`}function Pv(a){if(!a)return"—";const r=new Date(a);if(Number.isNaN(r.getTime()))return a;const i=Date.now()-r.getTime(),o=Math.floor(i/1e3);if(o<60)return"just now";const d=Math.floor(o/60);if(d<60)return`${d} min ago`;const m=Math.floor(d/60);if(m<24)return`${m} hr ago`;const f=Math.floor(m/24);if(f<30)return`${f} day${f===1?"":"s"} ago`;const x=Math.floor(f/30);if(x<12)return`${x} month${x===1?"":"s"} ago`;const h=Math.floor(x/12);return`${h} year${h===1?"":"s"} ago`}function lk(a){const r=PS.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function pr(a){const r=a?nk[a]:void 0;return n.jsx("span",{style:ek,title:r,children:"—"})}function gn(a,r,i){return n.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[n.jsx("span",{style:JS,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function or(a,r,i={}){if(r==null||r==="")return gn(a,pr(a));if(i.path)return gn(a,n.jsx("span",{"data-path-value":"true",style:tk,children:r}));const o=i.tabular?dr:i.mono?Zv:Fv;return gn(a,n.jsx("span",{style:o,children:r}))}function rk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[sk(a),a.origin==="installed"?ik(a):null,ok(a),uk(a),dk(a),pk(a,r,i)]})}function sk(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...Zv,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):pr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):pr("Tags");return n.jsxs("section",{style:vr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:xr,children:"Frontmatter"}),or("Description",a.description??null),or("Version",a.version??null,{tabular:!0}),or("Category",a.category??null),or("Author",a.author??null),or("License",a.license??null),gn("Homepage",r),gn("Tags",i)]},"frontmatter")}function ik(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:Fv,"data-agent-id":r,children:lk(r)}):pr("Agent");return n.jsxs("section",{style:vr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:xr,children:"Source agent"}),gn("Agent",i)]},"source-agent")}function ok(a){const r=a.lastModified?n.jsx("span",{style:dr,title:a.lastModified,children:Pv(a.lastModified)}):pr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,d=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>ck(o),style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",cursor:"pointer",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i});return n.jsxs("section",{style:vr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:xr,children:"Filesystem"}),or("Directory",a.dir||null,{path:!0}),gn("Entry point",d),gn("Size",n.jsx("span",{style:dr,children:ak(a.sizeBytes)})),gn("Last modified",r)]},"filesystem")}function ck(a){var r;try{(r=navigator.clipboard)==null||r.writeText(a)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${a}`,severity:"info"}}))}function uk(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:dr,title:a.lastBenchmark,children:Pv(a.lastBenchmark)}):pr("Last benchmark");return n.jsxs("section",{style:vr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:xr,children:"Benchmark"}),gn("Eval count",n.jsx("span",{style:dr,children:a.evalCount})),gn("Assertions",n.jsx("span",{style:dr,children:a.assertionCount})),gn("Status",i),gn("Last benchmark",o)]},"benchmark")}function dk(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:vr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:xr,children:"MCP dependencies"}),r.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):n.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:r.map(i=>n.jsxs("li",{"data-mcp-dep":i,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[n.jsx(fk,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function fk(){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 pk(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:vr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:xr,children:"Skill dependencies"}),o.length===0?n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(d=>{const m=mk(d,r),f=m!=null,x={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},h=f&&i?()=>i({plugin:m.plugin,skill:m.skill,origin:m.origin}):void 0,p=f&&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":f?"true":"false",title:f?`Open ${d}`:"Not installed",onClick:h,onKeyDown:p,style:x,children:d},d)})})]},"skill-deps")}function mk(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const d of r)if(i&&d.plugin===i&&d.skill===o||!i&&d.skill===o)return d;return null}const Dx=v.memo(function({message:r,politeness:i="polite",role:o}){const d=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:d,"data-testid":"aria-live","data-politeness":i,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0,padding:0,margin:-1},children:r})});function hk({toast:a,onDismiss:r}){const[i,o]=v.useState(!0),d=v.useRef(null);v.useEffect(()=>(d.current=requestAnimationFrame(()=>{d.current=requestAnimationFrame(()=>o(!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(),r(a.id)},style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"3px 8px",color:"var(--text-primary)",cursor:"pointer",fontSize:11,fontFamily:"var(--font-sans)"},children:a.action.label}),n.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>r(a.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function xk({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(Dx,{politeness:"polite",message:i}),n.jsx(Dx,{politeness:"assertive",message:o}),a.length>0&&n.jsx("div",{"data-testid":"toast-stack",style:{position:"fixed",right:16,bottom:16,display:"flex",flexDirection:"column-reverse",gap:8,zIndex:50,pointerEvents:"none"},children:a.map(d=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(hk,{toast:d,onDismiss:r})},d.id))})]})}const Jv=v.createContext(null);function Cd(){const a=v.useContext(Jv);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function vk({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,d]=v.useState([]),[m,f]=v.useState(""),[x,h]=v.useState(""),p=v.useRef(new Map),b=v.useCallback(E=>{const N=p.current.get(E);N&&(clearTimeout(N),p.current.delete(E)),d(R=>R.filter(L=>L.id!==E))},[]),g=v.useCallback((E,N)=>{if(N<=0)return;const R=setTimeout(()=>{b(E)},N);p.current.set(E,R)},[b]),j=v.useCallback(E=>{const N=E.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,R={id:N,message:E.message,severity:E.severity??"info",durationMs:E.durationMs??i,action:E.action};return d(L=>[...L,R]),R.severity==="error"?h(R.message):f(R.message),g(N,R.durationMs),N},[i,g]),S=v.useCallback(()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear(),d([])},[]);v.useEffect(()=>{function E(N){N.key==="Escape"&&d(R=>{if(R.length===0)return R;const L=R.slice(0,r),I=L[L.length-1],O=p.current.get(I.id);return O&&(clearTimeout(O),p.current.delete(I.id)),R.filter($=>$.id!==I.id)})}return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[r]),v.useEffect(()=>()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear()},[]);const C=o.slice(0,r),A=v.useMemo(()=>({toast:j,dismiss:b,clear:S}),[j,b,S]);return n.jsxs(Jv.Provider,{value:A,children:[a,n.jsx(xk,{toasts:C,onDismiss:b,liveMessage:m,liveAssertiveMessage:x})]})}function yk(a){const{toast:r}=Cd(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...d)=>{const m=i.current,f=m.snapshot();m.apply(...d),m.confirmGraceMs;const x=m.timeoutMs??5e3;let h=!1,p,b=!1;const g=m.commit(...d).then(()=>{h=!0,b=!0},C=>{h=!0,p=C??new Error("Commit failed")}),j=new Promise(C=>{setTimeout(C,x)});if(await Promise.race([g,j]),!h)p=new Error("TIMEOUT");else if(b)return;m.rollback(f);const S=typeof m.failureMessage=="function"?m.failureMessage(p):m.failureMessage??"Couldn't complete that action.";r({message:S,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...d)}}})},[r]);return{run:o}}const Lx=6e4;function gk({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Cd(),[o,d]=v.useState("idle"),[m,f]=v.useState(null),[x,h]=v.useState(!1),[p,b]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),C=v.useRef(null),A=v.useCallback(()=>new Promise((I,O)=>{if(!a){O(new Error("No skill selected"));return}const $=Ce.startSkillUpdate(a.plugin,a.skill);S.current=$;const w=()=>{C.current&&(clearTimeout(C.current),C.current=null);try{$.close()}catch{}S.current=null};C.current=setTimeout(()=>{w(),O(new Error("TIMEOUT"))},Lx),$.addEventListener("progress",D=>{try{const M=JSON.parse(D.data);typeof(M==null?void 0:M.status)=="string"&&f(M.status)}catch{}}),$.addEventListener("done",()=>{w(),d("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),I()}),$.addEventListener("error",D=>{w();let M="Stream error";try{const U=typeof D.data=="string"?JSON.parse(D.data):null;U!=null&&U.error&&(M=String(U.error))}catch{}O(new Error(M))})}),[a,r,i]),E=yk({snapshot:()=>({status:o}),apply:()=>{d("updating"),f("updating")},commit:()=>A(),rollback:I=>{d(I.status==="updating"?"idle":I.status),f(null)},failureMessage:I=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${I.message}`,timeoutMs:Lx+1e3});if(v.useEffect(()=>{if(!x||p!=null||!a||!a.latestVersion)return;let I=!1;return j(!0),Ce.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(O=>{I||b(O)}).catch(()=>{I||b(null)}).finally(()=>{I||j(!1)}),()=>{I=!0}},[x,p,a==null?void 0:a.plugin,a==null?void 0:a.skill,a==null?void 0:a.latestVersion,a==null?void 0:a.currentVersion,a]),v.useEffect(()=>()=>{if(C.current&&clearTimeout(C.current),S.current)try{S.current.close()}catch{}},[]),!a||a.updateAvailable!==!0)return null;const N=a.latestVersion,R=o==="updating"?"Updating…":N?`Update to ${N}`:"Update",L=o==="updating";return n.jsxs("div",{"data-testid":"update-action",style:{display:"flex",flexDirection:"column",gap:6,padding:"12px 16px",borderTop:"1px solid var(--border-default)",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[n.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{E.run()},disabled:L,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:L?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:R}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>h(I=>!I),disabled:L||!N,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:x?"Hide changelog":"Preview changelog"})]}),m&&n.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:m}),x&&N&&n.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[g&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!g&&p&&n.jsx(wd,{contentDiff:p.contentDiff,fromLabel:p.from,toLabel:p.to,diffSummary:p.diffSummary??void 0,renderContext:"inline"}),!g&&!p&&n.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function Fu(){const{state:a,setMobileView:r}=ya();return a.isMobile?n.jsxs("button",{onClick:()=>r("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function bk(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return jk(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:d}=ya(),[m,f]=v.useState(typeof window<"u"?window.location.hash:"");if(v.useEffect(()=>{const p=()=>f(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),m==="#/updates")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(Fu,{}),n.jsx(ZS,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(Fu,{}),n.jsx(WS,{onCreated:(p,b)=>{o("browse"),d(),i({plugin:p,skill:b,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(Ji,{variant:"error",message:r.skillsError,onRetry:d}):!r.skillsLoading&&r.skills.length===0?n.jsx(Ji,{variant:"no-skills"}):n.jsx(Ji,{variant:"no-selection"});const x=r.selectedSkill,h=r.skills.find(p=>p.plugin===x.plugin&&p.skill===x.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(Fu,{}),n.jsx(Sk,{skillInfo:h,allSkills:r.skills,onSelectSkill:p=>i(p)})]})}function jk(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return Nk();if(a.loadError)return Ck(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return ey(r,i,a.onDetailTabChange,o)}function Sk({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,d]=v.useState("overview"),m=v.useMemo(()=>a?ey(a,o,d,{allSkills:r,onSelectSkill:i}):n.jsx(Ji,{variant:"no-selection"}),[a,o,r,i]);return n.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:m})}const kk=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function wk(a,r){return n.jsx("div",{role:"tablist","aria-label":"Detail sections",style:{display:"flex",alignItems:"stretch",gap:4,borderBottom:"1px solid var(--border-default)",padding:"0 16px",background:"var(--bg-canvas)"},children:kk.map(i=>{const o=i.id===a;return n.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${i.id}`,"aria-controls":`detail-panel-${i.id}`,onClick:()=>r==null?void 0:r(i.id),style:{background:"transparent",border:"none",borderBottom:o?"2px solid var(--text-primary)":"2px solid transparent",padding:"10px 4px",marginBottom:-1,fontFamily:"var(--font-sans)",fontSize:13,fontWeight:o?500:400,color:o?"var(--text-primary)":"var(--text-secondary)",cursor:"pointer"},children:i.label},i.id)})})}function Nk(){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 Ck(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[Nd({skill:a}),n.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[n.jsxs("h3",{style:{fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px"},children:["Couldn't load SKILL.md for ",a.skill]}),n.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:r}),n.jsxs("div",{style:{display:"flex",gap:8},children:[n.jsx("button",{type:"button",style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Open in editor"}),n.jsx("button",{type:"button",onClick:()=>{var i;return(i=navigator.clipboard)==null?void 0:i.writeText(a.dir)},style:{fontFamily:"var(--font-sans)",fontSize:12,padding:"4px 10px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Copy path"})]})]})]})}function ey(a,r,i,o){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[n.jsx("div",{style:{padding:16,paddingBottom:12},children:Nd({skill:a})}),n.jsx(gk,{skill:a}),wk(r,i),n.jsxs("div",{role:"tabpanel",id:`detail-panel-${r}`,"aria-labelledby":`detail-tab-${r}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[r==="overview"&&n.jsxs(n.Fragment,{children:[rk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(mx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(IS,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(mx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(Lv,{})})},`${a.plugin}/${a.skill}-versions`),r==="versions"&&o==null&&n.jsx("div",{style:{padding:16,fontFamily:"var(--font-sans)",color:"var(--text-secondary)",fontSize:13},children:"Select a skill from the sidebar to load its version history."})]})]})}function Ek(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return v.useEffect(()=>{if(!o)return;const d=setTimeout(()=>i(),1e4);return()=>clearTimeout(d)},[o,i]),o?n.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-3 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow)",color:"var(--text-primary)"},children:[n.jsxs("span",{children:[a," update",a===1?"":"s"," available"]}),n.jsx("button",{onClick:()=>{window.location.hash="#/updates"},className:"px-2 py-0.5 rounded text-[12px] font-semibold",style:{background:"var(--yellow)",color:"var(--surface-0)",border:"none",cursor:"pointer"},children:"View Updates"}),n.jsx("button",{onClick:i,className:"text-[14px] leading-none",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px"},"aria-label":"Dismiss",children:"✕"})]}):null}const Tk=[{name:ve.shortcuts.groupNavigation,items:[{keys:"/",label:ve.shortcuts.search},{keys:"j",label:ve.shortcuts.moveDown},{keys:"k",label:ve.shortcuts.moveUp},{keys:"Enter",label:ve.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:ve.shortcuts.groupActions,items:[{keys:"⌘K",label:ve.shortcuts.openPalette},{keys:"?",label:ve.shortcuts.openShortcuts},{keys:"⌘B",label:ve.shortcuts.toggleSidebar},{keys:"E",label:ve.actions.edit}]},{name:ve.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:ve.shortcuts.toggleTheme}]}];function Rk({open:a,onClose:r,groups:i=Tk,title:o=ve.shortcuts.title}){const d=v.useRef(null),m=v.useRef(null);return v.useEffect(()=>{var f;if(a)return d.current=document.activeElement??null,(f=m.current)==null||f.focus(),()=>{var x,h;(h=(x=d.current)==null?void 0:x.focus)==null||h.call(x),d.current=null}},[a]),v.useEffect(()=>{if(!a)return;function f(x){var h;if(x.key==="Escape"){x.preventDefault(),r();return}x.key==="Tab"&&(x.preventDefault(),(h=m.current)==null||h.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref:m,type:"button","aria-label":"Close",onClick:r,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),i.map(f=>n.jsxs("section",{style:{marginBottom:12},children:[n.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:f.name}),n.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.items.map(x=>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:x.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:x.keys})]},`${f.name}:${x.keys}`))})]},f.name))]})}):null}function Ak(a){const r=ve.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function Mk({state:a,onClose:r,onAction:i,itemsOverride:o}){const d=v.useRef(null),m=v.useRef(null),[f,x]=v.useState(0),h=v.useMemo(()=>a.skill?o??Ak(a.skill):[],[a.skill,o]),p=v.useMemo(()=>{if(typeof window>"u")return{left:a.x,top:a.y};const g=8,j=220,S=44+h.length*28;let C=a.x,A=a.y;return C+j+g>window.innerWidth&&(C=Math.max(g,a.x-j)),A+S+g>window.innerHeight&&(A=Math.max(g,a.y-S)),{left:C,top:A}},[a.x,a.y,h.length]);v.useEffect(()=>{if(a.open)return m.current=document.activeElement??null,x(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=v.useCallback(()=>{if(!a.skill)return;const g=h[f];!g||g.disabled||(i(g.action,a.skill),r())},[h,f,a.skill,i,r]);return v.useEffect(()=>{if(!a.open)return;function g(S){if(S.key==="Escape"){S.preventDefault(),r();return}if(S.key==="ArrowDown"){S.preventDefault(),x(C=>Math.min(C+1,Math.max(h.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),x(C=>Math.max(C-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),b();return}}function j(S){d.current&&S.target instanceof Node&&(d.current.contains(S.target)||r())}return window.addEventListener("keydown",g,!0),window.addEventListener("mousedown",j,!0),()=>{window.removeEventListener("keydown",g,!0),window.removeEventListener("mousedown",j,!0)}},[a.open,r,h.length,b]),!a.open||!a.skill?null:n.jsx("div",{ref:d,role:"menu",tabIndex:-1,"data-testid":"context-menu",style:{position:"fixed",left:p.left,top:p.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:h.map((g,j)=>n.jsx("div",{role:"menuitem","aria-disabled":g.disabled||void 0,"data-action":g.action,"data-selected":j===f||void 0,onMouseEnter:()=>x(j),onClick:()=>{g.disabled||(i(g.action,a.skill),r())},style:{padding:"5px 10px",borderRadius:4,cursor:g.disabled?"default":"pointer",opacity:g.disabled?.5:1,background:j===f?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:g.label},g.action))})}const _x={open:!1,x:0,y:0,skill:null};function zk(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function ml(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function Dk(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{ml(ve.toasts.permissionDenied,"error");return}ml(ve.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":ml(ve.actions.editPlaceholder,"info");return;case"run-benchmark":ml(ve.toasts.benchmarkQueued,"info");return;case"duplicate":ml(ve.toasts.skillDuplicated,"info");return;case"update":ml(ve.toasts.skillUpdated,"info");return;case"uninstall":ml(ve.actions.editPlaceholder,"info");return;default:return}}const Lk=v.lazy(()=>ud(()=>import("./CommandPalette-BYCtdLfL.js"),__vite__mapDeps([2,1])));function _k(){return n.jsx(V1,{children:n.jsx(H1,{children:n.jsxs(vk,{children:[n.jsx(Ok,{}),n.jsx(Ek,{})]})})})}function Ok(){var W;const{state:a,selectSkill:r,refreshSkills:i,outdatedByOrigin:o}=ya(),{config:d}=yl(),{mode:m,resolvedTheme:f,setTheme:x}=Yx(),{toast:h}=Cd(),[p,b]=v.useState(()=>G2()),[g]=v.useState(!0),[j,S]=v.useState(!1),[C,A]=v.useState(!1),[E,N]=v.useState(!1),[R,L]=v.useState("overview"),[I,O]=v.useState(_x),$=v.useCallback((P,F)=>{O(zk(P,F))},[]),w=v.useCallback(()=>{O(_x)},[]);v.useEffect(()=>{function P(F){if(!(F instanceof CustomEvent))return;const _=F.detail;_!=null&&_.message&&h({message:_.message,severity:_.severity??"info"})}return window.addEventListener("studio:toast",P),()=>window.removeEventListener("studio:toast",P)},[h]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${p}px`)},[p]);const D=v.useMemo(()=>a.selectedSkill?a.skills.find(P=>P.plugin===a.selectedSkill.plugin&&P.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),M=v.useCallback(P=>{r({plugin:P.plugin,skill:P.skill,origin:P.origin})},[r]),U=v.useMemo(()=>{if(!a.selectedSkill)return"";const P=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${P})`},[a.selectedSkill]),q=v.useMemo(()=>[{id:"switch-theme",label:ve.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(m==="light"?"dark":m==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>N(P=>!P)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>A(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>i()}],[m,x,i]);return Ev([{key:"cmd+k",handler:()=>S(P=>!P)},{key:"ctrl+k",handler:()=>S(P=>!P)},{key:"?",handler:()=>A(P=>!P)},{key:"cmd+shift+d",handler:()=>x(f==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(f==="light"?"dark":"light")},{key:"cmd+b",handler:()=>N(P=>!P)},{key:"ctrl+b",handler:()=>N(P=>!P)},{key:"e",handler:()=>h({message:ve.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx($1,{sidebarWidth:p,sidebarHidden:E||a.isMobile&&a.mobileView==="detail",banner:n.jsx(K2,{connected:g}),liveMessage:U,topRail:n.jsx(L0,{projectName:(d==null?void 0:d.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>S(!0)}),sidebar:n.jsx(_2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:M,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:i,onContextMenu:$,outdatedByOrigin:o}),resizeHandle:n.jsx(Y2,{initialWidth:p??xs,onChange:b}),main:n.jsx(bk,{selectedSkillInfo:D,activeDetailTab:R,onDetailTabChange:L,allSkills:a.skills,onSelectSkill:M}),statusBar:n.jsx(Y0,{projectPath:(d==null?void 0:d.root)??null,modelName:(d==null?void 0:d.model)??null,health:d!=null&&d.error?"degraded":"ok",providers:(W=d==null?void 0:d.providers)==null?void 0:W.map(P=>{const F=P.id;return{id:F,label:P.label,available:P.available,kind:F==="ollama"||F==="lm-studio"?"start-service":F==="anthropic"||F==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(Rk,{open:C,onClose:()=>A(!1)}),n.jsx(Mk,{state:I,onClose:w,onAction:(P,F)=>Dk(P,F)}),j&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(Lk,{open:j,onClose:()=>S(!1),commands:q})})]})}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}j1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(I0,{children:n.jsx(_k,{})})}));export{n as j,v as r,ve as s};