vskill 0.5.87 → 0.5.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/agents.json +124 -0
- package/dist/agents/agents-registry.d.ts +29 -5
- package/dist/agents/agents-registry.js +133 -12
- package/dist/agents/agents-registry.js.map +1 -1
- package/dist/commands/add.d.ts +2 -16
- package/dist/commands/add.js +3 -89
- package/dist/commands/add.js.map +1 -1
- package/dist/eval/plugin-scanner.d.ts +14 -0
- package/dist/eval/plugin-scanner.js +237 -0
- package/dist/eval/plugin-scanner.js.map +1 -0
- package/dist/eval/skill-scanner.d.ts +18 -0
- package/dist/eval/skill-scanner.js +82 -9
- package/dist/eval/skill-scanner.js.map +1 -1
- package/dist/eval/standalone-skill-scanner.d.ts +7 -0
- package/dist/eval/standalone-skill-scanner.js +76 -0
- package/dist/eval/standalone-skill-scanner.js.map +1 -0
- package/dist/eval-server/api-routes.d.ts +1 -0
- package/dist/eval-server/api-routes.js +12 -1
- package/dist/eval-server/api-routes.js.map +1 -1
- package/dist/eval-server/eval-server.d.ts +9 -1
- package/dist/eval-server/eval-server.js +51 -1
- package/dist/eval-server/eval-server.js.map +1 -1
- package/dist/eval-server/workspace-routes.d.ts +14 -0
- package/dist/eval-server/workspace-routes.js +108 -0
- package/dist/eval-server/workspace-routes.js.map +1 -0
- package/dist/eval-server/workspace-store.d.ts +36 -0
- package/dist/eval-server/workspace-store.js +144 -0
- package/dist/eval-server/workspace-store.js.map +1 -0
- package/dist/eval-ui/assets/{CommandPalette-BmFgVfCB.js → CommandPalette-DrPj2MN0.js} +1 -1
- package/dist/eval-ui/assets/{UpdateDropdown-DyH9TWvR.js → UpdateDropdown-CXwYZ5VE.js} +1 -1
- package/dist/eval-ui/assets/index-D5A8Jbqy.css +1 -0
- package/dist/eval-ui/assets/index-Dg6Nwzn_.js +90 -0
- package/dist/eval-ui/index.html +2 -2
- package/dist/shared/copy-plugin-filtered.d.ts +13 -0
- package/dist/shared/copy-plugin-filtered.js +97 -0
- package/dist/shared/copy-plugin-filtered.js.map +1 -0
- package/dist/studio/lib/ops-log.d.ts +10 -0
- package/dist/studio/lib/ops-log.js +99 -0
- package/dist/studio/lib/ops-log.js.map +1 -0
- package/dist/studio/lib/provenance.d.ts +4 -0
- package/dist/studio/lib/provenance.js +41 -0
- package/dist/studio/lib/provenance.js.map +1 -0
- package/dist/studio/lib/scope-transfer.d.ts +28 -0
- package/dist/studio/lib/scope-transfer.js +112 -0
- package/dist/studio/lib/scope-transfer.js.map +1 -0
- package/dist/studio/routes/index.d.ts +2 -0
- package/dist/studio/routes/index.js +19 -0
- package/dist/studio/routes/index.js.map +1 -0
- package/dist/studio/routes/ops.d.ts +2 -0
- package/dist/studio/routes/ops.js +63 -0
- package/dist/studio/routes/ops.js.map +1 -0
- package/dist/studio/routes/promote.d.ts +2 -0
- package/dist/studio/routes/promote.js +118 -0
- package/dist/studio/routes/promote.js.map +1 -0
- package/dist/studio/routes/revert.d.ts +2 -0
- package/dist/studio/routes/revert.js +97 -0
- package/dist/studio/routes/revert.js.map +1 -0
- package/dist/studio/routes/test-install.d.ts +2 -0
- package/dist/studio/routes/test-install.js +102 -0
- package/dist/studio/routes/test-install.js.map +1 -0
- package/dist/studio/types.d.ts +48 -0
- package/dist/studio/types.js +11 -0
- package/dist/studio/types.js.map +1 -0
- package/dist/utils/agent-filter.js +9 -1
- package/dist/utils/agent-filter.js.map +1 -1
- package/package.json +4 -1
- package/scripts/preuninstall.cjs +9 -2
- package/dist/eval-ui/assets/index-C4XKAX1s.css +0 -1
- package/dist/eval-ui/assets/index-DQDnt_gJ.js +0 -89
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-CXwYZ5VE.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-DrPj2MN0.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 u of document.querySelectorAll('link[rel="modulepreload"]'))o(u);new MutationObserver(u=>{for(const m of u)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(u){const m={};return u.integrity&&(m.integrity=u.integrity),u.referrerPolicy&&(m.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?m.credentials="include":u.crossOrigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function o(u){if(u.ep)return;u.ep=!0;const m=i(u);fetch(u.href,m)}})();function Zx(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Mu={exports:{}},ds={};/**
|
|
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 Lh;function D1(){if(Lh)return ds;Lh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function i(o,u,m){var f=null;if(m!==void 0&&(f=""+m),u.key!==void 0&&(f=""+u.key),"key"in u){m={};for(var h in u)h!=="key"&&(m[h]=u[h])}else m=u;return u=m.ref,{$$typeof:a,type:o,key:f,ref:u!==void 0?u:null,props:m}}return ds.Fragment=r,ds.jsx=i,ds.jsxs=i,ds}var _h;function z1(){return _h||(_h=1,Mu.exports=D1()),Mu.exports}var n=z1(),Du={exports:{}},ze={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var Oh;function L1(){if(Oh)return ze;Oh=1;var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=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(){}},D=Object.assign,E={};function k(z,W,ie){this.props=z,this.context=W,this.refs=E,this.updater=ie||C}k.prototype.isReactComponent={},k.prototype.setState=function(z,W){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,W,"setState")},k.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function T(){}T.prototype=k.prototype;function L(z,W,ie){this.props=z,this.context=W,this.refs=E,this.updater=ie||C}var I=L.prototype=new T;I.constructor=L,D(I,k.prototype),I.isPureReactComponent=!0;var _=Array.isArray;function $(){}var N={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function R(z,W,ie){var de=ie.ref;return{$$typeof:a,type:z,key:W,ref:de!==void 0?de:null,props:ie}}function H(z,W){return R(z.type,W,z.props)}function q(z){return typeof z=="object"&&z!==null&&z.$$typeof===a}function P(z){var W={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(ie){return W[ie]})}var te=/\/+/g;function X(z,W){return typeof z=="object"&&z!==null&&z.key!=null?P(""+z.key):W.toString(36)}function O(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(W){z.status==="pending"&&(z.status="fulfilled",z.value=W)},function(W){z.status==="pending"&&(z.status="rejected",z.reason=W)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function A(z,W,ie,de,ge){var xe=typeof z;(xe==="undefined"||xe==="boolean")&&(z=null);var oe=!1;if(z===null)oe=!0;else switch(xe){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(z.$$typeof){case a:case r:oe=!0;break;case y:return oe=z._init,A(oe(z._payload),W,ie,de,ge)}}if(oe)return ge=ge(z),oe=de===""?"."+X(z,0):de,_(ge)?(ie="",oe!=null&&(ie=oe.replace(te,"$&/")+"/"),A(ge,W,ie,"",function(Ie){return Ie})):ge!=null&&(q(ge)&&(ge=H(ge,ie+(ge.key==null||z&&z.key===ge.key?"":(""+ge.key).replace(te,"$&/")+"/")+oe)),W.push(ge)),1;oe=0;var ae=de===""?".":de+":";if(_(z))for(var ve=0;ve<z.length;ve++)de=z[ve],xe=ae+X(de,ve),oe+=A(de,W,ie,xe,ge);else if(ve=S(z),typeof ve=="function")for(z=ve.call(z),ve=0;!(de=z.next()).done;)de=de.value,xe=ae+X(de,ve++),oe+=A(de,W,ie,xe,ge);else if(xe==="object"){if(typeof z.then=="function")return A(O(z),W,ie,de,ge);throw W=String(z),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return oe}function B(z,W,ie){if(z==null)return z;var de=[],ge=0;return A(z,de,"","",function(xe){return W.call(ie,xe,ge++)}),de}function se(z){if(z._status===-1){var W=z._result;W=W(),W.then(function(ie){(z._status===0||z._status===-1)&&(z._status=1,z._result=ie)},function(ie){(z._status===0||z._status===-1)&&(z._status=2,z._result=ie)}),z._status===-1&&(z._status=0,z._result=W)}if(z._status===1)return z._result.default;throw z._result}var Y=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=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(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},me={map:B,forEach:function(z,W,ie){B(z,function(){W.apply(this,arguments)},ie)},count:function(z){var W=0;return B(z,function(){W++}),W},toArray:function(z){return B(z,function(W){return W})||[]},only:function(z){if(!q(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return ze.Activity=g,ze.Children=me,ze.Component=k,ze.Fragment=i,ze.Profiler=u,ze.PureComponent=L,ze.StrictMode=o,ze.Suspense=x,ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,ze.__COMPILER_RUNTIME={__proto__:null,c:function(z){return N.H.useMemoCache(z)}},ze.cache=function(z){return function(){return z.apply(null,arguments)}},ze.cacheSignal=function(){return null},ze.cloneElement=function(z,W,ie){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var de=D({},z.props),ge=z.key;if(W!=null)for(xe in W.key!==void 0&&(ge=""+W.key),W)!M.call(W,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&W.ref===void 0||(de[xe]=W[xe]);var xe=arguments.length-2;if(xe===1)de.children=ie;else if(1<xe){for(var oe=Array(xe),ae=0;ae<xe;ae++)oe[ae]=arguments[ae+2];de.children=oe}return R(z.type,ge,de)},ze.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},ze.createElement=function(z,W,ie){var de,ge={},xe=null;if(W!=null)for(de in W.key!==void 0&&(xe=""+W.key),W)M.call(W,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(ge[de]=W[de]);var oe=arguments.length-2;if(oe===1)ge.children=ie;else if(1<oe){for(var ae=Array(oe),ve=0;ve<oe;ve++)ae[ve]=arguments[ve+2];ge.children=ae}if(z&&z.defaultProps)for(de in oe=z.defaultProps,oe)ge[de]===void 0&&(ge[de]=oe[de]);return R(z,xe,ge)},ze.createRef=function(){return{current:null}},ze.forwardRef=function(z){return{$$typeof:h,render:z}},ze.isValidElement=q,ze.lazy=function(z){return{$$typeof:y,_payload:{_status:-1,_result:z},_init:se}},ze.memo=function(z,W){return{$$typeof:p,type:z,compare:W===void 0?null:W}},ze.startTransition=function(z){var W=N.T,ie={};N.T=ie;try{var de=z(),ge=N.S;ge!==null&&ge(ie,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then($,Y)}catch(xe){Y(xe)}finally{W!==null&&ie.types!==null&&(W.types=ie.types),N.T=W}},ze.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},ze.use=function(z){return N.H.use(z)},ze.useActionState=function(z,W,ie){return N.H.useActionState(z,W,ie)},ze.useCallback=function(z,W){return N.H.useCallback(z,W)},ze.useContext=function(z){return N.H.useContext(z)},ze.useDebugValue=function(){},ze.useDeferredValue=function(z,W){return N.H.useDeferredValue(z,W)},ze.useEffect=function(z,W){return N.H.useEffect(z,W)},ze.useEffectEvent=function(z){return N.H.useEffectEvent(z)},ze.useId=function(){return N.H.useId()},ze.useImperativeHandle=function(z,W,ie){return N.H.useImperativeHandle(z,W,ie)},ze.useInsertionEffect=function(z,W){return N.H.useInsertionEffect(z,W)},ze.useLayoutEffect=function(z,W){return N.H.useLayoutEffect(z,W)},ze.useMemo=function(z,W){return N.H.useMemo(z,W)},ze.useOptimistic=function(z,W){return N.H.useOptimistic(z,W)},ze.useReducer=function(z,W,ie){return N.H.useReducer(z,W,ie)},ze.useRef=function(z){return N.H.useRef(z)},ze.useState=function(z){return N.H.useState(z)},ze.useSyncExternalStore=function(z,W,ie){return N.H.useSyncExternalStore(z,W,ie)},ze.useTransition=function(){return N.H.useTransition()},ze.version="19.2.4",ze}var Bh;function gd(){return Bh||(Bh=1,Du.exports=L1()),Du.exports}var v=gd();const we=Zx(v);var zu={exports:{}},fs={},Lu={exports:{}},_u={};/**
|
|
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 Uh;function _1(){return Uh||(Uh=1,(function(a){function r(A,B){var se=A.length;A.push(B);e:for(;0<se;){var Y=se-1>>>1,me=A[Y];if(0<u(me,B))A[Y]=B,A[se]=me,se=Y;else break e}}function i(A){return A.length===0?null:A[0]}function o(A){if(A.length===0)return null;var B=A[0],se=A.pop();if(se!==B){A[0]=se;e:for(var Y=0,me=A.length,z=me>>>1;Y<z;){var W=2*(Y+1)-1,ie=A[W],de=W+1,ge=A[de];if(0>u(ie,se))de<me&&0>u(ge,ie)?(A[Y]=ge,A[de]=se,Y=de):(A[Y]=ie,A[W]=se,Y=W);else if(de<me&&0>u(ge,se))A[Y]=ge,A[de]=se,Y=de;else break e}}return B}function u(A,B){var se=A.sortIndex-B.sortIndex;return se!==0?se:A.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,h=f.now();a.unstable_now=function(){return f.now()-h}}var x=[],p=[],y=1,g=null,j=3,S=!1,C=!1,D=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function I(A){for(var B=i(p);B!==null;){if(B.callback===null)o(p);else if(B.startTime<=A)o(p),B.sortIndex=B.expirationTime,r(x,B);else break;B=i(p)}}function _(A){if(D=!1,I(A),!C)if(i(x)!==null)C=!0,$||($=!0,P());else{var B=i(p);B!==null&&O(_,B.startTime-A)}}var $=!1,N=-1,M=5,R=-1;function H(){return E?!0:!(a.unstable_now()-R<M)}function q(){if(E=!1,$){var A=a.unstable_now();R=A;var B=!0;try{e:{C=!1,D&&(D=!1,T(N),N=-1),S=!0;var se=j;try{t:{for(I(A),g=i(x);g!==null&&!(g.expirationTime>A&&H());){var Y=g.callback;if(typeof Y=="function"){g.callback=null,j=g.priorityLevel;var me=Y(g.expirationTime<=A);if(A=a.unstable_now(),typeof me=="function"){g.callback=me,I(A),B=!0;break t}g===i(x)&&o(x),I(A)}else o(x);g=i(x)}if(g!==null)B=!0;else{var z=i(p);z!==null&&O(_,z.startTime-A),B=!1}}break e}finally{g=null,j=se,S=!1}B=void 0}}finally{B?P():$=!1}}}var P;if(typeof L=="function")P=function(){L(q)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,X=te.port2;te.port1.onmessage=q,P=function(){X.postMessage(null)}}else P=function(){k(q,0)};function O(A,B){N=k(function(){A(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(A){A.callback=null},a.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<A?Math.floor(1e3/A):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(A){switch(j){case 1:case 2:case 3:var B=3;break;default:B=j}var se=j;j=B;try{return A()}finally{j=se}},a.unstable_requestPaint=function(){E=!0},a.unstable_runWithPriority=function(A,B){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var se=j;j=A;try{return B()}finally{j=se}},a.unstable_scheduleCallback=function(A,B,se){var Y=a.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?Y+se:Y):se=Y,A){case 1:var me=-1;break;case 2:me=250;break;case 5:me=1073741823;break;case 4:me=1e4;break;default:me=5e3}return me=se+me,A={id:y++,callback:B,priorityLevel:A,startTime:se,expirationTime:me,sortIndex:-1},se>Y?(A.sortIndex=se,r(p,A),i(x)===null&&A===i(p)&&(D?(T(N),N=-1):D=!0,O(_,se-Y))):(A.sortIndex=me,r(x,A),C||S||(C=!0,$||($=!0,P()))),A},a.unstable_shouldYield=H,a.unstable_wrapCallback=function(A){var B=j;return function(){var se=j;j=B;try{return A.apply(this,arguments)}finally{j=se}}}})(_u)),_u}var Hh;function O1(){return Hh||(Hh=1,Lu.exports=_1()),Lu.exports}var Ou={exports:{}},Wt={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var Ih;function B1(){if(Ih)return Wt;Ih=1;var a=gd();function r(x){var p="https://react.dev/errors/"+x;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+x+"; 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},u=Symbol.for("react.portal");function m(x,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:x,containerInfo:p,implementation:y}}var f=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(x,p){if(x==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Wt.createPortal=function(x,p){var y=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(x,p,null,y)},Wt.flushSync=function(x){var p=f.T,y=o.p;try{if(f.T=null,o.p=2,x)return x()}finally{f.T=p,o.p=y,o.d.f()}},Wt.preconnect=function(x,p){typeof x=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,o.d.C(x,p))},Wt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Wt.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var y=p.as,g=h(y,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:S}):y==="script"&&o.d.X(x,{crossOrigin:g,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Wt.preinitModule=function(x,p){if(typeof x=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=h(p.as,p.crossOrigin);o.d.M(x,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&o.d.M(x)},Wt.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=h(y,p.crossOrigin);o.d.L(x,y,{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})}},Wt.preloadModule=function(x,p){if(typeof x=="string")if(p){var y=h(p.as,p.crossOrigin);o.d.m(x,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else o.d.m(x)},Wt.requestFormReset=function(x){o.d.r(x)},Wt.unstable_batchedUpdates=function(x,p){return x(p)},Wt.useFormState=function(x,p,y){return f.H.useFormState(x,p,y)},Wt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Wt.version="19.2.4",Wt}var Vh;function Jx(){if(Vh)return Ou.exports;Vh=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(),Ou.exports=B1(),Ou.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 $h;function U1(){if($h)return fs;$h=1;var a=O1(),r=gd(),i=Jx();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 u(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 h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function x(e){if(m(e)!==e)throw Error(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 d=c.alternate;if(d===null){if(s=c.return,s!==null){l=s;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===l)return x(c),e;if(d===s)return x(c),t;d=d.sibling}throw Error(o(188))}if(l.return!==s.return)l=c,s=d;else{for(var b=!1,w=c.child;w;){if(w===l){b=!0,l=c,s=d;break}if(w===s){b=!0,s=c,l=d;break}w=w.sibling}if(!b){for(w=d.child;w;){if(w===l){b=!0,l=d,s=c;break}if(w===s){b=!0,s=d,l=c;break}w=w.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==s)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),L=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function X(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case D:return"Fragment";case k:return"Profiler";case E:return"StrictMode";case _:return"Suspense";case $:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case L:return e.displayName||"Context";case T: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 N:return t=e.displayName||null,t!==null?t:X(e.type)||"Memo";case M:t=e._payload,e=e._init;try{return X(e(t))}catch{}}return null}var O=Array.isArray,A=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,se={pending:!1,data:null,method:null,action:null},Y=[],me=-1;function z(e){return{current:e}}function W(e){0>me||(e.current=Y[me],Y[me]=null,me--)}function ie(e,t){me++,Y[me]=e.current,e.current=t}var de=z(null),ge=z(null),xe=z(null),oe=z(null);function ae(e,t){switch(ie(xe,t),ie(ge,e),ie(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ah(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ah(t),e=lh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}W(de),ie(de,e)}function ve(){W(de),W(ge),W(xe)}function Ie(e){e.memoizedState!==null&&ie(oe,e);var t=de.current,l=lh(t,e.type);t!==l&&(ie(ge,e),ie(de,l))}function Be(e){ge.current===e&&(W(de),W(ge)),oe.current===e&&(W(oe),is._currentValue=se)}var ne,fe;function ue(e){if(ne===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);ne=t&&t[1]||"",fe=-1<l.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ne+e+fe}var he=!1;function be(e,t){if(!e||he)return"";he=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var re=function(){throw Error()};if(Object.defineProperty(re.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(re,[])}catch(Z){var Q=Z}Reflect.construct(e,[],re)}else{try{re.call()}catch(Z){Q=Z}e.call(re.prototype)}}else{try{throw Error()}catch(Z){Q=Z}(re=e())&&typeof re.catch=="function"&&re.catch(function(){})}}catch(Z){if(Z&&Q&&typeof Z.stack=="string")return[Z.stack,Q.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 d=s.DetermineComponentFrameRoot(),b=d[0],w=d[1];if(b&&w){var U=b.split(`
|
|
45
|
+
`),F=w.split(`
|
|
46
|
+
`);for(c=s=0;s<U.length&&!U[s].includes("DetermineComponentFrameRoot");)s++;for(;c<F.length&&!F[c].includes("DetermineComponentFrameRoot");)c++;if(s===U.length||c===F.length)for(s=U.length-1,c=F.length-1;1<=s&&0<=c&&U[s]!==F[c];)c--;for(;1<=s&&0<=c;s--,c--)if(U[s]!==F[c]){if(s!==1||c!==1)do if(s--,c--,0>c||U[s]!==F[c]){var ee=`
|
|
47
|
+
`+U[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{he=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?ue(l):""}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue("Lazy");case 13:return e.child!==t&&t!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return be(e.type,!1);case 11:return be(e.type.render,!1);case 1:return be(e.type,!0);case 31:return ue("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,Zt=a.unstable_scheduleCallback,ct=a.unstable_cancelCallback,Vt=a.unstable_shouldYield,$t=a.unstable_requestPaint,tt=a.unstable_now,jt=a.unstable_getCurrentPriorityLevel,ye=a.unstable_ImmediatePriority,Rt=a.unstable_UserBlockingPriority,De=a.unstable_NormalPriority,xt=a.unstable_LowPriority,Ft=a.unstable_IdlePriority,nt=a.log,Xa=a.unstable_setDisableYieldValue,Xn=null,Ct=null;function St(e){if(typeof nt=="function"&&Xa(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Xn,e)}catch{}}var bt=Math.clz32?Math.clz32:Un,Bn=Math.log,Za=Math.LN2;function Un(e){return e>>>=0,e===0?32:31-(Bn(e)/Za|0)|0}var Ve=256,Ut=262144,Zn=4194304;function Nt(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 br(e,t,l){var s=e.pendingLanes;if(s===0)return 0;var c=0,d=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var w=s&134217727;return w!==0?(s=w&~d,s!==0?c=Nt(s):(b&=w,b!==0?c=Nt(b):l||(l=w&~e,l!==0&&(c=Nt(l))))):(w=s&~d,w!==0?c=Nt(w):b!==0?c=Nt(b):l||(l=s&~e,l!==0&&(c=Nt(l)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,l=t&-t,d>=l||d===32&&(l&4194048)!==0)?t:c}function wn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function go(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Bd(){var e=Zn;return Zn<<=1,(Zn&62914560)===0&&(Zn=4194304),e}function yo(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function jr(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bg(e,t,l,s,c,d){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var w=e.entanglements,U=e.expirationTimes,F=e.hiddenUpdates;for(l=b&~l;0<l;){var ee=31-bt(l),re=1<<ee;w[ee]=0,U[ee]=-1;var Q=F[ee];if(Q!==null)for(F[ee]=null,ee=0;ee<Q.length;ee++){var Z=Q[ee];Z!==null&&(Z.lane&=-536870913)}l&=~re}s!==0&&Ud(e,s,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(b&~t))}function Ud(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 Hd(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 Id(e,t){var l=t&-t;return l=(l&42)!==0?1:bo(l),(l&(e.suspendedLanes|t))!==0?0:l}function bo(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 jo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Vd(){var e=B.p;return e!==0?e:(e=window.event,e===void 0?32:Eh(e.type))}function $d(e,t){var l=B.p;try{return B.p=e,t()}finally{B.p=l}}var ba=Math.random().toString(36).slice(2),Gt="__reactFiber$"+ba,ln="__reactProps$"+ba,kl="__reactContainer$"+ba,So="__reactEvents$"+ba,jg="__reactListeners$"+ba,Sg="__reactHandles$"+ba,Gd="__reactResources$"+ba,Sr="__reactMarker$"+ba;function ko(e){delete e[Gt],delete e[ln],delete e[So],delete e[jg],delete e[Sg]}function wl(e){var t=e[Gt];if(t)return t;for(var l=e.parentNode;l;){if(t=l[kl]||l[Gt]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=dh(e);e!==null;){if(l=e[Gt])return l;e=dh(e)}return t}e=l,l=e.parentNode}return null}function Cl(e){if(e=e[Gt]||e[kl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function kr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Nl(e){var t=e[Gd];return t||(t=e[Gd]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ht(e){e[Sr]=!0}var qd=new Set,Yd={};function Ja(e,t){El(e,t),El(e+"Capture",t)}function El(e,t){for(Yd[e]=t,e=0;e<t.length;e++)qd.add(t[e])}var kg=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]*$"),Pd={},Kd={};function wg(e){return dt.call(Kd,e)?!0:dt.call(Pd,e)?!1:kg.test(e)?Kd[e]=!0:(Pd[e]=!0,!1)}function Ls(e,t,l){if(wg(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 _s(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Jn(e,t,l,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 Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fd(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Cg(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,d=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(b){l=""+b,d.call(this,b)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function wo(e){if(!e._valueTracker){var t=Fd(e)?"checked":"value";e._valueTracker=Cg(e,t,""+e[t])}}function Wd(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),s="";return e&&(s=Fd(e)?e.checked?"true":"false":e.value),e=s,e!==l?(t.setValue(e),!0):!1}function Os(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 Ng=/[\n"\\]/g;function Nn(e){return e.replace(Ng,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Co(e,t,l,s,c,d,b,w){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Cn(t)):e.value!==""+Cn(t)&&(e.value=""+Cn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?No(e,b,Cn(t)):l!=null?No(e,b,Cn(l)):s!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Cn(w):e.removeAttribute("name")}function Qd(e,t,l,s,c,d,b,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||l!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){wo(e);return}l=l!=null?""+Cn(l):"",t=t!=null?""+Cn(t):l,w||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=w?e.checked:!!s,e.defaultChecked=!!s,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),wo(e)}function No(e,t,l){t==="number"&&Os(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Tl(e,t,l,s){if(e=e.options,t){t={};for(var c=0;c<l.length;c++)t["$"+l[c]]=!0;for(l=0;l<e.length;l++)c=t.hasOwnProperty("$"+e[l].value),e[l].selected!==c&&(e[l].selected=c),c&&s&&(e[l].defaultSelected=!0)}else{for(l=""+Cn(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 Xd(e,t,l){if(t!=null&&(t=""+Cn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+Cn(l):""}function Zd(e,t,l,s){if(t==null){if(s!=null){if(l!=null)throw Error(o(92));if(O(s)){if(1<s.length)throw Error(o(93));s=s[0]}l=s}l==null&&(l=""),t=l}l=Cn(t),e.defaultValue=l,s=e.textContent,s===l&&s!==""&&s!==null&&(e.value=s),wo(e)}function Rl(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Eg=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 Jd(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||Eg.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function ef(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&&Jd(e,c,s)}else for(var d in t)t.hasOwnProperty(d)&&Jd(e,d,t[d])}function Eo(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 Tg=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"]]),Rg=/^[\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 Bs(e){return Rg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ea(){}var To=null;function Ro(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Al=null,Ml=null;function tf(e){var t=Cl(e);if(t&&(e=t.stateNode)){var l=e[ln]||null;e:switch(e=t.stateNode,t.type){case"input":if(Co(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[ln]||null;if(!c)throw Error(o(90));Co(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&&Wd(s)}break e;case"textarea":Xd(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Tl(e,!!l.multiple,t,!1)}}}var Ao=!1;function nf(e,t,l){if(Ao)return e(t,l);Ao=!0;try{var s=e(t);return s}finally{if(Ao=!1,(Al!==null||Ml!==null)&&(wi(),Al&&(t=Al,e=Ml,Ml=Al=null,tf(t),e)))for(t=0;t<e.length;t++)tf(e[t])}}function wr(e,t){var l=e.stateNode;if(l===null)return null;var s=l[ln]||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 ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mo=!1;if(ta)try{var Cr={};Object.defineProperty(Cr,"passive",{get:function(){Mo=!0}}),window.addEventListener("test",Cr,Cr),window.removeEventListener("test",Cr,Cr)}catch{Mo=!1}var ja=null,Do=null,Us=null;function af(){if(Us)return Us;var e,t=Do,l=t.length,s,c="value"in ja?ja.value:ja.textContent,d=c.length;for(e=0;e<l&&t[e]===c[e];e++);var b=l-e;for(s=1;s<=b&&t[l-s]===c[d-s];s++);return Us=c.slice(e,1<s?1-s:void 0)}function Hs(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 Is(){return!0}function lf(){return!1}function rn(e){function t(l,s,c,d,b){this._reactName=l,this._targetInst=c,this.type=s,this.nativeEvent=d,this.target=b,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(l=e[w],this[w]=l?l(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?Is:lf,this.isPropagationStopped=lf,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=Is)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Is)},persist:function(){},isPersistent:Is}),t}var el={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vs=rn(el),Nr=g({},el,{view:0,detail:0}),Ag=rn(Nr),zo,Lo,Er,$s=g({},Nr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oo,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!==Er&&(Er&&e.type==="mousemove"?(zo=e.screenX-Er.screenX,Lo=e.screenY-Er.screenY):Lo=zo=0,Er=e),zo)},movementY:function(e){return"movementY"in e?e.movementY:Lo}}),rf=rn($s),Mg=g({},$s,{dataTransfer:0}),Dg=rn(Mg),zg=g({},Nr,{relatedTarget:0}),_o=rn(zg),Lg=g({},el,{animationName:0,elapsedTime:0,pseudoElement:0}),_g=rn(Lg),Og=g({},el,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bg=rn(Og),Ug=g({},el,{data:0}),sf=rn(Ug),Hg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ig={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"},Vg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $g(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vg[e])?!!t[e]:!1}function Oo(){return $g}var Gg=g({},Nr,{key:function(e){if(e.key){var t=Hg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Hs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ig[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oo,charCode:function(e){return e.type==="keypress"?Hs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Hs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qg=rn(Gg),Yg=g({},$s,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),of=rn(Yg),Pg=g({},Nr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oo}),Kg=rn(Pg),Fg=g({},el,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wg=rn(Fg),Qg=g({},$s,{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}),Xg=rn(Qg),Zg=g({},el,{newState:0,oldState:0}),Jg=rn(Zg),ey=[9,13,27,32],Bo=ta&&"CompositionEvent"in window,Tr=null;ta&&"documentMode"in document&&(Tr=document.documentMode);var ty=ta&&"TextEvent"in window&&!Tr,cf=ta&&(!Bo||Tr&&8<Tr&&11>=Tr),uf=" ",df=!1;function ff(e,t){switch(e){case"keyup":return ey.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function pf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dl=!1;function ny(e,t){switch(e){case"compositionend":return pf(t);case"keypress":return t.which!==32?null:(df=!0,uf);case"textInput":return e=t.data,e===uf&&df?null:e;default:return null}}function ay(e,t){if(Dl)return e==="compositionend"||!Bo&&ff(e,t)?(e=af(),Us=Do=ja=null,Dl=!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 cf&&t.locale!=="ko"?null:t.data;default:return null}}var ly={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 mf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ly[e.type]:t==="textarea"}function hf(e,t,l,s){Al?Ml?Ml.push(s):Ml=[s]:Al=s,t=Mi(t,"onChange"),0<t.length&&(l=new Vs("onChange","change",null,l,s),e.push({event:l,listeners:t}))}var Rr=null,Ar=null;function ry(e){Xm(e,0)}function Gs(e){var t=kr(e);if(Wd(t))return e}function xf(e,t){if(e==="change")return t}var vf=!1;if(ta){var Uo;if(ta){var Ho="oninput"in document;if(!Ho){var gf=document.createElement("div");gf.setAttribute("oninput","return;"),Ho=typeof gf.oninput=="function"}Uo=Ho}else Uo=!1;vf=Uo&&(!document.documentMode||9<document.documentMode)}function yf(){Rr&&(Rr.detachEvent("onpropertychange",bf),Ar=Rr=null)}function bf(e){if(e.propertyName==="value"&&Gs(Ar)){var t=[];hf(t,Ar,e,Ro(e)),nf(ry,t)}}function sy(e,t,l){e==="focusin"?(yf(),Rr=t,Ar=l,Rr.attachEvent("onpropertychange",bf)):e==="focusout"&&yf()}function iy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Gs(Ar)}function oy(e,t){if(e==="click")return Gs(t)}function cy(e,t){if(e==="input"||e==="change")return Gs(t)}function uy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var fn=typeof Object.is=="function"?Object.is:uy;function Mr(e,t){if(fn(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)||!fn(e[c],t[c]))return!1}return!0}function jf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sf(e,t){var l=jf(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=jf(l)}}function kf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Os(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=Os(e.document)}return t}function Io(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 dy=ta&&"documentMode"in document&&11>=document.documentMode,zl=null,Vo=null,Dr=null,$o=!1;function Cf(e,t,l){var s=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;$o||zl==null||zl!==Os(s)||(s=zl,"selectionStart"in s&&Io(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}),Dr&&Mr(Dr,s)||(Dr=s,s=Mi(Vo,"onSelect"),0<s.length&&(t=new Vs("onSelect","select",null,t,l),e.push({event:t,listeners:s}),t.target=zl)))}function tl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var Ll={animationend:tl("Animation","AnimationEnd"),animationiteration:tl("Animation","AnimationIteration"),animationstart:tl("Animation","AnimationStart"),transitionrun:tl("Transition","TransitionRun"),transitionstart:tl("Transition","TransitionStart"),transitioncancel:tl("Transition","TransitionCancel"),transitionend:tl("Transition","TransitionEnd")},Go={},Nf={};ta&&(Nf=document.createElement("div").style,"AnimationEvent"in window||(delete Ll.animationend.animation,delete Ll.animationiteration.animation,delete Ll.animationstart.animation),"TransitionEvent"in window||delete Ll.transitionend.transition);function nl(e){if(Go[e])return Go[e];if(!Ll[e])return e;var t=Ll[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in Nf)return Go[e]=t[l];return e}var Ef=nl("animationend"),Tf=nl("animationiteration"),Rf=nl("animationstart"),fy=nl("transitionrun"),py=nl("transitionstart"),my=nl("transitioncancel"),Af=nl("transitionend"),Mf=new Map,qo="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(" ");qo.push("scrollEnd");function Hn(e,t){Mf.set(e,t),Ja(t,[e])}var qs=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],_l=0,Yo=0;function Ys(){for(var e=_l,t=Yo=_l=0;t<e;){var l=En[t];En[t++]=null;var s=En[t];En[t++]=null;var c=En[t];En[t++]=null;var d=En[t];if(En[t++]=null,s!==null&&c!==null){var b=s.pending;b===null?c.next=c:(c.next=b.next,b.next=c),s.pending=c}d!==0&&Df(l,c,d)}}function Ps(e,t,l,s){En[_l++]=e,En[_l++]=t,En[_l++]=l,En[_l++]=s,Yo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Po(e,t,l,s){return Ps(e,t,l,s),Ks(e)}function al(e,t){return Ps(e,null,null,t),Ks(e)}function Df(e,t,l){e.lanes|=l;var s=e.alternate;s!==null&&(s.lanes|=l);for(var c=!1,d=e.return;d!==null;)d.childLanes|=l,s=d.alternate,s!==null&&(s.childLanes|=l),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-bt(l),e=d.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=l|536870912),d):null}function Ks(e){if(50<es)throw es=0,tu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ol={};function hy(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 pn(e,t,l,s){return new hy(e,t,l,s)}function Ko(e){return e=e.prototype,!(!e||!e.isReactComponent)}function na(e,t){var l=e.alternate;return l===null?(l=pn(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 zf(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 Fs(e,t,l,s,c,d){var b=0;if(s=e,typeof e=="function")Ko(e)&&(b=1);else if(typeof e=="string")b=b1(e,l,de.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=pn(31,l,t,c),e.elementType=R,e.lanes=d,e;case D:return ll(l.children,c,d,t);case E:b=8,c|=24;break;case k:return e=pn(12,l,t,c|2),e.elementType=k,e.lanes=d,e;case _:return e=pn(13,l,t,c),e.elementType=_,e.lanes=d,e;case $:return e=pn(19,l,t,c),e.elementType=$,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:b=10;break e;case T:b=9;break e;case I:b=11;break e;case N:b=14;break e;case M:b=16,s=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),s=null}return t=pn(b,l,t,c),t.elementType=e,t.type=s,t.lanes=d,t}function ll(e,t,l,s){return e=pn(7,e,s,t),e.lanes=l,e}function Fo(e,t,l){return e=pn(6,e,null,t),e.lanes=l,e}function Lf(e){var t=pn(18,null,null,0);return t.stateNode=e,t}function Wo(e,t,l){return t=pn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var _f=new WeakMap;function Tn(e,t){if(typeof e=="object"&&e!==null){var l=_f.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Me(t)},_f.set(e,t),t)}return{value:e,source:t,stack:Me(t)}}var Bl=[],Ul=0,Ws=null,zr=0,Rn=[],An=0,Sa=null,qn=1,Yn="";function aa(e,t){Bl[Ul++]=zr,Bl[Ul++]=Ws,Ws=e,zr=t}function Of(e,t,l){Rn[An++]=qn,Rn[An++]=Yn,Rn[An++]=Sa,Sa=e;var s=qn;e=Yn;var c=32-bt(s)-1;s&=~(1<<c),l+=1;var d=32-bt(t)+c;if(30<d){var b=c-c%5;d=(s&(1<<b)-1).toString(32),s>>=b,c-=b,qn=1<<32-bt(t)+c|l<<c|s,Yn=d+e}else qn=1<<d|l<<c|s,Yn=e}function Qo(e){e.return!==null&&(aa(e,1),Of(e,1,0))}function Xo(e){for(;e===Ws;)Ws=Bl[--Ul],Bl[Ul]=null,zr=Bl[--Ul],Bl[Ul]=null;for(;e===Sa;)Sa=Rn[--An],Rn[An]=null,Yn=Rn[--An],Rn[An]=null,qn=Rn[--An],Rn[An]=null}function Bf(e,t){Rn[An++]=qn,Rn[An++]=Yn,Rn[An++]=Sa,qn=t.id,Yn=t.overflow,Sa=e}var qt=null,ft=null,Fe=!1,ka=null,Mn=!1,Zo=Error(o(519));function wa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Lr(Tn(t,e)),Zo}function Uf(e){var t=e.stateNode,l=e.type,s=e.memoizedProps;switch(t[Gt]=e,t[ln]=s,l){case"dialog":Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":case"embed":Ye("load",t);break;case"video":case"audio":for(l=0;l<ns.length;l++)Ye(ns[l],t);break;case"source":Ye("error",t);break;case"img":case"image":case"link":Ye("error",t),Ye("load",t);break;case"details":Ye("toggle",t);break;case"input":Ye("invalid",t),Qd(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Ye("invalid",t);break;case"textarea":Ye("invalid",t),Zd(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||th(t.textContent,l)?(s.popover!=null&&(Ye("beforetoggle",t),Ye("toggle",t)),s.onScroll!=null&&Ye("scroll",t),s.onScrollEnd!=null&&Ye("scrollend",t),s.onClick!=null&&(t.onclick=ea),t=!0):t=!1,t||wa(e,!0)}function Hf(e){for(qt=e.return;qt;)switch(qt.tag){case 5:case 31:case 13:Mn=!1;return;case 27:case 3:Mn=!0;return;default:qt=qt.return}}function Hl(e){if(e!==qt)return!1;if(!Fe)return Hf(e),Fe=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||xu(e.type,e.memoizedProps)),l=!l),l&&ft&&wa(e),Hf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=uh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));ft=uh(e)}else t===27?(t=ft,Ua(e.type)?(e=ju,ju=null,ft=e):ft=t):ft=qt?zn(e.stateNode.nextSibling):null;return!0}function rl(){ft=qt=null,Fe=!1}function Jo(){var e=ka;return e!==null&&(un===null?un=e:un.push.apply(un,e),ka=null),e}function Lr(e){ka===null?ka=[e]:ka.push(e)}var ec=z(null),sl=null,la=null;function Ca(e,t,l){ie(ec,t._currentValue),t._currentValue=l}function ra(e){e._currentValue=ec.current,W(ec)}function tc(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 nc(e,t,l,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var b=c.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=c;for(var U=0;U<t.length;U++)if(w.context===t[U]){d.lanes|=l,w=d.alternate,w!==null&&(w.lanes|=l),tc(d.return,l,e),s||(b=null);break e}d=w.next}}else if(c.tag===18){if(b=c.return,b===null)throw Error(o(341));b.lanes|=l,d=b.alternate,d!==null&&(d.lanes|=l),tc(b,l,e),b=null}else b=c.child;if(b!==null)b.return=c;else for(b=c;b!==null;){if(b===e){b=null;break}if(c=b.sibling,c!==null){c.return=b.return,b=c;break}b=b.return}c=b}}function Il(e,t,l,s){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var b=c.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var w=c.type;fn(c.pendingProps.value,b.value)||(e!==null?e.push(w):e=[w])}}else if(c===oe.current){if(b=c.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(is):e=[is])}c=c.return}e!==null&&nc(t,e,l,s),t.flags|=262144}function Qs(e){for(e=e.firstContext;e!==null;){if(!fn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function il(e){sl=e,la=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Yt(e){return If(sl,e)}function Xs(e,t){return sl===null&&il(e),If(e,t)}function If(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},la===null){if(e===null)throw Error(o(308));la=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else la=la.next=t;return l}var xy=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()})}},vy=a.unstable_scheduleCallback,gy=a.unstable_NormalPriority,At={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ac(){return{controller:new xy,data:new Map,refCount:0}}function _r(e){e.refCount--,e.refCount===0&&vy(gy,function(){e.controller.abort()})}var Or=null,lc=0,Vl=0,$l=null;function yy(e,t){if(Or===null){var l=Or=[];lc=0,Vl=iu(),$l={status:"pending",value:void 0,then:function(s){l.push(s)}}}return lc++,t.then(Vf,Vf),t}function Vf(){if(--lc===0&&Or!==null){$l!==null&&($l.status="fulfilled");var e=Or;Or=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function by(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 $f=A.S;A.S=function(e,t){Cm=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&yy(e,t),$f!==null&&$f(e,t)};var ol=z(null);function rc(){var e=ol.current;return e!==null?e:ut.pooledCache}function Zs(e,t){t===null?ie(ol,ol.current):ie(ol,t.pool)}function Gf(){var e=rc();return e===null?null:{parent:At._currentValue,pool:e}}var Gl=Error(o(460)),sc=Error(o(474)),Js=Error(o(542)),ei={then:function(){}};function qf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Yf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(ea,ea),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Kf(e),e;default:if(typeof t.status=="string")t.then(ea,ea);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,Kf(e),e}throw ul=t,Gl}}function cl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ul=l,Gl):l}}var ul=null;function Pf(){if(ul===null)throw Error(o(459));var e=ul;return ul=null,e}function Kf(e){if(e===Gl||e===Js)throw Error(o(483))}var ql=null,Br=0;function ti(e){var t=Br;return Br+=1,ql===null&&(ql=[]),Yf(ql,e,t)}function Ur(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ni(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 Ff(e){function t(G,V){if(e){var K=G.deletions;K===null?(G.deletions=[V],G.flags|=16):K.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=na(G,V),G.index=0,G.sibling=null,G}function d(G,V,K){return G.index=K,e?(K=G.alternate,K!==null?(K=K.index,K<V?(G.flags|=67108866,V):K):(G.flags|=67108866,V)):(G.flags|=1048576,V)}function b(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function w(G,V,K,le){return V===null||V.tag!==6?(V=Fo(K,G.mode,le),V.return=G,V):(V=c(V,K),V.return=G,V)}function U(G,V,K,le){var Ee=K.type;return Ee===D?ee(G,V,K.props.children,le,K.key):V!==null&&(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===M&&cl(Ee)===V.type)?(V=c(V,K.props),Ur(V,K),V.return=G,V):(V=Fs(K.type,K.key,K.props,null,G.mode,le),Ur(V,K),V.return=G,V)}function F(G,V,K,le){return V===null||V.tag!==4||V.stateNode.containerInfo!==K.containerInfo||V.stateNode.implementation!==K.implementation?(V=Wo(K,G.mode,le),V.return=G,V):(V=c(V,K.children||[]),V.return=G,V)}function ee(G,V,K,le,Ee){return V===null||V.tag!==7?(V=ll(K,G.mode,le,Ee),V.return=G,V):(V=c(V,K),V.return=G,V)}function re(G,V,K){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Fo(""+V,G.mode,K),V.return=G,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return K=Fs(V.type,V.key,V.props,null,G.mode,K),Ur(K,V),K.return=G,K;case C:return V=Wo(V,G.mode,K),V.return=G,V;case M:return V=cl(V),re(G,V,K)}if(O(V)||P(V))return V=ll(V,G.mode,K,null),V.return=G,V;if(typeof V.then=="function")return re(G,ti(V),K);if(V.$$typeof===L)return re(G,Xs(G,V),K);ni(G,V)}return null}function Q(G,V,K,le){var Ee=V!==null?V.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return Ee!==null?null:w(G,V,""+K,le);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return K.key===Ee?U(G,V,K,le):null;case C:return K.key===Ee?F(G,V,K,le):null;case M:return K=cl(K),Q(G,V,K,le)}if(O(K)||P(K))return Ee!==null?null:ee(G,V,K,le,null);if(typeof K.then=="function")return Q(G,V,ti(K),le);if(K.$$typeof===L)return Q(G,V,Xs(G,K),le);ni(G,K)}return null}function Z(G,V,K,le,Ee){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return G=G.get(K)||null,w(V,G,""+le,Ee);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case S:return G=G.get(le.key===null?K:le.key)||null,U(V,G,le,Ee);case C:return G=G.get(le.key===null?K:le.key)||null,F(V,G,le,Ee);case M:return le=cl(le),Z(G,V,K,le,Ee)}if(O(le)||P(le))return G=G.get(K)||null,ee(V,G,le,Ee,null);if(typeof le.then=="function")return Z(G,V,K,ti(le),Ee);if(le.$$typeof===L)return Z(G,V,K,Xs(V,le),Ee);ni(V,le)}return null}function Se(G,V,K,le){for(var Ee=null,Qe=null,ke=V,Ue=V=0,Ke=null;ke!==null&&Ue<K.length;Ue++){ke.index>Ue?(Ke=ke,ke=null):Ke=ke.sibling;var Xe=Q(G,ke,K[Ue],le);if(Xe===null){ke===null&&(ke=Ke);break}e&&ke&&Xe.alternate===null&&t(G,ke),V=d(Xe,V,Ue),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe,ke=Ke}if(Ue===K.length)return l(G,ke),Fe&&aa(G,Ue),Ee;if(ke===null){for(;Ue<K.length;Ue++)ke=re(G,K[Ue],le),ke!==null&&(V=d(ke,V,Ue),Qe===null?Ee=ke:Qe.sibling=ke,Qe=ke);return Fe&&aa(G,Ue),Ee}for(ke=s(ke);Ue<K.length;Ue++)Ke=Z(ke,G,Ue,K[Ue],le),Ke!==null&&(e&&Ke.alternate!==null&&ke.delete(Ke.key===null?Ue:Ke.key),V=d(Ke,V,Ue),Qe===null?Ee=Ke:Qe.sibling=Ke,Qe=Ke);return e&&ke.forEach(function(Ga){return t(G,Ga)}),Fe&&aa(G,Ue),Ee}function Te(G,V,K,le){if(K==null)throw Error(o(151));for(var Ee=null,Qe=null,ke=V,Ue=V=0,Ke=null,Xe=K.next();ke!==null&&!Xe.done;Ue++,Xe=K.next()){ke.index>Ue?(Ke=ke,ke=null):Ke=ke.sibling;var Ga=Q(G,ke,Xe.value,le);if(Ga===null){ke===null&&(ke=Ke);break}e&&ke&&Ga.alternate===null&&t(G,ke),V=d(Ga,V,Ue),Qe===null?Ee=Ga:Qe.sibling=Ga,Qe=Ga,ke=Ke}if(Xe.done)return l(G,ke),Fe&&aa(G,Ue),Ee;if(ke===null){for(;!Xe.done;Ue++,Xe=K.next())Xe=re(G,Xe.value,le),Xe!==null&&(V=d(Xe,V,Ue),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe);return Fe&&aa(G,Ue),Ee}for(ke=s(ke);!Xe.done;Ue++,Xe=K.next())Xe=Z(ke,G,Ue,Xe.value,le),Xe!==null&&(e&&Xe.alternate!==null&&ke.delete(Xe.key===null?Ue:Xe.key),V=d(Xe,V,Ue),Qe===null?Ee=Xe:Qe.sibling=Xe,Qe=Xe);return e&&ke.forEach(function(M1){return t(G,M1)}),Fe&&aa(G,Ue),Ee}function it(G,V,K,le){if(typeof K=="object"&&K!==null&&K.type===D&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case S:e:{for(var Ee=K.key;V!==null;){if(V.key===Ee){if(Ee=K.type,Ee===D){if(V.tag===7){l(G,V.sibling),le=c(V,K.props.children),le.return=G,G=le;break e}}else if(V.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===M&&cl(Ee)===V.type){l(G,V.sibling),le=c(V,K.props),Ur(le,K),le.return=G,G=le;break e}l(G,V);break}else t(G,V);V=V.sibling}K.type===D?(le=ll(K.props.children,G.mode,le,K.key),le.return=G,G=le):(le=Fs(K.type,K.key,K.props,null,G.mode,le),Ur(le,K),le.return=G,G=le)}return b(G);case C:e:{for(Ee=K.key;V!==null;){if(V.key===Ee)if(V.tag===4&&V.stateNode.containerInfo===K.containerInfo&&V.stateNode.implementation===K.implementation){l(G,V.sibling),le=c(V,K.children||[]),le.return=G,G=le;break e}else{l(G,V);break}else t(G,V);V=V.sibling}le=Wo(K,G.mode,le),le.return=G,G=le}return b(G);case M:return K=cl(K),it(G,V,K,le)}if(O(K))return Se(G,V,K,le);if(P(K)){if(Ee=P(K),typeof Ee!="function")throw Error(o(150));return K=Ee.call(K),Te(G,V,K,le)}if(typeof K.then=="function")return it(G,V,ti(K),le);if(K.$$typeof===L)return it(G,V,Xs(G,K),le);ni(G,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,V!==null&&V.tag===6?(l(G,V.sibling),le=c(V,K),le.return=G,G=le):(l(G,V),le=Fo(K,G.mode,le),le.return=G,G=le),b(G)):l(G,V)}return function(G,V,K,le){try{Br=0;var Ee=it(G,V,K,le);return ql=null,Ee}catch(ke){if(ke===Gl||ke===Js)throw ke;var Qe=pn(29,ke,null,G.mode);return Qe.lanes=le,Qe.return=G,Qe}finally{}}}var dl=Ff(!0),Wf=Ff(!1),Na=!1;function ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function oc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ea(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ta(e,t,l){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Je&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=Ks(e),Df(e,null,l),t}return Ps(e,s,t,l),Ks(e)}function Hr(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,Hd(e,l)}}function cc(e,t){var l=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,l===s)){var c=null,d=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};d===null?c=d=b:d=d.next=b,l=l.next}while(l!==null);d===null?c=d=t:d=d.next=t}else c=d=t;l={baseState:s.baseState,firstBaseUpdate:c,lastBaseUpdate:d,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 uc=!1;function Ir(){if(uc){var e=$l;if(e!==null)throw e}}function Vr(e,t,l,s){uc=!1;var c=e.updateQueue;Na=!1;var d=c.firstBaseUpdate,b=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var U=w,F=U.next;U.next=null,b===null?d=F:b.next=F,b=U;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,w=ee.lastBaseUpdate,w!==b&&(w===null?ee.firstBaseUpdate=F:w.next=F,ee.lastBaseUpdate=U))}if(d!==null){var re=c.baseState;b=0,ee=F=U=null,w=d;do{var Q=w.lane&-536870913,Z=Q!==w.lane;if(Z?(Pe&Q)===Q:(s&Q)===Q){Q!==0&&Q===Vl&&(uc=!0),ee!==null&&(ee=ee.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Se=e,Te=w;Q=t;var it=l;switch(Te.tag){case 1:if(Se=Te.payload,typeof Se=="function"){re=Se.call(it,re,Q);break e}re=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Te.payload,Q=typeof Se=="function"?Se.call(it,re,Q):Se,Q==null)break e;re=g({},re,Q);break e;case 2:Na=!0}}Q=w.callback,Q!==null&&(e.flags|=64,Z&&(e.flags|=8192),Z=c.callbacks,Z===null?c.callbacks=[Q]:Z.push(Q))}else Z={lane:Q,tag:w.tag,payload:w.payload,callback:w.callback,next:null},ee===null?(F=ee=Z,U=re):ee=ee.next=Z,b|=Q;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;Z=w,w=Z.next,Z.next=null,c.lastBaseUpdate=Z,c.shared.pending=null}}while(!0);ee===null&&(U=re),c.baseState=U,c.firstBaseUpdate=F,c.lastBaseUpdate=ee,d===null&&(c.shared.lanes=0),za|=b,e.lanes=b,e.memoizedState=re}}function Qf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Xf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Qf(l[e],t)}var Yl=z(null),ai=z(0);function Zf(e,t){e=ma,ie(ai,e),ie(Yl,t),ma=e|t.baseLanes}function dc(){ie(ai,ma),ie(Yl,Yl.current)}function fc(){ma=ai.current,W(Yl),W(ai)}var mn=z(null),Dn=null;function Ra(e){var t=e.alternate;ie(Et,Et.current&1),ie(mn,e),Dn===null&&(t===null||Yl.current!==null||t.memoizedState!==null)&&(Dn=e)}function pc(e){ie(Et,Et.current),ie(mn,e),Dn===null&&(Dn=e)}function Jf(e){e.tag===22?(ie(Et,Et.current),ie(mn,e),Dn===null&&(Dn=e)):Aa()}function Aa(){ie(Et,Et.current),ie(mn,mn.current)}function hn(e){W(mn),Dn===e&&(Dn=null),W(Et)}var Et=z(0);function li(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||yu(l)||bu(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 sa=0,Oe=null,rt=null,Mt=null,ri=!1,Pl=!1,fl=!1,si=0,$r=0,Kl=null,jy=0;function kt(){throw Error(o(321))}function mc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!fn(e[l],t[l]))return!1;return!0}function hc(e,t,l,s,c,d){return sa=d,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?Op:Ac,fl=!1,d=l(s,c),fl=!1,Pl&&(d=tp(t,l,s,c)),ep(e),d}function ep(e){A.H=Yr;var t=rt!==null&&rt.next!==null;if(sa=0,Mt=rt=Oe=null,ri=!1,$r=0,Kl=null,t)throw Error(o(300));e===null||Dt||(e=e.dependencies,e!==null&&Qs(e)&&(Dt=!0))}function tp(e,t,l,s){Oe=e;var c=0;do{if(Pl&&(Kl=null),$r=0,Pl=!1,25<=c)throw Error(o(301));if(c+=1,Mt=rt=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}A.H=Bp,d=t(l,s)}while(Pl);return d}function Sy(){var e=A.H,t=e.useState()[0];return t=typeof t.then=="function"?Gr(t):t,e=e.useState()[0],(rt!==null?rt.memoizedState:null)!==e&&(Oe.flags|=1024),t}function xc(){var e=si!==0;return si=0,e}function vc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function gc(e){if(ri){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ri=!1}sa=0,Mt=rt=Oe=null,Pl=!1,$r=si=0,Kl=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 ii(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Gr(e){var t=$r;return $r+=1,Kl===null&&(Kl=[]),e=Yf(Kl,e,t),t=Oe,(Mt===null?t.memoizedState:Mt.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?Op:Ac),e}function oi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Gr(e);if(e.$$typeof===L)return Yt(e)}throw Error(o(438,String(e)))}function yc(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=ii(),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]=H;return t.index++,l}function ia(e,t){return typeof t=="function"?t(e):t}function ci(e){var t=Tt();return bc(t,rt,e)}function bc(e,t,l){var s=e.queue;if(s===null)throw Error(o(311));s.lastRenderedReducer=l;var c=e.baseQueue,d=s.pending;if(d!==null){if(c!==null){var b=c.next;c.next=d.next,d.next=b}t.baseQueue=c=d,s.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var w=b=null,U=null,F=t,ee=!1;do{var re=F.lane&-536870913;if(re!==F.lane?(Pe&re)===re:(sa&re)===re){var Q=F.revertLane;if(Q===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),re===Vl&&(ee=!0);else if((sa&Q)===Q){F=F.next,Q===Vl&&(ee=!0);continue}else re={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},U===null?(w=U=re,b=d):U=U.next=re,Oe.lanes|=Q,za|=Q;re=F.action,fl&&l(d,re),d=F.hasEagerState?F.eagerState:l(d,re)}else Q={lane:re,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},U===null?(w=U=Q,b=d):U=U.next=Q,Oe.lanes|=re,za|=re;F=F.next}while(F!==null&&F!==t);if(U===null?b=d:U.next=w,!fn(d,e.memoizedState)&&(Dt=!0,ee&&(l=$l,l!==null)))throw l;e.memoizedState=d,e.baseState=b,e.baseQueue=U,s.lastRenderedState=d}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function jc(e){var t=Tt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var s=l.dispatch,c=l.pending,d=t.memoizedState;if(c!==null){l.pending=null;var b=c=c.next;do d=e(d,b.action),b=b.next;while(b!==c);fn(d,t.memoizedState)||(Dt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),l.lastRenderedState=d}return[d,s]}function np(e,t,l){var s=Oe,c=Tt(),d=Fe;if(d){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!fn((rt||c).memoizedState,l);if(b&&(c.memoizedState=l,Dt=!0),c=c.queue,wc(rp.bind(null,s,c,e),[e]),c.getSnapshot!==t||b||Mt!==null&&Mt.memoizedState.tag&1){if(s.flags|=2048,Fl(9,{destroy:void 0},lp.bind(null,s,c,l,t),null),ut===null)throw Error(o(349));d||(sa&127)!==0||ap(s,t,l)}return l}function ap(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Oe.updateQueue,t===null?(t=ii(),Oe.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function lp(e,t,l,s){t.value=l,t.getSnapshot=s,sp(t)&&ip(e)}function rp(e,t,l){return l(function(){sp(t)&&ip(e)})}function sp(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!fn(e,l)}catch{return!0}}function ip(e){var t=al(e,2);t!==null&&dn(t,e,2)}function Sc(e){var t=Jt();if(typeof e=="function"){var l=e;if(e=l(),fl){St(!0);try{l()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:e},t}function op(e,t,l,s){return e.baseState=l,bc(e,rt,typeof s=="function"?s:ia)}function ky(e,t,l,s,c){if(fi(e))throw Error(o(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){d.listeners.push(b)}};A.T!==null?l(!0):d.isTransition=!1,s(d),l=t.pending,l===null?(d.next=t.pending=d,cp(t,d)):(d.next=l.next,t.pending=l.next=d)}}function cp(e,t){var l=t.action,s=t.payload,c=e.state;if(t.isTransition){var d=A.T,b={};A.T=b;try{var w=l(c,s),U=A.S;U!==null&&U(b,w),up(e,t,w)}catch(F){kc(e,t,F)}finally{d!==null&&b.types!==null&&(d.types=b.types),A.T=d}}else try{d=l(c,s),up(e,t,d)}catch(F){kc(e,t,F)}}function up(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(s){dp(e,t,s)},function(s){return kc(e,t,s)}):dp(e,t,l)}function dp(e,t,l){t.status="fulfilled",t.value=l,fp(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,cp(e,l)))}function kc(e,t,l){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=l,fp(t),t=t.next;while(t!==s)}e.action=null}function fp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function pp(e,t){return t}function mp(e,t){if(Fe){var l=ut.formState;if(l!==null){e:{var s=Oe;if(Fe){if(ft){t:{for(var c=ft,d=Mn;c.nodeType!==8;){if(!d){c=null;break t}if(c=zn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ft=zn(c.nextSibling),s=c.data==="F!";break e}}wa(s)}s=!1}s&&(t=l[0])}}return l=Jt(),l.memoizedState=l.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pp,lastRenderedState:t},l.queue=s,l=zp.bind(null,Oe,s),s.dispatch=l,s=Sc(!1),d=Rc.bind(null,Oe,!1,s.queue),s=Jt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,l=ky.bind(null,Oe,c,d,l),c.dispatch=l,s.memoizedState=e,[t,l,!1]}function hp(e){var t=Tt();return xp(t,rt,e)}function xp(e,t,l){if(t=bc(e,t,pp)[0],e=ci(ia)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Gr(t)}catch(b){throw b===Gl?Js:b}else s=t;t=Tt();var c=t.queue,d=c.dispatch;return l!==t.memoizedState&&(Oe.flags|=2048,Fl(9,{destroy:void 0},wy.bind(null,c,l),null)),[s,d,e]}function wy(e,t){e.action=t}function vp(e){var t=Tt(),l=rt;if(l!==null)return xp(t,l,e);Tt(),t=t.memoizedState,l=Tt();var s=l.queue.dispatch;return l.memoizedState=e,[t,s,!1]}function Fl(e,t,l,s){return e={tag:e,create:l,deps:s,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=ii(),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 gp(){return Tt().memoizedState}function ui(e,t,l,s){var c=Jt();Oe.flags|=e,c.memoizedState=Fl(1|t,{destroy:void 0},l,s===void 0?null:s)}function di(e,t,l,s){var c=Tt();s=s===void 0?null:s;var d=c.memoizedState.inst;rt!==null&&s!==null&&mc(s,rt.memoizedState.deps)?c.memoizedState=Fl(t,d,l,s):(Oe.flags|=e,c.memoizedState=Fl(1|t,d,l,s))}function yp(e,t){ui(8390656,8,e,t)}function wc(e,t){di(2048,8,e,t)}function Cy(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=ii(),Oe.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function bp(e){var t=Tt().memoizedState;return Cy({ref:t,nextImpl:e}),function(){if((Je&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function jp(e,t){return di(4,2,e,t)}function Sp(e,t){return di(4,4,e,t)}function kp(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 wp(e,t,l){l=l!=null?l.concat([e]):null,di(4,4,kp.bind(null,t,e),l)}function Cc(){}function Cp(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;return t!==null&&mc(t,s[1])?s[0]:(l.memoizedState=[e,t],e)}function Np(e,t){var l=Tt();t=t===void 0?null:t;var s=l.memoizedState;if(t!==null&&mc(t,s[1]))return s[0];if(s=e(),fl){St(!0);try{e()}finally{St(!1)}}return l.memoizedState=[s,t],s}function Nc(e,t,l){return l===void 0||(sa&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=Em(),Oe.lanes|=e,za|=e,l)}function Ep(e,t,l,s){return fn(l,t)?l:Yl.current!==null?(e=Nc(e,l,s),fn(e,t)||(Dt=!0),e):(sa&42)===0||(sa&1073741824)!==0&&(Pe&261930)===0?(Dt=!0,e.memoizedState=l):(e=Em(),Oe.lanes|=e,za|=e,t)}function Tp(e,t,l,s,c){var d=B.p;B.p=d!==0&&8>d?d:8;var b=A.T,w={};A.T=w,Rc(e,!1,t,l);try{var U=c(),F=A.S;if(F!==null&&F(w,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ee=by(U,s);qr(e,t,ee,gn(e))}else qr(e,t,s,gn(e))}catch(re){qr(e,t,{then:function(){},status:"rejected",reason:re},gn())}finally{B.p=d,b!==null&&w.types!==null&&(b.types=w.types),A.T=b}}function Ny(){}function Ec(e,t,l,s){if(e.tag!==5)throw Error(o(476));var c=Rp(e).queue;Tp(e,c,t,se,l===null?Ny:function(){return Ap(e),l(s)})}function Rp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:se},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ia,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ap(e){var t=Rp(e);t.next===null&&(t=e.alternate.memoizedState),qr(e,t.next.queue,{},gn())}function Tc(){return Yt(is)}function Mp(){return Tt().memoizedState}function Dp(){return Tt().memoizedState}function Ey(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=gn();e=Ea(l);var s=Ta(t,e,l);s!==null&&(dn(s,t,l),Hr(s,t,l)),t={cache:ac()},e.payload=t;return}t=t.return}}function Ty(e,t,l){var s=gn();l={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},fi(e)?Lp(t,l):(l=Po(e,t,l,s),l!==null&&(dn(l,e,s),_p(l,t,s)))}function zp(e,t,l){var s=gn();qr(e,t,l,s)}function qr(e,t,l,s){var c={lane:s,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(fi(e))Lp(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var b=t.lastRenderedState,w=d(b,l);if(c.hasEagerState=!0,c.eagerState=w,fn(w,b))return Ps(e,t,c,0),ut===null&&Ys(),!1}catch{}finally{}if(l=Po(e,t,c,s),l!==null)return dn(l,e,s),_p(l,t,s),!0}return!1}function Rc(e,t,l,s){if(s={lane:2,revertLane:iu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},fi(e)){if(t)throw Error(o(479))}else t=Po(e,l,s,2),t!==null&&dn(t,e,2)}function fi(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Lp(e,t){Pl=ri=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function _p(e,t,l){if((l&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,l|=s,t.lanes=l,Hd(e,l)}}var Yr={readContext:Yt,use:oi,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};Yr.useEffectEvent=kt;var Op={readContext:Yt,use:oi,useCallback:function(e,t){return Jt().memoizedState=[e,t===void 0?null:t],e},useContext:Yt,useEffect:yp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,ui(4194308,4,kp.bind(null,t,e),l)},useLayoutEffect:function(e,t){return ui(4194308,4,e,t)},useInsertionEffect:function(e,t){ui(4,2,e,t)},useMemo:function(e,t){var l=Jt();t=t===void 0?null:t;var s=e();if(fl){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(fl){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=Ty.bind(null,Oe,e),[s.memoizedState,e]},useRef:function(e){var t=Jt();return e={current:e},t.memoizedState=e},useState:function(e){e=Sc(e);var t=e.queue,l=zp.bind(null,Oe,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:Cc,useDeferredValue:function(e,t){var l=Jt();return Nc(l,e,t)},useTransition:function(){var e=Sc(!1);return e=Tp.bind(null,Oe,e.queue,!0,!1),Jt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var s=Oe,c=Jt();if(Fe){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),ut===null)throw Error(o(349));(Pe&127)!==0||ap(s,t,l)}c.memoizedState=l;var d={value:l,getSnapshot:t};return c.queue=d,yp(rp.bind(null,s,d,e),[e]),s.flags|=2048,Fl(9,{destroy:void 0},lp.bind(null,s,d,l,t),null),l},useId:function(){var e=Jt(),t=ut.identifierPrefix;if(Fe){var l=Yn,s=qn;l=(s&~(1<<32-bt(s)-1)).toString(32)+l,t="_"+t+"R_"+l,l=si++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=jy++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Tc,useFormState:mp,useActionState:mp,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=Rc.bind(null,Oe,!0,l),l.dispatch=t,[e,t]},useMemoCache:yc,useCacheRefresh:function(){return Jt().memoizedState=Ey.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)}}},Ac={readContext:Yt,use:oi,useCallback:Cp,useContext:Yt,useEffect:wc,useImperativeHandle:wp,useInsertionEffect:jp,useLayoutEffect:Sp,useMemo:Np,useReducer:ci,useRef:gp,useState:function(){return ci(ia)},useDebugValue:Cc,useDeferredValue:function(e,t){var l=Tt();return Ep(l,rt.memoizedState,e,t)},useTransition:function(){var e=ci(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:np,useId:Mp,useHostTransitionStatus:Tc,useFormState:hp,useActionState:hp,useOptimistic:function(e,t){var l=Tt();return op(l,rt,e,t)},useMemoCache:yc,useCacheRefresh:Dp};Ac.useEffectEvent=bp;var Bp={readContext:Yt,use:oi,useCallback:Cp,useContext:Yt,useEffect:wc,useImperativeHandle:wp,useInsertionEffect:jp,useLayoutEffect:Sp,useMemo:Np,useReducer:jc,useRef:gp,useState:function(){return jc(ia)},useDebugValue:Cc,useDeferredValue:function(e,t){var l=Tt();return rt===null?Nc(l,e,t):Ep(l,rt.memoizedState,e,t)},useTransition:function(){var e=jc(ia)[0],t=Tt().memoizedState;return[typeof e=="boolean"?e:Gr(e),t]},useSyncExternalStore:np,useId:Mp,useHostTransitionStatus:Tc,useFormState:vp,useActionState:vp,useOptimistic:function(e,t){var l=Tt();return rt!==null?op(l,rt,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:yc,useCacheRefresh:Dp};Bp.useEffectEvent=bp;function Mc(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 Dc={enqueueSetState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var s=gn(),c=Ea(s);c.tag=1,c.payload=t,l!=null&&(c.callback=l),t=Ta(e,c,s),t!==null&&(dn(t,e,s),Hr(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=gn(),s=Ea(l);s.tag=2,t!=null&&(s.callback=t),t=Ta(e,s,l),t!==null&&(dn(t,e,l),Hr(t,e,l))}};function Up(e,t,l,s,c,d,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,d,b):t.prototype&&t.prototype.isPureReactComponent?!Mr(l,s)||!Mr(c,d):!0}function Hp(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&&Dc.enqueueReplaceState(t,t.state,null)}function pl(e,t){var l=t;if("ref"in t){l={};for(var s in t)s!=="ref"&&(l[s]=t[s])}if(e=e.defaultProps){l===t&&(l=g({},l));for(var c in e)l[c]===void 0&&(l[c]=e[c])}return l}function Ip(e){qs(e)}function Vp(e){console.error(e)}function $p(e){qs(e)}function pi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Gp(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 zc(e,t,l){return l=Ea(l),l.tag=3,l.payload={element:null},l.callback=function(){pi(e,t)},l}function qp(e){return e=Ea(e),e.tag=3,e}function Yp(e,t,l,s){var c=l.type.getDerivedStateFromError;if(typeof c=="function"){var d=s.value;e.payload=function(){return c(d)},e.callback=function(){Gp(t,l,s)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Gp(t,l,s),typeof c!="function"&&(La===null?La=new Set([this]):La.add(this));var w=s.stack;this.componentDidCatch(s.value,{componentStack:w!==null?w:""})})}function Ry(e,t,l,s,c){if(l.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=l.alternate,t!==null&&Il(t,l,c,!0),l=mn.current,l!==null){switch(l.tag){case 31:case 13:return Dn===null?Ci():l.alternate===null&&wt===0&&(wt=3),l.flags&=-257,l.flags|=65536,l.lanes=c,s===ei?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([s]):t.add(s),lu(e,s,c)),!1;case 22:return l.flags|=65536,s===ei?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)),lu(e,s,c)),!1}throw Error(o(435,l.tag))}return lu(e,s,c),Ci(),!1}if(Fe)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==Zo&&(e=Error(o(422),{cause:s}),Lr(Tn(e,l)))):(s!==Zo&&(t=Error(o(423),{cause:s}),Lr(Tn(t,l))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Tn(s,l),c=zc(e.stateNode,s,c),cc(e,c),wt!==4&&(wt=2)),!1;var d=Error(o(520),{cause:s});if(d=Tn(d,l),Jr===null?Jr=[d]:Jr.push(d),wt!==4&&(wt=2),t===null)return!0;s=Tn(s,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=c&-c,l.lanes|=e,e=zc(l.stateNode,s,e),cc(l,e),!1;case 1:if(t=l.type,d=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(La===null||!La.has(d))))return l.flags|=65536,c&=-c,l.lanes|=c,c=qp(c),Yp(c,e,l,s),cc(l,c),!1}l=l.return}while(l!==null);return!1}var Lc=Error(o(461)),Dt=!1;function Pt(e,t,l,s){t.child=e===null?Wf(t,null,l,s):dl(t,e.child,l,s)}function Pp(e,t,l,s,c){l=l.render;var d=t.ref;if("ref"in s){var b={};for(var w in s)w!=="ref"&&(b[w]=s[w])}else b=s;return il(t),s=hc(e,t,l,b,d,c),w=xc(),e!==null&&!Dt?(vc(e,t,c),oa(e,t,c)):(Fe&&w&&Qo(t),t.flags|=1,Pt(e,t,s,c),t.child)}function Kp(e,t,l,s,c){if(e===null){var d=l.type;return typeof d=="function"&&!Ko(d)&&d.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=d,Fp(e,t,d,s,c)):(e=Fs(l.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!$c(e,c)){var b=d.memoizedProps;if(l=l.compare,l=l!==null?l:Mr,l(b,s)&&e.ref===t.ref)return oa(e,t,c)}return t.flags|=1,e=na(d,s),e.ref=t.ref,e.return=t,t.child=e}function Fp(e,t,l,s,c){if(e!==null){var d=e.memoizedProps;if(Mr(d,s)&&e.ref===t.ref)if(Dt=!1,t.pendingProps=s=d,$c(e,c))(e.flags&131072)!==0&&(Dt=!0);else return t.lanes=e.lanes,oa(e,t,c)}return _c(e,t,l,s,c)}function Wp(e,t,l,s){var c=s.children,d=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(d=d!==null?d.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&~d}else s=0,t.child=null;return Qp(e,t,d,l,s)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Zs(t,d!==null?d.cachePool:null),d!==null?Zf(t,d):dc(),Jf(t);else return s=t.lanes=536870912,Qp(e,t,d!==null?d.baseLanes|l:l,l,s)}else d!==null?(Zs(t,d.cachePool),Zf(t,d),Aa(),t.memoizedState=null):(e!==null&&Zs(t,null),dc(),Aa());return Pt(e,t,c,l),t.child}function Pr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Qp(e,t,l,s,c){var d=rc();return d=d===null?null:{parent:At._currentValue,pool:d},t.memoizedState={baseLanes:l,cachePool:d},e!==null&&Zs(t,null),dc(),Jf(t),e!==null&&Il(e,t,s,!0),t.childLanes=c,null}function mi(e,t){return t=xi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Xp(e,t,l){return dl(t,e.child,null,l),e=mi(t,t.pendingProps),e.flags|=2,hn(t),t.memoizedState=null,e}function Ay(e,t,l){var s=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Fe){if(s.mode==="hidden")return e=mi(t,s),t.lanes=536870912,Pr(null,e);if(pc(t),(e=ft)?(e=ch(e,Mn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:qn,overflow:Yn}:null,retryLane:536870912,hydrationErrors:null},l=Lf(e),l.return=t,t.child=l,qt=t,ft=null)):e=null,e===null)throw wa(t);return t.lanes=536870912,null}return mi(t,s)}var d=e.memoizedState;if(d!==null){var b=d.dehydrated;if(pc(t),c)if(t.flags&256)t.flags&=-257,t=Xp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Dt||Il(e,t,l,!1),c=(l&e.childLanes)!==0,Dt||c){if(s=ut,s!==null&&(b=Id(s,l),b!==0&&b!==d.retryLane))throw d.retryLane=b,al(e,b),dn(s,e,b),Lc;Ci(),t=Xp(e,t,l)}else e=d.treeContext,ft=zn(b.nextSibling),qt=t,Fe=!0,ka=null,Mn=!1,e!==null&&Bf(t,e),t=mi(t,s),t.flags|=4096;return t}return e=na(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hi(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 _c(e,t,l,s,c){return il(t),l=hc(e,t,l,s,void 0,c),s=xc(),e!==null&&!Dt?(vc(e,t,c),oa(e,t,c)):(Fe&&s&&Qo(t),t.flags|=1,Pt(e,t,l,c),t.child)}function Zp(e,t,l,s,c,d){return il(t),t.updateQueue=null,l=tp(t,s,l,c),ep(e),s=xc(),e!==null&&!Dt?(vc(e,t,d),oa(e,t,d)):(Fe&&s&&Qo(t),t.flags|=1,Pt(e,t,l,d),t.child)}function Jp(e,t,l,s,c){if(il(t),t.stateNode===null){var d=Ol,b=l.contextType;typeof b=="object"&&b!==null&&(d=Yt(b)),d=new l(s,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Dc,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=s,d.state=t.memoizedState,d.refs={},ic(t),b=l.contextType,d.context=typeof b=="object"&&b!==null?Yt(b):Ol,d.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(Mc(t,l,b,s),d.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(b=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),b!==d.state&&Dc.enqueueReplaceState(d,d.state,null),Vr(t,s,d,c),Ir(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){d=t.stateNode;var w=t.memoizedProps,U=pl(l,w);d.props=U;var F=d.context,ee=l.contextType;b=Ol,typeof ee=="object"&&ee!==null&&(b=Yt(ee));var re=l.getDerivedStateFromProps;ee=typeof re=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,ee||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||F!==b)&&Hp(t,d,s,b),Na=!1;var Q=t.memoizedState;d.state=Q,Vr(t,s,d,c),Ir(),F=t.memoizedState,w||Q!==F||Na?(typeof re=="function"&&(Mc(t,l,re,s),F=t.memoizedState),(U=Na||Up(t,l,U,s,Q,F,b))?(ee||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=F),d.props=s,d.state=F,d.context=b,s=U):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{d=t.stateNode,oc(e,t),b=t.memoizedProps,ee=pl(l,b),d.props=ee,re=t.pendingProps,Q=d.context,F=l.contextType,U=Ol,typeof F=="object"&&F!==null&&(U=Yt(F)),w=l.getDerivedStateFromProps,(F=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b!==re||Q!==U)&&Hp(t,d,s,U),Na=!1,Q=t.memoizedState,d.state=Q,Vr(t,s,d,c),Ir();var Z=t.memoizedState;b!==re||Q!==Z||Na||e!==null&&e.dependencies!==null&&Qs(e.dependencies)?(typeof w=="function"&&(Mc(t,l,w,s),Z=t.memoizedState),(ee=Na||Up(t,l,ee,s,Q,Z,U)||e!==null&&e.dependencies!==null&&Qs(e.dependencies))?(F||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(s,Z,U),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(s,Z,U)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=Z),d.props=s,d.state=Z,d.context=U,s=ee):(typeof d.componentDidUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&Q===e.memoizedState||(t.flags|=1024),s=!1)}return d=s,hi(e,t),s=(t.flags&128)!==0,d||s?(d=t.stateNode,l=s&&typeof l.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&s?(t.child=dl(t,e.child,null,c),t.child=dl(t,null,l,c)):Pt(e,t,l,c),t.memoizedState=d.state,e=t.child):e=oa(e,t,c),e}function em(e,t,l,s){return rl(),t.flags|=256,Pt(e,t,l,s),t.child}var Oc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bc(e){return{baseLanes:e,cachePool:Gf()}}function Uc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=vn),e}function tm(e,t,l){var s=t.pendingProps,c=!1,d=(t.flags&128)!==0,b;if((b=d)||(b=e!==null&&e.memoizedState===null?!1:(Et.current&2)!==0),b&&(c=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Fe){if(c?Ra(t):Aa(),(e=ft)?(e=ch(e,Mn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:qn,overflow:Yn}:null,retryLane:536870912,hydrationErrors:null},l=Lf(e),l.return=t,t.child=l,qt=t,ft=null)):e=null,e===null)throw wa(t);return bu(e)?t.lanes=32:t.lanes=536870912,null}var w=s.children;return s=s.fallback,c?(Aa(),c=t.mode,w=xi({mode:"hidden",children:w},c),s=ll(s,c,l,null),w.return=t,s.return=t,w.sibling=s,t.child=w,s=t.child,s.memoizedState=Bc(l),s.childLanes=Uc(e,b,l),t.memoizedState=Oc,Pr(null,s)):(Ra(t),Hc(t,w))}var U=e.memoizedState;if(U!==null&&(w=U.dehydrated,w!==null)){if(d)t.flags&256?(Ra(t),t.flags&=-257,t=Ic(e,t,l)):t.memoizedState!==null?(Aa(),t.child=e.child,t.flags|=128,t=null):(Aa(),w=s.fallback,c=t.mode,s=xi({mode:"visible",children:s.children},c),w=ll(w,c,l,null),w.flags|=2,s.return=t,w.return=t,s.sibling=w,t.child=s,dl(t,e.child,null,l),s=t.child,s.memoizedState=Bc(l),s.childLanes=Uc(e,b,l),t.memoizedState=Oc,t=Pr(null,s));else if(Ra(t),bu(w)){if(b=w.nextSibling&&w.nextSibling.dataset,b)var F=b.dgst;b=F,s=Error(o(419)),s.stack="",s.digest=b,Lr({value:s,source:null,stack:null}),t=Ic(e,t,l)}else if(Dt||Il(e,t,l,!1),b=(l&e.childLanes)!==0,Dt||b){if(b=ut,b!==null&&(s=Id(b,l),s!==0&&s!==U.retryLane))throw U.retryLane=s,al(e,s),dn(b,e,s),Lc;yu(w)||Ci(),t=Ic(e,t,l)}else yu(w)?(t.flags|=192,t.child=e.child,t=null):(e=U.treeContext,ft=zn(w.nextSibling),qt=t,Fe=!0,ka=null,Mn=!1,e!==null&&Bf(t,e),t=Hc(t,s.children),t.flags|=4096);return t}return c?(Aa(),w=s.fallback,c=t.mode,U=e.child,F=U.sibling,s=na(U,{mode:"hidden",children:s.children}),s.subtreeFlags=U.subtreeFlags&65011712,F!==null?w=na(F,w):(w=ll(w,c,l,null),w.flags|=2),w.return=t,s.return=t,s.sibling=w,t.child=s,Pr(null,s),s=t.child,w=e.child.memoizedState,w===null?w=Bc(l):(c=w.cachePool,c!==null?(U=At._currentValue,c=c.parent!==U?{parent:U,pool:U}:c):c=Gf(),w={baseLanes:w.baseLanes|l,cachePool:c}),s.memoizedState=w,s.childLanes=Uc(e,b,l),t.memoizedState=Oc,Pr(e.child,s)):(Ra(t),l=e.child,e=l.sibling,l=na(l,{mode:"visible",children:s.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function Hc(e,t){return t=xi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function xi(e,t){return e=pn(22,e,null,t),e.lanes=0,e}function Ic(e,t,l){return dl(t,e.child,null,l),e=Hc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function nm(e,t,l){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),tc(e.return,t,l)}function Vc(e,t,l,s,c,d){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:l,tailMode:c,treeForkCount:d}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=s,b.tail=l,b.tailMode=c,b.treeForkCount=d)}function am(e,t,l){var s=t.pendingProps,c=s.revealOrder,d=s.tail;s=s.children;var b=Et.current,w=(b&2)!==0;if(w?(b=b&1|2,t.flags|=128):b&=1,ie(Et,b),Pt(e,t,s,l),s=Fe?zr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nm(e,l,t);else if(e.tag===19)nm(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&&li(e)===null&&(c=l),l=l.sibling;l=c,l===null?(c=t.child,t.child=null):(c=l.sibling,l.sibling=null),Vc(t,!1,c,l,d,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&&li(e)===null){t.child=c;break}e=c.sibling,c.sibling=l,l=c,c=e}Vc(t,!0,l,null,d,s);break;case"together":Vc(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function oa(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),za|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(Il(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=na(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=na(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function $c(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Qs(e)))}function My(e,t,l){switch(t.tag){case 3:ae(t,t.stateNode.containerInfo),Ca(t,At,e.memoizedState.cache),rl();break;case 27:case 5:Ie(t);break;case 4:ae(t,t.stateNode.containerInfo);break;case 10:Ca(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,pc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Ra(t),t.flags|=128,null):(l&t.child.childLanes)!==0?tm(e,t,l):(Ra(t),e=oa(e,t,l),e!==null?e.sibling:null);Ra(t);break;case 19:var c=(e.flags&128)!==0;if(s=(l&t.childLanes)!==0,s||(Il(e,t,l,!1),s=(l&t.childLanes)!==0),c){if(s)return am(e,t,l);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),ie(Et,Et.current),s)break;return null;case 22:return t.lanes=0,Wp(e,t,l,t.pendingProps);case 24:Ca(t,At,e.memoizedState.cache)}return oa(e,t,l)}function lm(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Dt=!0;else{if(!$c(e,l)&&(t.flags&128)===0)return Dt=!1,My(e,t,l);Dt=(e.flags&131072)!==0}else Dt=!1,Fe&&(t.flags&1048576)!==0&&Of(t,zr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=cl(t.elementType),t.type=e,typeof e=="function")Ko(e)?(s=pl(e,s),t.tag=1,t=Jp(null,t,e,s,l)):(t.tag=0,t=_c(null,t,e,s,l));else{if(e!=null){var c=e.$$typeof;if(c===I){t.tag=11,t=Pp(null,t,e,s,l);break e}else if(c===N){t.tag=14,t=Kp(null,t,e,s,l);break e}}throw t=X(e)||e,Error(o(306,t,""))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,l);case 1:return s=t.type,c=pl(s,t.pendingProps),Jp(e,t,s,c,l);case 3:e:{if(ae(t,t.stateNode.containerInfo),e===null)throw Error(o(387));s=t.pendingProps;var d=t.memoizedState;c=d.element,oc(e,t),Vr(t,s,null,l);var b=t.memoizedState;if(s=b.cache,Ca(t,At,s),s!==d.cache&&nc(t,[At],l,!0),Ir(),s=b.element,d.isDehydrated)if(d={element:s,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=em(e,t,s,l);break e}else if(s!==c){c=Tn(Error(o(424)),t),Lr(c),t=em(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,Fe=!0,ka=null,Mn=!0,l=Wf(t,null,s,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(rl(),s===c){t=oa(e,t,l);break e}Pt(e,t,s,l)}t=t.child}return t;case 26:return hi(e,t),e===null?(l=hh(t.type,null,t.pendingProps,null))?t.memoizedState=l:Fe||(l=t.type,e=t.pendingProps,s=Di(xe.current).createElement(l),s[Gt]=t,s[ln]=e,Kt(s,l,e),Ht(s),t.stateNode=s):t.memoizedState=hh(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ie(t),e===null&&Fe&&(s=t.stateNode=fh(t.type,t.pendingProps,xe.current),qt=t,Mn=!0,c=ft,Ua(t.type)?(ju=c,ft=zn(s.firstChild)):ft=c),Pt(e,t,t.pendingProps.children,l),hi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Fe&&((c=s=ft)&&(s=i1(s,t.type,t.pendingProps,Mn),s!==null?(t.stateNode=s,qt=t,ft=zn(s.firstChild),Mn=!1,c=!0):c=!1),c||wa(t)),Ie(t),c=t.type,d=t.pendingProps,b=e!==null?e.memoizedProps:null,s=d.children,xu(c,d)?s=null:b!==null&&xu(c,b)&&(t.flags|=32),t.memoizedState!==null&&(c=hc(e,t,Sy,null,null,l),is._currentValue=c),hi(e,t),Pt(e,t,s,l),t.child;case 6:return e===null&&Fe&&((e=l=ft)&&(l=o1(l,t.pendingProps,Mn),l!==null?(t.stateNode=l,qt=t,ft=null,e=!0):e=!1),e||wa(t)),null;case 13:return tm(e,t,l);case 4:return ae(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=dl(t,null,s,l):Pt(e,t,s,l),t.child;case 11:return Pp(e,t,t.type,t.pendingProps,l);case 7:return Pt(e,t,t.pendingProps,l),t.child;case 8:return Pt(e,t,t.pendingProps.children,l),t.child;case 12:return Pt(e,t,t.pendingProps.children,l),t.child;case 10:return s=t.pendingProps,Ca(t,t.type,s.value),Pt(e,t,s.children,l),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,il(t),c=Yt(c),s=s(c),t.flags|=1,Pt(e,t,s,l),t.child;case 14:return Kp(e,t,t.type,t.pendingProps,l);case 15:return Fp(e,t,t.type,t.pendingProps,l);case 19:return am(e,t,l);case 31:return Ay(e,t,l);case 22:return Wp(e,t,l,t.pendingProps);case 24:return il(t),s=Yt(At),e===null?(c=rc(),c===null&&(c=ut,d=ac(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=l),c=d),t.memoizedState={parent:s,cache:c},ic(t),Ca(t,At,c)):((e.lanes&l)!==0&&(oc(e,t),Vr(t,null,null,l),Ir()),c=e.memoizedState,d=t.memoizedState,c.parent!==s?(c={parent:s,cache:s},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),Ca(t,At,s)):(s=d.cache,Ca(t,At,s),s!==c.cache&&nc(t,[At],l,!0))),Pt(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ca(e){e.flags|=4}function Gc(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(Mm())e.flags|=8192;else throw ul=ei,sc}else e.flags&=-16777217}function rm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!bh(t))if(Mm())e.flags|=8192;else throw ul=ei,sc}function vi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Bd():536870912,e.lanes|=t,Zl|=t)}function Kr(e,t){if(!Fe)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 Dy(e,t,l){var s=t.pendingProps;switch(Xo(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),ra(At),ve(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Hl(t)?ca(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Jo())),pt(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(ca(t),d!==null?(pt(t),rm(t,d)):(pt(t),Gc(t,c,null,s,l))):d?d!==e.memoizedState?(ca(t),pt(t),rm(t,d)):(pt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&ca(t),pt(t),Gc(t,c,e,s,l)),null;case 27:if(Be(t),l=xe.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}e=de.current,Hl(t)?Uf(t):(e=fh(c,s,l),t.stateNode=e,ca(t))}return pt(t),null;case 5:if(Be(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(!s){if(t.stateNode===null)throw Error(o(166));return pt(t),null}if(d=de.current,Hl(t))Uf(t);else{var b=Di(xe.current);switch(d){case 1:d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=b.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=b.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=b.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof s.is=="string"?b.createElement("select",{is:s.is}):b.createElement("select"),s.multiple?d.multiple=!0:s.size&&(d.size=s.size);break;default:d=typeof s.is=="string"?b.createElement(c,{is:s.is}):b.createElement(c)}}d[Gt]=t,d[ln]=s;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)d.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=d;e:switch(Kt(d,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&&ca(t)}}return pt(t),Gc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&ca(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Hl(t)){if(e=t.stateNode,l=t.memoizedProps,s=null,c=qt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===l||s!==null&&s.suppressHydrationWarning===!0||th(e.nodeValue,l)),e||wa(t,!0)}else e=Di(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=Hl(t),l!==null){if(e===null){if(!s)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),e=!1}else l=Jo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(hn(t),t):(hn(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=Hl(t),s!==null&&s.dehydrated!==null){if(e===null){if(!c)throw Error(o(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(o(317));c[Gt]=t}else rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;pt(t),c=!1}else c=Jo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(hn(t),t):(hn(t),null)}return hn(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),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),vi(t,t.updateQueue),pt(t),null);case 4:return ve(),e===null&&du(t.stateNode.containerInfo),pt(t),null;case 10:return ra(t.type),pt(t),null;case 19:if(W(Et),s=t.memoizedState,s===null)return pt(t),null;if(c=(t.flags&128)!==0,d=s.rendering,d===null)if(c)Kr(s,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=li(e),d!==null){for(t.flags|=128,Kr(s,!1),e=d.updateQueue,t.updateQueue=e,vi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)zf(l,e),l=l.sibling;return ie(Et,Et.current&1|2),Fe&&aa(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>Si&&(t.flags|=128,c=!0,Kr(s,!1),t.lanes=4194304)}else{if(!c)if(e=li(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,vi(t,e),Kr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!d.alternate&&!Fe)return pt(t),null}else 2*tt()-s.renderingStartTime>Si&&l!==536870912&&(t.flags|=128,c=!0,Kr(s,!1),t.lanes=4194304);s.isBackwards?(d.sibling=t.child,t.child=d):(e=s.last,e!==null?e.sibling=d:t.child=d,s.last=d)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,l=Et.current,ie(Et,c?l&1|2:l&1),Fe&&aa(t,s.treeForkCount),e):(pt(t),null);case 22:case 23:return hn(t),fc(),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&&vi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==l&&(t.flags|=2048),e!==null&&W(ol),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),ra(At),pt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function zy(e,t){switch(Xo(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ra(At),ve(),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(hn(t),t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(hn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(Et),null;case 4:return ve(),null;case 10:return ra(t.type),null;case 22:case 23:return hn(t),fc(),e!==null&&W(ol),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ra(At),null;case 25:return null;default:return null}}function sm(e,t){switch(Xo(t),t.tag){case 3:ra(At),ve();break;case 26:case 27:case 5:Be(t);break;case 4:ve();break;case 31:t.memoizedState!==null&&hn(t);break;case 13:hn(t);break;case 19:W(Et);break;case 10:ra(t.type);break;case 22:case 23:hn(t),fc(),e!==null&&W(ol);break;case 24:ra(At)}}function Fr(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 d=l.create,b=l.inst;s=d(),b.destroy=s}l=l.next}while(l!==c)}}catch(w){lt(t,t.return,w)}}function Ma(e,t,l){try{var s=t.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var d=c.next;s=d;do{if((s.tag&e)===e){var b=s.inst,w=b.destroy;if(w!==void 0){b.destroy=void 0,c=t;var U=l,F=w;try{F()}catch(ee){lt(c,U,ee)}}}s=s.next}while(s!==d)}}catch(ee){lt(t,t.return,ee)}}function im(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Xf(t,l)}catch(s){lt(e,e.return,s)}}}function om(e,t,l){l.props=pl(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 Pn(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 cm(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 qc(e,t,l){try{var s=e.stateNode;t1(s,e.type,l,t),s[ln]=t}catch(c){lt(e,e.return,c)}}function um(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ua(e.type)||e.tag===4}function Yc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||um(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&&Ua(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 Pc(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=ea));else if(s!==4&&(s===27&&Ua(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Pc(e,t,l),e=e.sibling;e!==null;)Pc(e,t,l),e=e.sibling}function gi(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&&Ua(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(gi(e,t,l),e=e.sibling;e!==null;)gi(e,t,l),e=e.sibling}function dm(e){var t=e.stateNode,l=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Kt(t,s,l),t[Gt]=e,t[ln]=l}catch(d){lt(e,e.return,d)}}var ua=!1,zt=!1,Kc=!1,fm=typeof WeakSet=="function"?WeakSet:Set,It=null;function Ly(e,t){if(e=e.containerInfo,mu=Hi,e=wf(e),Io(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,d=s.focusNode;s=s.focusOffset;try{l.nodeType,d.nodeType}catch{l=null;break e}var b=0,w=-1,U=-1,F=0,ee=0,re=e,Q=null;t:for(;;){for(var Z;re!==l||c!==0&&re.nodeType!==3||(w=b+c),re!==d||s!==0&&re.nodeType!==3||(U=b+s),re.nodeType===3&&(b+=re.nodeValue.length),(Z=re.firstChild)!==null;)Q=re,re=Z;for(;;){if(re===e)break t;if(Q===l&&++F===c&&(w=b),Q===d&&++ee===s&&(U=b),(Z=re.nextSibling)!==null)break;re=Q,Q=re.parentNode}re=Z}l=w===-1||U===-1?null:{start:w,end:U}}else l=null}l=l||{start:0,end:0}}else l=null;for(hu={focusedElem:e,selectionRange:l},Hi=!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,d=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&&d!==null){e=void 0,l=t,c=d.memoizedProps,d=d.memoizedState,s=l.stateNode;try{var Se=pl(l.type,c);e=s.getSnapshotBeforeUpdate(Se,d),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)gu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":gu(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 pm(e,t,l){var s=l.flags;switch(l.tag){case 0:case 11:case 15:fa(e,l),s&4&&Fr(5,l);break;case 1:if(fa(e,l),s&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){lt(l,l.return,b)}else{var c=pl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){lt(l,l.return,b)}}s&64&&im(l),s&512&&Wr(l,l.return);break;case 3:if(fa(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{Xf(e,t)}catch(b){lt(l,l.return,b)}}break;case 27:t===null&&s&4&&dm(l);case 26:case 5:fa(e,l),t===null&&s&4&&cm(l),s&512&&Wr(l,l.return);break;case 12:fa(e,l);break;case 31:fa(e,l),s&4&&xm(e,l);break;case 13:fa(e,l),s&4&&vm(e,l),s&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Gy.bind(null,l),c1(e,l))));break;case 22:if(s=l.memoizedState!==null||ua,!s){t=t!==null&&t.memoizedState!==null||zt,c=ua;var d=zt;ua=s,(zt=t)&&!d?pa(e,l,(l.subtreeFlags&8772)!==0):fa(e,l),ua=c,zt=d}break;case 30:break;default:fa(e,l)}}function mm(e){var t=e.alternate;t!==null&&(e.alternate=null,mm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ko(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,sn=!1;function da(e,t,l){for(l=l.child;l!==null;)hm(e,t,l),l=l.sibling}function hm(e,t,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Xn,l)}catch{}switch(l.tag){case 26:zt||Pn(l,t),da(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:zt||Pn(l,t);var s=vt,c=sn;Ua(l.type)&&(vt=l.stateNode,sn=!1),da(e,t,l),ls(l.stateNode),vt=s,sn=c;break;case 5:zt||Pn(l,t);case 6:if(s=vt,c=sn,vt=null,da(e,t,l),vt=s,sn=c,vt!==null)if(sn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(l.stateNode)}catch(d){lt(l,t,d)}else try{vt.removeChild(l.stateNode)}catch(d){lt(l,t,d)}break;case 18:vt!==null&&(sn?(e=vt,ih(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),sr(e)):ih(vt,l.stateNode));break;case 4:s=vt,c=sn,vt=l.stateNode.containerInfo,sn=!0,da(e,t,l),vt=s,sn=c;break;case 0:case 11:case 14:case 15:Ma(2,l,t),zt||Ma(4,l,t),da(e,t,l);break;case 1:zt||(Pn(l,t),s=l.stateNode,typeof s.componentWillUnmount=="function"&&om(l,t,s)),da(e,t,l);break;case 21:da(e,t,l);break;case 22:zt=(s=zt)||l.memoizedState!==null,da(e,t,l),zt=s;break;default:da(e,t,l)}}function xm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{sr(e)}catch(l){lt(t,t.return,l)}}}function vm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{sr(e)}catch(l){lt(t,t.return,l)}}function _y(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new fm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new fm),t;default:throw Error(o(435,e.tag))}}function yi(e,t){var l=_y(e);t.forEach(function(s){if(!l.has(s)){l.add(s);var c=qy.bind(null,e,s);s.then(c,c)}})}function on(e,t){var l=t.deletions;if(l!==null)for(var s=0;s<l.length;s++){var c=l[s],d=e,b=t,w=b;e:for(;w!==null;){switch(w.tag){case 27:if(Ua(w.type)){vt=w.stateNode,sn=!1;break e}break;case 5:vt=w.stateNode,sn=!1;break e;case 3:case 4:vt=w.stateNode.containerInfo,sn=!0;break e}w=w.return}if(vt===null)throw Error(o(160));hm(d,b,c),vt=null,sn=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)gm(t,e),t=t.sibling}var In=null;function gm(e,t){var l=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),cn(e),s&4&&(Ma(3,e,e.return),Fr(3,e),Ma(5,e,e.return));break;case 1:on(t,e),cn(e),s&512&&(zt||l===null||Pn(l,l.return)),s&64&&ua&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:var c=In;if(on(t,e),cn(e),s&512&&(zt||l===null||Pn(l,l.return)),s&4){var d=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":d=c.getElementsByTagName("title")[0],(!d||d[Sr]||d[Gt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(s),c.head.insertBefore(d,c.querySelector("head > title"))),Kt(d,s,l),d[Gt]=e,Ht(d),s=d;break e;case"link":var b=gh("link","href",c).get(s+(l.href||""));if(b){for(var w=0;w<b.length;w++)if(d=b[w],d.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&d.getAttribute("rel")===(l.rel==null?null:l.rel)&&d.getAttribute("title")===(l.title==null?null:l.title)&&d.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(w,1);break t}}d=c.createElement(s),Kt(d,s,l),c.head.appendChild(d);break;case"meta":if(b=gh("meta","content",c).get(s+(l.content||""))){for(w=0;w<b.length;w++)if(d=b[w],d.getAttribute("content")===(l.content==null?null:""+l.content)&&d.getAttribute("name")===(l.name==null?null:l.name)&&d.getAttribute("property")===(l.property==null?null:l.property)&&d.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&d.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(w,1);break t}}d=c.createElement(s),Kt(d,s,l),c.head.appendChild(d);break;default:throw Error(o(468,s))}d[Gt]=e,Ht(d),s=d}e.stateNode=s}else yh(c,e.type,e.stateNode);else e.stateNode=vh(c,s,e.memoizedProps);else d!==s?(d===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):d.count--,s===null?yh(c,e.type,e.stateNode):vh(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&qc(e,e.memoizedProps,l.memoizedProps)}break;case 27:on(t,e),cn(e),s&512&&(zt||l===null||Pn(l,l.return)),l!==null&&s&4&&qc(e,e.memoizedProps,l.memoizedProps);break;case 5:if(on(t,e),cn(e),s&512&&(zt||l===null||Pn(l,l.return)),e.flags&32){c=e.stateNode;try{Rl(c,"")}catch(Se){lt(e,e.return,Se)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,qc(e,c,l!==null?l.memoizedProps:c)),s&1024&&(Kc=!0);break;case 6:if(on(t,e),cn(e),s&4){if(e.stateNode===null)throw Error(o(162));s=e.memoizedProps,l=e.stateNode;try{l.nodeValue=s}catch(Se){lt(e,e.return,Se)}}break;case 3:if(_i=null,c=In,In=zi(t.containerInfo),on(t,e),In=c,cn(e),s&4&&l!==null&&l.memoizedState.isDehydrated)try{sr(t.containerInfo)}catch(Se){lt(e,e.return,Se)}Kc&&(Kc=!1,ym(e));break;case 4:s=In,In=zi(e.stateNode.containerInfo),on(t,e),cn(e),In=s;break;case 12:on(t,e),cn(e);break;case 31:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yi(e,s)));break;case 13:on(t,e),cn(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ji=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yi(e,s)));break;case 22:c=e.memoizedState!==null;var U=l!==null&&l.memoizedState!==null,F=ua,ee=zt;if(ua=F||c,zt=ee||U,on(t,e),zt=ee,ua=F,cn(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(l===null||U||ua||zt||ml(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){U=l=t;try{if(d=U.stateNode,c)b=d.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{w=U.stateNode;var re=U.memoizedProps.style,Q=re!=null&&re.hasOwnProperty("display")?re.display:null;w.style.display=Q==null||typeof Q=="boolean"?"":(""+Q).trim()}}catch(Se){lt(U,U.return,Se)}}}else if(t.tag===6){if(l===null){U=t;try{U.stateNode.nodeValue=c?"":U.memoizedProps}catch(Se){lt(U,U.return,Se)}}}else if(t.tag===18){if(l===null){U=t;try{var Z=U.stateNode;c?oh(Z,!0):oh(U.stateNode,!1)}catch(Se){lt(U,U.return,Se)}}}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,yi(e,l))));break;case 19:on(t,e),cn(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,yi(e,s)));break;case 30:break;case 21:break;default:on(t,e),cn(e)}}function cn(e){var t=e.flags;if(t&2){try{for(var l,s=e.return;s!==null;){if(um(s)){l=s;break}s=s.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var c=l.stateNode,d=Yc(e);gi(e,d,c);break;case 5:var b=l.stateNode;l.flags&32&&(Rl(b,""),l.flags&=-33);var w=Yc(e);gi(e,w,b);break;case 3:case 4:var U=l.stateNode.containerInfo,F=Yc(e);Pc(e,F,U);break;default:throw Error(o(161))}}catch(ee){lt(e,e.return,ee)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ym(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ym(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function fa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)pm(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ma(4,t,t.return),ml(t);break;case 1:Pn(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&om(t,t.return,l),ml(t);break;case 27:ls(t.stateNode);case 26:case 5:Pn(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function pa(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,d=t,b=d.flags;switch(d.tag){case 0:case 11:case 15:pa(c,d,l),Fr(4,d);break;case 1:if(pa(c,d,l),s=d,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(F){lt(s,s.return,F)}if(s=d,c=s.updateQueue,c!==null){var w=s.stateNode;try{var U=c.shared.hiddenCallbacks;if(U!==null)for(c.shared.hiddenCallbacks=null,c=0;c<U.length;c++)Qf(U[c],w)}catch(F){lt(s,s.return,F)}}l&&b&64&&im(d),Wr(d,d.return);break;case 27:dm(d);case 26:case 5:pa(c,d,l),l&&s===null&&b&4&&cm(d),Wr(d,d.return);break;case 12:pa(c,d,l);break;case 31:pa(c,d,l),l&&b&4&&xm(c,d);break;case 13:pa(c,d,l),l&&b&4&&vm(c,d);break;case 22:d.memoizedState===null&&pa(c,d,l),Wr(d,d.return);break;case 30:break;default:pa(c,d,l)}t=t.sibling}}function Fc(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&&_r(l))}function Wc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&_r(e))}function Vn(e,t,l,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)bm(e,t,l,s),t=t.sibling}function bm(e,t,l,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Vn(e,t,l,s),c&2048&&Fr(9,t);break;case 1:Vn(e,t,l,s);break;case 3:Vn(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&&_r(e)));break;case 12:if(c&2048){Vn(e,t,l,s),e=t.stateNode;try{var d=t.memoizedProps,b=d.id,w=d.onPostCommit;typeof w=="function"&&w(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){lt(t,t.return,U)}}else Vn(e,t,l,s);break;case 31:Vn(e,t,l,s);break;case 13:Vn(e,t,l,s);break;case 23:break;case 22:d=t.stateNode,b=t.alternate,t.memoizedState!==null?d._visibility&2?Vn(e,t,l,s):Qr(e,t):d._visibility&2?Vn(e,t,l,s):(d._visibility|=2,Wl(e,t,l,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Fc(b,t);break;case 24:Vn(e,t,l,s),c&2048&&Wc(t.alternate,t);break;default:Vn(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 d=e,b=t,w=l,U=s,F=b.flags;switch(b.tag){case 0:case 11:case 15:Wl(d,b,w,U,c),Fr(8,b);break;case 23:break;case 22:var ee=b.stateNode;b.memoizedState!==null?ee._visibility&2?Wl(d,b,w,U,c):Qr(d,b):(ee._visibility|=2,Wl(d,b,w,U,c)),c&&F&2048&&Fc(b.alternate,b);break;case 24:Wl(d,b,w,U,c),c&&F&2048&&Wc(b.alternate,b);break;default:Wl(d,b,w,U,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&&Fc(s.alternate,s);break;case 24:Qr(l,s),c&2048&&Wc(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;)jm(e,t,l),e=e.sibling}function jm(e,t,l){switch(e.tag){case 26:Ql(e,t,l),e.flags&Xr&&e.memoizedState!==null&&j1(l,In,e.memoizedState,e.memoizedProps);break;case 5:Ql(e,t,l);break;case 3:case 4:var s=In;In=zi(e.stateNode.containerInfo),Ql(e,t,l),In=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 Sm(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 Zr(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,wm(s,e)}Sm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)km(e),e=e.sibling}function km(e){switch(e.tag){case 0:case 11:case 15:Zr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:Zr(e);break;case 12:Zr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,bi(e)):Zr(e);break;default:Zr(e)}}function bi(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,wm(s,e)}Sm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ma(8,t,t.return),bi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,bi(t));break;default:bi(t)}e=e.sibling}}function wm(e,t){for(;It!==null;){var l=It;switch(l.tag){case 0:case 11:case 15:Ma(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var s=l.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:_r(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,d=s.return;if(mm(s),s===l){It=null;break e}if(c!==null){c.return=d,It=c;break e}It=d}}}var Oy={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}},By=typeof WeakMap=="function"?WeakMap:Map,Je=0,ut=null,qe=null,Pe=0,at=0,xn=null,Da=!1,Xl=!1,Qc=!1,ma=0,wt=0,za=0,hl=0,Xc=0,vn=0,Zl=0,Jr=null,un=null,Zc=!1,ji=0,Cm=0,Si=1/0,ki=null,La=null,_t=0,_a=null,Jl=null,ha=0,Jc=0,eu=null,Nm=null,es=0,tu=null;function gn(){return(Je&2)!==0&&Pe!==0?Pe&-Pe:A.T!==null?iu():Vd()}function Em(){if(vn===0)if((Pe&536870912)===0||Fe){var e=Ut;Ut<<=1,(Ut&3932160)===0&&(Ut=262144),vn=e}else vn=536870912;return e=mn.current,e!==null&&(e.flags|=32),vn}function dn(e,t,l){(e===ut&&(at===2||at===9)||e.cancelPendingCommit!==null)&&(er(e,0),Oa(e,Pe,vn,!1)),jr(e,l),((Je&2)===0||e!==ut)&&(e===ut&&((Je&2)===0&&(hl|=l),wt===4&&Oa(e,Pe,vn,!1)),Kn(e))}function Tm(e,t,l){if((Je&6)!==0)throw Error(o(327));var s=!l&&(t&127)===0&&(t&e.expiredLanes)===0||wn(e,t),c=s?Iy(e,t):au(e,t,!0),d=s;do{if(c===0){Xl&&!s&&Oa(e,t,0,!1);break}else{if(l=e.current.alternate,d&&!Uy(l)){c=au(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var w=e;c=Jr;var U=w.current.memoizedState.isDehydrated;if(U&&(er(w,b).flags|=256),b=au(w,b,!1),b!==2){if(Qc&&!U){w.errorRecoveryDisabledLanes|=d,hl|=d,c=4;break e}d=un,un=c,d!==null&&(un===null?un=d:un.push.apply(un,d))}c=b}if(d=!1,c!==2)continue}}if(c===1){er(e,0),Oa(e,t,0,!0);break}e:{switch(s=e,d=c,d){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Oa(s,t,vn,!Da);break e;case 2:un=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(c=ji+300-tt(),10<c)){if(Oa(s,t,vn,!Da),br(s,0,!0)!==0)break e;ha=t,s.timeoutHandle=rh(Rm.bind(null,s,l,un,ki,Zc,t,vn,hl,Zl,Da,d,"Throttled",-0,0),c);break e}Rm(s,l,un,ki,Zc,t,vn,hl,Zl,Da,d,null,-0,0)}}break}while(!0);Kn(e)}function Rm(e,t,l,s,c,d,b,w,U,F,ee,re,Q,Z){if(e.timeoutHandle=-1,re=t.subtreeFlags,re&8192||(re&16785408)===16785408){re={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ea},jm(t,d,re);var Se=(d&62914560)===d?ji-tt():(d&4194048)===d?Cm-tt():0;if(Se=S1(re,Se),Se!==null){ha=d,e.cancelPendingCommit=Se(Bm.bind(null,e,t,d,l,s,c,b,w,U,ee,re,null,Q,Z)),Oa(e,d,b,!F);return}}Bm(e,t,d,l,s,c,b,w,U)}function Uy(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],d=c.getSnapshot;c=c.value;try{if(!fn(d(),c))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Oa(e,t,l,s){t&=~Xc,t&=~hl,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var d=31-bt(c),b=1<<d;s[d]=-1,c&=~b}l!==0&&Ud(e,l,t)}function wi(){return(Je&6)===0?(ts(0),!1):!0}function nu(){if(qe!==null){if(at===0)var e=qe.return;else e=qe,la=sl=null,gc(e),ql=null,Br=0,e=qe;for(;e!==null;)sm(e.alternate,e),e=e.return;qe=null}}function er(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,l1(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),ha=0,nu(),ut=e,qe=l=na(e.current,null),Pe=t,at=0,xn=null,Da=!1,Xl=wn(e,t),Qc=!1,Zl=vn=Xc=hl=za=wt=0,un=Jr=null,Zc=!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),d=1<<c;t|=e[c],s&=~d}return ma=t,Ys(),l}function Am(e,t){Oe=null,A.H=Yr,t===Gl||t===Js?(t=Pf(),at=3):t===sc?(t=Pf(),at=4):at=t===Lc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,xn=t,qe===null&&(wt=1,pi(e,Tn(t,e.current)))}function Mm(){var e=mn.current;return e===null?!0:(Pe&4194048)===Pe?Dn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Dn:!1}function Dm(){var e=A.H;return A.H=Yr,e===null?Yr:e}function zm(){var e=A.A;return A.A=Oy,e}function Ci(){wt=4,Da||(Pe&4194048)!==Pe&&mn.current!==null||(Xl=!0),(za&134217727)===0&&(hl&134217727)===0||ut===null||Oa(ut,Pe,vn,!1)}function au(e,t,l){var s=Je;Je|=2;var c=Dm(),d=zm();(ut!==e||Pe!==t)&&(ki=null,er(e,t)),t=!1;var b=wt;e:do try{if(at!==0&&qe!==null){var w=qe,U=xn;switch(at){case 8:nu(),b=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var F=at;if(at=0,xn=null,tr(e,w,U,F),l&&Xl){b=0;break e}break;default:F=at,at=0,xn=null,tr(e,w,U,F)}}Hy(),b=wt;break}catch(ee){Am(e,ee)}while(!0);return t&&e.shellSuspendCounter++,la=sl=null,Je=s,A.H=c,A.A=d,qe===null&&(ut=null,Pe=0,Ys()),b}function Hy(){for(;qe!==null;)Lm(qe)}function Iy(e,t){var l=Je;Je|=2;var s=Dm(),c=zm();ut!==e||Pe!==t?(ki=null,Si=tt()+500,er(e,t)):Xl=wn(e,t);e:do try{if(at!==0&&qe!==null){t=qe;var d=xn;t:switch(at){case 1:at=0,xn=null,tr(e,t,d,1);break;case 2:case 9:if(qf(d)){at=0,xn=null,_m(t);break}t=function(){at!==2&&at!==9||ut!==e||(at=7),Kn(e)},d.then(t,t);break e;case 3:at=7;break e;case 4:at=5;break e;case 7:qf(d)?(at=0,xn=null,_m(t)):(at=0,xn=null,tr(e,t,d,7));break;case 5:var b=null;switch(qe.tag){case 26:b=qe.memoizedState;case 5:case 27:var w=qe;if(b?bh(b):w.stateNode.complete){at=0,xn=null;var U=w.sibling;if(U!==null)qe=U;else{var F=w.return;F!==null?(qe=F,Ni(F)):qe=null}break t}}at=0,xn=null,tr(e,t,d,5);break;case 6:at=0,xn=null,tr(e,t,d,6);break;case 8:nu(),wt=6;break e;default:throw Error(o(462))}}Vy();break}catch(ee){Am(e,ee)}while(!0);return la=sl=null,A.H=s,A.A=c,Je=l,qe!==null?0:(ut=null,Pe=0,Ys(),wt)}function Vy(){for(;qe!==null&&!Vt();)Lm(qe)}function Lm(e){var t=lm(e.alternate,e,ma);e.memoizedProps=e.pendingProps,t===null?Ni(e):qe=t}function _m(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Zp(l,t,t.pendingProps,t.type,void 0,Pe);break;case 11:t=Zp(l,t,t.pendingProps,t.type.render,t.ref,Pe);break;case 5:gc(t);default:sm(l,t),t=qe=zf(t,ma),t=lm(l,t,ma)}e.memoizedProps=e.pendingProps,t===null?Ni(e):qe=t}function tr(e,t,l,s){la=sl=null,gc(t),ql=null,Br=0;var c=t.return;try{if(Ry(e,c,t,l,Pe)){wt=1,pi(e,Tn(l,e.current)),qe=null;return}}catch(d){if(c!==null)throw qe=c,d;wt=1,pi(e,Tn(l,e.current)),qe=null;return}t.flags&32768?(Fe||s===1?e=!0:Xl||(Pe&536870912)!==0?e=!1:(Da=e=!0,(s===2||s===9||s===3||s===6)&&(s=mn.current,s!==null&&s.tag===13&&(s.flags|=16384))),Om(t,e)):Ni(t)}function Ni(e){var t=e;do{if((t.flags&32768)!==0){Om(t,Da);return}e=t.return;var l=Dy(t.alternate,t,ma);if(l!==null){qe=l;return}if(t=t.sibling,t!==null){qe=t;return}qe=t=e}while(t!==null);wt===0&&(wt=5)}function Om(e,t){do{var l=zy(e.alternate,e);if(l!==null){l.flags&=32767,qe=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){qe=e;return}qe=e=l}while(e!==null);wt=6,qe=null}function Bm(e,t,l,s,c,d,b,w,U){e.cancelPendingCommit=null;do Ei();while(_t!==0);if((Je&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(d=t.lanes|t.childLanes,d|=Yo,bg(e,l,d,b,w,U),e===ut&&(qe=ut=null,Pe=0),Jl=t,_a=e,ha=l,Jc=d,eu=c,Nm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Yy(De,function(){return $m(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=A.T,A.T=null,c=B.p,B.p=2,b=Je,Je|=4;try{Ly(e,t,l)}finally{Je=b,B.p=c,A.T=s}}_t=1,Um(),Hm(),Im()}}function Um(){if(_t===1){_t=0;var e=_a,t=Jl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=A.T,A.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{gm(t,e);var d=hu,b=wf(e.containerInfo),w=d.focusedElem,U=d.selectionRange;if(b!==w&&w&&w.ownerDocument&&kf(w.ownerDocument.documentElement,w)){if(U!==null&&Io(w)){var F=U.start,ee=U.end;if(ee===void 0&&(ee=F),"selectionStart"in w)w.selectionStart=F,w.selectionEnd=Math.min(ee,w.value.length);else{var re=w.ownerDocument||document,Q=re&&re.defaultView||window;if(Q.getSelection){var Z=Q.getSelection(),Se=w.textContent.length,Te=Math.min(U.start,Se),it=U.end===void 0?Te:Math.min(U.end,Se);!Z.extend&&Te>it&&(b=it,it=Te,Te=b);var G=Sf(w,Te),V=Sf(w,it);if(G&&V&&(Z.rangeCount!==1||Z.anchorNode!==G.node||Z.anchorOffset!==G.offset||Z.focusNode!==V.node||Z.focusOffset!==V.offset)){var K=re.createRange();K.setStart(G.node,G.offset),Z.removeAllRanges(),Te>it?(Z.addRange(K),Z.extend(V.node,V.offset)):(K.setEnd(V.node,V.offset),Z.addRange(K))}}}}for(re=[],Z=w;Z=Z.parentNode;)Z.nodeType===1&&re.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<re.length;w++){var le=re[w];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}Hi=!!mu,hu=mu=null}finally{Je=c,B.p=s,A.T=l}}e.current=t,_t=2}}function Hm(){if(_t===2){_t=0;var e=_a,t=Jl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=A.T,A.T=null;var s=B.p;B.p=2;var c=Je;Je|=4;try{pm(e,t.alternate,t)}finally{Je=c,B.p=s,A.T=l}}_t=3}}function Im(){if(_t===4||_t===3){_t=0,$t();var e=_a,t=Jl,l=ha,s=Nm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?_t=5:(_t=0,Jl=_a=null,Vm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(La=null),jo(l),t=t.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Xn,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=A.T,c=B.p,B.p=2,A.T=null;try{for(var d=e.onRecoverableError,b=0;b<s.length;b++){var w=s[b];d(w.value,{componentStack:w.stack})}}finally{A.T=t,B.p=c}}(ha&3)!==0&&Ei(),Kn(e),c=e.pendingLanes,(l&261930)!==0&&(c&42)!==0?e===tu?es++:(es=0,tu=e):es=0,ts(0)}}function Vm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,_r(t)))}function Ei(){return Um(),Hm(),Im(),$m()}function $m(){if(_t!==5)return!1;var e=_a,t=Jc;Jc=0;var l=jo(ha),s=A.T,c=B.p;try{B.p=32>l?32:l,A.T=null,l=eu,eu=null;var d=_a,b=ha;if(_t=0,Jl=_a=null,ha=0,(Je&6)!==0)throw Error(o(331));var w=Je;if(Je|=4,km(d.current),bm(d,d.current,b,l),Je=w,ts(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Xn,d)}catch{}return!0}finally{B.p=c,A.T=s,Vm(e,t)}}function Gm(e,t,l){t=Tn(l,t),t=zc(e.stateNode,t,2),e=Ta(e,t,2),e!==null&&(jr(e,2),Kn(e))}function lt(e,t,l){if(e.tag===3)Gm(e,e,l);else for(;t!==null;){if(t.tag===3){Gm(t,e,l);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(La===null||!La.has(s))){e=Tn(l,e),l=qp(2),s=Ta(t,l,2),s!==null&&(Yp(l,s,t,e),jr(s,2),Kn(s));break}}t=t.return}}function lu(e,t,l){var s=e.pingCache;if(s===null){s=e.pingCache=new By;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)||(Qc=!0,c.add(l),e=$y.bind(null,e,t,l),t.then(e,e))}function $y(e,t,l){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,ut===e&&(Pe&l)===l&&(wt===4||wt===3&&(Pe&62914560)===Pe&&300>tt()-ji?(Je&2)===0&&er(e,0):Xc|=l,Zl===Pe&&(Zl=0)),Kn(e)}function qm(e,t){t===0&&(t=Bd()),e=al(e,t),e!==null&&(jr(e,t),Kn(e))}function Gy(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),qm(e,l)}function qy(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),qm(e,l)}function Yy(e,t){return Zt(e,t)}var Ti=null,nr=null,ru=!1,Ri=!1,su=!1,Ba=0;function Kn(e){e!==nr&&e.next===null&&(nr===null?Ti=nr=e:nr=nr.next=e),Ri=!0,ru||(ru=!0,Ky())}function ts(e,t){if(!su&&Ri){su=!0;do for(var l=!1,s=Ti;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var d=0;else{var b=s.suspendedLanes,w=s.pingedLanes;d=(1<<31-bt(42|e)+1)-1,d&=c&~(b&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(l=!0,Fm(s,d))}else d=Pe,d=br(s,s===ut?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(d&3)===0||wn(s,d)||(l=!0,Fm(s,d));s=s.next}while(l);su=!1}}function Py(){Ym()}function Ym(){Ri=ru=!1;var e=0;Ba!==0&&a1()&&(e=Ba);for(var t=tt(),l=null,s=Ti;s!==null;){var c=s.next,d=Pm(s,t);d===0?(s.next=null,l===null?Ti=c:l.next=c,c===null&&(nr=l)):(l=s,(e!==0||(d&3)!==0)&&(Ri=!0)),s=c}_t!==0&&_t!==5||ts(e),Ba!==0&&(Ba=0)}function Pm(e,t){for(var l=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var b=31-bt(d),w=1<<b,U=c[b];U===-1?((w&l)===0||(w&s)!==0)&&(c[b]=go(w,t)):U<=t&&(e.expiredLanes|=w),d&=~w}if(t=ut,l=Pe,l=br(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||wn(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(s!==null&&ct(s),jo(l)){case 2:case 8:l=Rt;break;case 32:l=De;break;case 268435456:l=Ft;break;default:l=De}return s=Km.bind(null,e),l=Zt(l,s),e.callbackPriority=t,e.callbackNode=l,t}return s!==null&&s!==null&&ct(s),e.callbackPriority=2,e.callbackNode=null,2}function Km(e,t){if(_t!==0&&_t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Ei()&&e.callbackNode!==l)return null;var s=Pe;return s=br(e,e===ut?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(Tm(e,s,t),Pm(e,tt()),e.callbackNode!=null&&e.callbackNode===l?Km.bind(null,e):null)}function Fm(e,t){if(Ei())return null;Tm(e,t,!0)}function Ky(){r1(function(){(Je&6)!==0?Zt(ye,Py):Ym()})}function iu(){if(Ba===0){var e=Vl;e===0&&(e=Ve,Ve<<=1,(Ve&261888)===0&&(Ve=256)),Ba=e}return Ba}function Wm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Bs(""+e)}function Qm(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 Fy(e,t,l,s,c){if(t==="submit"&&l&&l.stateNode===c){var d=Wm((c[ln]||null).action),b=s.submitter;b&&(t=(t=b[ln]||null)?Wm(t.formAction):b.getAttribute("formAction"),t!==null&&(d=t,b=null));var w=new Vs("action","action",null,s,c);e.push({event:w,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ba!==0){var U=b?Qm(c,b):new FormData(c);Ec(l,{pending:!0,data:U,method:c.method,action:d},null,U)}}else typeof d=="function"&&(w.preventDefault(),U=b?Qm(c,b):new FormData(c),Ec(l,{pending:!0,data:U,method:c.method,action:d},d,U))},currentTarget:c}]})}}for(var ou=0;ou<qo.length;ou++){var cu=qo[ou],Wy=cu.toLowerCase(),Qy=cu[0].toUpperCase()+cu.slice(1);Hn(Wy,"on"+Qy)}Hn(Ef,"onAnimationEnd"),Hn(Tf,"onAnimationIteration"),Hn(Rf,"onAnimationStart"),Hn("dblclick","onDoubleClick"),Hn("focusin","onFocus"),Hn("focusout","onBlur"),Hn(fy,"onTransitionRun"),Hn(py,"onTransitionStart"),Hn(my,"onTransitionCancel"),Hn(Af,"onTransitionEnd"),El("onMouseEnter",["mouseout","mouseover"]),El("onMouseLeave",["mouseout","mouseover"]),El("onPointerEnter",["pointerout","pointerover"]),El("onPointerLeave",["pointerout","pointerover"]),Ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ja("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ns="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(" "),Xy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ns));function Xm(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 d=void 0;if(t)for(var b=s.length-1;0<=b;b--){var w=s[b],U=w.instance,F=w.currentTarget;if(w=w.listener,U!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=F;try{d(c)}catch(ee){qs(ee)}c.currentTarget=null,d=U}else for(b=0;b<s.length;b++){if(w=s[b],U=w.instance,F=w.currentTarget,w=w.listener,U!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=F;try{d(c)}catch(ee){qs(ee)}c.currentTarget=null,d=U}}}}function Ye(e,t){var l=t[So];l===void 0&&(l=t[So]=new Set);var s=e+"__bubble";l.has(s)||(Zm(t,e,2,!1),l.add(s))}function uu(e,t,l){var s=0;t&&(s|=4),Zm(l,e,s,t)}var Ai="_reactListening"+Math.random().toString(36).slice(2);function du(e){if(!e[Ai]){e[Ai]=!0,qd.forEach(function(l){l!=="selectionchange"&&(Xy.has(l)||uu(l,!1,e),uu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ai]||(t[Ai]=!0,uu("selectionchange",!1,t))}}function Zm(e,t,l,s){switch(Eh(t)){case 2:var c=C1;break;case 8:c=N1;break;default:c=Nu}l=c.bind(null,t,l,e),c=void 0,!Mo||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 fu(e,t,l,s,c){var d=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var b=s.tag;if(b===3||b===4){var w=s.stateNode.containerInfo;if(w===c)break;if(b===4)for(b=s.return;b!==null;){var U=b.tag;if((U===3||U===4)&&b.stateNode.containerInfo===c)return;b=b.return}for(;w!==null;){if(b=wl(w),b===null)return;if(U=b.tag,U===5||U===6||U===26||U===27){s=d=b;continue e}w=w.parentNode}}s=s.return}nf(function(){var F=d,ee=Ro(l),re=[];e:{var Q=Mf.get(e);if(Q!==void 0){var Z=Vs,Se=e;switch(e){case"keypress":if(Hs(l)===0)break e;case"keydown":case"keyup":Z=qg;break;case"focusin":Se="focus",Z=_o;break;case"focusout":Se="blur",Z=_o;break;case"beforeblur":case"afterblur":Z=_o;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":Z=rf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=Dg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=Kg;break;case Ef:case Tf:case Rf:Z=_g;break;case Af:Z=Wg;break;case"scroll":case"scrollend":Z=Ag;break;case"wheel":Z=Xg;break;case"copy":case"cut":case"paste":Z=Bg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=of;break;case"toggle":case"beforetoggle":Z=Jg}var Te=(t&4)!==0,it=!Te&&(e==="scroll"||e==="scrollend"),G=Te?Q!==null?Q+"Capture":null:Q;Te=[];for(var V=F,K;V!==null;){var le=V;if(K=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||K===null||G===null||(le=wr(V,G),le!=null&&Te.push(as(V,le,K))),it)break;V=V.return}0<Te.length&&(Q=new Z(Q,Se,null,l,ee),re.push({event:Q,listeners:Te}))}}if((t&7)===0){e:{if(Q=e==="mouseover"||e==="pointerover",Z=e==="mouseout"||e==="pointerout",Q&&l!==To&&(Se=l.relatedTarget||l.fromElement)&&(wl(Se)||Se[kl]))break e;if((Z||Q)&&(Q=ee.window===ee?ee:(Q=ee.ownerDocument)?Q.defaultView||Q.parentWindow:window,Z?(Se=l.relatedTarget||l.toElement,Z=F,Se=Se?wl(Se):null,Se!==null&&(it=m(Se),Te=Se.tag,Se!==it||Te!==5&&Te!==27&&Te!==6)&&(Se=null)):(Z=null,Se=F),Z!==Se)){if(Te=rf,le="onMouseLeave",G="onMouseEnter",V="mouse",(e==="pointerout"||e==="pointerover")&&(Te=of,le="onPointerLeave",G="onPointerEnter",V="pointer"),it=Z==null?Q:kr(Z),K=Se==null?Q:kr(Se),Q=new Te(le,V+"leave",Z,l,ee),Q.target=it,Q.relatedTarget=K,le=null,wl(ee)===F&&(Te=new Te(G,V+"enter",Se,l,ee),Te.target=K,Te.relatedTarget=it,le=Te),it=le,Z&&Se)t:{for(Te=Zy,G=Z,V=Se,K=0,le=G;le;le=Te(le))K++;le=0;for(var Ee=V;Ee;Ee=Te(Ee))le++;for(;0<K-le;)G=Te(G),K--;for(;0<le-K;)V=Te(V),le--;for(;K--;){if(G===V||V!==null&&G===V.alternate){Te=G;break t}G=Te(G),V=Te(V)}Te=null}else Te=null;Z!==null&&Jm(re,Q,Z,Te,!1),Se!==null&&it!==null&&Jm(re,it,Se,Te,!0)}}e:{if(Q=F?kr(F):window,Z=Q.nodeName&&Q.nodeName.toLowerCase(),Z==="select"||Z==="input"&&Q.type==="file")var Qe=xf;else if(mf(Q))if(vf)Qe=cy;else{Qe=iy;var ke=sy}else Z=Q.nodeName,!Z||Z.toLowerCase()!=="input"||Q.type!=="checkbox"&&Q.type!=="radio"?F&&Eo(F.elementType)&&(Qe=xf):Qe=oy;if(Qe&&(Qe=Qe(e,F))){hf(re,Qe,l,ee);break e}ke&&ke(e,Q,F),e==="focusout"&&F&&Q.type==="number"&&F.memoizedProps.value!=null&&No(Q,"number",Q.value)}switch(ke=F?kr(F):window,e){case"focusin":(mf(ke)||ke.contentEditable==="true")&&(zl=ke,Vo=F,Dr=null);break;case"focusout":Dr=Vo=zl=null;break;case"mousedown":$o=!0;break;case"contextmenu":case"mouseup":case"dragend":$o=!1,Cf(re,l,ee);break;case"selectionchange":if(dy)break;case"keydown":case"keyup":Cf(re,l,ee)}var Ue;if(Bo)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 Dl?ff(e,l)&&(Ke="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(Ke="onCompositionStart");Ke&&(cf&&l.locale!=="ko"&&(Dl||Ke!=="onCompositionStart"?Ke==="onCompositionEnd"&&Dl&&(Ue=af()):(ja=ee,Do="value"in ja?ja.value:ja.textContent,Dl=!0)),ke=Mi(F,Ke),0<ke.length&&(Ke=new sf(Ke,e,null,l,ee),re.push({event:Ke,listeners:ke}),Ue?Ke.data=Ue:(Ue=pf(l),Ue!==null&&(Ke.data=Ue)))),(Ue=ty?ny(e,l):ay(e,l))&&(Ke=Mi(F,"onBeforeInput"),0<Ke.length&&(ke=new sf("onBeforeInput","beforeinput",null,l,ee),re.push({event:ke,listeners:Ke}),ke.data=Ue)),Fy(re,e,F,l,ee)}Xm(re,t)})}function as(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Mi(e,t){for(var l=t+"Capture",s=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=wr(e,l),c!=null&&s.unshift(as(e,c,d)),c=wr(e,t),c!=null&&s.push(as(e,c,d))),e.tag===3)return s;e=e.return}return[]}function Zy(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Jm(e,t,l,s,c){for(var d=t._reactName,b=[];l!==null&&l!==s;){var w=l,U=w.alternate,F=w.stateNode;if(w=w.tag,U!==null&&U===s)break;w!==5&&w!==26&&w!==27||F===null||(U=F,c?(F=wr(l,d),F!=null&&b.unshift(as(l,F,U))):c||(F=wr(l,d),F!=null&&b.push(as(l,F,U)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var Jy=/\r\n?/g,e1=/\u0000|\uFFFD/g;function eh(e){return(typeof e=="string"?e:""+e).replace(Jy,`
|
|
50
|
+
`).replace(e1,"")}function th(e,t){return t=eh(t),eh(e)===t}function st(e,t,l,s,c,d){switch(l){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Rl(e,""+s);break;case"className":_s(e,"class",s);break;case"tabIndex":_s(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":_s(e,l,s);break;case"style":ef(e,s,d);break;case"data":if(t!=="object"){_s(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=Bs(""+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 d=="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=Bs(""+s),e.setAttribute(l,s);break;case"onClick":s!=null&&(e.onclick=ea);break;case"onScroll":s!=null&&Ye("scroll",e);break;case"onScrollEnd":s!=null&&Ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}l=Bs(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""+s):e.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":s===!0?e.setAttribute(l,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(l,s):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(l,s):e.removeAttribute(l);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(l):e.setAttribute(l,s);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),Ls(e,"popover",s);break;case"xlinkActuate":Jn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Jn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Jn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Jn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Jn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Jn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Jn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ls(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=Tg.get(l)||l,Ls(e,l,s))}}function pu(e,t,l,s,c,d){switch(l){case"style":ef(e,s,d);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(o(61));if(l=s.__html,l!=null){if(c.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof s=="string"?Rl(e,s):(typeof s=="number"||typeof s=="bigint")&&Rl(e,""+s);break;case"onScroll":s!=null&&Ye("scroll",e);break;case"onScrollEnd":s!=null&&Ye("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ea);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yd.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(c=l.endsWith("Capture"),t=l.slice(2,c?l.length-7:void 0),d=e[ln]||null,d=d!=null?d[l]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof s=="function")){typeof d!="function"&&d!==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,""):Ls(e,l,s)}}}function Kt(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",e),Ye("load",e);var s=!1,c=!1,d;for(d in l)if(l.hasOwnProperty(d)){var b=l[d];if(b!=null)switch(d){case"src":s=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,d,b,l,null)}}c&&st(e,t,"srcSet",l.srcSet,l,null),s&&st(e,t,"src",l.src,l,null);return;case"input":Ye("invalid",e);var w=d=b=c=null,U=null,F=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":b=ee;break;case"checked":U=ee;break;case"defaultChecked":F=ee;break;case"value":d=ee;break;case"defaultValue":w=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:st(e,t,s,ee,l,null)}}Qd(e,d,w,U,F,b,c,!1);return;case"select":Ye("invalid",e),s=b=d=null;for(c in l)if(l.hasOwnProperty(c)&&(w=l[c],w!=null))switch(c){case"value":d=w;break;case"defaultValue":b=w;break;case"multiple":s=w;default:st(e,t,c,w,l,null)}t=d,l=b,e.multiple=!!s,t!=null?Tl(e,!!s,t,!1):l!=null&&Tl(e,!!s,l,!0);return;case"textarea":Ye("invalid",e),d=c=s=null;for(b in l)if(l.hasOwnProperty(b)&&(w=l[b],w!=null))switch(b){case"value":s=w;break;case"defaultValue":c=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(o(91));break;default:st(e,t,b,w,l,null)}Zd(e,s,c,d);return;case"option":for(U in l)if(l.hasOwnProperty(U)&&(s=l[U],s!=null))switch(U){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:st(e,t,U,s,l,null)}return;case"dialog":Ye("beforetoggle",e),Ye("toggle",e),Ye("cancel",e),Ye("close",e);break;case"iframe":case"object":Ye("load",e);break;case"video":case"audio":for(s=0;s<ns.length;s++)Ye(ns[s],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in l)if(l.hasOwnProperty(F)&&(s=l[F],s!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:st(e,t,F,s,l,null)}return;default:if(Eo(t)){for(ee in l)l.hasOwnProperty(ee)&&(s=l[ee],s!==void 0&&pu(e,t,ee,s,l,void 0));return}}for(w in l)l.hasOwnProperty(w)&&(s=l[w],s!=null&&st(e,t,w,s,l,null))}function t1(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,d=null,b=null,w=null,U=null,F=null,ee=null;for(Z in l){var re=l[Z];if(l.hasOwnProperty(Z)&&re!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":U=re;default:s.hasOwnProperty(Z)||st(e,t,Z,null,s,re)}}for(var Q in s){var Z=s[Q];if(re=l[Q],s.hasOwnProperty(Q)&&(Z!=null||re!=null))switch(Q){case"type":d=Z;break;case"name":c=Z;break;case"checked":F=Z;break;case"defaultChecked":ee=Z;break;case"value":b=Z;break;case"defaultValue":w=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:Z!==re&&st(e,t,Q,Z,s,re)}}Co(e,b,w,U,F,ee,d,c);return;case"select":Z=b=w=Q=null;for(d in l)if(U=l[d],l.hasOwnProperty(d)&&U!=null)switch(d){case"value":break;case"multiple":Z=U;default:s.hasOwnProperty(d)||st(e,t,d,null,s,U)}for(c in s)if(d=s[c],U=l[c],s.hasOwnProperty(c)&&(d!=null||U!=null))switch(c){case"value":Q=d;break;case"defaultValue":w=d;break;case"multiple":b=d;default:d!==U&&st(e,t,c,d,s,U)}t=w,l=b,s=Z,Q!=null?Tl(e,!!l,Q,!1):!!s!=!!l&&(t!=null?Tl(e,!!l,t,!0):Tl(e,!!l,l?[]:"",!1));return;case"textarea":Z=Q=null;for(w in l)if(c=l[w],l.hasOwnProperty(w)&&c!=null&&!s.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:st(e,t,w,null,s,c)}for(b in s)if(c=s[b],d=l[b],s.hasOwnProperty(b)&&(c!=null||d!=null))switch(b){case"value":Q=c;break;case"defaultValue":Z=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(o(91));break;default:c!==d&&st(e,t,b,c,s,d)}Xd(e,Q,Z);return;case"option":for(var Se in l)if(Q=l[Se],l.hasOwnProperty(Se)&&Q!=null&&!s.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:st(e,t,Se,null,s,Q)}for(U in s)if(Q=s[U],Z=l[U],s.hasOwnProperty(U)&&Q!==Z&&(Q!=null||Z!=null))switch(U){case"selected":e.selected=Q&&typeof Q!="function"&&typeof Q!="symbol";break;default:st(e,t,U,Q,s,Z)}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)Q=l[Te],l.hasOwnProperty(Te)&&Q!=null&&!s.hasOwnProperty(Te)&&st(e,t,Te,null,s,Q);for(F in s)if(Q=s[F],Z=l[F],s.hasOwnProperty(F)&&Q!==Z&&(Q!=null||Z!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,t));break;default:st(e,t,F,Q,s,Z)}return;default:if(Eo(t)){for(var it in l)Q=l[it],l.hasOwnProperty(it)&&Q!==void 0&&!s.hasOwnProperty(it)&&pu(e,t,it,void 0,s,Q);for(ee in s)Q=s[ee],Z=l[ee],!s.hasOwnProperty(ee)||Q===Z||Q===void 0&&Z===void 0||pu(e,t,ee,Q,s,Z);return}}for(var G in l)Q=l[G],l.hasOwnProperty(G)&&Q!=null&&!s.hasOwnProperty(G)&&st(e,t,G,null,s,Q);for(re in s)Q=s[re],Z=l[re],!s.hasOwnProperty(re)||Q===Z||Q==null&&Z==null||st(e,t,re,Q,s,Z)}function nh(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function n1(){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],d=c.transferSize,b=c.initiatorType,w=c.duration;if(d&&w&&nh(b)){for(b=0,w=c.responseEnd,s+=1;s<l.length;s++){var U=l[s],F=U.startTime;if(F>w)break;var ee=U.transferSize,re=U.initiatorType;ee&&nh(re)&&(U=U.responseEnd,b+=ee*(U<w?1:(w-F)/(U-F)))}if(--s,t+=8*(d+b)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var mu=null,hu=null;function Di(e){return e.nodeType===9?e:e.ownerDocument}function ah(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 lh(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 xu(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 vu=null;function a1(){var e=window.event;return e&&e.type==="popstate"?e===vu?!1:(vu=e,!0):(vu=null,!1)}var rh=typeof setTimeout=="function"?setTimeout:void 0,l1=typeof clearTimeout=="function"?clearTimeout:void 0,sh=typeof Promise=="function"?Promise:void 0,r1=typeof queueMicrotask=="function"?queueMicrotask:typeof sh<"u"?function(e){return sh.resolve(null).then(e).catch(s1)}:rh;function s1(e){setTimeout(function(){throw e})}function Ua(e){return e==="head"}function ih(e,t){var l=t,s=0;do{var c=l.nextSibling;if(e.removeChild(l),c&&c.nodeType===8)if(l=c.data,l==="/$"||l==="/&"){if(s===0){e.removeChild(c),sr(t);return}s--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")s++;else if(l==="html")ls(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,ls(l);for(var d=l.firstChild;d;){var b=d.nextSibling,w=d.nodeName;d[Sr]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&d.rel.toLowerCase()==="stylesheet"||l.removeChild(d),d=b}}else l==="body"&&ls(e.ownerDocument.body);l=c}while(l);sr(t)}function oh(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 gu(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":gu(l),ko(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function i1(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[Sr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==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(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=zn(e.nextSibling),e===null)break}return null}function o1(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 ch(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 yu(e){return e.data==="$?"||e.data==="$~"}function bu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function c1(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 ju=null;function uh(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 dh(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 fh(e,t,l){switch(t=Di(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 ls(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ko(e)}var Ln=new Map,ph=new Set;function zi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xa=B.d;B.d={f:u1,r:d1,D:f1,C:p1,L:m1,m:h1,X:v1,S:x1,M:g1};function u1(){var e=xa.f(),t=wi();return e||t}function d1(e){var t=Cl(e);t!==null&&t.tag===5&&t.type==="form"?Ap(t):xa.r(e)}var ar=typeof document>"u"?null:document;function mh(e,t,l){var s=ar;if(s&&typeof t=="string"&&t){var c=Nn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof l=="string"&&(c+='[crossorigin="'+l+'"]'),ph.has(c)||(ph.add(c),e={rel:e,crossOrigin:l,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),Kt(t,"link",e),Ht(t),s.head.appendChild(t)))}}function f1(e){xa.D(e),mh("dns-prefetch",e,null)}function p1(e,t){xa.C(e,t),mh("preconnect",e,t)}function m1(e,t,l){xa.L(e,t,l);var s=ar;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 d=c;switch(t){case"style":d=lr(e);break;case"script":d=rr(e)}Ln.has(d)||(e=g({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Ln.set(d,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(rs(d))||t==="script"&&s.querySelector(ss(d))||(t=s.createElement("link"),Kt(t,"link",e),Ht(t),s.head.appendChild(t)))}}function h1(e,t){xa.m(e,t);var l=ar;if(l&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Nn(s)+'"][href="'+Nn(e)+'"]',d=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=rr(e)}if(!Ln.has(d)&&(e=g({rel:"modulepreload",href:e},t),Ln.set(d,e),l.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ss(d)))return}s=l.createElement("link"),Kt(s,"link",e),Ht(s),l.head.appendChild(s)}}}function x1(e,t,l){xa.S(e,t,l);var s=ar;if(s&&e){var c=Nl(s).hoistableStyles,d=lr(e);t=t||"default";var b=c.get(d);if(!b){var w={loading:0,preload:null};if(b=s.querySelector(rs(d)))w.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ln.get(d))&&Su(e,l);var U=b=s.createElement("link");Ht(U),Kt(U,"link",e),U._p=new Promise(function(F,ee){U.onload=F,U.onerror=ee}),U.addEventListener("load",function(){w.loading|=1}),U.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Li(b,t,s)}b={type:"stylesheet",instance:b,count:1,state:w},c.set(d,b)}}}function v1(e,t){xa.X(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0},t),(t=Ln.get(c))&&ku(e,t),d=l.createElement("script"),Ht(d),Kt(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function g1(e,t){xa.M(e,t);var l=ar;if(l&&e){var s=Nl(l).hoistableScripts,c=rr(e),d=s.get(c);d||(d=l.querySelector(ss(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=Ln.get(c))&&ku(e,t),d=l.createElement("script"),Ht(d),Kt(d,"link",e),l.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},s.set(c,d))}}function hh(e,t,l,s){var c=(c=xe.current)?zi(c):null;if(!c)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=lr(l.href),l=Nl(c).hoistableStyles,s=l.get(t),s||(s={type:"style",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=lr(l.href);var d=Nl(c).hoistableStyles,b=d.get(e);if(b||(c=c.ownerDocument||c,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,b),(d=c.querySelector(rs(e)))&&!d._p&&(b.instance=d,b.state.loading=5),Ln.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},Ln.set(e,l),d||y1(c,e,l,b.state))),t&&s===null)throw Error(o(528,""));return b}if(t&&s!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=rr(l),l=Nl(c).hoistableScripts,s=l.get(t),s||(s={type:"script",instance:null,count:0,state:null},l.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function lr(e){return'href="'+Nn(e)+'"'}function rs(e){return'link[rel="stylesheet"]['+e+"]"}function xh(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function y1(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}),Kt(t,"link",l),Ht(t),e.head.appendChild(t))}function rr(e){return'[src="'+Nn(e)+'"]'}function ss(e){return"script[async]"+e}function vh(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,Ht(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"),Ht(s),Kt(s,"style",c),Li(s,l.precedence,e),t.instance=s;case"stylesheet":c=lr(l.href);var d=e.querySelector(rs(c));if(d)return t.state.loading|=4,t.instance=d,Ht(d),d;s=xh(l),(c=Ln.get(c))&&Su(s,c),d=(e.ownerDocument||e).createElement("link"),Ht(d);var b=d;return b._p=new Promise(function(w,U){b.onload=w,b.onerror=U}),Kt(d,"link",s),t.state.loading|=4,Li(d,l.precedence,e),t.instance=d;case"script":return d=rr(l.src),(c=e.querySelector(ss(d)))?(t.instance=c,Ht(c),c):(s=l,(c=Ln.get(d))&&(s=g({},l),ku(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),Ht(c),Kt(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,Li(s,l.precedence,e));return t.instance}function Li(e,t,l){for(var s=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=s.length?s[s.length-1]:null,d=c,b=0;b<s.length;b++){var w=s[b];if(w.dataset.precedence===t)d=w;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Su(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var _i=null;function gh(e,t,l){if(_i===null){var s=new Map,c=_i=new Map;c.set(l,s)}else c=_i,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 d=l[c];if(!(d[Sr]||d[Gt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var b=d.getAttribute(t)||"";b=e+b;var w=s.get(b);w?w.push(d):s.set(b,[d])}}return s}function yh(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function b1(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 bh(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function j1(e,t,l,s){if(l.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var c=lr(s.href),d=t.querySelector(rs(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Oi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=d,Ht(d);return}d=t.ownerDocument||t,s=xh(s),(c=Ln.get(c))&&Su(s,c),d=d.createElement("link"),Ht(d);var b=d;b._p=new Promise(function(w,U){b.onload=w,b.onerror=U}),Kt(d,"link",s),l.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Oi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var wu=0;function S1(e,t){return e.stylesheets&&e.count===0&&Ui(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var s=setTimeout(function(){if(e.stylesheets&&Ui(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&wu===0&&(wu=62500*n1());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ui(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>wu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Oi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ui(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Bi=null;function Ui(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Bi=new Map,t.forEach(k1,e),Bi=null,Oi.call(e))}function k1(e,t){if(!(t.state.loading&4)){var l=Bi.get(e);if(l)var s=l.get(null);else{l=new Map,Bi.set(e,l);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var b=c[d];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),s=b)}s&&l.set(null,s)}c=t.instance,b=c.getAttribute("data-precedence"),d=l.get(b)||s,d===s&&l.set(null,c),l.set(b,c),this.count++,s=Oi.bind(this),c.addEventListener("load",s),c.addEventListener("error",s),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var is={$$typeof:L,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function w1(e,t,l,s,c,d,b,w,U){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=yo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yo(0),this.hiddenUpdates=yo(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function jh(e,t,l,s,c,d,b,w,U,F,ee,re){return e=new w1(e,t,l,b,U,F,ee,re,w),t=1,d===!0&&(t|=24),d=pn(3,null,null,t),e.current=d,d.stateNode=e,t=ac(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:s,isDehydrated:l,cache:t},ic(d),e}function Sh(e){return e?(e=Ol,e):Ol}function kh(e,t,l,s,c,d){c=Sh(c),s.context===null?s.context=c:s.pendingContext=c,s=Ea(t),s.payload={element:l},d=d===void 0?null:d,d!==null&&(s.callback=d),l=Ta(e,s,t),l!==null&&(dn(l,e,t),Hr(l,e,t))}function wh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function Cu(e,t){wh(e,t),(e=e.alternate)&&wh(e,t)}function Ch(e){if(e.tag===13||e.tag===31){var t=al(e,67108864);t!==null&&dn(t,e,67108864),Cu(e,67108864)}}function Nh(e){if(e.tag===13||e.tag===31){var t=gn();t=bo(t);var l=al(e,t);l!==null&&dn(l,e,t),Cu(e,t)}}var Hi=!0;function C1(e,t,l,s){var c=A.T;A.T=null;var d=B.p;try{B.p=2,Nu(e,t,l,s)}finally{B.p=d,A.T=c}}function N1(e,t,l,s){var c=A.T;A.T=null;var d=B.p;try{B.p=8,Nu(e,t,l,s)}finally{B.p=d,A.T=c}}function Nu(e,t,l,s){if(Hi){var c=Eu(s);if(c===null)fu(e,t,s,Ii,l),Th(e,s);else if(T1(c,e,t,l,s))s.stopPropagation();else if(Th(e,s),t&4&&-1<E1.indexOf(e)){for(;c!==null;){var d=Cl(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var b=Nt(d.pendingLanes);if(b!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;b;){var U=1<<31-bt(b);w.entanglements[1]|=U,b&=~U}Kn(d),(Je&6)===0&&(Si=tt()+500,ts(0))}}break;case 31:case 13:w=al(d,2),w!==null&&dn(w,d,2),wi(),Cu(d,2)}if(d=Eu(s),d===null&&fu(e,t,s,Ii,l),d===c)break;c=d}c!==null&&s.stopPropagation()}else fu(e,t,s,null,l)}}function Eu(e){return e=Ro(e),Tu(e)}var Ii=null;function Tu(e){if(Ii=null,e=wl(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=h(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ii=e,null}function Eh(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 ye:return 2;case Rt:return 8;case De:case xt:return 32;case Ft:return 268435456;default:return 32}default:return 32}}var Ru=!1,Ha=null,Ia=null,Va=null,os=new Map,cs=new Map,$a=[],E1="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 Th(e,t){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Ia=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":os.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":cs.delete(t.pointerId)}}function us(e,t,l,s,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:l,eventSystemFlags:s,nativeEvent:d,targetContainers:[c]},t!==null&&(t=Cl(t),t!==null&&Ch(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function T1(e,t,l,s,c){switch(t){case"focusin":return Ha=us(Ha,e,t,l,s,c),!0;case"dragenter":return Ia=us(Ia,e,t,l,s,c),!0;case"mouseover":return Va=us(Va,e,t,l,s,c),!0;case"pointerover":var d=c.pointerId;return os.set(d,us(os.get(d)||null,e,t,l,s,c)),!0;case"gotpointercapture":return d=c.pointerId,cs.set(d,us(cs.get(d)||null,e,t,l,s,c)),!0}return!1}function Rh(e){var t=wl(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,$d(e.priority,function(){Nh(l)});return}}else if(t===31){if(t=h(l),t!==null){e.blockedOn=t,$d(e.priority,function(){Nh(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 Vi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=Eu(e.nativeEvent);if(l===null){l=e.nativeEvent;var s=new l.constructor(l.type,l);To=s,l.target.dispatchEvent(s),To=null}else return t=Cl(l),t!==null&&Ch(t),e.blockedOn=l,!1;t.shift()}return!0}function Ah(e,t,l){Vi(e)&&l.delete(t)}function R1(){Ru=!1,Ha!==null&&Vi(Ha)&&(Ha=null),Ia!==null&&Vi(Ia)&&(Ia=null),Va!==null&&Vi(Va)&&(Va=null),os.forEach(Ah),cs.forEach(Ah)}function $i(e,t){e.blockedOn===t&&(e.blockedOn=null,Ru||(Ru=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,R1)))}var Gi=null;function Mh(e){Gi!==e&&(Gi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Gi===e&&(Gi=null);for(var t=0;t<e.length;t+=3){var l=e[t],s=e[t+1],c=e[t+2];if(typeof s!="function"){if(Tu(s||l)===null)continue;break}var d=Cl(l);d!==null&&(e.splice(t,3),t-=3,Ec(d,{pending:!0,data:c,method:l.method,action:s},s,c))}}))}function sr(e){function t(U){return $i(U,e)}Ha!==null&&$i(Ha,e),Ia!==null&&$i(Ia,e),Va!==null&&$i(Va,e),os.forEach(t),cs.forEach(t);for(var l=0;l<$a.length;l++){var s=$a[l];s.blockedOn===e&&(s.blockedOn=null)}for(;0<$a.length&&(l=$a[0],l.blockedOn===null);)Rh(l),l.blockedOn===null&&$a.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(s=0;s<l.length;s+=3){var c=l[s],d=l[s+1],b=c[ln]||null;if(typeof d=="function")b||Mh(l);else if(b){var w=null;if(d&&d.hasAttribute("formAction")){if(c=d,b=d[ln]||null)w=b.formAction;else if(Tu(c)!==null)continue}else w=b.action;typeof w=="function"?l[s+1]=w:(l.splice(s,3),s-=3),Mh(l)}}}function Dh(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(b){return c=b})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),s||setTimeout(l,20)}function l(){if(!s&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.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 Au(e){this._internalRoot=e}qi.prototype.render=Au.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,s=gn();kh(l,s,e,t,null,null)},qi.prototype.unmount=Au.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kh(e.current,2,null,e,null,null),wi(),t[kl]=null}};function qi(e){this._internalRoot=e}qi.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vd();e={blockedOn:null,target:e,priority:t};for(var l=0;l<$a.length&&t!==0&&t<$a[l].priority;l++);$a.splice(l,0,e),l===0&&Rh(e)}};var zh=r.version;if(zh!=="19.2.4")throw Error(o(527,zh,"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?y(e):null,e=e===null?null:e.stateNode,e};var A1={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yi.isDisabled&&Yi.supportsFiber)try{Xn=Yi.inject(A1),Ct=Yi}catch{}}return fs.createRoot=function(e,t){if(!u(e))throw Error(o(299));var l=!1,s="",c=Ip,d=Vp,b=$p;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&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=jh(e,1,!1,null,null,l,s,null,c,d,b,Dh),e[kl]=t.current,du(e),new Au(t)},fs.hydrateRoot=function(e,t,l){if(!u(e))throw Error(o(299));var s=!1,c="",d=Ip,b=Vp,w=$p,U=null;return l!=null&&(l.unstable_strictMode===!0&&(s=!0),l.identifierPrefix!==void 0&&(c=l.identifierPrefix),l.onUncaughtError!==void 0&&(d=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(w=l.onRecoverableError),l.formState!==void 0&&(U=l.formState)),t=jh(e,1,!0,t,l??null,s,c,U,d,b,w,Dh),t.context=Sh(null),l=t.current,s=gn(),s=bo(s),c=Ea(s),c.callback=null,Ta(l,c,s),l=s,t.current.lanes=l,jr(t,l),Kn(t),e[kl]=t.current,du(e),new qi(t)},fs.version="19.2.4",fs}var Gh;function H1(){if(Gh)return zu.exports;Gh=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=U1(),zu.exports}var I1=H1();const V1="modulepreload",$1=function(a){return"/"+a},qh={},yd=function(r,i,o){let u=Promise.resolve();if(i&&i.length>0){let f=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));u=f(i.map(p=>{if(p=$1(p),p in qh)return;qh[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const j=document.createElement("link");if(j.rel=y?"stylesheet":V1,y||(j.as="script"),j.crossOrigin="",j.href=p,x&&j.setAttribute("nonce",x),document.head.appendChild(j),y)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 h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=f,window.dispatchEvent(h),!h.defaultPrevented)throw f}return u.then(f=>{for(const h of f||[])h.status==="rejected"&&m(h.reason);return r().catch(m)})},Yh={own:"authoring-project",installed:"available-project",global:"available-personal"},ev=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function G1(a){if(typeof a=="string"){if(ev.has(a))return a;if(Object.prototype.hasOwnProperty.call(Yh,a))return Yh[a]}return"authoring-project"}function q1(a){return a.startsWith("available-")?"available":"authoring"}function Y1(a){const r=a.indexOf("-");return a.slice(r+1)}const Pa="";class vs extends Error{constructor(r,i){super(r),this.name="ApiError",this.status=i}}async function Ge(a,r){const i=await fetch(`${Pa}${a}`,r);if(!i.ok){const o=await i.json().catch(()=>({error:i.statusText}));throw new vs(o.error||`HTTP ${i.status}`,i.status)}return i.json()}function en(a){return typeof a=="string"&&a.length>0?a:null}function P1(a){return typeof a=="number"&&Number.isFinite(a)?a:null}function Bu(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 K1(a){const r=a??{};let i;r.origin==="source"||r.origin==="installed"?i=r.origin:(i="source",console.warn(`[api.getSkills] skill ${String(r.plugin)}/${String(r.skill)} has invalid origin=${JSON.stringify(r.origin)}; defaulting to 'source'`));let o;r.scope==="own"||r.scope==="installed"||r.scope==="global"?o=r.scope:o=i==="installed"?"installed":"own";let u;r.installMethod==="authored"||r.installMethod==="copied"||r.installMethod==="symlinked"?u=r.installMethod:u=o==="own"?"authored":"copied";const m=G1(r.scope),f=q1(m),h=Y1(m),x=typeof r.precedenceRank=="number"?r.precedenceRank:void 0;let p;r.shadowedBy===null?p=null:typeof r.shadowedBy=="string"&&ev.has(r.shadowedBy)?p=r.shadowedBy:p=void 0;const y={plugin:typeof r.plugin=="string"?r.plugin:"",skill:typeof r.skill=="string"?r.skill:"",dir:typeof r.dir=="string"?r.dir:"",hasEvals:!!r.hasEvals,hasBenchmark:!!r.hasBenchmark,evalCount:typeof r.evalCount=="number"?r.evalCount:0,assertionCount:typeof r.assertionCount=="number"?r.assertionCount:0,benchmarkStatus:r.benchmarkStatus==="pass"||r.benchmarkStatus==="fail"||r.benchmarkStatus==="pending"||r.benchmarkStatus==="stale"||r.benchmarkStatus==="missing"?r.benchmarkStatus:"missing",lastBenchmark:typeof r.lastBenchmark=="string"?r.lastBenchmark:null,origin:i,scope:o,isSymlink:typeof r.isSymlink=="boolean"?r.isSymlink:!1,symlinkTarget:en(r.symlinkTarget),installMethod:u,scopeV2:m,group:f,source:h,pluginName:en(r.pluginName),pluginNamespace:en(r.pluginNamespace),pluginMarketplace:en(r.pluginMarketplace),pluginManifestPath:en(r.pluginManifestPath),pluginVersion:en(r.pluginVersion),precedenceRank:x,shadowedBy:p,description:en(r.description),version:en(r.version),category:en(r.category),author:en(r.author),license:en(r.license),homepage:en(r.homepage),tags:Bu(r.tags),deps:Bu(r.deps),mcpDeps:Bu(r.mcpDeps),entryPoint:en(r.entryPoint),lastModified:en(r.lastModified),sizeBytes:P1(r.sizeBytes),sourceAgent:en(r.sourceAgent)};if(r.provenance&&typeof r.provenance=="object"){const g=r.provenance;(g.promotedFrom==="installed"||g.promotedFrom==="global")&&typeof g.sourcePath=="string"&&typeof g.promotedAt=="number"?y.provenance={promotedFrom:g.promotedFrom,sourcePath:g.sourcePath,promotedAt:g.promotedAt,sourceSkillVersion:typeof g.sourceSkillVersion=="string"?g.sourceSkillVersion:void 0}:y.provenance=null}else r.provenance===null&&(y.provenance=null);return typeof r.updateAvailable=="boolean"&&(y.updateAvailable=r.updateAvailable),typeof r.currentVersion=="string"&&(y.currentVersion=r.currentVersion),typeof r.latestVersion=="string"&&(y.latestVersion=r.latestVersion),typeof r.pinnedVersion=="string"&&(y.pinnedVersion=r.pinnedVersion),y}const Ne={getConfig(){return Ge("/api/config")},setConfig(a,r){return Ge("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,model:r})})},async getSkills(a){const r=new URLSearchParams;a!=null&&a.scope&&r.set("scope",a.scope),a!=null&&a.agent&&r.set("agent",a.agent);const i=r.toString(),o=await Ge(`/api/skills${i?"?"+i:""}`);return Array.isArray(o)?o.map(K1):[]},getAgents(){return Ge("/api/agents")},getSkillDetail(a,r){return Ge(`/api/skills/${a}/${r}`)},getEvals(a,r){return Ge(`/api/skills/${a}/${r}/evals`)},saveEvals(a,r,i){return Ge(`/api/skills/${a}/${r}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},generateEvals(a,r){return Ge(`/api/skills/${a}/${r}/generate-evals`,{method:"POST"})},async getLatestBenchmark(a,r){const i=await fetch(`${Pa}/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 vs(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 u=o.toString();return Ge(`/api/skills/${a}/${r}/history${u?"?"+u:""}`)},getHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`)},compareRuns(a,r,i,o){return Ge(`/api/skills/${a}/${r}/history-compare?a=${encodeURIComponent(i)}&b=${encodeURIComponent(o)}`)},getCaseHistory(a,r,i,o){const u=new URLSearchParams;o&&u.set("model",o);const m=u.toString();return Ge(`/api/skills/${a}/${r}/history/case/${i}${m?"?"+m:""}`)},deleteHistoryEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/history/${encodeURIComponent(i)}`,{method:"DELETE"})},deleteSkill(a,r){return Ge(`/api/skills/${a}/${r}`,{method:"DELETE"})},improveSkill(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})},instructEdit(a,r,i){return Ge(`/api/skills/${a}/${r}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...i})})},applyImprovement(a,r,i){return Ge(`/api/skills/${a}/${r}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:i})})},getStats(a,r){return Ge(`/api/skills/${a}/${r}/stats`)},getDependencies(a,r){return Ge(`/api/skills/${a}/${r}/dependencies`)},getProjectLayout(){return Ge("/api/project-layout")},createSkill(a){return Ge("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},saveDraft(a){return Ge("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillCreatorStatus(){return Ge("/api/skill-creator-status")},generateSkill(a){return Ge("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})},getSkillFiles(a,r){return Ge(`/api/skills/${a}/${r}/files`)},getSkillFile(a,r,i){return Ge(`/api/skills/${a}/${r}/file?path=${encodeURIComponent(i)}`)},saveSkillFile(a,r,i,o){return Ge(`/api/skills/${a}/${r}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:i,content:o})})},getLeaderboard(a,r){return Ge(`/api/skills/${a}/${r}/leaderboard`)},getLeaderboardEntry(a,r,i){return Ge(`/api/skills/${a}/${r}/leaderboard/${encodeURIComponent(i)}`)},startSweep(a,r,i){const o=`${Pa}/api/skills/${a}/${r}/sweep`,u=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(i)}),u},getCredentials(a,r){return Ge(`/api/credentials/${a}/${r}`)},setCredential(a,r,i,o){return Ge(`/api/credentials/${a}/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:i,value:o})})},getParams(a,r){return Ge(`/api/credentials/${a}/${r}/params`)},getParamsRevealed(a,r,i){const o=i?`reveal=true&key=${encodeURIComponent(i)}`:"reveal=true";return Ge(`/api/credentials/${a}/${r}/params?${o}`)},searchModels(){return Ge("/api/openrouter/models")},getSkillVersions(a,r){return Ge(`/api/skills/${a}/${r}/versions`)},getVersionDiff(a,r,i,o){return Ge(`/api/skills/${a}/${r}/versions/diff?from=${i}&to=${o}`)},startBatchUpdate(a){const r=`${Pa}/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=`${Pa}/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(`${Pa}/api/skills/updates`);return a.ok?await a.json():[]}catch{return[]}},promoteSkill(a,r,i){const o=i!=null&&i.overwrite?"?overwrite=true":"";return Uu(`/api/skills/${a}/${r}/promote${o}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},testInstallSkill(a,r,i){const o=new URLSearchParams;(i==null?void 0:i.dest)==="global"&&o.set("dest","global"),i!=null&&i.overwrite&&o.set("overwrite","true");const u=o.toString();return Uu(`/api/skills/${a}/${r}/test-install${u?"?"+u:""}`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},revertSkill(a,r,i){return Uu(`/api/skills/${a}/${r}/revert`,i==null?void 0:i.onEvent,i==null?void 0:i.signal)},listStudioOps(a){const r=new URLSearchParams;(a==null?void 0:a.before)!=null&&r.set("before",String(a.before)),(a==null?void 0:a.limit)!=null&&r.set("limit",String(a.limit));const i=r.toString();return Ge(`/api/studio/ops${i?"?"+i:""}`)},deleteStudioOp(a){return Ge(`/api/studio/ops/${encodeURIComponent(a)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Pa}/api/studio/ops/stream`)}};async function Uu(a,r,i){const o=await fetch(`${Pa}${a}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:i});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,g;try{const S=await o.json();S.error&&(y=S.error),typeof S.code=="string"&&(g=S.code)}catch{}const j=new vs(y,o.status);throw g&&(j.code=g),j}const u=o.body.getReader(),m=new TextDecoder;let f="",h="",x=null,p=null;for(;;){const{done:y,value:g}=await u.read();if(y)break;f+=m.decode(g,{stream:!0});const j=f.split(`
|
|
51
|
+
`);f=j.pop()??"";for(const S of j)if(S.startsWith("event: "))h=S.slice(7).trim();else if(S.startsWith("data: ")){let C={};try{C=JSON.parse(S.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const D={type:h,...C};r==null||r(D),D.type==="done"&&(x=D),D.type==="error"&&(p=D)}h=""}}if(p){const y=new vs(p.message,500);throw y.code=p.code,y}if(!x)throw new vs("Transfer stream ended without 'done' event",500);return x}function F1(a,r){if(!r.length)return a;const i=new Map;for(const o of r){const u=o.name.split("/").pop()||o.name;i.set(u,o)}return a.map(o=>{const u=i.get(o.skill);return u?{...o,updateAvailable:u.updateAvailable,currentVersion:u.installed,latestVersion:u.latest??void 0}:o})}function W1(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 u=m=>i(m.matches);return o.addEventListener("change",u),()=>o.removeEventListener("change",u)},[a]),r}const Q1=3e5,X1=500,Z1=15e3,J1=6e4;function eb(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 tb(a){let r=0;for(const i of a)i.updateAvailable&&r++;return r}function nb(a){a()}function ab(a){const r=Q1,i=X1,o=Z1,u=J1,[m,f]=v.useState([]),[h,x]=v.useState(()=>new Map),[p,y]=v.useState(0),[g,j]=v.useState(!1),[S,C]=v.useState(null),[D,E]=v.useState(null),k=v.useRef(null),T=v.useRef(null),L=v.useRef(null),I=v.useRef(null),_=v.useRef(!0),$=v.useCallback(async()=>{j(!0);const H=new AbortController,q=setTimeout(()=>H.abort(),o);try{const P=await Promise.race([Ne.getSkillUpdates(),new Promise((te,X)=>{H.signal.addEventListener("abort",()=>{X(new Error("TIMEOUT"))})})]);if(P==="TIMEOUT")throw new Error("TIMEOUT");if(!_.current)return;f(P),x(eb(P)),y(tb(P)),T.current=Date.now(),C(T.current),E(null)}catch(P){if(!_.current)return;E(P instanceof Error?P:new Error(String(P)))}finally{clearTimeout(q),_.current&&j(!1)}},[o]),N=v.useCallback(()=>{if(k.current)return k.current;const H=$().finally(()=>{k.current=null});return k.current=H,H},[$]),M=v.useCallback(()=>{L.current==null&&(L.current=setInterval(()=>{N()},r))},[r,N]),R=v.useCallback(()=>{L.current!=null&&(clearInterval(L.current),L.current=null)},[]);return v.useEffect(()=>{_.current=!0,(T.current==null||Date.now()-T.current>u)&&nb(()=>void N()),(typeof document>"u"||document.visibilityState!=="hidden")&&M();const P=()=>{if(I.current&&(clearTimeout(I.current),I.current=null),document.visibilityState==="hidden"){R();return}I.current=setTimeout(()=>{I.current=null,(T.current==null||Date.now()-T.current>u)&&N(),M()},i)};return typeof document<"u"&&document.addEventListener("visibilitychange",P),()=>{_.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",P),I.current&&clearTimeout(I.current),R()}},[]),{updates:m,updatesMap:h,updateCount:p,isRefreshing:g,lastFetchAt:S,error:D,refresh:N}}const lb={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1};function rb(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 tv=v.createContext(null);function ya(){const a=v.useContext(tv);if(!a)throw new Error("useStudio must be used within StudioProvider");return a}function sb({children:a}){const[r,i]=v.useReducer(rb,lb),o=W1("(max-width: 767px)");v.useEffect(()=>{i({type:"SET_MOBILE",isMobile:o})},[o]);const u=v.useCallback(()=>{i({type:"SET_SKILLS_LOADING",loading:!0}),Ne.getSkills().then(L=>{i({type:"SET_SKILLS",skills:L});const _=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(_){const[,$,N]=_,M=L.find(R=>R.plugin===$&&R.skill===N);M&&i({type:"SELECT_SKILL",skill:{plugin:$,skill:N,origin:M.origin}})}}).catch(L=>i({type:"SET_SKILLS_ERROR",error:L.message}))},[]);v.useEffect(()=>{u()},[u]);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)},[]),h=v.useCallback(L=>{i({type:"SET_MODE",mode:L})},[]),x=v.useCallback(L=>{i({type:"SET_SEARCH",query:L})},[]),p=v.useCallback(L=>{i({type:"SET_MOBILE_VIEW",view:L})},[]),y=v.useCallback(()=>{i({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),g=ab(),j=v.useMemo(()=>{const L=r.skills.map(I=>{if(!I.updateAvailable&&I.latestVersion===void 0)return I;const _={...I};return delete _.updateAvailable,delete _.currentVersion,delete _.latestVersion,_});return F1(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]),D=g.updateCount,E=g.refresh,k=g.isRefreshing,T=v.useMemo(()=>({state:C,selectSkill:m,clearSelection:f,setMode:h,setSearch:x,setMobileView:p,refreshSkills:u,updateCount:D,dismissUpdateNotification:y,updates:g.updates,outdatedByOrigin:S,isRefreshingUpdates:k,refreshUpdates:E}),[C,m,f,h,x,p,u,D,y,g.updates,S,k,E]);return n.jsx(tv.Provider,{value:T,children:a})}const ib={config:null,loading:!0};function ob(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 nv=v.createContext(null);function bl(){const a=v.useContext(nv);if(!a)throw new Error("useConfig must be used within ConfigProvider");return a}function cb({children:a}){const[r,i]=v.useReducer(ob,ib),o=v.useCallback(()=>{Ne.getConfig().then(f=>i({type:"SET_CONFIG",config:f})).catch(()=>{})},[]);v.useEffect(()=>{o()},[o]);const u=v.useCallback(async(f,h)=>{const x=await Ne.setConfig(f,h);return i({type:"SET_CONFIG",config:x}),x},[]),m=v.useMemo(()=>({config:r.config,loading:r.loading,updateConfig:u,refreshConfig:o}),[r,u,o]);return n.jsx(nv.Provider,{value:m,children:a})}function ub({topRail:a,sidebar:r,main:i,statusBar:o,resizeHandle:u,banner:m,liveMessage:f,sidebarWidth:h=320,sidebarHidden:x=!1}){const p={"--top-rail-height":"48px","--status-bar-height":"28px","--sidebar-width":`${h}px`,display:"grid",gridTemplateRows:"var(--top-rail-height) 1fr var(--status-bar-height)",height:"100vh",overflow:"hidden",background:"var(--bg-canvas)",color:"var(--text-primary)"},y={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return n.jsxs("div",{className:"studio-shell",style: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:y,children:[!x&&n.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:u?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:r}),!x&&u,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 co=Jx();const db=Zx(co),Ph=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],fb={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},pb={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},mb={"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"},hb={"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 xb(a,r){var h,x;const i=fb[a.id]??null,o=pb[a.id]??null,u=i?!!((h=r==null?void 0:r.wrapperFolders)!=null&&h[i]):!1,m=o?!!((x=r==null?void 0:r.binaries)!=null&&x[o]):!0,f=a.models.map(p=>({id:p.id,displayName:p.label,billingMode:hb[a.id]??"per-token"}));return{id:a.id,displayName:vb(a.id,a.label),wrapperFolder:i,wrapperFolderPresent:u,binaryAvailable:m,endpointReachable:a.id==="ollama"||a.id==="lm-studio"?a.available:null,available:a.available,ctaType:a.available?null:mb[a.id]??null,models:f}}function vb(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 gb(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of Ph){const u=r.get(o);u&&i.push(u)}for(const o of a)Ph.includes(o.id)||i.push(o);return i}function yb(a){const[r,i]=v.useState(null),[o,u]=v.useState("loading"),[m,f]=v.useState(null),h=v.useRef(null),x=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 D=await C.json(),E=gb((D.providers||[]).map(k=>xb(k,D.detection)));i({agents:E,activeAgent:D.provider??null,activeModel:D.model??null}),u("ready"),f(null)}catch(C){u("error"),f(C.message)}},[]);v.useEffect(()=>{p()},[p]);const y=v.useCallback(async()=>{const C=Date.now();if(!(C-x.current<5*6e4))try{const D=await fetch("/api/openrouter/models");if(!D.ok)return;const E=await D.json();x.current=C,i(k=>{if(!k)return k;const T=k.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{...k,agents:T}}),E.stale&&(a!=null&&a.onStaleCatalog)&&a.onStaleCatalog("openrouter",(E.ageSec??0)*1e3)}catch{}},[a]),g=v.useCallback(C=>{h.current=C,C==="openrouter"&&y()},[y]),j=v.useCallback(()=>{x.current=0,p()},[p]),S=v.useCallback(async(C,D)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:C,model:D})})).ok&&i(k=>k&&{...k,activeAgent:C,activeModel:D})},[]);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 Hu({variant:a,label:r,onActivate:i,installUrl:o}){function u(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(),u(f))}return n.jsx("button",{type:"button","data-testid":`locked-cta-${a}`,onClick:u,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 rd({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 bb={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}`},jb={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"},Sb={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"},kb={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."},wb={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"},Cb={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"},Nb={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."},Eb={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},Tb={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},Rb={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},Ab={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"},Mb={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 →"}},Db={subscriptionBilling:"· subscription",free:"· free"},zb={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`},Lb={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.`},_b={triggerAriaLabel:"Choose active agent for the sidebar",popoverTitle:"Choose active agent",statsInstalled:"Installed",statsGlobal:"Global",statsLastSync:"Last sync",statsHealthOk:"Fresh",statsHealthStale:"Updates available",statsHealthMissing:"Not detected",switchCta:"Switch for this studio session",notDetectedSubheading:"Not detected",setUpCta:a=>`Set up ${a}`,sharedFolderBanner:a=>`Shared folder — consumed by ${a}`},Ob={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:a=>`No skills installed for ${a} in this project — run vskill install.`,emptyGlobal:a=>`No global skills for ${a} — run vskill install --global.`},Bb={compactLabel:"Covered by Max/Pro · overflow billed at API rates",tooltip:"Your Claude Code CLI usage runs under your Pro/Max subscription quota. If you've enabled extra usage in your account settings, excess usage continues at standard API rates. Run /usage in Claude Code or visit claude.com Settings → Usage to see remaining quota — vskill can't display it directly.",firstUseBanner:"Claude Code uses your Pro/Max subscription. No API key needed — vskill just runs the official claude binary on your behalf.",learnMore:"Learn more"},Ub={title:a=>`Set up ${a}`,close:"Close",copy:"Copy",copied:"Copied",requiredEnv:"Required env vars",getKey:"Get a key",installRun:"Install & run",learnMore:"Learn more",fallbackTitle:"No setup guide available",fallbackBody:"We don't ship a setup guide for this provider yet."},Hb={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Ib={anthropic:{name:"Anthropic API",description:"Direct API access to Claude via your Anthropic API key. Pay-per-token billing.",envVars:["ANTHROPIC_API_KEY"],keyUrl:"https://platform.claude.com/settings/keys",learnMoreUrl:"https://docs.claude.com/en/docs/get-started"},openai:{name:"OpenAI",description:"Access to GPT-4, GPT-5 and the o-series reasoning models via your OpenAI API key.",envVars:["OPENAI_API_KEY"],keyUrl:"https://platform.openai.com/api-keys",learnMoreUrl:"https://platform.openai.com/docs"},openrouter:{name:"OpenRouter",description:"One API key, 300+ models from Anthropic, OpenAI, Google, Meta, and more.",envVars:["OPENROUTER_API_KEY"],keyUrl:"https://openrouter.ai/keys",learnMoreUrl:"https://openrouter.ai/docs"},gemini:{name:"Gemini",description:"Google Gemini models (2.5 Pro, Flash) via Google AI Studio. Free tier available.",envVars:["GEMINI_API_KEY"],keyUrl:"https://aistudio.google.com/apikey",learnMoreUrl:"https://ai.google.dev/gemini-api/docs"},ollama:{name:"Ollama",description:"Local models on your own machine. Zero external calls, zero cost after download.",envVars:["OLLAMA_HOST"],installCmd:"curl -fsSL https://ollama.com/install.sh | sh",startCmd:"ollama serve",pullExample:"ollama pull llama3.2",learnMoreUrl:"https://ollama.com/download"},lmStudio:{name:"LM Studio",description:"Desktop app + local server for running open models with a GUI. Compatible with the OpenAI API.",envVars:["LM_STUDIO_BASE_URL"],installCmd:"Download from https://lmstudio.ai and launch the app, then start the local server.",startCmd:"# In LM Studio: Developer → Start Server (default port 1234)",pullExample:"# In LM Studio: Discover → download any GGUF model",learnMoreUrl:"https://lmstudio.ai/docs"},claudeCode:{name:"Claude Code",description:"No API key needed if you're logged into Claude Code. vskill just runs the official claude binary on your behalf under your Pro/Max subscription.",loginHint:"If you're not logged in, run claude in your terminal and authenticate with your Pro/Max account.",learnMoreUrl:"https://docs.claude.com/en/docs/claude-code"}},J={sidebar:bb,shell:jb,detail:Sb,actions:kb,palette:wb,shortcuts:Cb,toasts:Nb,connection:Eb,forms:Tb,errors:Rb,picker:Ab,providers:Mb,models:Db,settings:zb,statusBar:Lb,scopePicker:_b,scopeSection:Ob,claudeCodeLabel:Bb,setupDrawer:Ub,setupProviders:Ib,scopeLabels:Hb},Kh=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Vb({agents:a,activeAgentId:r,focusedAgentId:i,onFocus:o,onSelect:u,onOpenSettings:m}){const f=a.filter(x=>Kh.has(x.id)),h=a.filter(x=>!Kh.has(x.id));return n.jsxs("div",{role:"listbox","aria-label":"Agent","data-testid":"agent-list",style:{width:240,borderRight:"1px solid var(--border-default, var(--border-subtle))",display:"flex",flexDirection:"column",overflowY:"auto"},children:[f.map(x=>n.jsx(Fh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id)),h.length>0&&n.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>n.jsx(Fh,{agent:x,isActive:x.id===r,isFocused:x.id===i,onFocus:o,onSelect:u,onOpenSettings:m},x.id))]})}function Fh({agent:a,isActive:r,isFocused:i,onFocus:o,onSelect:u,onOpenSettings:m}){const{providers:f}=J,h={"claude-cli":f.claudeCli.caption,anthropic:f.anthropic.caption,openrouter:f.openrouter.caption},x={"claude-cli":{label:f.claudeCli.installCta,url:f.claudeCli.installUrl},cursor:{label:f.cursor.installCta},"codex-cli":{label:f.codexCli.installCta},"gemini-cli":{label:f.geminiCli.installCta},copilot:{label:f.copilot.installCta},zed:{label:f.zed.installCta}},p=a.id==="claude-cli"||a.id==="claude-code",y={minHeight:36,height:p?"auto":36,padding:p?"6px 12px":"0 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",position:"relative",background:i?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:r?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:r?500:400,color:"var(--text-primary)"};return r&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),n.jsxs("div",{role:"option","aria-selected":r,"data-testid":`agent-row-${a.id}`,"data-focused":i||void 0,tabIndex:i?0:-1,onMouseEnter:()=>o(a.id),onFocus:()=>o(a.id),onClick:()=>u(a.id),style:y,children:[a.wrapperFolder&&n.jsx("span",{"data-testid":`wrapper-dot-${a.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:a.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:a.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!a.wrapperFolder&&n.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),n.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[n.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.displayName}),(a.id==="claude-cli"||a.id==="claude-code")&&n.jsx("span",{"data-testid":"claude-code-billing-label",title:J.claudeCodeLabel.tooltip,style:{fontSize:10,color:"var(--text-secondary, var(--text-tertiary))",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginTop:1},children:J.claudeCodeLabel.compactLabel})]}),n.jsx("span",{"aria-label":a.available?"available":"locked",style:{color:a.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:a.available?n.jsx(rd,{unlocked:!0,size:10}):n.jsx(rd,{size:10})}),r&&n.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${a.id}`,children:J.picker.currentlyActive}),!a.available&&a.ctaType==="api-key"&&n.jsx(Hu,{variant:"api-key",label:a.id==="anthropic"?f.anthropic.addKeyCta:f.openrouter.addKeyCta,onActivate:()=>m(a.id)}),!a.available&&a.ctaType==="cli-install"&&x[a.id]&&n.jsx(Hu,{variant:"cli-install",label:x[a.id].label,installUrl:x[a.id].url,onActivate:()=>{}}),!a.available&&a.ctaType==="start-service"&&n.jsx(Hu,{variant:"start-service",label:a.id==="ollama"?f.ollama.startServiceCta:f.lmStudio.startServiceCta,onActivate:()=>m(a.id)}),h[a.id]&&n.jsx("span",{className:"sr-only","data-testid":`caption-${a.id}`,children:h[a.id]})]})}function $b(a,r,i,o){const f=a>=80,h=v.useRef(null),[x,p]=v.useState(0),y=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(x/r)-4),C=Math.ceil(i/r)+8,D=Math.min(a,S+C);return{visibleStart:S,visibleEnd:D}},[f,x,r,i,a,4]);return{visibleStart:g,visibleEnd:j,totalHeight:a*r,offsetTop:g*r,virtualised:f,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:i,willChange:f?"transform":void 0}}}}const av=44,Gb=352,qb=60;function Yb(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 ${J.models.subscriptionBilling}`:J.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,u=`$${i.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return r?`${r} ctx · ${u}`:u}function Pb(a,r){if(!r)return a;const i=r.toLowerCase();return a.filter(u=>u.displayName.toLowerCase().includes(i)).sort((u,m)=>{const f=u.displayName.toLowerCase().indexOf(i),h=m.displayName.toLowerCase().indexOf(i);return f!==h?f-h:u.displayName.length-m.displayName.length})}function Kb({agent:a,activeModelId:r,onSelect:i,onOpenSettings:o}){const[u,m]=v.useState(""),[f,h]=v.useState(""),x=v.useRef(null);if(v.useEffect(()=>{const g=setTimeout(()=>h(u),qb);return()=>clearTimeout(g)},[u]),v.useEffect(()=>{a.id==="openrouter"&&a.available&&x.current&&x.current.focus()},[a.id,a.available]),a.id==="openrouter"&&!a.available)return n.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[n.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),n.jsx("button",{type:"button",onClick:()=>o("openrouter"),style:{alignSelf:"flex-start",padding:"6px 10px",borderRadius:6,background:"var(--accent, var(--color-accent))",color:"var(--bg-surface, white)",border:"none",fontSize:12,fontWeight:500,cursor:"pointer"},children:J.providers.openrouter.addKeyCta})]});const p=v.useMemo(()=>Pb(a.models,f),[a.models,f]),y=$b(p.length,av,Gb);return n.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[a.id==="openrouter"&&n.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:n.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:u,onChange:g=>m(g.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),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:J.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:J.picker.clearSearch})]}):p.length===0?n.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):n.jsx("div",{...y.containerProps,children:n.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:n.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:p.slice(y.visibleStart,y.visibleEnd).map(g=>n.jsx(Fb,{model:g,isActive:g.id===r,onSelect:()=>i(g.id)},g.id))})})})]})}function Fb({model:a,isActive:r,onSelect:i}){const o=Yb(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:av,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 Wh={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function Wb(){const[a,r]=v.useState(null),[i,o]=v.useState(!0),[u,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 y=await p.json();r({...Wh,...y}),m(null)}catch(p){m(p.message),r(Wh)}finally{o(!1)}},[]);v.useEffect(()=>{f()},[f]);const h=v.useCallback(async(p,y,g="browser")=>{const j=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y,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]),x=v.useCallback(async p=>{const y=await fetch(`/api/settings/keys/${p}`,{method:"DELETE"});if(!y.ok)throw new Error(`DELETE /api/settings/keys/${p} returned ${y.status}`);await f()},[f]);return{state:a,loading:i,error:u,save:h,remove:x,refresh:f}}const Qb=[{id:"anthropic",name:J.providers.anthropic.name,keyIssuanceUrl:J.providers.anthropic.keyIssuanceUrl,prefix:J.providers.anthropic.keyPrefix},{id:"openrouter",name:J.providers.openrouter.name,keyIssuanceUrl:J.providers.openrouter.keyIssuanceUrl,prefix:J.providers.openrouter.keyPrefix}];function Xb(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function Zb(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 Jb({open:a,onClose:r,initialProvider:i,onToast:o}){const{state:u,save:m,remove:f}=Wb(),[h,x]=v.useState("browser"),p=v.useRef(null),y=v.useRef(null),[g,j]=v.useState(i??"anthropic");if(v.useEffect(()=>{if(!a)return;const C=document.activeElement,D=setTimeout(()=>{var T;const E=i?`input[data-provider="${i}"]`:"input[data-provider]",k=(T=p.current)==null?void 0:T.querySelector(E);k==null||k.focus()},0);return()=>{var E;clearTimeout(D),(E=C==null?void 0:C.focus)==null||E.call(C)}},[a,i]),v.useEffect(()=>{if(!a)return;const C=D=>{if(D.key==="Escape"){D.preventDefault(),r();return}if(D.key==="Tab"&&p.current){const E=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(E.length===0)return;const k=E[0],T=E[E.length-1];D.shiftKey&&document.activeElement===k?(D.preventDefault(),T.focus()):!D.shiftKey&&document.activeElement===T&&(D.preventDefault(),k.focus())}};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[a,r]),!a)return null;const S=Xb();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:J.settings.title}),n.jsx("div",{role:"note","data-testid":"settings-banner",style:{padding:"8px 12px",borderRadius:6,background:"color-mix(in srgb, var(--info, var(--accent-muted)) 20%, transparent)",color:"var(--text-primary)",fontSize:12,marginBottom:16},children:J.settings.banner}),n.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[n.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),Qb.map(C=>n.jsx(e0,{providerId:C.id,providerName:C.name,keyIssuanceUrl:C.keyIssuanceUrl,prefix:C.prefix,metadata:u==null?void 0:u[C.id],tier:h,onSave:async D=>{const E=await m(C.id,D,h);return o==null||o(J.settings.keySaved(C.name)),E},onRemove:async()=>{await f(C.id),o==null||o(J.settings.keyRemoved(C.name))},inputRef:C.id===(i??"anthropic")?y: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:J.settings.sectionStorage}),S?n.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[n.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):n.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,n.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),n.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:n.jsx("button",{type:"button",onClick:r,style:{padding:"6px 12px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:6,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},children:"Close"})})]})})}function e0({providerId:a,providerName:r,keyIssuanceUrl:i,prefix:o,metadata:u,onSave:m,onRemove:f,inputRef:h}){const[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(!1),[C,D]=v.useState(!1),[E,k]=v.useState(null),T=x.trim(),L=T.length===0,I=T.length>0&&!T.startsWith(o),_=v.useCallback(async()=>{if(!L){S(!0);try{const M=await m(T);M.warning?k(M.warning):k(null),p("")}finally{S(!1)}}},[L,m,T]),$=v.useCallback(async()=>{var M;try{if(!((M=navigator.clipboard)!=null&&M.readText))return;const R=await navigator.clipboard.readText();p(R)}catch{}},[]),N=v.useCallback(async()=>{D(!1),await f()},[f]);return n.jsxs("div",{"data-testid":`provider-row-${a}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[n.jsx("strong",{style:{fontSize:13},children:r}),n.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),n.jsxs("div",{style:{display:"flex",gap:6},children:[n.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:M=>{p(M.target.value),k(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(!y),style:ir,children:y?J.settings.hide:J.settings.show}),n.jsx("button",{type:"button",onClick:$,style:ir,children:J.settings.paste})]}),L&&x.length>0&&n.jsx("div",{role:"status",style:t0,children:J.settings.enterNonEmpty}),I&&n.jsx("div",{role:"status","data-testid":`prefix-warn-${a}`,style:Qh,children:J.settings.prefixWarn(r)}),E&&n.jsx("div",{role:"status",style:Qh,children:E}),n.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[n.jsx("button",{type:"button",onClick:_,disabled:L||j,"data-testid":`save-${a}`,style:{...ir,background:L?"var(--surface-2)":"var(--accent, var(--color-accent))",color:L?"var(--text-muted)":"white",cursor:L?"not-allowed":"pointer"},children:J.settings.save}),(u==null?void 0:u.stored)&&n.jsx(n.Fragment,{children:C?n.jsxs(n.Fragment,{children:[n.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(r)}),n.jsx("button",{type:"button",onClick:N,"data-testid":`remove-confirm-${a}`,style:{...ir,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),n.jsx("button",{type:"button",onClick:()=>D(!1),style:ir,children:"Cancel"})]}):n.jsx("button",{type:"button",onClick:()=>D(!0),"data-testid":`remove-${a}`,style:{...ir,color:"var(--text-muted)"},children:J.settings.remove})}),n.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${a}`,children:u!=null&&u.stored&&u.updatedAt?J.settings.keyStoredAt(Zb(u.updatedAt)):J.settings.noKey})]})]})}const ir={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},t0={fontSize:11,color:"var(--danger, #b33)"},Qh={fontSize:11,color:"var(--warning, var(--text-muted))"};function n0(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function a0({onToast:a}){const{status:r,catalog:i,focusAgent:o,setActive:u}=yb({onStaleCatalog:(M,R)=>{const H=Math.round(R/6e4);a==null||a(`Using cached ${M} catalog (${H} min old)`)}}),[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,y]=v.useState(),[g,j]=v.useState(null),[S,C]=v.useState("agents"),D=v.useRef(null);v.useRef(null),v.useEffect(()=>{var M;i&&!g&&j(i.activeAgent??((M=i.agents[0])==null?void 0:M.id)??null)},[i,g]);const E=(i==null?void 0:i.agents)??[],k=v.useMemo(()=>E.find(M=>M.id===g)??E[0],[E,g]),T=v.useCallback(()=>{var M;f(!0),C("agents"),j((i==null?void 0:i.activeAgent)??((M=E[0])==null?void 0:M.id)??null)},[i,E]),L=v.useCallback(()=>{var M;f(!1),(M=D.current)==null||M.focus()},[]);v.useEffect(()=>{const M=R=>{var q;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const H=(q=document.activeElement)==null?void 0:q.tagName;H==="INPUT"||H==="TEXTAREA"||(R.preventDefault(),f(P=>!P))};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]),v.useEffect(()=>{if(!m)return;const M=H=>{if(H.key==="Escape"){H.preventDefault(),L();return}if(H.key==="ArrowDown"){H.preventDefault(),R(1);return}if(H.key==="ArrowUp"){H.preventDefault(),R(-1);return}if(H.key==="ArrowRight"&&S==="agents"){H.preventDefault(),C("models");return}if(H.key==="ArrowLeft"&&S==="models"){H.preventDefault(),C("agents");return}if(H.key==="Enter"){H.preventDefault(),S==="agents"&&k?C("models"):S==="models"&&k&&k.models[0]&&(u(k.id,k.models[0].id),L());return}};function R(H){if(S==="agents"){const q=E.findIndex(te=>te.id===g),P=E[Math.max(0,Math.min(E.length-1,q+H))];P&&(j(P.id),o(P.id))}}return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[m,S,E,g,k,L,o,u]);const I=v.useCallback(M=>{y(M==="anthropic"||M==="openrouter"?M:void 0),x(!0),f(!1)},[]),_=E.find(M=>M.id===(i==null?void 0:i.activeAgent)),$=_==null?void 0:_.models.find(M=>M.id===(i==null?void 0:i.activeModel)),N=v.useMemo(()=>{if(r!=="ready"||!i)return"Loading…";const M=(_==null?void 0:_.displayName)??"Agent",R=($==null?void 0:$.displayName)??i.activeModel??"Model";return`${M} · ${R}`},[r,i,_,$]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:D,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>m?L():T(),"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:_!=null&&_.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),n.jsx("span",{children:N})]}),m&&typeof document<"u"&&co.createPortal(n.jsxs(l0,{reducedMotion:n0(),onClickOutside:L,children:[n.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[n.jsx(Vb,{agents:E,activeAgentId:(i==null?void 0:i.activeAgent)??null,focusedAgentId:g,onFocus:M=>{j(M),o(M)},onSelect:M=>{j(M),o(M),C("models")},onOpenSettings:I}),k&&n.jsx(Kb,{agent:k,activeModelId:(i==null?void 0:i.activeModel)??null,onSelect:M=>{u(k.id,M),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:J.picker.settingsButton}),n.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),n.jsx(Jb,{open:h,onClose:()=>x(!1),initialProvider:p,onToast:a})]})}function l0({children:a,reducedMotion:r,onClickOutside:i}){const o=v.useRef(null);return v.useEffect(()=>{const u=m=>{o.current&&!o.current.contains(m.target)&&i()};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[i]),n.jsxs("div",{ref:o,"data-testid":"agent-model-picker-popover",role:"dialog","aria-label":"Select agent and model",style:{position:"fixed",top:56,left:"50%",transform:"translateX(-50%)",width:600,background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,overflow:"hidden",zIndex:90,animation:r?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[a,n.jsx("style",{children:`@keyframes agentPickerFadeIn {
|
|
52
|
+
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
53
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
54
|
+
}`})]})}function Xh(){typeof window>"u"||(window.location.hash="#/")}function r0({onHome:a}){const[r,i]=v.useState(!1),[o,u]=v.useState(!1),m=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),Xh(),a==null||a())},f=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),Xh(),a==null||a())};return n.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:m,onKeyDown:f,onFocus:()=>i(!0),onBlur:()=>i(!1),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{display:"inline-flex",alignItems:"center",gap:10,flexShrink:0,padding:"4px 6px",margin:"-4px -6px",borderRadius:6,textDecoration:"none",color:"inherit",cursor:"pointer",outline:r?"2px solid var(--border-focus)":"none",outlineOffset:2,background:o?"color-mix(in srgb, var(--text-primary) 4%, transparent)":"transparent",transition:"background-color var(--duration-fast, 120ms) var(--ease-standard, ease)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:6,background:"color-mix(in srgb, var(--accent-surface) 20%, transparent)"},children:n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent-surface)",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),n.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const s0="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",i0=v.lazy(()=>yd(()=>import("./UpdateDropdown-CXwYZ5VE.js"),__vite__mapDeps([0,1])));function o0(){const{updateCount:a,updates:r,isRefreshingUpdates:i,refreshUpdates:o,selectSkill:u}=ya(),[m,f]=v.useState(!1),h=v.useRef(null),x=v.useCallback(()=>f(!1),[]),p=a>0?"var(--text-primary)":"var(--text-secondary)",y=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:h,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:s0,alt:"",width:18,height:18,style:{display:"block",opacity:a>0?1:.75}}),a>0&&n.jsx("span",{"data-testid":"update-bell-badge","aria-hidden":"true",style:{position:"absolute",top:-2,right:-2,minWidth:14,height:14,padding:"0 3px",borderRadius:999,background:"var(--color-own)",color:"var(--color-paper)",fontSize:9,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:600,lineHeight:1},children:y})]}),m&&n.jsx(v.Suspense,{fallback:n.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:n.jsx(i0,{updates:r,isRefreshing:i,onRefresh:()=>o(),onSelectSkill:j=>{const S=j.name.split("/"),C=S.length>=2?S[S.length-2]:S[0],D=S[S.length-1];u({plugin:C,skill:D,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function Zh(a){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:a}))}function c0({projectName:a,selected:r,onOpenPalette:i,onHome:o,projectPickerSlot:u}){const m=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(r0,{onHome:o}),u?n.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:u}):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&&m&&n.jsxs(n.Fragment,{children:[n.jsx(Jh,{segment:"origin",onClick:()=>Zh({scope:"origin",origin:r.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:r.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:m}),n.jsx(ex,{}),n.jsx(Jh,{segment:"plugin",onClick:()=>Zh({scope:"plugin",plugin:r.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:r.plugin}),n.jsx(ex,{}),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(a0,{})}),n.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:n.jsx(o0,{})}),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 Jh({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:u=>{u.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:u=>{const m=(i==null?void 0:i.color)??"var(--text-secondary)";u.currentTarget.style.color=m},children:o})}function ex(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const uo="vskill-theme";function lv(a){return a==="light"||a==="dark"||a==="auto"?a:"auto"}function u0(a,r){return a==="light"||a==="dark"?a:r?"dark":"light"}function d0(a){try{const r=a.getItem(uo);return lv(r)}catch{return"auto"}}function f0(a,r){try{a.setItem(uo,r)}catch{}}function p0(a,r,i){a.dataset.theme=i,a.dataset.themeMode=r}function m0(a){if(!a)return!1;try{return a("(prefers-color-scheme: dark)").matches}catch{return!1}}const rv=v.createContext(null);function h0({storage:a,matchMedia:r,target:i,children:o}){const u=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),[h,x]=v.useState(()=>u?d0(u):"auto"),[p,y]=v.useState(()=>m0(m)),g=v.useMemo(()=>u0(h,p),[h,p]);v.useEffect(()=>{f&&p0(f,h,g)},[f,h,g]),v.useEffect(()=>{if(!m)return;const C=m("(prefers-color-scheme: dark)"),D=k=>y(k.matches);if(typeof C.addEventListener=="function")return C.addEventListener("change",D),()=>C.removeEventListener("change",D);const E=C;return E.addListener(D),()=>E.removeListener(D)},[m]),v.useEffect(()=>{if(typeof window>"u")return;const C=D=>{D.key===uo&&x(lv(D.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 D=T=>{T?f.dataset.contrast="more":f.dataset.contrast==="more"&&delete f.dataset.contrast};D(C.matches);const E=T=>D(T.matches);if(typeof C.addEventListener=="function")return C.addEventListener("change",E),()=>C.removeEventListener("change",E);const k=C;return k.addListener(E),()=>k.removeListener(E)},[m,f]);const j=v.useCallback(C=>{x(C),u&&f0(u,C)},[u]),S=v.useMemo(()=>({mode:h,resolvedTheme:g,setTheme:j}),[h,g,j]);return n.jsx(rv.Provider,{value:S,children:o})}function sv(){const a=v.useContext(rv);if(!a)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return a}const tx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function x0(a){const r=new Map(a.map(o=>[o.id,o])),i=[];for(const o of tx){const u=r.get(o);u&&i.push(u)}for(const o of a)tx.includes(o.id)||i.push(o);return i}function v0(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)`),u=()=>i(o.matches);return(m=o.addEventListener)==null||m.call(o,"change",u),()=>{var f;return(f=o.removeEventListener)==null?void 0:f.call(o,"change",u)}},[a]),r}function g0({providers:a,onOpenSettings:r,onOpenInstallHelp:i}){const o=x0(a),u=v0(640),[m,f]=v.useState(!1),h=v.useCallback(x=>{x.available||x.kind==="api-key"?r==null||r(x.id):i==null||i(x.id)},[r,i]);if(u){const x=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":J.statusBar.providerSummary(x,o.length),style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:11,cursor:"pointer",padding:"0 4px"},children:J.statusBar.providerSummary(x,o.length)}),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(nx,{p,onClick:h},p.id))})]})}return n.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>n.jsx(nx,{p:x,onClick:h,compact:!0},x.id))})}function nx({p:a,onClick:r,compact:i}){const o=a.available?J.statusBar.unlocked(a.label):a.kind==="cli-install"?J.statusBar.lockedCli(a.label):J.statusBar.locked(a.label);return n.jsxs("button",{type:"button","data-testid":`provider-glyph-${a.id}`,"data-available":a.available,"aria-label":o,title:o,onClick:()=>r(a),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:a.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:i?"2px":"4px 6px",fontSize:11},children:[n.jsx(rd,{unlocked:a.available,size:10}),!i&&n.jsx("span",{children:a.label})]})}function y0(){try{return typeof localStorage>"u"?null:localStorage.getItem(uo)}catch{return null}}function b0({projectPath:a,modelName:r,health:i="ok",onPathClick:o,providers:u,onOpenProviderSettings:m,onOpenProviderInstallHelp:f}){const{mode:h,resolvedTheme:x,setTheme:p}=sv(),g=y0()==="auto",j=j0(h,x,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.jsx("span",{title:r??"",style:{fontFamily:"var(--font-mono)"},children:r??"—"}),n.jsx(ax,{}),n.jsxs("span",{"aria-label":`Health: ${i}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[n.jsx(S0,{color:S}),n.jsx("span",{style:{textTransform:"capitalize"},children:i})]}),u&&u.length>0&&n.jsxs(n.Fragment,{children:[n.jsx(ax,{}),n.jsx(g0,{providers:u,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: ${h} — click for ${j}`,style:{display:"inline-flex",alignItems:"center",gap:6,background:"transparent",border:"1px solid var(--border-default)",padding:"2px 8px",borderRadius:4,color:"var(--text-secondary)",cursor:"pointer",fontSize:11,height:20},children:[n.jsx(k0,{mode:h}),n.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function j0(a,r,i){return a==="light"?"dark":a==="dark"?"auto":i?"light":r==="light"?"dark":"light"}function S0({color:a}){return n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:a,display:"inline-block",flexShrink:0}})}function ax(){return n.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function k0({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 fo=0,Fa=1,xr=2,iv=4;function lx(a){return()=>a}function w0(a){a()}function ov(a,r){return i=>a(r(i))}function rx(a,r){return()=>a(r)}function C0(a,r){return i=>a(r,i)}function bd(a){return a!==void 0}function N0(...a){return()=>{a.map(w0)}}function vr(){}function po(a,r){return r(a),a}function E0(a,r){return r(a)}function ht(...a){return a}function et(a,r){return a(Fa,r)}function He(a,r){a(fo,r)}function jd(a){a(xr)}function yt(a){return a(iv)}function Ce(a,r){return et(a,C0(r,fo))}function $n(a,r){const i=a(Fa,o=>{i(),r(o)});return i}function sx(a){let r,i;return o=>u=>{r=u,i&&clearTimeout(i),i=setTimeout(()=>{o(r)},a)}}function cv(a,r){return a===r}function mt(a=cv){let r;return i=>o=>{a(r,o)||(r=o,i(o))}}function Ae(a){return r=>i=>{a(i)&&r(i)}}function je(a){return r=>ov(r,a)}function Fn(a){return r=>()=>{r(a)}}function ce(a,...r){const i=T0(...r);return((o,u)=>{switch(o){case xr:jd(a);return;case Fa:return et(a,i(u))}})}function Wn(a,r){return i=>o=>{i(r=a(r,o))}}function yl(a){return r=>i=>{a>0?a--:r(i)}}function va(a){let r=null,i;return o=>u=>{r=u,!i&&(i=setTimeout(()=>{i=void 0,o(r)},a))}}function $e(...a){const r=new Array(a.length);let i=0,o=null;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{const p=i;i|=h,r[f]=x,p!==u&&i===u&&o&&(o(),o=null)})}),m=>f=>{const h=()=>{m([f].concat(r))};i===u?h():o=h}}function T0(...a){return r=>a.reduceRight(E0,r)}function R0(a){let r,i;const o=()=>r==null?void 0:r();return function(u,m){switch(u){case Fa:return m?i===m?void 0:(o(),i=m,r=et(a,m),r):(o(),vr);case xr:o(),i=null;return}}}function pe(a){let r=a;const i=We();return((o,u)=>{switch(o){case fo:r=u;break;case Fa:{u(r);break}case iv:return r}return i(o,u)})}function Xt(a,r){return po(pe(r),i=>Ce(a,i))}function We(){const a=[];return((r,i)=>{switch(r){case fo:a.slice().forEach(o=>{o(i)});return;case xr:a.splice(0,a.length);return;case Fa:return a.push(i),()=>{const o=a.indexOf(i);o>-1&&a.splice(o,1)}}})}function jn(a){return po(We(),r=>Ce(a,r))}function Ze(a,r=[],{singleton:i}={singleton:!0}){return{constructor:a,dependencies:r,id:A0(),singleton:i}}const A0=()=>Symbol();function M0(a){const r=new Map,i=({constructor:o,dependencies:u,id:m,singleton:f})=>{if(f&&r.has(m))return r.get(m);const h=o(u.map(x=>i(x)));return f&&r.set(m,h),h};return i(a)}function Lt(...a){const r=We(),i=new Array(a.length);let o=0;const u=2**a.length-1;return a.forEach((m,f)=>{const h=2**f;et(m,x=>{i[f]=x,o|=h,o===u&&He(r,i)})}),function(m,f){switch(m){case xr:{jd(r);return}case Fa:return o===u&&f(i),et(r,f)}}}function Re(a,r=cv){return ce(a,mt(r))}function sd(...a){return function(r,i){switch(r){case xr:return;case Fa:return N0(...a.map(o=>et(o,i)))}}}const Bt={DEBUG:0,INFO:1,WARN:2,ERROR:3},D0={[Bt.DEBUG]:"debug",[Bt.ERROR]:"error",[Bt.INFO]:"log",[Bt.WARN]:"warn"},z0=()=>typeof globalThis>"u"?window:globalThis,Wa=Ze(()=>{const a=pe(Bt.ERROR);return{log:pe((r,i,o=Bt.INFO)=>{const u=z0().VIRTUOSO_LOG_LEVEL??yt(a);o>=u&&console[D0[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",r,i)}),logLevel:a}},[],{singleton:!0});function jl(a,r,i){return Sd(a,r,i).callbackRef}function Sd(a,r,i){const o=we.useRef(null);let u=f=>{};const m=we.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(f=>{const h=()=>{const x=f[0].target;x.offsetParent!==null&&a(x)};i?h():requestAnimationFrame(h)}):null,[a,i]);return u=f=>{f&&r?(m==null||m.observe(f),o.current=f):(o.current&&(m==null||m.unobserve(o.current)),o.current=null)},{callbackRef:u,ref:o}}function L0(a,r,i,o,u,m,f,h,x){const p=we.useCallback(y=>{const g=_0(y.children,r,h?"offsetWidth":"offsetHeight",u);let j=y.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 D=f?h?f.scrollLeft:f.scrollTop:S?h?C.scrollX||C.document.documentElement.scrollLeft:C.scrollY||C.document.documentElement.scrollTop:h?j.scrollLeft:j.scrollTop,E=f?h?f.scrollWidth:f.scrollHeight:S?h?C.document.documentElement.scrollWidth:C.document.documentElement.scrollHeight:h?j.scrollWidth:j.scrollHeight,k=f?h?f.offsetWidth:f.offsetHeight:S?h?C.innerWidth:C.innerHeight:h?j.offsetWidth:j.offsetHeight;o({scrollHeight:E,scrollTop:Math.max(D,0),viewportHeight:k}),m==null||m(h?ix("column-gap",getComputedStyle(y).columnGap,u):ix("row-gap",getComputedStyle(y).rowGap,u)),g!==null&&a(g)},[a,r,u,m,f,o,h]);return Sd(p,i,x)}function _0(a,r,i,o){const u=a.length;if(u===0)return null;const m=[];for(let f=0;f<u;f++){const h=a.item(f);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),p=parseFloat(h.dataset.knownSize),y=r(h,i);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Bt.ERROR),y===p)continue;const g=m[m.length-1];m.length===0||g.size!==y||g.endIndex!==x-1?m.push({endIndex:x,size:y,startIndex:x}):m[m.length-1].endIndex++}return m}function ix(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 uv(a,r,i){const o=we.useRef(null),u=we.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const p=x.getBoundingClientRect(),y=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:y},a(o.current)},[a,r]),{callbackRef:m,ref:f}=Sd(u,!0,i),h=we.useCallback(()=>{u(f.current)},[u,f]);return we.useEffect(()=>{var p;if(r){r.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(r),()=>{r.removeEventListener("scroll",h),y.unobserve(r)}}const x=(p=f.current)==null?void 0:p.ownerDocument.defaultView;return x==null||x.addEventListener("scroll",h),x==null||x.addEventListener("resize",h),()=>{x==null||x.removeEventListener("scroll",h),x==null||x.removeEventListener("resize",h)}},[h,r,f]),m}const an=Ze(()=>{const a=We(),r=We(),i=pe(0),o=We(),u=pe(0),m=We(),f=We(),h=pe(0),x=pe(0),p=pe(0),y=pe(0),g=We(),j=We(),S=pe(!1),C=pe(!1),D=pe(!1);return Ce(ce(a,je(({scrollTop:E})=>E)),r),Ce(ce(a,je(({scrollHeight:E})=>E)),f),Ce(r,u),{deviation:i,fixedFooterHeight:p,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:C,scrollBy:j,scrollContainerState:a,scrollHeight:f,scrollingInProgress:S,scrollTo:g,scrollTop:r,skipAnimationFrameInResizeObserver:D,smoothScrollTargetReached:o,statefulScrollTop:u,viewportHeight:m}},[],{singleton:!0}),js={lvl:0};function dv(a,r){const i=a.length;if(i===0)return[];let{index:o,value:u}=r(a[0]);const m=[];for(let f=1;f<i;f++){const{index:h,value:x}=r(a[f]);m.push({end:h-1,start:o,value:u}),o=h,u=x}return m.push({end:1/0,start:o,value:u}),m}function ot(a){return a===js}function Ss(a,r){if(!ot(a))return r===a.k?a.v:r<a.k?Ss(a.l,r):Ss(a.r,r)}function Gn(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=Gn(a.r,r,i);return o[0]===-1/0?[a.k,a.v]:o}return Gn(a.l,r,i)}function yn(a,r,i){return ot(a)?mv(r,i,1):r===a.k?Ot(a,{k:r,v:i}):r<a.k?ox(Ot(a,{l:yn(a.l,r,i)})):ox(Ot(a,{r:yn(a.r,r,i)}))}function ur(){return js}function dr(a,r,i){if(ot(a))return[];const o=Gn(a,r)[0];return O0(od(a,o,i))}function id(a,r){if(ot(a))return js;const{k:i,l:o,r:u}=a;if(r===i){if(ot(o))return u;if(ot(u))return o;const[m,f]=pv(o);return eo(Ot(a,{k:m,l:fv(o),v:f}))}return r<i?eo(Ot(a,{l:id(o,r)})):eo(Ot(a,{r:id(u,r)}))}function gl(a){return ot(a)?[]:[...gl(a.l),{k:a.k,v:a.v},...gl(a.r)]}function od(a,r,i){if(ot(a))return[];const{k:o,l:u,r:m,v:f}=a;let h=[];return o>r&&(h=h.concat(od(u,r,i))),o>=r&&o<=i&&h.push({k:o,v:f}),o<=i&&(h=h.concat(od(m,r,i))),h}function eo(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(Iu(r))return hv(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(Iu(a))return cd(Ot(a,{lvl:i-1}));if(!ot(o)&&!ot(o.l)){const u=o.l,m=Iu(u)?o.lvl-1:o.lvl;return Ot(u,{l:Ot(a,{lvl:i-1,r:u.l}),lvl:u.lvl+1,r:cd(Ot(o,{l:u.r,lvl:m}))})}throw new Error("Unexpected empty nodes")}function Ot(a,r){return mv(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 fv(a){return ot(a.r)?a.l:eo(Ot(a,{r:fv(a.r)}))}function Iu(a){return ot(a)||a.lvl>a.r.lvl}function pv(a){return ot(a.r)?[a.k,a.v]:pv(a.r)}function mv(a,r,i,o=js,u=js){return{k:a,l:o,lvl:i,r:u,v:r}}function ox(a){return cd(hv(a))}function hv(a){const{l:r}=a;return!ot(r)&&r.lvl===a.lvl?Ot(r,{r:Ot(a,{l:r.r})}):a}function cd(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 O0(a){return dv(a,({k:r,v:i})=>({index:r,value:i}))}function xv(a,r){return!!(a&&a.startIndex===r.startIndex&&a.endIndex===r.endIndex)}function ks(a,r){return!!(a&&a[0]===r[0]&&a[1]===r[1])}const kd=Ze(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function vv(a,r,i){return a[ro(a,r,i)]}function ro(a,r,i,o=0){let u=a.length-1;for(;o<=u;){const m=Math.floor((o+u)/2),f=a[m],h=i(f,r);if(h===0)return m;if(h===-1){if(u-o<2)return m-1;u=m-1}else{if(u===o)return m;o=m+1}}throw new Error(`Failed binary finding record in array - ${a.join(",")}, searched for ${r}`)}function B0(a,r,i,o){const u=ro(a,r,o),m=ro(a,i,o,u);return a.slice(u,m+1)}function Ka(a,r){return Math.round(a.getBoundingClientRect()[r])}function mo(a){return!ot(a.groupOffsetTree)}function wd({index:a},r){return r===a?0:r<a?-1:1}function U0(){return{groupIndices:[],groupOffsetTree:ur(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:ur()}}function H0(a,r){let i=ot(a)?0:1/0;for(const o of r){const{endIndex:u,size:m,startIndex:f}=o;if(i=Math.min(i,f),ot(a)){a=yn(a,0,m);continue}const h=dr(a,f-1,u+1);if(h.some(P0(o)))continue;let x=!1,p=!1;for(const{end:y,start:g,value:j}of h)x?(u>=g||m===j)&&(a=id(a,g)):(p=j!==m,x=!0),y>u&&u>=g&&j!==m&&(a=yn(a,u+1,j));p&&(a=yn(a,f,m))}return[a,i]}function I0(a){return typeof a.groupIndex<"u"}function V0({offset:a},r){return r===a?0:r<a?-1:1}function ws(a,r,i){if(r.length===0)return 0;const{index:o,offset:u,size:m}=vv(r,a,wd),f=a-o,h=m*f+(f-1)*i+u;return h>0?h+i:h}function gv(a,r){if(!mo(r))return a;let i=0;for(;r.groupIndices[i]<=a+i;)i++;return a+i}function yv(a,r,i){if(I0(a))return r.groupIndices[a.groupIndex]+1;const o=a.index==="LAST"?i:a.index;let u=gv(o,r);return u=Math.max(0,u,Math.min(i,u)),u}function $0(a,r,i,o=0){return o>0&&(r=Math.max(r,vv(a,o,wd).offset)),dv(B0(a,r,i,V0),Y0)}function G0(a,[r,i,o,u]){r.length>0&&o("received item sizes",r,Bt.DEBUG);const m=a.sizeTree;let f=m,h=0;if(i.length>0&&ot(m)&&r.length===2){const j=r[0].size,S=r[1].size;f=i.reduce((C,D)=>yn(yn(C,D,j),D+1,S),f)}else[f,h]=H0(f,r);if(f===m)return a;const{lastIndex:x,lastOffset:p,lastSize:y,offsetTree:g}=ud(a.offsetTree,h,f,u);return{groupIndices:i,groupOffsetTree:i.reduce((j,S)=>yn(j,S,ws(S,g,u)),ur()),lastIndex:x,lastOffset:p,lastSize:y,offsetTree:g,sizeTree:f}}function q0(a){return gl(a).map(({k:r,v:i},o,u)=>{const m=u[o+1];return{endIndex:m!==void 0?m.k-1:1/0,size:i,startIndex:r}})}function cx(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 ud(a,r,i,o){let u=a,m=0,f=0,h=0,x=0;if(r!==0){x=ro(u,r-1,wd),h=u[x].offset;const p=Gn(i,r-1);m=p[0],f=p[1],u.length&&u[x].size===Gn(i,r)[1]&&(x-=1),u=u.slice(0,x+1)}else u=[];for(const{start:p,value:y}of dr(i,r,1/0)){const g=p-m,j=g*f+h+g*o;u.push({index:p,offset:j,size:y}),m=p,h=j,f=y}return{lastIndex:m,lastOffset:h,lastSize:f,offsetTree:u}}function Y0(a){return{index:a.index,value:a}}function P0(a){const{endIndex:r,size:i,startIndex:o}=a;return u=>u.start===o&&(u.end===r||u.end===1/0)&&u.value===i}const K0={offsetHeight:"height",offsetWidth:"width"},Qn=Ze(([{log:a},{recalcInProgress:r}])=>{const i=We(),o=We(),u=Xt(o,0),m=We(),f=We(),h=pe(0),x=pe([]),p=pe(void 0),y=pe(void 0),g=pe(void 0),j=pe(void 0),S=pe((N,M)=>Ka(N,K0[M])),C=pe(void 0),D=pe(0),E=U0(),k=Xt(ce(i,$e(x,a,D),Wn(G0,E),mt()),E),T=Xt(ce(x,mt(),Wn((N,M)=>({current:M,prev:N.current}),{current:[],prev:[]}),je(({prev:N})=>N)),[]);Ce(ce(x,Ae(N=>N.length>0),$e(k,D),je(([N,M,R])=>{const H=N.reduce((q,P,te)=>yn(q,P,ws(P,M.offsetTree,R)||te),ur());return{...M,groupIndices:N,groupOffsetTree:H}})),k),Ce(ce(o,$e(k),Ae(([N,{lastIndex:M}])=>N<M),je(([N,{lastIndex:M,lastSize:R}])=>[{endIndex:M,size:R,startIndex:N}])),i),Ce(p,y);const L=Xt(ce(p,je(N=>N===void 0)),!0);Ce(ce(y,Ae(N=>N!==void 0&&ot(yt(k).sizeTree)),je(N=>{const M=yt(g),R=yt(x).length>0;return M!==void 0&&M!==0?R?[{endIndex:0,size:M,startIndex:0},{endIndex:1,size:N,startIndex:1}]:[]:[{endIndex:0,size:N,startIndex:0}]})),i),Ce(ce(j,Ae(N=>N!==void 0&&N.length>0&&ot(yt(k).sizeTree)),je(N=>{const M=[];let R=N[0],H=0;for(let q=1;q<N.length;q++){const P=N[q];P!==R&&(M.push({endIndex:q-1,size:R,startIndex:H}),R=P,H=q)}return M.push({endIndex:N.length-1,size:R,startIndex:H}),M})),i),Ce(ce(x,$e(g,y),Ae(([,N,M])=>N!==void 0&&M!==void 0),je(([N,M,R])=>{const H=[];for(let q=0;q<N.length;q++){const P=N[q],te=N[q+1];H.push({startIndex:P,endIndex:P,size:M}),te!==void 0&&H.push({startIndex:P+1,endIndex:te-1,size:R})}return H})),i);const I=jn(ce(i,$e(k),Wn(({sizes:N},[M,R])=>({changed:R!==N,sizes:R}),{changed:!1,sizes:E}),je(N=>N.changed)));et(ce(h,Wn((N,M)=>({diff:N.prev-M,prev:M}),{diff:0,prev:0}),je(N=>N.diff)),N=>{const{groupIndices:M}=yt(k);if(N>0)He(r,!0),He(m,N+cx(N,M));else if(N<0){const R=yt(T);R.length>0&&(N-=cx(-N,R)),He(f,N)}}),et(ce(h,$e(a)),([N,M])=>{N<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Bt.ERROR)});const _=jn(m);Ce(ce(m,$e(k),je(([N,M])=>{const R=M.groupIndices.length>0,H=[],q=M.lastSize;if(R){const P=Ss(M.sizeTree,0);let te=0,X=0;for(;te<N;){const A=M.groupIndices[X],B=M.groupIndices.length===X+1?1/0:M.groupIndices[X+1]-A-1;H.push({endIndex:A,size:P,startIndex:A}),H.push({endIndex:A+1+B-1,size:q,startIndex:A+1}),X++,te+=B+1}const O=gl(M.sizeTree);return te!==N&&O.shift(),O.reduce((A,{k:B,v:se})=>{let Y=A.ranges;return A.prevSize!==0&&(Y=[...A.ranges,{endIndex:B+N-1,size:A.prevSize,startIndex:A.prevIndex}]),{prevIndex:B+N,prevSize:se,ranges:Y}},{prevIndex:N,prevSize:0,ranges:H}).ranges}return gl(M.sizeTree).reduce((P,{k:te,v:X})=>({prevIndex:te+N,prevSize:X,ranges:[...P.ranges,{endIndex:te+N-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:q,ranges:[]}).ranges})),i);const $=jn(ce(f,$e(k,D),je(([N,{offsetTree:M},R])=>{const H=-N;return ws(H,M,R)})));return Ce(ce(f,$e(k,D),je(([N,M,R])=>{if(M.groupIndices.length>0){if(ot(M.sizeTree))return M;let q=ur();const P=yt(T);let te=0,X=0,O=0;for(;te<-N;){O=P[X];const A=P[X+1]-O-1;X++,te+=A+1}if(q=gl(M.sizeTree).reduce((A,{k:B,v:se})=>yn(A,Math.max(0,B+N),se),q),te!==-N){const A=Ss(M.sizeTree,O);q=yn(q,0,A);const B=Gn(M.sizeTree,-N+1)[1];q=yn(q,1,B)}return{...M,sizeTree:q,...ud(M.offsetTree,0,q,R)}}const H=gl(M.sizeTree).reduce((q,{k:P,v:te})=>yn(q,Math.max(0,P+N),te),ur());return{...M,sizeTree:H,...ud(M.offsetTree,0,H,R)}})),k),{beforeUnshiftWith:_,data:C,defaultItemSize:y,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:g,gap:D,groupIndices:x,heightEstimates:j,itemSize:S,listRefresh:I,shiftWith:f,shiftWithOffset:$,sizeRanges:i,sizes:k,statefulTotalCount:u,totalCount:o,trackItemSizes:L,unshiftWith:m}},ht(Wa,kd),{singleton:!0});function F0(a){return a.reduce((r,i)=>(r.groupIndices.push(r.totalCount),r.totalCount+=i+1,r),{groupIndices:[],totalCount:0})}const bv=Ze(([{groupIndices:a,sizes:r,totalCount:i},{headerHeight:o,scrollTop:u}])=>{const m=We(),f=We(),h=jn(ce(m,je(F0)));return Ce(ce(h,je(x=>x.totalCount)),i),Ce(ce(h,je(x=>x.groupIndices)),a),Ce(ce(Lt(u,r,o),Ae(([x,p])=>mo(p)),je(([x,p,y])=>Gn(p.groupOffsetTree,Math.max(x-y,0),"v")[0]),mt(),je(x=>[x])),f),{groupCounts:m,topItemsIndexes:f}},ht(Qn,an)),Qa=Ze(([{log:a}])=>{const r=pe(!1),i=jn(ce(r,Ae(o=>o),mt()));return et(r,o=>{o&&yt(a)("props updated",{},Bt.DEBUG)}),{didMount:i,propsReady:r}},ht(Wa),{singleton:!0}),W0=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function jv(a){const r=typeof a=="number"?{index:a}:a;return r.align||(r.align="start"),(!r.behavior||!W0)&&(r.behavior="auto"),r.offset===void 0&&(r.offset=0),r}const Ts=Ze(([{gap:a,listRefresh:r,sizes:i,totalCount:o},{fixedFooterHeight:u,fixedHeaderHeight:m,footerHeight:f,headerHeight:h,scrollingInProgress:x,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:g},{log:j}])=>{const S=We(),C=We(),D=pe(0);let E=null,k=null,T=null;function L(){E!==null&&(E(),E=null),T!==null&&(T(),T=null),k&&(clearTimeout(k),k=null),He(x,!1)}return Ce(ce(S,$e(i,g,o,D,h,f,j),$e(a,m,u),je(([[I,_,$,N,M,R,H,q],P,te,X])=>{const O=jv(I),{align:A,behavior:B,offset:se}=O,Y=N-1,me=yv(O,_,Y);let z=ws(me,_.offsetTree,P)+R;A==="end"?(z+=te+Gn(_.sizeTree,me)[1]-$+X,me===Y&&(z+=H)):A==="center"?z+=(te+Gn(_.sizeTree,me)[1]-$+X)/2:z-=M,se!==void 0&&se!==0&&(z+=se);const W=ie=>{L(),ie?(q("retrying to scroll to",{location:I},Bt.DEBUG),He(S,I)):(He(C,!0),q("list did not change, scroll successful",{},Bt.DEBUG))};if(L(),B==="smooth"){let ie=!1;T=et(r,de=>{ie=ie||de}),E=$n(y,()=>{W(ie)})}else E=$n(ce(r,Q0(150)),W);return k=setTimeout(()=>{L()},1200),He(x,!0),q("scrolling from index to",{behavior:B,index:me,top:z},Bt.DEBUG),{behavior:B,top:z}})),p),{scrollTargetReached:C,scrollToIndex:S,topListHeight:D}},ht(Qn,an,Wa),{singleton:!0});function Q0(a){return r=>{const i=setTimeout(()=>{r(!1)},a);return o=>{o&&(r(!0),clearTimeout(i))}}}function Cd(a,r){a===0?r():requestAnimationFrame(()=>{Cd(a-1,r)})}function Nd(a,r){const i=r-1;return typeof a=="number"?a:a.index==="LAST"?i:a.index}const Rs=Ze(([{defaultItemSize:a,listRefresh:r,sizes:i},{scrollTop:o},{scrollTargetReached:u,scrollToIndex:m},{didMount:f}])=>{const h=pe(!0),x=pe(0),p=pe(!0);return Ce(ce(f,$e(x),Ae(([y,g])=>g!==0),Fn(!1)),h),Ce(ce(f,$e(x),Ae(([y,g])=>g!==0),Fn(!1)),p),et(ce(Lt(r,f),$e(h,i,a,p),Ae(([[,y],g,{sizeTree:j},S,C])=>y&&(!ot(j)||bd(S))&&!g&&!C),$e(x)),([,y])=>{$n(u,()=>{He(p,!0)}),Cd(4,()=>{$n(o,()=>{He(h,!0)}),He(m,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:x,scrolledToInitialItem:h}},ht(Qn,an,Ts,Qa),{singleton:!0});function Sv(a,r){return Math.abs(a-r)<1.01}const Cs="up",gs="down",X0="none",Z0={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},J0=0,As=Ze(([{footerHeight:a,headerHeight:r,scrollBy:i,scrollContainerState:o,scrollTop:u,viewportHeight:m}])=>{const f=pe(!1),h=pe(!0),x=We(),p=We(),y=pe(4),g=pe(J0),j=Xt(ce(sd(ce(Re(u),yl(1),Fn(!0)),ce(Re(u),yl(1),Fn(!1),sx(100))),mt()),!1),S=Xt(ce(sd(ce(i,Fn(!0)),ce(i,Fn(!1),sx(200))),mt()),!1);Ce(ce(Lt(Re(u),Re(g)),je(([T,L])=>T<=L),mt()),h),Ce(ce(h,va(50)),p);const C=jn(ce(Lt(o,Re(m),Re(r),Re(a),Re(y)),Wn((T,[{scrollHeight:L,scrollTop:I},_,$,N,M])=>{const R=I+_-L>-M,H={scrollHeight:L,scrollTop:I,viewportHeight:_};if(R){let P,te;return I>T.state.scrollTop?(P="SCROLLED_DOWN",te=T.state.scrollTop-I):(P="SIZE_DECREASED",te=T.state.scrollTop-I||T.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:te,state:H}}let q;return H.scrollHeight>T.state.scrollHeight?q="SIZE_INCREASED":_<T.state.viewportHeight?q="VIEWPORT_HEIGHT_DECREASING":I<T.state.scrollTop?q="SCROLLING_UPWARDS":q="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:q,state:H}},Z0),mt((T,L)=>T!==void 0&&T.atBottom===L.atBottom))),D=Xt(ce(o,Wn((T,{scrollHeight:L,scrollTop:I,viewportHeight:_})=>{if(!Sv(T.scrollHeight,L)){const $=L-(I+_)<1;return T.scrollTop!==I&&$?{changed:!0,jump:T.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(T=>T.changed),je(T=>T.jump)),0);Ce(ce(C,je(T=>T.atBottom)),f),Ce(ce(f,va(50)),x);const E=pe(gs);Ce(ce(o,je(({scrollTop:T})=>T),mt(),Wn((T,L)=>yt(S)?{direction:T.direction,prevScrollTop:L}:{direction:L<T.prevScrollTop?Cs:gs,prevScrollTop:L},{direction:gs,prevScrollTop:0}),je(T=>T.direction)),E),Ce(ce(o,va(50),Fn(X0)),E);const k=pe(0);return Ce(ce(j,Ae(T=>!T),Fn(0)),k),Ce(ce(u,va(100),$e(j),Ae(([T,L])=>L),Wn(([T,L],[I])=>[L,I],[0,0]),je(([T,L])=>L-T)),k),{atBottomState:C,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:g,isAtBottom:f,isAtTop:h,isScrolling:j,lastJumpDueToItemResize:D,scrollDirection:E,scrollVelocity:k}},ht(an)),Ns="top",Es="bottom",ux="none";function dx(a,r,i){return typeof a=="number"?i===Cs&&r===Ns||i===gs&&r===Es?a:0:i===Cs?r===Ns?a.main:a.reverse:r===Es?a.main:a.reverse}function fx(a,r){return typeof a=="number"?a:a[r]??0}const Ed=Ze(([{deviation:a,fixedHeaderHeight:r,headerHeight:i,scrollTop:o,viewportHeight:u}])=>{const m=We(),f=pe(0),h=pe(0),x=pe(0),p=Xt(ce(Lt(Re(o),Re(u),Re(i),Re(m,ks),Re(x),Re(f),Re(r),Re(a),Re(h)),je(([y,g,j,[S,C],D,E,k,T,L])=>{const I=y-T,_=E+k,$=Math.max(j-I,0);let N=ux;const M=fx(L,Ns),R=fx(L,Es);return S-=T,S+=j+k,C+=j+k,C-=T,S>y+_-M&&(N=Cs),C<y-$+g+R&&(N=gs),N!==ux?[Math.max(I-j-dx(D,Ns,N)-M,0),I-$-k+g+dx(D,Es,N)+R]:null}),Ae(y=>y!==null),mt(ks)),[0,0]);return{increaseViewportBy:h,listBoundary:m,overscan:x,topListHeight:f,visibleRange:p}},ht(an),{singleton:!0});function ej(a,r,i){if(mo(r)){const o=gv(a,r);return[{index:Gn(r.groupOffsetTree,o)[0],offset:0,size:0},{data:i==null?void 0:i[0],index:o,offset:0,size:0}]}return[{data:i==null?void 0:i[0],index:a,offset:0,size:0}]}const Vu={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function to(a,r,i,o,u,m){const{lastIndex:f,lastOffset:h,lastSize:x}=u;let p=0,y=0;if(a.length>0){p=a[0].offset;const D=a[a.length-1];y=D.offset+D.size}const g=i-f,j=h+g*x+(g-1)*o,S=p,C=j-y;return{bottom:y,firstItemIndex:m,items:px(a,u,m),offsetBottom:C,offsetTop:p,top:S,topItems:px(r,u,m),topListHeight:r.reduce((D,E)=>E.size+D,0),totalCount:i}}function kv(a,r,i,o,u,m){let f=0;if(i.groupIndices.length>0)for(const y of i.groupIndices){if(y-f>=a)break;f++}const h=a+f,x=Nd(r,h),p=Array.from({length:h}).map((y,g)=>({data:m[g+x],index:g+x,offset:0,size:0}));return to(p,[],h,u,i,o)}function px(a,r,i){if(a.length===0)return[];if(!mo(r))return a.map(p=>({...p,index:p.index+i,originalIndex:p.index}));const o=a[0].index,u=a[a.length-1].index,m=[],f=dr(r.groupOffsetTree,o,u);let h,x=0;for(const p of a){(!h||h.end<p.index)&&(h=f.shift(),x=r.groupIndices.indexOf(h.start));let y;p.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:p.index-(x+1)+i},m.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return m}function mx(a,r){return a===void 0?0:typeof a=="number"?a:a[r]??0}const Sl=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o,totalCount:u},m,{listBoundary:f,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:g},j,{didMount:S},{recalcInProgress:C}])=>{const D=pe([]),E=pe(0),k=We(),T=pe(0);Ce(m.topItemsIndexes,D);const L=Xt(ce(Lt(S,C,Re(x,ks),Re(u),Re(o),Re(p),y,Re(D),Re(r),Re(i),Re(T),a),Ae(([N,M,,R,,,,,,,,H])=>{const q=H!==void 0&&H.length!==R;return N&&!M&&!q}),je(([,,[N,M],R,H,q,P,te,X,O,A,B])=>{var ve,Ie;const se=H,{offsetTree:Y,sizeTree:me}=se,z=yt(E);if(R===0)return{...Vu,totalCount:R};if(N===0&&M===0)return z===0?{...Vu,totalCount:R}:kv(z,q,H,X,O,B||[]);if(ot(me))return z>0?null:to(ej(Nd(q,R),se,B),[],R,O,se,X);const W=[];if(te.length>0){const Be=te[0],ne=te[te.length-1];let fe=0;for(const ue of dr(me,Be,ne)){const he=ue.value,be=Math.max(ue.start,Be),_e=Math.min(ue.end,ne);for(let Me=be;Me<=_e;Me++)W.push({data:B==null?void 0:B[Me],index:Me,offset:fe,size:he}),fe+=he}}if(!P)return to([],W,R,O,se,X);const ie=te.length>0?te[te.length-1]+1:0,de=$0(Y,N,M,ie);if(de.length===0)return null;const ge=R-1,xe=po([],Be=>{for(const ne of de){const fe=ne.value;let ue=fe.offset,he=ne.start;const be=fe.size;if(fe.offset<N){he+=Math.floor((N-fe.offset+O)/(be+O));const Me=he-ne.start;ue+=Me*be+Me*O}he<ie&&(ue+=(ie-he)*be,he=ie);const _e=Math.min(ne.end,ge);for(let Me=he;Me<=_e&&!(ue>=M);Me++)Be.push({data:B==null?void 0:B[Me],index:Me,offset:ue,size:be}),ue+=be+O}}),oe=mx(A,Ns),ae=mx(A,Es);if(xe.length>0&&(oe>0||ae>0)){const Be=xe[0],ne=xe[xe.length-1];if(oe>0&&Be.index>ie){const fe=Math.min(oe,Be.index-ie),ue=[];let he=Be.offset;for(let be=Be.index-1;be>=Be.index-fe;be--){const _e=((ve=dr(me,be,be)[0])==null?void 0:ve.value)??Be.size;he-=_e+O,ue.unshift({data:B==null?void 0:B[be],index:be,offset:he,size:_e})}xe.unshift(...ue)}if(ae>0&&ne.index<ge){const fe=Math.min(ae,ge-ne.index);let ue=ne.offset+ne.size+O;for(let he=ne.index+1;he<=ne.index+fe;he++){const be=((Ie=dr(me,he,he)[0])==null?void 0:Ie.value)??ne.size;xe.push({data:B==null?void 0:B[he],index:he,offset:ue,size:be}),ue+=be+O}}}return to(xe,W,R,O,se,X)}),Ae(N=>N!==null),mt()),Vu);Ce(ce(a,Ae(bd),je(N=>N==null?void 0:N.length)),u),Ce(ce(L,je(N=>N.topListHeight)),g),Ce(g,h),Ce(ce(L,je(N=>[N.top,N.bottom])),f),Ce(ce(L,je(N=>N.items)),k);const I=jn(ce(L,Ae(({items:N})=>N.length>0),$e(u,a),Ae(([{items:N},M])=>N[N.length-1].originalIndex===M-1),je(([,N,M])=>[N-1,M]),mt(ks),je(([N])=>N))),_=jn(ce(L,va(200),Ae(({items:N,topItems:M})=>N.length>0&&N[0].originalIndex===M.length),je(({items:N})=>N[0].index),mt())),$=jn(ce(L,Ae(({items:N})=>N.length>0),je(({items:N})=>{let M=0,R=N.length-1;for(;N[M].type==="group"&&M<R;)M++;for(;N[R].type==="group"&&R>M;)R--;return{endIndex:N[R].index,startIndex:N[M].index}}),mt(xv)));return{endReached:I,initialItemCount:E,itemsRendered:k,listState:L,minOverscanItemCount:T,rangeChanged:$,startReached:_,topItemsIndexes:D,...j}},ht(Qn,bv,Ed,Rs,Ts,As,Qa,kd),{singleton:!0}),wv=Ze(([{fixedFooterHeight:a,fixedHeaderHeight:r,footerHeight:i,headerHeight:o},{listState:u}])=>{const m=We(),f=Xt(ce(Lt(i,a,o,r,u),je(([h,x,p,y,g])=>h+x+p+y+g.offsetBottom+g.bottom)),0);return Ce(Re(f),m),{totalListHeight:f,totalListHeightChanged:m}},ht(an,Sl),{singleton:!0}),tj=Ze(([{viewportHeight:a},{totalListHeight:r}])=>{const i=pe(!1),o=Xt(ce(Lt(i,a,r),Ae(([u])=>u),je(([,u,m])=>Math.max(0,u-m)),va(0),mt()),0);return{alignToBottom:i,paddingTopAddition:o}},ht(an,wv),{singleton:!0}),Cv=Ze(()=>({context:pe(null)})),nj=({itemBottom:a,itemTop:r,locationParams:{align:i,behavior:o,...u},viewportBottom:m,viewportTop:f})=>r<f?{...u,align:i??"start",...o!==void 0?{behavior:o}:{}}:a>m?{...u,align:i??"end",...o!==void 0?{behavior:o}:{}}:null,Nv=Ze(([{gap:a,sizes:r,totalCount:i},{fixedFooterHeight:o,fixedHeaderHeight:u,headerHeight:m,scrollingInProgress:f,scrollTop:h,viewportHeight:x},{scrollToIndex:p}])=>{const y=We();return Ce(ce(y,$e(r,x,i,m,u,o,h),$e(a),je(([[g,j,S,C,D,E,k,T],L])=>{const{calculateViewLocation:I=nj,done:_,...$}=g,N=yv(g,j,C-1),M=ws(N,j.offsetTree,L)+D+E,R=M+Gn(j.sizeTree,N)[1],H=T+E,q=T+S-k,P=I({itemBottom:R,itemTop:M,locationParams:$,viewportBottom:q,viewportTop:H});return P!==null?_&&$n(ce(f,Ae(te=>!te),yl(yt(f)?1:2)),_):_==null||_(),P}),Ae(g=>g!==null)),p),{scrollIntoView:y}},ht(Qn,an,Ts,Sl,Wa),{singleton:!0});function hx(a){return a===!1?!1:a==="smooth"?"smooth":"auto"}const aj=(a,r)=>typeof a=="function"?hx(a(r)):r&&hx(a),lj=Ze(([{listRefresh:a,totalCount:r,fixedItemSize:i,data:o},{atBottomState:u,isAtBottom:m},{scrollToIndex:f},{scrolledToInitialItem:h},{didMount:x,propsReady:p},{log:y},{scrollingInProgress:g},{context:j},{scrollIntoView:S}])=>{const C=pe(!1),D=We();let E=null;function k(_){He(f,{align:"end",behavior:_,index:"LAST"})}et(ce(Lt(ce(Re(r),yl(1)),x),$e(Re(C),m,h,g),je(([[_,$],N,M,R,H])=>{let q=$&&R,P="auto";return q&&(P=aj(N,M||H),q=q&&P!==!1),{followOutputBehavior:P,shouldFollow:q,totalCount:_}}),Ae(({shouldFollow:_})=>_)),({followOutputBehavior:_,totalCount:$})=>{E!==null&&(E(),E=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("following output to ",{totalCount:$},Bt.DEBUG),k(_)}):E=$n(a,()=>{yt(y)("following output to ",{totalCount:$},Bt.DEBUG),k(_),E=null})});function T(_){const $=$n(u,N=>{_&&!N.atBottom&&N.notAtBottomBecause==="SIZE_INCREASED"&&E===null&&(yt(y)("scrolling to bottom due to increased size",{},Bt.DEBUG),k("auto"))});setTimeout($,100)}et(ce(Lt(Re(C),r,p),Ae(([_,,$])=>_!==!1&&$),Wn(({value:_},[,$])=>({refreshed:_===$,value:$}),{refreshed:!1,value:0}),Ae(({refreshed:_})=>_),$e(C,r)),([,_])=>{yt(h)&&T(_!==!1)}),et(D,()=>{T(yt(C)!==!1)}),et(Lt(Re(C),u),([_,$])=>{_!==!1&&!$.atBottom&&$.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&k("auto")});const L=pe(null),I=We();return Ce(sd(ce(Re(o),je(_=>(_==null?void 0:_.length)??0)),ce(Re(r))),I),et(ce(Lt(ce(I,yl(1)),x),$e(Re(L),h,g,j),je(([[_,$],N,M,R,H])=>$&&M&&(N==null?void 0:N({context:H,totalCount:_,scrollingInProgress:R}))),Ae(_=>!!_),va(0)),_=>{E!==null&&(E(),E=null),yt(i)!==void 0?requestAnimationFrame(()=>{yt(y)("scrolling into view",{}),He(S,_)}):E=$n(a,()=>{yt(y)("scrolling into view",{}),He(S,_),E=null})}),{autoscrollToBottom:D,followOutput:C,scrollIntoViewOnChange:L}},ht(Qn,As,Ts,Rs,Qa,Wa,an,Cv,Nv)),rj=Ze(([{data:a,firstItemIndex:r,gap:i,sizes:o},{initialTopMostItemIndex:u},{initialItemCount:m,listState:f},{didMount:h}])=>(Ce(ce(h,$e(m),Ae(([,x])=>x!==0),$e(u,o,r,i,a),je(([[,x],p,y,g,j,S=[]])=>kv(x,p,y,g,j,S))),f),{}),ht(Qn,Rs,Sl,Qa),{singleton:!0}),sj=Ze(([{didMount:a},{scrollTo:r},{listState:i}])=>{const o=pe(0);return et(ce(a,$e(o),Ae(([,u])=>u!==0),je(([,u])=>({top:u}))),u=>{$n(ce(i,yl(1),Ae(m=>m.items.length>1)),()=>{requestAnimationFrame(()=>{He(r,u)})})}),{initialScrollTop:o}},ht(Qa,an,Sl),{singleton:!0}),Ev=Ze(([{scrollVelocity:a}])=>{const r=pe(!1),i=We(),o=pe(!1);return Ce(ce(a,$e(o,r,i),Ae(([u,m])=>m!==!1&&m!==void 0),je(([u,m,f,h])=>{const{enter:x,exit:p}=m;if(f){if(p(u,h))return!1}else if(x(u,h))return!0;return f}),mt()),r),et(ce(Lt(r,a,i),$e(o)),([[u,m,f],h])=>{u&&h!==!1&&h!==void 0&&h.change&&h.change(m,f)}),{isSeeking:r,scrollSeekConfiguration:o,scrollSeekRangeChanged:i,scrollVelocity:a}},ht(As),{singleton:!0}),Td=Ze(([{scrollContainerState:a,scrollTo:r}])=>{const i=We(),o=We(),u=We(),m=pe(!1),f=pe(void 0);return Ce(ce(Lt(i,o),je(([{scrollTop:h,viewportHeight:x},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-p),viewportHeight:x}))),a),Ce(ce(r,$e(o),je(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),u),{customScrollParent:f,useWindowScroll:m,windowScrollContainerState:i,windowScrollTo:u,windowViewportRect:o}},ht(an)),ij=Ze(([{sizeRanges:a,sizes:r},{headerHeight:i,scrollTop:o},{initialTopMostItemIndex:u},{didMount:m},{useWindowScroll:f,windowScrollContainerState:h,windowViewportRect:x}])=>{const p=We(),y=pe(void 0),g=pe(null),j=pe(null);return Ce(h,g),Ce(x,j),et(ce(p,$e(r,o,f,g,j,i)),([S,C,D,E,k,T,L])=>{const I=q0(C.sizeTree);E&&k!==null&&T!==null&&(D=k.scrollTop-T.offsetTop),D-=L,S({ranges:I,scrollTop:D})}),Ce(ce(y,Ae(bd),je(oj)),u),Ce(ce(m,$e(y),Ae(([,S])=>S!==void 0),mt(),je(([,S])=>S.ranges)),a),{getState:p,restoreStateFrom:y}},ht(Qn,an,Rs,Qa,Td));function oj(a){return{align:"start",index:0,offset:a.scrollTop}}const cj=Ze(([{topItemsIndexes:a}])=>{const r=pe(0);return Ce(ce(r,Ae(i=>i>=0),je(i=>Array.from({length:i}).map((o,u)=>u))),a),{topItemCount:r}},ht(Sl));function Tv(a){let r=!1,i;return(()=>(r||(r=!0,i=a()),i))}const uj=Tv(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),dj=Ze(([{deviation:a,scrollBy:r,scrollingInProgress:i,scrollTop:o},{isAtBottom:u,isScrolling:m,lastJumpDueToItemResize:f,scrollDirection:h},{listState:x},{beforeUnshiftWith:p,gap:y,shiftWithOffset:g,sizes:j},{log:S},{recalcInProgress:C}])=>{const D=jn(ce(x,$e(f),Wn(([,k,T,L],[{bottom:I,items:_,offsetBottom:$,totalCount:N},M])=>{const R=I+$;let H=0;return T===N&&k.length>0&&_.length>0&&(_[0].originalIndex===0&&k[0].originalIndex===0||(H=R-L,H!==0&&(H+=M))),[H,_,N,R]},[0,[],0,0]),Ae(([k])=>k!==0),$e(o,h,i,u,S,C),Ae(([,k,T,L,,,I])=>!I&&!L&&k!==0&&T===Cs),je(([[k],,,,,T])=>(T("Upward scrolling compensation",{amount:k},Bt.DEBUG),k))));function E(k){k>0?(He(r,{behavior:"auto",top:-k}),He(a,0)):(He(a,0),He(r,{behavior:"auto",top:-k}))}return et(ce(D,$e(a,m)),([k,T,L])=>{L&&uj()?He(a,T-k):E(-k)}),et(ce(Lt(Xt(m,!1),a,C),Ae(([k,T,L])=>!k&&!L&&T!==0),je(([k,T])=>T),va(1)),E),Ce(ce(g,je(k=>({top:-k}))),r),et(ce(p,$e(j,y),je(([k,{groupIndices:T,lastSize:L,sizeTree:I},_])=>{function $(q){return q*(L+_)}if(T.length===0)return $(k);let N=0;const M=Ss(I,0);let R=0,H=0;for(;R<k;){R++,N+=M;let q=T.length===H+1?1/0:T[H+1]-T[H]-1;R+q>k&&(N-=M,q=k-R+1),R+=q,N+=$(q),H++}return N})),k=>{He(a,k),requestAnimationFrame(()=>{He(r,{top:k}),requestAnimationFrame(()=>{He(a,0),He(C,!1)})})}),{deviation:a}},ht(an,As,Sl,Qn,Wa,kd)),fj=Ze(([a,r,i,o,u,m,f,h,x,p,y])=>({...a,...r,...i,...o,...u,...m,...f,...h,...x,...p,...y}),ht(Ed,rj,Qa,Ev,wv,sj,tj,Td,Nv,Wa,Cv)),Rv=Ze(([{data:a,defaultItemSize:r,firstItemIndex:i,fixedItemSize:o,fixedGroupSize:u,gap:m,groupIndices:f,heightEstimates:h,itemSize:x,sizeRanges:p,sizes:y,statefulTotalCount:g,totalCount:j,trackItemSizes:S},{initialItemFinalLocationReached:C,initialTopMostItemIndex:D,scrolledToInitialItem:E},k,T,L,I,{scrollToIndex:_},$,{topItemCount:N},{groupCounts:M},R])=>{const{listState:H,minOverscanItemCount:q,topItemsIndexes:P,rangeChanged:te,...X}=I;return Ce(te,R.scrollSeekRangeChanged),Ce(ce(R.windowViewportRect,je(O=>O.visibleHeight)),k.viewportHeight),{data:a,defaultItemHeight:r,firstItemIndex:i,fixedItemHeight:o,fixedGroupHeight:u,gap:m,groupCounts:M,heightEstimates:h,initialItemFinalLocationReached:C,initialTopMostItemIndex:D,scrolledToInitialItem:E,sizeRanges:p,topItemCount:N,topItemsIndexes:P,totalCount:j,...L,groupIndices:f,itemSize:x,listState:H,minOverscanItemCount:q,scrollToIndex:_,statefulTotalCount:g,trackItemSizes:S,rangeChanged:te,...X,...R,...k,sizes:y,...T}},ht(Qn,Rs,an,ij,lj,Sl,Ts,dj,cj,bv,fj));function pj(a,r){const i={},o={};let u=0;const m=a.length;for(;u<m;)o[a[u]]=1,u+=1;for(const f in r)Object.hasOwn(o,f)||(i[f]=r[f]);return i}const Pi=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Av(a,r,i){const o=Object.keys(r.required||{}),u=Object.keys(r.optional||{}),m=Object.keys(r.methods||{}),f=Object.keys(r.events||{}),h=we.createContext({});function x(E,k){E.propsReady!==void 0&&He(E.propsReady,!1);for(const T of o){const L=E[r.required[T]];He(L,k[T])}for(const T of u)if(T in k){const L=E[r.optional[T]];He(L,k[T])}E.propsReady!==void 0&&He(E.propsReady,!0)}function p(E){return m.reduce((k,T)=>(k[T]=L=>{const I=E[r.methods[T]];He(I,L)},k),{})}function y(E){return f.reduce((k,T)=>(k[T]=R0(E[r.events[T]]),k),{})}const g=we.forwardRef(function(E,k){const{children:T,...L}=E,[I]=we.useState(()=>po(M0(a),N=>{x(N,L)})),[_]=we.useState(rx(y,I));Pi(()=>{for(const N of f)N in L&&et(_[N],L[N]);return()=>{Object.values(_).map(jd)}},[L,_,I]),Pi(()=>{x(I,L)}),we.useImperativeHandle(k,lx(p(I)));const $=i;return n.jsx(h.Provider,{value:I,children:i!==void 0?n.jsx($,{...pj([...o,...u,...f],L),children:T}):T})}),j=E=>{const k=we.useContext(h);return we.useCallback(T=>{He(k[E],T)},[k,E])},S=E=>{const k=we.useContext(h)[E],T=we.useCallback(L=>et(k,L),[k]);return we.useSyncExternalStore(T,()=>yt(k),()=>yt(k))},C=E=>{const k=we.useContext(h)[E],[T,L]=we.useState(rx(yt,k));return Pi(()=>et(k,I=>{I!==T&&L(lx(I))}),[k,T]),T},D=parseInt(we.version)>=18?S:C;return{Component:g,useEmitter:(E,k)=>{const T=we.useContext(h)[E];Pi(()=>et(T,k),[k,T])},useEmitterValue:D,usePublisher:j}}const Mv=we.createContext(void 0),Dv=we.createContext(void 0),$u="-webkit-sticky",xx="sticky",Rd=Tv(()=>{if(typeof document>"u")return xx;const a=document.createElement("div");return a.style.position=$u,a.style.position===$u?$u:xx}),zv=typeof document<"u"?we.useLayoutEffect:we.useEffect;function Gu(a){return"self"in a}function mj(a){return"body"in a}function Lv(a,r,i,o=vr,u,m){const f=we.useRef(null),h=we.useRef(null),x=we.useRef(null),p=we.useCallback(j=>{let S,C,D;const E=j.target;if(mj(E)||Gu(E)){const T=Gu(E)?E:E.defaultView;D=m===!0?T.scrollX:T.scrollY,S=m===!0?T.document.documentElement.scrollWidth:T.document.documentElement.scrollHeight,C=m===!0?T.innerWidth:T.innerHeight}else D=m===!0?E.scrollLeft:E.scrollTop,S=m===!0?E.scrollWidth:E.scrollHeight,C=m===!0?E.offsetWidth:E.offsetHeight;const k=()=>{a({scrollHeight:S,scrollTop:Math.max(D,0),viewportHeight:C})};j.suppressFlushSync===!0?k():db.flushSync(k),h.current!==null&&(D===h.current||D<=0||D===S-C)&&(h.current=null,r(!0),x.current&&(clearTimeout(x.current),x.current=null))},[a,r,m]);we.useEffect(()=>{const j=u||f.current;return o(u||f.current),p({suppressFlushSync:!0,target:j}),j.addEventListener("scroll",p,{passive:!0}),()=>{o(null),j.removeEventListener("scroll",p)}},[f,p,i,o,u]);function y(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 D,E,k;Gu(S)?(E=Math.max(Ka(S.document.documentElement,m===!0?"width":"height"),m===!0?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight),D=m===!0?S.innerWidth:S.innerHeight,k=m===!0?window.scrollX:window.scrollY):(E=S[m===!0?"scrollWidth":"scrollHeight"],D=Ka(S,m===!0?"width":"height"),k=S[m===!0?"scrollLeft":"scrollTop"]);const T=E-D;if(j.top=Math.ceil(Math.max(Math.min(T,j.top),0)),Sv(D,E)||j.top===k){a({scrollHeight:E,scrollTop:k,viewportHeight:D}),C&&r(!0);return}C?(h.current=j.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,r(!0)},1e3)):h.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:y}}function Ad(a){return a}const hj=Ze(()=>{const a=pe(h=>`Item ${h}`),r=pe(h=>`Group ${h}`),i=pe({}),o=pe(Ad),u=pe("div"),m=pe(vr),f=(h,x=null)=>Xt(ce(i,je(p=>p[h]),mt()),x);return{components:i,computeItemKey:o,EmptyPlaceholder:f("EmptyPlaceholder"),FooterComponent:f("Footer"),GroupComponent:f("Group","div"),groupContent:r,HeaderComponent:f("Header"),HeaderFooterTag:u,ItemComponent:f("Item","div"),itemContent:a,ListComponent:f("List","div"),ScrollerComponent:f("Scroller","div"),scrollerRef:m,ScrollSeekPlaceholder:f("ScrollSeekPlaceholder"),TopItemListComponent:f("TopItemList")}}),xj=Ze(([a,r])=>({...a,...r}),ht(Rv,hj)),vj=({height:a})=>n.jsx("div",{style:{height:a}}),gj={overflowAnchor:"none",position:Rd(),zIndex:1},_v={overflowAnchor:"none"},yj={..._v,display:"inline-block",height:"100%"},vx=we.memo(function({showTopList:a=!1}){const r=Le("listState"),i=_n("sizeRanges"),o=Le("useWindowScroll"),u=Le("customScrollParent"),m=_n("windowScrollContainerState"),f=_n("scrollContainerState"),h=u||o?m:f,x=Le("itemContent"),p=Le("context"),y=Le("groupContent"),g=Le("trackItemSizes"),j=Le("itemSize"),S=Le("log"),C=_n("gap"),D=Le("horizontalDirection"),{callbackRef:E}=L0(i,j,g,a?vr:h,S,C,u,D,Le("skipAnimationFrameInResizeObserver")),[k,T]=we.useState(0);Md("deviation",X=>{k!==X&&T(X)});const L=Le("EmptyPlaceholder"),I=Le("ScrollSeekPlaceholder")??vj,_=Le("ListComponent"),$=Le("ItemComponent"),N=Le("GroupComponent"),M=Le("computeItemKey"),R=Le("isSeeking"),H=Le("groupIndices").length>0,q=Le("alignToBottom"),P=Le("initialItemFinalLocationReached"),te=a?{}:{boxSizing:"border-box",...D?{display:"inline-block",height:"100%",marginLeft:k!==0?k:q?"auto":0,paddingLeft:r.offsetTop,paddingRight:r.offsetBottom,whiteSpace:"nowrap"}:{marginTop:k!==0?k:q?"auto":0,paddingBottom:r.offsetBottom,paddingTop:r.offsetTop},...P?{}:{visibility:"hidden"}};return!a&&r.totalCount===0&&L!==null&&L!==void 0?n.jsx(L,{...Qt(L,p)}):n.jsx(_,{...Qt(_,p),"data-testid":a?"virtuoso-top-item-list":"virtuoso-item-list",ref:E,style:te,children:(a?r.topItems:r.items).map(X=>{const O=X.originalIndex,A=M(O+r.firstItemIndex,X.data,p);return R?v.createElement(I,{...Qt(I,p),height:X.size,index:X.index,key:A,type:X.type||"item",...X.type==="group"?{}:{groupIndex:X.groupIndex}}):X.type==="group"?v.createElement(N,{...Qt(N,p),"data-index":O,"data-item-index":X.index,"data-known-size":X.size,key:A,style:gj},y(X.index,p)):v.createElement($,{...Qt($,p),...kj($,X.data),"data-index":O,"data-item-group-index":X.groupIndex,"data-item-index":X.index,"data-known-size":X.size,key:A,style:D?yj:_v},H?x(X.index,X.groupIndex,X.data,p):x(X.index,X.data,p))})})}),bj={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},jj={outline:"none",overflowX:"auto",position:"relative"},ho=a=>({height:"100%",position:"absolute",top:0,width:"100%",...a?{display:"flex",flexDirection:"column"}:void 0}),Sj={position:Rd(),top:0,width:"100%",zIndex:1};function Qt(a,r){if(typeof a!="string")return{context:r}}function kj(a,r){return{item:typeof a=="string"?void 0:r}}const wj=we.memo(function(){const a=Le("HeaderComponent"),r=_n("headerHeight"),i=Le("HeaderFooterTag"),o=jl(we.useMemo(()=>m=>{r(Ka(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Cj=we.memo(function(){const a=Le("FooterComponent"),r=_n("footerHeight"),i=Le("HeaderFooterTag"),o=jl(we.useMemo(()=>m=>{r(Ka(m,"height"))},[r]),!0,Le("skipAnimationFrameInResizeObserver")),u=Le("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null});function Ov({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:m,...f}){const h=i("scrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),y=r("scrollerRef"),g=r("horizontalDirection")||!1,{scrollByCallback:j,scrollerRef:S,scrollToCallback:C}=Lv(h,p,x,y,void 0,g);return a("scrollTo",C),a("scrollBy",j),n.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:S,style:{...g?jj:bj,...u},tabIndex:0,...f,...Qt(x,m),children:o})})}function Bv({useEmitter:a,useEmitterValue:r,usePublisher:i}){return we.memo(function({children:o,style:u,context:m,...f}){const h=i("windowScrollContainerState"),x=r("ScrollerComponent"),p=i("smoothScrollTargetReached"),y=r("totalListHeight"),g=r("deviation"),j=r("customScrollParent"),S=we.useRef(null),C=r("scrollerRef"),{scrollByCallback:D,scrollerRef:E,scrollToCallback:k}=Lv(h,p,x,C,j);return zv(()=>{var T;return E.current=j||((T=S.current)==null?void 0:T.ownerDocument.defaultView),()=>{E.current=null}},[E,j]),a("windowScrollTo",k),a("scrollBy",D),n.jsx(x,{ref:S,"data-virtuoso-scroller":!0,style:{position:"relative",...u,...y!==0?{height:y+g}:void 0},...f,...Qt(x,m),children:o})})}const Nj=({children:a})=>{const r=we.useContext(Mv),i=_n("viewportHeight"),o=_n("fixedItemHeight"),u=Le("alignToBottom"),m=Le("horizontalDirection"),f=we.useMemo(()=>ov(i,x=>Ka(x,m?"width":"height")),[i,m]),h=jl(f,!0,Le("skipAnimationFrameInResizeObserver"));return we.useEffect(()=>{r&&(i(r.viewportHeight),o(r.itemHeight))},[r,i,o]),n.jsx("div",{"data-viewport-type":"element",ref:h,style:ho(u),children:a})},Ej=({children:a})=>{const r=we.useContext(Mv),i=_n("windowViewportRect"),o=_n("fixedItemHeight"),u=Le("customScrollParent"),m=uv(i,u,Le("skipAnimationFrameInResizeObserver")),f=Le("alignToBottom");return we.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:ho(f),children:a})},Tj=({children:a})=>{const r=Le("TopItemListComponent")??"div",i=Le("headerHeight"),o={...Sj,marginTop:`${i}px`},u=Le("context");return n.jsx(r,{style:o,...Qt(r,u),children:a})},Rj=we.memo(function(a){const r=Le("useWindowScroll"),i=Le("topItemsIndexes").length>0,o=Le("customScrollParent"),u=Le("context");return n.jsxs(o||r?Dj:Mj,{...a,context:u,children:[i&&n.jsx(Tj,{children:n.jsx(vx,{showTopList:!0})}),n.jsxs(o||r?Ej:Nj,{children:[n.jsx(wj,{}),n.jsx(vx,{}),n.jsx(Cj,{})]})]})}),{Component:Aj,useEmitter:Md,useEmitterValue:Le,usePublisher:_n}=Av(xj,{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"}},Rj),Mj=Ov({useEmitter:Md,useEmitterValue:Le,usePublisher:_n}),Dj=Bv({useEmitter:Md,useEmitterValue:Le,usePublisher:_n}),zj=Aj,Lj=Ze(()=>{const a=pe(p=>n.jsxs("td",{children:["Item $",p]})),r=pe(null),i=pe(p=>n.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=pe(null),u=pe(null),m=pe({}),f=pe(Ad),h=pe(vr),x=(p,y=null)=>Xt(ce(m,je(g=>g[p]),mt()),y);return{components:m,computeItemKey:f,context:r,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:u,fixedHeaderContent:o,itemContent:a,groupContent:i,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});ht(Rv,Lj);Rd();const gx={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},_j={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:yx,floor:so,max:ys,min:qu,round:bx}=Math;function jx(a,r,i){return Array.from({length:r-a+1}).map((o,u)=>({data:i===null?null:i[u+a],index:u+a}))}function Oj(a){return{..._j,items:a}}function Ki(a,r){return a!==void 0&&a.width===r.width&&a.height===r.height}function Bj(a,r){return a!==void 0&&a.column===r.column&&a.row===r.row}const Uj=Ze(([{increaseViewportBy:a,listBoundary:r,overscan:i,visibleRange:o},{footerHeight:u,headerHeight:m,scrollBy:f,scrollContainerState:h,scrollTo:x,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:g},j,S,{didMount:C,propsReady:D},{customScrollParent:E,useWindowScroll:k,windowScrollContainerState:T,windowScrollTo:L,windowViewportRect:I},_])=>{const $=pe(0),N=pe(0),M=pe(gx),R=pe({height:0,width:0}),H=pe({height:0,width:0}),q=We(),P=We(),te=pe(0),X=pe(null),O=pe({column:0,row:0}),A=We(),B=We(),se=pe(!1),Y=pe(0),me=pe(!0),z=pe(!1),W=pe(!1);et(ce(C,$e(Y),Ae(([ae,ve])=>ve!==0)),()=>{He(me,!1)}),et(ce(Lt(C,me,H,R,Y,z),Ae(([ae,ve,Ie,Be,,ne])=>ae&&!ve&&Ie.height!==0&&Be.height!==0&&!ne)),([,,,,ae])=>{He(z,!0),Cd(1,()=>{He(q,ae)}),$n(ce(p),()=>{He(r,[0,0]),He(me,!0)})}),Ce(ce(B,Ae(ae=>ae!=null&&ae.scrollTop>0),Fn(0)),N),et(ce(C,$e(B),Ae(([,ae])=>ae!=null)),([,ae])=>{ae&&(He(R,ae.viewport),He(H,ae.item),He(O,ae.gap),ae.scrollTop>0&&(He(se,!0),$n(ce(p,yl(1)),ve=>{He(se,!1)}),He(x,{top:ae.scrollTop})))}),Ce(ce(R,je(({height:ae})=>ae)),g),Ce(ce(Lt(Re(R,Ki),Re(H,Ki),Re(O,(ae,ve)=>ae!==void 0&&ae.column===ve.column&&ae.row===ve.row),Re(p)),je(([ae,ve,Ie,Be])=>({gap:Ie,item:ve,scrollTop:Be,viewport:ae}))),A),Ce(ce(Lt(Re($),o,Re(O,Bj),Re(H,Ki),Re(R,Ki),Re(X),Re(N),Re(se),Re(me),Re(Y)),Ae(([,,,,,,,ae])=>!ae),je(([ae,[ve,Ie],Be,ne,fe,ue,he,,be,_e])=>{const{column:Me,row:dt}=Be,{height:Zt,width:ct}=ne,{width:Vt}=fe;if(he===0&&(ae===0||Vt===0))return gx;if(ct===0){const nt=Nd(_e,ae),Xa=nt+Math.max(he-1,0);return Oj(jx(nt,Xa,ue))}const $t=Uv(Vt,ct,Me);let tt,jt;be?ve===0&&Ie===0&&he>0?(tt=0,jt=he-1):(tt=$t*so((ve+dt)/(Zt+dt)),jt=$t*yx((Ie+dt)/(Zt+dt))-1,jt=qu(ae-1,ys(jt,$t-1)),tt=qu(jt,ys(0,tt))):(tt=0,jt=-1);const ye=jx(tt,jt,ue),{bottom:Rt,top:De}=Sx(fe,Be,ne,ye),xt=yx(ae/$t),Ft=xt*Zt+(xt-1)*dt-Rt;return{bottom:Rt,itemHeight:Zt,items:ye,itemWidth:ct,offsetBottom:Ft,offsetTop:De,top:De}})),M),Ce(ce(X,Ae(ae=>ae!==null),je(ae=>ae.length)),$),Ce(ce(Lt(R,H,M,O),Ae(([ae,ve,{items:Ie}])=>Ie.length>0&&ve.height!==0&&ae.height!==0),je(([ae,ve,{items:Ie},Be])=>{const{bottom:ne,top:fe}=Sx(ae,Be,ve,Ie);return[fe,ne]}),mt(ks)),r);const ie=pe(!1);Ce(ce(p,$e(ie),je(([ae,ve])=>ve||ae!==0)),ie);const de=jn(ce(Lt(M,$),Ae(([{items:ae}])=>ae.length>0),$e(ie),Ae(([[ae,ve],Ie])=>{const Be=ae.items[ae.items.length-1].index===ve-1;return(Ie||ae.bottom>0&&ae.itemHeight>0&&ae.offsetBottom===0&&ae.items.length===ve)&&Be}),je(([[,ae]])=>ae-1),mt())),ge=jn(ce(Re(M),Ae(({items:ae})=>ae.length>0&&ae[0].index===0),Fn(0),mt())),xe=jn(ce(Re(M),$e(se),Ae(([{items:ae},ve])=>ae.length>0&&!ve),je(([{items:ae}])=>({endIndex:ae[ae.length-1].index,startIndex:ae[0].index})),mt(xv),va(0)));Ce(xe,S.scrollSeekRangeChanged),Ce(ce(q,$e(R,H,$,O),je(([ae,ve,Ie,Be,ne])=>{const fe=jv(ae),{align:ue,behavior:he,offset:be}=fe;let _e=fe.index;_e==="LAST"&&(_e=Be-1),_e=ys(0,_e,qu(Be-1,_e));let Me=dd(ve,ne,Ie,_e);return ue==="end"?Me=bx(Me-ve.height+Ie.height):ue==="center"&&(Me=bx(Me-ve.height/2+Ie.height/2)),be!==void 0&&be!==0&&(Me+=be),{behavior:he,top:Me}})),x);const oe=Xt(ce(M,je(ae=>ae.offsetBottom+ae.bottom)),0);return Ce(ce(I,je(ae=>({height:ae.visibleHeight,width:ae.visibleWidth}))),R),{customScrollParent:E,data:X,deviation:te,footerHeight:u,gap:O,headerHeight:m,increaseViewportBy:a,initialItemCount:N,itemDimensions:H,overscan:i,restoreStateFrom:B,scrollBy:f,scrollContainerState:h,scrollHeight:P,scrollTo:x,scrollToIndex:q,scrollTop:p,smoothScrollTargetReached:y,totalCount:$,useWindowScroll:k,viewportDimensions:R,windowScrollContainerState:T,windowScrollTo:L,windowViewportRect:I,...S,gridState:M,horizontalDirection:W,initialTopMostItemIndex:Y,totalListHeight:oe,...j,endReached:de,propsReady:D,rangeChanged:xe,startReached:ge,stateChanged:A,stateRestoreInProgress:se,..._}},ht(Ed,an,As,Ev,Qa,Td,Wa));function Uv(a,r,i){return ys(1,so((a+i)/(so(r)+i)))}function Sx(a,r,i,o){const{height:u}=i;if(u===void 0||o.length===0)return{bottom:0,top:0};const m=dd(a,r,i,o[0].index);return{bottom:dd(a,r,i,o[o.length-1].index)+u,top:m}}function dd(a,r,i,o){const u=Uv(a.width,i.width,r.column),m=so(o/u),f=m*i.height+ys(0,m-1)*r.row;return f>0?f+r.row:f}const Hj=Ze(()=>{const a=pe(g=>`Item ${g}`),r=pe({}),i=pe(null),o=pe("virtuoso-grid-item"),u=pe("virtuoso-grid-list"),m=pe(Ad),f=pe("div"),h=pe(vr),x=(g,j=null)=>Xt(ce(r,je(S=>S[g]),mt()),j),p=pe(!1),y=pe(!1);return Ce(Re(y),p),{components:r,computeItemKey:m,context:i,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:f,itemClassName:o,ItemComponent:x("Item","div"),itemContent:a,listClassName:u,ListComponent:x("List","div"),readyStateChanged:p,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Ij=Ze(([a,r])=>({...a,...r}),ht(Uj,Hj)),Vj=we.memo(function(){const a=gt("gridState"),r=gt("listClassName"),i=gt("itemClassName"),o=gt("itemContent"),u=gt("computeItemKey"),m=gt("isSeeking"),f=On("scrollHeight"),h=gt("ItemComponent"),x=gt("ListComponent"),p=gt("ScrollSeekPlaceholder"),y=gt("context"),g=On("itemDimensions"),j=On("gap"),S=gt("log"),C=gt("stateRestoreInProgress"),D=On("reportReadyState"),E=jl(we.useMemo(()=>k=>{const T=k.parentElement.parentElement.scrollHeight;f(T);const L=k.firstChild;if(L!==null){const{height:I,width:_}=L.getBoundingClientRect();g({height:I,width:_})}j({column:kx("column-gap",getComputedStyle(k).columnGap,S),row:kx("row-gap",getComputedStyle(k).rowGap,S)})},[f,g,j,S]),!0,!1);return zv(()=>{a.itemHeight>0&&a.itemWidth>0&&D(!0)},[a]),C?null:n.jsx(x,{className:r,ref:E,...Qt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:a.offsetBottom,paddingTop:a.offsetTop},children:a.items.map(k=>{const T=u(k.index,k.data,y);return m?n.jsx(p,{...Qt(p,y),height:a.itemHeight,index:k.index,width:a.itemWidth},T):v.createElement(h,{...Qt(h,y),className:i,"data-index":k.index,key:T},o(k.index,k.data,y))})})}),$j=we.memo(function(){const a=gt("HeaderComponent"),r=On("headerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>m=>{r(Ka(m,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),Gj=we.memo(function(){const a=gt("FooterComponent"),r=On("footerHeight"),i=gt("headerFooterTag"),o=jl(we.useMemo(()=>m=>{r(Ka(m,"height"))},[r]),!0,!1),u=gt("context");return a!=null?n.jsx(i,{ref:o,children:n.jsx(a,{...Qt(a,u)})}):null}),qj=({children:a})=>{const r=we.useContext(Dv),i=On("itemDimensions"),o=On("viewportDimensions"),u=jl(we.useMemo(()=>m=>{o(m.getBoundingClientRect())},[o]),!0,!1);return we.useEffect(()=>{r&&(o({height:r.viewportHeight,width:r.viewportWidth}),i({height:r.itemHeight,width:r.itemWidth}))},[r,o,i]),n.jsx("div",{ref:u,style:ho(!1),children:a})},Yj=({children:a})=>{const r=we.useContext(Dv),i=On("windowViewportRect"),o=On("itemDimensions"),u=gt("customScrollParent"),m=uv(i,u,!1);return we.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:ho(!1),children:a})},Pj=we.memo(function({...a}){const r=gt("useWindowScroll"),i=gt("customScrollParent"),o=i||r?Fj:Kj,u=i||r?Yj:qj,m=gt("context");return n.jsx(o,{...a,...Qt(o,m),children:n.jsxs(u,{children:[n.jsx($j,{}),n.jsx(Vj,{}),n.jsx(Gj,{})]})})}),{useEmitter:Hv,useEmitterValue:gt,usePublisher:On}=Av(Ij,{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"}},Pj),Kj=Ov({useEmitter:Hv,useEmitterValue:gt,usePublisher:On}),Fj=Bv({useEmitter:Hv,useEmitterValue:gt,usePublisher:On});function kx(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 Wj={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Iv={source:"Own",installed:"Installed"};function Qj(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 Xj(a,r){const i=r?"true":"false";try{localStorage.setItem(a,i)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(a,i)}catch{}}function wx({origin:a,count:r,filteredCount:i,updateCount:o,children:u}){const m=Wj[a],[f,h]=v.useState(()=>Qj(m)),x=v.useCallback(()=>{h(j=>{const S=!j;return Xj(m,S),S})},[m]),p=Iv[a],y=`sidebar-section-${a}-header`,g=`sidebar-section-${a}-group`;return n.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!f,"aria-controls":g,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(Jj,{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(Zj,{origin:a,updateCount:o})]}),!f&&n.jsx("div",{id:g,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:u})]})}function Zj({origin:a,updateCount:r}){const[i,o]=v.useState(!1),u=Iv[a].toLowerCase(),m=`${r} updates available in ${u} 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 Jj({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"})})}const Vv={own:"Own",installed:"Installed",global:"Global"},e2={own:"var(--color-own)",installed:"var(--color-accent)",global:"var(--color-global, #8B8FB1)"},t2={fresh:"var(--color-ok, #22c55e)",updates:"var(--color-own, #f59e0b)",empty:"var(--text-tertiary, #9ca3af)"};function n2(a,r){return`vskill-sidebar-${a}-${r}-collapsed`}function a2(a){try{const r=localStorage.getItem(a);if(r!=null)return r==="true"}catch{}return!1}function l2(a,r){try{localStorage.setItem(a,r?"true":"false")}catch{}}function r2(a,r){return a===0?"empty":r>0?"updates":"fresh"}function Yu({scope:a,agentId:r,count:i,filteredCount:o,updateCount:u=0,children:m}){const f=n2(r,a),[h,x]=v.useState(()=>a2(f)),p=v.useCallback(()=>{x(D=>{const E=!D;return l2(f,E),E})},[f]),y=Vv[a],g=e2[a],j=r2(i,u),S=`scope-section-${r}-${a}-header`,C=`scope-section-${r}-${a}-group`;return n.jsxs("section",{"aria-labelledby":S,"data-testid":`scope-section-${a}`,"data-scope":a,style:{display:"flex",flexDirection:"column",minHeight:0},children:[n.jsxs("button",{id:S,type:"button","data-testid":"scope-section-header","aria-expanded":!h,"aria-controls":C,onClick:p,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"12px 14px 4px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[n.jsx(i2,{collapsed:h}),n.jsx("span",{"data-testid":"scope-status-dot","data-status":j,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:t2[j],flexShrink:0}}),n.jsx("h2",{"data-testid":"scope-section-kicker","aria-level":2,style:{fontFamily:"'Source Serif 4 Variable', 'Source Serif 4', serif",fontSize:"14px",fontWeight:600,letterSpacing:"0.12em",textTransform:"uppercase",fontFeatureSettings:'"smcp" 0',color:g,margin:0},children:y}),n.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:o!=null&&o!==i?`(${o} of ${i})`:`(${i})`}),u>0&&n.jsx(s2,{updateCount:u,scope:a})]}),!h&&n.jsx("div",{id:C,role:"group","aria-labelledby":S,style:{display:"flex",flexDirection:"column",minHeight:0},children:m})]})}function s2({updateCount:a,scope:r}){return n.jsxs("span",{role:"link",tabIndex:0,"data-testid":"scope-section-update-chip","data-scope":r,"aria-label":`${a} updates available in ${Vv[r].toLowerCase()} section`,onClick:i=>{i.stopPropagation(),window.location.hash="#/updates"},onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopPropagation(),window.location.hash="#/updates")},style:{fontSize:10,color:"var(--color-own)",fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:"0 4px",borderRadius:3},children:[a," updates ▾"]})}function i2({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 $v(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 o2({value:a,onChange:r,placeholder:i="Filter skills…",validationPattern:o,validationMessage:u="Invalid filter expression"}){const m=v.useRef(null),f=v.useId(),h=!!o&&a.trim()!==""&&!o.test(a);return v.useEffect(()=>{function x(p){var j;if(p.key!=="/")return;const y=p.target;if(!y)return;const g=y.tagName;g==="INPUT"||g==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(j=m.current)==null||j.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),n.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[n.jsxs("svg",{"aria-hidden":"true",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"M21 21l-4.35-4.35"})]}),n.jsx("input",{ref:m,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?f:void 0,value:a,placeholder:i,onChange:x=>r(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(r(""),x.currentTarget.blur())},style:{flex:1,minWidth:0,border:"none",outline:"none",background:"transparent",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:12,padding:"2px 0"}}),h&&n.jsx("span",{id:f,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:u}),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({target:a}){const r=typeof a=="string"&&a.length>0,i=r?`symlinked → ${a}`:"symlinked — cycle detected or target unresolved",o=r?`symlinked from ${a}`:"symlinked, target unresolved";return n.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:i,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:n.jsxs("svg",{"data-testid":"symlink-glyph",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function u2({skill:a}){if(!a.updateAvailable)return null;const r=a.currentVersion??"",i=a.latestVersion,o=i?`Update available: ${r} → ${i}`.trim():"Update available";return n.jsx("span",{"data-testid":"skill-row-update-glyph",title:o,"aria-label":"Update available",style:{color:"var(--color-own)",display:"inline-flex",flexShrink:0},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function d2({skill:a,isSelected:r,onSelect:i,onContextMenu:o}){const u=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:u,display:"inline-block",flexShrink:0}}),n.jsx("span",{title:a.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.skill}),a.version&&n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:a.version}),a.isSymlink&&n.jsx(c2,{target:a.symlinkTarget??null}),n.jsx(u2,{skill:a})]})}const Gv=v.memo(d2);function f2({plugin:a,skills:r,selectedKey:i,onSelect:o,onContextMenu:u}){const m=[...r].sort((f,h)=>f.skill.localeCompare(h.skill));return n.jsxs("div",{role:"group","aria-label":`${a} (${r.length})`,children:[n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:a,children:a}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",r.length,")"]})]}),n.jsx("div",{role:"list",children:m.map(f=>{const h=!!i&&i.plugin===f.plugin&&i.skill===f.skill;return n.jsx("div",{role:"listitem",children:n.jsx(Gv,{skill:f,isSelected:h,onSelect:()=>o(f),onContextMenu:u})},`${f.plugin}/${f.skill}`)})})]})}function Cx({name:a,count:r,className:i}){const o=["flex items-center gap-1 px-2 py-1 text-xs uppercase tracking-wide font-medium text-muted-foreground select-none",i??""].join(" ").trim();return n.jsxs("div",{"data-vskill-group-header":a,className:o,role:"heading","aria-level":3,children:[n.jsx("span",{className:"vskill-group-header-name",children:a}),n.jsxs("span",{className:"vskill-group-header-count tabular-nums",children:["(",r,")"]})]})}function p2(){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 m2(a){const r=a.key.split("+").map(h=>h.trim()).filter(Boolean);let i=!!a.meta,o=!!a.ctrl,u=!!a.shift,m=!!a.alt,f=a.key;if(r.length>1){for(const h of r.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?i=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?u=!0:(x==="alt"||x==="option")&&(m=!0)}f=r[r.length-1]}return{key:f.length===1?f.toLowerCase():f,meta:i,ctrl:o,shift:u,alt:m,allowInInputs:!!a.allowInInputs,handler:a.handler}}function h2(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 x2(a,r){const i=!!a.metaKey,o=!!a.ctrlKey,u=!!a.shiftKey,m=!!a.altKey;return i!==r.meta||o!==r.ctrl||u!==r.shift||m!==r.alt?!1:(a.key.length===1?a.key.toLowerCase():a.key)===r.key}function fd(a,r={}){const{enabled:i=!0,target:o}=r,u=v.useRef([]),m=Array.isArray(a)?a:[a];u.current=m.map(m2),v.useEffect(()=>{if(!i)return;const f=o??(typeof window<"u"?window:void 0);if(!f)return;function h(x){const p=x,y=h2(p.target);for(const g of u.current){if(!x2(p,g))continue;const j=g.meta||g.ctrl||g.alt;if(!(y&&!g.allowInInputs&&!j)){g.handler(p);return}}}return f.addEventListener("keydown",h),()=>{f.removeEventListener("keydown",h)}},[i,o])}const v2=200;function g2(a){return a.scope==="own"||a.scope==="installed"||a.scope==="global"?a.scope:a.origin==="installed"?"installed":"own"}function y2(a,r){const i=[],o=[],u=[];for(const f of a){const h=g2(f);h==="global"?u.push(f):h==="installed"?o.push(f):i.push(f)}function m(f){var y;const h=f.filter(g=>$v(g,r)),x={};for(const g of h)(x[y=g.plugin]||(x[y]=[])).push(g);const p=Object.entries(x).sort((g,j)=>g[0].localeCompare(j[0]));return{total:f.length,filtered:h.length,byPlugin:p}}return{own:m(i),installed:m(o),global:m(u)}}function b2(a,r){const i=[],o=[];for(const m of a)(m.origin==="installed"?o:i).push(m);function u(m){var p;const f=m.filter(y=>$v(y,r)),h={};for(const y of f)(h[p=y.plugin]||(h[p]=[])).push(y);const x=Object.entries(h).sort((y,g)=>y[0].localeCompare(g[0]));return{total:m.length,filtered:f.length,byPlugin:x}}return{own:u(i),installed:u(o)}}function j2({skills:a,selectedKey:r,onSelect:i,isLoading:o,error:u,onRetry:m,onContextMenu:f,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:p,topSlot:y}){const g=!!x||a.some(M=>M.scope!==void 0&&M.scope!==null),j=x??"claude-cli",[S,C]=v.useState(""),D=v.useDeferredValue(S),E=v.useMemo(()=>y2(a,D),[a,D]),{own:k,installed:T}=v.useMemo(()=>b2(a,D),[a,D]),I=E.own.filtered+E.installed.filtered+E.global.filtered>=v2,_=v.useMemo(()=>{const M=R=>{const H=[];for(const[,q]of R){const P=[...q].sort((te,X)=>te.skill.localeCompare(X.skill));H.push(...P)}return H};return g?[...M(E.own.byPlugin),...M(E.installed.byPlugin),...M(E.global.byPlugin)]:[...M(k.byPlugin),...M(T.byPlugin)]},[g,E.own.byPlugin,E.installed.byPlugin,E.global.byPlugin,k.byPlugin,T.byPlugin]),$=v.useMemo(()=>r?_.findIndex(M=>M.plugin===r.plugin&&M.skill===r.skill):-1,[_,r]),N=v.useCallback(M=>{if(_.length===0)return;const R=$<0?M>0?0:_.length-1:Math.min(Math.max($+M,0),_.length-1);i(_[R])},[_,$,i]);return fd([{key:"j",handler:()=>N(1)},{key:"k",handler:()=>N(-1)},{key:"Enter",handler:()=>{$>=0&&i(_[$])}}],{enabled:!o&&!u}),n.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,n.jsx(o2,{value:S,onChange:C}),o&&n.jsx(N2,{}),!o&&u&&n.jsx(E2,{error:u,onRetry:m}),!o&&!u&&g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(Cx,{name:J.scopeLabels.groupAvailable.toUpperCase(),count:E.installed.total+E.global.total}),n.jsx(Yu,{scope:"installed",agentId:j,count:E.installed.total,filteredCount:S?E.installed.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:E.installed.filtered===0?n.jsx(Ex,{queryActive:!!S,agentId:j}):n.jsx(ps,{items:E.installed.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})}),n.jsx(Yu,{scope:"global",agentId:j,count:E.global.total,filteredCount:S?E.global.filtered:null,updateCount:p==null?void 0:p.global,children:E.global.filtered===0?n.jsx(k2,{queryActive:!!S,agentId:j}):n.jsx(ps,{items:E.global.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})}),n.jsx(C2,{}),n.jsx(Cx,{name:J.scopeLabels.groupAuthoring.toUpperCase(),count:E.own.total}),n.jsx(Yu,{scope:"own",agentId:j,count:E.own.total,filteredCount:S?E.own.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),children:E.own.filtered===0?n.jsx(Nx,{queryActive:!!S}):n.jsx(ps,{items:E.own.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})})]}),!o&&!u&&!g&&n.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[n.jsx(wx,{origin:"source",count:k.total,filteredCount:S?k.filtered:null,updateCount:h==null?void 0:h.source,children:k.filtered===0?n.jsx(Nx,{queryActive:!!S}):n.jsx(ps,{items:k.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})}),n.jsx(w2,{}),n.jsx(wx,{origin:"installed",count:T.total,filteredCount:S?T.filtered:null,updateCount:h==null?void 0:h.installed,children:T.filtered===0?n.jsx(Ex,{queryActive:!!S}):n.jsx(ps,{items:T.byPlugin,selectedKey:r,onSelect:i,onContextMenu:f,useVirtual:I})})]})]})}function S2(a){const r=[];for(const[i,o]of a){const u=[...o].sort((m,f)=>m.skill.localeCompare(f.skill));r.push({kind:"header",plugin:i,count:u.length});for(const m of u)r.push({kind:"row",skill:m})}return r}function ps({items:a,selectedKey:r,onSelect:i,onContextMenu:o,useVirtual:u}){if(u){const m=S2(a);return n.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:n.jsx(zj,{overscan:4,totalCount:m.length,itemContent:f=>{const h=m[f];if(!h)return null;if(h.kind==="header")return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,p=!!r&&r.plugin===x.plugin&&r.skill===x.skill;return n.jsx(Gv,{skill:x,isSelected:p,onSelect:()=>i(x),onContextMenu:o})}})})}return n.jsx("div",{"data-virtualized":"false",children:a.map(([m,f])=>n.jsx(f2,{plugin:m,skills:f,selectedKey:r,onSelect:i,onContextMenu:o},m))})}function Nx({queryActive:a}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:"No skills yet.",body:n.jsxs(n.Fragment,{children:["Create one with ",n.jsx(Dd,{children:"vskill new"})," or the"," ",n.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Ex({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:r?`No skills installed for ${r} in this project.`:"No installed skills.",body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Dd,{children:"vskill install <plugin>"})," to add one."]})})}function k2({queryActive:a,agentId:r}){return a?n.jsx(pr,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):n.jsx(pr,{headline:`No global skills for ${r}.`,body:n.jsxs(n.Fragment,{children:["Run ",n.jsx(Dd,{children:"vskill install --global <plugin>"})," to add one."]})})}function pr({headline:a,body:r}){return n.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[n.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:a}),n.jsx("div",{children:r})]})}function Dd({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 w2(){return n.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function C2(){return n.jsx("div",{"aria-hidden":"true","data-testid":"scope-bold-divider",style:{height:3,background:"var(--color-rule)",boxShadow:"inset 0 1px 0 color-mix(in srgb, var(--color-rule) 50%, transparent)",margin:"12px 0"}})}function N2(){return n.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(a=>n.jsx(p2,{},a))})}function E2({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:T2(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 T2(a){const r=a.split(`
|
|
55
|
+
`)[0]??a;return r.length>80?r.slice(0,77)+"…":r}const qv=240,Yv=480,Pv="vskill-sidebar-width",bs=320;function zd(a){return Number.isFinite(a)?Math.round(Math.max(qv,Math.min(Yv,a))):bs}function R2(){try{const a=localStorage.getItem(Pv);if(!a)return bs;const r=Number(a);return Number.isFinite(r)?zd(r):bs}catch{return bs}}function A2(a){try{localStorage.setItem(Pv,String(zd(a)))}catch{}}function M2({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 u(f){if(i.current.pointerId==null||f.pointerId!==i.current.pointerId)return;const h=f.clientX-i.current.startX,x=zd(i.current.startWidth+h);o.current=x,r(x)}function m(f){i.current.pointerId==null||f.pointerId!==i.current.pointerId||(i.current.pointerId=null,A2(o.current))}return window.addEventListener("pointermove",u),window.addEventListener("pointerup",m),window.addEventListener("pointercancel",m),()=>{window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m)}},[r]),n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":qv,"aria-valuemax":Yv,"aria-valuenow":a,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:u=>{const m=u.currentTarget;i.current.startX=u.clientX,i.current.startWidth=o.current,i.current.pointerId=u.pointerId;try{m.setPointerCapture(u.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function D2({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 Kv(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,u)=>{if(typeof u=="object"&&u!==null){if(i.has(u))return"[Circular]";i.add(u)}return u})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function Pu(){const[a,r]=v.useState([]),[i,o]=v.useState(!1),[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useCallback(async(g,j)=>{r([]),o(!0),m(!1),h(null);const S=new AbortController;x.current=S;try{const C=Kv(j),D=await fetch(g,{method:"POST",headers:{"Content-Type":"application/json"},body:C,signal:S.signal});if(!D.ok||!D.body){let I=`HTTP ${D.status}`;try{const _=await D.json();_.error&&(I=_.error)}catch{}throw new Error(I)}const E=D.body.getReader(),k=new TextDecoder;let T="",L="";for(;;){const{done:I,value:_}=await E.read();if(I)break;T+=k.decode(_,{stream:!0});const $=T.split(`
|
|
56
|
+
`);T=$.pop()||"";for(const N of $)if(N.startsWith("event: "))L=N.slice(7).trim();else if(N.startsWith("data: ")){try{const M=JSON.parse(N.slice(6)),R={event:L,data:M};L==="done"?(m(!0),r(H=>[...H,R])):r(H=>[...H,R])}catch{}L=""}}}catch(C){C.name!=="AbortError"&&h(C.message)}finally{o(!1),x.current=null}},[]),y=v.useCallback(()=>{var g;(g=x.current)==null||g.abort()},[]);return{events:a,running:i,done:u,error:f,start:p,stop:y}}function z2(a){const r=v.useRef(a);r.current=a;const[i,o]=v.useState(new Set),u=v.useRef(new Map),m=v.useCallback(async(p,y,g)=>{var S;(S=u.current.get(p))==null||S.abort();const j=new AbortController;u.current.set(p,j),o(C=>{const D=new Set(C);return D.add(p),D});try{const C=Kv(g),D=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:C,signal:j.signal});if(!D.ok||!D.body){let I=`HTTP ${D.status}`;try{const _=await D.json();_.error&&(I=_.error)}catch{}throw new Error(I)}const E=D.body.getReader(),k=new TextDecoder;let T="",L="";for(;;){const{done:I,value:_}=await E.read();if(I)break;T+=k.decode(_,{stream:!0});const $=T.split(`
|
|
57
|
+
`);T=$.pop()||"";for(const N of $)if(N.startsWith("event: "))L=N.slice(7).trim();else if(N.startsWith("data: ")){try{const M=JSON.parse(N.slice(6)),R={event:L,data:M};r.current.onEvent(p,R)}catch{}L=""}}r.current.onDone(p)}catch(C){C.name!=="AbortError"&&r.current.onError(p,C.message)}finally{o(C=>{const D=new Set(C);return D.delete(p),D}),u.current.delete(p)}},[]),f=v.useCallback(p=>{var y;(y=u.current.get(p))==null||y.abort()},[]),h=v.useCallback(()=>{for(const p of u.current.values())p.abort()},[]),x=i.size>0;return{runningSet:i,startCase:m,stopCase:f,stopAll:h,isAnyCaseRunning:x}}const L2={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 _2(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 u=new Map;if(r.benchmark)for(const f of r.benchmark.cases)u.set(f.eval_id,{status:f.status,passRate:f.pass_rate,errorMessage:f.error_message||void 0,durationMs:f.durationMs,tokens:f.tokens,output:f.output,assertions:f.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const 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:u,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 u=new Map(a.caseRunStates);return u.set(r.caseId,{status:"running",startedAt:Date.now(),mode:r.mode}),{...a,caseRunStates:u,runMode:r.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);u.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:u,inlineResults:f}}case"CASE_RUN_ERROR":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);u.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:u,inlineResults:f}}case"CASE_RUN_CANCEL":{const u=new Map(a.caseRunStates),m=u.get(r.caseId);return u.set(r.caseId,{status:"cancelled",mode:m==null?void 0:m.mode}),{...a,caseRunStates:u}}case"BULK_RUN_START":{const u=new Map(a.caseRunStates);for(const m of r.caseIds)u.set(m,{status:"queued",mode:r.mode});return{...a,caseRunStates:u,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 u=new Map(a.caseRunStates);for(const[m,f]of u)(f.status==="running"||f.status==="queued")&&u.set(m,{status:"cancelled"});return{...a,caseRunStates:u,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const u=new Map(a.inlineResults);return u.set(r.evalId,r.result),{...a,inlineResults:u}}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 u=r.evalChanges??[],m=new Map;for(let f=0;f<u.length;f++)m.set(f,!0);return{...a,aiEditLoading:!1,aiEditResult:{improved:r.improved,reasoning:r.reasoning,evalChanges:u},aiEditEvalChanges:u,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 u=new Map(a.aiEditEvalSelections);return u.set(r.index,!u.get(r.index)),{...a,aiEditEvalSelections:u}}case"SELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!0);return{...a,aiEditEvalSelections:u}}case"DESELECT_ALL_EVAL_CHANGES":{const u=new Map(a.aiEditEvalSelections);for(const m of u.keys())u.set(m,!1);return{...a,aiEditEvalSelections:u}}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 O2(a){if(a==="unit"||a==="integration")return a}function B2(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(u=>u.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 Fv=v.createContext(null);function kn(){const a=v.useContext(Fv);if(!a)throw new Error("useWorkspace must be used within WorkspaceProvider");return a}function Tx({plugin:a,skill:r,origin:i,children:o}){const u=i==="installed",[m,f]=v.useReducer(_2,{...L2,plugin:a,skill:r}),h=v.useRef(new Set),x=v.useRef(new Set),p=v.useRef(new Map),y=v.useCallback((ne,fe)=>{let ue=p.current.get(ne);ue||(ue={assertions:[]},p.current.set(ne,ue)),B2(ue,fe),f({type:"UPDATE_INLINE_RESULT",evalId:ne,result:{...ue,assertions:[...ue.assertions]}})},[]),g=v.useCallback(ne=>{if(x.current.has(ne))return;x.current.add(ne);const fe=p.current.get(ne)??{assertions:[]};f({type:"CASE_RUN_COMPLETE",caseId:ne,result:{...fe,assertions:[...fe.assertions]}}),h.current.has(ne)&&(h.current.delete(ne),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ue=>f({type:"BULK_RUN_COMPLETE",benchmark:ue})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null})))},[a,r]),j=v.useCallback((ne,fe)=>{x.current.has(ne)||(x.current.add(ne),f({type:"CASE_RUN_ERROR",caseId:ne,error:fe}),h.current.has(ne)&&(h.current.delete(ne),h.current.size===0&&Ne.getLatestBenchmark(a,r).then(ue=>f({type:"BULK_RUN_COMPLETE",benchmark:ue})).catch(()=>f({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[a,r]),{startCase:S,stopCase:C,stopAll:D}=z2({onEvent:y,onDone:g,onError:j});v.useEffect(()=>()=>{D()},[D]);const E=v.useCallback(async()=>{try{const ne=await fetch(`/api/skills/${a}/${r}/activation-history`);if(!ne.ok){if(ne.status===404){f({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const fe=await ne.json();f({type:"ACTIVATION_HISTORY_LOADED",runs:fe.runs||[]})}catch{}},[a,r]);v.useEffect(()=>{let ne=!1;async function fe(){try{const[ue,he,be]=await Promise.allSettled([Ne.getSkillDetail(a,r),Ne.getEvals(a,r),Ne.getLatestBenchmark(a,r)]);if(ne)return;let _e=null,Me=null;if(he.status==="fulfilled")_e=he.value;else{const dt=he.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:ue.status==="fulfilled"?ue.value.skillContent:"",evals:_e,evalsError:Me,benchmark:be.status==="fulfilled"?be.value:null})}catch(ue){ne||f({type:"SET_ERROR",error:ue.message})}}return fe(),E(),()=>{ne=!0}},[a,r,E]);const k=v.useCallback(async()=>{if(!u)try{await Ne.applyImprovement(a,r,m.skillContent),f({type:"CONTENT_SAVED"})}catch(ne){f({type:"SET_ERROR",error:ne.message})}},[u,a,r,m.skillContent]),T=v.useCallback(async ne=>{if(!u)try{const fe=await Ne.saveEvals(a,r,ne);f({type:"SET_EVALS",evals:fe})}catch(fe){f({type:"SET_ERROR",error:fe.message})}},[u,a,r]),L=v.useCallback((ne,fe="benchmark")=>{if(u)return;const ue=m.caseRunStates.get(ne);if((ue==null?void 0:ue.status)!=="running")if(p.current.delete(ne),x.current.delete(ne),f({type:"CASE_RUN_START",caseId:ne,mode:fe}),fe==="comparison"){const he=`/api/skills/${a}/${r}/compare`;S(ne,he,{eval_ids:[ne]})}else{const he=`/api/skills/${a}/${r}/benchmark/case/${ne}`;S(ne,he,fe==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.caseRunStates,S]),I=v.useCallback((ne="benchmark")=>{var he;if(u)return;const fe=((he=m.evals)==null?void 0:he.evals)??[];if(fe.length===0)return;const ue=fe.map(be=>be.id);for(const be of ue)p.current.delete(be),x.current.delete(be);f({type:"BULK_RUN_START",caseIds:ue,mode:ne}),h.current=new Set(ue);for(const be of ue)if(ne==="comparison")S(be,`/api/skills/${a}/${r}/compare`,{eval_ids:[be]});else{const _e=`/api/skills/${a}/${r}/benchmark/case/${be}`;S(be,_e,ne==="baseline"?{baseline_only:!0}:void 0)}},[u,a,r,m.evals,S]),_=v.useCallback(ne=>{C(ne),f({type:"CASE_RUN_CANCEL",caseId:ne}),h.current.delete(ne),x.current.add(ne)},[C]),$=v.useCallback(()=>{D(),f({type:"CANCEL_ALL"}),h.current.clear()},[D]),N=v.useCallback(async(ne,fe)=>{f({type:"OPEN_IMPROVE",evalId:ne})},[]),M=v.useCallback(async(ne,fe)=>{try{await Ne.applyImprovement(a,r,fe),f({type:"SET_CONTENT",content:fe}),f({type:"CONTENT_SAVED"}),f({type:"CLOSE_IMPROVE"}),L(ne,"benchmark")}catch(ue){f({type:"SET_ERROR",error:ue.message})}},[a,r,L]),R=Pu(),H=v.useRef(null),q=v.useRef(0);v.useEffect(()=>{const ne=R.events;for(let fe=q.current;fe<ne.length;fe++){const ue=ne[fe],he=ue.data;if(ue.event==="progress"&&f({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ue.event==="done"){const be=he.improved,_e=he.reasoning,Me=he.evalChanges??[];f({type:"AI_EDIT_RESULT",improved:be,reasoning:_e,evalChanges:Me})}if(ue.event==="error"){const be=he;f({type:"AI_EDIT_ERROR",message:be.description||"Unknown error",classified:be})}}q.current=ne.length},[R.events]),v.useEffect(()=>{R.error&&f({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),v.useEffect(()=>()=>{R.stop()},[R.stop]);const P=v.useCallback(async(ne,fe,ue)=>{u||(q.current=0,f({type:"AI_EDIT_LOADING"}),H.current=R.stop,R.start(`/api/skills/${a}/${r}/improve?sse`,{mode:"instruct",instruction:ne,content:m.skillContent,evals:m.evals??{skill_name:r,evals:[]},provider:fe,model:ue}))},[u,a,r,m.skillContent,m.evals,R]),te=v.useCallback(()=>{R.stop(),f({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),X=v.useCallback(async()=>{const ne=m.aiEditResult;if(ne!=null&&ne.improved)try{if(await Ne.applyImprovement(a,r,ne.improved),f({type:"SET_CONTENT",content:ne.improved}),f({type:"CONTENT_SAVED"}),m.aiEditEvalChanges.length>0&&Array.from(m.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:ue}=await yd(async()=>{const{mergeEvalChanges:_e}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:_e}},[]),he=m.evals??{skill_name:r,evals:[]},be=ue(he,m.aiEditEvalChanges,m.aiEditEvalSelections);try{const _e=await Ne.saveEvals(a,r,be);f({type:"SET_EVALS",evals:_e})}catch(_e){f({type:"SET_EVALS_RETRY",evalsFile:be}),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(fe){f({type:"SET_ERROR",error:fe.message})}},[a,r,m.aiEditResult,m.evals,m.aiEditEvalChanges,m.aiEditEvalSelections]),O=v.useCallback(()=>{f({type:"CLOSE_AI_EDIT"})},[]),A=v.useCallback(ne=>{f({type:"TOGGLE_EVAL_CHANGE",index:ne})},[]),B=v.useCallback(()=>{f({type:"SELECT_ALL_EVAL_CHANGES"})},[]),se=v.useCallback(()=>{f({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),Y=v.useCallback(async()=>{const ne=m.aiEditEvalsRetry;if(ne)try{const fe=await Ne.saveEvals(a,r,ne);f({type:"SET_EVALS",evals:fe}),f({type:"SET_ERROR",error:null}),f({type:"CLOSE_AI_EDIT"})}catch(fe){f({type:"SET_ERROR",error:`Retry failed: ${fe.message}`})}},[a,r,m.aiEditEvalsRetry]),me=v.useCallback(async()=>{try{const ne=await Ne.getSkillDetail(a,r);f({type:"SET_CONTENT",content:ne.skillContent}),f({type:"CONTENT_SAVED"})}catch{}},[a,r]),{config:z}=bl(),W=Pu(),ie=v.useRef(0);v.useEffect(()=>{const ne=W.events;for(let fe=ie.current;fe<ne.length;fe++){const ue=ne[fe],he=ue.data;if(ue.event==="progress"&&f({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),ue.event==="done"){const be=he;Ne.saveEvals(a,r,be).then(_e=>f({type:"GENERATE_EVALS_DONE",evals:_e})).catch(_e=>f({type:"SET_ERROR",error:_e.message}))}ue.event==="error"&&f({type:"GENERATE_EVALS_ERROR",classified:he})}ie.current=ne.length},[W.events,a,r]),v.useEffect(()=>{W.error&&f({type:"SET_ERROR",error:W.error})},[W.error]),v.useEffect(()=>()=>{W.stop()},[W.stop]);const de=v.useCallback(async ne=>{if(u)return;ie.current=0,f({type:"GENERATE_EVALS_START"});const fe={};z!=null&&z.provider&&(fe.provider=z.provider),z!=null&&z.model&&(fe.model=z.model);const ue=O2(ne==null?void 0:ne.testType);ue&&(fe.testType=ue),W.start(`/api/skills/${a}/${r}/generate-evals?sse`,Object.keys(fe).length>0?fe:void 0)},[u,a,r,W,z]),ge=Pu(),xe=v.useRef(0);v.useEffect(()=>()=>{ge.stop()},[ge.stop]),v.useEffect(()=>{const ne=ge.events;for(let fe=xe.current;fe<ne.length;fe++){const ue=ne[fe];if(ue.event==="classifying"){const he=ue.data;f({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(ue.event==="prompt_result"&&f({type:"ACTIVATION_RESULT",result:ue.data}),ue.event==="done"){oe.current&&(clearTimeout(oe.current),oe.current=null);const he=ue.data;if(he.error)f({type:"ACTIVATION_ERROR",error:he.error});else{f({type:"ACTIVATION_DONE",summary:he});const be={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:he.total,summary:{precision:he.precision,recall:he.recall,reliability:he.reliability,tp:he.tp,tn:he.tn,fp:he.fp,fn:he.fn}};f({type:"ACTIVATION_HISTORY_LOADED",runs:[be,...m.activationHistory??[]]})}}}xe.current=ne.length},[ge.events,z,m.activationHistory]),v.useEffect(()=>{ge.error&&(oe.current&&(clearTimeout(oe.current),oe.current=null),f({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const oe=v.useRef(null),ae=v.useCallback(()=>{oe.current&&(clearTimeout(oe.current),oe.current=null),ge.stop(),f({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),ve=v.useCallback(ne=>{const ue=ne.trim().split(`
|
|
58
|
+
`).filter(Boolean).map(be=>be.startsWith("!")?{prompt:be.slice(1).trim(),expected:"should_not_activate"}:be.startsWith("+")?{prompt:be.slice(1).trim(),expected:"should_activate"}:{prompt:be.trim(),expected:"auto"});xe.current=0,f({type:"ACTIVATION_START"}),f({type:"SET_ACTIVATION_PROMPTS",prompts:ne});const he={prompts:ue};z!=null&&z.provider&&(he.provider=z.provider),z!=null&&z.model&&(he.model=z.model),ge.start(`/api/skills/${a}/${r}/activation-test`,he),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{ge.stop(),f({type:"ACTIVATION_TIMEOUT"}),oe.current=null},12e4)},[a,r,ge,z]),Ie=v.useCallback(async(ne=8)=>{f({type:"GENERATE_PROMPTS_START"});try{const fe={count:ne};z!=null&&z.provider&&(fe.provider=z.provider),z!=null&&z.model&&(fe.model=z.model);const ue=await fetch(`/api/skills/${a}/${r}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)});if(!ue.ok){let ct=`HTTP ${ue.status}`;try{const Vt=await ue.json();Vt.error&&(ct=Vt.error)}catch{}throw new Error(ct)}const he=ue.body.getReader(),be=new TextDecoder;let _e="",Me="",dt=[];for(;;){const{done:ct,value:Vt}=await he.read();if(ct)break;_e+=be.decode(Vt,{stream:!0});const $t=_e.split(`
|
|
59
|
+
`);_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 Zt=dt.map(ct=>`${ct.expected==="should_activate"?"+":"!"}${ct.prompt}`).join(`
|
|
60
|
+
`);f({type:"SET_ACTIVATION_PROMPTS",prompts:Zt}),f({type:"GENERATE_PROMPTS_DONE"})}catch(fe){f({type:"GENERATE_PROMPTS_ERROR",error:fe.message})}},[a,r,z]),Be=v.useMemo(()=>({state:m,dispatch:f,isReadOnly:u,saveContent:k,saveEvals:T,runCase:L,runAll:I,cancelCase:_,cancelAll:$,improveForCase:N,applyImproveAndRerun:M,refreshSkillContent:me,generateEvals:de,runActivationTest:ve,cancelActivation:ae,generateActivationPrompts:Ie,fetchActivationHistory:E,submitAiEdit:P,cancelAiEdit:te,applyAiEdit:X,discardAiEdit:O,toggleEvalChange:A,selectAllEvalChanges:B,deselectAllEvalChanges:se,retryEvalsSave:Y}),[m,u,k,T,L,I,_,$,N,M,me,de,ve,ae,Ie,E,P,te,X,O,A,B,se,Y]);return n.jsx(Fv.Provider,{value:Be,children:o})}const no=new Map,vl=new Map,ms=new Map;function ga(a){no.delete(a),vl.delete(a);const r=ms.get(a);if(r)for(const i of r)i()}function Ms(a,r,i={}){const{ttl:o=3e4,enabled:u=!0}=i,[,m]=v.useState(0),f=v.useRef(!0),h=v.useRef(a);h.current=a;const x=()=>ga(a);v.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]),v.useEffect(()=>{if(!u)return;const j=()=>{f.current&&m(S=>S+1)};return ms.has(a)||ms.set(a,new Set),ms.get(a).add(j),()=>{var S;(S=ms.get(a))==null||S.delete(j)}},[a,u]),v.useEffect(()=>{if(!u)return;const j=no.get(a);if(!(!j||Date.now()-j.fetchedAt>o))return;if(vl.has(a)){const E=vl.get(a),k=()=>{f.current&&h.current===a&&m(T=>T+1)};E.subscribers.push(k);return}const C={promise:Promise.resolve(),subscribers:[]},D=r().then(E=>{no.set(a,{data:E,fetchedAt:Date.now()}),vl.delete(a),f.current&&h.current===a&&m(k=>k+1);for(const k of C.subscribers)k()},E=>{vl.delete(a),f.current&&h.current===a&&m(k=>k+1);for(const k of C.subscribers)k();throw E});C.promise=D,vl.set(a,C)},[a,r,o,u]);const p=no.get(a),y=u&&!p&&vl.has(a);return{data:p==null?void 0:p.data,loading:y||u&&!p,error:void 0,revalidate:x}}function U2(a){if(!a)return[];const r=a.split(`
|
|
61
|
+
`),i=[];for(const o of r)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){i.push({type:"header",content:o});continue}if(o.startsWith("+")){i.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){i.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&i.length>0)&&i.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return i}function Ld({contentDiff:a,fromLabel:r,toLabel:i,diffSummary:o,maxHeight:u=480,collapsible:m=!1,renderContext:f="inline",onRetry:h}){const[x,p]=v.useState(m),[y,g]=v.useState("unified"),j=v.useRef(null),S=v.useRef(null),C=v.useMemo(()=>U2(a),[a]),D=v.useMemo(()=>{const _=C.filter(N=>N.type==="add").length,$=C.filter(N=>N.type==="remove").length;return{added:_,removed:$}},[C]),E=v.useMemo(()=>{let _=0,$=0;return C.filter(N=>N.type!=="header").map(N=>N.type==="remove"?(_++,{...N,origNum:_,newNum:null}):N.type==="add"?($++,{...N,origNum:null,newNum:$}):(_++,$++,{...N,origNum:_,newNum:$}))},[C]),k=v.useMemo(()=>{const _=[],$=[];for(const N of E)if(N.type==="remove")_.push(N);else if(N.type==="add")$.push(N);else{for(;_.length<$.length;)_.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<_.length;)$.push({type:"context",content:"",origNum:null,newNum:null});_.push(N),$.push(N)}for(;_.length<$.length;)_.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<_.length;)$.push({type:"context",content:"",origNum:null,newNum:null});return{left:_,right:$}},[E]),T=v.useCallback(_=>{const $=_==="left"?j.current:S.current,N=_==="left"?S.current:j.current;$&&N&&(N.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."}),h&&n.jsx("button",{onClick:h,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:["+",D.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",D.removed]})]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>g(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),m&&n.jsx("button",{onClick:()=>p(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&n.jsx("div",{className:"mx-4 mt-3 px-4 py-2 rounded-lg text-[12px]",style:{background:"var(--accent-muted)",color:"var(--text-secondary)"},children:o}),!x&&(y==="unified"?n.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:u,overflowY:"auto"},children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:E.map((_,$)=>n.jsxs("tr",{style:{background:_.type==="add"?"rgba(34,197,94,0.08)":_.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:_.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:_.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:_.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:_.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:_.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:_.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:_.type==="add"?"var(--green)":_.type==="remove"?"var(--red)":"transparent",borderRight:_.type==="add"?"2px solid var(--green)":_.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:_.type==="add"?"+":_.type==="remove"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:_.type==="add"?"var(--green)":_.type==="remove"?"var(--red)":"var(--text-secondary)"},children:_.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:u,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>T("left"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.left.map((_,$)=>n.jsxs("tr",{style:{background:_.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:_.origNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:_.type==="remove"?"var(--red)":"var(--text-secondary)"},children:_.content||""})]},$))})})}),n.jsx("div",{ref:S,style:{maxHeight:u,overflowY:"auto"},onScroll:()=>T("right"),children:n.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:n.jsx("tbody",{children:k.right.map((_,$)=>n.jsxs("tr",{style:{background:_.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:_.newNum??""}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:_.type==="add"?"var(--green)":"var(--text-secondary)"},children:_.content||""})]},$))})})})]}))]});return f==="modal"?n.jsx("div",{className:L,children:n.jsx("div",{style:{width:"80%",maxWidth:900},children:I})}):I}const Rx={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 H2(a,r){return a?a.length>r?a.slice(0,r)+"…":a:""}function Wv(){const{state:a}=kn(),{plugin:r,skill:i}=a,{refreshSkills:o,updateCount:u}=ya(),m=`versions/${r}/${i}`,f=v.useCallback(()=>Ne.getSkillVersions(r,i),[r,i]),{data:h,loading:x}=Ms(m,f),[p,y]=v.useState(null),[g,j]=v.useState(null),[S,C]=v.useState(null),[D,E]=v.useState(!1),[k,T]=v.useState("idle"),[L,I]=v.useState(null),_=v.useRef(null),$=v.useRef(null),N=v.useMemo(()=>(h==null?void 0:h.find(X=>X.isInstalled))??null,[h]),M=v.useMemo(()=>(h==null?void 0:h[0])??null,[h]),R=N&&M&&N.version!==M.version,H=v.useCallback(X=>{p?!g&&X!==p?j(X):(y(X),j(null),C(null)):(y(X),C(null))},[p,g]),q=v.useCallback(async(X,O)=>{E(!0);try{const A=await Ne.getVersionDiff(r,i,X,O);C(A)}catch{C(null)}finally{E(!1)}},[r,i]);v.useEffect(()=>{if(p&&g){const X=h||[],O=X.findIndex(Y=>Y.version===p),A=X.findIndex(Y=>Y.version===g),[B,se]=O>A?[p,g]:[g,p];q(B,se)}},[p,g,h,q]);const P=v.useCallback(()=>{!N||!M||(y(N.version),j(M.version))},[N,M]),te=v.useCallback(()=>{T("updating"),I(null);const X=Ne.startSkillUpdate(r,i);_.current=X,X.addEventListener("progress",O=>{try{switch(JSON.parse(O.data).status){case"scanning":T("scanning");break;case"installing":T("installing");break;case"done":T("done");break}}catch{T("error"),I("Unexpected response from server")}}),X.addEventListener("done",()=>{X.close(),_.current=null,o(),ga(m),T("done")}),X.addEventListener("error",O=>{const A=O;let B="Connection lost";if(A.data)try{B=JSON.parse(A.data).error||"Update failed"}catch{}T("error"),I(B),X.close(),_.current=null})},[r,i,m,o]);return v.useEffect(()=>()=>{_.current&&(_.current.close(),_.current=null)},[]),x?n.jsxs("div",{className:"p-5",children:[n.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"}),n.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?n.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:n.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):n.jsxs("div",{className:"p-5",children:[n.jsxs("div",{className:"flex items-center justify-between mb-4",children:[n.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),n.jsxs("div",{className:"flex items-center gap-2",children:[R&&n.jsx("button",{onClick:P,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&k!=="done"&&(k==="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:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):n.jsx("button",{onClick:te,disabled:k!=="idle",className:"btn btn-primary text-[11px]",children:k==="idle"?`Update to ${M==null?void 0:M.version}`:k==="updating"?"Starting update...":k==="scanning"?"Scanning...":"Installing..."})),u>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 (",u,")"]})]})]}),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:h.map(X=>{const O=Rx[X.certTier]||Rx.COMMUNITY,A=X.version===p||X.version===g,B=X.isInstalled;return n.jsxs("button",{onClick:()=>H(X.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:A?"var(--accent-muted)":"transparent",border:A?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:se=>{A||(se.currentTarget.style.background="var(--surface-1)")},onMouseLeave:se=>{A||(se.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:X.version}),n.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.bg,color:O.text},children:X.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(X.createdAt).toLocaleDateString()})]}),X.diffSummary&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:H2(X.diffSummary,80)})]},X.version)})}),n.jsx("div",{ref:$,style:{height:1}})]}),D&&n.jsx("div",{className:"mt-4",children:n.jsx("div",{className:"skeleton h-48 rounded-xl"})}),S&&!D&&n.jsx("div",{className:"mt-4",children:n.jsx(Ld,{contentDiff:S.contentDiff,fromLabel:S.from,toLabel:S.to,diffSummary:S.diffSummary,renderContext:"inline",onRetry:()=>p&&g&&q(S.from,S.to)})})]})}function I2(a){return a==null?"var(--text-tertiary)":a>=.7?"var(--green)":a>=.4?"var(--yellow)":"var(--red)"}function V2(a){return a==null?"var(--surface-3)":a>=.7?"var(--green-muted)":a>=.4?"var(--yellow-muted)":"var(--red-muted)"}function Ax(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function _d(a){return a.skill?G2({skill:a.skill}):Y2({state:a.state,isReadOnly:a.isReadOnly,onDelete:a.onDelete})}function $2(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 G2({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),Ax(J.toasts.pathCopied,"info")}catch{Ax(J.toasts.permissionDenied,"error")}},[a.dir]),u=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: ${u}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:m}}),u]})]}),n.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[n.jsx("h2",{"data-testid":"detail-header-name",style:{fontFamily:"var(--font-serif)",fontSize:20,fontWeight:500,lineHeight:1.25,color:"var(--text-primary)",margin:0},children:a.skill}),n.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:a.version??"—"})]}),n.jsx(q2,{skill:a}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:a.dir,"aria-label":`Copy path ${a.dir} to clipboard`,onClick:o,style:{display:"inline-flex",alignItems:"center",padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:4,background:"transparent",fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"pointer"},children:$2(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 q2({skill:a}){const r=a.installMethod,i=a.symlinkTarget;if(!r)return null;let o="";switch(r){case"symlinked":o=i?`Symlinked from ${i}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return n.jsxs("div",{"data-testid":"detail-header-install-method",style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-secondary)",fontFamily:"var(--font-sans)",margin:"6px 0 8px"},children:[n.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),n.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function Y2({state:a,isReadOnly:r,onDelete:i}){const{plugin:o,skill:u,evals:m,latestBenchmark:f,isDirty:h,caseRunStates:x,regressions:p,iterationCount:y}=a,g=Array.from(x.values()).some(k=>k.status==="running"||k.status==="queued"),j=f==null?void 0:f.overall_pass_rate,S=(m==null?void 0:m.evals.reduce((k,T)=>k+T.assertions.length,0))??0,C=(m==null?void 0:m.evals.length)??0,D=I2(j),E=V2(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(P2,{}),n.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:u}),r&&n.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&n.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),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 "${u}"? 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:k=>{g||(k.currentTarget.style.color="var(--red)")},onMouseLeave:k=>{k.currentTarget.style.color="var(--text-tertiary)"},children:n.jsx(K2,{})}),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":""]}),y>0&&n.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),n.jsx("span",{className:"pill",style:{background:E,color:D},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 P2(){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 K2(){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 F2=[{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 W2({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 Q2({activePanel:a,onPanelChange:r,isDirty:i,isRunning:o,hasRegressions:u,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:F2.map((h,x)=>n.jsxs("div",{className:"flex items-center",children:[x>0&&n.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(p=>{const y=a===p.id,g=p.id==="editor"&&i||p.id==="run"&&o||p.id==="activation"&&m||p.id==="history"&&u||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:y?"var(--text-primary)":"var(--text-tertiary)",borderBottom:y?"2px solid var(--accent)":"2px solid transparent",cursor:"pointer",border:"none",borderBottomWidth:2,borderBottomStyle:"solid",borderBottomColor:y?"var(--accent)":"transparent",whiteSpace:"nowrap"},onMouseEnter:S=>{y||(S.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:S=>{y||(S.currentTarget.style.color="var(--text-tertiary)")},children:[n.jsx(W2,{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)})]},h.label))})}const Mx={rate_limit:{icon:"⏱",color:"var(--amber, #f59e0b)"},context_window:{icon:"⚠",color:"var(--amber, #f59e0b)"},auth:{icon:"🔒",color:"var(--red, #ef4444)"},timeout:{icon:"⌛",color:"var(--amber, #f59e0b)"},model_not_found:{icon:"🔍",color:"var(--red, #ef4444)"},provider_unavailable:{icon:"⚡",color:"var(--red, #ef4444)"},parse_error:{icon:"❓",color:"var(--amber, #f59e0b)"},unknown:{icon:"❌",color:"var(--red, #ef4444)"}};function Ds({error:a,onRetry:r,onDismiss:i}){const[o,u]=v.useState(null),m=v.useRef(null);v.useEffect(()=>(a.category==="rate_limit"&&a.retryAfterMs?u(Math.ceil(a.retryAfterMs/1e3)):u(null),()=>{m.current&&clearInterval(m.current)}),[a]),v.useEffect(()=>{if(!(o==null||o<=0))return m.current=setInterval(()=>{u(x=>x==null||x<=1?(m.current&&clearInterval(m.current),0):x-1)},1e3),()=>{m.current&&clearInterval(m.current)}},[o!=null&&o>0]);const f=Mx[a.category]||Mx.unknown,h=o!=null&&o>0;return n.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${f.color} 30%, transparent)`,background:`color-mix(in srgb, ${f.color} 6%, var(--surface-1))`},children:[n.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{style:{fontSize:14},children:f.icon}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:f.color},children:a.title})]}),i&&n.jsx("button",{onClick:i,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),n.jsxs("div",{className:"px-3.5 pb-3",children:[n.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:a.description}),n.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.hint}),(r||o!=null)&&n.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:r&&n.jsx("button",{onClick:r,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class X2 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 Z2(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 J2(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(),u={},m=i.split(`
|
|
62
|
+
`);let f="",h=!1;for(const x of m){const p=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&f&&h){const j=p[1],S=p[2].trim();let C=u[f];if((typeof C!="object"||Array.isArray(C))&&(C={},u[f]=C),!S)C[j]=[];else{const D=S.match(/^\[(.+)\]$/);D?C[j]=D[1].split(",").map(E=>E.trim().replace(/^["']|["']$/g,"")).filter(Boolean):C[j]=S.replace(/^["']|["']$/g,"")}continue}const y=x.match(/^\s+-\s+(.+)$/);if(y&&f){h=!1;const j=u[f];Array.isArray(j)?j.push(y[1].trim().replace(/^["']|["']$/g,"")):u[f]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const g=x.match(/^([\w-]+):\s*(.*)$/);if(g){f=g[1];const j=g[2].trim();if(h=!1,!j){u[f]={},h=!0;continue}const S=j.match(/^\[(.+)\]$/);if(S){u[f]=S[1].split(",").map(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}u[f]=j.replace(/^["']|["']$/g,"")}}return{metadata:u,body:o}}function xo(a){if(!a)return"";try{let r=a.replace(/^---\n[\s\S]*?\n---\n?/,""),i=eS(r);return i=i.replace(/```(\w*)\n([\s\S]*?)```/g,'<pre style="background:var(--surface-2);padding:0.75rem;border-radius:6px;overflow-x:auto;font-size:12px;line-height:1.5;margin:0.5rem 0;border:1px solid var(--border-subtle)"><code>$2</code></pre>'),i=i.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),i=i.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),i=i.replace(/\*([^*]+)\*/g,"<em>$1</em>"),i=i.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),i=i.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),i=i.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),i=i.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),i=i.replace(/\n/g,"<br/>"),i}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}</pre>`}}function eS(a){const r=a.split(`
|
|
63
|
+
`),i=[];let o=0;for(;o<r.length;)if(r[o].trim().startsWith("|")&&o+1<r.length&&r[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(r[o+1])){const u=Dx(r[o]);o+=2;const m=[];for(;o<r.length&&r[o].trim().startsWith("|");)m.push(Dx(r[o])),o++;const f='style="text-align:left;padding:0.4rem 0.6rem;font-weight:600;font-size:12px;color:var(--text-primary);border-bottom:1px solid var(--border-default)"',h='style="padding:0.4rem 0.6rem;font-size:12px;color:var(--text-secondary);border-bottom:1px solid var(--border-subtle)"';let x='<table style="width:100%;border-collapse:collapse;margin:0.5rem 0;border:1px solid var(--border-subtle);border-radius:6px;overflow:hidden">';x+="<thead><tr>";for(const p of u)x+=`<th ${f}>${p}</th>`;x+="</tr></thead><tbody>";for(const p of m){x+="<tr>";for(const y of p)x+=`<td ${h}>${y}</td>`;x+="</tr>"}x+="</tbody></table>",i.push(x)}else i.push(r[o]),o++;return i.join(`
|
|
64
|
+
`)}function Dx(a){return a.split("|").map(r=>r.trim()).filter(r=>r.length>0)}function vo(a,r){const i=a.split(`
|
|
65
|
+
`),o=r.split(`
|
|
66
|
+
`);if(i.length>1e3||o.length>1e3)return[...i.map(y=>({type:"unchanged",content:y}))];const u=i.length,m=o.length,f=Array.from({length:u+1},()=>new Array(m+1).fill(0));for(let y=1;y<=u;y++)for(let g=1;g<=m;g++)i[y-1]===o[g-1]?f[y][g]=f[y-1][g-1]+1:f[y][g]=Math.max(f[y-1][g],f[y][g-1]);const h=[];let x=u,p=m;for(;x>0||p>0;)x>0&&p>0&&i[x-1]===o[p-1]?(h.push({type:"unchanged",content:i[x-1]}),x--,p--):p>0&&(x===0||f[x][p-1]>=f[x-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:i[x-1]}),x--);return h.reverse()}function tS(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 zs({entries:a,isRunning:r}){const[i,o]=v.useState(!1),u=v.useRef(null);return v.useEffect(()=>{u.current&&!i&&(u.current.scrollTop=u.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:u,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:a.map((m,f)=>{const h=f===a.length-1&&r,x=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:h?1:.7},children:[tS(m.phase,h),n.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),n.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:m.message}),m.current!=null&&m.total!=null&&n.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",m.current,"/",m.total,"]"]})]},f)})})]})}function nS({plugin:a,skill:r,skillContent:i,onApplied:o}){const[u,m]=v.useState("closed"),{config:f}=bl(),[h,x]=v.useState("claude-cli"),[p,y]=v.useState("opus"),[g,j]=v.useState([]),[S,C]=v.useState(""),[D,E]=v.useState(""),[k,T]=v.useState(null),[L,I]=v.useState(null),[_,$]=v.useState([]),[N,M]=v.useState(!1),R=v.useRef(null);v.useEffect(()=>{if(!f)return;f.providers.find(B=>B.id==="claude-cli"&&B.available)&&(x("claude-cli"),y("opus"))},[f]),v.useEffect(()=>()=>{var A;(A=R.current)==null||A.abort()},[]);function H(){return f==null?void 0:f.providers.find(A=>A.id===h&&A.available)}const q=v.useCallback(()=>{var A;(A=R.current)==null||A.abort(),m("open")},[]);async function P(){m("loading"),T(null),I(null),$([]);const A=new AbortController;R.current=A;try{const B=await fetch(`/api/skills/${encodeURIComponent(a)}/${encodeURIComponent(r)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:p}),signal:A.signal});if(!B.ok||!B.body){let W=`HTTP ${B.status}`;try{const ie=await B.json();ie.error&&(W=ie.error)}catch{}throw new Error(W)}const se=B.body.getReader(),Y=new TextDecoder;let me="",z="";for(;;){const{done:W,value:ie}=await se.read();if(W)break;me+=Y.decode(ie,{stream:!0});const de=me.split(`
|
|
67
|
+
`);me=de.pop()||"";for(const ge of de)if(ge.startsWith("event: "))z=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));z==="progress"?$(oe=>[...oe,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):z==="done"||z==="complete"?(C(xe.improved),E(xe.reasoning||""),j(vo(xe.original||i,xe.improved)),m("diff_shown")):z==="error"&&(T(xe.message||xe.description||"Unknown error"),xe.category&&I(xe),m("open"))}catch{}z=""}}}catch(B){B.name!=="AbortError"&&(T(B.message),m("open"))}finally{R.current=null}}async function te(){M(!0);try{await Ne.applyImprovement(a,r,S),o(S),m("closed")}catch(A){T(A.message)}finally{M(!1)}}function X(){m("closed"),j([]),C(""),E(""),T(null)}if(u==="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 O=H();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:X,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:A=>{A.currentTarget.style.background="var(--surface-3)"},onMouseLeave:A=>{A.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:[(u==="open"||u==="loading")&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),n.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:A=>{x(A.target.value);const B=f==null?void 0:f.providers.find(se=>se.id===A.target.value);B!=null&&B.models[0]&&y(B.models[0].id)},disabled:u==="loading",children:f==null?void 0:f.providers.filter(A=>A.available).map(A=>n.jsx("option",{value:A.id,children:A.label},A.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:A=>y(A.target.value),disabled:u==="loading",children:O==null?void 0:O.models.map(A=>n.jsx("option",{value:A.id,children:A.label},A.id))})]}),u==="loading"?n.jsx("button",{onClick:q,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):n.jsx("button",{onClick:P,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),u==="loading"&&_.length>0&&n.jsx("div",{className:"mt-3",children:n.jsx(zs,{entries:_,isRunning:!0})})]}),k&&n.jsx("div",{className:"mb-4",children:L?n.jsx(Ds,{error:L,onRetry:P,onDismiss:()=>{T(null),I(null)}}):n.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:k})}),u==="diff_shown"&&n.jsxs(n.Fragment,{children:[D&&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: "}),D]}),n.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:g.map((A,B)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:A.type==="added"?"rgba(34,197,94,0.1)":A.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:A.type==="added"?"var(--green)":A.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:A.type==="added"?"3px solid var(--green)":A.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:A.type==="added"?"+":A.type==="removed"?"-":" "}),A.content]},B))}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:te,disabled:N,className:"btn btn-primary",children:N?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:X,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const zx={remove:{bg:"var(--red-muted)",color:"var(--red)",label:"REMOVE"},modify:{bg:"rgba(251,191,36,0.15)",color:"#fbbf24",label:"MODIFY"},add:{bg:"var(--green-muted)",color:"var(--green)",label:"ADD"}},aS={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function lS({change:a,index:r,selected:i,onToggle:o,originalEval:u}){var g;const[m,f]=v.useState(!1),h=zx[a.action]??zx.add,x=aS[a.action]??"var(--border-subtle)",p=a.action==="remove"?(u==null?void 0:u.name)??`Eval #${a.evalId}`:((g=a.eval)==null?void 0:g.name)??"Unnamed",y=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 ${x}`,opacity:i?1:.5},children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsx("input",{type:"checkbox",checked:i,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),n.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),n.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children: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(rS,{evalCase:a.eval}),a.action==="modify"&&a.eval&&u&&n.jsx(sS,{original:u,proposed:a.eval}),a.action==="remove"&&u&&n.jsx(iS,{evalCase:u})]})]})}function rS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",children:[n.jsx(pd,{label:"Prompt",value:a.prompt}),n.jsx(pd,{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 sS({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??[],u=r.assertions??[],m=new Set(o.map(p=>p.text)),f=new Set(u.map(p=>p.text)),h=u.filter(p=>!m.has(p.text)),x=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:["- ",md(p.old,120)]}),n.jsxs("div",{style:{color:"var(--green)"},children:["+ ",md(p.new,120)]})]})]},p.label)),(h.length>0||x.length>0)&&n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),n.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>n.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),i.length===0&&h.length===0&&x.length===0&&n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function iS({evalCase:a}){var r;return n.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[n.jsx(pd,{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 pd({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:md(r,300)})]})}function md(a,r){return a.length>r?a.slice(0,r)+"...":a}const Lx={remove:0,modify:1,add:2};function oS({changes:a,selections:r,currentEvals:i,onToggle:o,onSelectAll:u,onDeselectAll:m}){if(a.length===0)return null;const f=a.map((x,p)=>({change:x,originalIndex:p}));f.sort((x,p)=>(Lx[x.change.action]??2)-(Lx[p.change.action]??2));const h=Array.from(r.values()).filter(Boolean).length;return n.jsxs("div",{className:"mt-3 animate-fade-in",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",a.length," selected)"]})]}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("button",{onClick:u,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--accent)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--accent-muted)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Select All"}),n.jsx("button",{onClick:m,className:"text-[10px] px-2 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--surface-3)"},onMouseLeave:x=>{x.currentTarget.style.background="transparent"},children:"Deselect All"})]})]}),n.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:f.map(({change:x,originalIndex:p})=>n.jsx(lS,{change:x,index:p,selected:r.get(p)??!1,onToggle:o,originalEval:x.evalId!=null?i.find(y=>y.id===x.evalId):void 0},p))})]})}function cS(){var A;const{state:a,dispatch:r,submitAiEdit:i,applyAiEdit:o,discardAiEdit:u,cancelAiEdit:m,toggleEvalChange:f,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:p}=kn(),{aiEditLoading:y,aiEditResult:g,aiEditError:j,aiEditClassifiedError:S,aiEditProgress:C,aiEditEvalChanges:D,aiEditEvalSelections:E,aiEditEvalsRetry:k}=a,[T,L]=v.useState(""),{config:I}=bl(),[_,$]=v.useState("claude-cli"),[N,M]=v.useState("opus"),R=v.useRef(null);v.useEffect(()=>{var B;(B=R.current)==null||B.focus()},[]),v.useEffect(()=>{if(!I)return;I.providers.find(se=>se.id==="claude-cli"&&se.available)&&($("claude-cli"),M("opus"))},[I]);const H=I==null?void 0:I.providers.find(B=>B.id===_&&B.available),q=v.useCallback(()=>{const B=T.trim();!B||y||i(B,_,N)},[T,y,i,_,N]),P=v.useCallback(B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),q()),B.key==="Escape"&&(B.preventDefault(),y?m():u())},[q,y,m,u]),te=v.useCallback(()=>{r({type:"CLOSE_AI_EDIT"}),r({type:"OPEN_AI_EDIT"})},[r]),X=g?vo(a.skillContent,g.improved):[],O=((A=a.evals)==null?void 0:A.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:u,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:R,value:T,onChange:B=>L(B.target.value),onKeyDown:P,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:B=>{const se=B.currentTarget;se.style.height="auto",se.style.height=Math.min(se.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:_,onChange:B=>{$(B.target.value);const se=I==null?void 0:I.providers.find(Y=>Y.id===B.target.value);se!=null&&se.models[0]&&M(se.models[0].id)},disabled:y,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:N,onChange:B=>M(B.target.value),disabled:y,style:{width:"100%"},children:H==null?void 0:H.models.map(B=>n.jsx("option",{value:B.id,children:B.label},B.id))})]}),y?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:!T.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&C.length>0&&n.jsx("div",{className:"mt-2.5",children:n.jsx(zs,{entries:C,isRunning:!0})})]}),j&&n.jsx("div",{className:"mt-3",children:S?n.jsx(Ds,{error:S,onRetry:te,onDismiss:u}):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:X.map((B,se)=>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]},se))}),n.jsx(oS,{changes:D,selections:E,currentEvals:O,onToggle:f,onSelectAll:h,onDeselectAll:x}),k&&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:u,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),n.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function uS(a,r){const[i,o]=v.useState([]),[u,m]=v.useState("SKILL.md"),[f,h]=v.useState(null),[x,p]=v.useState(!1),[y,g]=v.useState(null),j=v.useCallback(async()=>{try{const D=await Ne.getSkillFiles(a,r);o(D.files)}catch{o([])}},[a,r]);v.useEffect(()=>{m("SKILL.md"),h(null),g(null),j()},[a,r,j]);const S=v.useCallback(async D=>{if(m(D),D==="SKILL.md"){h(null),g(null);return}p(!0),g(null);try{const E=await Ne.getSkillFile(a,r,D);h(E)}catch(E){g(`Unable to open file: ${E.message}`),h(null)}finally{p(!1)}},[a,r]),C=v.useCallback(()=>{j()},[j]);return{files:i,activeFile:u,secondaryContent:f,loading:x,error:y,selectFile:S,refresh:C,isSkillMd:u==="SKILL.md"}}function dS(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function fS(a){const r=[],i=new Map;for(const o of a){const u=o.path.split("/"),f={name:u[u.length-1],path:o.path,type:o.type,size:o.size,children:[]};i.set(o.path,f)}for(const o of a){const u=o.path.split("/");if(u.length===1){const m=i.get(o.path);m&&r.push(m)}else{const m=u.slice(0,-1).join("/"),f=i.get(m),h=i.get(o.path);f&&h&&f.children.push(h)}}return r}function Qv({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 Xv(){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 pS(){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 mS(){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 Zv({node:a,depth:r,activeFile:i,onSelect:o}){const[u,m]=v.useState(!0),f=a.path===i;return a.type==="dir"?n.jsxs("div",{children:[n.jsxs("button",{onClick:()=>m(!u),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(Qv,{expanded:u}),n.jsx(Xv,{}),n.jsxs("span",{children:[a.name,"/"]})]}),u&&a.children.map(h=>n.jsx(Zv,{node:h,depth:r+1,activeFile:i,onSelect:o},h.path))]}):n.jsxs("button",{onClick:()=>o(a.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+r*14}px`,paddingTop:2,paddingBottom:2,background:f?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:f?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[n.jsx("span",{style:{width:10}}),n.jsx(pS,{}),n.jsx("span",{style:{flex:1},children:a.name}),n.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:dS(a.size)})]})}function hS({files:a,activeFile:r,onSelect:i,onRefresh:o}){const[u,m]=v.useState(!1),f=v.useMemo(()=>fS(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(!u),children:[n.jsx(Qv,{expanded:u}),n.jsx(Xv,{}),n.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),n.jsx("button",{onClick:h=>{h.stopPropagation(),o()},style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",padding:"2px 4px",display:"flex",alignItems:"center",borderRadius:3},title:"Refresh file list",children:n.jsx(mS,{})})]}),u&&n.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:f.length===0?n.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):f.map(h=>n.jsx(Zv,{node:h,depth:0,activeFile:r,onSelect:i},h.path))})]})}function Fi(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function xS(a){try{return JSON.stringify(JSON.parse(a),null,2)}catch{return a}}function vS(a){const r=a.toLowerCase();return r.endsWith(".json")?"json":r.endsWith(".md")?"md":"other"}function _x({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 Ox({content:a,fileType:r}){if(r==="json"){const i=xS(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:xo(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 Bx(a){try{return JSON.stringify(JSON.parse(a),null,2).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"([^"\\]|\\.)*"\s*:/g,i=>`<span style="color:#6383ff">${i}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,i=>`<span style="color:#22c55e">${i.slice(0,2)}<span style="color:#22c55e">${i.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(i,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(i,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}}function gS({file:a,loading:r,error:i,viewMode:o,plugin:u,skill:m,onSaved:f,onDirtyChange:h}){const[x,p]=v.useState(o),[y,g]=v.useState(!1),[j,S]=v.useState(""),[C,D]=v.useState(!1),[E,k]=v.useState(null),T=o!==x?o:x;v.useEffect(()=>{h==null||h(y)},[y,h]);const L=v.useCallback(()=>{(a==null?void 0:a.content)!=null&&(S(a.content),g(!0))},[a]),I=v.useCallback(()=>{g(!1)},[]),_=v.useCallback(async()=>{if(!(!u||!m||!a)){D(!0);try{await Ne.saveSkillFile(u,m,a.path,j),k("Saved"),g(!1),f==null||f(),setTimeout(()=>k(null),2e3)}catch(M){k(`Save failed: ${M.message}`),setTimeout(()=>k(null),3e3)}finally{D(!1)}}},[u,m,a,j,f]);if(v.useEffect(()=>{if(!y)return;const M=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),_())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[y,_]),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 (",Fi(a.size),") — cannot be displayed"]});const $=a.content??"",N=vS(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 ",Fi(512*1024)," — ",Fi(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:[(N==="md"||N==="json")&&["raw","split","preview"].map(M=>n.jsx("button",{onClick:()=>p(M),style:{padding:"2px 8px",fontSize:11,background:T===M?"var(--accent-muted)":"none",color:T===M?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:M},M)),n.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[Fi(a.size),u&&m&&!a.binary&&!y&&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"}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:_,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:y?n.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[n.jsx("textarea",{value:j,onChange:M=>S(M.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:_,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"})]})]}):T==="split"&&N!=="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(_x,{content:$})}),n.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:N==="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:Bx($)}}):n.jsx(Ox,{content:$,fileType:N})})]}):T==="preview"&&N!=="other"?N==="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:Bx($)}}):n.jsx(Ox,{content:$,fileType:N}):n.jsx(_x,{content:$})})]})}function yS({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 bS({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 jS({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 SS({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 Ku({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 kS(){const{state:a,dispatch:r,saveContent:i,isReadOnly:o}=kn(),{plugin:u,skill:m,skillContent:f,isDirty:h,improveTarget:x,aiEditOpen:p}=a,[y,g]=v.useState("split"),[j,S]=v.useState(!1),C=v.useRef(null),[D,E]=v.useState(!1),[k,T]=v.useState(""),[L,I]=v.useState(!1),[_,$]=v.useState(null),[N,M]=v.useState([]),[R,H]=v.useState([]),[q,P]=v.useState(null),te=v.useRef(null),{config:X}=bl(),{files:O,activeFile:A,secondaryContent:B,loading:se,error:Y,selectFile:me,refresh:z,isSkillMd:W}=uS(u??"",m??""),[ie,de]=v.useState(!1),ge=v.useCallback(ye=>{ie&&!window.confirm("You have unsaved changes. Discard?")||me(ye)},[ie,me]);v.useEffect(()=>()=>{var ye;(ye=te.current)==null||ye.abort()},[]);const{metadata:xe,body:oe}=J2(f),ae=xe["allowed-tools"],ve=Array.isArray(ae)?ae:typeof ae=="string"?[ae]:[],Ie=xe.name,Be=xe.description,ne=xe.metadata,fe=typeof ne=="object"&&!Array.isArray(ne)?ne:null,ue=xe.version||(fe==null?void 0:fe.version),he=xe.tags||(fe==null?void 0:fe.tags),be=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ye=>ye.trim()).filter(Boolean):[],_e=new Set(["name","description","metadata","allowed-tools","version","tags"]),Me=Object.entries(xe).filter(([ye])=>!_e.has(ye)),dt=v.useCallback(async()=>{S(!0),await i(),S(!1)},[i]),Zt=v.useCallback(ye=>{(ye.ctrlKey||ye.metaKey)&&ye.key==="s"&&(ye.preventDefault(),ye.stopPropagation(),h&&dt()),(ye.ctrlKey||ye.metaKey)&&ye.key==="k"&&(ye.preventDefault(),ye.stopPropagation(),r({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,dt,p,r]),ct=v.useCallback(async()=>{var Rt,De;if(!k.trim())return;(Rt=te.current)==null||Rt.abort();const ye=new AbortController;te.current=ye,I(!0),P(null),H([]),$(null),M([]);try{const xt=(X==null?void 0:X.provider)||"claude-cli",Ft=(X==null?void 0:X.model)||"sonnet",nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:k,provider:xt,model:Ft}),signal:ye.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Xn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Xa.read();if(bt)break;Ct+=Xn.decode(Bn,{stream:!0});const Za=Ct.split(`
|
|
68
|
+
`);Ct=Za.pop()||"";for(const Un of Za)if(Un.startsWith("event: "))St=Un.slice(7).trim();else if(Un.startsWith("data: ")){try{const Ve=JSON.parse(Un.slice(6));if(St==="progress")H(Ut=>[...Ut,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ut=["---"];Ve.name&&Ut.push(`name: ${Ve.name}`),Ve.description&&Ut.push(`description: "${Ve.description.replace(/"/g,'\\"')}"`),Ve.model&&Ut.push(`model: ${Ve.model}`),(De=Ve.allowedTools)!=null&&De.trim()&&Ut.push(`allowed-tools: ${Ve.allowedTools.trim()}`),Ut.push("---","",Ve.body||"");const Zn=Ut.join(`
|
|
69
|
+
`);$(Zn),M(vo(f,Zn)),I(!1)}else St==="error"&&(P(Ve.message||Ve.description||"Generation failed"),I(!1))}catch{}St=""}}}catch(xt){xt.name!=="AbortError"&&P(xt.message)}finally{I(!1),te.current=null}},[k,X,f]),Vt=v.useCallback(()=>{_&&r({type:"SET_CONTENT",content:_}),E(!1),$(null),M([]),T(""),H([])},[_,r]),$t=v.useCallback(()=>{E(!1),$(null),M([]),T(""),H([]),P(null)},[]),tt=v.useCallback(()=>{var ye;D?((ye=te.current)==null||ye.abort(),$t()):(p&&r({type:"CLOSE_AI_EDIT"}),E(!0))},[D,p,r,$t]),jt=[{mode:"raw",icon:n.jsx(yS,{}),label:"Editor"},{mode:"split",icon:n.jsx(bS,{}),label:"Split"},{mode:"preview",icon:n.jsx(jS,{}),label:"Preview"}];return n.jsxs("div",{className:"flex flex-col h-full",onKeyDown:Zt,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:ye,icon:Rt,label:De})=>n.jsxs("button",{onClick:()=>g(ye),title:De,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ye?"var(--surface-4)":"transparent",color:y===ye?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ye?600:400,border:"none",cursor:"pointer"},children:[Rt,n.jsx("span",{style:{letterSpacing:"0.01em"},children:De})]},ye))}),W?o?n.jsx("div",{className:"flex items-center gap-2",children:n.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("button",{onClick:()=>{p?r({type:"CLOSE_AI_EDIT"}):(D&&$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(SS,{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:D?600:400,border:"none",cursor:"pointer",color:D?"var(--purple)":"var(--text-tertiary)",background:D?"var(--purple-muted)":"transparent"},children:[n.jsx(Ku,{size:13}),n.jsx("span",{children:"Regenerate"})]}),n.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&n.jsx("button",{onClick:()=>r({type:"SET_CONTENT",content:a.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),n.jsx("button",{onClick:dt,disabled:!h||j,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:j?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),u&&m&&n.jsx(hS,{files:O,activeFile:A,onSelect:ge,onRefresh:z}),!W&&n.jsx(gS,{file:B,loading:se,error:Y,viewMode:y,plugin:u??void 0,skill:m??void 0,onSaved:()=>{me(A),z()},onDirtyChange:de}),W&&n.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&n.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:n.jsx("textarea",{ref:C,value:f,onChange:ye=>{o||r({type:"SET_CONTENT",content:ye.target.value})},onKeyDown:Zt,spellCheck:!1,readOnly:o,className:"flex-1 w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",fontSize:12.5,lineHeight:1.7,tabSize:2,border:"none",padding:"16px 20px",opacity:o?.7:1}})}),y!=="raw"&&n.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:n.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(Ie||ue||Be)&&n.jsxs("div",{style:{marginBottom:20},children:[n.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[Ie&&n.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:Ie}),ue&&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",ue]})]}),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})]}),be.length>0&&n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:be.map(ye=>n.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ye},ye))}),ve.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"}),ve.map(ye=>n.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ye},ye))]})}),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(([ye,Rt],De)=>{const xt=Array.isArray(Rt)?Rt.join(", "):typeof Rt=="object"?Object.entries(Rt).map(([Ft,nt])=>`${Ft}: ${Array.isArray(nt)?nt.join(", "):nt}`).join(" | "):Rt;return n.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:De>0?"1px solid var(--border-subtle)":"none"},children:[n.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ye}),n.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:xt})]},ye)})}),(Ie||Be||be.length>0||ve.length>0||Me.length>0)&&oe&&n.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),oe&&n.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:xo(oe)}})]})})]}),W&&p&&n.jsx(cS,{}),W&&D&&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:[!_&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Ku,{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:k,onChange:ye=>T(ye.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:ye=>{ye.key==="Enter"&&(ye.ctrlKey||ye.metaKey)&&k.trim()&&!L&&(ye.preventDefault(),ct())}})}),n.jsxs("div",{className:"flex items-center gap-2",children:[L?n.jsx("button",{onClick:()=>{var ye;(ye=te.current)==null||ye.abort(),I(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):n.jsx("button",{onClick:ct,disabled:!k.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&&R.length>0&&n.jsx("div",{className:"mt-2",children:n.jsx(zs,{entries:R,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"})]})]}),_&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsx(Ku,{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:N.map((ye,Rt)=>n.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ye.type==="added"?"var(--green-muted)":ye.type==="removed"?"var(--red-muted)":"transparent",color:ye.type==="added"?"var(--green)":ye.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ye.type==="added"?"3px solid var(--green)":ye.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[n.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ye.type==="added"?"+":ye.type==="removed"?"-":" "}),ye.content]},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"})]})]})]})}),W&&x!==null&&u&&m&&n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(nS,{plugin:u,skill:m,skillContent:f,onApplied:ye=>{r({type:"SET_CONTENT",content:ye}),r({type:"CONTENT_SAVED"}),r({type:"CLOSE_IMPROVE"})}})})]})}function or(a){return a.testType==="integration"?"integration":"unit"}function mr(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function Jv(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 eg(a){return a==null?"--":a>=1e3?`${(a/1e3).toFixed(1)}s`:`${a}ms`}const wS=new Set(["benchmark","comparison","baseline"]);function Ux(a,r,i,o){return a.map(({rate:u,idx:m,total:f})=>{const h=o+m/(f-1)*(r-o*2),x=o+(i-o*2)-u*(i-o*2);return`${h},${x}`})}function tg({entries:a}){const r=a.filter(g=>wS.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 u=80,m=24,f=2,h=i.length>=2?Ux(i,u,m,f):[],x=o.length>=2?Ux(o,u,m,f):[],p=h[h.length-1],y=x[x.length-1];return n.jsxs("svg",{width:u,height:m,style:{display:"block",flexShrink:0},children:[x.length>0&&n.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&n.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&n.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.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 ng(a,r,i){const o=isNaN(r)?0:r,u=[],m=[],f=[];if((a==="PASS"||a==="EFFECTIVE")&&o>=.7){const p=u.length>0?` Met criteria: ${u.map(y=>y.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(", ")}.`:"",y=[...m.map(g=>`Improve "${g.criterion}" (score: ${g.score.toFixed(2)})`),...f.map(g=>`Strengthen "${g.criterion}" (score: ${g.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${a} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:y}}if(a==="INEFFECTIVE"){if(o<.2){const y=[...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:y}}const p=[...m.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.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(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...m.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(u.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(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(u.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 h=u.length>0?` Passing: ${u.map(p=>p.criterion).join(", ")}.`:"",x=f.length>0?` Needs improvement: ${f.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${a} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const ag={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function CS(a){return Object.hasOwn(ag,a)}function NS(a){return CS(a)?ag[a]:a}function ES(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState([]),[m,f]=v.useState([]),[h,x]=v.useState(!0),[p,y]=v.useState(null),[g,j]=v.useState(new Set),[S,C]=v.useState({}),[D,E]=v.useState(null),[k,T]=v.useState(""),[L,I]=v.useState(!1),[_,$]=v.useState(""),[N,M]=v.useState(""),R=v.useCallback(async()=>{x(!0),y(null);try{const[O,A]=await Promise.all([Ne.getCredentials(r,i),Ne.getParams(r,i)]);u(O.credentials),f(A.params)}catch(O){y(O instanceof Error?O.message:"Failed to load parameters"),u([]),f([])}finally{x(!1)}},[r,i]);v.useEffect(()=>{R()},[R]);const H=v.useCallback(async(O,A)=>{I(!0),y(null);try{await Ne.setCredential(r,i,O,A),E(null),T(""),await R()}catch(B){y(B instanceof Error?B.message:`Failed to save ${O}`)}finally{I(!1)}},[r,i,R]),q=v.useCallback(async()=>{const O=_.trim().toUpperCase(),A=N.trim();if(!(!O||!A)){I(!0),y(null);try{await Ne.setCredential(r,i,O,A),$(""),M(""),await R()}catch(B){y(B instanceof Error?B.message:`Failed to add ${O}`)}finally{I(!1)}}},[r,i,_,N,R]),P=v.useCallback(async O=>{if(g.has(O)){j(A=>{const B=new Set(A);return B.delete(O),B}),C(A=>{const B={...A};return delete B[O],B});return}try{const B=(await Ne.getParamsRevealed(r,i,O)).params.find(se=>se.name===O);B!=null&&B.value&&(C(se=>({...se,[O]:B.value})),j(se=>new Set(se).add(O)))}catch{}},[r,i,g]),te=new Set(o.map(O=>O.name)),X=[...o.map(O=>{const A=m.find(B=>B.name===O.name);return{name:O.name,status:O.status,maskedValue:(A==null?void 0:A.maskedValue)??""}}),...m.filter(O=>!te.has(O.name)).map(O=>({name:O.name,status:O.status,maskedValue:O.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}),h&&X.length===0&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&X.length===0&&!p&&n.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),X.map(O=>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:O.name}),n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:O.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:O.status==="ready"?"var(--green)":"var(--red)"},children:O.status}),(O.maskedValue||O.status==="ready")&&n.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[g.has(O.name)?S[O.name]??O.maskedValue:O.maskedValue||"***",n.jsx("button",{onClick:()=>P(O.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${g.has(O.name)?"Hide":"Reveal"} value for ${O.name}`,children:g.has(O.name)?"hide":"show"})]}),D===O.name?n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{value:k,onChange:A=>T(A.target.value),onKeyDown:A=>{A.key==="Enter"&&k.trim()&&H(O.name,k)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${O.name}`,autoFocus:!0}),n.jsx("button",{onClick:()=>H(O.name,k),disabled:L||!k.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),n.jsx("button",{onClick:()=>{E(null),T("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):n.jsx("button",{onClick:()=>{E(O.name),T("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},O.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:_,onChange:O=>$(O.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),n.jsx("input",{value:N,onChange:O=>M(O.target.value),onKeyDown:O=>{O.key==="Enter"&&_.trim()&&N.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||!_.trim()||!N.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 TS(a,r,i){const[o,u]=v.useState(null),[m,f]=v.useState(!1),h=v.useRef("");v.useEffect(()=>{const p=`${a}/${r}/${i}`;h.current!==p&&(h.current=p,f(!0),Ne.getCaseHistory(a,r,i).then(y=>u(y)).catch(()=>u([])).finally(()=>f(!1)))},[a,r,i]);const x=v.useCallback(()=>{f(!0),h.current="",Ne.getCaseHistory(a,r,i).then(p=>u(p)).catch(()=>u([])).finally(()=>f(!1))},[a,r,i]);return{entries:o,loading:m,refetch:x}}function RS(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(x=>x.assertions.find(p=>p.id===a)).filter(Boolean);if(m.length>=2){const p=m.filter(y=>y.pass).length/m.length;p>=.3&&p<=.7&&(o.flaky=!0)}const f=i.find(x=>x.type==="benchmark"),h=i.find(x=>x.type==="baseline");if(f&&h){const x=f.assertions.find(y=>y.id===a),p=h.assertions.find(y=>y.id===a);x!=null&&x.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(r&&!r.pass&&i.length>=1){const p=i[0].assertions.find(y=>y.id===a);p!=null&&p.pass&&(o.regression=!0)}return o}function AS(){var se;const{state:a,dispatch:r,saveEvals:i,runCase:o,runAll:u,cancelCase:m,cancelAll:f,generateEvals:h,isReadOnly:x}=kn(),{evals:p,evalsError:y,selectedCaseId:g,inlineResults:j,caseRunStates:S,generateEvalsLoading:C,generateEvalsProgress:D,generateEvalsError:E}=a,k=v.useMemo(()=>{for(const Y of S.values())if(Y.status==="running"||Y.status==="queued")return!0;return!1},[S]),[T,L]=v.useState(!1),[I,_]=v.useState("all"),$={skill_name:a.skill,evals:[]},N=p??$,M=N.evals,R=v.useMemo(()=>I==="all"?M:M.filter(Y=>or(Y)===I),[I,M]),H=R.find(Y=>Y.id===g)??null;v.useEffect(()=>{g!==null&&!R.find(Y=>Y.id===g)&&r({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,g,r]);const[q,P]=v.useState([]),te=v.useMemo(()=>M.some(Y=>or(Y)==="integration"),[M]);v.useEffect(()=>{te&&Ne.getCredentials(a.plugin,a.skill).then(Y=>P(Y.credentials)).catch(()=>P([]))},[a.plugin,a.skill,te]);const X=v.useMemo(()=>new Set(q.filter(Y=>Y.status==="missing").map(Y=>Y.name)),[q]),[O,A]=v.useState(!1),B=v.useCallback(Y=>{A(!1),h(Y?{testType:Y}:void 0)},[h]);return!p||M.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):n.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M9 11l3 3L22 4"}),n.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),n.jsx("div",{className:"text-center",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),n.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),n.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx("button",{onClick:()=>L(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),n.jsxs("div",{style:{position:"relative"},children:[n.jsxs("div",{className:"flex",children:[n.jsx("button",{onClick:()=>B("unit"),disabled:C||x,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:()=>A(!O),disabled:C||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),O&&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:Y=>{Y.currentTarget.style.background="var(--surface-2)"},onMouseLeave:Y=>{Y.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),C&&D.length>0&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(zs,{entries:D,isRunning:!0})}),E&&n.jsx("div",{className:"w-full max-w-md mt-3",children:n.jsx(Ds,{error:E,onRetry:()=>B()})}),T&&n.jsx(Hx,{evals:N,onSave:Y=>{i(Y),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 (",R.length,")"]}),n.jsx("div",{className:"flex items-center gap-1.5",children:k?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:()=>u("benchmark"),disabled:R.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),n.jsx("button",{onClick:()=>u("comparison"),disabled:R.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),n.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(Y=>n.jsx("button",{onClick:()=>_(Y),style:{padding:"2px 8px",fontSize:10,fontWeight:I===Y?600:400,background:I===Y?"var(--accent-muted)":"transparent",color:I===Y?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:Y==="all"?`All (${M.length})`:Y==="unit"?`Unit (${M.filter(me=>or(me)==="unit").length})`:`Integration (${M.filter(me=>or(me)==="integration").length})`},Y))}),n.jsxs("div",{className:"py-1",children:[R.length===0&&M.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"]}),R.map(Y=>{var ie;const me=j.get(Y.id),z=g===Y.id,W=or(Y);return n.jsxs("button",{onClick:()=>r({type:"SELECT_CASE",caseId:Y.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background: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:["#",Y.id," ",Y.name,n.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:W==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:W==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:W==="unit"?"U":"I"}),W==="integration"&&((ie=Y.requiredCredentials)==null?void 0:ie.some(de=>X.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(lg,{result:me})]}),n.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[Y.assertions.length," assertion",Y.assertions.length!==1?"s":"",(me==null?void 0:me.passRate)!=null&&n.jsx(zS,{passRate:me.passRate})]})]},Y.id)})]}),n.jsx("div",{className:"px-3 py-2",children:!x&&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:Y=>{Y.currentTarget.style.borderColor="var(--accent)",Y.currentTarget.style.color="var(--accent)"},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-default)",Y.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),n.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:n.jsx(ES,{})})]}),n.jsx("div",{className:"overflow-auto",children:H?n.jsx(MS,{evalCase:H,result:j.get(H.id),evals:p,caseStatus:((se=S.get(H.id))==null?void 0:se.status)??"idle",onSaveEvals:i,onRun:Y=>o(Y,"benchmark"),onCompare:Y=>o(Y,"comparison"),onCancel:Y=>m(Y),onImprove:Y=>r({type:"OPEN_IMPROVE",evalId:Y})}):n.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),T&&n.jsx(Hx,{evals:N,onSave:Y=>{i(Y),L(!1)},onCancel:()=>L(!1)})]})}function MS({evalCase:a,result:r,evals:i,caseStatus:o,onSaveEvals:u,onRun:m,onCompare:f,onCancel:h,onImprove:x}){const{state:p,isReadOnly:y}=kn(),{plugin:g,skill:j}=p,{entries:S,loading:C}=TS(g,j,a.id),[D,E]=v.useState(!1),[k,T]=v.useState(a.prompt),[L,I]=v.useState(!1),[_,$]=v.useState(a.expected_output);v.useState(()=>{T(a.prompt),$(a.expected_output)});const N=v.useCallback(Y=>{u({...i,evals:i.evals.map(me=>me.id===Y.id?Y:me)})},[i,u]),M=v.useCallback(()=>{N({...a,prompt:k}),E(!1)},[a,k,N]),R=v.useCallback(()=>{N({...a,expected_output:_}),I(!1)},[a,_,N]),H=v.useCallback(()=>{N({...a,assertions:[...a.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[a,N]),q=v.useCallback((Y,me)=>{N({...a,assertions:a.assertions.map(z=>z.id===Y?{...z,text:me}:z)})},[a,N]),P=v.useCallback(Y=>{N({...a,assertions:a.assertions.filter(me=>me.id!==Y)})},[a,N]),te=v.useCallback(()=>{confirm("Delete this test case?")&&u({...i,evals:i.evals.filter(Y=>Y.id!==a.id)})},[i,a.id,u]),X=r&&r.assertions.length>0&&r.assertions.every(Y=>Y.pass),O=r&&r.assertions.some(Y=>!Y.pass),A=or(a),B=a.requiredCredentials??[],se=A==="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]}),y?n.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:A==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:A==="unit"?"var(--accent)":"var(--orange)"},children:A==="unit"?"Unit":"Integration"}):n.jsx("button",{onClick:()=>{if((A==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:me,requirements:z,cleanup:W,...ie}=a;N({...ie,testType:"unit"})}else N({...a,testType:"integration"})},title:`Click to switch to ${A==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:A==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:A==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:A==="unit"?"Unit":"Integration"}),n.jsx(lg,{result:r})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?n.jsxs("button",{onClick:()=>h(a.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>m(a.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),n.jsx("button",{onClick:()=>f(a.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),O&&!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:()=>x(a.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&n.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&A==="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"})]}),X&&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"})]}),se&&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(Y=>n.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:Y},Y))})]}),!y&&A==="integration"&&n.jsx(OS,{evalCase:a,onUpdate:N}),n.jsx(Wi,{title:"Prompt",children:D?n.jsxs("div",{children:[n.jsx("textarea",{value:k,onChange:Y=>T(Y.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:M,className:"btn btn-primary text-[12px]",children:"Save"}),n.jsx("button",{onClick:()=>{T(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:y?"default":"pointer"},onClick:()=>{y||E(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.prompt||n.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),n.jsx(Wi,{title:"Expected Output",children:L?n.jsxs("div",{children:[n.jsx("textarea",{value:_,onChange:Y=>$(Y.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),n.jsxs("div",{className:"flex gap-2 mt-2",children:[n.jsx("button",{onClick:R,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:y?"default":"pointer"},onClick:()=>{y||I(!0)},onMouseEnter:Y=>{y||(Y.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:Y=>{Y.currentTarget.style.borderColor="var(--border-subtle)"},children:a.expected_output||n.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),n.jsx(Wi,{title:`Assertions (${a.assertions.length})`,action:y?void 0:n.jsx("button",{onClick:H,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:a.assertions.length===0?n.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):n.jsx("div",{className:"space-y-2",children:a.assertions.map(Y=>{const me=r==null?void 0:r.assertions.find(W=>W.assertion_id===Y.id),z=RS(Y.id,me,S);return n.jsx(DS,{assertion:Y,result:me,badges:z,isReadOnly:y,onUpdate:W=>q(Y.id,W),onDelete:()=>P(Y.id)},Y.id)})})}),(r==null?void 0:r.output)&&n.jsx(LS,{output:r.output,durationMs:r.durationMs,tokens:r.tokens}),r&&r.passRate!=null&&r.passRate<.2&&(()=>{const Y=ng("INEFFECTIVE",r.passRate);return Y.recommendations&&Y.recommendations.length>0?n.jsx(Wi,{title:"Recommendations",children:n.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[n.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),n.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),n.jsx("ul",{className:"space-y-1.5 ml-1",children:Y.recommendations.map((me,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:"•"}),me]},z))})]})}):null})(),n.jsx(_S,{evalId:a.id,sharedEntries:S,sharedLoading:C})]},a.id)}function DS({assertion:a,result:r,badges:i,isReadOnly:o,onUpdate:u,onDelete:m}){const[f,h]=v.useState(!1),[x,p]=v.useState(a.text),[y,g]=v.useState(!1),j=()=>{u(x),h(!1)};return n.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:n.jsxs("div",{className:"flex items-start gap-2",children:[r?n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:r.pass?"var(--green-muted)":"var(--red-muted)"},children:r.pass?n.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})}):n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):n.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(i==null?void 0:i.regression)&&n.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[n.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:a.id}),(i==null?void 0:i.flaky)&&n.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(i==null?void 0:i.nonDiscriminating)&&n.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),f?n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:x,onChange:S=>p(S.target.value),onKeyDown:S=>{S.key==="Enter"&&j(),S.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),n.jsx("button",{onClick:j,className:"btn btn-primary text-[11px]",children:"Save"})]}):n.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(a.text),h(!0))},children:a.text}),(r==null?void 0:r.reasoning)&&n.jsx("button",{onClick:()=>g(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(r==null?void 0:r.reasoning)&&n.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:r.reasoning})]}),!o&&n.jsx("button",{onClick: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 Wi({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 lg({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",u=a.passRate??0,f=ng(o?"PASS":"FAIL",u);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 zS({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 LS({output:a,durationMs:r,tokens:i}){const[o,u]=v.useState(!1);return n.jsxs("div",{className:"mb-5",children:[n.jsxs("button",{onClick:()=>u(!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 Fu(a){return a==="baseline"?"right":a==="comparison"?"full":"left"}function Wu({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:Jv(a.timestamp)}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:a.model}),n.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:a.type==="benchmark"?"var(--accent-muted)":a.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:a.type==="benchmark"?"var(--accent)":a.type==="comparison"?"var(--purple)":"var(--orange)"},children:a.type}),n.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:mr(a.pass_rate)},children:[Math.round(a.pass_rate*100),"%"]})]}),n.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[a.durationMs!=null&&n.jsx("span",{children:eg(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?"+":"",u=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:u},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 _S({evalId:a,sharedEntries:r,sharedLoading:i}){const{state:o,dispatch:u}=kn(),{plugin:m,skill:f}=o,[h,x]=v.useState(!0),p=r??null,y=i??!1,g=v.useCallback(()=>{x(D=>!D)},[]),j=p?p.slice(0,10):[],S=j.some(D=>{const E=Fu(D.type);return E==="left"||E==="full"}),C=j.some(D=>{const E=Fu(D.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:h?"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":"",")"]})]}),h&&n.jsx("div",{className:"animate-fade-in",children:y?n.jsxs("div",{className:"flex items-center gap-2 py-3",children:[n.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),n.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!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(tg,{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((D,E)=>{const k=Fu(D.type);return k==="full"?n.jsx("div",{style:{gridColumn:"1 / -1"},children:n.jsx(Wu,{entry:D})},E):k==="left"?n.jsxs(v.Fragment,{children:[n.jsx("div",{style:{gridColumn:"1"},children:n.jsx(Wu,{entry:D})}),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(Wu,{entry:D})})]},E)})]}),n.jsx("button",{onClick:()=>u({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:D=>{D.currentTarget.style.textDecoration="underline"},onMouseLeave:D=>{D.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function Hx({evals:a,onSave:r,onCancel:i}){const[o,u]=v.useState(""),[m,f]=v.useState(""),[h,x]=v.useState(""),[p,y]=v.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[g,j]=v.useState("unit"),[S,C]=v.useState(""),[D,E]=v.useState([]),[k,T]=v.useState(""),[L,I]=v.useState(""),_=Math.max(0,...a.evals.map(R=>R.id))+1,$=R=>{j(R),R==="unit"&&(E([]),C(""),T(""),I(""))},N=()=>{const R=S.trim().toUpperCase();R&&!D.includes(R)&&E([...D,R]),C("")},M=()=>{if(!o.trim()||!m.trim())return;const R={id:_,name:o.trim(),prompt:m.trim(),expected_output:h.trim(),files:[],assertions:p.filter(H=>H.text.trim()),...g==="integration"?{testType:"integration",...D.length>0?{requiredCredentials:D}:{},...k||L?{requirements:{...k?{platform:k}:{},...L?{chromeProfile:L}:{}}}:{}}:{}};r({...a,evals:[...a.evals,R]})};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(R=>n.jsx("button",{onClick:()=>$(R),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:g===R?R==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:g===R?R==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:R},R))})]}),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:R=>u(R.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:R=>f(R.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),n.jsxs("label",{className:"block mb-3",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),n.jsx("textarea",{value:h,onChange:R=>x(R.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((R,H)=>n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:R.text,onChange:q=>y(p.map((P,te)=>te===H?{...P,text:q.target.value}:P)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&n.jsx("button",{onClick:()=>y(p.filter((q,P)=>P!==H)),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"})]})})]},R.id)),n.jsx("button",{onClick:()=>y([...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:D.map(R=>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:[R,n.jsx("button",{onClick:()=>E(D.filter(H=>H!==R)),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"})]})})]},R))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:S,onChange:R=>C(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),N())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),n.jsx("button",{onClick:N,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:k,onChange:R=>T(R.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:R=>I(R.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:M,disabled:!o.trim()||!m.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function OS({evalCase:a,onUpdate:r}){var f,h;const[i,o]=v.useState(""),u=()=>{const x=i.trim().toUpperCase();x&&!(a.requiredCredentials??[]).includes(x)&&r({...a,requiredCredentials:[...a.requiredCredentials??[],x]}),o("")},m=x=>{const p=(a.requiredCredentials??[]).filter(y=>y!==x);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(x=>n.jsxs("span",{className:"flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono",style:{background:"var(--orange-muted)",color:"var(--orange)"},children:[x,n.jsx("button",{onClick:()=>m(x),style:{color:"var(--orange)",lineHeight:1},children:n.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),n.jsxs("div",{className:"flex gap-1.5",children:[n.jsx("input",{value:i,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),u())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),n.jsx("button",{onClick:u,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),n.jsxs("div",{className:"mb-2.5",children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),n.jsx("input",{value:((f=a.requirements)==null?void 0:f.platform)??"",onChange:x=>r({...a,requirements:{...a.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),n.jsx("input",{value:((h=a.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>r({...a,requirements:{...a.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function Sn(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 rg(a,r){return a==null||r==null?"N/A":`${a.toLocaleString("en-US")} in / ${r.toLocaleString("en-US")} out`}function BS(a){return a==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function US(a,r){let i="";if(r){const u=new Date(r);isNaN(u.getTime())||(i=u.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[a,i].filter(Boolean).join(" · ")}function HS(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 u=Math.round(Math.abs(a)*r);if(u===0)return`Your skill performs the same as the baseline across ${i} ${o}`;const m=a>0?"more":"fewer";return`Your skill passes ${u} ${m} assertions across ${i} ${o}`}function Ix(a,r){const i=o=>{const u=o/5*100;return isFinite(u)?Math.round(Math.min(100,Math.max(0,u))):0};return{skill:i(a),baseline:i(r)}}function IS(a){return a==="skill"?{text:"Skill wins",isSkill:!0}:a==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function VS(a,r){const i=a+r,o=i*10,u=i*25,m=f=>f>=60?`${Math.round(f/60)}m`:`${f}s`;return`${m(o)}–${m(u)}`}const $S={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function GS(a,r){if(!a)return null;const i=$S[a];if(i==null||i===0)return null;const o=i*r*.5,u=i*r*2;return`${Sn(o)}–${Sn(u)}`}function qS(){const{state:a,runCase:r,runAll:i,cancelCase:o,cancelAll:u,isReadOnly:m}=kn(),{evals:f,caseRunStates:h,bulkRunActive:x,latestBenchmark:p,inlineResults:y}=a,{config:g}=bl(),j=(f==null?void 0:f.evals)??[],S=v.useMemo(()=>{for(const N of h.values())if(N.status==="running"||N.status==="queued")return!0;return!1},[h]),C=j.filter(N=>{const M=h.get(N.id);return M&&(M.status==="complete"||M.status==="error"||M.status==="cancelled")}).length,D=j.filter(N=>{const M=h.get(N.id);return M&&(M.status==="running"||M.status==="queued")}).length,E=v.useRef(null),[k,T]=v.useState(0);v.useEffect(()=>{if(S&&!E.current&&(E.current=Date.now()),!S){E.current=null,T(0);return}const N=setInterval(()=>{E.current&&T(Math.round((Date.now()-E.current)/1e3))},1e3);return()=>clearInterval(N)},[S]);const L=j.reduce((N,M)=>N+M.assertions.length,0),I=j.length+L,_=v.useMemo(()=>VS(j.length,L),[j.length,L]),$=v.useMemo(()=>GS((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:[D," running"]})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[S&&n.jsxs("button",{onClick:u,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: ",_]}),$&&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: ",k>=60?`${Math.floor(k/60)}m ${k%60}s`:`${k}s`]}),n.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",_]})]})]}),n.jsx("div",{className:"space-y-3 stagger-children",children:j.map(N=>{const M=y.get(N.id),R=h.get(N.id),H=(R==null?void 0:R.status)??"idle",q=p==null?void 0:p.cases.find(P=>P.eval_id===N.id);return n.jsx(PS,{name:N.name,evalId:N.id,result:M,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:H,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:q==null?void 0:q.comparisonDetail,isReadOnly:m,onRun:P=>r(P,"benchmark"),onBaseline:P=>r(P,"baseline"),onCompare:P=>r(P,"comparison"),onCancel:P=>o(P)},N.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:BS(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: ${rg(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${Sn(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 N=US(p.model,p.timestamp);return N?n.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:N}):n.jsx("div",{className:"mb-3"})})(),n.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[n.jsx(Vx,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),n.jsx(Vx,{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&&` | ${NS(p.verdict)}`]}),(()=>{const N=p.cases.reduce((R,H)=>R+H.assertions.length,0),M=HS(p.comparison.delta,N,p.cases.length);return n.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:M})})()]})]})]})}const YS={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 PS({name:a,evalId:r,result:i,caseCost:o,caseBillingMode:u,caseInputTokens:m,caseOutputTokens:f,caseStatus:h,runMode:x,comparisonDetail:p,isReadOnly:y,onRun:g,onBaseline:j,onCompare:S,onCancel:C}){const[D,E]=v.useState(!1),k=h==="running"||h==="queued",T=h==="complete"||h==="error";return n.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:k?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:k?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[n.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&n.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&n.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),n.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",r," ",a]}),x&&(k||T)&&(()=>{const L=YS[x];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:[k?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:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),n.jsx("button",{onClick:()=>g(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),n.jsx("button",{onClick:()=>j(r),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),i&&i.status!=null&&n.jsx("span",{className:"pill text-[10px]",style:{background:i.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:i.status==="pass"?"var(--green)":"var(--red)"},children:i.passRate!=null?`${Math.round(i.passRate*100)}%`:i.status}),m!=null&&f!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:rg(m,f)}),o!=null&&n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:Sn(o,u)}),h==="cancelled"&&n.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),i&&i.assertions.length>0&&n.jsxs("div",{className:"px-4 pb-3",children:[n.jsx("div",{className:"space-y-1",children:i.assertions.map(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(!D),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:D?"Hide output":"Show output"}),D&&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=Ix(p.skillContentScore,p.baselineContentScore),I=Ix(p.skillStructureScore,p.baselineStructureScore),_=IS(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:_.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:_.text})]})})()})})}),i&&i.errorMessage&&n.jsx(KS,{errorMessage:i.errorMessage,classifiedError:i.classifiedError})]})}const Qu={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function KS({errorMessage:a,classifiedError:r}){const[i,o]=v.useState(!1),u=(r==null?void 0:r.title)??"Error",m=r==null?void 0:r.hint,f=r?Qu[r.category]??Qu.unknown:Qu.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:u}),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 Vx({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 $x={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 FS(){const{state:a,dispatch:r,runActivationTest:i,cancelActivation:o,generateActivationPrompts:u}=kn(),{plugin:m,skill:f,activationPrompts:h,activationResults:x,activationSummary:p,activationRunning:y,activationError:g,activationStartedAt:j,activationClassifyingStatus:S,generatingPrompts:C,generatingPromptsError:D,activationHistory:E}=a,[k,T]=v.useState(h),[L,I]=v.useState(null),[_,$]=v.useState(!1);v.useEffect(()=>{h&&h!==k&&T(h)},[h]),v.useEffect(()=>{r({type:"SET_ACTIVATION_PROMPTS",prompts:k})},[k,r]),v.useEffect(()=>{fetch(`/api/skills/${m}/${f}/description`).then(O=>O.json()).then(O=>I(O.rawContent||O.description||null)).catch(()=>I(null))},[m,f]);function N(){i(k)}function M(){u(8)}const R=k.trim().split(`
|
|
70
|
+
`).filter(Boolean).length,H=x.filter(O=>O.classification==="TP"||O.classification==="TN"),q=x.filter(O=>O.classification==="FP"||O.classification==="FN"),P=(L==null?void 0:L.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=k.trim().length>0,X=P?xo(P):"";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:M,disabled:C||!P||y,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:P?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:P?void 0:"No skill description available",onMouseEnter:O=>{P&&!C&&(O.currentTarget.style.background="var(--surface-3)")},onMouseLeave:O=>{C||(O.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"})}),te?"Regenerate":"Generate"," Test Prompts"]})})})]}),!P&&!y&&n.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),D&&n.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:D}),n.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:k,onChange:O=>T(O.target.value),placeholder:`How do I write a unit test?
|
|
71
|
+
What edge cases should I test?
|
|
72
|
+
+Deploy this to production
|
|
73
|
+
!What's the weather like today?
|
|
74
|
+
!Write me a poem about flowers`}),n.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[n.jsx("span",{children:"One prompt per line"}),n.jsx(Qi,{}),n.jsx("span",{children:"No prefix = auto-classify"}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),n.jsx(Qi,{}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),n.jsx(Qi,{}),n.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[R," prompt",R!==1?"s":""]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:N,disabled:y||!k.trim(),className:"btn btn-primary",children:y?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("circle",{cx:"12",cy:"12",r:"6"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[S||`${x.length} / ${R} prompts tested`,j&&n.jsx(ZS,{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:P?n.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:X}}):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}),y&&x.length===0&&n.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[n.jsx("div",{className:"spinner-lg mx-auto mb-4"}),n.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&n.jsxs("div",{className:"space-y-5",children:[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((O,A)=>n.jsx(Gx,{result:O},`incorrect-${A}`))})]}),H.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 (",H.length,")"]})]}),n.jsx("div",{className:"space-y-1.5 stagger-children",children:H.map((O,A)=>n.jsx(Gx,{result:O},`correct-${A}`))})]})]}),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(Xu,{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(Xu,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),n.jsx(Xu,{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(Xi,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),n.jsx(Xi,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),n.jsx(Xi,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),n.jsx(Xi,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),n.jsx(WS,{history:E,expanded:_,onToggle:()=>$(!_)})]})}function WS({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(QS,{run:o},o.id))})})]})}function QS({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",u=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:XS(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:u,background:`color-mix(in srgb, ${u} 10%, transparent)`},children:o})]})]})}function XS(a){const r=Date.now(),i=new Date(a).getTime(),o=Math.floor((r-i)/1e3);if(o<60)return"just now";const u=Math.floor(o/60);if(u<60)return`${u}m ago`;const m=Math.floor(u/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 Qi(){return n.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Gx({result:a}){const r=$x[a.classification]||$x.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 Xu({label:a,value:r,description:i,detail:o}){const u=Math.round(r*100),m=u>=80?"var(--green)":u>=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:[u,"%"]}),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 Xi({abbr:a,count:r,bg:i,color:o,description:u}){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:u})]})}function ZS({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 Zu={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},qx={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},hd=600,xd=180,tn=40,Ju=hd-tn*2,qa=xd-tn*2,JS=[25,50,75,100];function Yx(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ek(a){return a==null?"--":`${(a/1e3).toFixed(1)}s`}function tk({entries:a,onPointClick:r}){const[i,o]=v.useState(null),u=v.useMemo(()=>[...a].reverse(),[a]);if(u.length<2)return null;const m=u.length,f=u.map((p,y)=>{const g=tn+y/(m-1)*Ju,j=p.passRate*100,S=tn+qa-j/100*qa;return{x:g,y:S,pct:j,entry:p}}),h=f.map(p=>`${p.x},${p.y}`).join(" "),x=Array.from(new Set(u.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:x.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:Zu[p]??"var(--text-tertiary)"}}),n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:qx[p]??p})]},p))}),n.jsxs("svg",{width:hd,height:xd,viewBox:`0 0 ${hd} ${xd}`,style:{display:"block",overflow:"visible"},children:[JS.map(p=>{const y=tn+qa-p/100*qa;return n.jsxs("g",{children:[n.jsx("line",{x1:tn,y1:y,x2:tn+Ju,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),n.jsxs("text",{x:tn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),n.jsx("line",{x1:tn,y1:tn+qa,x2:tn+Ju,y2:tn+qa,stroke:"var(--border-subtle)",strokeWidth:1}),n.jsx("text",{x:tn-8,y:tn+qa+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),n.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),f.map((p,y)=>n.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Zu[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)},y)),nk(m).map(p=>n.jsx("text",{x:f[p].x,y:tn+qa+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Yx(u[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:Yx(i.entry.timestamp)}),n.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:i.entry.model}),n.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[n.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Zu[i.entry.type]??"var(--text-tertiary)",color:"#fff"},children:qx[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:ek(i.entry.totalDurationMs)}),n.jsx("span",{children:i.entry.totalTokens!=null?`${i.entry.totalTokens} tokens`:"--"})]})]})]})}function nk(a){if(a<=3)return Array.from({length:a},(o,u)=>u);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 hs=new Map;let nn=null,ao=null,Zi=1e3,xs=0;function sg(){if(nn)return;nn=new EventSource("/api/events");const a=r=>i=>{let o={};try{o=i.data?JSON.parse(i.data):{}}catch{}const u=hs.get(r);if(u)for(const m of u)m(o)};nn.addEventListener("benchmark:complete",a("benchmark:complete")),nn.addEventListener("history:written",a("history:written")),nn.addEventListener("leaderboard:updated",a("leaderboard:updated")),nn.onerror=()=>{nn==null||nn.close(),nn=null,xs>0&&(ao=setTimeout(()=>{Zi=Math.min(Zi*2,3e4),sg()},Zi))},nn.onopen=()=>{Zi=1e3}}function ak(){ao!=null&&(clearTimeout(ao),ao=null),nn==null||nn.close(),nn=null}function lk(a,r){return hs.has(a)||hs.set(a,new Set),hs.get(a).add(r),xs++,sg(),()=>{var i;(i=hs.get(a))==null||i.delete(r),xs--,xs<=0&&(xs=0,ak())}}function io(a,r){const i=v.useRef(r);i.current=r,v.useEffect(()=>lk(a,u=>i.current(u)),[a])}function oo(a){return a>=.8?"var(--green)":a>=.5?"var(--yellow)":"var(--red)"}function rk(a){return a>=1e3?`${(a/1e3).toFixed(1)}s`:`${Math.round(a)}ms`}function sk({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:oo(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:oo(a)}})})]})})}function ik({points:a}){if(a.length<2)return null;const r=200,i=48,o=4,u=a.length,m=a.map((x,p)=>{const y=o+p/(u-1)*(r-o*2),g=o+(i-o*2)-x.passRate*(i-o*2);return{x:y,y:g}}),f=`M ${m[0].x},${i-o} `+m.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${m[m.length-1].x},${i-o} Z`,h=m.map((x,p)=>`${p===0?"M":"L"} ${x.x},${x.y}`).join(" ");return n.jsxs("svg",{width:r,height:i,style:{display:"block"},children:[n.jsx("path",{d:f,fill:"var(--accent-muted)"}),n.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),n.jsx("circle",{cx:m[m.length-1].x,cy:m[m.length-1].y,r:3,fill:"var(--accent)"})]})}function ok({plugin:a,skill:r}){const i=`stats/${a}/${r}`,o=v.useCallback(()=>Ne.getStats(a,r),[a,r]),{data:u,loading:m}=Ms(i,o),f=v.useCallback(()=>ga(i),[i]);if(io("benchmark:complete",f),io("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(!u||u.totalRuns===0)return n.jsxs("div",{className:"text-center py-12",children:[n.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[n.jsx("path",{d:"M18 20V10"}),n.jsx("path",{d:"M12 20V4"}),n.jsx("path",{d:"M6 20v-6"})]})}),n.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),n.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=u.trendPoints.length>0?u.trendPoints[u.trendPoints.length-1].passRate:0,x=u.trendPoints.length>0?u.trendPoints[0].passRate:0,p=h-x,y=u.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:u.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:oo(h)},children:[Math.round(h*100),"%"]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),n.jsxs("div",{className:"text-[24px] font-bold",style:{color: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:u.modelStats.length})]}),u.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:Sn(u.totalCost)})]}),u.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:Sn(u.costPerRun)})]})]}),u.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(ik,{points:u.trendPoints})]}),u.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:u.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:oo(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:rk(g.avgDurationMs)}),n.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:g.avgCost!=null?Sn(g.avgCost):"N/A"})]},g.model))})]})]}),y.length>0&&n.jsxs("div",{className:"glass-card p-5",children:[n.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),n.jsx("div",{className:"space-y-3",children:y.map(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(sk,{rate:g.passRate,label:g.text})]},`${g.evalId}:${g.id}`))})]})]})}function ck({plugin:a,skill:r}){const[i,o]=v.useState(null),[u,m]=v.useState(null),[f,h]=v.useState({}),[x,p]=v.useState({});v.useEffect(()=>{Ne.getEvals(a,r).then(o).catch(()=>o(null))},[a,r]);async function y(g){if(u===g){m(null);return}if(m(g),!f[g]){p(j=>({...j,[g]:!0}));try{const j=await Ne.getCaseHistory(a,r,g);h(S=>({...S,[g]:j}))}catch{h(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=u===g.id,C=x[g.id],D=j.length>0?j[0].pass_rate:null;return n.jsxs("div",{className:"glass-card overflow-hidden",children:[n.jsxs("button",{onClick:()=>y(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(tg,{entries:j}),D!=null&&n.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:mr(D)},children:[Math.round(D*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,k)=>n.jsxs("div",{className:"p-4",style:{background:k===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:Jv(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:mr(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:eg(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(T=>n.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[n.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:T.pass?"var(--green)":"var(--red)"},children:n.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:T.pass?n.jsx("polyline",{points:"20 6 9 17 4 12"}):n.jsxs(n.Fragment,{children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:T.text}),T.reasoning&&n.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:T.reasoning})]})]},T.id))})]},k))})})]},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 uk(){const{state:a,dispatch:r}=kn(),{plugin:i,skill:o}=a,[u,m]=v.useState("timeline"),[f,h]=v.useState(""),[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState([]),[C,D]=v.useState(null),[E,k]=v.useState(!1),[T,L]=v.useState(null),[I,_]=v.useState(!1),$=`history/${i}/${o}?model=${f}&type=${x}`,N=v.useCallback(()=>Ne.getHistory(i,o,{model:f||void 0,type:x||void 0}),[i,o,f,x]),{data:M,loading:R}=Ms($,N),H=M??[];v.useEffect(()=>{!M||M.length<2||Ne.compareRuns(i,o,M[0].timestamp,M[1].timestamp).then(O=>{const A=O.regressions.filter(B=>B.change==="regression");r({type:"SET_REGRESSIONS",regressions:A})}).catch(()=>{})},[M,i,o,r]);const q=v.useCallback(()=>ga($),[$]);io("history:written",q);const P=v.useCallback(async O=>{if(y){S(A=>A.includes(O)?A.filter(B=>B!==O):A.length>=2?[A[1],O]:[...A,O]);return}_(!0);try{const A=await Ne.getHistoryEntry(i,o,O);L(A)}catch{}finally{_(!1)}},[i,o,y]),te=v.useCallback(async()=>{if(j.length===2){k(!0);try{const O=await Ne.compareRuns(i,o,j[0],j[1]);D(O)}catch{}finally{k(!1)}}},[i,o,j]),X=[...new Set(H.map(O=>O.model))];return R?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(O=>n.jsx("button",{onClick:()=>m(O),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:u===O?"var(--accent-muted)":"transparent",color:u===O?"var(--accent)":"var(--text-tertiary)"},children:O==="timeline"?"Timeline":O==="per-eval"?"Per Eval":"Statistics"},O))}),u==="timeline"&&n.jsxs("div",{children:[H.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(tk,{entries:H,onPointClick:O=>P(O.timestamp)})}),n.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[n.jsxs("select",{value:f,onChange:O=>h(O.target.value),className:"input-field text-[12px]",style:{width:150},children:[n.jsx("option",{value:"",children:"All Models"}),X.map(O=>n.jsx("option",{value:O,children:O},O))]}),n.jsxs("select",{value:x,onChange:O=>p(O.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(!y),S([]),D(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&j.length===2&&n.jsx("button",{onClick:te,disabled:E,className:"btn btn-primary text-[12px]",children:E?"Comparing...":"Compare"})]}),n.jsx("div",{className:"space-y-2",children:H.length===0?n.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):H.map(O=>{const A=j.includes(O.timestamp);return n.jsx("button",{onClick:()=>P(O.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:A?"var(--accent-muted)":"var(--surface-1)",border:A?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:B=>{A||(B.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:B=>{A||(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:[y&&n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:A?"var(--accent)":"var(--border-default)",background:A?"var(--accent)":"transparent"},children:A&&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(O.timestamp).toLocaleString()}),n.jsx("span",{className:"pill text-[9px]",style:{background:O.type==="comparison"?"var(--purple-muted)":O.type==="baseline"?"var(--surface-3)":O.type==="model-compare"?"var(--accent-muted)":O.type==="improve"||O.type==="instruct"?"var(--purple-muted)":O.type==="ai-generate"?"var(--green-muted)":O.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:O.type==="comparison"?"var(--purple)":O.type==="baseline"?"var(--text-tertiary)":O.type==="model-compare"?"var(--accent)":O.type==="improve"||O.type==="instruct"?"var(--purple)":O.type==="ai-generate"?"var(--green)":O.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:O.type==="model-compare"?"model compare":O.type==="improve"?"ai improve":O.type==="instruct"?"ai edit":O.type==="ai-generate"?"ai generate":O.type==="eval-generate"?"eval generate":O.type})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:O.model}),O.totalCost!=null&&O.totalCost>0&&n.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:Sn(O.totalCost)}),n.jsxs("span",{className:"text-[12px] font-semibold",style:{color:O.passRate>=.8?"var(--green)":O.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(O.passRate*100),"%"]})]})]})},O.timestamp)})}),C&&n.jsx(dk,{result:C}),T&&!y&&n.jsx(fk,{run:T,onClose:()=>L(null)})]}),u==="per-eval"&&n.jsx(ck,{plugin:i,skill:o}),u==="statistics"&&n.jsx(ok,{plugin:i,skill:o})]})}function dk({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: ",Sn(a.runA.totalCost??null)]}),n.jsxs("span",{children:["Run B cost: ",Sn(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: ",Sn(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 fk({run:a,onClose:r}){return(a.type==="improve"||a.type==="instruct")&&a.improve?n.jsx(pk,{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: ${Sn(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:Sn(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 pk({run:a,onClose:r}){var m;const i=v.useMemo(()=>a.improve?vo(a.improve.original,a.improve.improved):[],[a.improve]),o=v.useMemo(()=>{const f=i.filter(x=>x.type==="added").length,h=i.filter(x=>x.type==="removed").length;return{added:f,removed:h}},[i]),u=v.useMemo(()=>{let f=0,h=0;return i.map(x=>x.type==="removed"?(f++,{...x,origNum:f,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(f++,h++,{...x,origNum:f,newNum:h}))},[i]);return n.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),n.jsx("path",{d:"M2 17l10 5 10-5"}),n.jsx("path",{d:"M2 12l10 5 10-5"})]})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),n.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(a.timestamp).toLocaleString()," · ",a.model]})]})]}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[n.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),n.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),n.jsx("button",{onClick:r,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:f=>{f.currentTarget.style.background="var(--surface-3)"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((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:u.map((f,h)=>n.jsxs("tr",{style:{background:f.type==="added"?"var(--green-muted)":f.type==="removed"?"var(--red-muted)":"transparent"},children:[n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:f.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.origNum??""}),n.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:f.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:f.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:f.newNum??""}),n.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"transparent",borderRight:f.type==="added"?"2px solid var(--green)":f.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:f.type==="added"?"+":f.type==="removed"?"-":" "}),n.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:f.type==="added"?"var(--green)":f.type==="removed"?"var(--red)":"var(--text-secondary)"},children:f.content||""})]},h))})})})]})}function mk({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState([]),[f,h]=v.useState(!0),[x,p]=v.useState(null);v.useEffect(()=>{Ne.getDependencies(a,r).then(g=>{o(g.mcpDependencies),m(g.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[a,r]);async function y(g,j){try{await navigator.clipboard.writeText(j),p(g),setTimeout(()=>p(null),2e3)}catch{}}return f?null:i.length===0&&u.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+u.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:()=>y(g.server,g.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===g.server?"var(--green)":"var(--accent)"},children:x===g.server?n.jsxs(n.Fragment,{children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):n.jsxs(n.Fragment,{children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),n.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),n.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:g.url}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.matchedTools.map(j=>n.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:j},j))})]},g.server))]}),u.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:u.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 Px({plugin:a,skill:r}){const[i,o]=v.useState([]),[u,m]=v.useState(!0),[f,h]=v.useState(null),[x,p]=v.useState(""),[y,g]=v.useState(!1),[j,S]=v.useState(null),[C,D]=v.useState(""),[E,k]=v.useState(""),[T,L]=v.useState(!1),[I,_]=v.useState(new Set),$=v.useCallback(async()=>{m(!0);try{const[H,q]=await Promise.all([Ne.getCredentials(a,r).catch(()=>({credentials:[]})),Ne.getParams(a,r).catch(()=>({params:[]}))]),P=new Map(q.params.map(O=>[O.name,O])),te=new Set,X=[];for(const O of H.credentials){te.add(O.name);const A=P.get(O.name);X.push({name:O.name,status:O.status==="ready"||O.status==="resolved"?"ready":"missing",source:O.source,maskedValue:A==null?void 0:A.maskedValue})}for(const O of q.params)te.has(O.name)||X.push({name:O.name,status:O.status,maskedValue:O.maskedValue});o(X)}finally{m(!1)}},[a,r]);v.useEffect(()=>{$()},[$]);const N=v.useCallback(async H=>{if(I.has(H)){_(q=>{const P=new Set(q);return P.delete(H),P}),o(q=>q.map(P=>P.name===H?{...P,revealedValue:void 0}:P));return}try{const P=(await Ne.getParamsRevealed(a,r,H)).params.find(te=>te.name===H);P&&(o(te=>te.map(X=>X.name===H?{...X,revealedValue:P.value}:X)),_(te=>new Set(te).add(H)))}catch{}},[a,r,I]),M=async(H,q)=>{if(!(!H.trim()||!q.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,H,q),h(null),p(""),_(new Set),$()}catch(P){S(P.message)}finally{g(!1)}}},R=async()=>{if(!(!C.trim()||!E.trim())){g(!0),S(null);try{await Ne.setCredential(a,r,C.trim().toUpperCase(),E),D(""),k(""),L(!1),$()}catch(H){S(H.message)}finally{g(!1)}}};return u?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(!T),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),j&&n.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:j}),i.length===0&&!T?n.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):n.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:i.map(H=>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:H.name}),H.maskedValue&&n.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:I.has(H.name)&&H.revealedValue!=null?H.revealedValue:H.maskedValue}),H.maskedValue&&n.jsx("button",{onClick:()=>N(H.name),className:"btn btn-ghost px-1",title:I.has(H.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:I.has(H.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:H.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:H.status==="ready"?"var(--green)":"var(--orange)"},children:H.status==="ready"?"ready":"missing"}),H.source&&n.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:H.source}),f===H.name?n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("input",{value:x,onChange:q=>p(q.target.value),onKeyDown:q=>{q.key==="Enter"&&M(H.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),n.jsx("button",{onClick:()=>M(H.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),n.jsx("button",{onClick:()=>{h(null),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:()=>{h(H.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},H.name))}),T&&n.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[n.jsxs("div",{className:"flex gap-2 mb-2",children:[n.jsx("input",{value:C,onChange:H=>D(H.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),n.jsx("input",{value:E,onChange:H=>k(H.target.value),onKeyDown:H=>{H.key==="Enter"&&R()},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),D(""),k("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),n.jsx("button",{onClick:R,disabled:y||!C.trim()||!E.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function hk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState(null),[m,f]=v.useState(!0);return v.useEffect(()=>{Ne.getDependencies(r,i).then(u).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(mk,{plugin:r,skill:i}),n.jsx(Px,{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(Px,{plugin:r,skill:i})]})}function ig({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,u=2,m=i-u*2,f=o-u*2,h=r.length,x=Math.min(...r),y=Math.max(...r)-x||1,g=r.map((C,D)=>{const E=u+D/(h-1)*m,k=u+f-(C-x)/y*f;return`${E.toFixed(1)},${k.toFixed(1)}`}),j=r[r.length-1],S=mr(j);return n.jsxs("svg",{width:i,height:o,viewBox:`0 0 ${i} ${o}`,style:{display:"block"},children:[n.jsx("polyline",{points:g.join(" "),fill:"none",stroke:S,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[C,D]=g[g.length-1].split(",");return n.jsx("circle",{cx:C,cy:D,r:2.5,fill:S})})()]})}function xk(){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 vk({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 gk({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,u=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:[u,a.toFixed(1),"% (",r.toUpperCase(),")"]})]})}function yk({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 bk({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 jk(a){var o,u,m;if(a.length===0)return[];const r=new Map;for(const f of a)for(const h of f.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;r.has(x)||r.set(x,{provider:h.provider,passRates:[],lastRubric:null,lastDuration:0,lastCost:null,lastBaselinePassRate:void 0,lastSkillDelta:void 0,lastAmplificationPct:void 0,lastCompositeScore:void 0,hasBaseline:!1});const p=r.get(x);p.passRates.push(h.passRate.mean),p.lastRubric=((o=h.rubricScore)==null?void 0:o.mean)??null,p.lastDuration=h.duration.mean,p.lastCost=((u=h.cost)==null?void 0:u.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(m=h.skillDelta)==null?void 0:m.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const i=[];for(const[f,h]of r){const[x,...p]=f.split("/");i.push({rank:0,model:p.join("/"),provider:x,passRate:h.passRates[h.passRates.length-1],rubricScore:h.lastRubric,duration:h.lastDuration,cost:h.lastCost,sparklineData:h.passRates,isBest:!1,baselinePassRate:h.lastBaselinePassRate,skillDelta:h.lastSkillDelta,amplificationPct:h.lastAmplificationPct,compositeScore:h.lastCompositeScore,hasBaseline:h.hasBaseline})}return i.sort((f,h)=>{const x=f.compositeScore??f.passRate;return(h.compositeScore??h.passRate)-x}),i.forEach((f,h)=>{f.rank=h+1}),i.length>0&&(i[0].isBest=!0),i}const og=(a="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:a,whiteSpace:"nowrap"});function Sk({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:og(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(xk,{})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:r.passRate>=.7?"var(--green-muted)":r.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(r.passRate),fontSize:11,fontWeight:600},children:[Math.round(r.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.rubricScore!=null?r.rubricScore.toFixed(1):"--"}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.duration<1e3?`${Math.round(r.duration)}ms`:`${(r.duration/1e3).toFixed(1)}s`}),n.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:r.cost!=null?`$${r.cost.toFixed(4)}`:"N/A"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(ig,{data:r.sparklineData})})]},`${r.provider}/${r.model}`))})]})})}function kk({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:og(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:u=>{u.currentTarget.style.background="var(--surface-2)"},onMouseLeave:u=>{u.currentTarget.style.background="transparent"},children:[n.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:i.model}),n.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:i.provider})]})}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsxs("span",{className:"pill",style:{background:i.passRate>=.7?"var(--green-muted)":i.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:mr(i.passRate),fontSize:11,fontWeight:600},children:[Math.round(i.passRate*100),"%"]})}),n.jsx("td",{style:{padding:"10px 12px"},children:i.baselinePassRate!=null?n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(i.baselinePassRate*100),"%"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.skillDelta!=null?n.jsxs("span",{className:"text-[11px] font-medium",style:{color:i.skillDelta>=0?"var(--green)":"var(--red)"},children:[i.skillDelta>=0?"+":"",(i.skillDelta*100).toFixed(1),"pp"]}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:i.amplificationPct!=null&&isFinite(i.amplificationPct)?n.jsx(vk,{pct:i.amplificationPct}):"--"}),n.jsx("td",{style:{padding:"10px 12px"},children:n.jsx(ig,{data:i.sparklineData})})]},`${i.provider}/${i.model}`))})]})})}function wk(){const{state:a}=kn(),{plugin:r,skill:i}=a,[o,u]=v.useState("rankings"),m=`leaderboard/${r}/${i}`,f=v.useCallback(()=>Ne.getLeaderboard(r,i),[r,i]),{data:h,loading:x}=Ms(m,f),p=(h==null?void 0:h.entries)??[];v.useEffect(()=>{u("rankings")},[r,i]);const y=v.useCallback(()=>ga(m),[m]);io("leaderboard:updated",y);const g=v.useMemo(()=>jk(p),[p]),j=g.some(D=>D.hasBaseline),S=p[0],C=S==null?void 0:S.judgeBiasWarning;return x?n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"spinner spinner-lg"})}):g.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(bk,{active:o,onChange:u,hasBaseline:j})]}),n.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",g.length," model",g.length!==1?"s":""]})]}),C&&n.jsx(yk,{warning:C}),o==="rankings"?n.jsx(Sk,{entries:g}):n.jsx(kk,{entries:g}),o==="amplification"&&(S==null?void 0:S.skillQualityScore)!=null&&(S==null?void 0:S.skillQualityRating)&&n.jsx(gk,{score:S.skillQualityScore,rating:S.skillQualityRating})]})}const Ck=["editor","tests","run","activation","history","leaderboard","deps","versions"];function Nk(a){return a!=null&&Ck.includes(a)}function Ek({hideHeader:a=!1}={}){var j;const{state:r,dispatch:i,saveContent:o,isReadOnly:u}=kn(),{state:m,refreshSkills:f,clearSelection:h}=ya(),x=v.useCallback(async()=>{try{await Ne.deleteSkill(r.plugin,r.skill),f(),h()}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,h,i]);v.useEffect(()=>{const C=new URLSearchParams(window.location.search).get("panel");Nk(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 y=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(_d,{state:r,isReadOnly:u,onDelete:u?void 0:x}),r.error&&n.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:n.jsx(Ds,{error:Z2(r.error),onDismiss:()=>i({type:"SET_ERROR",error:null})})}),n.jsx(Q2,{activePanel:r.activePanel,onPanelChange:S=>i({type:"SET_PANEL",panel:S}),isDirty:r.isDirty,isRunning:y,hasRegressions:r.regressions.length>0,isActivationRunning:r.activationRunning,hasUpdate:g}),n.jsx(X2,{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(kS,{}),r.activePanel==="tests"&&n.jsx(AS,{}),r.activePanel==="run"&&n.jsx(qS,{}),r.activePanel==="activation"&&n.jsx(FS,{}),r.activePanel==="history"&&n.jsx(uk,{}),r.activePanel==="leaderboard"&&n.jsx(wk,{}),r.activePanel==="deps"&&n.jsx(hk,{}),r.activePanel==="versions"&&n.jsx(Wv,{})]},r.activePanel)})},`${r.plugin}/${r.skill}`)]})}function Tk(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 vd(a,r=!0){let i=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return r&&(i=i.replace(/^-+|-+$/g,"")),i}function Rk(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 Ak({onCreated:a,resolveAiConfigOverride:r}){const[i,o]=v.useState("ai"),[u,m]=v.useState(null),[f,h]=v.useState(!0),{config:x}=bl(),[p,y]=v.useState(""),[g,j]=v.useState(3),[S,C]=v.useState(""),[D,E]=v.useState(""),[k,T]=v.useState(""),[L,I]=v.useState(""),[_,$]=v.useState(""),[N,M]=v.useState(""),[R,H]=v.useState("write"),[q,P]=v.useState([]),[te,X]=v.useState(!1),[O,A]=v.useState(null),[B,se]=v.useState(""),[Y,me]=v.useState(!1),[z,W]=v.useState(!1),[ie,de]=v.useState(null),[ge,xe]=v.useState(null),[oe,ae]=v.useState([]),ve=v.useRef(null),Ie=v.useRef(null),Be=v.useRef(null),ne=v.useRef(null),[fe,ue]=v.useState(!1),[he,be]=v.useState(!1);v.useEffect(()=>{Ne.getProjectLayout().then(De=>{m(De),j(De.suggestedLayout);const xt=De.detectedLayouts.find(Ft=>Ft.layout===De.suggestedLayout);xt!=null&&xt.existingPlugins.length&&C(xt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),v.useEffect(()=>{var De;i==="ai"&&((De=ve.current)==null||De.focus())},[i]),v.useEffect(()=>()=>{var De;(De=Ie.current)==null||De.abort()},[]);const _e=v.useMemo(()=>{var De;return u?((De=u.detectedLayouts.find(xt=>xt.layout===g))==null?void 0:De.existingPlugins)||[]:[]},[u,g]),Me=S==="__new__"?D:S,dt=u?Rk(u.root,g,Me||"{plugin}",p||"{skill}"):"",Zt=v.useMemo(()=>u?u.detectedLayouts.filter(De=>De.layout!==4):[],[u]),ct=v.useMemo(()=>{if(!u)return null;const De=u.detectedLayouts.find(nt=>nt.layout===2&&nt.existingPlugins.length>0),xt=u.detectedLayouts.find(nt=>nt.layout===1&&nt.existingPlugins.length>0),Ft=De||xt;return Ft?{layout:Ft.layout,plugins:Ft.existingPlugins}:null},[u]),Vt=v.useCallback(()=>{if(r)return r();if(!x)return{provider:"claude-cli",model:"sonnet"};const De=x.provider||"claude-cli",xt=x.model||"sonnet";return{provider:De,model:xt}},[x,r]),$t=v.useCallback(()=>{var De;(De=Ie.current)==null||De.abort(),me(!1)},[]),tt=v.useCallback(()=>{de(null),xe(null)},[]),jt=v.useCallback(async()=>{if(de(null),xe(null),ae([]),Be.current=null,!B.trim()){de("Describe what your skill should do");return}me(!0);const De=new AbortController;Ie.current=De;const{provider:xt,model:Ft}=Vt();try{const nt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Tk({prompt:B.trim(),provider:xt,model:Ft,targetAgents:q})),signal:De.signal});if(!nt.ok||!nt.body){let bt=`HTTP ${nt.status}`;try{const Bn=await nt.json();Bn.error&&(bt=Bn.error)}catch{}throw new Error(bt)}const Xa=nt.body.getReader(),Xn=new TextDecoder;let Ct="",St="";for(;;){const{done:bt,value:Bn}=await Xa.read();if(bt)break;Ct+=Xn.decode(Bn,{stream:!0});const Za=Ct.split(`
|
|
75
|
+
`);Ct=Za.pop()||"";for(const Un of Za)if(Un.startsWith("event: "))St=Un.slice(7).trim();else if(Un.startsWith("data: ")){try{const Ve=JSON.parse(Un.slice(6));if(St==="progress")ae(Ut=>[...Ut,{phase:Ve.phase,message:Ve.message,timestamp:Date.now()}]);else if(St==="done"||St==="complete"){const Ut={prompt:B.trim(),provider:Vt().provider,model:Vt().model,reasoning:Ve.reasoning||""};if(y(Ve.name),T(Ve.description),I(Ve.model||""),$(Ve.allowedTools||""),M(Ve.body),W(!0),Be.current=Ut,o("manual"),Ve.suggestedPlugin&&typeof Ve.suggestedPlugin=="object"&&Ve.suggestedPlugin.plugin){const Nt=Ve.suggestedPlugin;if(((u==null?void 0:u.detectedLayouts.flatMap(wn=>wn.existingPlugins))??[]).includes(Nt.plugin))if(C(Nt.plugin),Nt.layout&&(Nt.layout===1||Nt.layout===2))j(Nt.layout);else{const wn=u==null?void 0:u.detectedLayouts.find(go=>go.existingPlugins.includes(Nt.plugin));wn&&(wn.layout===1||wn.layout===2)&&j(wn.layout)}else C("__new__"),E(Nt.plugin)}else g===3&&ct&&be(!0);const Zn={name:Ve.name,plugin:Me||"",layout:g,description:Ve.description,model:Ve.model||void 0,allowedTools:Ve.allowedTools||void 0,body:Ve.body,aiMeta:Ut};Ne.saveDraft(Zn).then(Nt=>{ue(!0),Nt!=null&&Nt.dir&&(ne.current=Nt.dir)}).catch(()=>{})}else St==="error"&&(de(Ve.message||Ve.description||"Unknown error"),Ve.category&&xe(Ve))}catch{}St=""}}}catch(nt){nt.name!=="AbortError"&&de(nt.message)}finally{me(!1),Ie.current=null}},[B,Vt,g,ct,Me,u,q]),ye=v.useCallback(async()=>{if(A(null),!p.trim()){A("Skill name is required");return}if(!k.trim()){A("Description is required");return}if(g!==3&&!Me.trim()){A("Plugin name is required");return}X(!0);try{const De=await Ne.createSkill({name:vd(p),plugin:Me||"",layout:g,description:k,model:L||void 0,allowedTools:_||void 0,body:N,aiMeta:Be.current||void 0,draftDir:ne.current||void 0});ne.current=null,a(De.plugin,De.skill)}catch(De){A(De.message)}finally{X(!1)}},[p,k,g,Me,L,_,N,a]),Rt=v.useCallback(()=>{ct&&(j(ct.layout),C(ct.plugins[0]),be(!1))},[ct]);return{mode:i,setMode:o,layout:u,layoutLoading:f,selectedLayout:g,setSelectedLayout:j,creatableLayouts:Zt,availablePlugins:_e,pathPreview:dt,plugin:S,setPlugin:C,newPlugin:D,setNewPlugin:E,effectivePlugin:Me,name:p,setName:y,description:k,setDescription:T,model:L,setModel:I,allowedTools:_,setAllowedTools:$,body:N,setBody:M,bodyViewMode:R,setBodyViewMode:H,aiPrompt:B,setAiPrompt:se,generating:Y,aiGenerated:z,aiError:ie,aiClassifiedError:ge,aiProgress:oe,promptRef:ve,handleGenerate:jt,handleCancelGenerate:$t,clearAiError:tt,targetAgents:q,setTargetAgents:P,draftSaved:fe,showPluginRecommendation:he,setShowPluginRecommendation:be,pluginLayoutInfo:ct,applyPluginRecommendation:Rt,creating:te,error:O,handleCreate:ye}}function cg(){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 Mk(){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 ug({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(cg,{}):n.jsx(Mk,{}),n.jsxs("span",{children:[a.name,a.type==="dir"?"/":""]})]}),(i=a.children)==null?void 0:i.map(o=>n.jsx(ug,{node:o,depth:r+1},o.name))]})}function Dk(a,r,i){const o=[];r&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const u=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return i&&u.push({name:"draft.json",type:"file"}),{name:a||"{skill}",type:"dir",children:u}}function zk({skillName:a,hasEvals:r,isDraft:i}){const o=Dk(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(cg,{})}),"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(ug,{node:o})})]})}const Ya={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function ed({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 Lk({onCreated:a,onCancel:r}){const i=Ak({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(ed,{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(ed,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),n.jsx("textarea",{ref:i.promptRef,value:i.aiPrompt,onChange:o=>i.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
|
|
76
|
+
|
|
77
|
+
Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:i.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...Ya,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(zs,{entries:i.aiProgress,isRunning:!0}),i.aiError&&n.jsx("div",{children:i.aiClassifiedError?n.jsx(Ds,{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(ed,{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:Ya,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(vd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:Ya})]}),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(vd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Ya})]}),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:{...Ya,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:Ya,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:Ya})]})]})]}),n.jsxs("div",{className:"glass-card p-4",children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("div",{className:"flex items-center gap-2.5",children:[n.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),n.jsx("polyline",{points:"14 2 14 8 20 8"}),n.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),n.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),n.jsxs("div",{children:[n.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),n.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),n.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>n.jsxs("button",{onClick:()=>i.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:i.bodyViewMode===o?"var(--surface-4)":"transparent",color:i.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:i.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("polyline",{points:"16 18 22 12 16 6"}),n.jsx("polyline",{points:"8 6 2 12 8 18"})]}):n.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),n.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),i.bodyViewMode==="write"?n.jsx("textarea",{value:i.body,onChange:o=>i.setBody(o.target.value),placeholder:`# /my-skill
|
|
78
|
+
|
|
79
|
+
You are an expert at...
|
|
80
|
+
`,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...Ya,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:xo(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(zk,{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 _k(){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 lo({variant:a,message:r,onRetry:i}){const{setMode:o,setSearch:u}=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(_k,{}):n.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>f(!0),style:{objectFit:"contain"}})}),n.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),n.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):a==="no-skills"?n.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[n.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:n.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),n.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),n.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",n.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),n.jsxs("button",{onClick:()=>o("create"),className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:"var(--accent)",color:"#fff",border:"none",cursor:"pointer"},onMouseEnter:h=>{h.currentTarget.style.opacity="0.9"},onMouseLeave:h=>{h.currentTarget.style.opacity="1"},children:[n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):a==="error"?n.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:n.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[n.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:r||"Failed to load skill data"}),i&&n.jsx("button",{onClick:i,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):n.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[n.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),n.jsx("button",{onClick:()=>u(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function Ok(a,r){const[i,o]=a.split(".").map(Number),[u,m]=r.split(".").map(Number);return u>i?"major":m>o?"minor":"patch"}const Bk={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 Uk(){const[a,r]=v.useState([]),[i,o]=v.useState(!0),[u,m]=v.useState(new Set),[f,h]=v.useState(new Map),[x,p]=v.useState(!1),[y,g]=v.useState(new Set),[j,S]=v.useState(null),[C,D]=v.useState(null),[E,k]=v.useState(!1),T=v.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();r(R.filter(H=>H.updateAvailable))}catch{r([])}finally{o(!1)}},[]);v.useEffect(()=>{T()},[T]);const L=v.useMemo(()=>a.filter(R=>!R.pinned),[a]),I=v.useCallback(R=>{m(H=>{const q=new Set(H);return q.has(R)?q.delete(R):q.add(R),q})},[]),_=v.useCallback(()=>{u.size===L.length?m(new Set):m(new Set(L.map(R=>R.name)))},[u,L]),$=v.useCallback(()=>{const R=[...u];if(!R.length)return;p(!0),h(new Map(R.map(q=>[q,{skill:q,status:"pending"}])));const H=Ne.startBatchUpdate(R);H.addEventListener("progress",q=>{try{const P=JSON.parse(q.data);h(te=>new Map(te).set(P.skill,P))}catch{}}),H.addEventListener("done",q=>{H.close(),p(!1);try{const P=JSON.parse(q.data);S(`Updated ${P.updated??0} skills, ${P.failed??0} failed`),setTimeout(()=>S(null),5e3)}catch{}T()}),H.addEventListener("error",()=>{H.close(),p(!1),S("Batch update failed"),setTimeout(()=>S(null),5e3)})},[u,T]),N=v.useCallback(R=>{R.name.split("/").pop()||R.name;const H=R.name.split("/"),q=H.length>=3?H[H.length-2]:H[0],P=H[H.length-1];g(X=>new Set(X).add(R.name));const te=Ne.startSkillUpdate(q,P);te.addEventListener("done",()=>{te.close(),g(X=>{const O=new Set(X);return O.delete(R.name),O}),T()}),te.addEventListener("error",()=>{te.close(),g(X=>{const O=new Set(X);return O.delete(R.name),O})})},[T]),M=v.useCallback(async R=>{if(!R.latest)return;const H=R.name.split("/"),q=H.length>=3?H[H.length-2]:H[0],P=H[H.length-1];k(!0);try{const te=await Ne.getVersionDiff(q,P,R.installed,R.latest);D({skill:R,diff:te})}catch{D(null)}finally{k(!1)}},[]);return i?n.jsxs("div",{className:"p-6",children:[n.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),n.jsxs("div",{className:"space-y-3",children:[n.jsx("div",{className:"skeleton h-16 rounded-lg"}),n.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):a.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[n.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-4",children:[n.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),n.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),n.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),n.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),n.jsx("button",{onClick:T,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):n.jsxs("div",{className:"p-6",children:[j&&n.jsx("div",{className:"fixed top-4 right-4 z-50 px-4 py-3 rounded-lg text-[13px] font-medium animate-fade-in",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"},children:j}),n.jsxs("div",{className:"flex items-center justify-between mb-5",children:[n.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",L.length,")"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:T,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),n.jsx("button",{onClick:$,disabled:u.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${u.size})`})]})]}),n.jsx("div",{className:"flex items-center gap-2 mb-3",children:n.jsxs("button",{onClick:_,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:u.size===L.length&&L.length>0?"var(--accent)":"var(--border-default)",background:u.size===L.length&&L.length>0?"var(--accent)":"transparent"},children:u.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(R=>{const H=R.name.split("/").pop()||R.name,q=R.latest?Ok(R.installed,R.latest):"patch",P=Bk[q],te=!!R.pinned,X=y.has(R.name),O=f.get(R.name),A=u.has(R.name);return n.jsx("div",{className:"rounded-lg px-4 py-3 transition-all duration-150",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",opacity:te?.7:1},children:n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("button",{onClick:()=>!te&&I(R.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:n.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:A?"var(--accent)":"var(--border-default)",background:A?"var(--accent)":"transparent",opacity:te?.4:1},children:A&&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:H}),te&&n.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),n.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:P.bg,color:P.text},children:q})]}),n.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",te&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),O&&n.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:O.status==="done"?"var(--green-muted)":O.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:O.status==="done"?"var(--green)":O.status==="error"?"var(--red)":"var(--yellow)"},children:[O.status,O.error&&`: ${O.error}`]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx("button",{onClick:()=>M(R),className:"btn btn-ghost text-[11px]",disabled:E,children:"View Changes"}),n.jsx("button",{onClick:()=>N(R),disabled:te||X||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:X?n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(O==null?void 0:O.status)==="done"?n.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.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:()=>D(null),children:n.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:R=>R.stopPropagation(),children:[n.jsx("div",{className:"mb-2 flex justify-end",children:n.jsx("button",{onClick:()=>D(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),n.jsx(Ld,{contentDiff:C.diff.contentDiff,fromLabel:C.diff.from,toLabel:C.diff.to,diffSummary:C.diff.diffSummary,renderContext:"inline"})]})})]})}const Hk=[{id:"amp",displayName:"Amp",localSkillsDir:".amp/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which amp",parentCompany:"Sourcegraph",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"cline",displayName:"Cline",localSkillsDir:".cline/skills",globalSkillsDir:"~/.cline/skills",isUniversal:!0,detectInstalled:"which cline",parentCompany:"Cline",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"codex",displayName:"Codex CLI",localSkillsDir:".codex/skills",globalSkillsDir:"~/.codex/skills",isUniversal:!0,detectInstalled:"which codex",parentCompany:"OpenAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cursor",displayName:"Cursor",localSkillsDir:".cursor/skills",globalSkillsDir:"~/.cursor/skills",isUniversal:!0,detectInstalled:"which cursor",parentCompany:"Anysphere",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"gemini-cli",displayName:"Gemini CLI",localSkillsDir:".gemini/skills",globalSkillsDir:"~/.gemini/skills",isUniversal:!0,detectInstalled:"which gemini",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"github-copilot-ext",displayName:"GitHub Copilot (VS Code)",localSkillsDir:".github/copilot/skills",globalSkillsDir:"~/.config/github-copilot/skills",isUniversal:!0,detectInstalled:"which code && ls ~/.vscode/extensions/github.copilot-* 2>/dev/null",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"kimi-cli",displayName:"Kimi CLI",localSkillsDir:".kimi/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!0,detectInstalled:"which kimi",parentCompany:"Moonshot AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"opencode",displayName:"OpenCode",localSkillsDir:".opencode/skills",globalSkillsDir:"~/.config/opencode/skills",isUniversal:!0,detectInstalled:"which opencode",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"antigravity",displayName:"Antigravity",localSkillsDir:".agent/skills",globalSkillsDir:"~/.gemini/antigravity/skills",isUniversal:!1,detectInstalled:"which antigravity",parentCompany:"Google",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"augment",displayName:"Augment Code",localSkillsDir:".augment/skills",globalSkillsDir:"~/.augment/skills",isUniversal:!1,detectInstalled:"which augment",parentCompany:"Augment",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"claude-code",displayName:"Claude Code",localSkillsDir:".claude/skills",globalSkillsDir:"~/.claude/skills",isUniversal:!1,detectInstalled:"which claude",parentCompany:"Anthropic",featureSupport:{slashCommands:!0,hooks:!0,mcp:!0,customSystemPrompt:!0},pluginCacheDir:"~/.claude/plugins/cache",pluginMarketplaceDir:"~/.claude/plugins/marketplaces"},{id:"openclaw",displayName:"OpenClaw",localSkillsDir:".openclaw/skills",globalSkillsDir:"~/.openclaw/skills",isUniversal:!1,detectInstalled:"which openclaw",parentCompany:"Community",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"replit",displayName:"Replit Agent",localSkillsDir:".replit/skills",globalSkillsDir:"~/.config/agents/skills",isUniversal:!1,detectInstalled:"which replit",parentCompany:"Replit",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"codebuddy",displayName:"CodeBuddy",localSkillsDir:".codebuddy/skills",globalSkillsDir:"~/.codebuddy/skills",isUniversal:!1,detectInstalled:"which codebuddy",parentCompany:"CodeBuddy",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"command-code",displayName:"Command Code",localSkillsDir:".commandcode/skills",globalSkillsDir:"~/.commandcode/skills",isUniversal:!1,detectInstalled:"which command-code",parentCompany:"Command",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"continue",displayName:"Continue",localSkillsDir:".continue/skills",globalSkillsDir:"~/.continue/skills",isUniversal:!1,detectInstalled:"which continue",parentCompany:"Continue",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"crush",displayName:"Crush",localSkillsDir:".crush/skills",globalSkillsDir:"~/.config/crush/skills",isUniversal:!1,detectInstalled:"which crush",parentCompany:"Crush",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"droid",displayName:"Droid (Factory)",localSkillsDir:".factory/skills",globalSkillsDir:"~/.factory/skills",isUniversal:!1,detectInstalled:"which droid",parentCompany:"Factory",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"goose",displayName:"Goose",localSkillsDir:".goose/skills",globalSkillsDir:"~/.config/goose/skills",isUniversal:!1,detectInstalled:"which goose",parentCompany:"Block",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"junie",displayName:"Junie",localSkillsDir:".junie/skills",globalSkillsDir:"~/.junie/skills",isUniversal:!1,detectInstalled:"which junie",parentCompany:"JetBrains",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"iflow-cli",displayName:"iFlow CLI",localSkillsDir:".iflow/skills",globalSkillsDir:"~/.iflow/skills",isUniversal:!1,detectInstalled:"which iflow",parentCompany:"iFlow",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kilo",displayName:"Kilo Code",localSkillsDir:".kilocode/skills",globalSkillsDir:"~/.kilocode/skills",isUniversal:!1,detectInstalled:"which kilocode",parentCompany:"Kilo Code",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kiro-cli",displayName:"Kiro CLI",localSkillsDir:".kiro/skills",globalSkillsDir:"~/.kiro/skills",isUniversal:!1,detectInstalled:"which kiro",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"kode",displayName:"Kode",localSkillsDir:".kode/skills",globalSkillsDir:"~/.kode/skills",isUniversal:!1,detectInstalled:"which kode",parentCompany:"Kode",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mcpjam",displayName:"MCPJam",localSkillsDir:".mcpjam/skills",globalSkillsDir:"~/.mcpjam/skills",isUniversal:!1,detectInstalled:"which mcpjam",parentCompany:"MCPJam",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!1}},{id:"mistral-vibe",displayName:"Mistral Vibe",localSkillsDir:".vibe/skills",globalSkillsDir:"~/.vibe/skills",isUniversal:!1,detectInstalled:"which vibe",parentCompany:"Mistral AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mux",displayName:"Mux",localSkillsDir:".mux/skills",globalSkillsDir:"~/.mux/skills",isUniversal:!1,detectInstalled:"which mux",parentCompany:"Mux",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"openhands",displayName:"OpenHands",localSkillsDir:".openhands/skills",globalSkillsDir:"~/.openhands/skills",isUniversal:!1,detectInstalled:"which openhands",parentCompany:"All Hands AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pi",displayName:"Pi",localSkillsDir:".pi/skills",globalSkillsDir:"~/.pi/agent/skills",isUniversal:!1,detectInstalled:"which pi",parentCompany:"Pi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qoder",displayName:"Qoder",localSkillsDir:".qoder/skills",globalSkillsDir:"~/.qoder/skills",isUniversal:!1,detectInstalled:"which qoder",parentCompany:"Qoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"qwen-code",displayName:"Qwen Code",localSkillsDir:".qwen/skills",globalSkillsDir:"~/.qwen/skills",isUniversal:!1,detectInstalled:"which qwen-code",parentCompany:"Alibaba",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"roo",displayName:"Roo Code",localSkillsDir:".roo/skills",globalSkillsDir:"~/.roo/skills",isUniversal:!1,detectInstalled:"which roo",parentCompany:"Roo",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae",displayName:"Trae",localSkillsDir:".trae/skills",globalSkillsDir:"~/.trae/skills",isUniversal:!1,detectInstalled:"which trae",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"trae-cn",displayName:"Trae CN",localSkillsDir:".trae-cn/skills",globalSkillsDir:"~/.trae-cn/skills",isUniversal:!1,detectInstalled:"which trae-cn",parentCompany:"ByteDance",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"windsurf",displayName:"Windsurf",localSkillsDir:".windsurf/skills",globalSkillsDir:"~/.codeium/windsurf/skills",isUniversal:!1,detectInstalled:"which windsurf",parentCompany:"Codeium",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zencoder",displayName:"ZenCoder",localSkillsDir:".zencoder/skills",globalSkillsDir:"~/.zencoder/skills",isUniversal:!1,detectInstalled:"which zencoder",parentCompany:"ZenCoder",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"neovate",displayName:"Neovate",localSkillsDir:".neovate/skills",globalSkillsDir:"~/.neovate/skills",isUniversal:!1,detectInstalled:"which neovate",parentCompany:"Neovate",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"pochi",displayName:"Pochi",localSkillsDir:".pochi/skills",globalSkillsDir:"~/.pochi/skills",isUniversal:!1,detectInstalled:"which pochi",parentCompany:"Pochi",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"adal",displayName:"Adal",localSkillsDir:".adal/skills",globalSkillsDir:"~/.adal/skills",isUniversal:!1,detectInstalled:"which adal",parentCompany:"Adal",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"cortex",displayName:"Cortex",localSkillsDir:".cortex/skills",globalSkillsDir:"~/.snowflake/cortex/skills",isUniversal:!1,detectInstalled:"which cortex",parentCompany:"Cortex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"aider",displayName:"Aider",localSkillsDir:".aider/skills",globalSkillsDir:"~/.aider/skills",isUniversal:!1,detectInstalled:"which aider",parentCompany:"Aider",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"tabnine",displayName:"Tabnine Chat",localSkillsDir:".tabnine/skills",globalSkillsDir:"~/.tabnine/skills",isUniversal:!1,detectInstalled:"which tabnine",parentCompany:"Tabnine",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"devin",displayName:"Devin",localSkillsDir:".devin/skills",globalSkillsDir:"~/.devin/skills",isUniversal:!1,detectInstalled:"which devin",parentCompany:"Cognition",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"bolt-new",displayName:"bolt.new",localSkillsDir:".bolt/skills",globalSkillsDir:"~/.bolt/skills",isUniversal:!1,detectInstalled:"which bolt",parentCompany:"StackBlitz",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"v0",displayName:"v0",localSkillsDir:".v0/skills",globalSkillsDir:"~/.v0/skills",isUniversal:!1,detectInstalled:"which v0",parentCompany:"Vercel",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0},isRemoteOnly:!0},{id:"gpt-pilot",displayName:"GPT Pilot",localSkillsDir:".gpt-pilot/skills",globalSkillsDir:"~/.gpt-pilot/skills",isUniversal:!1,detectInstalled:"which gpt-pilot",parentCompany:"Pythagora",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"plandex",displayName:"Plandex",localSkillsDir:".plandex/skills",globalSkillsDir:"~/.plandex/skills",isUniversal:!1,detectInstalled:"which plandex",parentCompany:"Plandex",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"sweep",displayName:"Sweep",localSkillsDir:".sweep/skills",globalSkillsDir:"~/.sweep/skills",isUniversal:!1,detectInstalled:"which sweep",parentCompany:"Sweep AI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"mentat",displayName:"Mentat",localSkillsDir:".mentat/skills",globalSkillsDir:"~/.mentat/skills",isUniversal:!1,detectInstalled:"which mentat",parentCompany:"AbanteAI",featureSupport:{slashCommands:!1,hooks:!1,mcp:!1,customSystemPrompt:!0}},{id:"copilot-cli",displayName:"GitHub Copilot CLI",localSkillsDir:".copilot/skills",globalSkillsDir:"~/.copilot/skills",isUniversal:!1,detectInstalled:"which copilot",parentCompany:"GitHub (Microsoft)",featureSupport:{slashCommands:!0,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"warp",displayName:"Warp",localSkillsDir:".warp/skills",globalSkillsDir:"~/.warp/skills",isUniversal:!1,detectInstalled:"which warp",parentCompany:"Warp",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"amazon-q-cli",displayName:"Amazon Q CLI",localSkillsDir:".amazonq/skills",globalSkillsDir:"~/.aws/amazonq/skills",isUniversal:!1,detectInstalled:"which q",parentCompany:"AWS",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}},{id:"zed",displayName:"Zed",localSkillsDir:".zed/skills",globalSkillsDir:"~/.config/zed/skills",isUniversal:!1,detectInstalled:"which zed",parentCompany:"Zed Industries",featureSupport:{slashCommands:!1,hooks:!1,mcp:!0,customSystemPrompt:!0}}],gr={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},yr={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},Ik={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},dg={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},fg={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},fr={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},Vk={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},$k={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},Gk={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 qk(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 pg(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 u=Math.floor(o/60);if(u<60)return`${u} min ago`;const m=Math.floor(u/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 h=Math.floor(f/30);if(h<12)return`${h} month${h===1?"":"s"} ago`;const x=Math.floor(h/12);return`${x} year${x===1?"":"s"} ago`}function Yk(a){const r=Hk.find(i=>i.id===a);return(r==null?void 0:r.displayName)??a}function hr(a){const r=a?Gk[a]:void 0;return n.jsx("span",{style:Vk,title:r,children:"—"})}function bn(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:Ik,children:a}),n.jsx("span",{style:{minWidth:0},children:r})]},a)}function cr(a,r,i={}){if(r==null||r==="")return bn(a,hr(a));if(i.path)return bn(a,n.jsx("span",{"data-path-value":"true",style:$k,children:r}));const o=i.tabular?fr:i.mono?fg:dg;return bn(a,n.jsx("span",{style:o,children:r}))}function Pk({skill:a,allSkills:r=[],onSelectSkill:i}){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[Kk(a),a.origin==="installed"?Fk(a):null,Wk(a),Xk(a),Zk(a),ew(a,r,i)]})}function Kk(a){const r=a.homepage?n.jsxs("a",{href:a.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...fg,color:"var(--text-accent)",textDecoration:"none",display:"inline-flex",alignItems:"center",gap:4},onMouseEnter:o=>{o.currentTarget.style.textDecoration="underline"},onMouseLeave:o=>{o.currentTarget.style.textDecoration="none"},children:[n.jsx("span",{children:a.homepage}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):hr("Homepage"),i=a.tags&&a.tags.length>0?n.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:a.tags.map(o=>n.jsx("span",{"data-chip":"tag",style:{fontFamily:"var(--font-sans)",fontSize:11,padding:"2px 8px",border:"1px solid var(--border-default)",borderRadius:999,color:"var(--text-secondary)",background:"transparent"},children:o},o))}):hr("Tags");return n.jsxs("section",{style:yr,"aria-labelledby":"md-frontmatter",children:[n.jsx("h3",{id:"md-frontmatter",style:gr,children:"Frontmatter"}),cr("Description",a.description??null),cr("Version",a.version??null,{tabular:!0}),cr("Category",a.category??null),cr("Author",a.author??null),cr("License",a.license??null),bn("Homepage",r),bn("Tags",i)]},"frontmatter")}function Fk(a){const r=a.sourceAgent,i=r?n.jsx("span",{style:dg,"data-agent-id":r,children:Yk(r)}):hr("Agent");return n.jsxs("section",{style:yr,"aria-labelledby":"md-source-agent",children:[n.jsx("h3",{id:"md-source-agent",style:gr,children:"Source agent"}),bn("Agent",i)]},"source-agent")}function Wk(a){const r=a.lastModified?n.jsx("span",{style:fr,title:a.lastModified,children:pg(a.lastModified)}):hr("Last modified"),i=a.entryPoint??"SKILL.md",o=a.dir?`${a.dir.replace(/\/$/,"")}/${i}`:i,u=n.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>Qk(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:yr,"aria-labelledby":"md-fs",children:[n.jsx("h3",{id:"md-fs",style:gr,children:"Filesystem"}),cr("Directory",a.dir||null,{path:!0}),bn("Entry point",u),bn("Size",n.jsx("span",{style:fr,children:qk(a.sizeBytes)})),bn("Last modified",r)]},"filesystem")}function Qk(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 Xk(a){const r=a.benchmarkStatus==="pass"?"var(--status-installed)":a.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",i=n.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:r}}),a.benchmarkStatus]}),o=a.lastBenchmark?n.jsx("span",{style:fr,title:a.lastBenchmark,children:pg(a.lastBenchmark)}):hr("Last benchmark");return n.jsxs("section",{style:yr,"aria-labelledby":"md-bench",children:[n.jsx("h3",{id:"md-bench",style:gr,children:"Benchmark"}),bn("Eval count",n.jsx("span",{style:fr,children:a.evalCount})),bn("Assertions",n.jsx("span",{style:fr,children:a.assertionCount})),bn("Status",i),bn("Last benchmark",o)]},"benchmark")}function Zk(a){const r=a.mcpDeps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-mcp",children:[n.jsx("h3",{id:"md-mcp",style:gr,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(Jk,{}),n.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:i})]},i))})]},"mcp-deps")}function Jk(){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 ew(a,r,i){const o=a.deps??[];return n.jsxs("section",{style:yr,"aria-labelledby":"md-skill-deps",children:[n.jsx("h3",{id:"md-skill-deps",style:gr,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(u=>{const m=tw(u,r),f=m!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:f?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:f?"pointer":"help"},x=f&&i?()=>i({plugin:m.plugin,skill:m.skill,origin:m.origin}):void 0,p=f&&i?y=>{(y.key==="Enter"||y.key===" ")&&(y.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 ${u}`:"Not installed",onClick:x,onKeyDown:p,style:h,children:u},u)})})]},"skill-deps")}function tw(a,r){const[i,o]=a.includes("/")?a.split("/"):["",a];for(const u of r)if(i&&u.plugin===i&&u.skill===o||!i&&u.skill===o)return u;return null}const Kx=v.memo(function({message:r,politeness:i="polite",role:o}){const u=o??(i==="assertive"?"alert":"status");return n.jsx("div",{"aria-live":i,"aria-atomic":"true",role:u,"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 nw({toast:a,onDismiss:r}){const[i,o]=v.useState(!0),u=v.useRef(null);v.useEffect(()=>(u.current=requestAnimationFrame(()=>{u.current=requestAnimationFrame(()=>o(!1))}),()=>{u.current!=null&&cancelAnimationFrame(u.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 aw({toasts:a,onDismiss:r,liveMessage:i,liveAssertiveMessage:o}){return n.jsxs(n.Fragment,{children:[n.jsx(Kx,{politeness:"polite",message:i}),n.jsx(Kx,{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(u=>n.jsx("div",{style:{pointerEvents:"auto"},children:n.jsx(nw,{toast:u,onDismiss:r})},u.id))})]})}const mg=v.createContext(null);function Od(){const a=v.useContext(mg);if(!a)throw new Error("useToast must be used inside <ToastProvider>.");return a}function lw({children:a,maxVisible:r=4,defaultDurationMs:i=4e3}){const[o,u]=v.useState([]),[m,f]=v.useState(""),[h,x]=v.useState(""),p=v.useRef(new Map),y=v.useCallback(E=>{const k=p.current.get(E);k&&(clearTimeout(k),p.current.delete(E)),u(T=>T.filter(L=>L.id!==E))},[]),g=v.useCallback((E,k)=>{if(k<=0)return;const T=setTimeout(()=>{y(E)},k);p.current.set(E,T)},[y]),j=v.useCallback(E=>{const k=E.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,T={id:k,message:E.message,severity:E.severity??"info",durationMs:E.durationMs??i,action:E.action};return u(L=>[...L,T]),T.severity==="error"?x(T.message):f(T.message),g(k,T.durationMs),k},[i,g]),S=v.useCallback(()=>{for(const E of p.current.values())clearTimeout(E);p.current.clear(),u([])},[]);v.useEffect(()=>{function E(k){k.key==="Escape"&&u(T=>{if(T.length===0)return T;const L=T.slice(0,r),I=L[L.length-1],_=p.current.get(I.id);return _&&(clearTimeout(_),p.current.delete(I.id)),T.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),D=v.useMemo(()=>({toast:j,dismiss:y,clear:S}),[j,y,S]);return n.jsxs(mg.Provider,{value:D,children:[a,n.jsx(aw,{toasts:C,onDismiss:y,liveMessage:m,liveAssertiveMessage:h})]})}function rw(a){const{toast:r}=Od(),i=v.useRef(a);i.current=a;const o=v.useCallback(async(...u)=>{const m=i.current,f=m.snapshot();m.apply(...u),m.confirmGraceMs;const h=m.timeoutMs??5e3;let x=!1,p,y=!1;const g=m.commit(...u).then(()=>{x=!0,y=!0},C=>{x=!0,p=C??new Error("Commit failed")}),j=new Promise(C=>{setTimeout(C,h)});if(await Promise.race([g,j]),!x)p=new Error("TIMEOUT");else if(y)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(...u)}}})},[r]);return{run:o}}const Fx=6e4;function sw({skill:a}){const{refreshUpdates:r}=ya(),{toast:i}=Od(),[o,u]=v.useState("idle"),[m,f]=v.useState(null),[h,x]=v.useState(!1),[p,y]=v.useState(null),[g,j]=v.useState(!1),S=v.useRef(null),C=v.useRef(null),D=v.useCallback(()=>new Promise((I,_)=>{if(!a){_(new Error("No skill selected"));return}const $=Ne.startSkillUpdate(a.plugin,a.skill);S.current=$;const N=()=>{C.current&&(clearTimeout(C.current),C.current=null);try{$.close()}catch{}S.current=null};C.current=setTimeout(()=>{N(),_(new Error("TIMEOUT"))},Fx),$.addEventListener("progress",M=>{try{const R=JSON.parse(M.data);typeof(R==null?void 0:R.status)=="string"&&f(R.status)}catch{}}),$.addEventListener("done",()=>{N(),u("done"),f(null),r(),i({message:`Updated ${a.skill}.`,severity:"success",durationMs:4e3}),I()}),$.addEventListener("error",M=>{N();let R="Stream error";try{const H=typeof M.data=="string"?JSON.parse(M.data):null;H!=null&&H.error&&(R=String(H.error))}catch{}_(new Error(R))})}),[a,r,i]),E=rw({snapshot:()=>({status:o}),apply:()=>{u("updating"),f("updating")},commit:()=>D(),rollback:I=>{u(I.status==="updating"?"idle":I.status),f(null)},failureMessage:I=>`Couldn't update ${(a==null?void 0:a.skill)??"skill"} — ${I.message}`,timeoutMs:Fx+1e3});if(v.useEffect(()=>{if(!h||p!=null||!a||!a.latestVersion)return;let I=!1;return j(!0),Ne.getVersionDiff(a.plugin,a.skill,a.currentVersion??"",a.latestVersion).then(_=>{I||y(_)}).catch(()=>{I||y(null)}).finally(()=>{I||j(!1)}),()=>{I=!0}},[h,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 k=a.latestVersion,T=o==="updating"?"Updating…":k?`Update to ${k}`:"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:T}),n.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(I=>!I),disabled:L||!k,style:{background:"transparent",border:"none",color:"var(--text-secondary)",fontSize:12,fontFamily:"var(--font-sans)",cursor:"pointer",textDecoration:"underline"},children:h?"Hide changelog":"Preview changelog"})]}),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}),h&&k&&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(Ld,{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 td(){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 iw(a={}){if(a.selectedSkillInfo!==void 0||a.loadError!==void 0)return ow(a);const{state:r,selectSkill:i,setMode:o,refreshSkills:u}=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(td,{}),n.jsx(Uk,{})]});if(r.mode==="create")return n.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[n.jsx(td,{}),n.jsx(Lk,{onCreated:(p,y)=>{o("browse"),u(),i({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!r.selectedSkill)return r.skillsError?n.jsx(lo,{variant:"error",message:r.skillsError,onRetry:u}):!r.skillsLoading&&r.skills.length===0?n.jsx(lo,{variant:"no-skills"}):n.jsx(lo,{variant:"no-selection"});const h=r.selectedSkill,x=r.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsx(td,{}),n.jsx(cw,{skillInfo:x,allSkills:r.skills,onSelectSkill:p=>i(p)})]})}function ow(a){const r=a.selectedSkillInfo??null,i=a.activeDetailTab??"overview";if(r==null)return fw();if(a.loadError)return pw(r,a.loadError);const o=a.allSkills&&a.onSelectSkill?{allSkills:a.allSkills,onSelectSkill:a.onSelectSkill}:void 0;return hg(r,i,a.onDetailTabChange,o)}function cw({skillInfo:a,allSkills:r,onSelectSkill:i}){const[o,u]=v.useState("overview"),m=v.useMemo(()=>a?hg(a,o,u,{allSkills:r,onSelectSkill:i}):n.jsx(lo,{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 uw=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function dw(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:uw.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 fw(){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 pw(a,r){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[_d({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 hg(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:_d({skill:a})}),n.jsx(sw,{skill:a}),dw(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:[Pk({skill:a,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&n.jsx(Tx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:n.jsx(Ek,{hideHeader:!0})})},`${a.plugin}/${a.skill}-workspace`)]}),r==="versions"&&o!=null&&n.jsx(Tx,{plugin:a.plugin,skill:a.skill,origin:a.origin,children:n.jsx("div",{style:{padding:16},children:n.jsx(Wv,{})})},`${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 mw(){const{updateCount:a,state:r,dismissUpdateNotification:i}=ya(),o=a>0&&!r.updateNotificationDismissed;return v.useEffect(()=>{if(!o)return;const u=setTimeout(()=>i(),1e4);return()=>clearTimeout(u)},[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 hw=[{name:J.shortcuts.groupNavigation,items:[{keys:"/",label:J.shortcuts.search},{keys:"j",label:J.shortcuts.moveDown},{keys:"k",label:J.shortcuts.moveUp},{keys:"Enter",label:J.shortcuts.openSelected},{keys:"Esc",label:"Close / clear"}]},{name:J.shortcuts.groupActions,items:[{keys:"⌘K",label:J.shortcuts.openPalette},{keys:"?",label:J.shortcuts.openShortcuts},{keys:"⌘B",label:J.shortcuts.toggleSidebar},{keys:"E",label:J.actions.edit}]},{name:J.shortcuts.groupTheme,items:[{keys:"⌘⇧D",label:J.shortcuts.toggleTheme}]}];function xw({open:a,onClose:r,groups:i=hw,title:o=J.shortcuts.title}){const u=v.useRef(null),m=v.useRef(null);return v.useEffect(()=>{var f;if(a)return u.current=document.activeElement??null,(f=m.current)==null||f.focus(),()=>{var h,x;(x=(h=u.current)==null?void 0:h.focus)==null||x.call(h),u.current=null}},[a]),v.useEffect(()=>{if(!a)return;function f(h){var x;if(h.key==="Escape"){h.preventDefault(),r();return}h.key==="Tab"&&(h.preventDefault(),(x=m.current)==null||x.focus())}return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[a,r]),a?n.jsx("div",{role:"presentation","data-testid":"shortcut-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, var(--bg-canvas) 70%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},onClick:f=>{f.target===f.currentTarget&&r()},children:n.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"shortcut-modal-title",style:{width:"min(480px, 92vw)",maxHeight:"80vh",overflow:"auto",background:"var(--bg-canvas)",border:"1px solid var(--border-default)",borderRadius:8,boxShadow:"0 16px 48px rgba(0,0,0,0.18)",padding:"16px 20px",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[n.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),n.jsx("button",{ref: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(h=>n.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[n.jsx("span",{children:h.label}),n.jsx("kbd",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-secondary)",border:"1px solid var(--border-default)",borderRadius:3,padding:"1px 6px"},children:h.keys})]},`${f.name}:${h.keys}`))})]},f.name))]})}):null}function vw(a){const r=J.actions,i=[{action:"open",label:r.open},{action:"copy-path",label:r.copyPath},{action:"reveal",label:r.revealInEditor},{action:"run-benchmark",label:r.runBenchmark}];if(a.origin==="source")return[...i,{action:"edit",label:r.edit},{action:"duplicate",label:r.duplicate}];const o=[...i];return a.updateAvailable&&o.push({action:"update",label:r.update}),o.push({action:"uninstall",label:r.uninstall}),o}function gw({state:a,onClose:r,onAction:i,itemsOverride:o}){const u=v.useRef(null),m=v.useRef(null),[f,h]=v.useState(0),x=v.useMemo(()=>a.skill?o??vw(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+x.length*28;let C=a.x,D=a.y;return C+j+g>window.innerWidth&&(C=Math.max(g,a.x-j)),D+S+g>window.innerHeight&&(D=Math.max(g,a.y-S)),{left:C,top:D}},[a.x,a.y,x.length]);v.useEffect(()=>{if(a.open)return m.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var g;(g=u.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 y=v.useCallback(()=>{if(!a.skill)return;const g=x[f];!g||g.disabled||(i(g.action,a.skill),r())},[x,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(),h(C=>Math.min(C+1,Math.max(x.length-1,0)));return}if(S.key==="ArrowUp"){S.preventDefault(),h(C=>Math.max(C-1,0));return}if(S.key==="Enter"||S.key===" "){S.preventDefault(),y();return}}function j(S){u.current&&S.target instanceof Node&&(u.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,x.length,y]),!a.open||!a.skill?null:n.jsx("div",{ref:u,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:x.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:()=>h(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 yw={"anthropic-api":{name:J.setupProviders.anthropic.name,description:J.setupProviders.anthropic.description,envVars:J.setupProviders.anthropic.envVars,keyUrl:J.setupProviders.anthropic.keyUrl,learnMoreUrl:J.setupProviders.anthropic.learnMoreUrl},openai:{name:J.setupProviders.openai.name,description:J.setupProviders.openai.description,envVars:J.setupProviders.openai.envVars,keyUrl:J.setupProviders.openai.keyUrl,learnMoreUrl:J.setupProviders.openai.learnMoreUrl},openrouter:{name:J.setupProviders.openrouter.name,description:J.setupProviders.openrouter.description,envVars:J.setupProviders.openrouter.envVars,keyUrl:J.setupProviders.openrouter.keyUrl,learnMoreUrl:J.setupProviders.openrouter.learnMoreUrl},gemini:{name:J.setupProviders.gemini.name,description:J.setupProviders.gemini.description,envVars:J.setupProviders.gemini.envVars,keyUrl:J.setupProviders.gemini.keyUrl,learnMoreUrl:J.setupProviders.gemini.learnMoreUrl},ollama:{name:J.setupProviders.ollama.name,description:J.setupProviders.ollama.description,envVars:J.setupProviders.ollama.envVars,install:[J.setupProviders.ollama.installCmd],start:[J.setupProviders.ollama.startCmd],pullExample:J.setupProviders.ollama.pullExample,learnMoreUrl:J.setupProviders.ollama.learnMoreUrl},"lm-studio":{name:J.setupProviders.lmStudio.name,description:J.setupProviders.lmStudio.description,envVars:J.setupProviders.lmStudio.envVars,install:[J.setupProviders.lmStudio.installCmd],start:[J.setupProviders.lmStudio.startCmd],pullExample:J.setupProviders.lmStudio.pullExample,learnMoreUrl:J.setupProviders.lmStudio.learnMoreUrl},"claude-code":{name:J.setupProviders.claudeCode.name,description:J.setupProviders.claudeCode.description,envVars:[],notes:[J.setupProviders.claudeCode.loginHint,J.claudeCodeLabel.compactLabel],learnMoreUrl:J.setupProviders.claudeCode.learnMoreUrl}};function bw(a){return a?yw[a]??null:null}function jw({open:a,providerKey:r,onClose:i}){const o=v.useRef(null);if(v.useEffect(()=>{if(!a)return;const f=h=>{h.key==="Escape"&&(h.preventDefault(),i())};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a,i]),v.useEffect(()=>{if(!a)return;const f=o.current;if(!f)return;const h=f.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[a]),!a||typeof document>"u")return null;const u=bw(r),m=(u==null?void 0:u.name)??J.setupDrawer.fallbackTitle;return co.createPortal(n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:i,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),n.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(m),style:{position:"fixed",top:0,right:0,bottom:0,width:"480px",maxWidth:"100vw",background:"var(--bg-surface, var(--surface-1))",borderLeft:"1px solid var(--border-default, var(--border-subtle))",boxShadow:"-8px 0 32px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",zIndex:100,fontFamily:"var(--font-sans)",animation:"vskillDrawerIn 200ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsx(Sw,{title:m,onClose:i}),n.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:u?n.jsx(kw,{content:u}):n.jsx(ww,{})}),n.jsx("style",{children:`@keyframes vskillDrawerIn {
|
|
81
|
+
from { transform: translateX(100%); }
|
|
82
|
+
to { transform: translateX(0); }
|
|
83
|
+
}
|
|
84
|
+
@keyframes vskillDrawerBackdropIn {
|
|
85
|
+
from { opacity: 0; }
|
|
86
|
+
to { opacity: 1; }
|
|
87
|
+
}`})]})]}),document.body)}function Sw({title:a,onClose:r}){return n.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[n.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:J.setupDrawer.title(a)}),n.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:r,"aria-label":J.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function kw({content:a}){var r,i;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[n.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:a.description}),a.notes&&a.notes.length>0&&n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.notes.map(o=>n.jsx("li",{style:{fontSize:13,color:"var(--text-secondary)",padding:"8px 10px",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",borderRadius:4},children:o},o))}),a.envVars.length>0&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.requiredEnv}),n.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:a.envVars.map(o=>n.jsx("li",{children:n.jsx(Cw,{name:o})},o))})]}),a.keyUrl&&n.jsx(Nw,{href:a.keyUrl,label:J.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(a.install||a.start||a.pullExample)&&n.jsxs("section",{children:[n.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.installRun}),n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(r=a.install)==null?void 0:r.map((o,u)=>n.jsx(nd,{code:o},`install-${u}`)),(i=a.start)==null?void 0:i.map((o,u)=>n.jsx(nd,{code:o},`start-${u}`)),a.pullExample&&n.jsx(nd,{code:a.pullExample})]})]}),n.jsx("footer",{style:{marginTop:8},children:n.jsxs("a",{href:a.learnMoreUrl,target:"_blank",rel:"noopener noreferrer","data-testid":"setup-drawer-learn-more",style:{fontSize:12,color:"var(--color-accent, var(--accent-surface))",textDecoration:"none"},children:[J.setupDrawer.learnMore," →"]})})]})}function ww(){return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[n.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:J.setupDrawer.fallbackTitle}),n.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:J.setupDrawer.fallbackBody})]})}function Cw({name:a}){const r=async()=>{var i;try{await((i=navigator.clipboard)==null?void 0:i.writeText(a))}catch{}};return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",background:"color-mix(in srgb, var(--border-default) 30%, transparent)",borderRadius:4},children:[n.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:a}),n.jsx("button",{type:"button",onClick:r,"aria-label":`Copy ${a} to clipboard`,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:3,padding:"2px 8px",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-sans)",cursor:"pointer"},children:J.setupDrawer.copy})]})}function nd({code:a}){return n.jsx("pre",{style:{margin:0,padding:"8px 10px",background:"var(--bg-canvas, #111)",color:"var(--text-primary)",fontFamily:"var(--font-mono)",fontSize:11.5,lineHeight:1.5,borderRadius:4,border:"1px solid var(--border-default, var(--border-subtle))",overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})}function Nw({href:a,label:r,testId:i}){return n.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer","data-testid":i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 12%, transparent)",color:"var(--text-primary)",textDecoration:"none",fontSize:13,fontWeight:500,fontFamily:"var(--font-sans)",width:"fit-content"},children:[r," →"]})}function Ew(){const[a,r]=v.useState(!1),[i,o]=v.useState(null),u=v.useRef(null),m=v.useCallback((h,x)=>{var p;u.current=typeof document<"u"?document.activeElement:null,(p=x==null?void 0:x.beforeOpen)==null||p.call(x),o(h),r(!0)},[]),f=v.useCallback(()=>{r(!1);const h=u.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:m,close:f,isOpen:a,providerKey:i}}function Tw(a){const r=[],i=[],o=new Set;for(const u of a){if(u.presence==="absent"||u.health==="missing"){i.push({kind:"individual",key:u.id,agent:u});continue}if(u.sharedFolderGroup&&u.sharedFolderGroup.length>1){const m=[...u.sharedFolderGroup].sort().join("+");if(o.has(m))continue;o.add(m);const f=a.filter(h=>u.sharedFolderGroup.includes(h.id));r.push({kind:"aggregate",key:`shared:${m}`,consumers:f,sharedFolderPath:u.sharedFolderPath??"~/.config/agents/skills",combinedCount:f.reduce((h,x)=>h+x.globalCount,0)});continue}r.push({kind:"individual",key:u.id,agent:u})}return{detected:r,notDetected:i}}function Rw({agents:a,activeAgentId:r,focusedAgentId:i,onFocusAgent:o,onSwitch:u,onOpenSetup:m,onClose:f}){const h=v.useRef(null);v.useEffect(()=>{const y=g=>{g.key==="Escape"&&(g.preventDefault(),f())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f]),v.useEffect(()=>{const y=j=>{h.current&&!h.current.contains(j.target)&&f()},g=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(g),document.removeEventListener("mousedown",y)}},[f]);const x=v.useMemo(()=>Tw(a),[a]),p=a.find(y=>y.id===i)??a.find(y=>y.id===r)??a[0];return typeof document>"u"?null:co.createPortal(n.jsxs("div",{ref:h,"data-testid":"agent-scope-picker-popover",role:"dialog","aria-label":J.scopePicker.popoverTitle,style:{position:"fixed",top:96,left:"50%",transform:"translateX(-50%)",width:600,maxWidth:"calc(100vw - 32px)",background:"var(--bg-surface, var(--surface-1))",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:8,boxShadow:"0 18px 40px rgba(0,0,0,0.25)",overflow:"hidden",zIndex:90,animation:"scopePickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[n.jsxs("section",{"data-testid":"agent-scope-picker-agents",style:{width:260,borderRight:"1px solid var(--border-default, var(--border-subtle))",overflowY:"auto",padding:"6px 0"},children:[x.detected.length===0&&x.notDetected.length===0&&n.jsx(Wx,{}),x.detected.map(y=>y.kind==="aggregate"?n.jsx(Mw,{row:y,onFocus:()=>{var g;return o(((g=y.consumers[0])==null?void 0:g.id)??r??"")}},y.key):n.jsx(Aw,{agent:y.agent,focused:y.agent.id===i,active:y.agent.id===r,onClick:()=>o(y.agent.id)},y.key)),x.notDetected.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-testid":"agent-scope-not-detected-subheading",style:{padding:"10px 14px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-tertiary)"},children:J.scopePicker.notDetectedSubheading}),x.notDetected.map(y=>n.jsx(Dw,{agent:y.agent,onSetUp:()=>m(y.agent.id)},y.key))]})]}),n.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?n.jsx(zw,{agent:p,activeAgentId:r,onSwitch:()=>u(p.id)}):n.jsx(Wx,{})})]}),n.jsx("style",{children:`@keyframes scopePickerFadeIn {
|
|
88
|
+
from { opacity: 0; transform: translateX(-50%) translateY(2px); }
|
|
89
|
+
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
|
90
|
+
}`})]}),document.body)}function Aw({agent:a,focused:r,active:i,onClick:o}){const u=a.health==="ok"?"var(--color-ok, #22c55e)":a.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return n.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":a.id,"data-active":i?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:r?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",border:"none",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),n.jsx("span",{style:{flex:1,fontSize:13},children:a.displayName}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[a.installedCount,"·",a.globalCount]})]})}function Mw({row:a,onFocus:r}){return n.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:r,style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4,width:"100%",padding:"8px 14px",background:"transparent",border:"none",borderTop:"1px dashed var(--border-subtle)",borderBottom:"1px dashed var(--border-subtle)",cursor:"pointer",textAlign:"left",fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[n.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:a.sharedFolderPath}),n.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[a.consumers.map(i=>n.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"color-mix(in srgb, var(--color-global) 20%, transparent)",color:"var(--text-primary)"},children:i.id},i.id)),n.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",a.combinedCount," skills"]})]})]})}function Dw({agent:a,onSetUp:r}){return n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),n.jsx("span",{style:{flex:1},children:a.displayName}),a.isRemoteOnly?n.jsx("span",{"data-testid":`agent-scope-remote-badge-${a.id}`,"aria-label":"Remote-only agent",style:{background:"color-mix(in srgb, var(--text-tertiary) 18%, transparent)",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:10,padding:"1px 8px",color:"var(--text-secondary)",fontSize:10,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Remote"}):n.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${a.id}`,onClick:r,style:{background:"transparent",border:"1px solid var(--border-default, var(--border-subtle))",borderRadius:4,padding:"2px 8px",color:"var(--text-primary)",fontSize:11,cursor:"pointer"},children:J.scopePicker.setUpCta(a.displayName)})]})}function zw({agent:a,activeAgentId:r,onSwitch:i}){const o=a.id===r,u=a.isRemoteOnly===!0,m=o||u,f=o?"Active":u?"Remote-only":J.scopePicker.switchCta;return n.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.jsxs("div",{children:[n.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:a.displayName}),n.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:u?"Remote service — no local install":_w(a.health)})]}),n.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[n.jsx(ad,{label:J.scopePicker.statsInstalled,value:String(a.installedCount)}),n.jsx(ad,{label:J.scopePicker.statsGlobal,value:String(a.globalCount)}),n.jsx(ad,{label:J.scopePicker.statsLastSync,value:a.lastSync?Lw(a.lastSync):"—"})]}),n.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:i,disabled:m,title:u?"This agent has no local CLI to switch to":void 0,style:{alignSelf:"flex-start",padding:"8px 14px",borderRadius:6,border:"1px solid var(--border-default, var(--border-subtle))",background:m?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:m?"default":"pointer",opacity:m?.5:1},children:f})]})}function ad({label:a,value:r}){return n.jsxs(n.Fragment,{children:[n.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:a}),n.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:r})]})}function Wx(){return n.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function Lw(a){try{const r=new Date(a).getTime(),i=Date.now()-r;if(Number.isNaN(r))return"—";const o=Math.round(i/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const u=Math.round(o/60);return u<24?`${u}h ago`:`${Math.round(u/24)}d ago`}catch{return"—"}}function _w(a){switch(a){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function Ow(a){const r=new Map;for(const i of a.sharedFolders??[])for(const o of i.consumers)r.set(o,i);return a.agents.map(i=>{const o=r.get(i.id);return{id:i.id,displayName:i.displayName,presence:i.detected?"detected":"absent",installedCount:i.localSkillCount,globalCount:i.globalSkillCount,lastSync:i.lastSync,health:i.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:i.isRemoteOnly}})}function Bw({agents:a,activeAgentId:r,onActiveAgentChange:i,onOpenSetup:o}){const[u,m]=v.useState(!1),[f,h]=v.useState(null),x=v.useRef(null),p=v.useMemo(()=>a.find(S=>S.id===r)??a[0]??null,[a,r]),y=v.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),g=v.useCallback(()=>{var S;m(!1),(S=x.current)==null||S.focus()},[]),j=v.useCallback(S=>{i(S),m(!1)},[i]);return n.jsxs(n.Fragment,{children:[n.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":u,onClick:()=>m(S=>!S),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),m(!0))},style:{display:"flex",alignItems:"center",gap:10,height:"40px",width:"100%",padding:"0 14px",background:"var(--bg-surface, var(--surface-1))",border:"none",borderBottom:"1px solid var(--border-default, var(--border-subtle))",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,textAlign:"left",position:"sticky",top:0,zIndex:2},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),n.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),n.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:["(",(p==null?void 0:p.installedCount)??0," · ",(p==null?void 0:p.globalCount)??0,")"]}),n.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),u&&n.jsx(Rw,{agents:a,activeAgentId:r,focusedAgentId:f??r,onFocusAgent:h,onSwitch:j,onOpenSetup:S=>{o(S),g()},onClose:g})]})}const xg="vskill-ccode-banner-dismissed",Uw=new Set(["claude-cli","claude-code"]);function Hw(){try{return sessionStorage.getItem(xg)==="true"}catch{return!1}}function Iw(){try{sessionStorage.setItem(xg,"true")}catch{}}function Vw({activeAgentId:a}){const[r,i]=v.useState(()=>Hw()),o=v.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),u=v.useCallback(()=>{Iw(),i(!0)},[]);return!a||!Uw.has(a)||r?null:n.jsxs("div",{"data-testid":"claude-code-first-use-banner",role:"note","aria-label":"Claude Code subscription info",style:{display:"flex",alignItems:"flex-start",gap:10,padding:"8px 12px",borderBottom:"1px solid var(--border-default, var(--border-subtle))",background:"color-mix(in srgb, var(--accent-surface) 8%, transparent)",fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-primary)",lineHeight:1.45},children:[n.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),n.jsxs("div",{style:{flex:1,minWidth:0},children:[n.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-learn-more",onClick:o,style:{background:"transparent",border:"none",padding:0,color:"var(--color-accent, var(--accent-surface))",cursor:"pointer",textDecoration:"underline",fontFamily:"inherit",fontSize:"inherit"},children:J.claudeCodeLabel.learnMore})]}),n.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:u,"aria-label":"Dismiss Claude Code info banner",style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1,padding:2,flexShrink:0},children:"×"})]})}function $w(){const[a,r]=v.useState(null),[i,o]=v.useState("loading"),[u,m]=v.useState(null),f=v.useCallback(async()=>{try{const h=await Ne.getAgents();r(h),o("ready"),m(null)}catch(h){o("error"),m(h.message)}},[]);return v.useEffect(()=>{f()},[f]),v.useEffect(()=>{const h=()=>void f();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[f]),{status:i,response:a,error:u,refresh:()=>void f()}}const Ji="workspace",Gw=["skills","agents"];async function qw(){const a=await fetch("/api/workspace");if(!a.ok)throw new Error(`GET /api/workspace failed: ${a.status}`);return await a.json()}async function Yw(a){const r=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/active failed: ${r.status}`)}return await r.json()}async function Pw(a){const r=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`POST /api/workspace/projects failed: ${r.status}`)}return await r.json()}async function Kw(a){const r=await fetch(`/api/workspace/projects/${encodeURIComponent(a)}`,{method:"DELETE"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Error(i.error??`DELETE /api/workspace/projects/${a} failed: ${r.status}`)}return await r.json()}function ld(){for(const a of Gw)ga(a)}function Fw(){const{data:a,loading:r,error:i,revalidate:o}=Ms(Ji,qw),u=a,m=u==null?void 0:u.projects.find(p=>p.id===u.activeProjectId),f=v.useCallback(async p=>{await Yw(p),ga(Ji),ld()},[]),h=v.useCallback(async p=>{await Pw(p),ga(Ji),ld()},[]),x=v.useCallback(async p=>{await Kw(p),ga(Ji),ld()},[]);return{workspace:u,activeProject:m,loading:r,error:i,switchProject:f,addProject:h,removeProject:x,revalidate:o}}function Ww({workspace:a,onSwitch:r,onAdd:i,onRemove:o,isPathStale:u}){const[m,f]=v.useState(!1),[h,x]=v.useState(!1),[p,y]=v.useState(""),[g,j]=v.useState(null),S=(a==null?void 0:a.projects)??[],C=S.find(k=>k.id===(a==null?void 0:a.activeProjectId));async function D(){j(null);const k=p.trim();if(!k){j("Enter an absolute project path");return}try{await i({path:k}),y(""),x(!1)}catch(T){j(T instanceof Error?T.message:String(T))}}async function E(){if(j(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const k=await window.showDirectoryPicker();y(k.name)}catch{}else x(!0)}return n.jsxs("div",{"data-vskill-project-picker":!0,className:"relative inline-block",children:[n.jsxs("button",{type:"button",onClick:()=>f(k=>!k),"aria-expanded":m,"aria-haspopup":"menu",className:"vskill-project-pill flex items-center gap-2 px-2 py-1 text-sm font-mono",children:[n.jsx("span",{"data-testid":"project-color-dot","aria-hidden":!0,className:"vskill-project-dot inline-block w-2 h-2 rounded-full",style:{backgroundColor:(C==null?void 0:C.colorDot)??"var(--muted-foreground)"}}),n.jsx("span",{className:"vskill-project-name",children:C?C.name:"No project selected"})]}),m&&n.jsxs("div",{role:"menu",className:"vskill-project-popover absolute top-full left-0 mt-1 min-w-64 border rounded shadow-md bg-background z-10",children:[S.length===0&&n.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No projects — add one to begin."}),S.map(k=>{const T=u?u(k.path):!1;return n.jsxs("div",{role:"menuitem","data-stale":T?"true":"false",className:["flex items-center gap-2 px-3 py-2",T?"opacity-50 pointer-events-none-selection":"cursor-pointer hover:bg-muted"].join(" "),children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:k.colorDot}}),n.jsxs("button",{type:"button",disabled:T,onClick:()=>{T||(r(k.id),f(!1))},className:"flex-1 text-left text-sm",children:[n.jsx("div",{className:"vskill-project-row-name",children:k.name}),n.jsx("div",{className:"vskill-project-row-path text-xs font-mono text-muted-foreground",children:k.path}),T&&n.jsx("div",{className:"text-xs text-amber-600",children:"Stale — path no longer exists."})]}),n.jsx("button",{type:"button","aria-label":`Remove ${k.name}`,onClick:L=>{L.stopPropagation(),o(k.id)},className:"px-2 text-xs text-muted-foreground hover:text-destructive",children:"Remove"})]},k.id)}),n.jsxs("div",{className:"border-t px-3 py-2 text-xs",children:[!h&&n.jsx("button",{type:"button",onClick:()=>void E(),className:"vskill-project-add text-xs text-primary hover:underline",children:"+ Add project"}),h&&n.jsxs("div",{className:"flex gap-1",children:[n.jsx("input",{type:"text",value:p,onChange:k=>y(k.target.value),placeholder:"/absolute/path/to/project",className:"flex-1 px-2 py-1 text-xs border rounded",autoFocus:!0}),n.jsx("button",{type:"button",onClick:()=>void D(),className:"text-xs",children:"Add"})]}),g&&n.jsx("div",{className:"mt-1 text-xs text-destructive",children:g})]})]})]})}function Qw(a,r){const i=r.trim().toLowerCase().split(/\s+/).filter(Boolean);return i.length===0?a:a.filter(o=>{const u=`${o.name} ${o.path}`.toLowerCase();return i.every(m=>u.includes(m))})}function Xw({open:a,projects:r,onSwitch:i,onClose:o}){const[u,m]=v.useState(""),[f,h]=v.useState(0),x=v.useMemo(()=>Qw(r,u),[r,u]);v.useEffect(()=>{a||(m(""),h(0))},[a]),v.useEffect(()=>{f>=x.length&&h(0)},[x.length,f]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(g=>Math.min(g+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(g=>Math.max(g-1,0));return}if(y.key==="Enter"){y.preventDefault();const g=x[f];g&&(i(g.id),o())}};return a?n.jsxs("div",{role:"dialog","aria-modal":"true","data-vskill-project-palette":!0,className:"vskill-project-palette fixed inset-0 z-50 flex items-start justify-center pt-24",children:[n.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),n.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[n.jsx("input",{type:"text",autoFocus:!0,value:u,onChange:y=>m(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),n.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&n.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,g)=>n.jsxs("li",{role:"option","aria-selected":g===f,"data-highlighted":g===f,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",g===f?"bg-muted":""].join(" "),onMouseEnter:()=>h(g),onClick:()=>{i(y.id),o()},children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),n.jsxs("span",{className:"flex-1",children:[n.jsx("span",{className:"vskill-palette-name",children:y.name}),n.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const vg="vskill.studio.prefs";function gg(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function yg(){const a=gg();if(!a)return{};try{const r=a.getItem(vg);if(!r)return{};const i=JSON.parse(r);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return{}}}function Zw(a,r){const i=gg();if(i)try{const u={...yg(),[a]:r};i.setItem(vg,JSON.stringify(u))}catch{}}function Jw(a,r){const o=yg()[a];return o===void 0?r:o}const Qx={open:!1,x:0,y:0,skill:null};function eC(a,r){return{open:!0,x:a.clientX,y:a.clientY,skill:r}}function xl(a,r="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:a,severity:r}}))}function tC(a,r){var i;switch(a){case"copy-path":try{(i=navigator.clipboard)==null||i.writeText(r.dir)}catch{xl(J.toasts.permissionDenied,"error");return}xl(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":xl(J.actions.editPlaceholder,"info");return;case"run-benchmark":xl(J.toasts.benchmarkQueued,"info");return;case"duplicate":xl(J.toasts.skillDuplicated,"info");return;case"update":xl(J.toasts.skillUpdated,"info");return;case"uninstall":xl(J.actions.editPlaceholder,"info");return;default:return}}const nC=v.lazy(()=>yd(()=>import("./CommandPalette-DrPj2MN0.js"),__vite__mapDeps([2,1])));function aC(){return n.jsx(cb,{children:n.jsx(sb,{children:n.jsxs(lw,{children:[n.jsx(lC,{}),n.jsx(mw,{})]})})})}function lC(){var ge,xe;const{state:a,selectSkill:r,clearSelection:i,refreshSkills:o,outdatedByOrigin:u}=ya(),{config:m}=bl(),{mode:f,resolvedTheme:h,setTheme:x}=sv(),{toast:p}=Od(),[y,g]=v.useState(()=>R2()),[j]=v.useState(!0),[S,C]=v.useState(!1),[D,E]=v.useState(!1),[k,T]=v.useState(!1),[L,I]=v.useState("overview"),[_,$]=v.useState(Qx),N=v.useCallback((oe,ae)=>{$(eC(oe,ae))},[]),M=$w(),[R,H]=v.useState(()=>Jw("activeAgent",null));v.useEffect(()=>{var oe;!R&&((oe=M.response)!=null&&oe.suggested)&&H(M.response.suggested)},[R,(ge=M.response)==null?void 0:ge.suggested]);const q=v.useCallback(oe=>{H(oe),Zw("activeAgent",oe),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:oe}}))},[]),P=v.useMemo(()=>M.response?Ow(M.response):[],[M.response]),{workspace:te,switchProject:X,addProject:O,removeProject:A}=Fw(),[B,se]=v.useState(!1);fd([{key:"p",meta:!0,handler:oe=>{var ve;const ae=typeof document<"u"?document.activeElement:null;ae&&ae.tagName==="INPUT"||((ve=oe==null?void 0:oe.preventDefault)==null||ve.call(oe),se(Ie=>!Ie))}}],{enabled:!0});const Y=Ew();v.useEffect(()=>{function oe(ae){if(!(ae instanceof CustomEvent))return;const ve=ae.detail;ve!=null&&ve.provider&&Y.open(ve.provider)}return window.addEventListener("studio:open-setup-drawer",oe),()=>window.removeEventListener("studio:open-setup-drawer",oe)},[Y]);const me=v.useCallback(()=>{$(Qx)},[]);v.useEffect(()=>{function oe(ae){if(!(ae instanceof CustomEvent))return;const ve=ae.detail;ve!=null&&ve.message&&p({message:ve.message,severity:ve.severity??"info"})}return window.addEventListener("studio:toast",oe),()=>window.removeEventListener("studio:toast",oe)},[p]),v.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const z=v.useMemo(()=>a.selectedSkill?a.skills.find(oe=>oe.plugin===a.selectedSkill.plugin&&oe.skill===a.selectedSkill.skill)??null:null,[a.skills,a.selectedSkill]),W=v.useCallback(oe=>{r({plugin:oe.plugin,skill:oe.skill,origin:oe.origin})},[r]),ie=v.useMemo(()=>{if(!a.selectedSkill)return"";const oe=a.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${a.selectedSkill.skill} (${oe})`},[a.selectedSkill]),de=v.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(f==="light"?"dark":f==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>T(oe=>!oe)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>E(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[f,x,o]);return fd([{key:"cmd+k",handler:()=>C(oe=>!oe)},{key:"ctrl+k",handler:()=>C(oe=>!oe)},{key:"?",handler:()=>E(oe=>!oe)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>T(oe=>!oe)},{key:"ctrl+b",handler:()=>T(oe=>!oe)},{key:"e",handler:()=>p({message:J.actions.editPlaceholder,severity:"info"})}]),n.jsxs(n.Fragment,{children:[n.jsx(ub,{sidebarWidth:y,sidebarHidden:k||a.isMobile&&a.mobileView==="detail",banner:n.jsx(D2,{connected:j}),liveMessage:ie,topRail:n.jsx(c0,{projectName:(m==null?void 0:m.projectName)??null,selected:a.selectedSkill,onOpenPalette:()=>C(!0),onHome:i,projectPickerSlot:te&&te.projects.length>0?n.jsx(Ww,{workspace:te,onSwitch:X,onAdd:O,onRemove:A}):void 0}),sidebar:n.jsx(j2,{skills:a.skills,selectedKey:a.selectedSkill?{plugin:a.selectedSkill.plugin,skill:a.selectedSkill.skill}:null,onSelect:W,isLoading:a.skillsLoading,error:a.skillsError??null,onRetry:o,onContextMenu:N,outdatedByOrigin:u,activeAgentId:R,topSlot:M.status==="ready"&&P.length>0?n.jsxs(n.Fragment,{children:[n.jsx(Bw,{agents:P,activeAgentId:R,onActiveAgentChange:q,onOpenSetup:oe=>Y.open(oe)}),n.jsx(Vw,{activeAgentId:R})]}):null}),resizeHandle:n.jsx(M2,{initialWidth:y??bs,onChange:g}),main:n.jsx(iw,{selectedSkillInfo:z,activeDetailTab:L,onDetailTabChange:I,allSkills:a.skills,onSelectSkill:W}),statusBar:n.jsx(b0,{projectPath:(m==null?void 0:m.root)??null,modelName:(m==null?void 0:m.model)??null,health:m!=null&&m.error?"degraded":"ok",providers:(xe=m==null?void 0:m.providers)==null?void 0:xe.map(oe=>{const ae=oe.id;return{id:ae,label:oe.label,available:oe.available,kind:ae==="ollama"||ae==="lm-studio"?"start-service":ae==="anthropic"||ae==="openrouter"?"api-key":"cli-install"}})})}),n.jsx(xw,{open:D,onClose:()=>E(!1)}),n.jsx(jw,{open:Y.isOpen,providerKey:Y.providerKey,onClose:Y.close}),n.jsx(gw,{state:_,onClose:me,onAction:(oe,ae)=>tC(oe,ae)}),S&&n.jsx(v.Suspense,{fallback:null,children:n.jsx(nC,{open:S,onClose:()=>C(!1),commands:de})}),n.jsx(Xw,{open:B,projects:(te==null?void 0:te.projects)??[],onSwitch:oe=>{X(oe)},onClose:()=>se(!1)})]})}const Xx="vskill.migrations.scope-rename.v1",rC={own:"authoring-project",installed:"available-project",global:"available-personal"},sC=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function iC(a){if(a.getItem(Xx)==="done")return;const r=[];for(let i=0;i<a.length;i++){const o=a.key(i);if(!o)continue;const u=o.match(sC);if(!u)continue;const[,m,f]=u,h=rC[f];if(!h)continue;const x=a.getItem(o);x!==null&&r.push({oldKey:o,newKey:`vskill-sidebar-${m}-${h}-collapsed`,value:x})}for(const{oldKey:i,newKey:o,value:u}of r)a.getItem(o)===null&&a.setItem(o,u),a.removeItem(i);a.setItem(Xx,"done")}if(typeof PerformanceObserver<"u")try{const a=new PerformanceObserver(r=>{for(const i of r.getEntries())if(i.name==="first-contentful-paint"){window.__vskillPaint=i.startTime,a.disconnect();return}});a.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{iC(window.localStorage)}catch{}I1.createRoot(document.getElementById("root")).render(n.jsx(v.StrictMode,{children:n.jsx(h0,{children:n.jsx(aC,{})})}));export{n as j,v as r,J as s};
|