vskill 0.5.103 → 0.5.105

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.
Files changed (102) hide show
  1. package/README.md +147 -4
  2. package/agents.json +1 -1
  3. package/dist/agents/agents-registry.d.ts +13 -3
  4. package/dist/agents/agents-registry.js +100 -57
  5. package/dist/agents/agents-registry.js.map +1 -1
  6. package/dist/api/client.d.ts +21 -0
  7. package/dist/api/client.js +39 -5
  8. package/dist/api/client.js.map +1 -1
  9. package/dist/commands/diff.d.ts +6 -0
  10. package/dist/commands/diff.js +104 -0
  11. package/dist/commands/diff.js.map +1 -0
  12. package/dist/commands/eval/serve.js +29 -83
  13. package/dist/commands/eval/serve.js.map +1 -1
  14. package/dist/commands/keys.d.ts +14 -0
  15. package/dist/commands/keys.js +166 -0
  16. package/dist/commands/keys.js.map +1 -0
  17. package/dist/commands/masked-stdin.d.ts +14 -0
  18. package/dist/commands/masked-stdin.js +79 -0
  19. package/dist/commands/masked-stdin.js.map +1 -0
  20. package/dist/commands/skill.d.ts +6 -0
  21. package/dist/commands/skill.js +366 -0
  22. package/dist/commands/skill.js.map +1 -0
  23. package/dist/commands/update.js +15 -4
  24. package/dist/commands/update.js.map +1 -1
  25. package/dist/core/skill-emitter.d.ts +37 -0
  26. package/dist/core/skill-emitter.js +333 -0
  27. package/dist/core/skill-emitter.js.map +1 -0
  28. package/dist/core/skill-generator.d.ts +27 -0
  29. package/dist/core/skill-generator.js +100 -0
  30. package/dist/core/skill-generator.js.map +1 -0
  31. package/dist/eval/anthropic-catalog.d.ts +49 -0
  32. package/dist/eval/anthropic-catalog.js +238 -0
  33. package/dist/eval/anthropic-catalog.js.map +1 -0
  34. package/dist/eval/llm.d.ts +1 -1
  35. package/dist/eval/llm.js +68 -10
  36. package/dist/eval/llm.js.map +1 -1
  37. package/dist/eval/mcp-detector.js +24 -3
  38. package/dist/eval/mcp-detector.js.map +1 -1
  39. package/dist/eval/model-resolver.d.ts +39 -0
  40. package/dist/eval/model-resolver.js +94 -0
  41. package/dist/eval/model-resolver.js.map +1 -0
  42. package/dist/eval/pricing.js +42 -16
  43. package/dist/eval/pricing.js.map +1 -1
  44. package/dist/eval/skill-scanner.d.ts +0 -5
  45. package/dist/eval/skill-scanner.js +0 -12
  46. package/dist/eval/skill-scanner.js.map +1 -1
  47. package/dist/eval-server/api-routes.d.ts +1 -0
  48. package/dist/eval-server/api-routes.js +191 -63
  49. package/dist/eval-server/api-routes.js.map +1 -1
  50. package/dist/eval-server/authoring-routes.js +21 -1
  51. package/dist/eval-server/authoring-routes.js.map +1 -1
  52. package/dist/eval-server/boot-preflight.js +8 -10
  53. package/dist/eval-server/boot-preflight.js.map +1 -1
  54. package/dist/eval-server/darwin-migrator.d.ts +57 -0
  55. package/dist/eval-server/darwin-migrator.js +169 -0
  56. package/dist/eval-server/darwin-migrator.js.map +1 -0
  57. package/dist/eval-server/eval-server.d.ts +1 -0
  58. package/dist/eval-server/eval-server.js +10 -0
  59. package/dist/eval-server/eval-server.js.map +1 -1
  60. package/dist/eval-server/providers.d.ts +7 -12
  61. package/dist/eval-server/providers.js +13 -15
  62. package/dist/eval-server/providers.js.map +1 -1
  63. package/dist/eval-server/settings-store.d.ts +17 -19
  64. package/dist/eval-server/settings-store.js +192 -189
  65. package/dist/eval-server/settings-store.js.map +1 -1
  66. package/dist/eval-server/skill-create-routes.d.ts +62 -0
  67. package/dist/eval-server/skill-create-routes.js +97 -132
  68. package/dist/eval-server/skill-create-routes.js.map +1 -1
  69. package/dist/eval-ui/assets/{CommandPalette-6cLEufX0.js → CommandPalette-DAWyTgXL.js} +1 -1
  70. package/dist/eval-ui/assets/CreateSkillPage-D5xmvnzV.js +12 -0
  71. package/dist/eval-ui/assets/UpdateDropdown-6bfwsX0-.js +1 -0
  72. package/dist/eval-ui/assets/index-C_-YXE6O.js +102 -0
  73. package/dist/eval-ui/index.html +1 -1
  74. package/dist/first-run-onboarding.d.ts +19 -0
  75. package/dist/first-run-onboarding.js +104 -0
  76. package/dist/first-run-onboarding.js.map +1 -0
  77. package/dist/index.js +21 -0
  78. package/dist/index.js.map +1 -1
  79. package/dist/installer/canonical.d.ts +2 -0
  80. package/dist/installer/canonical.js +33 -3
  81. package/dist/installer/canonical.js.map +1 -1
  82. package/dist/studio/lib/ops-log.js +1 -4
  83. package/dist/studio/lib/ops-log.js.map +1 -1
  84. package/dist/studio/lib/scope-transfer.d.ts +0 -10
  85. package/dist/studio/lib/scope-transfer.js +13 -116
  86. package/dist/studio/lib/scope-transfer.js.map +1 -1
  87. package/dist/studio/routes/ops.js +3 -26
  88. package/dist/studio/routes/ops.js.map +1 -1
  89. package/dist/studio/routes/promote.js +15 -9
  90. package/dist/studio/routes/promote.js.map +1 -1
  91. package/dist/studio/routes/test-install.js +11 -4
  92. package/dist/studio/routes/test-install.js.map +1 -1
  93. package/dist/utils/agent-filter.js +5 -4
  94. package/dist/utils/agent-filter.js.map +1 -1
  95. package/dist/utils/resolve-binary.d.ts +22 -0
  96. package/dist/utils/resolve-binary.js +44 -1
  97. package/dist/utils/resolve-binary.js.map +1 -1
  98. package/package.json +3 -1
  99. package/scripts/preuninstall.cjs +2 -9
  100. package/dist/eval-ui/assets/CreateSkillPage-kn7xDaAP.js +0 -12
  101. package/dist/eval-ui/assets/UpdateDropdown-9qR5NxTi.js +0 -1
  102. package/dist/eval-ui/assets/index-4LdVR3Lo.js +0 -102
@@ -1,102 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpdateDropdown-9qR5NxTi.js","assets/fonts-i7Lkz2zN.css","assets/CommandPalette-6cLEufX0.js","assets/CreateSkillPage-kn7xDaAP.js"])))=>i.map(i=>d[i]);
2
- /* empty css */(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function s(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function o(c){if(c.ep)return;c.ep=!0;const f=s(c);fetch(c.href,f)}})();function Yg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var nd={exports:{}},Ss={};/**
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 bx;function Pb(){if(bx)return Ss;bx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function s(o,c,f){var d=null;if(f!==void 0&&(d=""+f),c.key!==void 0&&(d=""+c.key),"key"in c){f={};for(var h in c)h!=="key"&&(f[h]=c[h])}else f=c;return c=f.ref,{$$typeof:n,type:o,key:d,ref:c!==void 0?c:null,props:f}}return Ss.Fragment=l,Ss.jsx=s,Ss.jsxs=s,Ss}var Sx;function Vb(){return Sx||(Sx=1,nd.exports=Pb()),nd.exports}var a=Vb(),ad={exports:{}},Ie={};/**
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 jx;function Fb(){if(jx)return Ie;jx=1;var n=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=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"),v=Symbol.for("react.activity"),b=Symbol.iterator;function j(O){return O===null||typeof O!="object"?null:(O=b&&O[b]||O["@@iterator"],typeof O=="function"?O:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function w(O,Y,se){this.props=O,this.context=Y,this.refs=C,this.updater=se||k}w.prototype.isReactComponent={},w.prototype.setState=function(O,Y){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,Y,"setState")},w.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function A(){}A.prototype=w.prototype;function _(O,Y,se){this.props=O,this.context=Y,this.refs=C,this.updater=se||k}var H=_.prototype=new A;H.constructor=_,N(H,w.prototype),H.isPureReactComponent=!0;var L=Array.isArray;function $(){}var E={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function R(O,Y,se){var ue=se.ref;return{$$typeof:n,type:O,key:Y,ref:ue!==void 0?ue:null,props:se}}function B(O,Y){return R(O.type,Y,O.props)}function P(O){return typeof O=="object"&&O!==null&&O.$$typeof===n}function W(O){var Y={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(se){return Y[se]})}var te=/\/+/g;function Q(O,Y){return typeof O=="object"&&O!==null&&O.key!=null?W(""+O.key):Y.toString(36)}function z(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then($,$):(O.status="pending",O.then(function(Y){O.status==="pending"&&(O.status="fulfilled",O.value=Y)},function(Y){O.status==="pending"&&(O.status="rejected",O.reason=Y)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function M(O,Y,se,ue,ge){var xe=typeof O;(xe==="undefined"||xe==="boolean")&&(O=null);var we=!1;if(O===null)we=!0;else switch(xe){case"bigint":case"string":case"number":we=!0;break;case"object":switch(O.$$typeof){case n:case l:we=!0;break;case y:return we=O._init,M(we(O._payload),Y,se,ue,ge)}}if(we)return ge=ge(O),we=ue===""?"."+Q(O,0):ue,L(ge)?(se="",we!=null&&(se=we.replace(te,"$&/")+"/"),M(ge,Y,se,"",function(_e){return _e})):ge!=null&&(P(ge)&&(ge=B(ge,se+(ge.key==null||O&&O.key===ge.key?"":(""+ge.key).replace(te,"$&/")+"/")+we)),Y.push(ge)),1;we=0;var ie=ue===""?".":ue+":";if(L(O))for(var je=0;je<O.length;je++)ue=O[je],xe=ie+Q(ue,je),we+=M(ue,Y,se,xe,ge);else if(je=j(O),typeof je=="function")for(O=je.call(O),je=0;!(ue=O.next()).done;)ue=ue.value,xe=ie+Q(ue,je++),we+=M(ue,Y,se,xe,ge);else if(xe==="object"){if(typeof O.then=="function")return M(z(O),Y,se,ue,ge);throw Y=String(O),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.")}return we}function I(O,Y,se){if(O==null)return O;var ue=[],ge=0;return M(O,ue,"","",function(xe){return Y.call(se,xe,ge++)}),ue}function X(O){if(O._status===-1){var Y=O._result;Y=Y(),Y.then(function(se){(O._status===0||O._status===-1)&&(O._status=1,O._result=se)},function(se){(O._status===0||O._status===-1)&&(O._status=2,O._result=se)}),O._status===-1&&(O._status=0,O._result=Y)}if(O._status===1)return O._result.default;throw O._result}var G=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Y=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(Y))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},ce={map:I,forEach:function(O,Y,se){I(O,function(){Y.apply(this,arguments)},se)},count:function(O){var Y=0;return I(O,function(){Y++}),Y},toArray:function(O){return I(O,function(Y){return Y})||[]},only:function(O){if(!P(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ie.Activity=v,Ie.Children=ce,Ie.Component=w,Ie.Fragment=s,Ie.Profiler=c,Ie.PureComponent=_,Ie.StrictMode=o,Ie.Suspense=x,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(O){return E.H.useMemoCache(O)}},Ie.cache=function(O){return function(){return O.apply(null,arguments)}},Ie.cacheSignal=function(){return null},Ie.cloneElement=function(O,Y,se){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var ue=N({},O.props),ge=O.key;if(Y!=null)for(xe in Y.key!==void 0&&(ge=""+Y.key),Y)!D.call(Y,xe)||xe==="key"||xe==="__self"||xe==="__source"||xe==="ref"&&Y.ref===void 0||(ue[xe]=Y[xe]);var xe=arguments.length-2;if(xe===1)ue.children=se;else if(1<xe){for(var we=Array(xe),ie=0;ie<xe;ie++)we[ie]=arguments[ie+2];ue.children=we}return R(O.type,ge,ue)},Ie.createContext=function(O){return O={$$typeof:d,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:f,_context:O},O},Ie.createElement=function(O,Y,se){var ue,ge={},xe=null;if(Y!=null)for(ue in Y.key!==void 0&&(xe=""+Y.key),Y)D.call(Y,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(ge[ue]=Y[ue]);var we=arguments.length-2;if(we===1)ge.children=se;else if(1<we){for(var ie=Array(we),je=0;je<we;je++)ie[je]=arguments[je+2];ge.children=ie}if(O&&O.defaultProps)for(ue in we=O.defaultProps,we)ge[ue]===void 0&&(ge[ue]=we[ue]);return R(O,xe,ge)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(O){return{$$typeof:h,render:O}},Ie.isValidElement=P,Ie.lazy=function(O){return{$$typeof:y,_payload:{_status:-1,_result:O},_init:X}},Ie.memo=function(O,Y){return{$$typeof:p,type:O,compare:Y===void 0?null:Y}},Ie.startTransition=function(O){var Y=E.T,se={};E.T=se;try{var ue=O(),ge=E.S;ge!==null&&ge(se,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then($,G)}catch(xe){G(xe)}finally{Y!==null&&se.types!==null&&(Y.types=se.types),E.T=Y}},Ie.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},Ie.use=function(O){return E.H.use(O)},Ie.useActionState=function(O,Y,se){return E.H.useActionState(O,Y,se)},Ie.useCallback=function(O,Y){return E.H.useCallback(O,Y)},Ie.useContext=function(O){return E.H.useContext(O)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(O,Y){return E.H.useDeferredValue(O,Y)},Ie.useEffect=function(O,Y){return E.H.useEffect(O,Y)},Ie.useEffectEvent=function(O){return E.H.useEffectEvent(O)},Ie.useId=function(){return E.H.useId()},Ie.useImperativeHandle=function(O,Y,se){return E.H.useImperativeHandle(O,Y,se)},Ie.useInsertionEffect=function(O,Y){return E.H.useInsertionEffect(O,Y)},Ie.useLayoutEffect=function(O,Y){return E.H.useLayoutEffect(O,Y)},Ie.useMemo=function(O,Y){return E.H.useMemo(O,Y)},Ie.useOptimistic=function(O,Y){return E.H.useOptimistic(O,Y)},Ie.useReducer=function(O,Y,se){return E.H.useReducer(O,Y,se)},Ie.useRef=function(O){return E.H.useRef(O)},Ie.useState=function(O){return E.H.useState(O)},Ie.useSyncExternalStore=function(O,Y,se){return E.H.useSyncExternalStore(O,Y,se)},Ie.useTransition=function(){return E.H.useTransition()},Ie.version="19.2.4",Ie}var kx;function Zd(){return kx||(kx=1,ad.exports=Fb()),ad.exports}var g=Zd();const Ce=Yg(g);var rd={exports:{}},js={},ld={exports:{}},sd={};/**
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 wx;function Gb(){return wx||(wx=1,(function(n){function l(M,I){var X=M.length;M.push(I);e:for(;0<X;){var G=X-1>>>1,ce=M[G];if(0<c(ce,I))M[G]=I,M[X]=ce,X=G;else break e}}function s(M){return M.length===0?null:M[0]}function o(M){if(M.length===0)return null;var I=M[0],X=M.pop();if(X!==I){M[0]=X;e:for(var G=0,ce=M.length,O=ce>>>1;G<O;){var Y=2*(G+1)-1,se=M[Y],ue=Y+1,ge=M[ue];if(0>c(se,X))ue<ce&&0>c(ge,se)?(M[G]=ge,M[ue]=X,G=ue):(M[G]=se,M[Y]=X,G=Y);else if(ue<ce&&0>c(ge,X))M[G]=ge,M[ue]=X,G=ue;else break e}}return I}function c(M,I){var X=M.sortIndex-I.sortIndex;return X!==0?X:M.id-I.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var x=[],p=[],y=1,v=null,b=3,j=!1,k=!1,N=!1,C=!1,w=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function H(M){for(var I=s(p);I!==null;){if(I.callback===null)o(p);else if(I.startTime<=M)o(p),I.sortIndex=I.expirationTime,l(x,I);else break;I=s(p)}}function L(M){if(N=!1,H(M),!k)if(s(x)!==null)k=!0,$||($=!0,W());else{var I=s(p);I!==null&&z(L,I.startTime-M)}}var $=!1,E=-1,D=5,R=-1;function B(){return C?!0:!(n.unstable_now()-R<D)}function P(){if(C=!1,$){var M=n.unstable_now();R=M;var I=!0;try{e:{k=!1,N&&(N=!1,A(E),E=-1),j=!0;var X=b;try{t:{for(H(M),v=s(x);v!==null&&!(v.expirationTime>M&&B());){var G=v.callback;if(typeof G=="function"){v.callback=null,b=v.priorityLevel;var ce=G(v.expirationTime<=M);if(M=n.unstable_now(),typeof ce=="function"){v.callback=ce,H(M),I=!0;break t}v===s(x)&&o(x),H(M)}else o(x);v=s(x)}if(v!==null)I=!0;else{var O=s(p);O!==null&&z(L,O.startTime-M),I=!1}}break e}finally{v=null,b=X,j=!1}I=void 0}}finally{I?W():$=!1}}}var W;if(typeof _=="function")W=function(){_(P)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,Q=te.port2;te.port1.onmessage=P,W=function(){Q.postMessage(null)}}else W=function(){w(P,0)};function z(M,I){E=w(function(){M(n.unstable_now())},I)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(M){M.callback=null},n.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<M?Math.floor(1e3/M):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(M){switch(b){case 1:case 2:case 3:var I=3;break;default:I=b}var X=b;b=I;try{return M()}finally{b=X}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(M,I){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var X=b;b=M;try{return I()}finally{b=X}},n.unstable_scheduleCallback=function(M,I,X){var G=n.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?G+X:G):X=G,M){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=X+ce,M={id:y++,callback:I,priorityLevel:M,startTime:X,expirationTime:ce,sortIndex:-1},X>G?(M.sortIndex=X,l(p,M),s(x)===null&&M===s(p)&&(N?(A(E),E=-1):N=!0,z(L,X-G))):(M.sortIndex=ce,l(x,M),k||j||(k=!0,$||($=!0,W()))),M},n.unstable_shouldYield=B,n.unstable_wrapCallback=function(M){var I=b;return function(){var X=b;b=I;try{return M.apply(this,arguments)}finally{b=X}}}})(sd)),sd}var Cx;function Wb(){return Cx||(Cx=1,ld.exports=Gb()),ld.exports}var id={exports:{}},Qt={};/**
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 Ex;function qb(){if(Ex)return Qt;Ex=1;var n=Zd();function l(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 s(){}var o={d:{f:s,r:function(){throw Error(l(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(x,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:x,containerInfo:p,implementation:y}}var d=n.__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 Qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Qt.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(l(299));return f(x,p,null,y)},Qt.flushSync=function(x){var p=d.T,y=o.p;try{if(d.T=null,o.p=2,x)return x()}finally{d.T=p,o.p=y,o.d.f()}},Qt.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))},Qt.prefetchDNS=function(x){typeof x=="string"&&o.d.D(x)},Qt.preinit=function(x,p){if(typeof x=="string"&&p&&typeof p.as=="string"){var y=p.as,v=h(y,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,j=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?o.d.S(x,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:b,fetchPriority:j}):y==="script"&&o.d.X(x,{crossOrigin:v,integrity:b,fetchPriority:j,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Qt.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)},Qt.preload=function(x,p){if(typeof x=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=h(y,p.crossOrigin);o.d.L(x,y,{crossOrigin:v,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})}},Qt.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)},Qt.requestFormReset=function(x){o.d.r(x)},Qt.unstable_batchedUpdates=function(x,p){return x(p)},Qt.useFormState=function(x,p,y){return d.H.useFormState(x,p,y)},Qt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Qt.version="19.2.4",Qt}var Nx;function Kg(){if(Nx)return id.exports;Nx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),id.exports=qb(),id.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 Tx;function Yb(){if(Tx)return js;Tx=1;var n=Wb(),l=Zd(),s=Kg();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}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 c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function d(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(f(e)!==e)throw Error(o(188))}function p(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(o(188));return t!==e?null:e}for(var r=e,i=t;;){var u=r.return;if(u===null)break;var m=u.alternate;if(m===null){if(i=u.return,i!==null){r=i;continue}break}if(u.child===m.child){for(m=u.child;m;){if(m===r)return x(u),e;if(m===i)return x(u),t;m=m.sibling}throw Error(o(188))}if(r.return!==i.return)r=u,i=m;else{for(var S=!1,T=u.child;T;){if(T===r){S=!0,r=u,i=m;break}if(T===i){S=!0,i=u,r=m;break}T=T.sibling}if(!S){for(T=m.child;T;){if(T===r){S=!0,r=m,i=u;break}if(T===i){S=!0,i=m,r=u;break}T=T.sibling}if(!S)throw Error(o(189))}}if(r.alternate!==i)throw Error(o(190))}if(r.tag!==3)throw Error(o(188));return r.stateNode.current===r?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,b=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),_=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function W(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function Q(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case w:return"Profiler";case C:return"StrictMode";case L:return"Suspense";case $:return"SuspenseList";case R:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case _:return e.displayName||"Context";case A:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case E:return t=e.displayName||null,t!==null?t:Q(e.type)||"Memo";case D:t=e._payload,e=e._init;try{return Q(e(t))}catch{}}return null}var z=Array.isArray,M=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},G=[],ce=-1;function O(e){return{current:e}}function Y(e){0>ce||(e.current=G[ce],G[ce]=null,ce--)}function se(e,t){ce++,G[ce]=e.current,e.current=t}var ue=O(null),ge=O(null),xe=O(null),we=O(null);function ie(e,t){switch(se(xe,t),se(ge,e),se(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vh(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vh(t),e=Fh(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Y(ue),se(ue,e)}function je(){Y(ue),Y(ge),Y(xe)}function _e(e){e.memoizedState!==null&&se(we,e);var t=ue.current,r=Fh(t,e.type);t!==r&&(se(ge,e),se(ue,r))}function Ue(e){ge.current===e&&(Y(ue),Y(ge)),we.current===e&&(Y(we),gs._currentValue=X)}var ae,fe;function de(e){if(ae===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);ae=t&&t[1]||"",fe=-1<r.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+ae+e+fe}var he=!1;function ye(e,t){if(!e||he)return"";he=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(ee){var Z=ee}Reflect.construct(e,[],le)}else{try{le.call()}catch(ee){Z=ee}e.call(le.prototype)}}else{try{throw Error()}catch(ee){Z=ee}(le=e())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(ee){if(ee&&Z&&typeof ee.stack=="string")return[ee.stack,Z.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=i.DetermineComponentFrameRoot(),S=m[0],T=m[1];if(S&&T){var U=S.split(`
45
- `),K=T.split(`
46
- `);for(u=i=0;i<U.length&&!U[i].includes("DetermineComponentFrameRoot");)i++;for(;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;if(i===U.length||u===K.length)for(i=U.length-1,u=K.length-1;1<=i&&0<=u&&U[i]!==K[u];)u--;for(;1<=i&&0<=u;i--,u--)if(U[i]!==K[u]){if(i!==1||u!==1)do if(i--,u--,0>u||U[i]!==K[u]){var ne=`
47
- `+U[i].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=i&&0<=u);break}}}finally{he=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?de(r):""}function Oe(e,t){switch(e.tag){case 26:case 27:case 5:return de(e.type);case 16:return de("Lazy");case 13:return e.child!==t&&t!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return de("Activity");default:return""}}function Ae(e){try{var t="",r=null;do t+=Oe(e,r),r=e,e=e.return;while(e);return t}catch(i){return`
48
- Error generating stack: `+i.message+`
49
- `+i.stack}}var pe=Object.prototype.hasOwnProperty,ze=n.unstable_scheduleCallback,Be=n.unstable_cancelCallback,Ot=n.unstable_shouldYield,Ft=n.unstable_requestPaint,rt=n.unstable_now,jt=n.unstable_getCurrentPriorityLevel,ve=n.unstable_ImmediatePriority,At=n.unstable_UserBlockingPriority,De=n.unstable_NormalPriority,gt=n.unstable_LowPriority,Xt=n.unstable_IdlePriority,lt=n.log,rr=n.unstable_setDisableYieldValue,na=null,Et=null;function kt(e){if(typeof lt=="function"&&rr(e),Et&&typeof Et.setStrictMode=="function")try{Et.setStrictMode(na,e)}catch{}}var St=Math.clz32?Math.clz32:$n,Un=Math.log,lr=Math.LN2;function $n(e){return e>>>=0,e===0?32:31-(Un(e)/lr|0)|0}var Fe=256,$t=262144,aa=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 Al(e,t,r){var i=e.pendingLanes;if(i===0)return 0;var u=0,m=e.suspendedLanes,S=e.pingedLanes;e=e.warmLanes;var T=i&134217727;return T!==0?(i=T&~m,i!==0?u=Nt(i):(S&=T,S!==0?u=Nt(S):r||(r=T&~e,r!==0&&(u=Nt(r))))):(T=i&~m,T!==0?u=Nt(T):S!==0?u=Nt(S):r||(r=i&~e,r!==0&&(u=Nt(r)))),u===0?0:t!==0&&t!==u&&(t&m)===0&&(m=u&-u,r=t&-t,m>=r||m===32&&(r&4194048)!==0)?t:u}function En(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Vo(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 wf(){var e=aa;return aa<<=1,(aa&62914560)===0&&(aa=4194304),e}function Fo(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function Ml(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ay(e,t,r,i,u,m){var S=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var T=e.entanglements,U=e.expirationTimes,K=e.hiddenUpdates;for(r=S&~r;0<r;){var ne=31-St(r),le=1<<ne;T[ne]=0,U[ne]=-1;var Z=K[ne];if(Z!==null)for(K[ne]=null,ne=0;ne<Z.length;ne++){var ee=Z[ne];ee!==null&&(ee.lane&=-536870913)}r&=~le}i!==0&&Cf(e,i,0),m!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=m&~(S&~t))}function Cf(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-St(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|r&261930}function Ef(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-St(r),u=1<<i;u&t|e[i]&t&&(e[i]|=t),r&=~u}}function Nf(e,t){var r=t&-t;return r=(r&42)!==0?1:Go(r),(r&(e.suspendedLanes|t))!==0?0:r}function Go(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 Wo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Tf(){var e=I.p;return e!==0?e:(e=window.event,e===void 0?32:px(e.type))}function Rf(e,t){var r=I.p;try{return I.p=e,t()}finally{I.p=r}}var Ea=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Ea,sn="__reactProps$"+Ea,Ar="__reactContainer$"+Ea,qo="__reactEvents$"+Ea,My="__reactListeners$"+Ea,Ly="__reactHandles$"+Ea,Af="__reactResources$"+Ea,Ll="__reactMarker$"+Ea;function Yo(e){delete e[Gt],delete e[sn],delete e[qo],delete e[My],delete e[Ly]}function Mr(e){var t=e[Gt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Ar]||r[Gt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Qh(e);e!==null;){if(r=e[Gt])return r;e=Qh(e)}return t}e=r,r=e.parentNode}return null}function Lr(e){if(e=e[Gt]||e[Ar]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function zl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function zr(e){var t=e[Af];return t||(t=e[Af]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Pt(e){e[Ll]=!0}var Mf=new Set,Lf={};function sr(e,t){Dr(e,t),Dr(e+"Capture",t)}function Dr(e,t){for(Lf[e]=t,e=0;e<t.length;e++)Mf.add(t[e])}var zy=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]*$"),zf={},Df={};function Dy(e){return pe.call(Df,e)?!0:pe.call(zf,e)?!1:zy.test(e)?Df[e]=!0:(zf[e]=!0,!1)}function Ys(e,t,r){if(Dy(t))if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+r)}}function Ks(e,t,r){if(r===null)e.removeAttribute(t);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+r)}}function ra(e,t,r,i){if(i===null)e.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(t,r,""+i)}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function _f(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _y(e,t,r){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,m=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(S){r=""+S,m.call(this,S)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return r},setValue:function(S){r=""+S},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ko(e){if(!e._valueTracker){var t=_f(e)?"checked":"value";e._valueTracker=_y(e,t,""+e[t])}}function Of(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),i="";return e&&(i=_f(e)?e.checked?"true":"false":e.value),e=i,e!==r?(t.setValue(e),!0):!1}function Xs(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 Oy=/[\n"\\]/g;function Tn(e){return e.replace(Oy,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Xo(e,t,r,i,u,m,S,T){e.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.type=S:e.removeAttribute("type"),t!=null?S==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Nn(t)):e.value!==""+Nn(t)&&(e.value=""+Nn(t)):S!=="submit"&&S!=="reset"||e.removeAttribute("value"),t!=null?Qo(e,S,Nn(t)):r!=null?Qo(e,S,Nn(r)):i!=null&&e.removeAttribute("value"),u==null&&m!=null&&(e.defaultChecked=!!m),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?e.name=""+Nn(T):e.removeAttribute("name")}function Bf(e,t,r,i,u,m,S,T){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),t!=null||r!=null){if(!(m!=="submit"&&m!=="reset"||t!=null)){Ko(e);return}r=r!=null?""+Nn(r):"",t=t!=null?""+Nn(t):r,T||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=T?e.checked:!!i,e.defaultChecked=!!i,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(e.name=S),Ko(e)}function Qo(e,t,r){t==="number"&&Xs(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function _r(e,t,r,i){if(e=e.options,t){t={};for(var u=0;u<r.length;u++)t["$"+r[u]]=!0;for(r=0;r<e.length;r++)u=t.hasOwnProperty("$"+e[r].value),e[r].selected!==u&&(e[r].selected=u),u&&i&&(e[r].defaultSelected=!0)}else{for(r=""+Nn(r),t=null,u=0;u<e.length;u++){if(e[u].value===r){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function If(e,t,r){if(t!=null&&(t=""+Nn(t),t!==e.value&&(e.value=t),r==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=r!=null?""+Nn(r):""}function Hf(e,t,r,i){if(t==null){if(i!=null){if(r!=null)throw Error(o(92));if(z(i)){if(1<i.length)throw Error(o(93));i=i[0]}r=i}r==null&&(r=""),t=r}r=Nn(t),e.defaultValue=r,i=e.textContent,i===r&&i!==""&&i!==null&&(e.value=i),Ko(e)}function Or(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var By=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 Uf(e,t,r){var i=t.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,r):typeof r!="number"||r===0||By.has(t)?t==="float"?e.cssFloat=r:e[t]=(""+r).trim():e[t]=r+"px"}function $f(e,t,r){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,r!=null){for(var i in r)!r.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&r[u]!==i&&Uf(e,u,i)}else for(var m in t)t.hasOwnProperty(m)&&Uf(e,m,t[m])}function Zo(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 Iy=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"]]),Hy=/^[\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 Qs(e){return Hy.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function la(){}var Jo=null;function ec(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Br=null,Ir=null;function Pf(e){var t=Lr(e);if(t&&(e=t.stateNode)){var r=e[sn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Xo(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Tn(""+t)+'"][type="radio"]'),t=0;t<r.length;t++){var i=r[t];if(i!==e&&i.form===e.form){var u=i[sn]||null;if(!u)throw Error(o(90));Xo(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<r.length;t++)i=r[t],i.form===e.form&&Of(i)}break e;case"textarea":If(e,r.value,r.defaultValue);break e;case"select":t=r.value,t!=null&&_r(e,!!r.multiple,t,!1)}}}var tc=!1;function Vf(e,t,r){if(tc)return e(t,r);tc=!0;try{var i=e(t);return i}finally{if(tc=!1,(Br!==null||Ir!==null)&&(Ii(),Br&&(t=Br,e=Ir,Ir=Br=null,Pf(t),e)))for(t=0;t<e.length;t++)Pf(e[t])}}function Dl(e,t){var r=e.stateNode;if(r===null)return null;var i=r[sn]||null;if(i===null)return null;r=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(o(231,t,typeof r));return r}var sa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nc=!1;if(sa)try{var _l={};Object.defineProperty(_l,"passive",{get:function(){nc=!0}}),window.addEventListener("test",_l,_l),window.removeEventListener("test",_l,_l)}catch{nc=!1}var Na=null,ac=null,Zs=null;function Ff(){if(Zs)return Zs;var e,t=ac,r=t.length,i,u="value"in Na?Na.value:Na.textContent,m=u.length;for(e=0;e<r&&t[e]===u[e];e++);var S=r-e;for(i=1;i<=S&&t[r-i]===u[m-i];i++);return Zs=u.slice(e,1<i?1-i:void 0)}function Js(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 ei(){return!0}function Gf(){return!1}function on(e){function t(r,i,u,m,S){this._reactName=r,this._targetInst=u,this.type=i,this.nativeEvent=m,this.target=S,this.currentTarget=null;for(var T in e)e.hasOwnProperty(T)&&(r=e[T],this[T]=r?r(m):m[T]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ei:Gf,this.isPropagationStopped=Gf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=ei)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=ei)},persist:function(){},isPersistent:ei}),t}var ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ti=on(ir),Ol=v({},ir,{view:0,detail:0}),Uy=on(Ol),rc,lc,Bl,ni=v({},Ol,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ic,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!==Bl&&(Bl&&e.type==="mousemove"?(rc=e.screenX-Bl.screenX,lc=e.screenY-Bl.screenY):lc=rc=0,Bl=e),rc)},movementY:function(e){return"movementY"in e?e.movementY:lc}}),Wf=on(ni),$y=v({},ni,{dataTransfer:0}),Py=on($y),Vy=v({},Ol,{relatedTarget:0}),sc=on(Vy),Fy=v({},ir,{animationName:0,elapsedTime:0,pseudoElement:0}),Gy=on(Fy),Wy=v({},ir,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qy=on(Wy),Yy=v({},ir,{data:0}),qf=on(Yy),Ky={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Xy={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"},Qy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Zy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Qy[e])?!!t[e]:!1}function ic(){return Zy}var Jy=v({},Ol,{key:function(e){if(e.key){var t=Ky[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Js(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Xy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ic,charCode:function(e){return e.type==="keypress"?Js(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Js(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),e1=on(Jy),t1=v({},ni,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yf=on(t1),n1=v({},Ol,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ic}),a1=on(n1),r1=v({},ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),l1=on(r1),s1=v({},ni,{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}),i1=on(s1),o1=v({},ir,{newState:0,oldState:0}),c1=on(o1),u1=[9,13,27,32],oc=sa&&"CompositionEvent"in window,Il=null;sa&&"documentMode"in document&&(Il=document.documentMode);var d1=sa&&"TextEvent"in window&&!Il,Kf=sa&&(!oc||Il&&8<Il&&11>=Il),Xf=" ",Qf=!1;function Zf(e,t){switch(e){case"keyup":return u1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Jf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hr=!1;function f1(e,t){switch(e){case"compositionend":return Jf(t);case"keypress":return t.which!==32?null:(Qf=!0,Xf);case"textInput":return e=t.data,e===Xf&&Qf?null:e;default:return null}}function p1(e,t){if(Hr)return e==="compositionend"||!oc&&Zf(e,t)?(e=Ff(),Zs=ac=Na=null,Hr=!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 Kf&&t.locale!=="ko"?null:t.data;default:return null}}var m1={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 ep(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!m1[e.type]:t==="textarea"}function tp(e,t,r,i){Br?Ir?Ir.push(i):Ir=[i]:Br=i,t=Gi(t,"onChange"),0<t.length&&(r=new ti("onChange","change",null,r,i),e.push({event:r,listeners:t}))}var Hl=null,Ul=null;function h1(e){Bh(e,0)}function ai(e){var t=zl(e);if(Of(t))return e}function np(e,t){if(e==="change")return t}var ap=!1;if(sa){var cc;if(sa){var uc="oninput"in document;if(!uc){var rp=document.createElement("div");rp.setAttribute("oninput","return;"),uc=typeof rp.oninput=="function"}cc=uc}else cc=!1;ap=cc&&(!document.documentMode||9<document.documentMode)}function lp(){Hl&&(Hl.detachEvent("onpropertychange",sp),Ul=Hl=null)}function sp(e){if(e.propertyName==="value"&&ai(Ul)){var t=[];tp(t,Ul,e,ec(e)),Vf(h1,t)}}function x1(e,t,r){e==="focusin"?(lp(),Hl=t,Ul=r,Hl.attachEvent("onpropertychange",sp)):e==="focusout"&&lp()}function g1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ai(Ul)}function v1(e,t){if(e==="click")return ai(t)}function y1(e,t){if(e==="input"||e==="change")return ai(t)}function b1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var mn=typeof Object.is=="function"?Object.is:b1;function $l(e,t){if(mn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var u=r[i];if(!pe.call(t,u)||!mn(e[u],t[u]))return!1}return!0}function ip(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function op(e,t){var r=ip(e);e=0;for(var i;r;){if(r.nodeType===3){if(i=e+r.textContent.length,e<=t&&i>=t)return{node:r,offset:t-e};e=i}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=ip(r)}}function cp(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?cp(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function up(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xs(e.document);t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Xs(e.document)}return t}function dc(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 S1=sa&&"documentMode"in document&&11>=document.documentMode,Ur=null,fc=null,Pl=null,pc=!1;function dp(e,t,r){var i=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;pc||Ur==null||Ur!==Xs(i)||(i=Ur,"selectionStart"in i&&dc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Pl&&$l(Pl,i)||(Pl=i,i=Gi(fc,"onSelect"),0<i.length&&(t=new ti("onSelect","select",null,t,r),e.push({event:t,listeners:i}),t.target=Ur)))}function or(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var $r={animationend:or("Animation","AnimationEnd"),animationiteration:or("Animation","AnimationIteration"),animationstart:or("Animation","AnimationStart"),transitionrun:or("Transition","TransitionRun"),transitionstart:or("Transition","TransitionStart"),transitioncancel:or("Transition","TransitionCancel"),transitionend:or("Transition","TransitionEnd")},mc={},fp={};sa&&(fp=document.createElement("div").style,"AnimationEvent"in window||(delete $r.animationend.animation,delete $r.animationiteration.animation,delete $r.animationstart.animation),"TransitionEvent"in window||delete $r.transitionend.transition);function cr(e){if(mc[e])return mc[e];if(!$r[e])return e;var t=$r[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in fp)return mc[e]=t[r];return e}var pp=cr("animationend"),mp=cr("animationiteration"),hp=cr("animationstart"),j1=cr("transitionrun"),k1=cr("transitionstart"),w1=cr("transitioncancel"),xp=cr("transitionend"),gp=new Map,hc="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(" ");hc.push("scrollEnd");function Pn(e,t){gp.set(e,t),sr(t,[e])}var ri=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)},Rn=[],Pr=0,xc=0;function li(){for(var e=Pr,t=xc=Pr=0;t<e;){var r=Rn[t];Rn[t++]=null;var i=Rn[t];Rn[t++]=null;var u=Rn[t];Rn[t++]=null;var m=Rn[t];if(Rn[t++]=null,i!==null&&u!==null){var S=i.pending;S===null?u.next=u:(u.next=S.next,S.next=u),i.pending=u}m!==0&&vp(r,u,m)}}function si(e,t,r,i){Rn[Pr++]=e,Rn[Pr++]=t,Rn[Pr++]=r,Rn[Pr++]=i,xc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function gc(e,t,r,i){return si(e,t,r,i),ii(e)}function ur(e,t){return si(e,null,null,t),ii(e)}function vp(e,t,r){e.lanes|=r;var i=e.alternate;i!==null&&(i.lanes|=r);for(var u=!1,m=e.return;m!==null;)m.childLanes|=r,i=m.alternate,i!==null&&(i.childLanes|=r),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(u=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,u&&t!==null&&(u=31-St(r),e=m.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=r|536870912),m):null}function ii(e){if(50<us)throw us=0,Eu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vr={};function C1(e,t,r,i){this.tag=e,this.key=r,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=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hn(e,t,r,i){return new C1(e,t,r,i)}function vc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ia(e,t){var r=e.alternate;return r===null?(r=hn(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function yp(e,t){e.flags&=65011714;var r=e.alternate;return r===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=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,t=r.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function oi(e,t,r,i,u,m){var S=0;if(i=e,typeof e=="function")vc(e)&&(S=1);else if(typeof e=="string")S=Ab(e,r,ue.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case R:return e=hn(31,r,t,u),e.elementType=R,e.lanes=m,e;case N:return dr(r.children,u,m,t);case C:S=8,u|=24;break;case w:return e=hn(12,r,t,u|2),e.elementType=w,e.lanes=m,e;case L:return e=hn(13,r,t,u),e.elementType=L,e.lanes=m,e;case $:return e=hn(19,r,t,u),e.elementType=$,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case _:S=10;break e;case A:S=9;break e;case H:S=11;break e;case E:S=14;break e;case D:S=16,i=null;break e}S=29,r=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=hn(S,r,t,u),t.elementType=e,t.type=i,t.lanes=m,t}function dr(e,t,r,i){return e=hn(7,e,i,t),e.lanes=r,e}function yc(e,t,r){return e=hn(6,e,null,t),e.lanes=r,e}function bp(e){var t=hn(18,null,null,0);return t.stateNode=e,t}function bc(e,t,r){return t=hn(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Sp=new WeakMap;function An(e,t){if(typeof e=="object"&&e!==null){var r=Sp.get(e);return r!==void 0?r:(t={value:e,source:t,stack:Ae(t)},Sp.set(e,t),t)}return{value:e,source:t,stack:Ae(t)}}var Fr=[],Gr=0,ci=null,Vl=0,Mn=[],Ln=0,Ta=null,Yn=1,Kn="";function oa(e,t){Fr[Gr++]=Vl,Fr[Gr++]=ci,ci=e,Vl=t}function jp(e,t,r){Mn[Ln++]=Yn,Mn[Ln++]=Kn,Mn[Ln++]=Ta,Ta=e;var i=Yn;e=Kn;var u=32-St(i)-1;i&=~(1<<u),r+=1;var m=32-St(t)+u;if(30<m){var S=u-u%5;m=(i&(1<<S)-1).toString(32),i>>=S,u-=S,Yn=1<<32-St(t)+u|r<<u|i,Kn=m+e}else Yn=1<<m|r<<u|i,Kn=e}function Sc(e){e.return!==null&&(oa(e,1),jp(e,1,0))}function jc(e){for(;e===ci;)ci=Fr[--Gr],Fr[Gr]=null,Vl=Fr[--Gr],Fr[Gr]=null;for(;e===Ta;)Ta=Mn[--Ln],Mn[Ln]=null,Kn=Mn[--Ln],Mn[Ln]=null,Yn=Mn[--Ln],Mn[Ln]=null}function kp(e,t){Mn[Ln++]=Yn,Mn[Ln++]=Kn,Mn[Ln++]=Ta,Yn=t.id,Kn=t.overflow,Ta=e}var Wt=null,pt=null,Qe=!1,Ra=null,zn=!1,kc=Error(o(519));function Aa(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fl(An(t,e)),kc}function wp(e){var t=e.stateNode,r=e.type,i=e.memoizedProps;switch(t[Gt]=e,t[sn]=i,r){case"dialog":Ye("cancel",t),Ye("close",t);break;case"iframe":case"object":case"embed":Ye("load",t);break;case"video":case"audio":for(r=0;r<fs.length;r++)Ye(fs[r],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),Bf(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ye("invalid",t);break;case"textarea":Ye("invalid",t),Hf(t,i.value,i.defaultValue,i.children)}r=i.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||t.textContent===""+r||i.suppressHydrationWarning===!0||$h(t.textContent,r)?(i.popover!=null&&(Ye("beforetoggle",t),Ye("toggle",t)),i.onScroll!=null&&Ye("scroll",t),i.onScrollEnd!=null&&Ye("scrollend",t),i.onClick!=null&&(t.onclick=la),t=!0):t=!1,t||Aa(e,!0)}function Cp(e){for(Wt=e.return;Wt;)switch(Wt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Wt=Wt.return}}function Wr(e){if(e!==Wt)return!1;if(!Qe)return Cp(e),Qe=!0,!1;var t=e.tag,r;if((r=t!==3&&t!==27)&&((r=t===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||$u(e.type,e.memoizedProps)),r=!r),r&&pt&&Aa(e),Cp(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=Xh(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));pt=Xh(e)}else t===27?(t=pt,Fa(e.type)?(e=Wu,Wu=null,pt=e):pt=t):pt=Wt?_n(e.stateNode.nextSibling):null;return!0}function fr(){pt=Wt=null,Qe=!1}function wc(){var e=Ra;return e!==null&&(fn===null?fn=e:fn.push.apply(fn,e),Ra=null),e}function Fl(e){Ra===null?Ra=[e]:Ra.push(e)}var Cc=O(null),pr=null,ca=null;function Ma(e,t,r){se(Cc,t._currentValue),t._currentValue=r}function ua(e){e._currentValue=Cc.current,Y(Cc)}function Ec(e,t,r){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function Nc(e,t,r,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var m=u.dependencies;if(m!==null){var S=u.child;m=m.firstContext;e:for(;m!==null;){var T=m;m=u;for(var U=0;U<t.length;U++)if(T.context===t[U]){m.lanes|=r,T=m.alternate,T!==null&&(T.lanes|=r),Ec(m.return,r,e),i||(S=null);break e}m=T.next}}else if(u.tag===18){if(S=u.return,S===null)throw Error(o(341));S.lanes|=r,m=S.alternate,m!==null&&(m.lanes|=r),Ec(S,r,e),S=null}else S=u.child;if(S!==null)S.return=u;else for(S=u;S!==null;){if(S===e){S=null;break}if(u=S.sibling,u!==null){u.return=S.return,S=u;break}S=S.return}u=S}}function qr(e,t,r,i){e=null;for(var u=t,m=!1;u!==null;){if(!m){if((u.flags&524288)!==0)m=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var S=u.alternate;if(S===null)throw Error(o(387));if(S=S.memoizedProps,S!==null){var T=u.type;mn(u.pendingProps.value,S.value)||(e!==null?e.push(T):e=[T])}}else if(u===we.current){if(S=u.alternate,S===null)throw Error(o(387));S.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(gs):e=[gs])}u=u.return}e!==null&&Nc(t,e,r,i),t.flags|=262144}function ui(e){for(e=e.firstContext;e!==null;){if(!mn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function mr(e){pr=e,ca=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return Ep(pr,e)}function di(e,t){return pr===null&&mr(e),Ep(e,t)}function Ep(e,t){var r=t._currentValue;if(t={context:t,memoizedValue:r,next:null},ca===null){if(e===null)throw Error(o(308));ca=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ca=ca.next=t;return r}var E1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(r,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(r){return r()})}},N1=n.unstable_scheduleCallback,T1=n.unstable_NormalPriority,Mt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Tc(){return{controller:new E1,data:new Map,refCount:0}}function Gl(e){e.refCount--,e.refCount===0&&N1(T1,function(){e.controller.abort()})}var Wl=null,Rc=0,Yr=0,Kr=null;function R1(e,t){if(Wl===null){var r=Wl=[];Rc=0,Yr=Lu(),Kr={status:"pending",value:void 0,then:function(i){r.push(i)}}}return Rc++,t.then(Np,Np),t}function Np(){if(--Rc===0&&Wl!==null){Kr!==null&&(Kr.status="fulfilled");var e=Wl;Wl=null,Yr=0,Kr=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function A1(e,t){var r=[],i={status:"pending",value:null,reason:null,then:function(u){r.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<r.length;u++)(0,r[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<r.length;u++)(0,r[u])(void 0)}),i}var Tp=M.S;M.S=function(e,t){dh=rt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&R1(e,t),Tp!==null&&Tp(e,t)};var hr=O(null);function Ac(){var e=hr.current;return e!==null?e:ft.pooledCache}function fi(e,t){t===null?se(hr,hr.current):se(hr,t.pool)}function Rp(){var e=Ac();return e===null?null:{parent:Mt._currentValue,pool:e}}var Xr=Error(o(460)),Mc=Error(o(474)),pi=Error(o(542)),mi={then:function(){}};function Ap(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Mp(e,t,r){switch(r=e[r],r===void 0?e.push(t):r!==t&&(t.then(la,la),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,zp(e),e;default:if(typeof t.status=="string")t.then(la,la);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,zp(e),e}throw gr=t,Xr}}function xr(e){try{var t=e._init;return t(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(gr=r,Xr):r}}var gr=null;function Lp(){if(gr===null)throw Error(o(459));var e=gr;return gr=null,e}function zp(e){if(e===Xr||e===pi)throw Error(o(483))}var Qr=null,ql=0;function hi(e){var t=ql;return ql+=1,Qr===null&&(Qr=[]),Mp(Qr,e,t)}function Yl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function xi(e,t){throw t.$$typeof===b?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Dp(e){function t(F,V){if(e){var q=F.deletions;q===null?(F.deletions=[V],F.flags|=16):q.push(V)}}function r(F,V){if(!e)return null;for(;V!==null;)t(F,V),V=V.sibling;return null}function i(F){for(var V=new Map;F!==null;)F.key!==null?V.set(F.key,F):V.set(F.index,F),F=F.sibling;return V}function u(F,V){return F=ia(F,V),F.index=0,F.sibling=null,F}function m(F,V,q){return F.index=q,e?(q=F.alternate,q!==null?(q=q.index,q<V?(F.flags|=67108866,V):q):(F.flags|=67108866,V)):(F.flags|=1048576,V)}function S(F){return e&&F.alternate===null&&(F.flags|=67108866),F}function T(F,V,q,re){return V===null||V.tag!==6?(V=yc(q,F.mode,re),V.return=F,V):(V=u(V,q),V.return=F,V)}function U(F,V,q,re){var Te=q.type;return Te===N?ne(F,V,q.props.children,re,q.key):V!==null&&(V.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===D&&xr(Te)===V.type)?(V=u(V,q.props),Yl(V,q),V.return=F,V):(V=oi(q.type,q.key,q.props,null,F.mode,re),Yl(V,q),V.return=F,V)}function K(F,V,q,re){return V===null||V.tag!==4||V.stateNode.containerInfo!==q.containerInfo||V.stateNode.implementation!==q.implementation?(V=bc(q,F.mode,re),V.return=F,V):(V=u(V,q.children||[]),V.return=F,V)}function ne(F,V,q,re,Te){return V===null||V.tag!==7?(V=dr(q,F.mode,re,Te),V.return=F,V):(V=u(V,q),V.return=F,V)}function le(F,V,q){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=yc(""+V,F.mode,q),V.return=F,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case j:return q=oi(V.type,V.key,V.props,null,F.mode,q),Yl(q,V),q.return=F,q;case k:return V=bc(V,F.mode,q),V.return=F,V;case D:return V=xr(V),le(F,V,q)}if(z(V)||W(V))return V=dr(V,F.mode,q,null),V.return=F,V;if(typeof V.then=="function")return le(F,hi(V),q);if(V.$$typeof===_)return le(F,di(F,V),q);xi(F,V)}return null}function Z(F,V,q,re){var Te=V!==null?V.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return Te!==null?null:T(F,V,""+q,re);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case j:return q.key===Te?U(F,V,q,re):null;case k:return q.key===Te?K(F,V,q,re):null;case D:return q=xr(q),Z(F,V,q,re)}if(z(q)||W(q))return Te!==null?null:ne(F,V,q,re,null);if(typeof q.then=="function")return Z(F,V,hi(q),re);if(q.$$typeof===_)return Z(F,V,di(F,q),re);xi(F,q)}return null}function ee(F,V,q,re,Te){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return F=F.get(q)||null,T(V,F,""+re,Te);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case j:return F=F.get(re.key===null?q:re.key)||null,U(V,F,re,Te);case k:return F=F.get(re.key===null?q:re.key)||null,K(V,F,re,Te);case D:return re=xr(re),ee(F,V,q,re,Te)}if(z(re)||W(re))return F=F.get(q)||null,ne(V,F,re,Te,null);if(typeof re.then=="function")return ee(F,V,q,hi(re),Te);if(re.$$typeof===_)return ee(F,V,q,di(V,re),Te);xi(V,re)}return null}function Se(F,V,q,re){for(var Te=null,Je=null,ke=V,Pe=V=0,Xe=null;ke!==null&&Pe<q.length;Pe++){ke.index>Pe?(Xe=ke,ke=null):Xe=ke.sibling;var et=Z(F,ke,q[Pe],re);if(et===null){ke===null&&(ke=Xe);break}e&&ke&&et.alternate===null&&t(F,ke),V=m(et,V,Pe),Je===null?Te=et:Je.sibling=et,Je=et,ke=Xe}if(Pe===q.length)return r(F,ke),Qe&&oa(F,Pe),Te;if(ke===null){for(;Pe<q.length;Pe++)ke=le(F,q[Pe],re),ke!==null&&(V=m(ke,V,Pe),Je===null?Te=ke:Je.sibling=ke,Je=ke);return Qe&&oa(F,Pe),Te}for(ke=i(ke);Pe<q.length;Pe++)Xe=ee(ke,F,Pe,q[Pe],re),Xe!==null&&(e&&Xe.alternate!==null&&ke.delete(Xe.key===null?Pe:Xe.key),V=m(Xe,V,Pe),Je===null?Te=Xe:Je.sibling=Xe,Je=Xe);return e&&ke.forEach(function(Ka){return t(F,Ka)}),Qe&&oa(F,Pe),Te}function Re(F,V,q,re){if(q==null)throw Error(o(151));for(var Te=null,Je=null,ke=V,Pe=V=0,Xe=null,et=q.next();ke!==null&&!et.done;Pe++,et=q.next()){ke.index>Pe?(Xe=ke,ke=null):Xe=ke.sibling;var Ka=Z(F,ke,et.value,re);if(Ka===null){ke===null&&(ke=Xe);break}e&&ke&&Ka.alternate===null&&t(F,ke),V=m(Ka,V,Pe),Je===null?Te=Ka:Je.sibling=Ka,Je=Ka,ke=Xe}if(et.done)return r(F,ke),Qe&&oa(F,Pe),Te;if(ke===null){for(;!et.done;Pe++,et=q.next())et=le(F,et.value,re),et!==null&&(V=m(et,V,Pe),Je===null?Te=et:Je.sibling=et,Je=et);return Qe&&oa(F,Pe),Te}for(ke=i(ke);!et.done;Pe++,et=q.next())et=ee(ke,F,Pe,et.value,re),et!==null&&(e&&et.alternate!==null&&ke.delete(et.key===null?Pe:et.key),V=m(et,V,Pe),Je===null?Te=et:Je.sibling=et,Je=et);return e&&ke.forEach(function($b){return t(F,$b)}),Qe&&oa(F,Pe),Te}function ut(F,V,q,re){if(typeof q=="object"&&q!==null&&q.type===N&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case j:e:{for(var Te=q.key;V!==null;){if(V.key===Te){if(Te=q.type,Te===N){if(V.tag===7){r(F,V.sibling),re=u(V,q.props.children),re.return=F,F=re;break e}}else if(V.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===D&&xr(Te)===V.type){r(F,V.sibling),re=u(V,q.props),Yl(re,q),re.return=F,F=re;break e}r(F,V);break}else t(F,V);V=V.sibling}q.type===N?(re=dr(q.props.children,F.mode,re,q.key),re.return=F,F=re):(re=oi(q.type,q.key,q.props,null,F.mode,re),Yl(re,q),re.return=F,F=re)}return S(F);case k:e:{for(Te=q.key;V!==null;){if(V.key===Te)if(V.tag===4&&V.stateNode.containerInfo===q.containerInfo&&V.stateNode.implementation===q.implementation){r(F,V.sibling),re=u(V,q.children||[]),re.return=F,F=re;break e}else{r(F,V);break}else t(F,V);V=V.sibling}re=bc(q,F.mode,re),re.return=F,F=re}return S(F);case D:return q=xr(q),ut(F,V,q,re)}if(z(q))return Se(F,V,q,re);if(W(q)){if(Te=W(q),typeof Te!="function")throw Error(o(150));return q=Te.call(q),Re(F,V,q,re)}if(typeof q.then=="function")return ut(F,V,hi(q),re);if(q.$$typeof===_)return ut(F,V,di(F,q),re);xi(F,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,V!==null&&V.tag===6?(r(F,V.sibling),re=u(V,q),re.return=F,F=re):(r(F,V),re=yc(q,F.mode,re),re.return=F,F=re),S(F)):r(F,V)}return function(F,V,q,re){try{ql=0;var Te=ut(F,V,q,re);return Qr=null,Te}catch(ke){if(ke===Xr||ke===pi)throw ke;var Je=hn(29,ke,null,F.mode);return Je.lanes=re,Je.return=F,Je}finally{}}}var vr=Dp(!0),_p=Dp(!1),La=!1;function Lc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function zc(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 za(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Da(e,t,r){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(nt&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=ii(e),vp(e,null,r),t}return si(e,i,t,r),ii(e)}function Kl(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Ef(e,r)}}function Dc(e,t){var r=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,r===i)){var u=null,m=null;if(r=r.firstBaseUpdate,r!==null){do{var S={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};m===null?u=m=S:m=m.next=S,r=r.next}while(r!==null);m===null?u=m=t:m=m.next=t}else u=m=t;r={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:m,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}var _c=!1;function Xl(){if(_c){var e=Kr;if(e!==null)throw e}}function Ql(e,t,r,i){_c=!1;var u=e.updateQueue;La=!1;var m=u.firstBaseUpdate,S=u.lastBaseUpdate,T=u.shared.pending;if(T!==null){u.shared.pending=null;var U=T,K=U.next;U.next=null,S===null?m=K:S.next=K,S=U;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,T=ne.lastBaseUpdate,T!==S&&(T===null?ne.firstBaseUpdate=K:T.next=K,ne.lastBaseUpdate=U))}if(m!==null){var le=u.baseState;S=0,ne=K=U=null,T=m;do{var Z=T.lane&-536870913,ee=Z!==T.lane;if(ee?(Ke&Z)===Z:(i&Z)===Z){Z!==0&&Z===Yr&&(_c=!0),ne!==null&&(ne=ne.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Se=e,Re=T;Z=t;var ut=r;switch(Re.tag){case 1:if(Se=Re.payload,typeof Se=="function"){le=Se.call(ut,le,Z);break e}le=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Re.payload,Z=typeof Se=="function"?Se.call(ut,le,Z):Se,Z==null)break e;le=v({},le,Z);break e;case 2:La=!0}}Z=T.callback,Z!==null&&(e.flags|=64,ee&&(e.flags|=8192),ee=u.callbacks,ee===null?u.callbacks=[Z]:ee.push(Z))}else ee={lane:Z,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ne===null?(K=ne=ee,U=le):ne=ne.next=ee,S|=Z;if(T=T.next,T===null){if(T=u.shared.pending,T===null)break;ee=T,T=ee.next,ee.next=null,u.lastBaseUpdate=ee,u.shared.pending=null}}while(!0);ne===null&&(U=le),u.baseState=U,u.firstBaseUpdate=K,u.lastBaseUpdate=ne,m===null&&(u.shared.lanes=0),Ha|=S,e.lanes=S,e.memoizedState=le}}function Op(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Bp(e,t){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)Op(r[e],t)}var Zr=O(null),gi=O(0);function Ip(e,t){e=ya,se(gi,e),se(Zr,t),ya=e|t.baseLanes}function Oc(){se(gi,ya),se(Zr,Zr.current)}function Bc(){ya=gi.current,Y(Zr),Y(gi)}var xn=O(null),Dn=null;function _a(e){var t=e.alternate;se(Tt,Tt.current&1),se(xn,e),Dn===null&&(t===null||Zr.current!==null||t.memoizedState!==null)&&(Dn=e)}function Ic(e){se(Tt,Tt.current),se(xn,e),Dn===null&&(Dn=e)}function Hp(e){e.tag===22?(se(Tt,Tt.current),se(xn,e),Dn===null&&(Dn=e)):Oa()}function Oa(){se(Tt,Tt.current),se(xn,xn.current)}function gn(e){Y(xn),Dn===e&&(Dn=null),Y(Tt)}var Tt=O(0);function vi(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||Fu(r)||Gu(r)))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 da=0,$e=null,ot=null,Lt=null,yi=!1,Jr=!1,yr=!1,bi=0,Zl=0,el=null,M1=0;function wt(){throw Error(o(321))}function Hc(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!mn(e[r],t[r]))return!1;return!0}function Uc(e,t,r,i,u,m){return da=m,$e=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?jm:tu,yr=!1,m=r(i,u),yr=!1,Jr&&(m=$p(t,r,i,u)),Up(e),m}function Up(e){M.H=ts;var t=ot!==null&&ot.next!==null;if(da=0,Lt=ot=$e=null,yi=!1,Zl=0,el=null,t)throw Error(o(300));e===null||zt||(e=e.dependencies,e!==null&&ui(e)&&(zt=!0))}function $p(e,t,r,i){$e=e;var u=0;do{if(Jr&&(el=null),Zl=0,Jr=!1,25<=u)throw Error(o(301));if(u+=1,Lt=ot=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}M.H=km,m=t(r,i)}while(Jr);return m}function L1(){var e=M.H,t=e.useState()[0];return t=typeof t.then=="function"?Jl(t):t,e=e.useState()[0],(ot!==null?ot.memoizedState:null)!==e&&($e.flags|=1024),t}function $c(){var e=bi!==0;return bi=0,e}function Pc(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function Vc(e){if(yi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}yi=!1}da=0,Lt=ot=$e=null,Jr=!1,Zl=bi=0,el=null}function en(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?$e.memoizedState=Lt=e:Lt=Lt.next=e,Lt}function Rt(){if(ot===null){var e=$e.alternate;e=e!==null?e.memoizedState:null}else e=ot.next;var t=Lt===null?$e.memoizedState:Lt.next;if(t!==null)Lt=t,ot=e;else{if(e===null)throw $e.alternate===null?Error(o(467)):Error(o(310));ot=e,e={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},Lt===null?$e.memoizedState=Lt=e:Lt=Lt.next=e}return Lt}function Si(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jl(e){var t=Zl;return Zl+=1,el===null&&(el=[]),e=Mp(el,e,t),t=$e,(Lt===null?t.memoizedState:Lt.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?jm:tu),e}function ji(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Jl(e);if(e.$$typeof===_)return qt(e)}throw Error(o(438,String(e)))}function Fc(e){var t=null,r=$e.updateQueue;if(r!==null&&(t=r.memoCache),t==null){var i=$e.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),r===null&&(r=Si(),$e.updateQueue=r),r.memoCache=t,r=t.data[t.index],r===void 0)for(r=t.data[t.index]=Array(e),i=0;i<e;i++)r[i]=B;return t.index++,r}function fa(e,t){return typeof t=="function"?t(e):t}function ki(e){var t=Rt();return Gc(t,ot,e)}function Gc(e,t,r){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=r;var u=e.baseQueue,m=i.pending;if(m!==null){if(u!==null){var S=u.next;u.next=m.next,m.next=S}t.baseQueue=u=m,i.pending=null}if(m=e.baseState,u===null)e.memoizedState=m;else{t=u.next;var T=S=null,U=null,K=t,ne=!1;do{var le=K.lane&-536870913;if(le!==K.lane?(Ke&le)===le:(da&le)===le){var Z=K.revertLane;if(Z===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),le===Yr&&(ne=!0);else if((da&Z)===Z){K=K.next,Z===Yr&&(ne=!0);continue}else le={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},U===null?(T=U=le,S=m):U=U.next=le,$e.lanes|=Z,Ha|=Z;le=K.action,yr&&r(m,le),m=K.hasEagerState?K.eagerState:r(m,le)}else Z={lane:le,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},U===null?(T=U=Z,S=m):U=U.next=Z,$e.lanes|=le,Ha|=le;K=K.next}while(K!==null&&K!==t);if(U===null?S=m:U.next=T,!mn(m,e.memoizedState)&&(zt=!0,ne&&(r=Kr,r!==null)))throw r;e.memoizedState=m,e.baseState=S,e.baseQueue=U,i.lastRenderedState=m}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Wc(e){var t=Rt(),r=t.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=e;var i=r.dispatch,u=r.pending,m=t.memoizedState;if(u!==null){r.pending=null;var S=u=u.next;do m=e(m,S.action),S=S.next;while(S!==u);mn(m,t.memoizedState)||(zt=!0),t.memoizedState=m,t.baseQueue===null&&(t.baseState=m),r.lastRenderedState=m}return[m,i]}function Pp(e,t,r){var i=$e,u=Rt(),m=Qe;if(m){if(r===void 0)throw Error(o(407));r=r()}else r=t();var S=!mn((ot||u).memoizedState,r);if(S&&(u.memoizedState=r,zt=!0),u=u.queue,Kc(Gp.bind(null,i,u,e),[e]),u.getSnapshot!==t||S||Lt!==null&&Lt.memoizedState.tag&1){if(i.flags|=2048,tl(9,{destroy:void 0},Fp.bind(null,i,u,r,t),null),ft===null)throw Error(o(349));m||(da&127)!==0||Vp(i,t,r)}return r}function Vp(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=$e.updateQueue,t===null?(t=Si(),$e.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Fp(e,t,r,i){t.value=r,t.getSnapshot=i,Wp(t)&&qp(e)}function Gp(e,t,r){return r(function(){Wp(t)&&qp(e)})}function Wp(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!mn(e,r)}catch{return!0}}function qp(e){var t=ur(e,2);t!==null&&pn(t,e,2)}function qc(e){var t=en();if(typeof e=="function"){var r=e;if(e=r(),yr){kt(!0);try{r()}finally{kt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:e},t}function Yp(e,t,r,i){return e.baseState=r,Gc(e,ot,typeof i=="function"?i:fa)}function z1(e,t,r,i,u){if(Ei(e))throw Error(o(485));if(e=t.action,e!==null){var m={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){m.listeners.push(S)}};M.T!==null?r(!0):m.isTransition=!1,i(m),r=t.pending,r===null?(m.next=t.pending=m,Kp(t,m)):(m.next=r.next,t.pending=r.next=m)}}function Kp(e,t){var r=t.action,i=t.payload,u=e.state;if(t.isTransition){var m=M.T,S={};M.T=S;try{var T=r(u,i),U=M.S;U!==null&&U(S,T),Xp(e,t,T)}catch(K){Yc(e,t,K)}finally{m!==null&&S.types!==null&&(m.types=S.types),M.T=m}}else try{m=r(u,i),Xp(e,t,m)}catch(K){Yc(e,t,K)}}function Xp(e,t,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(i){Qp(e,t,i)},function(i){return Yc(e,t,i)}):Qp(e,t,r)}function Qp(e,t,r){t.status="fulfilled",t.value=r,Zp(t),e.state=r,t=e.pending,t!==null&&(r=t.next,r===t?e.pending=null:(r=r.next,t.next=r,Kp(e,r)))}function Yc(e,t,r){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=r,Zp(t),t=t.next;while(t!==i)}e.action=null}function Zp(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jp(e,t){return t}function em(e,t){if(Qe){var r=ft.formState;if(r!==null){e:{var i=$e;if(Qe){if(pt){t:{for(var u=pt,m=zn;u.nodeType!==8;){if(!m){u=null;break t}if(u=_n(u.nextSibling),u===null){u=null;break t}}m=u.data,u=m==="F!"||m==="F"?u:null}if(u){pt=_n(u.nextSibling),i=u.data==="F!";break e}}Aa(i)}i=!1}i&&(t=r[0])}}return r=en(),r.memoizedState=r.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jp,lastRenderedState:t},r.queue=i,r=ym.bind(null,$e,i),i.dispatch=r,i=qc(!1),m=eu.bind(null,$e,!1,i.queue),i=en(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,r=z1.bind(null,$e,u,m,r),u.dispatch=r,i.memoizedState=e,[t,r,!1]}function tm(e){var t=Rt();return nm(t,ot,e)}function nm(e,t,r){if(t=Gc(e,t,Jp)[0],e=ki(fa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=Jl(t)}catch(S){throw S===Xr?pi:S}else i=t;t=Rt();var u=t.queue,m=u.dispatch;return r!==t.memoizedState&&($e.flags|=2048,tl(9,{destroy:void 0},D1.bind(null,u,r),null)),[i,m,e]}function D1(e,t){e.action=t}function am(e){var t=Rt(),r=ot;if(r!==null)return nm(t,r,e);Rt(),t=t.memoizedState,r=Rt();var i=r.queue.dispatch;return r.memoizedState=e,[t,i,!1]}function tl(e,t,r,i){return e={tag:e,create:r,deps:i,inst:t,next:null},t=$e.updateQueue,t===null&&(t=Si(),$e.updateQueue=t),r=t.lastEffect,r===null?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e),e}function rm(){return Rt().memoizedState}function wi(e,t,r,i){var u=en();$e.flags|=e,u.memoizedState=tl(1|t,{destroy:void 0},r,i===void 0?null:i)}function Ci(e,t,r,i){var u=Rt();i=i===void 0?null:i;var m=u.memoizedState.inst;ot!==null&&i!==null&&Hc(i,ot.memoizedState.deps)?u.memoizedState=tl(t,m,r,i):($e.flags|=e,u.memoizedState=tl(1|t,m,r,i))}function lm(e,t){wi(8390656,8,e,t)}function Kc(e,t){Ci(2048,8,e,t)}function _1(e){$e.flags|=4;var t=$e.updateQueue;if(t===null)t=Si(),$e.updateQueue=t,t.events=[e];else{var r=t.events;r===null?t.events=[e]:r.push(e)}}function sm(e){var t=Rt().memoizedState;return _1({ref:t,nextImpl:e}),function(){if((nt&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function im(e,t){return Ci(4,2,e,t)}function om(e,t){return Ci(4,4,e,t)}function cm(e,t){if(typeof t=="function"){e=e();var r=t(e);return function(){typeof r=="function"?r():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function um(e,t,r){r=r!=null?r.concat([e]):null,Ci(4,4,cm.bind(null,t,e),r)}function Xc(){}function dm(e,t){var r=Rt();t=t===void 0?null:t;var i=r.memoizedState;return t!==null&&Hc(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function fm(e,t){var r=Rt();t=t===void 0?null:t;var i=r.memoizedState;if(t!==null&&Hc(t,i[1]))return i[0];if(i=e(),yr){kt(!0);try{e()}finally{kt(!1)}}return r.memoizedState=[i,t],i}function Qc(e,t,r){return r===void 0||(da&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=t:(e.memoizedState=r,e=ph(),$e.lanes|=e,Ha|=e,r)}function pm(e,t,r,i){return mn(r,t)?r:Zr.current!==null?(e=Qc(e,r,i),mn(e,t)||(zt=!0),e):(da&42)===0||(da&1073741824)!==0&&(Ke&261930)===0?(zt=!0,e.memoizedState=r):(e=ph(),$e.lanes|=e,Ha|=e,t)}function mm(e,t,r,i,u){var m=I.p;I.p=m!==0&&8>m?m:8;var S=M.T,T={};M.T=T,eu(e,!1,t,r);try{var U=u(),K=M.S;if(K!==null&&K(T,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var ne=A1(U,i);es(e,t,ne,bn(e))}else es(e,t,i,bn(e))}catch(le){es(e,t,{then:function(){},status:"rejected",reason:le},bn())}finally{I.p=m,S!==null&&T.types!==null&&(S.types=T.types),M.T=S}}function O1(){}function Zc(e,t,r,i){if(e.tag!==5)throw Error(o(476));var u=hm(e).queue;mm(e,u,t,X,r===null?O1:function(){return xm(e),r(i)})}function hm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:X},next:null};var r={};return t.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fa,lastRenderedState:r},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xm(e){var t=hm(e);t.next===null&&(t=e.alternate.memoizedState),es(e,t.next.queue,{},bn())}function Jc(){return qt(gs)}function gm(){return Rt().memoizedState}function vm(){return Rt().memoizedState}function B1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var r=bn();e=za(r);var i=Da(t,e,r);i!==null&&(pn(i,t,r),Kl(i,t,r)),t={cache:Tc()},e.payload=t;return}t=t.return}}function I1(e,t,r){var i=bn();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ei(e)?bm(t,r):(r=gc(e,t,r,i),r!==null&&(pn(r,e,i),Sm(r,t,i)))}function ym(e,t,r){var i=bn();es(e,t,r,i)}function es(e,t,r,i){var u={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(Ei(e))bm(t,u);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=t.lastRenderedReducer,m!==null))try{var S=t.lastRenderedState,T=m(S,r);if(u.hasEagerState=!0,u.eagerState=T,mn(T,S))return si(e,t,u,0),ft===null&&li(),!1}catch{}finally{}if(r=gc(e,t,u,i),r!==null)return pn(r,e,i),Sm(r,t,i),!0}return!1}function eu(e,t,r,i){if(i={lane:2,revertLane:Lu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ei(e)){if(t)throw Error(o(479))}else t=gc(e,r,i,2),t!==null&&pn(t,e,2)}function Ei(e){var t=e.alternate;return e===$e||t!==null&&t===$e}function bm(e,t){Jr=yi=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function Sm(e,t,r){if((r&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,Ef(e,r)}}var ts={readContext:qt,use:ji,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};ts.useEffectEvent=wt;var jm={readContext:qt,use:ji,useCallback:function(e,t){return en().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:lm,useImperativeHandle:function(e,t,r){r=r!=null?r.concat([e]):null,wi(4194308,4,cm.bind(null,t,e),r)},useLayoutEffect:function(e,t){return wi(4194308,4,e,t)},useInsertionEffect:function(e,t){wi(4,2,e,t)},useMemo:function(e,t){var r=en();t=t===void 0?null:t;var i=e();if(yr){kt(!0);try{e()}finally{kt(!1)}}return r.memoizedState=[i,t],i},useReducer:function(e,t,r){var i=en();if(r!==void 0){var u=r(t);if(yr){kt(!0);try{r(t)}finally{kt(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=I1.bind(null,$e,e),[i.memoizedState,e]},useRef:function(e){var t=en();return e={current:e},t.memoizedState=e},useState:function(e){e=qc(e);var t=e.queue,r=ym.bind(null,$e,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:Xc,useDeferredValue:function(e,t){var r=en();return Qc(r,e,t)},useTransition:function(){var e=qc(!1);return e=mm.bind(null,$e,e.queue,!0,!1),en().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var i=$e,u=en();if(Qe){if(r===void 0)throw Error(o(407));r=r()}else{if(r=t(),ft===null)throw Error(o(349));(Ke&127)!==0||Vp(i,t,r)}u.memoizedState=r;var m={value:r,getSnapshot:t};return u.queue=m,lm(Gp.bind(null,i,m,e),[e]),i.flags|=2048,tl(9,{destroy:void 0},Fp.bind(null,i,m,r,t),null),r},useId:function(){var e=en(),t=ft.identifierPrefix;if(Qe){var r=Kn,i=Yn;r=(i&~(1<<32-St(i)-1)).toString(32)+r,t="_"+t+"R_"+r,r=bi++,0<r&&(t+="H"+r.toString(32)),t+="_"}else r=M1++,t="_"+t+"r_"+r.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Jc,useFormState:em,useActionState:em,useOptimistic:function(e){var t=en();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=eu.bind(null,$e,!0,r),r.dispatch=t,[e,t]},useMemoCache:Fc,useCacheRefresh:function(){return en().memoizedState=B1.bind(null,$e)},useEffectEvent:function(e){var t=en(),r={impl:e};return t.memoizedState=r,function(){if((nt&2)!==0)throw Error(o(440));return r.impl.apply(void 0,arguments)}}},tu={readContext:qt,use:ji,useCallback:dm,useContext:qt,useEffect:Kc,useImperativeHandle:um,useInsertionEffect:im,useLayoutEffect:om,useMemo:fm,useReducer:ki,useRef:rm,useState:function(){return ki(fa)},useDebugValue:Xc,useDeferredValue:function(e,t){var r=Rt();return pm(r,ot.memoizedState,e,t)},useTransition:function(){var e=ki(fa)[0],t=Rt().memoizedState;return[typeof e=="boolean"?e:Jl(e),t]},useSyncExternalStore:Pp,useId:gm,useHostTransitionStatus:Jc,useFormState:tm,useActionState:tm,useOptimistic:function(e,t){var r=Rt();return Yp(r,ot,e,t)},useMemoCache:Fc,useCacheRefresh:vm};tu.useEffectEvent=sm;var km={readContext:qt,use:ji,useCallback:dm,useContext:qt,useEffect:Kc,useImperativeHandle:um,useInsertionEffect:im,useLayoutEffect:om,useMemo:fm,useReducer:Wc,useRef:rm,useState:function(){return Wc(fa)},useDebugValue:Xc,useDeferredValue:function(e,t){var r=Rt();return ot===null?Qc(r,e,t):pm(r,ot.memoizedState,e,t)},useTransition:function(){var e=Wc(fa)[0],t=Rt().memoizedState;return[typeof e=="boolean"?e:Jl(e),t]},useSyncExternalStore:Pp,useId:gm,useHostTransitionStatus:Jc,useFormState:am,useActionState:am,useOptimistic:function(e,t){var r=Rt();return ot!==null?Yp(r,ot,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:Fc,useCacheRefresh:vm};km.useEffectEvent=sm;function nu(e,t,r,i){t=e.memoizedState,r=r(i,t),r=r==null?t:v({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var au={enqueueSetState:function(e,t,r){e=e._reactInternals;var i=bn(),u=za(i);u.payload=t,r!=null&&(u.callback=r),t=Da(e,u,i),t!==null&&(pn(t,e,i),Kl(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=bn(),u=za(i);u.tag=1,u.payload=t,r!=null&&(u.callback=r),t=Da(e,u,i),t!==null&&(pn(t,e,i),Kl(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=bn(),i=za(r);i.tag=2,t!=null&&(i.callback=t),t=Da(e,i,r),t!==null&&(pn(t,e,r),Kl(t,e,r))}};function wm(e,t,r,i,u,m,S){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,m,S):t.prototype&&t.prototype.isPureReactComponent?!$l(r,i)||!$l(u,m):!0}function Cm(e,t,r,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&au.enqueueReplaceState(t,t.state,null)}function br(e,t){var r=t;if("ref"in t){r={};for(var i in t)i!=="ref"&&(r[i]=t[i])}if(e=e.defaultProps){r===t&&(r=v({},r));for(var u in e)r[u]===void 0&&(r[u]=e[u])}return r}function Em(e){ri(e)}function Nm(e){console.error(e)}function Tm(e){ri(e)}function Ni(e,t){try{var r=e.onUncaughtError;r(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Rm(e,t,r){try{var i=e.onCaughtError;i(r.value,{componentStack:r.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function ru(e,t,r){return r=za(r),r.tag=3,r.payload={element:null},r.callback=function(){Ni(e,t)},r}function Am(e){return e=za(e),e.tag=3,e}function Mm(e,t,r,i){var u=r.type.getDerivedStateFromError;if(typeof u=="function"){var m=i.value;e.payload=function(){return u(m)},e.callback=function(){Rm(t,r,i)}}var S=r.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(e.callback=function(){Rm(t,r,i),typeof u!="function"&&(Ua===null?Ua=new Set([this]):Ua.add(this));var T=i.stack;this.componentDidCatch(i.value,{componentStack:T!==null?T:""})})}function H1(e,t,r,i,u){if(r.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=r.alternate,t!==null&&qr(t,r,u,!0),r=xn.current,r!==null){switch(r.tag){case 31:case 13:return Dn===null?Hi():r.alternate===null&&Ct===0&&(Ct=3),r.flags&=-257,r.flags|=65536,r.lanes=u,i===mi?r.flags|=16384:(t=r.updateQueue,t===null?r.updateQueue=new Set([i]):t.add(i),Ru(e,i,u)),!1;case 22:return r.flags|=65536,i===mi?r.flags|=16384:(t=r.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},r.updateQueue=t):(r=t.retryQueue,r===null?t.retryQueue=new Set([i]):r.add(i)),Ru(e,i,u)),!1}throw Error(o(435,r.tag))}return Ru(e,i,u),Hi(),!1}if(Qe)return t=xn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==kc&&(e=Error(o(422),{cause:i}),Fl(An(e,r)))):(i!==kc&&(t=Error(o(423),{cause:i}),Fl(An(t,r))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=An(i,r),u=ru(e.stateNode,i,u),Dc(e,u),Ct!==4&&(Ct=2)),!1;var m=Error(o(520),{cause:i});if(m=An(m,r),cs===null?cs=[m]:cs.push(m),Ct!==4&&(Ct=2),t===null)return!0;i=An(i,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=u&-u,r.lanes|=e,e=ru(r.stateNode,i,e),Dc(r,e),!1;case 1:if(t=r.type,m=r.stateNode,(r.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Ua===null||!Ua.has(m))))return r.flags|=65536,u&=-u,r.lanes|=u,u=Am(u),Mm(u,e,r,i),Dc(r,u),!1}r=r.return}while(r!==null);return!1}var lu=Error(o(461)),zt=!1;function Yt(e,t,r,i){t.child=e===null?_p(t,null,r,i):vr(t,e.child,r,i)}function Lm(e,t,r,i,u){r=r.render;var m=t.ref;if("ref"in i){var S={};for(var T in i)T!=="ref"&&(S[T]=i[T])}else S=i;return mr(t),i=Uc(e,t,r,S,m,u),T=$c(),e!==null&&!zt?(Pc(e,t,u),pa(e,t,u)):(Qe&&T&&Sc(t),t.flags|=1,Yt(e,t,i,u),t.child)}function zm(e,t,r,i,u){if(e===null){var m=r.type;return typeof m=="function"&&!vc(m)&&m.defaultProps===void 0&&r.compare===null?(t.tag=15,t.type=m,Dm(e,t,m,i,u)):(e=oi(r.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(m=e.child,!pu(e,u)){var S=m.memoizedProps;if(r=r.compare,r=r!==null?r:$l,r(S,i)&&e.ref===t.ref)return pa(e,t,u)}return t.flags|=1,e=ia(m,i),e.ref=t.ref,e.return=t,t.child=e}function Dm(e,t,r,i,u){if(e!==null){var m=e.memoizedProps;if($l(m,i)&&e.ref===t.ref)if(zt=!1,t.pendingProps=i=m,pu(e,u))(e.flags&131072)!==0&&(zt=!0);else return t.lanes=e.lanes,pa(e,t,u)}return su(e,t,r,i,u)}function _m(e,t,r,i){var u=i.children,m=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(m=m!==null?m.baseLanes|r:r,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~m}else i=0,t.child=null;return Om(e,t,m,r,i)}if((r&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fi(t,m!==null?m.cachePool:null),m!==null?Ip(t,m):Oc(),Hp(t);else return i=t.lanes=536870912,Om(e,t,m!==null?m.baseLanes|r:r,r,i)}else m!==null?(fi(t,m.cachePool),Ip(t,m),Oa(),t.memoizedState=null):(e!==null&&fi(t,null),Oc(),Oa());return Yt(e,t,u,r),t.child}function ns(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Om(e,t,r,i,u){var m=Ac();return m=m===null?null:{parent:Mt._currentValue,pool:m},t.memoizedState={baseLanes:r,cachePool:m},e!==null&&fi(t,null),Oc(),Hp(t),e!==null&&qr(e,t,i,!0),t.childLanes=u,null}function Ti(e,t){return t=Ai({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Bm(e,t,r){return vr(t,e.child,null,r),e=Ti(t,t.pendingProps),e.flags|=2,gn(t),t.memoizedState=null,e}function U1(e,t,r){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Qe){if(i.mode==="hidden")return e=Ti(t,i),t.lanes=536870912,ns(null,e);if(Ic(t),(e=pt)?(e=Kh(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ta!==null?{id:Yn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},r=bp(e),r.return=t,t.child=r,Wt=t,pt=null)):e=null,e===null)throw Aa(t);return t.lanes=536870912,null}return Ti(t,i)}var m=e.memoizedState;if(m!==null){var S=m.dehydrated;if(Ic(t),u)if(t.flags&256)t.flags&=-257,t=Bm(e,t,r);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(zt||qr(e,t,r,!1),u=(r&e.childLanes)!==0,zt||u){if(i=ft,i!==null&&(S=Nf(i,r),S!==0&&S!==m.retryLane))throw m.retryLane=S,ur(e,S),pn(i,e,S),lu;Hi(),t=Bm(e,t,r)}else e=m.treeContext,pt=_n(S.nextSibling),Wt=t,Qe=!0,Ra=null,zn=!1,e!==null&&kp(t,e),t=Ti(t,i),t.flags|=4096;return t}return e=ia(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ri(e,t){var r=t.ref;if(r===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(o(284));(e===null||e.ref!==r)&&(t.flags|=4194816)}}function su(e,t,r,i,u){return mr(t),r=Uc(e,t,r,i,void 0,u),i=$c(),e!==null&&!zt?(Pc(e,t,u),pa(e,t,u)):(Qe&&i&&Sc(t),t.flags|=1,Yt(e,t,r,u),t.child)}function Im(e,t,r,i,u,m){return mr(t),t.updateQueue=null,r=$p(t,i,r,u),Up(e),i=$c(),e!==null&&!zt?(Pc(e,t,m),pa(e,t,m)):(Qe&&i&&Sc(t),t.flags|=1,Yt(e,t,r,m),t.child)}function Hm(e,t,r,i,u){if(mr(t),t.stateNode===null){var m=Vr,S=r.contextType;typeof S=="object"&&S!==null&&(m=qt(S)),m=new r(i,m),t.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=au,t.stateNode=m,m._reactInternals=t,m=t.stateNode,m.props=i,m.state=t.memoizedState,m.refs={},Lc(t),S=r.contextType,m.context=typeof S=="object"&&S!==null?qt(S):Vr,m.state=t.memoizedState,S=r.getDerivedStateFromProps,typeof S=="function"&&(nu(t,r,S,i),m.state=t.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(S=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),S!==m.state&&au.enqueueReplaceState(m,m.state,null),Ql(t,i,m,u),Xl(),m.state=t.memoizedState),typeof m.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){m=t.stateNode;var T=t.memoizedProps,U=br(r,T);m.props=U;var K=m.context,ne=r.contextType;S=Vr,typeof ne=="object"&&ne!==null&&(S=qt(ne));var le=r.getDerivedStateFromProps;ne=typeof le=="function"||typeof m.getSnapshotBeforeUpdate=="function",T=t.pendingProps!==T,ne||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(T||K!==S)&&Cm(t,m,i,S),La=!1;var Z=t.memoizedState;m.state=Z,Ql(t,i,m,u),Xl(),K=t.memoizedState,T||Z!==K||La?(typeof le=="function"&&(nu(t,r,le,i),K=t.memoizedState),(U=La||wm(t,r,U,i,Z,K,S))?(ne||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(t.flags|=4194308)):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=K),m.props=i,m.state=K,m.context=S,i=U):(typeof m.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{m=t.stateNode,zc(e,t),S=t.memoizedProps,ne=br(r,S),m.props=ne,le=t.pendingProps,Z=m.context,K=r.contextType,U=Vr,typeof K=="object"&&K!==null&&(U=qt(K)),T=r.getDerivedStateFromProps,(K=typeof T=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(S!==le||Z!==U)&&Cm(t,m,i,U),La=!1,Z=t.memoizedState,m.state=Z,Ql(t,i,m,u),Xl();var ee=t.memoizedState;S!==le||Z!==ee||La||e!==null&&e.dependencies!==null&&ui(e.dependencies)?(typeof T=="function"&&(nu(t,r,T,i),ee=t.memoizedState),(ne=La||wm(t,r,ne,i,Z,ee,U)||e!==null&&e.dependencies!==null&&ui(e.dependencies))?(K||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(i,ee,U),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(i,ee,U)),typeof m.componentDidUpdate=="function"&&(t.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof m.componentDidUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=ee),m.props=i,m.state=ee,m.context=U,i=ne):(typeof m.componentDidUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&Z===e.memoizedState||(t.flags|=1024),i=!1)}return m=i,Ri(e,t),i=(t.flags&128)!==0,m||i?(m=t.stateNode,r=i&&typeof r.getDerivedStateFromError!="function"?null:m.render(),t.flags|=1,e!==null&&i?(t.child=vr(t,e.child,null,u),t.child=vr(t,null,r,u)):Yt(e,t,r,u),t.memoizedState=m.state,e=t.child):e=pa(e,t,u),e}function Um(e,t,r,i){return fr(),t.flags|=256,Yt(e,t,r,i),t.child}var iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ou(e){return{baseLanes:e,cachePool:Rp()}}function cu(e,t,r){return e=e!==null?e.childLanes&~r:0,t&&(e|=yn),e}function $m(e,t,r){var i=t.pendingProps,u=!1,m=(t.flags&128)!==0,S;if((S=m)||(S=e!==null&&e.memoizedState===null?!1:(Tt.current&2)!==0),S&&(u=!0,t.flags&=-129),S=(t.flags&32)!==0,t.flags&=-33,e===null){if(Qe){if(u?_a(t):Oa(),(e=pt)?(e=Kh(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ta!==null?{id:Yn,overflow:Kn}:null,retryLane:536870912,hydrationErrors:null},r=bp(e),r.return=t,t.child=r,Wt=t,pt=null)):e=null,e===null)throw Aa(t);return Gu(e)?t.lanes=32:t.lanes=536870912,null}var T=i.children;return i=i.fallback,u?(Oa(),u=t.mode,T=Ai({mode:"hidden",children:T},u),i=dr(i,u,r,null),T.return=t,i.return=t,T.sibling=i,t.child=T,i=t.child,i.memoizedState=ou(r),i.childLanes=cu(e,S,r),t.memoizedState=iu,ns(null,i)):(_a(t),uu(t,T))}var U=e.memoizedState;if(U!==null&&(T=U.dehydrated,T!==null)){if(m)t.flags&256?(_a(t),t.flags&=-257,t=du(e,t,r)):t.memoizedState!==null?(Oa(),t.child=e.child,t.flags|=128,t=null):(Oa(),T=i.fallback,u=t.mode,i=Ai({mode:"visible",children:i.children},u),T=dr(T,u,r,null),T.flags|=2,i.return=t,T.return=t,i.sibling=T,t.child=i,vr(t,e.child,null,r),i=t.child,i.memoizedState=ou(r),i.childLanes=cu(e,S,r),t.memoizedState=iu,t=ns(null,i));else if(_a(t),Gu(T)){if(S=T.nextSibling&&T.nextSibling.dataset,S)var K=S.dgst;S=K,i=Error(o(419)),i.stack="",i.digest=S,Fl({value:i,source:null,stack:null}),t=du(e,t,r)}else if(zt||qr(e,t,r,!1),S=(r&e.childLanes)!==0,zt||S){if(S=ft,S!==null&&(i=Nf(S,r),i!==0&&i!==U.retryLane))throw U.retryLane=i,ur(e,i),pn(S,e,i),lu;Fu(T)||Hi(),t=du(e,t,r)}else Fu(T)?(t.flags|=192,t.child=e.child,t=null):(e=U.treeContext,pt=_n(T.nextSibling),Wt=t,Qe=!0,Ra=null,zn=!1,e!==null&&kp(t,e),t=uu(t,i.children),t.flags|=4096);return t}return u?(Oa(),T=i.fallback,u=t.mode,U=e.child,K=U.sibling,i=ia(U,{mode:"hidden",children:i.children}),i.subtreeFlags=U.subtreeFlags&65011712,K!==null?T=ia(K,T):(T=dr(T,u,r,null),T.flags|=2),T.return=t,i.return=t,i.sibling=T,t.child=i,ns(null,i),i=t.child,T=e.child.memoizedState,T===null?T=ou(r):(u=T.cachePool,u!==null?(U=Mt._currentValue,u=u.parent!==U?{parent:U,pool:U}:u):u=Rp(),T={baseLanes:T.baseLanes|r,cachePool:u}),i.memoizedState=T,i.childLanes=cu(e,S,r),t.memoizedState=iu,ns(e.child,i)):(_a(t),r=e.child,e=r.sibling,r=ia(r,{mode:"visible",children:i.children}),r.return=t,r.sibling=null,e!==null&&(S=t.deletions,S===null?(t.deletions=[e],t.flags|=16):S.push(e)),t.child=r,t.memoizedState=null,r)}function uu(e,t){return t=Ai({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ai(e,t){return e=hn(22,e,null,t),e.lanes=0,e}function du(e,t,r){return vr(t,e.child,null,r),e=uu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Pm(e,t,r){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ec(e.return,t,r)}function fu(e,t,r,i,u,m){var S=e.memoizedState;S===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:u,treeForkCount:m}:(S.isBackwards=t,S.rendering=null,S.renderingStartTime=0,S.last=i,S.tail=r,S.tailMode=u,S.treeForkCount=m)}function Vm(e,t,r){var i=t.pendingProps,u=i.revealOrder,m=i.tail;i=i.children;var S=Tt.current,T=(S&2)!==0;if(T?(S=S&1|2,t.flags|=128):S&=1,se(Tt,S),Yt(e,t,i,r),i=Qe?Vl:0,!T&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Pm(e,r,t);else if(e.tag===19)Pm(e,r,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(u){case"forwards":for(r=t.child,u=null;r!==null;)e=r.alternate,e!==null&&vi(e)===null&&(u=r),r=r.sibling;r=u,r===null?(u=t.child,t.child=null):(u=r.sibling,r.sibling=null),fu(t,!1,u,r,m,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&vi(e)===null){t.child=u;break}e=u.sibling,u.sibling=r,r=u,u=e}fu(t,!0,r,null,m,i);break;case"together":fu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function pa(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),Ha|=t.lanes,(r&t.childLanes)===0)if(e!==null){if(qr(e,t,r,!1),(r&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,r=ia(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=ia(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function pu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&ui(e)))}function $1(e,t,r){switch(t.tag){case 3:ie(t,t.stateNode.containerInfo),Ma(t,Mt,e.memoizedState.cache),fr();break;case 27:case 5:_e(t);break;case 4:ie(t,t.stateNode.containerInfo);break;case 10:Ma(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ic(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(_a(t),t.flags|=128,null):(r&t.child.childLanes)!==0?$m(e,t,r):(_a(t),e=pa(e,t,r),e!==null?e.sibling:null);_a(t);break;case 19:var u=(e.flags&128)!==0;if(i=(r&t.childLanes)!==0,i||(qr(e,t,r,!1),i=(r&t.childLanes)!==0),u){if(i)return Vm(e,t,r);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),se(Tt,Tt.current),i)break;return null;case 22:return t.lanes=0,_m(e,t,r,t.pendingProps);case 24:Ma(t,Mt,e.memoizedState.cache)}return pa(e,t,r)}function Fm(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps)zt=!0;else{if(!pu(e,r)&&(t.flags&128)===0)return zt=!1,$1(e,t,r);zt=(e.flags&131072)!==0}else zt=!1,Qe&&(t.flags&1048576)!==0&&jp(t,Vl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=xr(t.elementType),t.type=e,typeof e=="function")vc(e)?(i=br(e,i),t.tag=1,t=Hm(null,t,e,i,r)):(t.tag=0,t=su(null,t,e,i,r));else{if(e!=null){var u=e.$$typeof;if(u===H){t.tag=11,t=Lm(null,t,e,i,r);break e}else if(u===E){t.tag=14,t=zm(null,t,e,i,r);break e}}throw t=Q(e)||e,Error(o(306,t,""))}}return t;case 0:return su(e,t,t.type,t.pendingProps,r);case 1:return i=t.type,u=br(i,t.pendingProps),Hm(e,t,i,u,r);case 3:e:{if(ie(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var m=t.memoizedState;u=m.element,zc(e,t),Ql(t,i,null,r);var S=t.memoizedState;if(i=S.cache,Ma(t,Mt,i),i!==m.cache&&Nc(t,[Mt],r,!0),Xl(),i=S.element,m.isDehydrated)if(m={element:i,isDehydrated:!1,cache:S.cache},t.updateQueue.baseState=m,t.memoizedState=m,t.flags&256){t=Um(e,t,i,r);break e}else if(i!==u){u=An(Error(o(424)),t),Fl(u),t=Um(e,t,i,r);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(pt=_n(e.firstChild),Wt=t,Qe=!0,Ra=null,zn=!0,r=_p(t,null,i,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling}else{if(fr(),i===u){t=pa(e,t,r);break e}Yt(e,t,i,r)}t=t.child}return t;case 26:return Ri(e,t),e===null?(r=tx(t.type,null,t.pendingProps,null))?t.memoizedState=r:Qe||(r=t.type,e=t.pendingProps,i=Wi(xe.current).createElement(r),i[Gt]=t,i[sn]=e,Kt(i,r,e),Pt(i),t.stateNode=i):t.memoizedState=tx(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _e(t),e===null&&Qe&&(i=t.stateNode=Zh(t.type,t.pendingProps,xe.current),Wt=t,zn=!0,u=pt,Fa(t.type)?(Wu=u,pt=_n(i.firstChild)):pt=u),Yt(e,t,t.pendingProps.children,r),Ri(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Qe&&((u=i=pt)&&(i=gb(i,t.type,t.pendingProps,zn),i!==null?(t.stateNode=i,Wt=t,pt=_n(i.firstChild),zn=!1,u=!0):u=!1),u||Aa(t)),_e(t),u=t.type,m=t.pendingProps,S=e!==null?e.memoizedProps:null,i=m.children,$u(u,m)?i=null:S!==null&&$u(u,S)&&(t.flags|=32),t.memoizedState!==null&&(u=Uc(e,t,L1,null,null,r),gs._currentValue=u),Ri(e,t),Yt(e,t,i,r),t.child;case 6:return e===null&&Qe&&((e=r=pt)&&(r=vb(r,t.pendingProps,zn),r!==null?(t.stateNode=r,Wt=t,pt=null,e=!0):e=!1),e||Aa(t)),null;case 13:return $m(e,t,r);case 4:return ie(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=vr(t,null,i,r):Yt(e,t,i,r),t.child;case 11:return Lm(e,t,t.type,t.pendingProps,r);case 7:return Yt(e,t,t.pendingProps,r),t.child;case 8:return Yt(e,t,t.pendingProps.children,r),t.child;case 12:return Yt(e,t,t.pendingProps.children,r),t.child;case 10:return i=t.pendingProps,Ma(t,t.type,i.value),Yt(e,t,i.children,r),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,mr(t),u=qt(u),i=i(u),t.flags|=1,Yt(e,t,i,r),t.child;case 14:return zm(e,t,t.type,t.pendingProps,r);case 15:return Dm(e,t,t.type,t.pendingProps,r);case 19:return Vm(e,t,r);case 31:return U1(e,t,r);case 22:return _m(e,t,r,t.pendingProps);case 24:return mr(t),i=qt(Mt),e===null?(u=Ac(),u===null&&(u=ft,m=Tc(),u.pooledCache=m,m.refCount++,m!==null&&(u.pooledCacheLanes|=r),u=m),t.memoizedState={parent:i,cache:u},Lc(t),Ma(t,Mt,u)):((e.lanes&r)!==0&&(zc(e,t),Ql(t,null,null,r),Xl()),u=e.memoizedState,m=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Ma(t,Mt,i)):(i=m.cache,Ma(t,Mt,i),i!==u.cache&&Nc(t,[Mt],r,!0))),Yt(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function ma(e){e.flags|=4}function mu(e,t,r,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(gh())e.flags|=8192;else throw gr=mi,Mc}else e.flags&=-16777217}function Gm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!sx(t))if(gh())e.flags|=8192;else throw gr=mi,Mc}function Mi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?wf():536870912,e.lanes|=t,ll|=t)}function as(e,t){if(!Qe)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function mt(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,i=0;if(t)for(var u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)r|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function P1(e,t,r){var i=t.pendingProps;switch(jc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(t),null;case 1:return mt(t),null;case 3:return r=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),ua(Mt),je(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Wr(t)?ma(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,wc())),mt(t),null;case 26:var u=t.type,m=t.memoizedState;return e===null?(ma(t),m!==null?(mt(t),Gm(t,m)):(mt(t),mu(t,u,null,i,r))):m?m!==e.memoizedState?(ma(t),mt(t),Gm(t,m)):(mt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&ma(t),mt(t),mu(t,u,e,i,r)),null;case 27:if(Ue(t),r=xe.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ma(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return mt(t),null}e=ue.current,Wr(t)?wp(t):(e=Zh(u,i,r),t.stateNode=e,ma(t))}return mt(t),null;case 5:if(Ue(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&ma(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return mt(t),null}if(m=ue.current,Wr(t))wp(t);else{var S=Wi(xe.current);switch(m){case 1:m=S.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:m=S.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":m=S.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":m=S.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":m=S.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof i.is=="string"?S.createElement("select",{is:i.is}):S.createElement("select"),i.multiple?m.multiple=!0:i.size&&(m.size=i.size);break;default:m=typeof i.is=="string"?S.createElement(u,{is:i.is}):S.createElement(u)}}m[Gt]=t,m[sn]=i;e:for(S=t.child;S!==null;){if(S.tag===5||S.tag===6)m.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===t)break e;for(;S.sibling===null;){if(S.return===null||S.return===t)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}t.stateNode=m;e:switch(Kt(m,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ma(t)}}return mt(t),mu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&ma(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=xe.current,Wr(t)){if(e=t.stateNode,r=t.memoizedProps,i=null,u=Wt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[Gt]=t,e=!!(e.nodeValue===r||i!==null&&i.suppressHydrationWarning===!0||$h(e.nodeValue,r)),e||Aa(t,!0)}else e=Wi(e).createTextNode(i),e[Gt]=t,t.stateNode=e}return mt(t),null;case 31:if(r=t.memoizedState,e===null||e.memoizedState!==null){if(i=Wr(t),r!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Gt]=t}else fr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),e=!1}else r=wc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return t.flags&256?(gn(t),t):(gn(t),null);if((t.flags&128)!==0)throw Error(o(558))}return mt(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Wr(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Gt]=t}else fr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;mt(t),u=!1}else u=wc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(gn(t),t):(gn(t),null)}return gn(t),(t.flags&128)!==0?(t.lanes=r,t):(r=i!==null,e=e!==null&&e.memoizedState!==null,r&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),m=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(m=i.memoizedState.cachePool.pool),m!==u&&(i.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),Mi(t,t.updateQueue),mt(t),null);case 4:return je(),e===null&&Ou(t.stateNode.containerInfo),mt(t),null;case 10:return ua(t.type),mt(t),null;case 19:if(Y(Tt),i=t.memoizedState,i===null)return mt(t),null;if(u=(t.flags&128)!==0,m=i.rendering,m===null)if(u)as(i,!1);else{if(Ct!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(m=vi(e),m!==null){for(t.flags|=128,as(i,!1),e=m.updateQueue,t.updateQueue=e,Mi(t,e),t.subtreeFlags=0,e=r,r=t.child;r!==null;)yp(r,e),r=r.sibling;return se(Tt,Tt.current&1|2),Qe&&oa(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&rt()>Oi&&(t.flags|=128,u=!0,as(i,!1),t.lanes=4194304)}else{if(!u)if(e=vi(m),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Mi(t,e),as(i,!0),i.tail===null&&i.tailMode==="hidden"&&!m.alternate&&!Qe)return mt(t),null}else 2*rt()-i.renderingStartTime>Oi&&r!==536870912&&(t.flags|=128,u=!0,as(i,!1),t.lanes=4194304);i.isBackwards?(m.sibling=t.child,t.child=m):(e=i.last,e!==null?e.sibling=m:t.child=m,i.last=m)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=rt(),e.sibling=null,r=Tt.current,se(Tt,u?r&1|2:r&1),Qe&&oa(t,i.treeForkCount),e):(mt(t),null);case 22:case 23:return gn(t),Bc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(r&536870912)!==0&&(t.flags&128)===0&&(mt(t),t.subtreeFlags&6&&(t.flags|=8192)):mt(t),r=t.updateQueue,r!==null&&Mi(t,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==r&&(t.flags|=2048),e!==null&&Y(hr),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ua(Mt),mt(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function V1(e,t){switch(jc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ua(Mt),je(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ue(t),null;case 31:if(t.memoizedState!==null){if(gn(t),t.alternate===null)throw Error(o(340));fr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(gn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));fr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Y(Tt),null;case 4:return je(),null;case 10:return ua(t.type),null;case 22:case 23:return gn(t),Bc(),e!==null&&Y(hr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ua(Mt),null;case 25:return null;default:return null}}function Wm(e,t){switch(jc(t),t.tag){case 3:ua(Mt),je();break;case 26:case 27:case 5:Ue(t);break;case 4:je();break;case 31:t.memoizedState!==null&&gn(t);break;case 13:gn(t);break;case 19:Y(Tt);break;case 10:ua(t.type);break;case 22:case 23:gn(t),Bc(),e!==null&&Y(hr);break;case 24:ua(Mt)}}function rs(e,t){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var u=i.next;r=u;do{if((r.tag&e)===e){i=void 0;var m=r.create,S=r.inst;i=m(),S.destroy=i}r=r.next}while(r!==u)}}catch(T){it(t,t.return,T)}}function Ba(e,t,r){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var m=u.next;i=m;do{if((i.tag&e)===e){var S=i.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,u=t;var U=r,K=T;try{K()}catch(ne){it(u,U,ne)}}}i=i.next}while(i!==m)}}catch(ne){it(t,t.return,ne)}}function qm(e){var t=e.updateQueue;if(t!==null){var r=e.stateNode;try{Bp(t,r)}catch(i){it(e,e.return,i)}}}function Ym(e,t,r){r.props=br(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(i){it(e,t,i)}}function ls(e,t){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof r=="function"?e.refCleanup=r(i):r.current=i}}catch(u){it(e,t,u)}}function Xn(e,t){var r=e.ref,i=e.refCleanup;if(r!==null)if(typeof i=="function")try{i()}catch(u){it(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(u){it(e,t,u)}else r.current=null}function Km(e){var t=e.type,r=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":r.autoFocus&&i.focus();break e;case"img":r.src?i.src=r.src:r.srcSet&&(i.srcset=r.srcSet)}}catch(u){it(e,e.return,u)}}function hu(e,t,r){try{var i=e.stateNode;db(i,e.type,r,t),i[sn]=t}catch(u){it(e,e.return,u)}}function Xm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Fa(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xm(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&&Fa(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 gu(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,t):(t=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,t.appendChild(e),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=la));else if(i!==4&&(i===27&&Fa(e.type)&&(r=e.stateNode,t=null),e=e.child,e!==null))for(gu(e,t,r),e=e.sibling;e!==null;)gu(e,t,r),e=e.sibling}function Li(e,t,r){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(i!==4&&(i===27&&Fa(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(Li(e,t,r),e=e.sibling;e!==null;)Li(e,t,r),e=e.sibling}function Qm(e){var t=e.stateNode,r=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Kt(t,i,r),t[Gt]=e,t[sn]=r}catch(m){it(e,e.return,m)}}var ha=!1,Dt=!1,vu=!1,Zm=typeof WeakSet=="function"?WeakSet:Set,Vt=null;function F1(e,t){if(e=e.containerInfo,Hu=Ji,e=up(e),dc(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var u=i.anchorOffset,m=i.focusNode;i=i.focusOffset;try{r.nodeType,m.nodeType}catch{r=null;break e}var S=0,T=-1,U=-1,K=0,ne=0,le=e,Z=null;t:for(;;){for(var ee;le!==r||u!==0&&le.nodeType!==3||(T=S+u),le!==m||i!==0&&le.nodeType!==3||(U=S+i),le.nodeType===3&&(S+=le.nodeValue.length),(ee=le.firstChild)!==null;)Z=le,le=ee;for(;;){if(le===e)break t;if(Z===r&&++K===u&&(T=S),Z===m&&++ne===i&&(U=S),(ee=le.nextSibling)!==null)break;le=Z,Z=le.parentNode}le=ee}r=T===-1||U===-1?null:{start:T,end:U}}else r=null}r=r||{start:0,end:0}}else r=null;for(Uu={focusedElem:e,selectionRange:r},Ji=!1,Vt=t;Vt!==null;)if(t=Vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Vt=e;else for(;Vt!==null;){switch(t=Vt,m=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(r=0;r<e.length;r++)u=e[r],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,r=t,u=m.memoizedProps,m=m.memoizedState,i=r.stateNode;try{var Se=br(r.type,u);e=i.getSnapshotBeforeUpdate(Se,m),i.__reactInternalSnapshotBeforeUpdate=e}catch(Re){it(r,r.return,Re)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,r=e.nodeType,r===9)Vu(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Vu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Vt=e;break}Vt=t.return}}function Jm(e,t,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:ga(e,r),i&4&&rs(5,r);break;case 1:if(ga(e,r),i&4)if(e=r.stateNode,t===null)try{e.componentDidMount()}catch(S){it(r,r.return,S)}else{var u=br(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(S){it(r,r.return,S)}}i&64&&qm(r),i&512&&ls(r,r.return);break;case 3:if(ga(e,r),i&64&&(e=r.updateQueue,e!==null)){if(t=null,r.child!==null)switch(r.child.tag){case 27:case 5:t=r.child.stateNode;break;case 1:t=r.child.stateNode}try{Bp(e,t)}catch(S){it(r,r.return,S)}}break;case 27:t===null&&i&4&&Qm(r);case 26:case 5:ga(e,r),t===null&&i&4&&Km(r),i&512&&ls(r,r.return);break;case 12:ga(e,r);break;case 31:ga(e,r),i&4&&nh(e,r);break;case 13:ga(e,r),i&4&&ah(e,r),i&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=J1.bind(null,r),yb(e,r))));break;case 22:if(i=r.memoizedState!==null||ha,!i){t=t!==null&&t.memoizedState!==null||Dt,u=ha;var m=Dt;ha=i,(Dt=t)&&!m?va(e,r,(r.subtreeFlags&8772)!==0):ga(e,r),ha=u,Dt=m}break;case 30:break;default:ga(e,r)}}function eh(e){var t=e.alternate;t!==null&&(e.alternate=null,eh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Yo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var vt=null,cn=!1;function xa(e,t,r){for(r=r.child;r!==null;)th(e,t,r),r=r.sibling}function th(e,t,r){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(na,r)}catch{}switch(r.tag){case 26:Dt||Xn(r,t),xa(e,t,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:Dt||Xn(r,t);var i=vt,u=cn;Fa(r.type)&&(vt=r.stateNode,cn=!1),xa(e,t,r),ms(r.stateNode),vt=i,cn=u;break;case 5:Dt||Xn(r,t);case 6:if(i=vt,u=cn,vt=null,xa(e,t,r),vt=i,cn=u,vt!==null)if(cn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(r.stateNode)}catch(m){it(r,t,m)}else try{vt.removeChild(r.stateNode)}catch(m){it(r,t,m)}break;case 18:vt!==null&&(cn?(e=vt,qh(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),pl(e)):qh(vt,r.stateNode));break;case 4:i=vt,u=cn,vt=r.stateNode.containerInfo,cn=!0,xa(e,t,r),vt=i,cn=u;break;case 0:case 11:case 14:case 15:Ba(2,r,t),Dt||Ba(4,r,t),xa(e,t,r);break;case 1:Dt||(Xn(r,t),i=r.stateNode,typeof i.componentWillUnmount=="function"&&Ym(r,t,i)),xa(e,t,r);break;case 21:xa(e,t,r);break;case 22:Dt=(i=Dt)||r.memoizedState!==null,xa(e,t,r),Dt=i;break;default:xa(e,t,r)}}function nh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{pl(e)}catch(r){it(t,t.return,r)}}}function ah(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{pl(e)}catch(r){it(t,t.return,r)}}function G1(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zm),t;default:throw Error(o(435,e.tag))}}function zi(e,t){var r=G1(e);t.forEach(function(i){if(!r.has(i)){r.add(i);var u=eb.bind(null,e,i);i.then(u,u)}})}function un(e,t){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var u=r[i],m=e,S=t,T=S;e:for(;T!==null;){switch(T.tag){case 27:if(Fa(T.type)){vt=T.stateNode,cn=!1;break e}break;case 5:vt=T.stateNode,cn=!1;break e;case 3:case 4:vt=T.stateNode.containerInfo,cn=!0;break e}T=T.return}if(vt===null)throw Error(o(160));th(m,S,u),vt=null,cn=!1,m=u.alternate,m!==null&&(m.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)rh(t,e),t=t.sibling}var Vn=null;function rh(e,t){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:un(t,e),dn(e),i&4&&(Ba(3,e,e.return),rs(3,e),Ba(5,e,e.return));break;case 1:un(t,e),dn(e),i&512&&(Dt||r===null||Xn(r,r.return)),i&64&&ha&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?i:r.concat(i))));break;case 26:var u=Vn;if(un(t,e),dn(e),i&512&&(Dt||r===null||Xn(r,r.return)),i&4){var m=r!==null?r.memoizedState:null;if(i=e.memoizedState,r===null)if(i===null)if(e.stateNode===null){e:{i=e.type,r=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":m=u.getElementsByTagName("title")[0],(!m||m[Ll]||m[Gt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=u.createElement(i),u.head.insertBefore(m,u.querySelector("head > title"))),Kt(m,i,r),m[Gt]=e,Pt(m),i=m;break e;case"link":var S=rx("link","href",u).get(i+(r.href||""));if(S){for(var T=0;T<S.length;T++)if(m=S[T],m.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&m.getAttribute("rel")===(r.rel==null?null:r.rel)&&m.getAttribute("title")===(r.title==null?null:r.title)&&m.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){S.splice(T,1);break t}}m=u.createElement(i),Kt(m,i,r),u.head.appendChild(m);break;case"meta":if(S=rx("meta","content",u).get(i+(r.content||""))){for(T=0;T<S.length;T++)if(m=S[T],m.getAttribute("content")===(r.content==null?null:""+r.content)&&m.getAttribute("name")===(r.name==null?null:r.name)&&m.getAttribute("property")===(r.property==null?null:r.property)&&m.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&m.getAttribute("charset")===(r.charSet==null?null:r.charSet)){S.splice(T,1);break t}}m=u.createElement(i),Kt(m,i,r),u.head.appendChild(m);break;default:throw Error(o(468,i))}m[Gt]=e,Pt(m),i=m}e.stateNode=i}else lx(u,e.type,e.stateNode);else e.stateNode=ax(u,i,e.memoizedProps);else m!==i?(m===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):m.count--,i===null?lx(u,e.type,e.stateNode):ax(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&hu(e,e.memoizedProps,r.memoizedProps)}break;case 27:un(t,e),dn(e),i&512&&(Dt||r===null||Xn(r,r.return)),r!==null&&i&4&&hu(e,e.memoizedProps,r.memoizedProps);break;case 5:if(un(t,e),dn(e),i&512&&(Dt||r===null||Xn(r,r.return)),e.flags&32){u=e.stateNode;try{Or(u,"")}catch(Se){it(e,e.return,Se)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,hu(e,u,r!==null?r.memoizedProps:u)),i&1024&&(vu=!0);break;case 6:if(un(t,e),dn(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,r=e.stateNode;try{r.nodeValue=i}catch(Se){it(e,e.return,Se)}}break;case 3:if(Ki=null,u=Vn,Vn=qi(t.containerInfo),un(t,e),Vn=u,dn(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{pl(t.containerInfo)}catch(Se){it(e,e.return,Se)}vu&&(vu=!1,lh(e));break;case 4:i=Vn,Vn=qi(e.stateNode.containerInfo),un(t,e),dn(e),Vn=i;break;case 12:un(t,e),dn(e);break;case 31:un(t,e),dn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,zi(e,i)));break;case 13:un(t,e),dn(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(_i=rt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,zi(e,i)));break;case 22:u=e.memoizedState!==null;var U=r!==null&&r.memoizedState!==null,K=ha,ne=Dt;if(ha=K||u,Dt=ne||U,un(t,e),Dt=ne,ha=K,dn(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(r===null||U||ha||Dt||Sr(e)),r=null,t=e;;){if(t.tag===5||t.tag===26){if(r===null){U=r=t;try{if(m=U.stateNode,u)S=m.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{T=U.stateNode;var le=U.memoizedProps.style,Z=le!=null&&le.hasOwnProperty("display")?le.display:null;T.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Se){it(U,U.return,Se)}}}else if(t.tag===6){if(r===null){U=t;try{U.stateNode.nodeValue=u?"":U.memoizedProps}catch(Se){it(U,U.return,Se)}}}else if(t.tag===18){if(r===null){U=t;try{var ee=U.stateNode;u?Yh(ee,!0):Yh(U.stateNode,!1)}catch(Se){it(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;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(r=i.retryQueue,r!==null&&(i.retryQueue=null,zi(e,r))));break;case 19:un(t,e),dn(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,zi(e,i)));break;case 30:break;case 21:break;default:un(t,e),dn(e)}}function dn(e){var t=e.flags;if(t&2){try{for(var r,i=e.return;i!==null;){if(Xm(i)){r=i;break}i=i.return}if(r==null)throw Error(o(160));switch(r.tag){case 27:var u=r.stateNode,m=xu(e);Li(e,m,u);break;case 5:var S=r.stateNode;r.flags&32&&(Or(S,""),r.flags&=-33);var T=xu(e);Li(e,T,S);break;case 3:case 4:var U=r.stateNode.containerInfo,K=xu(e);gu(e,K,U);break;default:throw Error(o(161))}}catch(ne){it(e,e.return,ne)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function lh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;lh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ga(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Jm(e,t.alternate,t),t=t.sibling}function Sr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ba(4,t,t.return),Sr(t);break;case 1:Xn(t,t.return);var r=t.stateNode;typeof r.componentWillUnmount=="function"&&Ym(t,t.return,r),Sr(t);break;case 27:ms(t.stateNode);case 26:case 5:Xn(t,t.return),Sr(t);break;case 22:t.memoizedState===null&&Sr(t);break;case 30:Sr(t);break;default:Sr(t)}e=e.sibling}}function va(e,t,r){for(r=r&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,m=t,S=m.flags;switch(m.tag){case 0:case 11:case 15:va(u,m,r),rs(4,m);break;case 1:if(va(u,m,r),i=m,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(K){it(i,i.return,K)}if(i=m,u=i.updateQueue,u!==null){var T=i.stateNode;try{var U=u.shared.hiddenCallbacks;if(U!==null)for(u.shared.hiddenCallbacks=null,u=0;u<U.length;u++)Op(U[u],T)}catch(K){it(i,i.return,K)}}r&&S&64&&qm(m),ls(m,m.return);break;case 27:Qm(m);case 26:case 5:va(u,m,r),r&&i===null&&S&4&&Km(m),ls(m,m.return);break;case 12:va(u,m,r);break;case 31:va(u,m,r),r&&S&4&&nh(u,m);break;case 13:va(u,m,r),r&&S&4&&ah(u,m);break;case 22:m.memoizedState===null&&va(u,m,r),ls(m,m.return);break;case 30:break;default:va(u,m,r)}t=t.sibling}}function yu(e,t){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&Gl(r))}function bu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gl(e))}function Fn(e,t,r,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)sh(e,t,r,i),t=t.sibling}function sh(e,t,r,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:Fn(e,t,r,i),u&2048&&rs(9,t);break;case 1:Fn(e,t,r,i);break;case 3:Fn(e,t,r,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gl(e)));break;case 12:if(u&2048){Fn(e,t,r,i),e=t.stateNode;try{var m=t.memoizedProps,S=m.id,T=m.onPostCommit;typeof T=="function"&&T(S,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(U){it(t,t.return,U)}}else Fn(e,t,r,i);break;case 31:Fn(e,t,r,i);break;case 13:Fn(e,t,r,i);break;case 23:break;case 22:m=t.stateNode,S=t.alternate,t.memoizedState!==null?m._visibility&2?Fn(e,t,r,i):ss(e,t):m._visibility&2?Fn(e,t,r,i):(m._visibility|=2,nl(e,t,r,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&yu(S,t);break;case 24:Fn(e,t,r,i),u&2048&&bu(t.alternate,t);break;default:Fn(e,t,r,i)}}function nl(e,t,r,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var m=e,S=t,T=r,U=i,K=S.flags;switch(S.tag){case 0:case 11:case 15:nl(m,S,T,U,u),rs(8,S);break;case 23:break;case 22:var ne=S.stateNode;S.memoizedState!==null?ne._visibility&2?nl(m,S,T,U,u):ss(m,S):(ne._visibility|=2,nl(m,S,T,U,u)),u&&K&2048&&yu(S.alternate,S);break;case 24:nl(m,S,T,U,u),u&&K&2048&&bu(S.alternate,S);break;default:nl(m,S,T,U,u)}t=t.sibling}}function ss(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var r=e,i=t,u=i.flags;switch(i.tag){case 22:ss(r,i),u&2048&&yu(i.alternate,i);break;case 24:ss(r,i),u&2048&&bu(i.alternate,i);break;default:ss(r,i)}t=t.sibling}}var is=8192;function al(e,t,r){if(e.subtreeFlags&is)for(e=e.child;e!==null;)ih(e,t,r),e=e.sibling}function ih(e,t,r){switch(e.tag){case 26:al(e,t,r),e.flags&is&&e.memoizedState!==null&&Mb(r,Vn,e.memoizedState,e.memoizedProps);break;case 5:al(e,t,r);break;case 3:case 4:var i=Vn;Vn=qi(e.stateNode.containerInfo),al(e,t,r),Vn=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=is,is=16777216,al(e,t,r),is=i):al(e,t,r));break;default:al(e,t,r)}}function oh(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 os(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];Vt=i,uh(i,e)}oh(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ch(e),e=e.sibling}function ch(e){switch(e.tag){case 0:case 11:case 15:os(e),e.flags&2048&&Ba(9,e,e.return);break;case 3:os(e);break;case 12:os(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Di(e)):os(e);break;default:os(e)}}function Di(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var r=0;r<t.length;r++){var i=t[r];Vt=i,uh(i,e)}oh(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ba(8,t,t.return),Di(t);break;case 22:r=t.stateNode,r._visibility&2&&(r._visibility&=-3,Di(t));break;default:Di(t)}e=e.sibling}}function uh(e,t){for(;Vt!==null;){var r=Vt;switch(r.tag){case 0:case 11:case 15:Ba(8,r,t);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var i=r.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:Gl(r.memoizedState.cache)}if(i=r.child,i!==null)i.return=r,Vt=i;else e:for(r=e;Vt!==null;){i=Vt;var u=i.sibling,m=i.return;if(eh(i),i===r){Vt=null;break e}if(u!==null){u.return=m,Vt=u;break e}Vt=m}}}var W1={getCacheForType:function(e){var t=qt(Mt),r=t.data.get(e);return r===void 0&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return qt(Mt).controller.signal}},q1=typeof WeakMap=="function"?WeakMap:Map,nt=0,ft=null,qe=null,Ke=0,st=0,vn=null,Ia=!1,rl=!1,Su=!1,ya=0,Ct=0,Ha=0,jr=0,ju=0,yn=0,ll=0,cs=null,fn=null,ku=!1,_i=0,dh=0,Oi=1/0,Bi=null,Ua=null,Bt=0,$a=null,sl=null,ba=0,wu=0,Cu=null,fh=null,us=0,Eu=null;function bn(){return(nt&2)!==0&&Ke!==0?Ke&-Ke:M.T!==null?Lu():Tf()}function ph(){if(yn===0)if((Ke&536870912)===0||Qe){var e=$t;$t<<=1,($t&3932160)===0&&($t=262144),yn=e}else yn=536870912;return e=xn.current,e!==null&&(e.flags|=32),yn}function pn(e,t,r){(e===ft&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(il(e,0),Pa(e,Ke,yn,!1)),Ml(e,r),((nt&2)===0||e!==ft)&&(e===ft&&((nt&2)===0&&(jr|=r),Ct===4&&Pa(e,Ke,yn,!1)),Qn(e))}function mh(e,t,r){if((nt&6)!==0)throw Error(o(327));var i=!r&&(t&127)===0&&(t&e.expiredLanes)===0||En(e,t),u=i?X1(e,t):Tu(e,t,!0),m=i;do{if(u===0){rl&&!i&&Pa(e,t,0,!1);break}else{if(r=e.current.alternate,m&&!Y1(r)){u=Tu(e,t,!1),m=!1;continue}if(u===2){if(m=t,e.errorRecoveryDisabledLanes&m)var S=0;else S=e.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){t=S;e:{var T=e;u=cs;var U=T.current.memoizedState.isDehydrated;if(U&&(il(T,S).flags|=256),S=Tu(T,S,!1),S!==2){if(Su&&!U){T.errorRecoveryDisabledLanes|=m,jr|=m,u=4;break e}m=fn,fn=u,m!==null&&(fn===null?fn=m:fn.push.apply(fn,m))}u=S}if(m=!1,u!==2)continue}}if(u===1){il(e,0),Pa(e,t,0,!0);break}e:{switch(i=e,m=u,m){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Pa(i,t,yn,!Ia);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=_i+300-rt(),10<u)){if(Pa(i,t,yn,!Ia),Al(i,0,!0)!==0)break e;ba=t,i.timeoutHandle=Gh(hh.bind(null,i,r,fn,Bi,ku,t,yn,jr,ll,Ia,m,"Throttled",-0,0),u);break e}hh(i,r,fn,Bi,ku,t,yn,jr,ll,Ia,m,null,-0,0)}}break}while(!0);Qn(e)}function hh(e,t,r,i,u,m,S,T,U,K,ne,le,Z,ee){if(e.timeoutHandle=-1,le=t.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:la},ih(t,m,le);var Se=(m&62914560)===m?_i-rt():(m&4194048)===m?dh-rt():0;if(Se=Lb(le,Se),Se!==null){ba=m,e.cancelPendingCommit=Se(kh.bind(null,e,t,m,r,i,u,S,T,U,ne,le,null,Z,ee)),Pa(e,m,S,!K);return}}kh(e,t,m,r,i,u,S,T,U)}function Y1(e){for(var t=e;;){var r=t.tag;if((r===0||r===11||r===15)&&t.flags&16384&&(r=t.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var i=0;i<r.length;i++){var u=r[i],m=u.getSnapshot;u=u.value;try{if(!mn(m(),u))return!1}catch{return!1}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;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 Pa(e,t,r,i){t&=~ju,t&=~jr,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var m=31-St(u),S=1<<m;i[m]=-1,u&=~S}r!==0&&Cf(e,r,t)}function Ii(){return(nt&6)===0?(ds(0),!1):!0}function Nu(){if(qe!==null){if(st===0)var e=qe.return;else e=qe,ca=pr=null,Vc(e),Qr=null,ql=0,e=qe;for(;e!==null;)Wm(e.alternate,e),e=e.return;qe=null}}function il(e,t){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,mb(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),ba=0,Nu(),ft=e,qe=r=ia(e.current,null),Ke=t,st=0,vn=null,Ia=!1,rl=En(e,t),Su=!1,ll=yn=ju=jr=Ha=Ct=0,fn=cs=null,ku=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-St(i),m=1<<u;t|=e[u],i&=~m}return ya=t,li(),r}function xh(e,t){$e=null,M.H=ts,t===Xr||t===pi?(t=Lp(),st=3):t===Mc?(t=Lp(),st=4):st=t===lu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,vn=t,qe===null&&(Ct=1,Ni(e,An(t,e.current)))}function gh(){var e=xn.current;return e===null?!0:(Ke&4194048)===Ke?Dn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Dn:!1}function vh(){var e=M.H;return M.H=ts,e===null?ts:e}function yh(){var e=M.A;return M.A=W1,e}function Hi(){Ct=4,Ia||(Ke&4194048)!==Ke&&xn.current!==null||(rl=!0),(Ha&134217727)===0&&(jr&134217727)===0||ft===null||Pa(ft,Ke,yn,!1)}function Tu(e,t,r){var i=nt;nt|=2;var u=vh(),m=yh();(ft!==e||Ke!==t)&&(Bi=null,il(e,t)),t=!1;var S=Ct;e:do try{if(st!==0&&qe!==null){var T=qe,U=vn;switch(st){case 8:Nu(),S=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(t=!0);var K=st;if(st=0,vn=null,ol(e,T,U,K),r&&rl){S=0;break e}break;default:K=st,st=0,vn=null,ol(e,T,U,K)}}K1(),S=Ct;break}catch(ne){xh(e,ne)}while(!0);return t&&e.shellSuspendCounter++,ca=pr=null,nt=i,M.H=u,M.A=m,qe===null&&(ft=null,Ke=0,li()),S}function K1(){for(;qe!==null;)bh(qe)}function X1(e,t){var r=nt;nt|=2;var i=vh(),u=yh();ft!==e||Ke!==t?(Bi=null,Oi=rt()+500,il(e,t)):rl=En(e,t);e:do try{if(st!==0&&qe!==null){t=qe;var m=vn;t:switch(st){case 1:st=0,vn=null,ol(e,t,m,1);break;case 2:case 9:if(Ap(m)){st=0,vn=null,Sh(t);break}t=function(){st!==2&&st!==9||ft!==e||(st=7),Qn(e)},m.then(t,t);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:Ap(m)?(st=0,vn=null,Sh(t)):(st=0,vn=null,ol(e,t,m,7));break;case 5:var S=null;switch(qe.tag){case 26:S=qe.memoizedState;case 5:case 27:var T=qe;if(S?sx(S):T.stateNode.complete){st=0,vn=null;var U=T.sibling;if(U!==null)qe=U;else{var K=T.return;K!==null?(qe=K,Ui(K)):qe=null}break t}}st=0,vn=null,ol(e,t,m,5);break;case 6:st=0,vn=null,ol(e,t,m,6);break;case 8:Nu(),Ct=6;break e;default:throw Error(o(462))}}Q1();break}catch(ne){xh(e,ne)}while(!0);return ca=pr=null,M.H=i,M.A=u,nt=r,qe!==null?0:(ft=null,Ke=0,li(),Ct)}function Q1(){for(;qe!==null&&!Ot();)bh(qe)}function bh(e){var t=Fm(e.alternate,e,ya);e.memoizedProps=e.pendingProps,t===null?Ui(e):qe=t}function Sh(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=Im(r,t,t.pendingProps,t.type,void 0,Ke);break;case 11:t=Im(r,t,t.pendingProps,t.type.render,t.ref,Ke);break;case 5:Vc(t);default:Wm(r,t),t=qe=yp(t,ya),t=Fm(r,t,ya)}e.memoizedProps=e.pendingProps,t===null?Ui(e):qe=t}function ol(e,t,r,i){ca=pr=null,Vc(t),Qr=null,ql=0;var u=t.return;try{if(H1(e,u,t,r,Ke)){Ct=1,Ni(e,An(r,e.current)),qe=null;return}}catch(m){if(u!==null)throw qe=u,m;Ct=1,Ni(e,An(r,e.current)),qe=null;return}t.flags&32768?(Qe||i===1?e=!0:rl||(Ke&536870912)!==0?e=!1:(Ia=e=!0,(i===2||i===9||i===3||i===6)&&(i=xn.current,i!==null&&i.tag===13&&(i.flags|=16384))),jh(t,e)):Ui(t)}function Ui(e){var t=e;do{if((t.flags&32768)!==0){jh(t,Ia);return}e=t.return;var r=P1(t.alternate,t,ya);if(r!==null){qe=r;return}if(t=t.sibling,t!==null){qe=t;return}qe=t=e}while(t!==null);Ct===0&&(Ct=5)}function jh(e,t){do{var r=V1(e.alternate,e);if(r!==null){r.flags&=32767,qe=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&(e=e.sibling,e!==null)){qe=e;return}qe=e=r}while(e!==null);Ct=6,qe=null}function kh(e,t,r,i,u,m,S,T,U){e.cancelPendingCommit=null;do $i();while(Bt!==0);if((nt&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(m=t.lanes|t.childLanes,m|=xc,Ay(e,r,m,S,T,U),e===ft&&(qe=ft=null,Ke=0),sl=t,$a=e,ba=r,wu=m,Cu=u,fh=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,tb(De,function(){return Th(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=M.T,M.T=null,u=I.p,I.p=2,S=nt,nt|=4;try{F1(e,t,r)}finally{nt=S,I.p=u,M.T=i}}Bt=1,wh(),Ch(),Eh()}}function wh(){if(Bt===1){Bt=0;var e=$a,t=sl,r=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||r){r=M.T,M.T=null;var i=I.p;I.p=2;var u=nt;nt|=4;try{rh(t,e);var m=Uu,S=up(e.containerInfo),T=m.focusedElem,U=m.selectionRange;if(S!==T&&T&&T.ownerDocument&&cp(T.ownerDocument.documentElement,T)){if(U!==null&&dc(T)){var K=U.start,ne=U.end;if(ne===void 0&&(ne=K),"selectionStart"in T)T.selectionStart=K,T.selectionEnd=Math.min(ne,T.value.length);else{var le=T.ownerDocument||document,Z=le&&le.defaultView||window;if(Z.getSelection){var ee=Z.getSelection(),Se=T.textContent.length,Re=Math.min(U.start,Se),ut=U.end===void 0?Re:Math.min(U.end,Se);!ee.extend&&Re>ut&&(S=ut,ut=Re,Re=S);var F=op(T,Re),V=op(T,ut);if(F&&V&&(ee.rangeCount!==1||ee.anchorNode!==F.node||ee.anchorOffset!==F.offset||ee.focusNode!==V.node||ee.focusOffset!==V.offset)){var q=le.createRange();q.setStart(F.node,F.offset),ee.removeAllRanges(),Re>ut?(ee.addRange(q),ee.extend(V.node,V.offset)):(q.setEnd(V.node,V.offset),ee.addRange(q))}}}}for(le=[],ee=T;ee=ee.parentNode;)ee.nodeType===1&&le.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<le.length;T++){var re=le[T];re.element.scrollLeft=re.left,re.element.scrollTop=re.top}}Ji=!!Hu,Uu=Hu=null}finally{nt=u,I.p=i,M.T=r}}e.current=t,Bt=2}}function Ch(){if(Bt===2){Bt=0;var e=$a,t=sl,r=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||r){r=M.T,M.T=null;var i=I.p;I.p=2;var u=nt;nt|=4;try{Jm(e,t.alternate,t)}finally{nt=u,I.p=i,M.T=r}}Bt=3}}function Eh(){if(Bt===4||Bt===3){Bt=0,Ft();var e=$a,t=sl,r=ba,i=fh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Bt=5:(Bt=0,sl=$a=null,Nh(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Ua=null),Wo(r),t=t.stateNode,Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(na,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=M.T,u=I.p,I.p=2,M.T=null;try{for(var m=e.onRecoverableError,S=0;S<i.length;S++){var T=i[S];m(T.value,{componentStack:T.stack})}}finally{M.T=t,I.p=u}}(ba&3)!==0&&$i(),Qn(e),u=e.pendingLanes,(r&261930)!==0&&(u&42)!==0?e===Eu?us++:(us=0,Eu=e):us=0,ds(0)}}function Nh(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gl(t)))}function $i(){return wh(),Ch(),Eh(),Th()}function Th(){if(Bt!==5)return!1;var e=$a,t=wu;wu=0;var r=Wo(ba),i=M.T,u=I.p;try{I.p=32>r?32:r,M.T=null,r=Cu,Cu=null;var m=$a,S=ba;if(Bt=0,sl=$a=null,ba=0,(nt&6)!==0)throw Error(o(331));var T=nt;if(nt|=4,ch(m.current),sh(m,m.current,S,r),nt=T,ds(0,!1),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(na,m)}catch{}return!0}finally{I.p=u,M.T=i,Nh(e,t)}}function Rh(e,t,r){t=An(r,t),t=ru(e.stateNode,t,2),e=Da(e,t,2),e!==null&&(Ml(e,2),Qn(e))}function it(e,t,r){if(e.tag===3)Rh(e,e,r);else for(;t!==null;){if(t.tag===3){Rh(t,e,r);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ua===null||!Ua.has(i))){e=An(r,e),r=Am(2),i=Da(t,r,2),i!==null&&(Mm(r,i,t,e),Ml(i,2),Qn(i));break}}t=t.return}}function Ru(e,t,r){var i=e.pingCache;if(i===null){i=e.pingCache=new q1;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(r)||(Su=!0,u.add(r),e=Z1.bind(null,e,t,r),t.then(e,e))}function Z1(e,t,r){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,ft===e&&(Ke&r)===r&&(Ct===4||Ct===3&&(Ke&62914560)===Ke&&300>rt()-_i?(nt&2)===0&&il(e,0):ju|=r,ll===Ke&&(ll=0)),Qn(e)}function Ah(e,t){t===0&&(t=wf()),e=ur(e,t),e!==null&&(Ml(e,t),Qn(e))}function J1(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),Ah(e,r)}function eb(e,t){var r=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(r=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Ah(e,r)}function tb(e,t){return ze(e,t)}var Pi=null,cl=null,Au=!1,Vi=!1,Mu=!1,Va=0;function Qn(e){e!==cl&&e.next===null&&(cl===null?Pi=cl=e:cl=cl.next=e),Vi=!0,Au||(Au=!0,ab())}function ds(e,t){if(!Mu&&Vi){Mu=!0;do for(var r=!1,i=Pi;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var m=0;else{var S=i.suspendedLanes,T=i.pingedLanes;m=(1<<31-St(42|e)+1)-1,m&=u&~(S&~T),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(r=!0,Dh(i,m))}else m=Ke,m=Al(i,i===ft?m:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(m&3)===0||En(i,m)||(r=!0,Dh(i,m));i=i.next}while(r);Mu=!1}}function nb(){Mh()}function Mh(){Vi=Au=!1;var e=0;Va!==0&&pb()&&(e=Va);for(var t=rt(),r=null,i=Pi;i!==null;){var u=i.next,m=Lh(i,t);m===0?(i.next=null,r===null?Pi=u:r.next=u,u===null&&(cl=r)):(r=i,(e!==0||(m&3)!==0)&&(Vi=!0)),i=u}Bt!==0&&Bt!==5||ds(e),Va!==0&&(Va=0)}function Lh(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var S=31-St(m),T=1<<S,U=u[S];U===-1?((T&r)===0||(T&i)!==0)&&(u[S]=Vo(T,t)):U<=t&&(e.expiredLanes|=T),m&=~T}if(t=ft,r=Ke,r=Al(e,e===t?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,r===0||e===t&&(st===2||st===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&Be(i),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||En(e,r)){if(t=r&-r,t===e.callbackPriority)return t;switch(i!==null&&Be(i),Wo(r)){case 2:case 8:r=At;break;case 32:r=De;break;case 268435456:r=Xt;break;default:r=De}return i=zh.bind(null,e),r=ze(r,i),e.callbackPriority=t,e.callbackNode=r,t}return i!==null&&i!==null&&Be(i),e.callbackPriority=2,e.callbackNode=null,2}function zh(e,t){if(Bt!==0&&Bt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if($i()&&e.callbackNode!==r)return null;var i=Ke;return i=Al(e,e===ft?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(mh(e,i,t),Lh(e,rt()),e.callbackNode!=null&&e.callbackNode===r?zh.bind(null,e):null)}function Dh(e,t){if($i())return null;mh(e,t,!0)}function ab(){hb(function(){(nt&6)!==0?ze(ve,nb):Mh()})}function Lu(){if(Va===0){var e=Yr;e===0&&(e=Fe,Fe<<=1,(Fe&261888)===0&&(Fe=256)),Va=e}return Va}function _h(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Qs(""+e)}function Oh(e,t){var r=t.ownerDocument.createElement("input");return r.name=t.name,r.value=t.value,e.id&&r.setAttribute("form",e.id),t.parentNode.insertBefore(r,t),e=new FormData(e),r.parentNode.removeChild(r),e}function rb(e,t,r,i,u){if(t==="submit"&&r&&r.stateNode===u){var m=_h((u[sn]||null).action),S=i.submitter;S&&(t=(t=S[sn]||null)?_h(t.formAction):S.getAttribute("formAction"),t!==null&&(m=t,S=null));var T=new ti("action","action",null,i,u);e.push({event:T,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Va!==0){var U=S?Oh(u,S):new FormData(u);Zc(r,{pending:!0,data:U,method:u.method,action:m},null,U)}}else typeof m=="function"&&(T.preventDefault(),U=S?Oh(u,S):new FormData(u),Zc(r,{pending:!0,data:U,method:u.method,action:m},m,U))},currentTarget:u}]})}}for(var zu=0;zu<hc.length;zu++){var Du=hc[zu],lb=Du.toLowerCase(),sb=Du[0].toUpperCase()+Du.slice(1);Pn(lb,"on"+sb)}Pn(pp,"onAnimationEnd"),Pn(mp,"onAnimationIteration"),Pn(hp,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(j1,"onTransitionRun"),Pn(k1,"onTransitionStart"),Pn(w1,"onTransitionCancel"),Pn(xp,"onTransitionEnd"),Dr("onMouseEnter",["mouseout","mouseover"]),Dr("onMouseLeave",["mouseout","mouseover"]),Dr("onPointerEnter",["pointerout","pointerover"]),Dr("onPointerLeave",["pointerout","pointerover"]),sr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),sr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),sr("onBeforeInput",["compositionend","keypress","textInput","paste"]),sr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),sr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),sr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fs="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(" "),ib=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fs));function Bh(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var i=e[r],u=i.event;i=i.listeners;e:{var m=void 0;if(t)for(var S=i.length-1;0<=S;S--){var T=i[S],U=T.instance,K=T.currentTarget;if(T=T.listener,U!==m&&u.isPropagationStopped())break e;m=T,u.currentTarget=K;try{m(u)}catch(ne){ri(ne)}u.currentTarget=null,m=U}else for(S=0;S<i.length;S++){if(T=i[S],U=T.instance,K=T.currentTarget,T=T.listener,U!==m&&u.isPropagationStopped())break e;m=T,u.currentTarget=K;try{m(u)}catch(ne){ri(ne)}u.currentTarget=null,m=U}}}}function Ye(e,t){var r=t[qo];r===void 0&&(r=t[qo]=new Set);var i=e+"__bubble";r.has(i)||(Ih(t,e,2,!1),r.add(i))}function _u(e,t,r){var i=0;t&&(i|=4),Ih(r,e,i,t)}var Fi="_reactListening"+Math.random().toString(36).slice(2);function Ou(e){if(!e[Fi]){e[Fi]=!0,Mf.forEach(function(r){r!=="selectionchange"&&(ib.has(r)||_u(r,!1,e),_u(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fi]||(t[Fi]=!0,_u("selectionchange",!1,t))}}function Ih(e,t,r,i){switch(px(t)){case 2:var u=_b;break;case 8:u=Ob;break;default:u=Qu}r=u.bind(null,t,r,e),u=void 0,!nc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,r,{capture:!0,passive:u}):e.addEventListener(t,r,!0):u!==void 0?e.addEventListener(t,r,{passive:u}):e.addEventListener(t,r,!1)}function Bu(e,t,r,i,u){var m=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var S=i.tag;if(S===3||S===4){var T=i.stateNode.containerInfo;if(T===u)break;if(S===4)for(S=i.return;S!==null;){var U=S.tag;if((U===3||U===4)&&S.stateNode.containerInfo===u)return;S=S.return}for(;T!==null;){if(S=Mr(T),S===null)return;if(U=S.tag,U===5||U===6||U===26||U===27){i=m=S;continue e}T=T.parentNode}}i=i.return}Vf(function(){var K=m,ne=ec(r),le=[];e:{var Z=gp.get(e);if(Z!==void 0){var ee=ti,Se=e;switch(e){case"keypress":if(Js(r)===0)break e;case"keydown":case"keyup":ee=e1;break;case"focusin":Se="focus",ee=sc;break;case"focusout":Se="blur",ee=sc;break;case"beforeblur":case"afterblur":ee=sc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=Wf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=Py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=a1;break;case pp:case mp:case hp:ee=Gy;break;case xp:ee=l1;break;case"scroll":case"scrollend":ee=Uy;break;case"wheel":ee=i1;break;case"copy":case"cut":case"paste":ee=qy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Yf;break;case"toggle":case"beforetoggle":ee=c1}var Re=(t&4)!==0,ut=!Re&&(e==="scroll"||e==="scrollend"),F=Re?Z!==null?Z+"Capture":null:Z;Re=[];for(var V=K,q;V!==null;){var re=V;if(q=re.stateNode,re=re.tag,re!==5&&re!==26&&re!==27||q===null||F===null||(re=Dl(V,F),re!=null&&Re.push(ps(V,re,q))),ut)break;V=V.return}0<Re.length&&(Z=new ee(Z,Se,null,r,ne),le.push({event:Z,listeners:Re}))}}if((t&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",ee=e==="mouseout"||e==="pointerout",Z&&r!==Jo&&(Se=r.relatedTarget||r.fromElement)&&(Mr(Se)||Se[Ar]))break e;if((ee||Z)&&(Z=ne.window===ne?ne:(Z=ne.ownerDocument)?Z.defaultView||Z.parentWindow:window,ee?(Se=r.relatedTarget||r.toElement,ee=K,Se=Se?Mr(Se):null,Se!==null&&(ut=f(Se),Re=Se.tag,Se!==ut||Re!==5&&Re!==27&&Re!==6)&&(Se=null)):(ee=null,Se=K),ee!==Se)){if(Re=Wf,re="onMouseLeave",F="onMouseEnter",V="mouse",(e==="pointerout"||e==="pointerover")&&(Re=Yf,re="onPointerLeave",F="onPointerEnter",V="pointer"),ut=ee==null?Z:zl(ee),q=Se==null?Z:zl(Se),Z=new Re(re,V+"leave",ee,r,ne),Z.target=ut,Z.relatedTarget=q,re=null,Mr(ne)===K&&(Re=new Re(F,V+"enter",Se,r,ne),Re.target=q,Re.relatedTarget=ut,re=Re),ut=re,ee&&Se)t:{for(Re=ob,F=ee,V=Se,q=0,re=F;re;re=Re(re))q++;re=0;for(var Te=V;Te;Te=Re(Te))re++;for(;0<q-re;)F=Re(F),q--;for(;0<re-q;)V=Re(V),re--;for(;q--;){if(F===V||V!==null&&F===V.alternate){Re=F;break t}F=Re(F),V=Re(V)}Re=null}else Re=null;ee!==null&&Hh(le,Z,ee,Re,!1),Se!==null&&ut!==null&&Hh(le,ut,Se,Re,!0)}}e:{if(Z=K?zl(K):window,ee=Z.nodeName&&Z.nodeName.toLowerCase(),ee==="select"||ee==="input"&&Z.type==="file")var Je=np;else if(ep(Z))if(ap)Je=y1;else{Je=g1;var ke=x1}else ee=Z.nodeName,!ee||ee.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?K&&Zo(K.elementType)&&(Je=np):Je=v1;if(Je&&(Je=Je(e,K))){tp(le,Je,r,ne);break e}ke&&ke(e,Z,K),e==="focusout"&&K&&Z.type==="number"&&K.memoizedProps.value!=null&&Qo(Z,"number",Z.value)}switch(ke=K?zl(K):window,e){case"focusin":(ep(ke)||ke.contentEditable==="true")&&(Ur=ke,fc=K,Pl=null);break;case"focusout":Pl=fc=Ur=null;break;case"mousedown":pc=!0;break;case"contextmenu":case"mouseup":case"dragend":pc=!1,dp(le,r,ne);break;case"selectionchange":if(S1)break;case"keydown":case"keyup":dp(le,r,ne)}var Pe;if(oc)e:{switch(e){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Hr?Zf(e,r)&&(Xe="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(Xe="onCompositionStart");Xe&&(Kf&&r.locale!=="ko"&&(Hr||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Hr&&(Pe=Ff()):(Na=ne,ac="value"in Na?Na.value:Na.textContent,Hr=!0)),ke=Gi(K,Xe),0<ke.length&&(Xe=new qf(Xe,e,null,r,ne),le.push({event:Xe,listeners:ke}),Pe?Xe.data=Pe:(Pe=Jf(r),Pe!==null&&(Xe.data=Pe)))),(Pe=d1?f1(e,r):p1(e,r))&&(Xe=Gi(K,"onBeforeInput"),0<Xe.length&&(ke=new qf("onBeforeInput","beforeinput",null,r,ne),le.push({event:ke,listeners:Xe}),ke.data=Pe)),rb(le,e,K,r,ne)}Bh(le,t)})}function ps(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Gi(e,t){for(var r=t+"Capture",i=[];e!==null;){var u=e,m=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||m===null||(u=Dl(e,r),u!=null&&i.unshift(ps(e,u,m)),u=Dl(e,t),u!=null&&i.push(ps(e,u,m))),e.tag===3)return i;e=e.return}return[]}function ob(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Hh(e,t,r,i,u){for(var m=t._reactName,S=[];r!==null&&r!==i;){var T=r,U=T.alternate,K=T.stateNode;if(T=T.tag,U!==null&&U===i)break;T!==5&&T!==26&&T!==27||K===null||(U=K,u?(K=Dl(r,m),K!=null&&S.unshift(ps(r,K,U))):u||(K=Dl(r,m),K!=null&&S.push(ps(r,K,U)))),r=r.return}S.length!==0&&e.push({event:t,listeners:S})}var cb=/\r\n?/g,ub=/\u0000|\uFFFD/g;function Uh(e){return(typeof e=="string"?e:""+e).replace(cb,`
50
- `).replace(ub,"")}function $h(e,t){return t=Uh(t),Uh(e)===t}function ct(e,t,r,i,u,m){switch(r){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Or(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Or(e,""+i);break;case"className":Ks(e,"class",i);break;case"tabIndex":Ks(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":Ks(e,r,i);break;case"style":$f(e,i,m);break;case"data":if(t!=="object"){Ks(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||r!=="href")){e.removeAttribute(r);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Qs(""+i),e.setAttribute(r,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(r,"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 m=="function"&&(r==="formAction"?(t!=="input"&&ct(e,t,"name",u.name,u,null),ct(e,t,"formEncType",u.formEncType,u,null),ct(e,t,"formMethod",u.formMethod,u,null),ct(e,t,"formTarget",u.formTarget,u,null)):(ct(e,t,"encType",u.encType,u,null),ct(e,t,"method",u.method,u,null),ct(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(r);break}i=Qs(""+i),e.setAttribute(r,i);break;case"onClick":i!=null&&(e.onclick=la);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=r}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}r=Qs(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""+i):e.removeAttribute(r);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":i===!0?e.setAttribute(r,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(r,i):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(r,i):e.removeAttribute(r);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(r):e.setAttribute(r,i);break;case"popover":Ye("beforetoggle",e),Ye("toggle",e),Ys(e,"popover",i);break;case"xlinkActuate":ra(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ra(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ra(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ra(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ra(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ra(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ra(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ra(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ra(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":Ys(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Iy.get(r)||r,Ys(e,r,i))}}function Iu(e,t,r,i,u,m){switch(r){case"style":$f(e,i,m);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(r=i.__html,r!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=r}}break;case"children":typeof i=="string"?Or(e,i):(typeof i=="number"||typeof i=="bigint")&&Or(e,""+i);break;case"onScroll":i!=null&&Ye("scroll",e);break;case"onScrollEnd":i!=null&&Ye("scrollend",e);break;case"onClick":i!=null&&(e.onclick=la);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Lf.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(u=r.endsWith("Capture"),t=r.slice(2,u?r.length-7:void 0),m=e[sn]||null,m=m!=null?m[r]:null,typeof m=="function"&&e.removeEventListener(t,m,u),typeof i=="function")){typeof m!="function"&&m!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(t,i,u);break e}r in e?e[r]=i:i===!0?e.setAttribute(r,""):Ys(e,r,i)}}}function Kt(e,t,r){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 i=!1,u=!1,m;for(m in r)if(r.hasOwnProperty(m)){var S=r[m];if(S!=null)switch(m){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,m,S,r,null)}}u&&ct(e,t,"srcSet",r.srcSet,r,null),i&&ct(e,t,"src",r.src,r,null);return;case"input":Ye("invalid",e);var T=m=S=u=null,U=null,K=null;for(i in r)if(r.hasOwnProperty(i)){var ne=r[i];if(ne!=null)switch(i){case"name":u=ne;break;case"type":S=ne;break;case"checked":U=ne;break;case"defaultChecked":K=ne;break;case"value":m=ne;break;case"defaultValue":T=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(o(137,t));break;default:ct(e,t,i,ne,r,null)}}Bf(e,m,T,U,K,S,u,!1);return;case"select":Ye("invalid",e),i=S=m=null;for(u in r)if(r.hasOwnProperty(u)&&(T=r[u],T!=null))switch(u){case"value":m=T;break;case"defaultValue":S=T;break;case"multiple":i=T;default:ct(e,t,u,T,r,null)}t=m,r=S,e.multiple=!!i,t!=null?_r(e,!!i,t,!1):r!=null&&_r(e,!!i,r,!0);return;case"textarea":Ye("invalid",e),m=u=i=null;for(S in r)if(r.hasOwnProperty(S)&&(T=r[S],T!=null))switch(S){case"value":i=T;break;case"defaultValue":u=T;break;case"children":m=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(o(91));break;default:ct(e,t,S,T,r,null)}Hf(e,i,u,m);return;case"option":for(U in r)if(r.hasOwnProperty(U)&&(i=r[U],i!=null))switch(U){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:ct(e,t,U,i,r,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(i=0;i<fs.length;i++)Ye(fs[i],e);break;case"image":Ye("error",e),Ye("load",e);break;case"details":Ye("toggle",e);break;case"embed":case"source":case"link":Ye("error",e),Ye("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in r)if(r.hasOwnProperty(K)&&(i=r[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:ct(e,t,K,i,r,null)}return;default:if(Zo(t)){for(ne in r)r.hasOwnProperty(ne)&&(i=r[ne],i!==void 0&&Iu(e,t,ne,i,r,void 0));return}}for(T in r)r.hasOwnProperty(T)&&(i=r[T],i!=null&&ct(e,t,T,i,r,null))}function db(e,t,r,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,m=null,S=null,T=null,U=null,K=null,ne=null;for(ee in r){var le=r[ee];if(r.hasOwnProperty(ee)&&le!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":U=le;default:i.hasOwnProperty(ee)||ct(e,t,ee,null,i,le)}}for(var Z in i){var ee=i[Z];if(le=r[Z],i.hasOwnProperty(Z)&&(ee!=null||le!=null))switch(Z){case"type":m=ee;break;case"name":u=ee;break;case"checked":K=ee;break;case"defaultChecked":ne=ee;break;case"value":S=ee;break;case"defaultValue":T=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(o(137,t));break;default:ee!==le&&ct(e,t,Z,ee,i,le)}}Xo(e,S,T,U,K,ne,m,u);return;case"select":ee=S=T=Z=null;for(m in r)if(U=r[m],r.hasOwnProperty(m)&&U!=null)switch(m){case"value":break;case"multiple":ee=U;default:i.hasOwnProperty(m)||ct(e,t,m,null,i,U)}for(u in i)if(m=i[u],U=r[u],i.hasOwnProperty(u)&&(m!=null||U!=null))switch(u){case"value":Z=m;break;case"defaultValue":T=m;break;case"multiple":S=m;default:m!==U&&ct(e,t,u,m,i,U)}t=T,r=S,i=ee,Z!=null?_r(e,!!r,Z,!1):!!i!=!!r&&(t!=null?_r(e,!!r,t,!0):_r(e,!!r,r?[]:"",!1));return;case"textarea":ee=Z=null;for(T in r)if(u=r[T],r.hasOwnProperty(T)&&u!=null&&!i.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:ct(e,t,T,null,i,u)}for(S in i)if(u=i[S],m=r[S],i.hasOwnProperty(S)&&(u!=null||m!=null))switch(S){case"value":Z=u;break;case"defaultValue":ee=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==m&&ct(e,t,S,u,i,m)}If(e,Z,ee);return;case"option":for(var Se in r)if(Z=r[Se],r.hasOwnProperty(Se)&&Z!=null&&!i.hasOwnProperty(Se))switch(Se){case"selected":e.selected=!1;break;default:ct(e,t,Se,null,i,Z)}for(U in i)if(Z=i[U],ee=r[U],i.hasOwnProperty(U)&&Z!==ee&&(Z!=null||ee!=null))switch(U){case"selected":e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:ct(e,t,U,Z,i,ee)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Re in r)Z=r[Re],r.hasOwnProperty(Re)&&Z!=null&&!i.hasOwnProperty(Re)&&ct(e,t,Re,null,i,Z);for(K in i)if(Z=i[K],ee=r[K],i.hasOwnProperty(K)&&Z!==ee&&(Z!=null||ee!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:ct(e,t,K,Z,i,ee)}return;default:if(Zo(t)){for(var ut in r)Z=r[ut],r.hasOwnProperty(ut)&&Z!==void 0&&!i.hasOwnProperty(ut)&&Iu(e,t,ut,void 0,i,Z);for(ne in i)Z=i[ne],ee=r[ne],!i.hasOwnProperty(ne)||Z===ee||Z===void 0&&ee===void 0||Iu(e,t,ne,Z,i,ee);return}}for(var F in r)Z=r[F],r.hasOwnProperty(F)&&Z!=null&&!i.hasOwnProperty(F)&&ct(e,t,F,null,i,Z);for(le in i)Z=i[le],ee=r[le],!i.hasOwnProperty(le)||Z===ee||Z==null&&ee==null||ct(e,t,le,Z,i,ee)}function Ph(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,r=performance.getEntriesByType("resource"),i=0;i<r.length;i++){var u=r[i],m=u.transferSize,S=u.initiatorType,T=u.duration;if(m&&T&&Ph(S)){for(S=0,T=u.responseEnd,i+=1;i<r.length;i++){var U=r[i],K=U.startTime;if(K>T)break;var ne=U.transferSize,le=U.initiatorType;ne&&Ph(le)&&(U=U.responseEnd,S+=ne*(U<T?1:(T-K)/(U-K)))}if(--i,t+=8*(m+S)/(u.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 Hu=null,Uu=null;function Wi(e){return e.nodeType===9?e:e.ownerDocument}function Vh(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 Fh(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 $u(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Pu=null;function pb(){var e=window.event;return e&&e.type==="popstate"?e===Pu?!1:(Pu=e,!0):(Pu=null,!1)}var Gh=typeof setTimeout=="function"?setTimeout:void 0,mb=typeof clearTimeout=="function"?clearTimeout:void 0,Wh=typeof Promise=="function"?Promise:void 0,hb=typeof queueMicrotask=="function"?queueMicrotask:typeof Wh<"u"?function(e){return Wh.resolve(null).then(e).catch(xb)}:Gh;function xb(e){setTimeout(function(){throw e})}function Fa(e){return e==="head"}function qh(e,t){var r=t,i=0;do{var u=r.nextSibling;if(e.removeChild(r),u&&u.nodeType===8)if(r=u.data,r==="/$"||r==="/&"){if(i===0){e.removeChild(u),pl(t);return}i--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")i++;else if(r==="html")ms(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,ms(r);for(var m=r.firstChild;m;){var S=m.nextSibling,T=m.nodeName;m[Ll]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&m.rel.toLowerCase()==="stylesheet"||r.removeChild(m),m=S}}else r==="body"&&ms(e.ownerDocument.body);r=u}while(r);pl(t)}function Yh(e,t){var r=e;e=0;do{var i=r.nextSibling;if(r.nodeType===1?t?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(t?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),i&&i.nodeType===8)if(r=i.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=i}while(r)}function Vu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var r=t;switch(t=t.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Vu(r),Yo(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function gb(e,t,r,i){for(;e.nodeType===1;){var u=r;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Ll])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var m=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=_n(e.nextSibling),e===null)break}return null}function vb(e,t,r){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=_n(e.nextSibling),e===null))return null;return e}function Kh(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=_n(e.nextSibling),e===null))return null;return e}function Fu(e){return e.data==="$?"||e.data==="$~"}function Gu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function yb(e,t){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||r.readyState!=="loading")t();else{var i=function(){t(),r.removeEventListener("DOMContentLoaded",i)};r.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function _n(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 Wu=null;function Xh(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(t===0)return _n(e.nextSibling);t--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||t++}e=e.nextSibling}return null}function Qh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(t===0)return e;t--}else r!=="/$"&&r!=="/&"||t++}e=e.previousSibling}return null}function Zh(e,t,r){switch(t=Wi(r),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 ms(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Yo(e)}var On=new Map,Jh=new Set;function qi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Sa=I.d;I.d={f:bb,r:Sb,D:jb,C:kb,L:wb,m:Cb,X:Nb,S:Eb,M:Tb};function bb(){var e=Sa.f(),t=Ii();return e||t}function Sb(e){var t=Lr(e);t!==null&&t.tag===5&&t.type==="form"?xm(t):Sa.r(e)}var ul=typeof document>"u"?null:document;function ex(e,t,r){var i=ul;if(i&&typeof t=="string"&&t){var u=Tn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof r=="string"&&(u+='[crossorigin="'+r+'"]'),Jh.has(u)||(Jh.add(u),e={rel:e,crossOrigin:r,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Kt(t,"link",e),Pt(t),i.head.appendChild(t)))}}function jb(e){Sa.D(e),ex("dns-prefetch",e,null)}function kb(e,t){Sa.C(e,t),ex("preconnect",e,t)}function wb(e,t,r){Sa.L(e,t,r);var i=ul;if(i&&e&&t){var u='link[rel="preload"][as="'+Tn(t)+'"]';t==="image"&&r&&r.imageSrcSet?(u+='[imagesrcset="'+Tn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(u+='[imagesizes="'+Tn(r.imageSizes)+'"]')):u+='[href="'+Tn(e)+'"]';var m=u;switch(t){case"style":m=dl(e);break;case"script":m=fl(e)}On.has(m)||(e=v({rel:"preload",href:t==="image"&&r&&r.imageSrcSet?void 0:e,as:t},r),On.set(m,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(hs(m))||t==="script"&&i.querySelector(xs(m))||(t=i.createElement("link"),Kt(t,"link",e),Pt(t),i.head.appendChild(t)))}}function Cb(e,t){Sa.m(e,t);var r=ul;if(r&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Tn(i)+'"][href="'+Tn(e)+'"]',m=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=fl(e)}if(!On.has(m)&&(e=v({rel:"modulepreload",href:e},t),On.set(m,e),r.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(xs(m)))return}i=r.createElement("link"),Kt(i,"link",e),Pt(i),r.head.appendChild(i)}}}function Eb(e,t,r){Sa.S(e,t,r);var i=ul;if(i&&e){var u=zr(i).hoistableStyles,m=dl(e);t=t||"default";var S=u.get(m);if(!S){var T={loading:0,preload:null};if(S=i.querySelector(hs(m)))T.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},r),(r=On.get(m))&&qu(e,r);var U=S=i.createElement("link");Pt(U),Kt(U,"link",e),U._p=new Promise(function(K,ne){U.onload=K,U.onerror=ne}),U.addEventListener("load",function(){T.loading|=1}),U.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Yi(S,t,i)}S={type:"stylesheet",instance:S,count:1,state:T},u.set(m,S)}}}function Nb(e,t){Sa.X(e,t);var r=ul;if(r&&e){var i=zr(r).hoistableScripts,u=fl(e),m=i.get(u);m||(m=r.querySelector(xs(u)),m||(e=v({src:e,async:!0},t),(t=On.get(u))&&Yu(e,t),m=r.createElement("script"),Pt(m),Kt(m,"link",e),r.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(u,m))}}function Tb(e,t){Sa.M(e,t);var r=ul;if(r&&e){var i=zr(r).hoistableScripts,u=fl(e),m=i.get(u);m||(m=r.querySelector(xs(u)),m||(e=v({src:e,async:!0,type:"module"},t),(t=On.get(u))&&Yu(e,t),m=r.createElement("script"),Pt(m),Kt(m,"link",e),r.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},i.set(u,m))}}function tx(e,t,r,i){var u=(u=xe.current)?qi(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(t=dl(r.href),r=zr(u).hoistableStyles,i=r.get(t),i||(i={type:"style",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=dl(r.href);var m=zr(u).hoistableStyles,S=m.get(e);if(S||(u=u.ownerDocument||u,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,S),(m=u.querySelector(hs(e)))&&!m._p&&(S.instance=m,S.state.loading=5),On.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},On.set(e,r),m||Rb(u,e,r,S.state))),t&&i===null)throw Error(o(528,""));return S}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=r.async,r=r.src,typeof r=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fl(r),r=zr(u).hoistableScripts,i=r.get(t),i||(i={type:"script",instance:null,count:0,state:null},r.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function dl(e){return'href="'+Tn(e)+'"'}function hs(e){return'link[rel="stylesheet"]['+e+"]"}function nx(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function Rb(e,t,r,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Kt(t,"link",r),Pt(t),e.head.appendChild(t))}function fl(e){return'[src="'+Tn(e)+'"]'}function xs(e){return"script[async]"+e}function ax(e,t,r){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Tn(r.href)+'"]');if(i)return t.instance=i,Pt(i),i;var u=v({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Pt(i),Kt(i,"style",u),Yi(i,r.precedence,e),t.instance=i;case"stylesheet":u=dl(r.href);var m=e.querySelector(hs(u));if(m)return t.state.loading|=4,t.instance=m,Pt(m),m;i=nx(r),(u=On.get(u))&&qu(i,u),m=(e.ownerDocument||e).createElement("link"),Pt(m);var S=m;return S._p=new Promise(function(T,U){S.onload=T,S.onerror=U}),Kt(m,"link",i),t.state.loading|=4,Yi(m,r.precedence,e),t.instance=m;case"script":return m=fl(r.src),(u=e.querySelector(xs(m)))?(t.instance=u,Pt(u),u):(i=r,(u=On.get(m))&&(i=v({},r),Yu(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),Pt(u),Kt(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,Yi(i,r.precedence,e));return t.instance}function Yi(e,t,r){for(var i=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,m=u,S=0;S<i.length;S++){var T=i[S];if(T.dataset.precedence===t)m=T;else if(m!==u)break}m?m.parentNode.insertBefore(e,m.nextSibling):(t=r.nodeType===9?r.head:r,t.insertBefore(e,t.firstChild))}function qu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Yu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ki=null;function rx(e,t,r){if(Ki===null){var i=new Map,u=Ki=new Map;u.set(r,i)}else u=Ki,i=u.get(r),i||(i=new Map,u.set(r,i));if(i.has(e))return i;for(i.set(e,null),r=r.getElementsByTagName(e),u=0;u<r.length;u++){var m=r[u];if(!(m[Ll]||m[Gt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var S=m.getAttribute(t)||"";S=e+S;var T=i.get(S);T?T.push(m):i.set(S,[m])}}return i}function lx(e,t,r){e=e.ownerDocument||e,e.head.insertBefore(r,t==="title"?e.querySelector("head > title"):null)}function Ab(e,t,r){if(r===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 sx(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Mb(e,t,r,i){if(r.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var u=dl(i.href),m=t.querySelector(hs(u));if(m){t=m._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Xi.bind(e),t.then(e,e)),r.state.loading|=4,r.instance=m,Pt(m);return}m=t.ownerDocument||t,i=nx(i),(u=On.get(u))&&qu(i,u),m=m.createElement("link"),Pt(m);var S=m;S._p=new Promise(function(T,U){S.onload=T,S.onerror=U}),Kt(m,"link",i),r.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,t),(t=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Xi.bind(e),t.addEventListener("load",r),t.addEventListener("error",r))}}var Ku=0;function Lb(e,t){return e.stylesheets&&e.count===0&&Zi(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var i=setTimeout(function(){if(e.stylesheets&&Zi(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+t);0<e.imgBytes&&Ku===0&&(Ku=62500*fb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zi(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>Ku?50:800)+t);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function Xi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qi=null;function Zi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qi=new Map,t.forEach(zb,e),Qi=null,Xi.call(e))}function zb(e,t){if(!(t.state.loading&4)){var r=Qi.get(e);if(r)var i=r.get(null);else{r=new Map,Qi.set(e,r);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<u.length;m++){var S=u[m];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(r.set(S.dataset.precedence,S),i=S)}i&&r.set(null,i)}u=t.instance,S=u.getAttribute("data-precedence"),m=r.get(S)||i,m===i&&r.set(null,u),r.set(S,u),this.count++,i=Xi.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),m?m.parentNode.insertBefore(u,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var gs={$$typeof:_,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function Db(e,t,r,i,u,m,S,T,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=Fo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fo(0),this.hiddenUpdates=Fo(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=m,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function ix(e,t,r,i,u,m,S,T,U,K,ne,le){return e=new Db(e,t,r,S,U,K,ne,le,T),t=1,m===!0&&(t|=24),m=hn(3,null,null,t),e.current=m,m.stateNode=e,t=Tc(),t.refCount++,e.pooledCache=t,t.refCount++,m.memoizedState={element:i,isDehydrated:r,cache:t},Lc(m),e}function ox(e){return e?(e=Vr,e):Vr}function cx(e,t,r,i,u,m){u=ox(u),i.context===null?i.context=u:i.pendingContext=u,i=za(t),i.payload={element:r},m=m===void 0?null:m,m!==null&&(i.callback=m),r=Da(e,i,t),r!==null&&(pn(r,e,t),Kl(r,e,t))}function ux(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function Xu(e,t){ux(e,t),(e=e.alternate)&&ux(e,t)}function dx(e){if(e.tag===13||e.tag===31){var t=ur(e,67108864);t!==null&&pn(t,e,67108864),Xu(e,67108864)}}function fx(e){if(e.tag===13||e.tag===31){var t=bn();t=Go(t);var r=ur(e,t);r!==null&&pn(r,e,t),Xu(e,t)}}var Ji=!0;function _b(e,t,r,i){var u=M.T;M.T=null;var m=I.p;try{I.p=2,Qu(e,t,r,i)}finally{I.p=m,M.T=u}}function Ob(e,t,r,i){var u=M.T;M.T=null;var m=I.p;try{I.p=8,Qu(e,t,r,i)}finally{I.p=m,M.T=u}}function Qu(e,t,r,i){if(Ji){var u=Zu(i);if(u===null)Bu(e,t,i,eo,r),mx(e,i);else if(Ib(u,e,t,r,i))i.stopPropagation();else if(mx(e,i),t&4&&-1<Bb.indexOf(e)){for(;u!==null;){var m=Lr(u);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var S=Nt(m.pendingLanes);if(S!==0){var T=m;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var U=1<<31-St(S);T.entanglements[1]|=U,S&=~U}Qn(m),(nt&6)===0&&(Oi=rt()+500,ds(0))}}break;case 31:case 13:T=ur(m,2),T!==null&&pn(T,m,2),Ii(),Xu(m,2)}if(m=Zu(i),m===null&&Bu(e,t,i,eo,r),m===u)break;u=m}u!==null&&i.stopPropagation()}else Bu(e,t,i,null,r)}}function Zu(e){return e=ec(e),Ju(e)}var eo=null;function Ju(e){if(eo=null,e=Mr(e),e!==null){var t=f(e);if(t===null)e=null;else{var r=t.tag;if(r===13){if(e=d(t),e!==null)return e;e=null}else if(r===31){if(e=h(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return eo=e,null}function px(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 ve:return 2;case At:return 8;case De:case gt:return 32;case Xt:return 268435456;default:return 32}default:return 32}}var ed=!1,Ga=null,Wa=null,qa=null,vs=new Map,ys=new Map,Ya=[],Bb="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 mx(e,t){switch(e){case"focusin":case"focusout":Ga=null;break;case"dragenter":case"dragleave":Wa=null;break;case"mouseover":case"mouseout":qa=null;break;case"pointerover":case"pointerout":vs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ys.delete(t.pointerId)}}function bs(e,t,r,i,u,m){return e===null||e.nativeEvent!==m?(e={blockedOn:t,domEventName:r,eventSystemFlags:i,nativeEvent:m,targetContainers:[u]},t!==null&&(t=Lr(t),t!==null&&dx(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Ib(e,t,r,i,u){switch(t){case"focusin":return Ga=bs(Ga,e,t,r,i,u),!0;case"dragenter":return Wa=bs(Wa,e,t,r,i,u),!0;case"mouseover":return qa=bs(qa,e,t,r,i,u),!0;case"pointerover":var m=u.pointerId;return vs.set(m,bs(vs.get(m)||null,e,t,r,i,u)),!0;case"gotpointercapture":return m=u.pointerId,ys.set(m,bs(ys.get(m)||null,e,t,r,i,u)),!0}return!1}function hx(e){var t=Mr(e.target);if(t!==null){var r=f(t);if(r!==null){if(t=r.tag,t===13){if(t=d(r),t!==null){e.blockedOn=t,Rf(e.priority,function(){fx(r)});return}}else if(t===31){if(t=h(r),t!==null){e.blockedOn=t,Rf(e.priority,function(){fx(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function to(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Zu(e.nativeEvent);if(r===null){r=e.nativeEvent;var i=new r.constructor(r.type,r);Jo=i,r.target.dispatchEvent(i),Jo=null}else return t=Lr(r),t!==null&&dx(t),e.blockedOn=r,!1;t.shift()}return!0}function xx(e,t,r){to(e)&&r.delete(t)}function Hb(){ed=!1,Ga!==null&&to(Ga)&&(Ga=null),Wa!==null&&to(Wa)&&(Wa=null),qa!==null&&to(qa)&&(qa=null),vs.forEach(xx),ys.forEach(xx)}function no(e,t){e.blockedOn===t&&(e.blockedOn=null,ed||(ed=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Hb)))}var ao=null;function gx(e){ao!==e&&(ao=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){ao===e&&(ao=null);for(var t=0;t<e.length;t+=3){var r=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(Ju(i||r)===null)continue;break}var m=Lr(r);m!==null&&(e.splice(t,3),t-=3,Zc(m,{pending:!0,data:u,method:r.method,action:i},i,u))}}))}function pl(e){function t(U){return no(U,e)}Ga!==null&&no(Ga,e),Wa!==null&&no(Wa,e),qa!==null&&no(qa,e),vs.forEach(t),ys.forEach(t);for(var r=0;r<Ya.length;r++){var i=Ya[r];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Ya.length&&(r=Ya[0],r.blockedOn===null);)hx(r),r.blockedOn===null&&Ya.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(i=0;i<r.length;i+=3){var u=r[i],m=r[i+1],S=u[sn]||null;if(typeof m=="function")S||gx(r);else if(S){var T=null;if(m&&m.hasAttribute("formAction")){if(u=m,S=m[sn]||null)T=S.formAction;else if(Ju(u)!==null)continue}else T=S.action;typeof T=="function"?r[i+1]=T:(r.splice(i,3),i-=3),gx(r)}}}function vx(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(S){return u=S})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(r,20)}function r(){if(!i&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(r,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function td(e){this._internalRoot=e}ro.prototype.render=td.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var r=t.current,i=bn();cx(r,i,e,t,null,null)},ro.prototype.unmount=td.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;cx(e.current,2,null,e,null,null),Ii(),t[Ar]=null}};function ro(e){this._internalRoot=e}ro.prototype.unstable_scheduleHydration=function(e){if(e){var t=Tf();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Ya.length&&t!==0&&t<Ya[r].priority;r++);Ya.splice(r,0,e),r===0&&hx(e)}};var yx=l.version;if(yx!=="19.2.4")throw Error(o(527,yx,"19.2.4"));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=p(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var Ub={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lo.isDisabled&&lo.supportsFiber)try{na=lo.inject(Ub),Et=lo}catch{}}return js.createRoot=function(e,t){if(!c(e))throw Error(o(299));var r=!1,i="",u=Em,m=Nm,S=Tm;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(m=t.onCaughtError),t.onRecoverableError!==void 0&&(S=t.onRecoverableError)),t=ix(e,1,!1,null,null,r,i,null,u,m,S,vx),e[Ar]=t.current,Ou(e),new td(t)},js.hydrateRoot=function(e,t,r){if(!c(e))throw Error(o(299));var i=!1,u="",m=Em,S=Nm,T=Tm,U=null;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(u=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(S=r.onCaughtError),r.onRecoverableError!==void 0&&(T=r.onRecoverableError),r.formState!==void 0&&(U=r.formState)),t=ix(e,1,!0,t,r??null,i,u,U,m,S,T,vx),t.context=ox(null),r=t.current,i=bn(),i=Go(i),u=za(i),u.callback=null,Da(r,u,i),r=i,t.current.lanes=r,Ml(t,r),Qn(t),e[Ar]=t.current,Ou(e),new ro(t)},js.version="19.2.4",js}var Rx;function Kb(){if(Rx)return rd.exports;Rx=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(l){console.error(l)}}return n(),rd.exports=Yb(),rd.exports}var Xb=Kb();/**
51
- * react-router v7.13.1
52
- *
53
- * Copyright (c) Remix Software Inc.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE.md file in the root directory of this source tree.
57
- *
58
- * @license MIT
59
- */var Ax="popstate";function Mx(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function Qb(n={}){function l(c,f){let{pathname:d="/",search:h="",hash:x=""}=kl(c.location.hash.substring(1));return!d.startsWith("/")&&!d.startsWith(".")&&(d="/"+d),Od("",{pathname:d,search:h,hash:x},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function s(c,f){let d=c.document.querySelector("base"),h="";if(d&&d.getAttribute("href")){let x=c.location.href,p=x.indexOf("#");h=p===-1?x:x.slice(0,p)}return h+"#"+(typeof f=="string"?f:zs(f))}function o(c,f){Wn(c.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(f)})`)}return Jb(l,s,o,n)}function Ut(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function Wn(n,l){if(!n){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function Zb(){return Math.random().toString(36).substring(2,10)}function Lx(n,l){return{usr:n.state,key:n.key,idx:l,masked:n.unstable_mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Od(n,l,s=null,o,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof l=="string"?kl(l):l,state:s,key:l&&l.key||o||Zb(),unstable_mask:c}}function zs({pathname:n="/",search:l="",hash:s=""}){return l&&l!=="?"&&(n+=l.charAt(0)==="?"?l:"?"+l),s&&s!=="#"&&(n+=s.charAt(0)==="#"?s:"#"+s),n}function kl(n){let l={};if(n){let s=n.indexOf("#");s>=0&&(l.hash=n.substring(s),n=n.substring(0,s));let o=n.indexOf("?");o>=0&&(l.search=n.substring(o),n=n.substring(0,o)),n&&(l.pathname=n)}return l}function Jb(n,l,s,o={}){let{window:c=document.defaultView,v5Compat:f=!1}=o,d=c.history,h="POP",x=null,p=y();p==null&&(p=0,d.replaceState({...d.state,idx:p},""));function y(){return(d.state||{idx:null}).idx}function v(){h="POP";let C=y(),w=C==null?null:C-p;p=C,x&&x({action:h,location:N.location,delta:w})}function b(C,w){h="PUSH";let A=Mx(C)?C:Od(N.location,C,w);s&&s(A,C),p=y()+1;let _=Lx(A,p),H=N.createHref(A.unstable_mask||A);try{d.pushState(_,"",H)}catch(L){if(L instanceof DOMException&&L.name==="DataCloneError")throw L;c.location.assign(H)}f&&x&&x({action:h,location:N.location,delta:1})}function j(C,w){h="REPLACE";let A=Mx(C)?C:Od(N.location,C,w);s&&s(A,C),p=y();let _=Lx(A,p),H=N.createHref(A.unstable_mask||A);d.replaceState(_,"",H),f&&x&&x({action:h,location:N.location,delta:0})}function k(C){return e0(C)}let N={get action(){return h},get location(){return n(c,d)},listen(C){if(x)throw new Error("A history only accepts one active listener");return c.addEventListener(Ax,v),x=C,()=>{c.removeEventListener(Ax,v),x=null}},createHref(C){return l(c,C)},createURL:k,encodeLocation(C){let w=k(C);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:b,replace:j,go(C){return d.go(C)}};return N}function e0(n,l=!1){let s="http://localhost";typeof window<"u"&&(s=window.location.origin!=="null"?window.location.origin:window.location.href),Ut(s,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:zs(n);return o=o.replace(/ $/,"%20"),!l&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function Xg(n,l,s="/"){return t0(n,l,s,!1)}function t0(n,l,s,o){let c=typeof l=="string"?kl(l):l,f=ka(c.pathname||"/",s);if(f==null)return null;let d=Qg(n);n0(d);let h=null;for(let x=0;h==null&&x<d.length;++x){let p=p0(f);h=d0(d[x],p,o)}return h}function Qg(n,l=[],s=[],o="",c=!1){let f=(d,h,x=c,p)=>{let y={relativePath:p===void 0?d.path||"":p,caseSensitive:d.caseSensitive===!0,childrenIndex:h,route:d};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(o)&&x)return;Ut(y.relativePath.startsWith(o),`Absolute route path "${y.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(o.length)}let v=ea([o,y.relativePath]),b=s.concat(y);d.children&&d.children.length>0&&(Ut(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),Qg(d.children,l,b,v,x)),!(d.path==null&&!d.index)&&l.push({path:v,score:c0(v,d.index),routesMeta:b})};return n.forEach((d,h)=>{var x;if(d.path===""||!((x=d.path)!=null&&x.includes("?")))f(d,h);else for(let p of Zg(d.path))f(d,h,!0,p)}),l}function Zg(n){let l=n.split("/");if(l.length===0)return[];let[s,...o]=l,c=s.endsWith("?"),f=s.replace(/\?$/,"");if(o.length===0)return c?[f,""]:[f];let d=Zg(o.join("/")),h=[];return h.push(...d.map(x=>x===""?f:[f,x].join("/"))),c&&h.push(...d),h.map(x=>n.startsWith("/")&&x===""?"/":x)}function n0(n){n.sort((l,s)=>l.score!==s.score?s.score-l.score:u0(l.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var a0=/^:[\w-]+$/,r0=3,l0=2,s0=1,i0=10,o0=-2,zx=n=>n==="*";function c0(n,l){let s=n.split("/"),o=s.length;return s.some(zx)&&(o+=o0),l&&(o+=l0),s.filter(c=>!zx(c)).reduce((c,f)=>c+(a0.test(f)?r0:f===""?s0:i0),o)}function u0(n,l){return n.length===l.length&&n.slice(0,-1).every((o,c)=>o===l[c])?n[n.length-1]-l[l.length-1]:0}function d0(n,l,s=!1){let{routesMeta:o}=n,c={},f="/",d=[];for(let h=0;h<o.length;++h){let x=o[h],p=h===o.length-1,y=f==="/"?l:l.slice(f.length)||"/",v=Co({path:x.relativePath,caseSensitive:x.caseSensitive,end:p},y),b=x.route;if(!v&&p&&s&&!o[o.length-1].route.index&&(v=Co({path:x.relativePath,caseSensitive:x.caseSensitive,end:!1},y)),!v)return null;Object.assign(c,v.params),d.push({params:c,pathname:ea([f,v.pathname]),pathnameBase:g0(ea([f,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(f=ea([f,v.pathnameBase]))}return d}function Co(n,l){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[s,o]=f0(n.path,n.caseSensitive,n.end),c=l.match(s);if(!c)return null;let f=c[0],d=f.replace(/(.)\/+$/,"$1"),h=c.slice(1);return{params:o.reduce((p,{paramName:y,isOptional:v},b)=>{if(y==="*"){let k=h[b]||"";d=f.slice(0,f.length-k.length).replace(/(.)\/+$/,"$1")}const j=h[b];return v&&!j?p[y]=void 0:p[y]=(j||"").replace(/%2F/g,"/"),p},{}),pathname:f,pathnameBase:d,pattern:n}}function f0(n,l=!1,s=!0){Wn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let o=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,h,x,p,y)=>{if(o.push({paramName:h,isOptional:x!=null}),x){let v=y.charAt(p+d.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(o.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,l?void 0:"i"),o]}function p0(n){try{return n.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Wn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),n}}function ka(n,l){if(l==="/")return n;if(!n.toLowerCase().startsWith(l.toLowerCase()))return null;let s=l.endsWith("/")?l.length-1:l.length,o=n.charAt(s);return o&&o!=="/"?null:n.slice(s)||"/"}var m0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function h0(n,l="/"){let{pathname:s,search:o="",hash:c=""}=typeof n=="string"?kl(n):n,f;return s?(s=s.replace(/\/\/+/g,"/"),s.startsWith("/")?f=Dx(s.substring(1),"/"):f=Dx(s,l)):f=l,{pathname:f,search:v0(o),hash:y0(c)}}function Dx(n,l){let s=l.replace(/\/+$/,"").split("/");return n.split("/").forEach(c=>{c===".."?s.length>1&&s.pop():c!=="."&&s.push(c)}),s.length>1?s.join("/"):"/"}function od(n,l,s,o){return`Cannot include a '${n}' character in a manually specified \`to.${l}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function x0(n){return n.filter((l,s)=>s===0||l.route.path&&l.route.path.length>0)}function Jg(n){let l=x0(n);return l.map((s,o)=>o===l.length-1?s.pathname:s.pathnameBase)}function Jd(n,l,s,o=!1){let c;typeof n=="string"?c=kl(n):(c={...n},Ut(!c.pathname||!c.pathname.includes("?"),od("?","pathname","search",c)),Ut(!c.pathname||!c.pathname.includes("#"),od("#","pathname","hash",c)),Ut(!c.search||!c.search.includes("#"),od("#","search","hash",c)));let f=n===""||c.pathname==="",d=f?"/":c.pathname,h;if(d==null)h=s;else{let v=l.length-1;if(!o&&d.startsWith("..")){let b=d.split("/");for(;b[0]==="..";)b.shift(),v-=1;c.pathname=b.join("/")}h=v>=0?l[v]:"/"}let x=h0(c,h),p=d&&d!=="/"&&d.endsWith("/"),y=(f||d===".")&&s.endsWith("/");return!x.pathname.endsWith("/")&&(p||y)&&(x.pathname+="/"),x}var ea=n=>n.join("/").replace(/\/\/+/g,"/"),g0=n=>n.replace(/\/+$/,"").replace(/^\/*/,"/"),v0=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,y0=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,b0=class{constructor(n,l,s,o=!1){this.status=n,this.statusText=l||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function S0(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function j0(n){return n.map(l=>l.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var ev=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tv(n,l){let s=n;if(typeof s!="string"||!m0.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,c=!1;if(ev)try{let f=new URL(window.location.href),d=s.startsWith("//")?new URL(f.protocol+s):new URL(s),h=ka(d.pathname,l);d.origin===f.origin&&h!=null?s=h+d.search+d.hash:c=!0}catch{Wn(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var nv=["POST","PUT","PATCH","DELETE"];new Set(nv);var k0=["GET",...nv];new Set(k0);var wl=g.createContext(null);wl.displayName="DataRouter";var Mo=g.createContext(null);Mo.displayName="DataRouterState";var w0=g.createContext(!1),av=g.createContext({isTransitioning:!1});av.displayName="ViewTransition";var C0=g.createContext(new Map);C0.displayName="Fetchers";var E0=g.createContext(null);E0.displayName="Await";var Hn=g.createContext(null);Hn.displayName="Navigation";var Lo=g.createContext(null);Lo.displayName="Location";var wa=g.createContext({outlet:null,matches:[],isDataRoute:!1});wa.displayName="Route";var ef=g.createContext(null);ef.displayName="RouteError";var rv="REACT_ROUTER_ERROR",N0="REDIRECT",T0="ROUTE_ERROR_RESPONSE";function R0(n){if(n.startsWith(`${rv}:${N0}:{`))try{let l=JSON.parse(n.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function A0(n){if(n.startsWith(`${rv}:${T0}:{`))try{let l=JSON.parse(n.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new b0(l.status,l.statusText,l.data)}catch{}}function M0(n,{relative:l}={}){Ut($s(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=g.useContext(Hn),{hash:c,pathname:f,search:d}=Ps(n,{relative:l}),h=f;return s!=="/"&&(h=f==="/"?s:ea([s,f])),o.createHref({pathname:h,search:d,hash:c})}function $s(){return g.useContext(Lo)!=null}function er(){return Ut($s(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(Lo).location}var lv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function sv(n){g.useContext(Hn).static||g.useLayoutEffect(n)}function L0(){let{isDataRoute:n}=g.useContext(wa);return n?G0():z0()}function z0(){Ut($s(),"useNavigate() may be used only in the context of a <Router> component.");let n=g.useContext(wl),{basename:l,navigator:s}=g.useContext(Hn),{matches:o}=g.useContext(wa),{pathname:c}=er(),f=JSON.stringify(Jg(o)),d=g.useRef(!1);return sv(()=>{d.current=!0}),g.useCallback((x,p={})=>{if(Wn(d.current,lv),!d.current)return;if(typeof x=="number"){s.go(x);return}let y=Jd(x,JSON.parse(f),c,p.relative==="path");n==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:ea([l,y.pathname])),(p.replace?s.replace:s.push)(y,p.state,p)},[l,s,f,c,n])}g.createContext(null);function Ps(n,{relative:l}={}){let{matches:s}=g.useContext(wa),{pathname:o}=er(),c=JSON.stringify(Jg(s));return g.useMemo(()=>Jd(n,JSON.parse(c),o,l==="path"),[n,c,o,l])}function D0(n,l,s){Ut($s(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=g.useContext(Hn),{matches:c}=g.useContext(wa),f=c[c.length-1],d=f?f.params:{},h=f?f.pathname:"/",x=f?f.pathnameBase:"/",p=f&&f.route;{let C=p&&p.path||"";ov(h,!p||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
60
-
61
- Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let y=er(),v;v=y;let b=v.pathname||"/",j=b;if(x!=="/"){let C=x.replace(/^\//,"").split("/");j="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let k=Xg(n,{pathname:j});return Wn(p||k!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),Wn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),H0(k&&k.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:ea([x,o.encodeLocation?o.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?x:ea([x,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),c,s)}function _0(){let n=F0(),l=S0(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),s=n instanceof Error?n.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},f={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",n),d=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:f},"ErrorBoundary")," or"," ",g.createElement("code",{style:f},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},l),s?g.createElement("pre",{style:c},s):null,d)}var O0=g.createElement(_0,null),iv=class extends g.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,l){return l.location!==n.location||l.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:l.error,location:l.location,revalidation:n.revalidation||l.revalidation}}componentDidCatch(n,l){this.props.onError?this.props.onError(n,l):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const s=A0(n.digest);s&&(n=s)}let l=n!==void 0?g.createElement(wa.Provider,{value:this.props.routeContext},g.createElement(ef.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?g.createElement(B0,{error:n},l):l}};iv.contextType=w0;var cd=new WeakMap;function B0({children:n,error:l}){let{basename:s}=g.useContext(Hn);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let o=R0(l.digest);if(o){let c=cd.get(l);if(c)throw c;let f=tv(o.location,s);if(ev&&!cd.get(l))if(f.isExternal||o.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:o.replace}));throw cd.set(l,d),d}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return n}function I0({routeContext:n,match:l,children:s}){let o=g.useContext(wl);return o&&o.static&&o.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=l.route.id),g.createElement(wa.Provider,{value:n},s)}function H0(n,l=[],s){let o=s==null?void 0:s.state;if(n==null){if(!o)return null;if(o.errors)n=o.matches;else if(l.length===0&&!o.initialized&&o.matches.length>0)n=o.matches;else return null}let c=n,f=o==null?void 0:o.errors;if(f!=null){let y=c.findIndex(v=>v.route.id&&(f==null?void 0:f[v.route.id])!==void 0);Ut(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),c=c.slice(0,Math.min(c.length,y+1))}let d=!1,h=-1;if(s&&o){d=o.renderFallback;for(let y=0;y<c.length;y++){let v=c[y];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(h=y),v.route.id){let{loaderData:b,errors:j}=o,k=v.route.loader&&!b.hasOwnProperty(v.route.id)&&(!j||j[v.route.id]===void 0);if(v.route.lazy||k){s.isStatic&&(d=!0),h>=0?c=c.slice(0,h+1):c=[c[0]];break}}}}let x=s==null?void 0:s.onError,p=o&&x?(y,v)=>{var b,j;x(y,{location:o.location,params:((j=(b=o.matches)==null?void 0:b[0])==null?void 0:j.params)??{},unstable_pattern:j0(o.matches),errorInfo:v})}:void 0;return c.reduceRight((y,v,b)=>{let j,k=!1,N=null,C=null;o&&(j=f&&v.route.id?f[v.route.id]:void 0,N=v.route.errorElement||O0,d&&(h<0&&b===0?(ov("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):h===b&&(k=!0,C=v.route.hydrateFallbackElement||null)));let w=l.concat(c.slice(0,b+1)),A=()=>{let _;return j?_=N:k?_=C:v.route.Component?_=g.createElement(v.route.Component,null):v.route.element?_=v.route.element:_=y,g.createElement(I0,{match:v,routeContext:{outlet:y,matches:w,isDataRoute:o!=null},children:_})};return o&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?g.createElement(iv,{location:o.location,revalidation:o.revalidation,component:N,error:j,children:A(),routeContext:{outlet:null,matches:w,isDataRoute:!0},onError:p}):A()},null)}function tf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function U0(n){let l=g.useContext(wl);return Ut(l,tf(n)),l}function $0(n){let l=g.useContext(Mo);return Ut(l,tf(n)),l}function P0(n){let l=g.useContext(wa);return Ut(l,tf(n)),l}function nf(n){let l=P0(n),s=l.matches[l.matches.length-1];return Ut(s.route.id,`${n} can only be used on routes that contain a unique "id"`),s.route.id}function V0(){return nf("useRouteId")}function F0(){var o;let n=g.useContext(ef),l=$0("useRouteError"),s=nf("useRouteError");return n!==void 0?n:(o=l.errors)==null?void 0:o[s]}function G0(){let{router:n}=U0("useNavigate"),l=nf("useNavigate"),s=g.useRef(!1);return sv(()=>{s.current=!0}),g.useCallback(async(c,f={})=>{Wn(s.current,lv),s.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:l,...f}))},[n,l])}var _x={};function ov(n,l,s){!l&&!_x[n]&&(_x[n]=!0,Wn(!1,s))}g.memo(W0);function W0({routes:n,future:l,state:s,isStatic:o,onError:c}){return D0(n,void 0,{state:s,isStatic:o,onError:c})}function q0({basename:n="/",children:l=null,location:s,navigationType:o="POP",navigator:c,static:f=!1,unstable_useTransitions:d}){Ut(!$s(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=n.replace(/^\/*/,"/"),x=g.useMemo(()=>({basename:h,navigator:c,static:f,unstable_useTransitions:d,future:{}}),[h,c,f,d]);typeof s=="string"&&(s=kl(s));let{pathname:p="/",search:y="",hash:v="",state:b=null,key:j="default",unstable_mask:k}=s,N=g.useMemo(()=>{let C=ka(p,h);return C==null?null:{location:{pathname:C,search:y,hash:v,state:b,key:j,unstable_mask:k},navigationType:o}},[h,p,y,v,b,j,o,k]);return Wn(N!=null,`<Router basename="${h}"> is not able to match the URL "${p}${y}${v}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:g.createElement(Hn.Provider,{value:x},g.createElement(Lo.Provider,{children:l,value:N}))}var vo="get",yo="application/x-www-form-urlencoded";function zo(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function Y0(n){return zo(n)&&n.tagName.toLowerCase()==="button"}function K0(n){return zo(n)&&n.tagName.toLowerCase()==="form"}function X0(n){return zo(n)&&n.tagName.toLowerCase()==="input"}function Q0(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Z0(n,l){return n.button===0&&(!l||l==="_self")&&!Q0(n)}var so=null;function J0(){if(so===null)try{new FormData(document.createElement("form"),0),so=!1}catch{so=!0}return so}var eS=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ud(n){return n!=null&&!eS.has(n)?(Wn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yo}"`),null):n}function tS(n,l){let s,o,c,f,d;if(K0(n)){let h=n.getAttribute("action");o=h?ka(h,l):null,s=n.getAttribute("method")||vo,c=ud(n.getAttribute("enctype"))||yo,f=new FormData(n)}else if(Y0(n)||X0(n)&&(n.type==="submit"||n.type==="image")){let h=n.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let x=n.getAttribute("formaction")||h.getAttribute("action");if(o=x?ka(x,l):null,s=n.getAttribute("formmethod")||h.getAttribute("method")||vo,c=ud(n.getAttribute("formenctype"))||ud(h.getAttribute("enctype"))||yo,f=new FormData(h,n),!J0()){let{name:p,type:y,value:v}=n;if(y==="image"){let b=p?`${p}.`:"";f.append(`${b}x`,"0"),f.append(`${b}y`,"0")}else p&&f.append(p,v)}}else{if(zo(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=vo,o=null,c=yo,d=n}return f&&c==="text/plain"&&(d=f,f=void 0),{action:o,method:s.toLowerCase(),encType:c,formData:f,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function af(n,l){if(n===!1||n===null||typeof n>"u")throw new Error(l)}function nS(n,l,s,o){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return s?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:l&&ka(c.pathname,l)==="/"?c.pathname=`${l.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function aS(n,l){if(n.id in l)return l[n.id];try{let s=await import(n.module);return l[n.id]=s,s}catch(s){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function rS(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function lS(n,l,s){let o=await Promise.all(n.map(async c=>{let f=l.routes[c.route.id];if(f){let d=await aS(f,s);return d.links?d.links():[]}return[]}));return cS(o.flat(1).filter(rS).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Ox(n,l,s,o,c,f){let d=(x,p)=>s[p]?x.route.id!==s[p].route.id:!0,h=(x,p)=>{var y;return s[p].pathname!==x.pathname||((y=s[p].route.path)==null?void 0:y.endsWith("*"))&&s[p].params["*"]!==x.params["*"]};return f==="assets"?l.filter((x,p)=>d(x,p)||h(x,p)):f==="data"?l.filter((x,p)=>{var v;let y=o.routes[x.route.id];if(!y||!y.hasLoader)return!1;if(d(x,p)||h(x,p))return!0;if(x.route.shouldRevalidate){let b=x.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((v=s[0])==null?void 0:v.params)||{},nextUrl:new URL(n,window.origin),nextParams:x.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function sS(n,l,{includeHydrateFallback:s}={}){return iS(n.map(o=>{let c=l.routes[o.route.id];if(!c)return[];let f=[c.module];return c.clientActionModule&&(f=f.concat(c.clientActionModule)),c.clientLoaderModule&&(f=f.concat(c.clientLoaderModule)),s&&c.hydrateFallbackModule&&(f=f.concat(c.hydrateFallbackModule)),c.imports&&(f=f.concat(c.imports)),f}).flat(1))}function iS(n){return[...new Set(n)]}function oS(n){let l={},s=Object.keys(n).sort();for(let o of s)l[o]=n[o];return l}function cS(n,l){let s=new Set;return new Set(l),n.reduce((o,c)=>{let f=JSON.stringify(oS(c));return s.has(f)||(s.add(f),o.push({key:f,link:c})),o},[])}function cv(){let n=g.useContext(wl);return af(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function uS(){let n=g.useContext(Mo);return af(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var rf=g.createContext(void 0);rf.displayName="FrameworkContext";function uv(){let n=g.useContext(rf);return af(n,"You must render this element inside a <HydratedRouter> element"),n}function dS(n,l){let s=g.useContext(rf),[o,c]=g.useState(!1),[f,d]=g.useState(!1),{onFocus:h,onBlur:x,onMouseEnter:p,onMouseLeave:y,onTouchStart:v}=l,b=g.useRef(null);g.useEffect(()=>{if(n==="render"&&d(!0),n==="viewport"){let N=w=>{w.forEach(A=>{d(A.isIntersecting)})},C=new IntersectionObserver(N,{threshold:.5});return b.current&&C.observe(b.current),()=>{C.disconnect()}}},[n]),g.useEffect(()=>{if(o){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[o]);let j=()=>{c(!0)},k=()=>{c(!1),d(!1)};return s?n!=="intent"?[f,b,{}]:[f,b,{onFocus:ks(h,j),onBlur:ks(x,k),onMouseEnter:ks(p,j),onMouseLeave:ks(y,k),onTouchStart:ks(v,j)}]:[!1,b,{}]}function ks(n,l){return s=>{n&&n(s),s.defaultPrevented||l(s)}}function fS({page:n,...l}){let{router:s}=cv(),o=g.useMemo(()=>Xg(s.routes,n,s.basename),[s.routes,n,s.basename]);return o?g.createElement(mS,{page:n,matches:o,...l}):null}function pS(n){let{manifest:l,routeModules:s}=uv(),[o,c]=g.useState([]);return g.useEffect(()=>{let f=!1;return lS(n,l,s).then(d=>{f||c(d)}),()=>{f=!0}},[n,l,s]),o}function mS({page:n,matches:l,...s}){let o=er(),{future:c,manifest:f,routeModules:d}=uv(),{basename:h}=cv(),{loaderData:x,matches:p}=uS(),y=g.useMemo(()=>Ox(n,l,p,f,o,"data"),[n,l,p,f,o]),v=g.useMemo(()=>Ox(n,l,p,f,o,"assets"),[n,l,p,f,o]),b=g.useMemo(()=>{if(n===o.pathname+o.search+o.hash)return[];let N=new Set,C=!1;if(l.forEach(A=>{var H;let _=f.routes[A.route.id];!_||!_.hasLoader||(!y.some(L=>L.route.id===A.route.id)&&A.route.id in x&&((H=d[A.route.id])!=null&&H.shouldRevalidate)||_.hasClientLoader?C=!0:N.add(A.route.id))}),N.size===0)return[];let w=nS(n,h,c.unstable_trailingSlashAwareDataRequests,"data");return C&&N.size>0&&w.searchParams.set("_routes",l.filter(A=>N.has(A.route.id)).map(A=>A.route.id).join(",")),[w.pathname+w.search]},[h,c.unstable_trailingSlashAwareDataRequests,x,o,f,y,l,n,d]),j=g.useMemo(()=>sS(v,f),[v,f]),k=pS(v);return g.createElement(g.Fragment,null,b.map(N=>g.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...s})),j.map(N=>g.createElement("link",{key:N,rel:"modulepreload",href:N,...s})),k.map(({key:N,link:C})=>g.createElement("link",{key:N,nonce:s.nonce,...C,crossOrigin:C.crossOrigin??s.crossOrigin})))}function hS(...n){return l=>{n.forEach(s=>{typeof s=="function"?s(l):s!=null&&(s.current=l)})}}var xS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{xS&&(window.__reactRouterVersion="7.13.1")}catch{}function gS({basename:n,children:l,unstable_useTransitions:s,window:o}){let c=g.useRef();c.current==null&&(c.current=Qb({window:o,v5Compat:!0}));let f=c.current,[d,h]=g.useState({action:f.action,location:f.location}),x=g.useCallback(p=>{s===!1?h(p):g.startTransition(()=>h(p))},[s]);return g.useLayoutEffect(()=>f.listen(x),[f,x]),g.createElement(q0,{basename:n,children:l,location:d.location,navigationType:d.action,navigator:f,unstable_useTransitions:s})}var dv=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,fv=g.forwardRef(function({onClick:l,discover:s="render",prefetch:o="none",relative:c,reloadDocument:f,replace:d,unstable_mask:h,state:x,target:p,to:y,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:j,...k},N){let{basename:C,navigator:w,unstable_useTransitions:A}=g.useContext(Hn),_=typeof y=="string"&&dv.test(y),H=tv(y,C);y=H.to;let L=M0(y,{relative:c}),$=er(),E=null;if(h){let z=Jd(h,[],$.unstable_mask?$.unstable_mask.pathname:"/",!0);C!=="/"&&(z.pathname=z.pathname==="/"?C:ea([C,z.pathname])),E=w.createHref(z)}let[D,R,B]=dS(o,k),P=SS(y,{replace:d,unstable_mask:h,state:x,target:p,preventScrollReset:v,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:j,unstable_useTransitions:A});function W(z){l&&l(z),z.defaultPrevented||P(z)}let te=!(H.isExternal||f),Q=g.createElement("a",{...k,...B,href:(te?E:void 0)||H.absoluteURL||L,onClick:te?W:l,ref:hS(N,R),target:p,"data-discover":!_&&s==="render"?"true":void 0});return D&&!_?g.createElement(g.Fragment,null,Q,g.createElement(fS,{page:L})):Q});fv.displayName="Link";var vS=g.forwardRef(function({"aria-current":l="page",caseSensitive:s=!1,className:o="",end:c=!1,style:f,to:d,viewTransition:h,children:x,...p},y){let v=Ps(d,{relative:p.relative}),b=er(),j=g.useContext(Mo),{navigator:k,basename:N}=g.useContext(Hn),C=j!=null&&ES(v)&&h===!0,w=k.encodeLocation?k.encodeLocation(v).pathname:v.pathname,A=b.pathname,_=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;s||(A=A.toLowerCase(),_=_?_.toLowerCase():null,w=w.toLowerCase()),_&&N&&(_=ka(_,N)||_);const H=w!=="/"&&w.endsWith("/")?w.length-1:w.length;let L=A===w||!c&&A.startsWith(w)&&A.charAt(H)==="/",$=_!=null&&(_===w||!c&&_.startsWith(w)&&_.charAt(w.length)==="/"),E={isActive:L,isPending:$,isTransitioning:C},D=L?l:void 0,R;typeof o=="function"?R=o(E):R=[o,L?"active":null,$?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let B=typeof f=="function"?f(E):f;return g.createElement(fv,{...p,"aria-current":D,className:R,ref:y,style:B,to:d,viewTransition:h},typeof x=="function"?x(E):x)});vS.displayName="NavLink";var yS=g.forwardRef(({discover:n="render",fetcherKey:l,navigate:s,reloadDocument:o,replace:c,state:f,method:d=vo,action:h,onSubmit:x,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b,...j},k)=>{let{unstable_useTransitions:N}=g.useContext(Hn),C=wS(),w=CS(h,{relative:p}),A=d.toLowerCase()==="get"?"get":"post",_=typeof h=="string"&&dv.test(h),H=L=>{if(x&&x(L),L.defaultPrevented)return;L.preventDefault();let $=L.nativeEvent.submitter,E=($==null?void 0:$.getAttribute("formmethod"))||d,D=()=>C($||L.currentTarget,{fetcherKey:l,method:E,navigate:s,replace:c,state:f,relative:p,preventScrollReset:y,viewTransition:v,unstable_defaultShouldRevalidate:b});N&&s!==!1?g.startTransition(()=>D()):D()};return g.createElement("form",{ref:k,method:A,action:w,onSubmit:o?x:H,...j,"data-discover":!_&&n==="render"?"true":void 0})});yS.displayName="Form";function bS(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pv(n){let l=g.useContext(wl);return Ut(l,bS(n)),l}function SS(n,{target:l,replace:s,unstable_mask:o,state:c,preventScrollReset:f,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:x,unstable_useTransitions:p}={}){let y=L0(),v=er(),b=Ps(n,{relative:d});return g.useCallback(j=>{if(Z0(j,l)){j.preventDefault();let k=s!==void 0?s:zs(v)===zs(b),N=()=>y(n,{replace:k,unstable_mask:o,state:c,preventScrollReset:f,relative:d,viewTransition:h,unstable_defaultShouldRevalidate:x});p?g.startTransition(()=>N()):N()}},[v,y,b,s,o,c,l,n,f,d,h,x,p])}var jS=0,kS=()=>`__${String(++jS)}__`;function wS(){let{router:n}=pv("useSubmit"),{basename:l}=g.useContext(Hn),s=V0(),o=n.fetch,c=n.navigate;return g.useCallback(async(f,d={})=>{let{action:h,method:x,encType:p,formData:y,body:v}=tS(f,l);if(d.navigate===!1){let b=d.fetcherKey||kS();await o(b,s,d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||x,formEncType:d.encType||p,flushSync:d.flushSync})}else await c(d.action||h,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:y,body:v,formMethod:d.method||x,formEncType:d.encType||p,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,l,s])}function CS(n,{relative:l}={}){let{basename:s}=g.useContext(Hn),o=g.useContext(wa);Ut(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),f={...Ps(n||".",{relative:l})},d=er();if(n==null){f.search=d.search;let h=new URLSearchParams(f.search),x=h.getAll("index");if(x.some(y=>y==="")){h.delete("index"),x.filter(v=>v).forEach(v=>h.append("index",v));let y=h.toString();f.search=y?`?${y}`:""}}return(!n||n===".")&&c.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(f.pathname=f.pathname==="/"?s:ea([s,f.pathname])),zs(f)}function ES(n,{relative:l}={}){let s=g.useContext(av);Ut(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=pv("useViewTransitionState"),c=Ps(n,{relative:l});if(!s.isTransitioning)return!1;let f=ka(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=ka(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Co(c.pathname,d)!=null||Co(c.pathname,f)!=null}var Do=Kg();const NS=Yg(Do),TS="modulepreload",RS=function(n){return"/"+n},Bx={},_o=function(l,s,o){let c=Promise.resolve();if(s&&s.length>0){let d=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),x=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));c=d(s.map(p=>{if(p=RS(p),p in Bx)return;Bx[p]=!0;const y=p.endsWith(".css"),v=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${v}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":TS,y||(b.as="script"),b.crossOrigin="",b.href=p,x&&b.setAttribute("nonce",x),document.head.appendChild(b),y)return new Promise((j,k)=>{b.addEventListener("load",j),b.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return c.then(d=>{for(const h of d||[])h.status==="rejected"&&f(h.reason);return l().catch(f)})},Ix={own:"authoring-project",installed:"available-project",global:"available-personal"},Bd=new Set(["available-project","available-personal","available-plugin","authoring-project","authoring-plugin"]);function AS(n){if(typeof n=="string"){if(Bd.has(n))return n;if(Object.prototype.hasOwnProperty.call(Ix,n))return Ix[n]}return"authoring-project"}function MS(n){return n.startsWith("available-")?"available":"authoring"}function LS(n){const l=n.indexOf("-");return n.slice(l+1)}const Za="";class Rs extends Error{constructor(l,s){super(l),this.name="ApiError",this.status=s}}async function We(n,l){const s=await fetch(`${Za}${n}`,l);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Rs(o.error||`HTTP ${s.status}`,s.status)}return s.json()}function tn(n){return typeof n=="string"&&n.length>0?n:null}function zS(n){return typeof n=="number"&&Number.isFinite(n)?n:null}function dd(n){if(!Array.isArray(n))return null;const l=n.filter(s=>typeof s=="string"&&s.length>0);return l.length>0?l:null}function DS(n){const l=n??{};let s;l.origin==="source"||l.origin==="installed"?s=l.origin:(s="source",console.warn(`[api.getSkills] skill ${String(l.plugin)}/${String(l.skill)} has invalid origin=${JSON.stringify(l.origin)}; defaulting to 'source'`));let o;l.scope==="own"||l.scope==="installed"||l.scope==="global"?o=l.scope:o=s==="installed"?"installed":"own";let c;l.installMethod==="authored"||l.installMethod==="copied"||l.installMethod==="symlinked"?c=l.installMethod:c=o==="own"?"authored":"copied";const f=typeof l.scopeV2=="string"&&Bd.has(l.scopeV2)?l.scopeV2:AS(l.scope),d=MS(f),h=LS(f),x=typeof l.precedenceRank=="number"?l.precedenceRank:void 0;let p;l.shadowedBy===null?p=null:typeof l.shadowedBy=="string"&&Bd.has(l.shadowedBy)?p=l.shadowedBy:p=void 0;const y={plugin:typeof l.plugin=="string"?l.plugin:"",skill:typeof l.skill=="string"?l.skill:"",dir:typeof l.dir=="string"?l.dir:"",hasEvals:!!l.hasEvals,hasBenchmark:!!l.hasBenchmark,evalCount:typeof l.evalCount=="number"?l.evalCount:0,assertionCount:typeof l.assertionCount=="number"?l.assertionCount:0,benchmarkStatus:l.benchmarkStatus==="pass"||l.benchmarkStatus==="fail"||l.benchmarkStatus==="pending"||l.benchmarkStatus==="stale"||l.benchmarkStatus==="missing"?l.benchmarkStatus:"missing",lastBenchmark:typeof l.lastBenchmark=="string"?l.lastBenchmark:null,origin:s,scope:o,isSymlink:typeof l.isSymlink=="boolean"?l.isSymlink:!1,symlinkTarget:tn(l.symlinkTarget),installMethod:c,scopeV2:f,group:d,source:h,pluginName:tn(l.pluginName),pluginNamespace:tn(l.pluginNamespace),pluginMarketplace:tn(l.pluginMarketplace),pluginManifestPath:tn(l.pluginManifestPath),pluginVersion:tn(l.pluginVersion),precedenceRank:x,shadowedBy:p,description:tn(l.description),version:tn(l.version),category:tn(l.category),author:tn(l.author),license:tn(l.license),homepage:tn(l.homepage),tags:dd(l.tags),deps:dd(l.deps),mcpDeps:dd(l.mcpDeps),entryPoint:tn(l.entryPoint),lastModified:tn(l.lastModified),sizeBytes:zS(l.sizeBytes),sourceAgent:tn(l.sourceAgent)};if(l.provenance&&typeof l.provenance=="object"){const v=l.provenance;(v.promotedFrom==="installed"||v.promotedFrom==="global")&&typeof v.sourcePath=="string"&&typeof v.promotedAt=="number"?y.provenance={promotedFrom:v.promotedFrom,sourcePath:v.sourcePath,promotedAt:v.promotedAt,sourceSkillVersion:typeof v.sourceSkillVersion=="string"?v.sourceSkillVersion:void 0}:y.provenance=null}else l.provenance===null&&(y.provenance=null);return typeof l.updateAvailable=="boolean"&&(y.updateAvailable=l.updateAvailable),typeof l.currentVersion=="string"&&(y.currentVersion=l.currentVersion),typeof l.latestVersion=="string"&&(y.latestVersion=l.latestVersion),typeof l.pinnedVersion=="string"&&(y.pinnedVersion=l.pinnedVersion),y}const Ne={getConfig(){return We("/api/config")},setConfig(n,l){return We("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,model:l})})},async getSkills(n){const l=new URLSearchParams;n!=null&&n.scope&&l.set("scope",n.scope),n!=null&&n.agent&&l.set("agent",n.agent);const s=l.toString(),o=await We(`/api/skills${s?"?"+s:""}`);return Array.isArray(o)?o.map(DS):[]},getAgents(){return We("/api/agents")},getSkillDetail(n,l){return We(`/api/skills/${n}/${l}`)},getEvals(n,l){return We(`/api/skills/${n}/${l}/evals`)},saveEvals(n,l,s){return We(`/api/skills/${n}/${l}/evals`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},generateEvals(n,l){return We(`/api/skills/${n}/${l}/generate-evals`,{method:"POST"})},async getLatestBenchmark(n,l){const s=await fetch(`${Za}/api/skills/${n}/${l}/benchmark/latest`);if(!s.ok){const o=await s.json().catch(()=>({error:s.statusText}));throw new Rs(o.error||`HTTP ${s.status}`,s.status)}return s.json()},getHistory(n,l,s){const o=new URLSearchParams;s!=null&&s.model&&o.set("model",s.model),s!=null&&s.type&&o.set("type",s.type),s!=null&&s.from&&o.set("from",s.from),s!=null&&s.to&&o.set("to",s.to);const c=o.toString();return We(`/api/skills/${n}/${l}/history${c?"?"+c:""}`)},getHistoryEntry(n,l,s){return We(`/api/skills/${n}/${l}/history/${encodeURIComponent(s)}`)},compareRuns(n,l,s,o){return We(`/api/skills/${n}/${l}/history-compare?a=${encodeURIComponent(s)}&b=${encodeURIComponent(o)}`)},getCaseHistory(n,l,s,o){const c=new URLSearchParams;o&&c.set("model",o);const f=c.toString();return We(`/api/skills/${n}/${l}/history/case/${s}${f?"?"+f:""}`)},deleteHistoryEntry(n,l,s){return We(`/api/skills/${n}/${l}/history/${encodeURIComponent(s)}`,{method:"DELETE"})},deleteSkill(n,l){return We(`/api/skills/${n}/${l}`,{method:"DELETE"})},improveSkill(n,l,s){return We(`/api/skills/${n}/${l}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})},instructEdit(n,l,s){return We(`/api/skills/${n}/${l}/improve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"instruct",...s})})},applyImprovement(n,l,s){return We(`/api/skills/${n}/${l}/apply-improvement`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s})})},getStats(n,l){return We(`/api/skills/${n}/${l}/stats`)},getDependencies(n,l){return We(`/api/skills/${n}/${l}/dependencies`)},getProjectLayout(){return We("/api/project-layout")},createSkill(n){return We("/api/skills/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},saveDraft(n){return We("/api/skills/save-draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},getSkillCreatorStatus(){return We("/api/skill-creator-status")},generateSkill(n){return We("/api/skills/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})},getSkillFiles(n,l){return We(`/api/skills/${n}/${l}/files`)},getSkillFile(n,l,s){return We(`/api/skills/${n}/${l}/file?path=${encodeURIComponent(s)}`)},saveSkillFile(n,l,s,o){return We(`/api/skills/${n}/${l}/file`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:s,content:o})})},getLeaderboard(n,l){return We(`/api/skills/${n}/${l}/leaderboard`)},getLeaderboardEntry(n,l,s){return We(`/api/skills/${n}/${l}/leaderboard/${encodeURIComponent(s)}`)},startSweep(n,l,s){const o=`${Za}/api/skills/${n}/${l}/sweep`,c=new EventSource(o);return fetch(o,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(s)}),c},getCredentials(n,l){return We(`/api/credentials/${n}/${l}`)},setCredential(n,l,s,o){return We(`/api/credentials/${n}/${l}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,value:o})})},getParams(n,l){return We(`/api/credentials/${n}/${l}/params`)},getParamsRevealed(n,l,s){const o=s?`reveal=true&key=${encodeURIComponent(s)}`:"reveal=true";return We(`/api/credentials/${n}/${l}/params?${o}`)},searchModels(){return We("/api/openrouter/models")},getSkillVersions(n,l){return We(`/api/skills/${n}/${l}/versions`)},getVersionDiff(n,l,s,o){return We(`/api/skills/${n}/${l}/versions/diff?from=${s}&to=${o}`)},startBatchUpdate(n){const l=`${Za}/api/skills/batch-update`,s=new EventSource(l);return fetch(l,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({skills:n})}),s},startSkillUpdate(n,l){const s=`${Za}/api/skills/${n}/${l}/update`,o=new EventSource(s);return fetch(s,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"}}),o},async getSkillUpdates(){try{const n=await fetch(`${Za}/api/skills/updates`);return n.ok?await n.json():[]}catch{return[]}},promoteSkill(n,l,s){const o=s!=null&&s.overwrite?"?overwrite=true":"";return fd(`/api/skills/${n}/${l}/promote${o}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},testInstallSkill(n,l,s){const o=new URLSearchParams;(s==null?void 0:s.dest)==="global"&&o.set("dest","global"),s!=null&&s.overwrite&&o.set("overwrite","true");const c=o.toString();return fd(`/api/skills/${n}/${l}/test-install${c?"?"+c:""}`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},revertSkill(n,l,s){return fd(`/api/skills/${n}/${l}/revert`,s==null?void 0:s.onEvent,s==null?void 0:s.signal)},listStudioOps(n){const l=new URLSearchParams;(n==null?void 0:n.before)!=null&&l.set("before",String(n.before)),(n==null?void 0:n.limit)!=null&&l.set("limit",String(n.limit));const s=l.toString();return We(`/api/studio/ops${s?"?"+s:""}`)},deleteStudioOp(n){return We(`/api/studio/ops/${encodeURIComponent(n)}`,{method:"DELETE"})},studioOpsStream(){return new EventSource(`${Za}/api/studio/ops/stream`)}};async function fd(n,l,s){const o=await fetch(`${Za}${n}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},signal:s});if(!o.ok||!o.body){let y=`HTTP ${o.status}`,v;try{const j=await o.json();j.error&&(y=j.error),typeof j.code=="string"&&(v=j.code)}catch{}const b=new Rs(y,o.status);throw v&&(b.code=v),b}const c=o.body.getReader(),f=new TextDecoder;let d="",h="",x=null,p=null;for(;;){const{done:y,value:v}=await c.read();if(y)break;d+=f.decode(v,{stream:!0});const b=d.split(`
62
- `);d=b.pop()??"";for(const j of b)if(j.startsWith("event: "))h=j.slice(7).trim();else if(j.startsWith("data: ")){let k={};try{k=JSON.parse(j.slice(6))}catch{h="";continue}if(h==="started"||h==="copied"||h==="deleted"||h==="indexed"||h==="done"||h==="error"){const N={type:h,...k};l==null||l(N),N.type==="done"&&(x=N),N.type==="error"&&(p=N)}h=""}}if(p){const y=new Rs(p.message,500);throw y.code=p.code,y}if(!x)throw new Rs("Transfer stream ended without 'done' event",500);return x}function _S(n,l){if(!l.length)return n;const s=new Map;for(const o of l){const c=o.name.split("/").pop()||o.name;s.set(c,o)}return n.map(o=>{const c=s.get(o.skill);return c?{...o,updateAvailable:c.updateAvailable,currentVersion:c.installed,latestVersion:c.latest??void 0}:o})}function OS(n){const[l,s]=g.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return g.useEffect(()=>{const o=window.matchMedia(n);s(o.matches);const c=f=>s(f.matches);return o.addEventListener("change",c),()=>o.removeEventListener("change",c)},[n]),l}const BS=3e5,IS=500,HS=15e3,US=6e4;function $S(n){const l=new Map;for(const s of n){const o=s.name.split("/").pop()||s.name;l.set(o,s)}return l}function PS(n){let l=0;for(const s of n)s.updateAvailable&&l++;return l}function VS(n){n()}function FS(n){const l=BS,s=IS,o=HS,c=US,[f,d]=g.useState([]),[h,x]=g.useState(()=>new Map),[p,y]=g.useState(0),[v,b]=g.useState(!1),[j,k]=g.useState(null),[N,C]=g.useState(null),w=g.useRef(null),A=g.useRef(null),_=g.useRef(null),H=g.useRef(null),L=g.useRef(!0),$=g.useCallback(async()=>{b(!0);const B=new AbortController,P=setTimeout(()=>B.abort(),o);try{const W=await Promise.race([Ne.getSkillUpdates(),new Promise((te,Q)=>{B.signal.addEventListener("abort",()=>{Q(new Error("TIMEOUT"))})})]);if(W==="TIMEOUT")throw new Error("TIMEOUT");if(!L.current)return;d(W),x($S(W)),y(PS(W)),A.current=Date.now(),k(A.current),C(null)}catch(W){if(!L.current)return;C(W instanceof Error?W:new Error(String(W)))}finally{clearTimeout(P),L.current&&b(!1)}},[o]),E=g.useCallback(()=>{if(w.current)return w.current;const B=$().finally(()=>{w.current=null});return w.current=B,B},[$]),D=g.useCallback(()=>{_.current==null&&(_.current=setInterval(()=>{E()},l))},[l,E]),R=g.useCallback(()=>{_.current!=null&&(clearInterval(_.current),_.current=null)},[]);return g.useEffect(()=>{L.current=!0,(A.current==null||Date.now()-A.current>c)&&VS(()=>void E()),(typeof document>"u"||document.visibilityState!=="hidden")&&D();const W=()=>{if(H.current&&(clearTimeout(H.current),H.current=null),document.visibilityState==="hidden"){R();return}H.current=setTimeout(()=>{H.current=null,(A.current==null||Date.now()-A.current>c)&&E(),D()},s)};return typeof document<"u"&&document.addEventListener("visibilitychange",W),()=>{L.current=!1,typeof document<"u"&&document.removeEventListener("visibilitychange",W),H.current&&clearTimeout(H.current),R()}},[]),{updates:f,updatesMap:h,updateCount:p,isRefreshing:v,lastFetchAt:j,error:N,refresh:E}}const GS={selectedSkill:null,mode:"browse",searchQuery:"",skills:[],skillsLoading:!0,skillsError:null,isMobile:!1,mobileView:"list",updateNotificationDismissed:!1,revealSkillId:null};function WS(n,l){switch(l.type){case"SELECT_SKILL":return{...n,selectedSkill:l.skill,mode:"browse",mobileView:n.isMobile?"detail":n.mobileView};case"CLEAR_SELECTION":return{...n,selectedSkill:null};case"SET_MODE":return{...n,mode:l.mode,selectedSkill:l.mode==="create"?null:n.selectedSkill};case"SET_SEARCH":return{...n,searchQuery:l.query};case"SET_SKILLS":return{...n,skills:l.skills,skillsLoading:!1,skillsError:null};case"SET_SKILLS_ERROR":return{...n,skillsError:l.error,skillsLoading:!1};case"SET_SKILLS_LOADING":return{...n,skillsLoading:l.loading};case"SET_MOBILE":return{...n,isMobile:l.isMobile};case"SET_MOBILE_VIEW":return{...n,mobileView:l.view};case"DISMISS_UPDATE_NOTIFICATION":return{...n,updateNotificationDismissed:!0};default:return n}}const mv=g.createContext(null);function Ca(){const n=g.useContext(mv);if(!n)throw new Error("useStudio must be used within StudioProvider");return n}function qS({children:n}){const[l,s]=g.useReducer(WS,GS),o=OS("(max-width: 767px)");g.useEffect(()=>{s({type:"SET_MOBILE",isMobile:o})},[o]);const[c,f]=g.useState(()=>{try{const L=window.localStorage.getItem("vskill.studio.prefs");if(!L)return null;const $=JSON.parse(L);return typeof $.activeAgent=="string"?$.activeAgent:null}catch{return null}});g.useEffect(()=>{function L($){if(!($ instanceof CustomEvent))return;const E=$.detail;E!=null&&E.agentId&&f(E.agentId)}return window.addEventListener("studio:agent-changed",L),()=>window.removeEventListener("studio:agent-changed",L)},[]);const d=g.useCallback(()=>{s({type:"SET_SKILLS_LOADING",loading:!0});const L=c?{agent:c}:void 0;Ne.getSkills(L).then($=>{s({type:"SET_SKILLS",skills:$});const D=window.location.hash.match(/^#\/skills\/([^/]+)\/([^/?]+)/);if(D){const[,R,B]=D,P=$.find(W=>W.plugin===R&&W.skill===B);P&&s({type:"SELECT_SKILL",skill:{plugin:R,skill:B,origin:P.origin}})}}).catch($=>s({type:"SET_SKILLS_ERROR",error:$.message}))},[c]);g.useEffect(()=>{d()},[d]);const h=g.useCallback(L=>{s({type:"SELECT_SKILL",skill:L}),window.location.hash=`/skills/${L.plugin}/${L.skill}`},[]),x=g.useCallback(()=>{s({type:"CLEAR_SELECTION"}),window.location.hash.startsWith("#/skills/")&&history.replaceState(null,"",window.location.pathname+window.location.search)},[]),p=g.useCallback(L=>{s({type:"SET_MODE",mode:L})},[]),y=g.useCallback(L=>{s({type:"SET_SEARCH",query:L})},[]),v=g.useCallback(L=>{s({type:"SET_MOBILE_VIEW",view:L})},[]),b=g.useCallback(()=>{s({type:"DISMISS_UPDATE_NOTIFICATION"})},[]),j=FS(),k=g.useMemo(()=>{const L=l.skills.map($=>{if(!$.updateAvailable&&$.latestVersion===void 0)return $;const E={...$};return delete E.updateAvailable,delete E.currentVersion,delete E.latestVersion,E});return _S(L,j.updates)},[l.skills,j.updates]),N=g.useMemo(()=>{const L={source:0,installed:0};for(const $ of k)$.updateAvailable&&(L[$.origin]+=1);return L},[k]),C=g.useMemo(()=>({...l,skills:k}),[l,k]),w=j.updateCount,A=j.refresh,_=j.isRefreshing,H=g.useMemo(()=>({state:C,selectSkill:h,clearSelection:x,setMode:p,setSearch:y,setMobileView:v,refreshSkills:d,updateCount:w,dismissUpdateNotification:b,updates:j.updates,outdatedByOrigin:N,isRefreshingUpdates:_,refreshUpdates:A}),[C,h,x,p,y,v,d,w,b,j.updates,N,_,A]);return a.jsx(mv.Provider,{value:H,children:n})}const YS={config:null,loading:!0};function KS(n,l){switch(l.type){case"SET_CONFIG":return{config:l.config,loading:!1};case"SET_LOADING":return{...n,loading:!0};default:return n}}const hv=g.createContext(null);function Nr(){const n=g.useContext(hv);if(!n)throw new Error("useConfig must be used within ConfigProvider");return n}function XS({children:n}){const[l,s]=g.useReducer(KS,YS),o=g.useCallback(()=>{Ne.getConfig().then(d=>s({type:"SET_CONFIG",config:d})).catch(()=>{})},[]);g.useEffect(()=>{o()},[o]);const c=g.useCallback(async(d,h)=>{const x=await Ne.setConfig(d,h);return s({type:"SET_CONFIG",config:x}),x},[]),f=g.useMemo(()=>({config:l.config,loading:l.loading,updateConfig:c,refreshConfig:o}),[l,c,o]);return a.jsx(hv.Provider,{value:f,children:n})}function QS({topRail:n,sidebar:l,main:s,statusBar:o,resizeHandle:c,banner:f,liveMessage:d,sidebarWidth:h=320,sidebarHidden:x=!1,opsDrawer:p}){const y={"--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)"},v={display:"grid",gridTemplateColumns:x?"1fr":"var(--sidebar-width) auto 1fr",minHeight:0,overflow:"hidden"};return a.jsxs("div",{className:"studio-shell",style:y,children:[f,a.jsx("header",{style:{borderBottom:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:n}),a.jsxs("div",{style:v,children:[!x&&a.jsx("aside",{"aria-label":"Skills sidebar",style:{minHeight:0,overflow:"hidden",borderRight:c?"none":"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",flexDirection:"column"},children:l}),!x&&c,a.jsx("main",{style:{minHeight:0,overflow:"auto",background:"var(--bg-canvas)"},children:s})]}),a.jsx("footer",{role:"contentinfo",style:{borderTop:"1px solid var(--border-default)",background:"var(--bg-canvas)",display:"flex",alignItems:"center",minHeight:0},children:o}),p,a.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:d??""})]})}const Hx=["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed","ollama","lm-studio"],ZS={"claude-cli":".claude",cursor:".cursor","codex-cli":".codex","gemini-cli":".gemini",copilot:".github",zed:".zed"},JS={"claude-cli":"claude",cursor:"cursor","codex-cli":"codex","gemini-cli":"gemini"},ej={"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"},tj={"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 nj(n,l){var h,x;const s=ZS[n.id]??null,o=JS[n.id]??null,c=s?!!((h=l==null?void 0:l.wrapperFolders)!=null&&h[s]):!1,f=o?!!((x=l==null?void 0:l.binaries)!=null&&x[o]):!0,d=n.models.map(p=>({id:p.id,displayName:p.label,billingMode:tj[n.id]??"per-token",...p.pricing?{pricing:p.pricing}:{}}));return{id:n.id,displayName:aj(n.id,n.label),wrapperFolder:s,wrapperFolderPresent:c,binaryAvailable:f,endpointReachable:n.id==="ollama"||n.id==="lm-studio"?n.available:null,available:n.available,ctaType:n.available?null:ej[n.id]??null,models:d,resolvedModel:n.resolvedModel??null}}function aj(n,l){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"}[n]??l}function rj(n){const l=new Map(n.map(o=>[o.id,o])),s=[];for(const o of Hx){const c=l.get(o);c&&s.push(c)}for(const o of n)Hx.includes(o.id)||s.push(o);return s}function lj(n){const[l,s]=g.useState(null),[o,c]=g.useState("loading"),[f,d]=g.useState(null),h=g.useRef(null),x=g.useRef(0),p=g.useCallback(async()=>{try{const k=await fetch("/api/config");if(!k.ok)throw new Error(`/api/config returned ${k.status}`);const N=await k.json(),C=rj((N.providers||[]).map(w=>nj(w,N.detection)));s({agents:C,activeAgent:N.provider??null,activeModel:N.model??null}),c("ready"),d(null)}catch(k){c("error"),d(k.message)}},[]);g.useEffect(()=>{p()},[p]);const y=g.useCallback(async()=>{const k=Date.now();if(!(k-x.current<5*6e4))try{const N=await fetch("/api/openrouter/models");if(!N.ok)return;const C=await N.json();x.current=k,s(w=>{if(!w)return w;const A=w.agents.map(_=>{if(_.id!=="openrouter")return _;const H=C.models.map($=>({id:$.id,displayName:$.name,contextWindow:$.contextWindow,pricing:$.pricing,billingMode:"per-token"}));return{..._,models:H,catalogAgeMs:C.ageSec?C.ageSec*1e3:0,cacheStale:!!C.stale}});return{...w,agents:A}}),C.stale&&(n!=null&&n.onStaleCatalog)&&n.onStaleCatalog("openrouter",(C.ageSec??0)*1e3)}catch{}},[n]),v=g.useCallback(k=>{h.current=k,k==="openrouter"&&y()},[y]),b=g.useCallback(()=>{x.current=0,p()},[p]),j=g.useCallback(async(k,N)=>{(await fetch("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:k,model:N})})).ok&&s(w=>w&&{...w,activeAgent:k,activeModel:N})},[]);return{status:o,catalog:l,error:f,focusAgent:v,refresh:b,activeAgentId:(l==null?void 0:l.activeAgent)??null,activeModelId:(l==null?void 0:l.activeModel)??null,setActive:j}}function pd({variant:n,label:l,onActivate:s,installUrl:o,tooltip:c}){function f(h){if(h.stopPropagation(),n==="cli-install"&&o){window.open(o,"_blank","noopener,noreferrer");return}s()}function d(h){(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),f(h))}return a.jsx("button",{type:"button","data-testid":`locked-cta-${n}`,onClick:f,onKeyDown:d,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":l,...c?{title:c}:{},children:l})}function Id({unlocked:n=!1,size:l=10}){return n?a.jsxs("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 3.5"})]}):a.jsxs("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[a.jsx("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),a.jsx("path",{d:"M5 7V4.5A3 3 0 0 1 11 4.5V7"})]})}const sj={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:(n,l)=>`${n} of ${l}`},ij={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"},oj={tabOverview:"Overview",tabVersions:"Versions",tabBenchmark:"Benchmark",emptyHeadline:"Select a skill to see details.",emptyBody:"Pick one from the sidebar.",loadErrorHeadline:n=>`Couldn't load SKILL.md for ${n}.`,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:n=>`Viewing ${n} (Own)`,announceViewingInstalled:n=>`Viewing ${n} (Installed)`,moreFields:"More fields",sourceAgent:"Source agent",noMcpDependencies:"No MCP dependencies.",filesystemGroup:"Filesystem",benchmarkGroup:"Benchmark",metadataGroup:"Frontmatter"},cj={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.",promote:"Promote to OWN",testInstall:"Test-install to .claude/",revert:"Revert to INSTALLED"},uj={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"},dj={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"},fj={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."},pj={disconnected:"Disconnected — reconnecting…",reconnected:"Reconnected.",loading:"Loading skills…",loadingPlaceholderCount:"—"},mj={fieldRequired:"This field is required.",nameInvalid:"Use letters, numbers, and hyphens.",descriptionRequired:"Description is required.",saveFailed:"Save failed. Check the form for errors."},hj={boundaryHeadline:"Something broke in this view.",boundaryBody:"Reload the page to recover.",boundaryAction:"Reload"},xj={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:n=>`No models match "${n}"`,clearSearch:"Clear",currentlyActive:"Currently active"},gj={claudeCli:{name:"Claude Code",caption:"Delegates to the `claude` CLI — your existing Claude Code session handles quota.",missingBinary:"Claude Code not found. Install it: `npm install -g @anthropic-ai/claude-code`. Or choose a provider with an API key.",installCta:"Install Claude Code →",installUrl:"https://docs.claude.com/en/docs/claude-code"},anthropic:{name:"Anthropic API",caption:"Direct access via your Anthropic API key.",addKeyCta:"Add API key →",keyIssuanceUrl:"https://platform.claude.com/settings/keys",keyPrefix:"sk-ant-"},openrouter:{name:"OpenRouter",caption:"300+ models from every major vendor.",addKeyCta:"Add API key →",emptyCardBody:"Add your OpenRouter API key to browse 300+ models",keyIssuanceUrl:"https://openrouter.ai/settings/keys",keyPrefix:"sk-or-"},cursor:{name:"Cursor",caption:"Cursor IDE composer.",installCta:"Install Cursor →"},codexCli:{name:"Codex CLI",caption:"OpenAI Codex CLI.",installCta:"Install Codex CLI →"},geminiCli:{name:"Gemini CLI",caption:"Google Gemini CLI.",installCta:"Install Gemini CLI →"},copilot:{name:"GitHub Copilot",caption:"GitHub Copilot CLI.",installCta:"Install Copilot →"},zed:{name:"Zed",caption:"Zed editor.",installCta:"Install Zed →"},ollama:{name:"Ollama",caption:"Local models, free.",startServiceCta:"Start service →"},lmStudio:{name:"LM Studio",caption:"Local models, free.",startServiceCta:"Start LM Studio server →",startServiceTooltip:"Open LM Studio → Developer tab → Start Server (default port 1234)."}},vj={subscriptionBilling:"· subscription",free:"· free"},yj={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:n=>`Remove ${n} API key?`,keyStoredAt:n=>`Key stored locally — updated ${n}`,noKey:"No key stored",enterNonEmpty:"Enter a non-empty key",prefixWarn:n=>`This doesn't look like a typical ${n} key. Save anyway?`,keySaved:n=>`${n} API key saved (local only, never synced)`,keyRemoved:n=>`${n} API key removed`},bj={providersLabel:"Providers",providerSummary:(n,l)=>`${n}/${l} providers`,locked:n=>`${n} — locked. Click to add a key.`,lockedCli:n=>`${n} — locked. Click for install instructions.`,unlocked:n=>`${n} — unlocked.`},Sj={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:n=>`Set up ${n}`,sharedFolderBanner:n=>`Shared folder — consumed by ${n}`},jj={ownLabel:"Own",installedLabel:"Installed",globalLabel:"Global",emptyOwn:"No authored skills — run vskill new.",emptyInstalled:n=>`No skills installed for ${n} in this project — run vskill install.`,emptyGlobal:n=>`No global skills for ${n} — run vskill install --global.`},kj={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"},wj={title:n=>`Set up ${n}`,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."},Cj={groupAvailable:"Available",groupAuthoring:"Authoring",sourceProject:"Project",sourcePersonal:"Personal",sourcePlugin:"Plugins",authoringSkills:"Skills"},Ej={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:sj,shell:ij,detail:oj,actions:cj,palette:uj,shortcuts:dj,toasts:fj,connection:pj,forms:mj,errors:hj,picker:xj,providers:gj,models:vj,settings:yj,statusBar:bj,scopePicker:Sj,scopeSection:jj,claudeCodeLabel:kj,setupDrawer:wj,setupProviders:Ej,scopeLabels:Cj},Ux=new Set(["claude-cli","anthropic","openrouter","cursor","codex-cli","gemini-cli","copilot","zed"]);function Nj({agents:n,activeAgentId:l,focusedAgentId:s,onFocus:o,onSelect:c,onOpenSettings:f}){const d=n.filter(x=>Ux.has(x.id)),h=n.filter(x=>!Ux.has(x.id));return a.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:[d.map(x=>a.jsx($x,{agent:x,isActive:x.id===l,isFocused:x.id===s,onFocus:o,onSelect:c,onOpenSettings:f},x.id)),h.length>0&&a.jsx("div",{style:{borderTop:"1px solid var(--border-default, var(--border-subtle))",margin:"4px 0"},"aria-hidden":"true"}),h.map(x=>a.jsx($x,{agent:x,isActive:x.id===l,isFocused:x.id===s,onFocus:o,onSelect:c,onOpenSettings:f},x.id))]})}function $x({agent:n,isActive:l,isFocused:s,onFocus:o,onSelect:c,onOpenSettings:f}){const{providers:d}=J,h={"claude-cli":d.claudeCli.caption,anthropic:d.anthropic.caption,openrouter:d.openrouter.caption},x={"claude-cli":{label:d.claudeCli.installCta,url:d.claudeCli.installUrl},cursor:{label:d.cursor.installCta},"codex-cli":{label:d.codexCli.installCta},"gemini-cli":{label:d.geminiCli.installCta},copilot:{label:d.copilot.installCta},zed:{label:d.zed.installCta}},p=n.id==="claude-cli"||n.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:s?"var(--surface-muted, var(--surface-3))":"transparent",borderLeft:l?"1px solid var(--accent, var(--color-accent))":"1px solid transparent",fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif",fontSize:13,fontWeight:l?500:400,color:"var(--text-primary)"};return l&&(y.background="color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)"),a.jsxs("div",{role:"option","aria-selected":l,"data-testid":`agent-row-${n.id}`,"data-focused":s||void 0,tabIndex:s?0:-1,onMouseEnter:()=>o(n.id),onFocus:()=>o(n.id),onClick:()=>c(n.id),style:y,children:[n.wrapperFolder&&a.jsx("span",{"data-testid":`wrapper-dot-${n.id}`,"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",flexShrink:0,background:n.wrapperFolderPresent?"var(--accent, var(--color-accent))":"transparent",border:n.wrapperFolderPresent?"none":"1px solid var(--border-default, var(--border-subtle))"}}),!n.wrapperFolder&&a.jsx("span",{style:{width:6,height:6,flexShrink:0},"aria-hidden":"true"}),a.jsxs("span",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.displayName}),(n.id==="claude-cli"||n.id==="claude-code")&&a.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})]}),a.jsx("span",{"aria-label":n.available?"available":"locked",style:{color:n.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0},children:n.available?a.jsx(Id,{unlocked:!0,size:10}):a.jsx(Id,{size:10})}),l&&a.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:"0.05em",fontWeight:600,color:"var(--accent-ink, var(--accent))",flexShrink:0},"data-testid":`active-badge-${n.id}`,children:J.picker.currentlyActive}),!n.available&&n.ctaType==="api-key"&&a.jsx(pd,{variant:"api-key",label:n.id==="anthropic"?d.anthropic.addKeyCta:d.openrouter.addKeyCta,onActivate:()=>f(n.id)}),!n.available&&n.ctaType==="cli-install"&&x[n.id]&&a.jsx(pd,{variant:"cli-install",label:x[n.id].label,installUrl:x[n.id].url,onActivate:()=>{}}),!n.available&&n.ctaType==="start-service"&&a.jsx(pd,{variant:"start-service",label:n.id==="ollama"?d.ollama.startServiceCta:d.lmStudio.startServiceCta,tooltip:n.id==="lm-studio"?d.lmStudio.startServiceTooltip:void 0,onActivate:()=>f(n.id)}),h[n.id]&&a.jsx("span",{className:"sr-only","data-testid":`caption-${n.id}`,children:h[n.id]})]})}function Tj(n,l,s,o){const d=n>=80,h=g.useRef(null),[x,p]=g.useState(0),y=g.useCallback(j=>{p(j.currentTarget.scrollTop)},[]),{visibleStart:v,visibleEnd:b}=g.useMemo(()=>{if(!d)return{visibleStart:0,visibleEnd:n};const j=Math.max(0,Math.floor(x/l)-4),k=Math.ceil(s/l)+8,N=Math.min(n,j+k);return{visibleStart:j,visibleEnd:N}},[d,x,l,s,n,4]);return{visibleStart:v,visibleEnd:b,totalHeight:n*l,offsetTop:v*l,virtualised:d,containerProps:{onScroll:y,ref:h,style:{overflowY:"auto",maxHeight:s,willChange:d?"transform":void 0}}}}const xv=44,Rj=352,Aj=60;function Mj(n){var f,d;const l=n.contextWindow?n.contextWindow>=1e6?`${Math.round(n.contextWindow/1e6)}M`:n.contextWindow>=1e3?`${Math.round(n.contextWindow/1e3)}k`:String(n.contextWindow):null;if(n.billingMode==="subscription")return l?`${l} ctx ${J.models.subscriptionBilling}`:J.models.subscriptionBilling.trim();if(n.billingMode==="free")return l?`local · ${l} ctx · free`:"local · free";const s=((f=n.pricing)==null?void 0:f.prompt)??0,o=((d=n.pricing)==null?void 0:d.completion)??0,c=`$${s.toFixed(2)} / $${o.toFixed(2)} per 1M tokens`;return l?`${l} ctx · ${c}`:c}function Lj(n,l){if(!l)return n;const s=l.toLowerCase();return n.filter(c=>c.displayName.toLowerCase().includes(s)).sort((c,f)=>{const d=c.displayName.toLowerCase().indexOf(s),h=f.displayName.toLowerCase().indexOf(s);return d!==h?d-h:c.displayName.length-f.displayName.length})}function zj({agent:n,activeModelId:l,onSelect:s,onOpenSettings:o}){const[c,f]=g.useState(""),[d,h]=g.useState(""),x=g.useRef(null);if(g.useEffect(()=>{const v=setTimeout(()=>h(c),Aj);return()=>clearTimeout(v)},[c]),g.useEffect(()=>{n.id==="openrouter"&&n.available&&x.current&&x.current.focus()},[n.id,n.available]),n.id==="openrouter"&&!n.available)return a.jsxs("div",{"data-testid":"openrouter-empty-card",style:{width:360,padding:20,display:"flex",flexDirection:"column",gap:12},children:[a.jsx("p",{style:{margin:0,color:"var(--text-primary)",fontSize:13,lineHeight:1.5},children:J.providers.openrouter.emptyCardBody}),a.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=g.useMemo(()=>Lj(n.models,d),[n.models,d]),y=Tj(p.length,xv,Rj);return a.jsxs("div",{role:"listbox","aria-label":"Model","data-testid":"model-list",style:{width:360,display:"flex",flexDirection:"column"},children:[n.id==="openrouter"&&a.jsx("div",{style:{padding:8,borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:a.jsx("input",{ref:x,type:"text",placeholder:J.picker.searchPlaceholder,value:c,onChange:v=>f(v.target.value),"data-testid":"model-search-input","aria-label":J.picker.searchPlaceholder,style:{width:"100%",padding:"6px 8px",background:"var(--surface-2, var(--bg-surface))",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,fontFamily:"'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif"}})}),p.length===0&&d?a.jsxs("div",{style:{padding:16},"data-testid":"no-matches",children:[a.jsx("div",{style:{color:"var(--text-muted, var(--text-tertiary))",fontSize:12,marginBottom:8},children:J.picker.noMatches(d)}),a.jsx("button",{type:"button",onClick:()=>f(""),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?a.jsx("div",{style:{padding:16,color:"var(--text-muted, var(--text-tertiary))",fontSize:12},children:J.picker.noModelsYet}):a.jsx("div",{...y.containerProps,children:a.jsx("div",{style:{height:y.virtualised?y.totalHeight:"auto",position:"relative"},children:a.jsx("div",{style:{transform:y.virtualised?`translateY(${y.offsetTop}px)`:void 0},children:p.slice(y.visibleStart,y.visibleEnd).map(v=>a.jsx(_j,{model:v,isActive:v.id===l,onSelect:()=>s(v.id),resolvedModel:n.id==="claude-cli"?n.resolvedModel??null:null},v.id))})})})]})}function Dj(n,l){return l?l.toLowerCase().includes(n.toLowerCase()):!1}function _j({model:n,isActive:l,onSelect:s,resolvedModel:o}){const c=Mj(n),f=Dj(n.id,o);return a.jsxs("button",{type:"button",role:"option","aria-selected":l,"data-testid":`model-row-${n.id}`,onClick:s,title:n.id,style:{width:"100%",minHeight:xv,padding:"4px 12px",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",gap:2,background:l?"color-mix(in srgb, var(--accent, var(--color-accent)) 10%, transparent)":"transparent",borderLeft:l?"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:[a.jsx("span",{style:{fontSize:14,fontWeight:500,color:"var(--text-primary)"},children:n.displayName}),a.jsx("span",{style:{fontSize:12,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",fontVariantNumeric:"tabular-nums",color:"var(--text-muted, var(--text-tertiary))"},children:c}),f&&a.jsxs("span",{"data-testid":`model-row-${n.id}-resolved`,style:{fontSize:11,fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace",color:"var(--text-muted, var(--text-tertiary))"},children:["routing to ",o]})]})}const Px={anthropic:{stored:!1,updatedAt:null,tier:"browser"},openrouter:{stored:!1,updatedAt:null,tier:"browser"}};function Oj(){const[n,l]=g.useState(null),[s,o]=g.useState(!0),[c,f]=g.useState(null),d=g.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();l({...Px,...y}),f(null)}catch(p){f(p.message),l(Px)}finally{o(!1)}},[]);g.useEffect(()=>{d()},[d]);const h=g.useCallback(async(p,y,v="browser")=>{const b=await fetch("/api/settings/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:p,key:y,tier:v})});if(!b.ok){const k=await b.json().catch(()=>({error:b.statusText}));throw new Error(k.error||`POST /api/settings/keys returned ${b.status}`)}const j=await b.json();return await d(),j},[d]),x=g.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 d()},[d]);return{state:n,loading:s,error:c,save:h,remove:x,refresh:d}}const Bj=[{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 Ij(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad/.test(navigator.platform)}function Hj(n){const l=Date.now()-new Date(n).getTime();return l<6e4?"just now":l<36e5?`${Math.round(l/6e4)}m ago`:l<864e5?`${Math.round(l/36e5)}h ago`:new Date(n).toLocaleString()}function Uj({open:n,onClose:l,initialProvider:s,onToast:o}){const{state:c,save:f,remove:d}=Oj(),[h,x]=g.useState("browser"),p=g.useRef(null),y=g.useRef(null),[v,b]=g.useState(s??"anthropic");if(g.useEffect(()=>{if(!n)return;const k=document.activeElement,N=setTimeout(()=>{var A;const C=s?`input[data-provider="${s}"]`:"input[data-provider]",w=(A=p.current)==null?void 0:A.querySelector(C);w==null||w.focus()},0);return()=>{var C;clearTimeout(N),(C=k==null?void 0:k.focus)==null||C.call(k)}},[n,s]),g.useEffect(()=>{if(!n)return;const k=N=>{if(N.key==="Escape"){N.preventDefault(),l();return}if(N.key==="Tab"&&p.current){const C=p.current.querySelectorAll("button, [href], input, select, textarea, [tabindex]:not([tabindex='-1'])");if(C.length===0)return;const w=C[0],A=C[C.length-1];N.shiftKey&&document.activeElement===w?(N.preventDefault(),A.focus()):!N.shiftKey&&document.activeElement===A&&(N.preventDefault(),w.focus())}};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n,l]),!n)return null;const j=Ij();return a.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"settings-modal-title","data-testid":"settings-modal",style:{position:"fixed",inset:0,background:"color-mix(in srgb, black 40%, transparent)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},onClick:k=>{k.target===k.currentTarget&&l()},children:a.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:k=>k.stopPropagation(),children:[a.jsx("h2",{id:"settings-modal-title",style:{margin:"0 0 16px 0",fontSize:16,fontWeight:600},children:J.settings.title}),a.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}),a.jsxs("section",{"aria-labelledby":"settings-api-keys-title",style:{marginBottom:20},children:[a.jsx("h3",{id:"settings-api-keys-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionApiKeys}),Bj.map(k=>a.jsx($j,{providerId:k.id,providerName:k.name,keyIssuanceUrl:k.keyIssuanceUrl,prefix:k.prefix,metadata:c==null?void 0:c[k.id],tier:h,onSave:async N=>{const C=await f(k.id,N,h);return o==null||o(J.settings.keySaved(k.name)),C},onRemove:async()=>{await d(k.id),o==null||o(J.settings.keyRemoved(k.name))},inputRef:k.id===(s??"anthropic")?y:void 0},k.id))]}),a.jsxs("section",{"aria-labelledby":"settings-storage-title",children:[a.jsx("h3",{id:"settings-storage-title",style:{fontSize:13,fontWeight:600,margin:"0 0 12px 0"},children:J.settings.sectionStorage}),j?a.jsxs("fieldset",{style:{border:"none",padding:0,margin:0,display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[a.jsx("input",{type:"radio",name:"storage-tier",value:"browser",checked:h==="browser",onChange:()=>x("browser")}),J.settings.storageBrowser]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12},children:[a.jsx("input",{type:"radio",name:"storage-tier",value:"keychain",checked:h==="keychain",onChange:()=>x("keychain")}),J.settings.storageKeychain]})]}):a.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, var(--text-tertiary))"},children:[J.settings.storageBrowser,a.jsxs("span",{title:J.settings.storageDarwinOnly,style:{marginLeft:8},children:["(",J.settings.storageDarwinOnly,")"]})]})]}),a.jsx("div",{style:{marginTop:20,display:"flex",justifyContent:"flex-end"},children:a.jsx("button",{type:"button",onClick:l,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 $j({providerId:n,providerName:l,keyIssuanceUrl:s,prefix:o,metadata:c,onSave:f,onRemove:d,inputRef:h}){const[x,p]=g.useState(""),[y,v]=g.useState(!1),[b,j]=g.useState(!1),[k,N]=g.useState(!1),[C,w]=g.useState(null),A=x.trim(),_=A.length===0,H=A.length>0&&!A.startsWith(o),L=g.useCallback(async()=>{if(!_){j(!0);try{const D=await f(A);D.warning?w(D.warning):w(null),p("")}finally{j(!1)}}},[_,f,A]),$=g.useCallback(async()=>{var D;try{if(!((D=navigator.clipboard)!=null&&D.readText))return;const R=await navigator.clipboard.readText();p(R)}catch{}},[]),E=g.useCallback(async()=>{N(!1),await d()},[d]);return a.jsxs("div",{"data-testid":`provider-row-${n}`,style:{padding:12,border:"1px solid var(--border-subtle)",borderRadius:6,marginBottom:8,display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a.jsx("strong",{style:{fontSize:13},children:l}),a.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",style:{fontSize:12,color:"var(--accent, var(--color-accent))"},children:"Get a key →"})]}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{ref:h,type:y?"text":"password",value:x,onChange:D=>{p(D.target.value),w(null)},"data-provider":n,placeholder:`Paste ${l} 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"}}),a.jsx("button",{type:"button",onClick:()=>v(!y),style:ml,children:y?J.settings.hide:J.settings.show}),a.jsx("button",{type:"button",onClick:$,style:ml,children:J.settings.paste})]}),_&&x.length>0&&a.jsx("div",{role:"status",style:Pj,children:J.settings.enterNonEmpty}),H&&a.jsx("div",{role:"status","data-testid":`prefix-warn-${n}`,style:Vx,children:J.settings.prefixWarn(l)}),C&&a.jsx("div",{role:"status",style:Vx,children:C}),a.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[a.jsx("button",{type:"button",onClick:L,disabled:_||b,"data-testid":`save-${n}`,style:{...ml,background:_?"var(--surface-2)":"var(--accent, var(--color-accent))",color:_?"var(--text-muted)":"white",cursor:_?"not-allowed":"pointer"},children:J.settings.save}),(c==null?void 0:c.stored)&&a.jsx(a.Fragment,{children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{fontSize:12},children:J.settings.removeConfirm(l)}),a.jsx("button",{type:"button",onClick:E,"data-testid":`remove-confirm-${n}`,style:{...ml,background:"var(--danger, #b33)",color:"white"},children:"Confirm"}),a.jsx("button",{type:"button",onClick:()=>N(!1),style:ml,children:"Cancel"})]}):a.jsx("button",{type:"button",onClick:()=>N(!0),"data-testid":`remove-${n}`,style:{...ml,color:"var(--text-muted)"},children:J.settings.remove})}),a.jsx("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-muted, var(--text-tertiary))"},"data-testid":`status-${n}`,children:c!=null&&c.stored&&c.updatedAt?J.settings.keyStoredAt(Hj(c.updatedAt)):J.settings.noKey})]})]})}const ml={padding:"4px 8px",background:"var(--surface-2, transparent)",border:"1px solid var(--border-subtle)",borderRadius:4,color:"var(--text-primary)",fontSize:12,cursor:"pointer"},Pj={fontSize:11,color:"var(--danger, #b33)"},Vx={fontSize:11,color:"var(--warning, var(--text-muted))"};function Vj(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Fj({onToast:n}){const{status:l,catalog:s,focusAgent:o,setActive:c}=lj({onStaleCatalog:(D,R)=>{const B=Math.round(R/6e4);n==null||n(`Using cached ${D} catalog (${B} min old)`)}}),[f,d]=g.useState(!1),[h,x]=g.useState(!1),[p,y]=g.useState(),[v,b]=g.useState(null),[j,k]=g.useState("agents"),N=g.useRef(null);g.useRef(null),g.useEffect(()=>{var D;s&&!v&&b(s.activeAgent??((D=s.agents[0])==null?void 0:D.id)??null)},[s,v]);const C=(s==null?void 0:s.agents)??[],w=g.useMemo(()=>C.find(D=>D.id===v)??C[0],[C,v]),A=g.useCallback(()=>{var D;d(!0),k("agents"),b((s==null?void 0:s.activeAgent)??((D=C[0])==null?void 0:D.id)??null)},[s,C]),_=g.useCallback(()=>{var D;d(!1),(D=N.current)==null||D.focus()},[]);g.useEffect(()=>{const D=R=>{var P;if(!(R.metaKey||R.ctrlKey)||R.key.toLowerCase()!=="k")return;const B=(P=document.activeElement)==null?void 0:P.tagName;B==="INPUT"||B==="TEXTAREA"||(R.preventDefault(),d(W=>!W))};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[]),g.useEffect(()=>{if(!f)return;const D=B=>{if(B.key==="Escape"){B.preventDefault(),_();return}if(B.key==="ArrowDown"){B.preventDefault(),R(1);return}if(B.key==="ArrowUp"){B.preventDefault(),R(-1);return}if(B.key==="ArrowRight"&&j==="agents"){B.preventDefault(),k("models");return}if(B.key==="ArrowLeft"&&j==="models"){B.preventDefault(),k("agents");return}if(B.key==="Enter"){B.preventDefault(),j==="agents"&&w?k("models"):j==="models"&&w&&w.models[0]&&(c(w.id,w.models[0].id),_());return}};function R(B){if(j==="agents"){const P=C.findIndex(te=>te.id===v),W=C[Math.max(0,Math.min(C.length-1,P+B))];W&&(b(W.id),o(W.id))}}return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[f,j,C,v,w,_,o,c]);const H=g.useCallback(D=>{y(D==="anthropic"||D==="openrouter"?D:void 0),x(!0),d(!1)},[]),L=C.find(D=>D.id===(s==null?void 0:s.activeAgent)),$=L==null?void 0:L.models.find(D=>D.id===(s==null?void 0:s.activeModel)),E=g.useMemo(()=>{if(l!=="ready"||!s)return"Loading…";const D=(L==null?void 0:L.displayName)??"Agent",R=($==null?void 0:$.displayName)??s.activeModel??"Model";return`${D} · ${R}`},[l,s,L,$]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:N,type:"button","data-testid":"agent-model-picker-trigger",onClick:()=>f?_():A(),"aria-haspopup":"listbox","aria-expanded":f,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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:L!=null&&L.available?"var(--accent, var(--color-accent))":"var(--text-muted, var(--text-tertiary))",flexShrink:0}}),a.jsx("span",{children:E})]}),f&&typeof document<"u"&&Do.createPortal(a.jsxs(Gj,{reducedMotion:Vj(),onClickOutside:_,children:[a.jsxs("div",{style:{display:"flex",height:440,maxHeight:"60vh"},children:[a.jsx(Nj,{agents:C,activeAgentId:(s==null?void 0:s.activeAgent)??null,focusedAgentId:v,onFocus:D=>{b(D),o(D)},onSelect:D=>{b(D),o(D),k("models")},onOpenSettings:H}),w&&a.jsx(zj,{agent:w,activeModelId:(s==null?void 0:s.activeModel)??null,onSelect:D=>{c(w.id,D),_()},onOpenSettings:H})]}),a.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:[a.jsx("button",{type:"button",onClick:()=>H(),"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}),a.jsx("span",{style:{fontFamily:"'JetBrains Mono Variable', 'JetBrains Mono', monospace"},children:J.picker.footerHint})]})]}),document.body),a.jsx(Uj,{open:h,onClose:()=>x(!1),initialProvider:p,onToast:n})]})}function Gj({children:n,reducedMotion:l,onClickOutside:s}){const o=g.useRef(null);return g.useEffect(()=>{const c=f=>{o.current&&!o.current.contains(f.target)&&s()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),a.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:l?void 0:"agentPickerFadeIn 120ms cubic-bezier(0.2, 0, 0, 1)"},children:[n,a.jsx("style",{children:`@keyframes agentPickerFadeIn {
63
- from { opacity: 0; transform: translateX(-50%) translateY(2px); }
64
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
65
- }`})]})}function Fx(){typeof window>"u"||(window.location.hash="#/")}function Wj({onHome:n}){const[l,s]=g.useState(!1),[o,c]=g.useState(!1),f=h=>{h.metaKey||h.ctrlKey||h.shiftKey||h.button!==0||(h.preventDefault(),Fx(),n==null||n())},d=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),Fx(),n==null||n())};return a.jsxs("a",{href:"#/",role:"link","data-testid":"studio-logo","aria-label":"Skill Studio — home",onClick:f,onKeyDown:d,onFocus:()=>s(!0),onBlur:()=>s(!1),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!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:l?"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:[a.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:a.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:a.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})})}),a.jsx("span",{style:{fontSize:13,fontWeight:600,letterSpacing:"-0.01em",color:"var(--text-primary)"},children:"Skill Studio"})]})}const qj="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",Yj=g.lazy(()=>_o(()=>import("./UpdateDropdown-9qR5NxTi.js"),__vite__mapDeps([0,1])));function Kj(){const{updateCount:n,updates:l,isRefreshingUpdates:s,refreshUpdates:o,selectSkill:c}=Ca(),[f,d]=g.useState(!1),h=g.useRef(null),x=g.useCallback(()=>d(!1),[]),p=n>0?"var(--text-primary)":"var(--text-secondary)",y=n>9?"9+":String(n),v=n===0?"No updates available":`${n} updates available, open summary`;return a.jsxs("span",{"data-testid":"update-bell-anchor",style:{position:"relative",display:"inline-flex"},children:[a.jsxs("button",{ref:h,type:"button","data-testid":"update-bell","aria-label":v,"aria-haspopup":"dialog","aria-expanded":f,onClick:()=>d(b=>!b),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:[a.jsx("img",{src:qj,alt:"",width:18,height:18,style:{display:"block",opacity:n>0?1:.75}}),n>0&&a.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})]}),f&&a.jsx(g.Suspense,{fallback:a.jsx("span",{"data-testid":"update-bell-fallback",children:"Loading…"}),children:a.jsx(Yj,{updates:l,isRefreshing:s,onRefresh:()=>o(),onSelectSkill:b=>{const j=b.name.split("/"),k=j.length>=2?j[j.length-2]:j[0],N=j[j.length-1];c({plugin:k,skill:N,origin:"installed"}),x()},onViewAll:()=>{window.location.hash="#/updates",x()},onClose:x,anchorRef:h})})]})}function Gx(n){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:navigate-scope",{detail:n}))}function Xj({projectName:n,selected:l,onOpenPalette:s,onHome:o,projectPickerSlot:c,onRequestCreateSkill:f}){const d=l?l.origin==="installed"?"Project":"Skills":null;return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,height:"100%",width:"100%",padding:"0 16px",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexShrink:0},children:[a.jsx(Wj,{onHome:o}),c?a.jsx("div",{style:{borderLeft:"1px solid var(--border-default)",paddingLeft:10,display:"flex",alignItems:"center"},children:c}):n&&a.jsx("span",{title:n,style:{fontSize:12,color:"var(--text-secondary)",borderLeft:"1px solid var(--border-default)",paddingLeft:10,maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})]}),a.jsx("nav",{"aria-label":"Breadcrumb",style:{flex:1,minWidth:0,display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:l&&d&&a.jsxs(a.Fragment,{children:[a.jsx(Wx,{segment:"origin",onClick:()=>Gx({scope:"origin",origin:l.origin}),style:{textTransform:"uppercase",letterSpacing:"0.06em",fontWeight:600,color:l.origin==="installed"?"var(--status-installed)":"var(--status-own)"},children:d}),a.jsx(qx,{}),a.jsx(Wx,{segment:"plugin",onClick:()=>Gx({scope:"plugin",plugin:l.plugin}),style:{fontFamily:"var(--font-mono)",fontSize:11},children:l.plugin}),a.jsx(qx,{}),a.jsx("span",{"data-breadcrumb-segment":"skill","aria-current":"page",style:{color:"var(--text-primary)",fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.skill})]})}),a.jsxs("div",{"data-toprail-right":"true",style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[f&&a.jsxs("button",{type:"button","data-slot":"create-skill-button",onClick:f,"aria-label":"Create a new skill",title:"Create a new skill",style:{display:"inline-flex",alignItems:"center",gap:6,height:28,padding:"0 12px",borderRadius:6,border:"1px solid var(--color-action, #2F5B8E)",background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",fontSize:12,fontWeight:600,fontFamily:"var(--font-sans)",cursor:"pointer",letterSpacing:"0.01em",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"New Skill"]}),a.jsx("span",{"data-slot":"agent-model-picker",style:{minWidth:200},children:a.jsx(Fj,{})}),a.jsx("span",{"data-slot":"update-bell",style:{display:"inline-flex"},children:a.jsx(Kj,{})}),a.jsx("button",{type:"button",onClick:s,"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:a.jsx("span",{children:"⌘K"})})]})]})}function Wx({segment:n,onClick:l,style:s,children:o}){return a.jsx("button",{type:"button","data-breadcrumb-segment":n,onClick:l,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",color:"var(--text-secondary)",fontFamily:"inherit",...s},onMouseEnter:c=>{c.currentTarget.style.color="var(--color-accent-ink)"},onMouseLeave:c=>{const f=(s==null?void 0:s.color)??"var(--text-secondary)";c.currentTarget.style.color=f},children:o})}function qx(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)",fontSize:10},children:"›"})}const Oo="vskill-theme";function gv(n){return n==="light"||n==="dark"||n==="auto"?n:"auto"}function Qj(n,l){return n==="light"||n==="dark"?n:l?"dark":"light"}function Zj(n){try{const l=n.getItem(Oo);return gv(l)}catch{return"auto"}}function Jj(n,l){try{n.setItem(Oo,l)}catch{}}function e2(n,l,s){n.dataset.theme=s,n.dataset.themeMode=l}function t2(n){if(!n)return!1;try{return n("(prefers-color-scheme: dark)").matches}catch{return!1}}const vv=g.createContext(null);function n2({storage:n,matchMedia:l,target:s,children:o}){const c=n??(typeof window<"u"?window.localStorage:void 0),f=l??(typeof window<"u"?window.matchMedia.bind(window):void 0),d=s??(typeof document<"u"?document.documentElement:void 0),[h,x]=g.useState(()=>c?Zj(c):"auto"),[p,y]=g.useState(()=>t2(f)),v=g.useMemo(()=>Qj(h,p),[h,p]);g.useEffect(()=>{d&&e2(d,h,v)},[d,h,v]),g.useEffect(()=>{if(!f)return;const k=f("(prefers-color-scheme: dark)"),N=w=>y(w.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",N),()=>k.removeEventListener("change",N);const C=k;return C.addListener(N),()=>C.removeListener(N)},[f]),g.useEffect(()=>{if(typeof window>"u")return;const k=N=>{N.key===Oo&&x(gv(N.newValue))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),g.useEffect(()=>{if(!f||!d)return;let k;try{k=f("(prefers-contrast: more)")}catch{return}const N=A=>{A?d.dataset.contrast="more":d.dataset.contrast==="more"&&delete d.dataset.contrast};N(k.matches);const C=A=>N(A.matches);if(typeof k.addEventListener=="function")return k.addEventListener("change",C),()=>k.removeEventListener("change",C);const w=k;return w.addListener(C),()=>w.removeListener(C)},[f,d]);const b=g.useCallback(k=>{x(k),c&&Jj(c,k)},[c]),j=g.useMemo(()=>({mode:h,resolvedTheme:v,setTheme:b}),[h,v,b]);return a.jsx(vv.Provider,{value:j,children:o})}function yv(){const n=g.useContext(vv);if(!n)throw new Error("useTheme must be used inside <ThemeProvider>. Wrap the app root in main.tsx.");return n}const Yx=["claude-cli","anthropic","openrouter","ollama","lm-studio"];function a2(n){const l=new Map(n.map(o=>[o.id,o])),s=[];for(const o of Yx){const c=l.get(o);c&&s.push(c)}for(const o of n)Yx.includes(o.id)||s.push(o);return s}function r2(n){const[l,s]=g.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(`(max-width: ${n}px)`).matches);return g.useEffect(()=>{var f;if(typeof window>"u"||!window.matchMedia)return;const o=window.matchMedia(`(max-width: ${n}px)`),c=()=>s(o.matches);return(f=o.addEventListener)==null||f.call(o,"change",c),()=>{var d;return(d=o.removeEventListener)==null?void 0:d.call(o,"change",c)}},[n]),l}function l2({providers:n,onOpenSettings:l,onOpenInstallHelp:s}){const o=a2(n),c=r2(640),[f,d]=g.useState(!1),h=g.useCallback(x=>{x.available||x.kind==="api-key"?l==null||l(x.id):s==null||s(x.id)},[l,s]);if(c){const x=o.filter(p=>p.available).length;return a.jsxs("div",{"data-testid":"providers-segment",style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[a.jsx("button",{type:"button","data-testid":"providers-summary",onClick:()=>d(!f),"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)}),f&&a.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=>a.jsx(Kx,{p,onClick:h},p.id))})]})}return a.jsx("div",{"data-testid":"providers-segment",style:{display:"inline-flex",alignItems:"center",gap:4},children:o.map(x=>a.jsx(Kx,{p:x,onClick:h,compact:!0},x.id))})}function Kx({p:n,onClick:l,compact:s}){const o=n.available?J.statusBar.unlocked(n.label):n.kind==="cli-install"?J.statusBar.lockedCli(n.label):J.statusBar.locked(n.label);return a.jsxs("button",{type:"button","data-testid":`provider-glyph-${n.id}`,"data-available":n.available,"aria-label":o,title:o,onClick:()=>l(n),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:"none",color:n.available?"var(--status-installed)":"var(--text-muted, var(--text-tertiary))",cursor:"pointer",padding:s?"2px":"4px 6px",fontSize:11},children:[a.jsx(Id,{unlocked:n.available,size:10}),!s&&a.jsx("span",{children:n.label})]})}function s2(){try{return typeof localStorage>"u"?null:localStorage.getItem(Oo)}catch{return null}}function i2({projectPath:n,modelName:l,health:s="ok",onPathClick:o,providers:c,onOpenProviderSettings:f,onOpenProviderInstallHelp:d}){const{mode:h,resolvedTheme:x,setTheme:p}=yv(),v=s2()==="auto",b=o2(h,x,v),j=s==="down"||s==="degraded"?"var(--status-own)":"var(--status-installed)";return a.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:[a.jsx("span",{title:l??"",style:{fontFamily:"var(--font-mono)"},children:l??"—"}),a.jsx(Xx,{}),a.jsxs("span",{"aria-label":`Health: ${s}`,style:{display:"inline-flex",alignItems:"center",gap:6},children:[a.jsx(c2,{color:j}),a.jsx("span",{style:{textTransform:"capitalize"},children:s})]}),c&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Xx,{}),a.jsx(l2,{providers:c,onOpenSettings:f,onOpenInstallHelp:d})]}),a.jsx("div",{style:{flex:1}}),a.jsxs("button",{type:"button","data-testid":"theme-toggle",onClick:()=>p(b),"aria-label":`Switch to ${b} theme`,title:`Theme: ${h} — click for ${b}`,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:[a.jsx(u2,{mode:h}),a.jsx("span",{style:{textTransform:"capitalize"},children:h})]})]})}function o2(n,l,s){return n==="light"?"dark":n==="dark"?"auto":s?"light":l==="light"?"dark":"light"}function c2({color:n}){return a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:n,display:"inline-block",flexShrink:0}})}function Xx(){return a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border-default)"},children:"|"})}function u2({mode:n}){return n==="dark"?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):n==="light"?a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"4"}),a.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"})]}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"9"}),a.jsx("path",{d:"M12 3a9 9 0 0 0 0 18z",fill:"currentColor"})]})}const bo=new Map,wr=new Map,Es=new Map;function rn(n){bo.delete(n),wr.delete(n);const l=Es.get(n);if(l)for(const s of l)s()}function Cl(n,l,s={}){const{ttl:o=3e4,enabled:c=!0}=s,[,f]=g.useState(0),d=g.useRef(!0),h=g.useRef(n);h.current=n;const x=()=>rn(n);g.useEffect(()=>(d.current=!0,()=>{d.current=!1}),[]),g.useEffect(()=>{if(!c)return;const b=()=>{d.current&&f(j=>j+1)};return Es.has(n)||Es.set(n,new Set),Es.get(n).add(b),()=>{var j;(j=Es.get(n))==null||j.delete(b)}},[n,c]),g.useEffect(()=>{if(!c)return;const b=bo.get(n);if(!(!b||Date.now()-b.fetchedAt>o))return;if(wr.has(n)){const C=wr.get(n),w=()=>{d.current&&h.current===n&&f(A=>A+1)};C.subscribers.push(w);return}const k={promise:Promise.resolve(),subscribers:[]},N=l().then(C=>{bo.set(n,{data:C,fetchedAt:Date.now()}),wr.delete(n),d.current&&h.current===n&&f(w=>w+1);for(const w of k.subscribers)w()},C=>{wr.delete(n),d.current&&h.current===n&&f(w=>w+1);for(const w of k.subscribers)w();throw C});k.promise=N,wr.set(n,k)},[n,l,o,c]);const p=bo.get(n),y=c&&!p&&wr.has(n);return{data:p==null?void 0:p.data,loading:y||c&&!p,error:void 0,revalidate:x}}const Bo=0,tr=1,El=2,bv=4;function Qx(n){return()=>n}function d2(n){n()}function Sv(n,l){return s=>n(l(s))}function Zx(n,l){return()=>n(l)}function f2(n,l){return s=>n(l,s)}function lf(n){return n!==void 0}function p2(...n){return()=>{n.map(d2)}}function Nl(){}function Io(n,l){return l(n),n}function m2(n,l){return l(n)}function xt(...n){return n}function at(n,l){return n(tr,l)}function Ve(n,l){n(Bo,l)}function sf(n){n(El)}function bt(n){return n(bv)}function Ee(n,l){return at(n,f2(l,Bo))}function Gn(n,l){const s=n(tr,o=>{s(),l(o)});return s}function Jx(n){let l,s;return o=>c=>{l=c,s&&clearTimeout(s),s=setTimeout(()=>{o(l)},n)}}function jv(n,l){return n===l}function ht(n=jv){let l;return s=>o=>{n(l,o)||(l=o,s(o))}}function Le(n){return l=>s=>{n(s)&&l(s)}}function be(n){return l=>Sv(l,n)}function Zn(n){return l=>()=>{l(n)}}function oe(n,...l){const s=h2(...l);return((o,c)=>{switch(o){case El:sf(n);return;case tr:return at(n,s(c))}})}function Jn(n,l){return s=>o=>{s(l=n(l,o))}}function Er(n){return l=>s=>{n>0?n--:l(s)}}function ja(n){let l=null,s;return o=>c=>{l=c,!s&&(s=setTimeout(()=>{s=void 0,o(l)},n))}}function Ge(...n){const l=new Array(n.length);let s=0,o=null;const c=2**n.length-1;return n.forEach((f,d)=>{const h=2**d;at(f,x=>{const p=s;s|=h,l[d]=x,p!==c&&s===c&&o&&(o(),o=null)})}),f=>d=>{const h=()=>{f([d].concat(l))};s===c?h():o=h}}function h2(...n){return l=>n.reduceRight(m2,l)}function x2(n){let l,s;const o=()=>l==null?void 0:l();return function(c,f){switch(c){case tr:return f?s===f?void 0:(o(),s=f,l=at(n,f),l):(o(),Nl);case El:o(),s=null;return}}}function me(n){let l=n;const s=Ze();return((o,c)=>{switch(o){case Bo:l=c;break;case tr:{c(l);break}case bv:return l}return s(o,c)})}function Jt(n,l){return Io(me(l),s=>Ee(n,s))}function Ze(){const n=[];return((l,s)=>{switch(l){case Bo:n.slice().forEach(o=>{o(s)});return;case El:n.splice(0,n.length);return;case tr:return n.push(s),()=>{const o=n.indexOf(s);o>-1&&n.splice(o,1)}}})}function kn(n){return Io(Ze(),l=>Ee(n,l))}function tt(n,l=[],{singleton:s}={singleton:!0}){return{constructor:n,dependencies:l,id:g2(),singleton:s}}const g2=()=>Symbol();function v2(n){const l=new Map,s=({constructor:o,dependencies:c,id:f,singleton:d})=>{if(d&&l.has(f))return l.get(f);const h=o(c.map(x=>s(x)));return d&&l.set(f,h),h};return s(n)}function _t(...n){const l=Ze(),s=new Array(n.length);let o=0;const c=2**n.length-1;return n.forEach((f,d)=>{const h=2**d;at(f,x=>{s[d]=x,o|=h,o===c&&Ve(l,s)})}),function(f,d){switch(f){case El:{sf(l);return}case tr:return o===c&&d(s),at(l,d)}}}function Me(n,l=jv){return oe(n,ht(l))}function Hd(...n){return function(l,s){switch(l){case El:return;case tr:return p2(...n.map(o=>at(o,s)))}}}const Ht={DEBUG:0,INFO:1,WARN:2,ERROR:3},y2={[Ht.DEBUG]:"debug",[Ht.ERROR]:"error",[Ht.INFO]:"log",[Ht.WARN]:"warn"},b2=()=>typeof globalThis>"u"?window:globalThis,nr=tt(()=>{const n=me(Ht.ERROR);return{log:me((l,s,o=Ht.INFO)=>{const c=b2().VIRTUOSO_LOG_LEVEL??bt(n);o>=c&&console[y2[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",l,s)}),logLevel:n}},[],{singleton:!0});function Tr(n,l,s){return of(n,l,s).callbackRef}function of(n,l,s){const o=Ce.useRef(null);let c=d=>{};const f=Ce.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(d=>{const h=()=>{const x=d[0].target;x.offsetParent!==null&&n(x)};s?h():requestAnimationFrame(h)}):null,[n,s]);return c=d=>{d&&l?(f==null||f.observe(d),o.current=d):(o.current&&(f==null||f.unobserve(o.current)),o.current=null)},{callbackRef:c,ref:o}}function S2(n,l,s,o,c,f,d,h,x){const p=Ce.useCallback(y=>{const v=j2(y.children,l,h?"offsetWidth":"offsetHeight",c);let b=y.parentElement;for(;b.dataset.virtuosoScroller===void 0;)b=b.parentElement;const j=b.lastElementChild.dataset.viewportType==="window";let k;j&&(k=b.ownerDocument.defaultView);const N=d?h?d.scrollLeft:d.scrollTop:j?h?k.scrollX||k.document.documentElement.scrollLeft:k.scrollY||k.document.documentElement.scrollTop:h?b.scrollLeft:b.scrollTop,C=d?h?d.scrollWidth:d.scrollHeight:j?h?k.document.documentElement.scrollWidth:k.document.documentElement.scrollHeight:h?b.scrollWidth:b.scrollHeight,w=d?h?d.offsetWidth:d.offsetHeight:j?h?k.innerWidth:k.innerHeight:h?b.offsetWidth:b.offsetHeight;o({scrollHeight:C,scrollTop:Math.max(N,0),viewportHeight:w}),f==null||f(h?eg("column-gap",getComputedStyle(y).columnGap,c):eg("row-gap",getComputedStyle(y).rowGap,c)),v!==null&&n(v)},[n,l,c,f,d,o,h]);return of(p,s,x)}function j2(n,l,s,o){const c=n.length;if(c===0)return null;const f=[];for(let d=0;d<c;d++){const h=n.item(d);if(h.dataset.index===void 0)continue;const x=parseInt(h.dataset.index),p=parseFloat(h.dataset.knownSize),y=l(h,s);if(y===0&&o("Zero-sized element, this should not happen",{child:h},Ht.ERROR),y===p)continue;const v=f[f.length-1];f.length===0||v.size!==y||v.endIndex!==x-1?f.push({endIndex:x,size:y,startIndex:x}):f[f.length-1].endIndex++}return f}function eg(n,l,s){return l!=="normal"&&(l==null?void 0:l.endsWith("px"))!==!0&&s(`${n} was not resolved to pixel value correctly`,l,Ht.WARN),l==="normal"?0:parseInt(l??"0",10)}function kv(n,l,s){const o=Ce.useRef(null),c=Ce.useCallback(x=>{if(!(x!=null&&x.offsetParent))return;const p=x.getBoundingClientRect(),y=p.width;let v,b;if(l){const j=l.getBoundingClientRect(),k=p.top-j.top;b=j.height-Math.max(0,k),v=k+l.scrollTop}else{const j=d.current.ownerDocument.defaultView;b=j.innerHeight-Math.max(0,p.top),v=p.top+j.scrollY}o.current={listHeight:p.height,offsetTop:v,visibleHeight:b,visibleWidth:y},n(o.current)},[n,l]),{callbackRef:f,ref:d}=of(c,!0,s),h=Ce.useCallback(()=>{c(d.current)},[c,d]);return Ce.useEffect(()=>{var p;if(l){l.addEventListener("scroll",h);const y=new ResizeObserver(()=>{requestAnimationFrame(h)});return y.observe(l),()=>{l.removeEventListener("scroll",h),y.unobserve(l)}}const x=(p=d.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,l,d]),f}const ln=tt(()=>{const n=Ze(),l=Ze(),s=me(0),o=Ze(),c=me(0),f=Ze(),d=Ze(),h=me(0),x=me(0),p=me(0),y=me(0),v=Ze(),b=Ze(),j=me(!1),k=me(!1),N=me(!1);return Ee(oe(n,be(({scrollTop:C})=>C)),l),Ee(oe(n,be(({scrollHeight:C})=>C)),d),Ee(l,c),{deviation:s,fixedFooterHeight:p,fixedHeaderHeight:x,footerHeight:y,headerHeight:h,horizontalDirection:k,scrollBy:b,scrollContainerState:n,scrollHeight:d,scrollingInProgress:j,scrollTo:v,scrollTop:l,skipAnimationFrameInResizeObserver:N,smoothScrollTargetReached:o,statefulScrollTop:c,viewportHeight:f}},[],{singleton:!0}),Ds={lvl:0};function wv(n,l){const s=n.length;if(s===0)return[];let{index:o,value:c}=l(n[0]);const f=[];for(let d=1;d<s;d++){const{index:h,value:x}=l(n[d]);f.push({end:h-1,start:o,value:c}),o=h,c=x}return f.push({end:1/0,start:o,value:c}),f}function dt(n){return n===Ds}function _s(n,l){if(!dt(n))return l===n.k?n.v:l<n.k?_s(n.l,l):_s(n.r,l)}function qn(n,l,s="k"){if(dt(n))return[-1/0,void 0];if(Number(n[s])===l)return[n.k,n.v];if(Number(n[s])<l){const o=qn(n.r,l,s);return o[0]===-1/0?[n.k,n.v]:o}return qn(n.l,l,s)}function Sn(n,l,s){return dt(n)?Nv(l,s,1):l===n.k?It(n,{k:l,v:s}):l<n.k?tg(It(n,{l:Sn(n.l,l,s)})):tg(It(n,{r:Sn(n.r,l,s)}))}function gl(){return Ds}function vl(n,l,s){if(dt(n))return[];const o=qn(n,l)[0];return k2($d(n,o,s))}function Ud(n,l){if(dt(n))return Ds;const{k:s,l:o,r:c}=n;if(l===s){if(dt(o))return c;if(dt(c))return o;const[f,d]=Ev(o);return So(It(n,{k:f,l:Cv(o),v:d}))}return l<s?So(It(n,{l:Ud(o,l)})):So(It(n,{r:Ud(c,l)}))}function Cr(n){return dt(n)?[]:[...Cr(n.l),{k:n.k,v:n.v},...Cr(n.r)]}function $d(n,l,s){if(dt(n))return[];const{k:o,l:c,r:f,v:d}=n;let h=[];return o>l&&(h=h.concat($d(c,l,s))),o>=l&&o<=s&&h.push({k:o,v:d}),o<=s&&(h=h.concat($d(f,l,s))),h}function So(n){const{l,lvl:s,r:o}=n;if(o.lvl>=s-1&&l.lvl>=s-1)return n;if(s>o.lvl+1){if(md(l))return Tv(It(n,{lvl:s-1}));if(!dt(l)&&!dt(l.r))return It(l.r,{l:It(l,{r:l.r.l}),lvl:s,r:It(n,{l:l.r.r,lvl:s-1})});throw new Error("Unexpected empty nodes")}if(md(n))return Pd(It(n,{lvl:s-1}));if(!dt(o)&&!dt(o.l)){const c=o.l,f=md(c)?o.lvl-1:o.lvl;return It(c,{l:It(n,{lvl:s-1,r:c.l}),lvl:c.lvl+1,r:Pd(It(o,{l:c.r,lvl:f}))})}throw new Error("Unexpected empty nodes")}function It(n,l){return Nv(l.k!==void 0?l.k:n.k,l.v!==void 0?l.v:n.v,l.lvl!==void 0?l.lvl:n.lvl,l.l!==void 0?l.l:n.l,l.r!==void 0?l.r:n.r)}function Cv(n){return dt(n.r)?n.l:So(It(n,{r:Cv(n.r)}))}function md(n){return dt(n)||n.lvl>n.r.lvl}function Ev(n){return dt(n.r)?[n.k,n.v]:Ev(n.r)}function Nv(n,l,s,o=Ds,c=Ds){return{k:n,l:o,lvl:s,r:c,v:l}}function tg(n){return Pd(Tv(n))}function Tv(n){const{l}=n;return!dt(l)&&l.lvl===n.lvl?It(l,{r:It(n,{l:l.r})}):n}function Pd(n){const{lvl:l,r:s}=n;return!dt(s)&&!dt(s.r)&&s.lvl===l&&s.r.lvl===l?It(s,{l:It(n,{r:s.l}),lvl:l+1}):n}function k2(n){return wv(n,({k:l,v:s})=>({index:l,value:s}))}function Rv(n,l){return!!(n&&n.startIndex===l.startIndex&&n.endIndex===l.endIndex)}function Os(n,l){return!!(n&&n[0]===l[0]&&n[1]===l[1])}const cf=tt(()=>({recalcInProgress:me(!1)}),[],{singleton:!0});function Av(n,l,s){return n[Eo(n,l,s)]}function Eo(n,l,s,o=0){let c=n.length-1;for(;o<=c;){const f=Math.floor((o+c)/2),d=n[f],h=s(d,l);if(h===0)return f;if(h===-1){if(c-o<2)return f-1;c=f-1}else{if(c===o)return f;o=f+1}}throw new Error(`Failed binary finding record in array - ${n.join(",")}, searched for ${l}`)}function w2(n,l,s,o){const c=Eo(n,l,o),f=Eo(n,s,o,c);return n.slice(c,f+1)}function Ja(n,l){return Math.round(n.getBoundingClientRect()[l])}function Ho(n){return!dt(n.groupOffsetTree)}function uf({index:n},l){return l===n?0:l<n?-1:1}function C2(){return{groupIndices:[],groupOffsetTree:gl(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:gl()}}function E2(n,l){let s=dt(n)?0:1/0;for(const o of l){const{endIndex:c,size:f,startIndex:d}=o;if(s=Math.min(s,d),dt(n)){n=Sn(n,0,f);continue}const h=vl(n,d-1,c+1);if(h.some(z2(o)))continue;let x=!1,p=!1;for(const{end:y,start:v,value:b}of h)x?(c>=v||f===b)&&(n=Ud(n,v)):(p=b!==f,x=!0),y>c&&c>=v&&b!==f&&(n=Sn(n,c+1,b));p&&(n=Sn(n,d,f))}return[n,s]}function N2(n){return typeof n.groupIndex<"u"}function T2({offset:n},l){return l===n?0:l<n?-1:1}function Bs(n,l,s){if(l.length===0)return 0;const{index:o,offset:c,size:f}=Av(l,n,uf),d=n-o,h=f*d+(d-1)*s+c;return h>0?h+s:h}function Mv(n,l){if(!Ho(l))return n;let s=0;for(;l.groupIndices[s]<=n+s;)s++;return n+s}function Lv(n,l,s){if(N2(n))return l.groupIndices[n.groupIndex]+1;const o=n.index==="LAST"?s:n.index;let c=Mv(o,l);return c=Math.max(0,c,Math.min(s,c)),c}function R2(n,l,s,o=0){return o>0&&(l=Math.max(l,Av(n,o,uf).offset)),wv(w2(n,l,s,T2),L2)}function A2(n,[l,s,o,c]){l.length>0&&o("received item sizes",l,Ht.DEBUG);const f=n.sizeTree;let d=f,h=0;if(s.length>0&&dt(f)&&l.length===2){const b=l[0].size,j=l[1].size;d=s.reduce((k,N)=>Sn(Sn(k,N,b),N+1,j),d)}else[d,h]=E2(d,l);if(d===f)return n;const{lastIndex:x,lastOffset:p,lastSize:y,offsetTree:v}=Vd(n.offsetTree,h,d,c);return{groupIndices:s,groupOffsetTree:s.reduce((b,j)=>Sn(b,j,Bs(j,v,c)),gl()),lastIndex:x,lastOffset:p,lastSize:y,offsetTree:v,sizeTree:d}}function M2(n){return Cr(n).map(({k:l,v:s},o,c)=>{const f=c[o+1];return{endIndex:f!==void 0?f.k-1:1/0,size:s,startIndex:l}})}function ng(n,l){let s=0,o=0;for(;s<n;)s+=l[o+1]-l[o]-1,o++;return o-(s===n?0:1)}function Vd(n,l,s,o){let c=n,f=0,d=0,h=0,x=0;if(l!==0){x=Eo(c,l-1,uf),h=c[x].offset;const p=qn(s,l-1);f=p[0],d=p[1],c.length&&c[x].size===qn(s,l)[1]&&(x-=1),c=c.slice(0,x+1)}else c=[];for(const{start:p,value:y}of vl(s,l,1/0)){const v=p-f,b=v*d+h+v*o;c.push({index:p,offset:b,size:y}),f=p,h=b,d=y}return{lastIndex:f,lastOffset:h,lastSize:d,offsetTree:c}}function L2(n){return{index:n.index,value:n}}function z2(n){const{endIndex:l,size:s,startIndex:o}=n;return c=>c.start===o&&(c.end===l||c.end===1/0)&&c.value===s}const D2={offsetHeight:"height",offsetWidth:"width"},ta=tt(([{log:n},{recalcInProgress:l}])=>{const s=Ze(),o=Ze(),c=Jt(o,0),f=Ze(),d=Ze(),h=me(0),x=me([]),p=me(void 0),y=me(void 0),v=me(void 0),b=me(void 0),j=me((E,D)=>Ja(E,D2[D])),k=me(void 0),N=me(0),C=C2(),w=Jt(oe(s,Ge(x,n,N),Jn(A2,C),ht()),C),A=Jt(oe(x,ht(),Jn((E,D)=>({current:D,prev:E.current}),{current:[],prev:[]}),be(({prev:E})=>E)),[]);Ee(oe(x,Le(E=>E.length>0),Ge(w,N),be(([E,D,R])=>{const B=E.reduce((P,W,te)=>Sn(P,W,Bs(W,D.offsetTree,R)||te),gl());return{...D,groupIndices:E,groupOffsetTree:B}})),w),Ee(oe(o,Ge(w),Le(([E,{lastIndex:D}])=>E<D),be(([E,{lastIndex:D,lastSize:R}])=>[{endIndex:D,size:R,startIndex:E}])),s),Ee(p,y);const _=Jt(oe(p,be(E=>E===void 0)),!0);Ee(oe(y,Le(E=>E!==void 0&&dt(bt(w).sizeTree)),be(E=>{const D=bt(v),R=bt(x).length>0;return D!==void 0&&D!==0?R?[{endIndex:0,size:D,startIndex:0},{endIndex:1,size:E,startIndex:1}]:[]:[{endIndex:0,size:E,startIndex:0}]})),s),Ee(oe(b,Le(E=>E!==void 0&&E.length>0&&dt(bt(w).sizeTree)),be(E=>{const D=[];let R=E[0],B=0;for(let P=1;P<E.length;P++){const W=E[P];W!==R&&(D.push({endIndex:P-1,size:R,startIndex:B}),R=W,B=P)}return D.push({endIndex:E.length-1,size:R,startIndex:B}),D})),s),Ee(oe(x,Ge(v,y),Le(([,E,D])=>E!==void 0&&D!==void 0),be(([E,D,R])=>{const B=[];for(let P=0;P<E.length;P++){const W=E[P],te=E[P+1];B.push({startIndex:W,endIndex:W,size:D}),te!==void 0&&B.push({startIndex:W+1,endIndex:te-1,size:R})}return B})),s);const H=kn(oe(s,Ge(w),Jn(({sizes:E},[D,R])=>({changed:R!==E,sizes:R}),{changed:!1,sizes:C}),be(E=>E.changed)));at(oe(h,Jn((E,D)=>({diff:E.prev-D,prev:D}),{diff:0,prev:0}),be(E=>E.diff)),E=>{const{groupIndices:D}=bt(w);if(E>0)Ve(l,!0),Ve(f,E+ng(E,D));else if(E<0){const R=bt(A);R.length>0&&(E-=ng(-E,R)),Ve(d,E)}}),at(oe(h,Ge(n)),([E,D])=>{E<0&&D("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:h},Ht.ERROR)});const L=kn(f);Ee(oe(f,Ge(w),be(([E,D])=>{const R=D.groupIndices.length>0,B=[],P=D.lastSize;if(R){const W=_s(D.sizeTree,0);let te=0,Q=0;for(;te<E;){const M=D.groupIndices[Q],I=D.groupIndices.length===Q+1?1/0:D.groupIndices[Q+1]-M-1;B.push({endIndex:M,size:W,startIndex:M}),B.push({endIndex:M+1+I-1,size:P,startIndex:M+1}),Q++,te+=I+1}const z=Cr(D.sizeTree);return te!==E&&z.shift(),z.reduce((M,{k:I,v:X})=>{let G=M.ranges;return M.prevSize!==0&&(G=[...M.ranges,{endIndex:I+E-1,size:M.prevSize,startIndex:M.prevIndex}]),{prevIndex:I+E,prevSize:X,ranges:G}},{prevIndex:E,prevSize:0,ranges:B}).ranges}return Cr(D.sizeTree).reduce((W,{k:te,v:Q})=>({prevIndex:te+E,prevSize:Q,ranges:[...W.ranges,{endIndex:te+E-1,size:W.prevSize,startIndex:W.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),s);const $=kn(oe(d,Ge(w,N),be(([E,{offsetTree:D},R])=>{const B=-E;return Bs(B,D,R)})));return Ee(oe(d,Ge(w,N),be(([E,D,R])=>{if(D.groupIndices.length>0){if(dt(D.sizeTree))return D;let P=gl();const W=bt(A);let te=0,Q=0,z=0;for(;te<-E;){z=W[Q];const M=W[Q+1]-z-1;Q++,te+=M+1}if(P=Cr(D.sizeTree).reduce((M,{k:I,v:X})=>Sn(M,Math.max(0,I+E),X),P),te!==-E){const M=_s(D.sizeTree,z);P=Sn(P,0,M);const I=qn(D.sizeTree,-E+1)[1];P=Sn(P,1,I)}return{...D,sizeTree:P,...Vd(D.offsetTree,0,P,R)}}const B=Cr(D.sizeTree).reduce((P,{k:W,v:te})=>Sn(P,Math.max(0,W+E),te),gl());return{...D,sizeTree:B,...Vd(D.offsetTree,0,B,R)}})),w),{beforeUnshiftWith:L,data:k,defaultItemSize:y,firstItemIndex:h,fixedItemSize:p,fixedGroupSize:v,gap:N,groupIndices:x,heightEstimates:b,itemSize:j,listRefresh:H,shiftWith:d,shiftWithOffset:$,sizeRanges:s,sizes:w,statefulTotalCount:c,totalCount:o,trackItemSizes:_,unshiftWith:f}},xt(nr,cf),{singleton:!0});function _2(n){return n.reduce((l,s)=>(l.groupIndices.push(l.totalCount),l.totalCount+=s+1,l),{groupIndices:[],totalCount:0})}const zv=tt(([{groupIndices:n,sizes:l,totalCount:s},{headerHeight:o,scrollTop:c}])=>{const f=Ze(),d=Ze(),h=kn(oe(f,be(_2)));return Ee(oe(h,be(x=>x.totalCount)),s),Ee(oe(h,be(x=>x.groupIndices)),n),Ee(oe(_t(c,l,o),Le(([x,p])=>Ho(p)),be(([x,p,y])=>qn(p.groupOffsetTree,Math.max(x-y,0),"v")[0]),ht(),be(x=>[x])),d),{groupCounts:f,topItemsIndexes:d}},xt(ta,ln)),ar=tt(([{log:n}])=>{const l=me(!1),s=kn(oe(l,Le(o=>o),ht()));return at(l,o=>{o&&bt(n)("props updated",{},Ht.DEBUG)}),{didMount:s,propsReady:l}},xt(nr),{singleton:!0}),O2=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Dv(n){const l=typeof n=="number"?{index:n}:n;return l.align||(l.align="start"),(!l.behavior||!O2)&&(l.behavior="auto"),l.offset===void 0&&(l.offset=0),l}const Vs=tt(([{gap:n,listRefresh:l,sizes:s,totalCount:o},{fixedFooterHeight:c,fixedHeaderHeight:f,footerHeight:d,headerHeight:h,scrollingInProgress:x,scrollTo:p,smoothScrollTargetReached:y,viewportHeight:v},{log:b}])=>{const j=Ze(),k=Ze(),N=me(0);let C=null,w=null,A=null;function _(){C!==null&&(C(),C=null),A!==null&&(A(),A=null),w&&(clearTimeout(w),w=null),Ve(x,!1)}return Ee(oe(j,Ge(s,v,o,N,h,d,b),Ge(n,f,c),be(([[H,L,$,E,D,R,B,P],W,te,Q])=>{const z=Dv(H),{align:M,behavior:I,offset:X}=z,G=E-1,ce=Lv(z,L,G);let O=Bs(ce,L.offsetTree,W)+R;M==="end"?(O+=te+qn(L.sizeTree,ce)[1]-$+Q,ce===G&&(O+=B)):M==="center"?O+=(te+qn(L.sizeTree,ce)[1]-$+Q)/2:O-=D,X!==void 0&&X!==0&&(O+=X);const Y=se=>{_(),se?(P("retrying to scroll to",{location:H},Ht.DEBUG),Ve(j,H)):(Ve(k,!0),P("list did not change, scroll successful",{},Ht.DEBUG))};if(_(),I==="smooth"){let se=!1;A=at(l,ue=>{se=se||ue}),C=Gn(y,()=>{Y(se)})}else C=Gn(oe(l,B2(150)),Y);return w=setTimeout(()=>{_()},1200),Ve(x,!0),P("scrolling from index to",{behavior:I,index:ce,top:O},Ht.DEBUG),{behavior:I,top:O}})),p),{scrollTargetReached:k,scrollToIndex:j,topListHeight:N}},xt(ta,ln,nr),{singleton:!0});function B2(n){return l=>{const s=setTimeout(()=>{l(!1)},n);return o=>{o&&(l(!0),clearTimeout(s))}}}function df(n,l){n===0?l():requestAnimationFrame(()=>{df(n-1,l)})}function ff(n,l){const s=l-1;return typeof n=="number"?n:n.index==="LAST"?s:n.index}const Fs=tt(([{defaultItemSize:n,listRefresh:l,sizes:s},{scrollTop:o},{scrollTargetReached:c,scrollToIndex:f},{didMount:d}])=>{const h=me(!0),x=me(0),p=me(!0);return Ee(oe(d,Ge(x),Le(([y,v])=>v!==0),Zn(!1)),h),Ee(oe(d,Ge(x),Le(([y,v])=>v!==0),Zn(!1)),p),at(oe(_t(l,d),Ge(h,s,n,p),Le(([[,y],v,{sizeTree:b},j,k])=>y&&(!dt(b)||lf(j))&&!v&&!k),Ge(x)),([,y])=>{Gn(c,()=>{Ve(p,!0)}),df(4,()=>{Gn(o,()=>{Ve(h,!0)}),Ve(f,y)})}),{initialItemFinalLocationReached:p,initialTopMostItemIndex:x,scrolledToInitialItem:h}},xt(ta,ln,Vs,ar),{singleton:!0});function _v(n,l){return Math.abs(n-l)<1.01}const Is="up",As="down",I2="none",H2={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},U2=0,Gs=tt(([{footerHeight:n,headerHeight:l,scrollBy:s,scrollContainerState:o,scrollTop:c,viewportHeight:f}])=>{const d=me(!1),h=me(!0),x=Ze(),p=Ze(),y=me(4),v=me(U2),b=Jt(oe(Hd(oe(Me(c),Er(1),Zn(!0)),oe(Me(c),Er(1),Zn(!1),Jx(100))),ht()),!1),j=Jt(oe(Hd(oe(s,Zn(!0)),oe(s,Zn(!1),Jx(200))),ht()),!1);Ee(oe(_t(Me(c),Me(v)),be(([A,_])=>A<=_),ht()),h),Ee(oe(h,ja(50)),p);const k=kn(oe(_t(o,Me(f),Me(l),Me(n),Me(y)),Jn((A,[{scrollHeight:_,scrollTop:H},L,$,E,D])=>{const R=H+L-_>-D,B={scrollHeight:_,scrollTop:H,viewportHeight:L};if(R){let W,te;return H>A.state.scrollTop?(W="SCROLLED_DOWN",te=A.state.scrollTop-H):(W="SIZE_DECREASED",te=A.state.scrollTop-H||A.scrollTopDelta),{atBottom:!0,atBottomBecause:W,scrollTopDelta:te,state:B}}let P;return B.scrollHeight>A.state.scrollHeight?P="SIZE_INCREASED":L<A.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":H<A.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:B}},H2),ht((A,_)=>A!==void 0&&A.atBottom===_.atBottom))),N=Jt(oe(o,Jn((A,{scrollHeight:_,scrollTop:H,viewportHeight:L})=>{if(!_v(A.scrollHeight,_)){const $=_-(H+L)<1;return A.scrollTop!==H&&$?{changed:!0,jump:A.scrollTop-H,scrollHeight:_,scrollTop:H}:{changed:!0,jump:0,scrollHeight:_,scrollTop:H}}return{changed:!1,jump:0,scrollHeight:_,scrollTop:H}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),Le(A=>A.changed),be(A=>A.jump)),0);Ee(oe(k,be(A=>A.atBottom)),d),Ee(oe(d,ja(50)),x);const C=me(As);Ee(oe(o,be(({scrollTop:A})=>A),ht(),Jn((A,_)=>bt(j)?{direction:A.direction,prevScrollTop:_}:{direction:_<A.prevScrollTop?Is:As,prevScrollTop:_},{direction:As,prevScrollTop:0}),be(A=>A.direction)),C),Ee(oe(o,ja(50),Zn(I2)),C);const w=me(0);return Ee(oe(b,Le(A=>!A),Zn(0)),w),Ee(oe(c,ja(100),Ge(b),Le(([A,_])=>_),Jn(([A,_],[H])=>[_,H],[0,0]),be(([A,_])=>_-A)),w),{atBottomState:k,atBottomStateChange:x,atBottomThreshold:y,atTopStateChange:p,atTopThreshold:v,isAtBottom:d,isAtTop:h,isScrolling:b,lastJumpDueToItemResize:N,scrollDirection:C,scrollVelocity:w}},xt(ln)),Hs="top",Us="bottom",ag="none";function rg(n,l,s){return typeof n=="number"?s===Is&&l===Hs||s===As&&l===Us?n:0:s===Is?l===Hs?n.main:n.reverse:l===Us?n.main:n.reverse}function lg(n,l){return typeof n=="number"?n:n[l]??0}const pf=tt(([{deviation:n,fixedHeaderHeight:l,headerHeight:s,scrollTop:o,viewportHeight:c}])=>{const f=Ze(),d=me(0),h=me(0),x=me(0),p=Jt(oe(_t(Me(o),Me(c),Me(s),Me(f,Os),Me(x),Me(d),Me(l),Me(n),Me(h)),be(([y,v,b,[j,k],N,C,w,A,_])=>{const H=y-A,L=C+w,$=Math.max(b-H,0);let E=ag;const D=lg(_,Hs),R=lg(_,Us);return j-=A,j+=b+w,k+=b+w,k-=A,j>y+L-D&&(E=Is),k<y-$+v+R&&(E=As),E!==ag?[Math.max(H-b-rg(N,Hs,E)-D,0),H-$-w+v+rg(N,Us,E)+R]:null}),Le(y=>y!==null),ht(Os)),[0,0]);return{increaseViewportBy:h,listBoundary:f,overscan:x,topListHeight:d,visibleRange:p}},xt(ln),{singleton:!0});function $2(n,l,s){if(Ho(l)){const o=Mv(n,l);return[{index:qn(l.groupOffsetTree,o)[0],offset:0,size:0},{data:s==null?void 0:s[0],index:o,offset:0,size:0}]}return[{data:s==null?void 0:s[0],index:n,offset:0,size:0}]}const hd={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function jo(n,l,s,o,c,f){const{lastIndex:d,lastOffset:h,lastSize:x}=c;let p=0,y=0;if(n.length>0){p=n[0].offset;const N=n[n.length-1];y=N.offset+N.size}const v=s-d,b=h+v*x+(v-1)*o,j=p,k=b-y;return{bottom:y,firstItemIndex:f,items:sg(n,c,f),offsetBottom:k,offsetTop:p,top:j,topItems:sg(l,c,f),topListHeight:l.reduce((N,C)=>C.size+N,0),totalCount:s}}function Ov(n,l,s,o,c,f){let d=0;if(s.groupIndices.length>0)for(const y of s.groupIndices){if(y-d>=n)break;d++}const h=n+d,x=ff(l,h),p=Array.from({length:h}).map((y,v)=>({data:f[v+x],index:v+x,offset:0,size:0}));return jo(p,[],h,c,s,o)}function sg(n,l,s){if(n.length===0)return[];if(!Ho(l))return n.map(p=>({...p,index:p.index+s,originalIndex:p.index}));const o=n[0].index,c=n[n.length-1].index,f=[],d=vl(l.groupOffsetTree,o,c);let h,x=0;for(const p of n){(!h||h.end<p.index)&&(h=d.shift(),x=l.groupIndices.indexOf(h.start));let y;p.index===h.start?y={index:x,type:"group"}:y={groupIndex:x,index:p.index-(x+1)+s},f.push({...y,data:p.data,offset:p.offset,originalIndex:p.index,size:p.size})}return f}function ig(n,l){return n===void 0?0:typeof n=="number"?n:n[l]??0}const Rr=tt(([{data:n,firstItemIndex:l,gap:s,sizes:o,totalCount:c},f,{listBoundary:d,topListHeight:h,visibleRange:x},{initialTopMostItemIndex:p,scrolledToInitialItem:y},{topListHeight:v},b,{didMount:j},{recalcInProgress:k}])=>{const N=me([]),C=me(0),w=Ze(),A=me(0);Ee(f.topItemsIndexes,N);const _=Jt(oe(_t(j,k,Me(x,Os),Me(c),Me(o),Me(p),y,Me(N),Me(l),Me(s),Me(A),n),Le(([E,D,,R,,,,,,,,B])=>{const P=B!==void 0&&B.length!==R;return E&&!D&&!P}),be(([,,[E,D],R,B,P,W,te,Q,z,M,I])=>{var je,_e;const X=B,{offsetTree:G,sizeTree:ce}=X,O=bt(C);if(R===0)return{...hd,totalCount:R};if(E===0&&D===0)return O===0?{...hd,totalCount:R}:Ov(O,P,B,Q,z,I||[]);if(dt(ce))return O>0?null:jo($2(ff(P,R),X,I),[],R,z,X,Q);const Y=[];if(te.length>0){const Ue=te[0],ae=te[te.length-1];let fe=0;for(const de of vl(ce,Ue,ae)){const he=de.value,ye=Math.max(de.start,Ue),Oe=Math.min(de.end,ae);for(let Ae=ye;Ae<=Oe;Ae++)Y.push({data:I==null?void 0:I[Ae],index:Ae,offset:fe,size:he}),fe+=he}}if(!W)return jo([],Y,R,z,X,Q);const se=te.length>0?te[te.length-1]+1:0,ue=R2(G,E,D,se);if(ue.length===0)return null;const ge=R-1,xe=Io([],Ue=>{for(const ae of ue){const fe=ae.value;let de=fe.offset,he=ae.start;const ye=fe.size;if(fe.offset<E){he+=Math.floor((E-fe.offset+z)/(ye+z));const Ae=he-ae.start;de+=Ae*ye+Ae*z}he<se&&(de+=(se-he)*ye,he=se);const Oe=Math.min(ae.end,ge);for(let Ae=he;Ae<=Oe&&!(de>=D);Ae++)Ue.push({data:I==null?void 0:I[Ae],index:Ae,offset:de,size:ye}),de+=ye+z}}),we=ig(M,Hs),ie=ig(M,Us);if(xe.length>0&&(we>0||ie>0)){const Ue=xe[0],ae=xe[xe.length-1];if(we>0&&Ue.index>se){const fe=Math.min(we,Ue.index-se),de=[];let he=Ue.offset;for(let ye=Ue.index-1;ye>=Ue.index-fe;ye--){const Oe=((je=vl(ce,ye,ye)[0])==null?void 0:je.value)??Ue.size;he-=Oe+z,de.unshift({data:I==null?void 0:I[ye],index:ye,offset:he,size:Oe})}xe.unshift(...de)}if(ie>0&&ae.index<ge){const fe=Math.min(ie,ge-ae.index);let de=ae.offset+ae.size+z;for(let he=ae.index+1;he<=ae.index+fe;he++){const ye=((_e=vl(ce,he,he)[0])==null?void 0:_e.value)??ae.size;xe.push({data:I==null?void 0:I[he],index:he,offset:de,size:ye}),de+=ye+z}}}return jo(xe,Y,R,z,X,Q)}),Le(E=>E!==null),ht()),hd);Ee(oe(n,Le(lf),be(E=>E==null?void 0:E.length)),c),Ee(oe(_,be(E=>E.topListHeight)),v),Ee(v,h),Ee(oe(_,be(E=>[E.top,E.bottom])),d),Ee(oe(_,be(E=>E.items)),w);const H=kn(oe(_,Le(({items:E})=>E.length>0),Ge(c,n),Le(([{items:E},D])=>E[E.length-1].originalIndex===D-1),be(([,E,D])=>[E-1,D]),ht(Os),be(([E])=>E))),L=kn(oe(_,ja(200),Le(({items:E,topItems:D})=>E.length>0&&E[0].originalIndex===D.length),be(({items:E})=>E[0].index),ht())),$=kn(oe(_,Le(({items:E})=>E.length>0),be(({items:E})=>{let D=0,R=E.length-1;for(;E[D].type==="group"&&D<R;)D++;for(;E[R].type==="group"&&R>D;)R--;return{endIndex:E[R].index,startIndex:E[D].index}}),ht(Rv)));return{endReached:H,initialItemCount:C,itemsRendered:w,listState:_,minOverscanItemCount:A,rangeChanged:$,startReached:L,topItemsIndexes:N,...b}},xt(ta,zv,pf,Fs,Vs,Gs,ar,cf),{singleton:!0}),Bv=tt(([{fixedFooterHeight:n,fixedHeaderHeight:l,footerHeight:s,headerHeight:o},{listState:c}])=>{const f=Ze(),d=Jt(oe(_t(s,n,o,l,c),be(([h,x,p,y,v])=>h+x+p+y+v.offsetBottom+v.bottom)),0);return Ee(Me(d),f),{totalListHeight:d,totalListHeightChanged:f}},xt(ln,Rr),{singleton:!0}),P2=tt(([{viewportHeight:n},{totalListHeight:l}])=>{const s=me(!1),o=Jt(oe(_t(s,n,l),Le(([c])=>c),be(([,c,f])=>Math.max(0,c-f)),ja(0),ht()),0);return{alignToBottom:s,paddingTopAddition:o}},xt(ln,Bv),{singleton:!0}),Iv=tt(()=>({context:me(null)})),V2=({itemBottom:n,itemTop:l,locationParams:{align:s,behavior:o,...c},viewportBottom:f,viewportTop:d})=>l<d?{...c,align:s??"start",...o!==void 0?{behavior:o}:{}}:n>f?{...c,align:s??"end",...o!==void 0?{behavior:o}:{}}:null,Hv=tt(([{gap:n,sizes:l,totalCount:s},{fixedFooterHeight:o,fixedHeaderHeight:c,headerHeight:f,scrollingInProgress:d,scrollTop:h,viewportHeight:x},{scrollToIndex:p}])=>{const y=Ze();return Ee(oe(y,Ge(l,x,s,f,c,o,h),Ge(n),be(([[v,b,j,k,N,C,w,A],_])=>{const{calculateViewLocation:H=V2,done:L,...$}=v,E=Lv(v,b,k-1),D=Bs(E,b.offsetTree,_)+N+C,R=D+qn(b.sizeTree,E)[1],B=A+C,P=A+j-w,W=H({itemBottom:R,itemTop:D,locationParams:$,viewportBottom:P,viewportTop:B});return W!==null?L&&Gn(oe(d,Le(te=>!te),Er(bt(d)?1:2)),L):L==null||L(),W}),Le(v=>v!==null)),p),{scrollIntoView:y}},xt(ta,ln,Vs,Rr,nr),{singleton:!0});function og(n){return n===!1?!1:n==="smooth"?"smooth":"auto"}const F2=(n,l)=>typeof n=="function"?og(n(l)):l&&og(n),G2=tt(([{listRefresh:n,totalCount:l,fixedItemSize:s,data:o},{atBottomState:c,isAtBottom:f},{scrollToIndex:d},{scrolledToInitialItem:h},{didMount:x,propsReady:p},{log:y},{scrollingInProgress:v},{context:b},{scrollIntoView:j}])=>{const k=me(!1),N=Ze();let C=null;function w(L){Ve(d,{align:"end",behavior:L,index:"LAST"})}at(oe(_t(oe(Me(l),Er(1)),x),Ge(Me(k),f,h,v),be(([[L,$],E,D,R,B])=>{let P=$&&R,W="auto";return P&&(W=F2(E,D||B),P=P&&W!==!1),{followOutputBehavior:W,shouldFollow:P,totalCount:L}}),Le(({shouldFollow:L})=>L)),({followOutputBehavior:L,totalCount:$})=>{C!==null&&(C(),C=null),bt(s)!==void 0?requestAnimationFrame(()=>{bt(y)("following output to ",{totalCount:$},Ht.DEBUG),w(L)}):C=Gn(n,()=>{bt(y)("following output to ",{totalCount:$},Ht.DEBUG),w(L),C=null})});function A(L){const $=Gn(c,E=>{L&&!E.atBottom&&E.notAtBottomBecause==="SIZE_INCREASED"&&C===null&&(bt(y)("scrolling to bottom due to increased size",{},Ht.DEBUG),w("auto"))});setTimeout($,100)}at(oe(_t(Me(k),l,p),Le(([L,,$])=>L!==!1&&$),Jn(({value:L},[,$])=>({refreshed:L===$,value:$}),{refreshed:!1,value:0}),Le(({refreshed:L})=>L),Ge(k,l)),([,L])=>{bt(h)&&A(L!==!1)}),at(N,()=>{A(bt(k)!==!1)}),at(_t(Me(k),c),([L,$])=>{L!==!1&&!$.atBottom&&$.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&w("auto")});const _=me(null),H=Ze();return Ee(Hd(oe(Me(o),be(L=>(L==null?void 0:L.length)??0)),oe(Me(l))),H),at(oe(_t(oe(H,Er(1)),x),Ge(Me(_),h,v,b),be(([[L,$],E,D,R,B])=>$&&D&&(E==null?void 0:E({context:B,totalCount:L,scrollingInProgress:R}))),Le(L=>!!L),ja(0)),L=>{C!==null&&(C(),C=null),bt(s)!==void 0?requestAnimationFrame(()=>{bt(y)("scrolling into view",{}),Ve(j,L)}):C=Gn(n,()=>{bt(y)("scrolling into view",{}),Ve(j,L),C=null})}),{autoscrollToBottom:N,followOutput:k,scrollIntoViewOnChange:_}},xt(ta,Gs,Vs,Fs,ar,nr,ln,Iv,Hv)),W2=tt(([{data:n,firstItemIndex:l,gap:s,sizes:o},{initialTopMostItemIndex:c},{initialItemCount:f,listState:d},{didMount:h}])=>(Ee(oe(h,Ge(f),Le(([,x])=>x!==0),Ge(c,o,l,s,n),be(([[,x],p,y,v,b,j=[]])=>Ov(x,p,y,v,b,j))),d),{}),xt(ta,Fs,Rr,ar),{singleton:!0}),q2=tt(([{didMount:n},{scrollTo:l},{listState:s}])=>{const o=me(0);return at(oe(n,Ge(o),Le(([,c])=>c!==0),be(([,c])=>({top:c}))),c=>{Gn(oe(s,Er(1),Le(f=>f.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(l,c)})})}),{initialScrollTop:o}},xt(ar,ln,Rr),{singleton:!0}),Uv=tt(([{scrollVelocity:n}])=>{const l=me(!1),s=Ze(),o=me(!1);return Ee(oe(n,Ge(o,l,s),Le(([c,f])=>f!==!1&&f!==void 0),be(([c,f,d,h])=>{const{enter:x,exit:p}=f;if(d){if(p(c,h))return!1}else if(x(c,h))return!0;return d}),ht()),l),at(oe(_t(l,n,s),Ge(o)),([[c,f,d],h])=>{c&&h!==!1&&h!==void 0&&h.change&&h.change(f,d)}),{isSeeking:l,scrollSeekConfiguration:o,scrollSeekRangeChanged:s,scrollVelocity:n}},xt(Gs),{singleton:!0}),mf=tt(([{scrollContainerState:n,scrollTo:l}])=>{const s=Ze(),o=Ze(),c=Ze(),f=me(!1),d=me(void 0);return Ee(oe(_t(s,o),be(([{scrollTop:h,viewportHeight:x},{offsetTop:p,listHeight:y}])=>({scrollHeight:y,scrollTop:Math.max(0,h-p),viewportHeight:x}))),n),Ee(oe(l,Ge(o),be(([h,{offsetTop:x}])=>({...h,top:h.top+x}))),c),{customScrollParent:d,useWindowScroll:f,windowScrollContainerState:s,windowScrollTo:c,windowViewportRect:o}},xt(ln)),Y2=tt(([{sizeRanges:n,sizes:l},{headerHeight:s,scrollTop:o},{initialTopMostItemIndex:c},{didMount:f},{useWindowScroll:d,windowScrollContainerState:h,windowViewportRect:x}])=>{const p=Ze(),y=me(void 0),v=me(null),b=me(null);return Ee(h,v),Ee(x,b),at(oe(p,Ge(l,o,d,v,b,s)),([j,k,N,C,w,A,_])=>{const H=M2(k.sizeTree);C&&w!==null&&A!==null&&(N=w.scrollTop-A.offsetTop),N-=_,j({ranges:H,scrollTop:N})}),Ee(oe(y,Le(lf),be(K2)),c),Ee(oe(f,Ge(y),Le(([,j])=>j!==void 0),ht(),be(([,j])=>j.ranges)),n),{getState:p,restoreStateFrom:y}},xt(ta,ln,Fs,ar,mf));function K2(n){return{align:"start",index:0,offset:n.scrollTop}}const X2=tt(([{topItemsIndexes:n}])=>{const l=me(0);return Ee(oe(l,Le(s=>s>=0),be(s=>Array.from({length:s}).map((o,c)=>c))),n),{topItemCount:l}},xt(Rr));function $v(n){let l=!1,s;return(()=>(l||(l=!0,s=n()),s))}const Q2=$v(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Z2=tt(([{deviation:n,scrollBy:l,scrollingInProgress:s,scrollTop:o},{isAtBottom:c,isScrolling:f,lastJumpDueToItemResize:d,scrollDirection:h},{listState:x},{beforeUnshiftWith:p,gap:y,shiftWithOffset:v,sizes:b},{log:j},{recalcInProgress:k}])=>{const N=kn(oe(x,Ge(d),Jn(([,w,A,_],[{bottom:H,items:L,offsetBottom:$,totalCount:E},D])=>{const R=H+$;let B=0;return A===E&&w.length>0&&L.length>0&&(L[0].originalIndex===0&&w[0].originalIndex===0||(B=R-_,B!==0&&(B+=D))),[B,L,E,R]},[0,[],0,0]),Le(([w])=>w!==0),Ge(o,h,s,c,j,k),Le(([,w,A,_,,,H])=>!H&&!_&&w!==0&&A===Is),be(([[w],,,,,A])=>(A("Upward scrolling compensation",{amount:w},Ht.DEBUG),w))));function C(w){w>0?(Ve(l,{behavior:"auto",top:-w}),Ve(n,0)):(Ve(n,0),Ve(l,{behavior:"auto",top:-w}))}return at(oe(N,Ge(n,f)),([w,A,_])=>{_&&Q2()?Ve(n,A-w):C(-w)}),at(oe(_t(Jt(f,!1),n,k),Le(([w,A,_])=>!w&&!_&&A!==0),be(([w,A])=>A),ja(1)),C),Ee(oe(v,be(w=>({top:-w}))),l),at(oe(p,Ge(b,y),be(([w,{groupIndices:A,lastSize:_,sizeTree:H},L])=>{function $(P){return P*(_+L)}if(A.length===0)return $(w);let E=0;const D=_s(H,0);let R=0,B=0;for(;R<w;){R++,E+=D;let P=A.length===B+1?1/0:A[B+1]-A[B]-1;R+P>w&&(E-=D,P=w-R+1),R+=P,E+=$(P),B++}return E})),w=>{Ve(n,w),requestAnimationFrame(()=>{Ve(l,{top:w}),requestAnimationFrame(()=>{Ve(n,0),Ve(k,!1)})})}),{deviation:n}},xt(ln,Gs,Rr,ta,nr,cf)),J2=tt(([n,l,s,o,c,f,d,h,x,p,y])=>({...n,...l,...s,...o,...c,...f,...d,...h,...x,...p,...y}),xt(pf,W2,ar,Uv,Bv,q2,P2,mf,Hv,nr,Iv)),Pv=tt(([{data:n,defaultItemSize:l,firstItemIndex:s,fixedItemSize:o,fixedGroupSize:c,gap:f,groupIndices:d,heightEstimates:h,itemSize:x,sizeRanges:p,sizes:y,statefulTotalCount:v,totalCount:b,trackItemSizes:j},{initialItemFinalLocationReached:k,initialTopMostItemIndex:N,scrolledToInitialItem:C},w,A,_,H,{scrollToIndex:L},$,{topItemCount:E},{groupCounts:D},R])=>{const{listState:B,minOverscanItemCount:P,topItemsIndexes:W,rangeChanged:te,...Q}=H;return Ee(te,R.scrollSeekRangeChanged),Ee(oe(R.windowViewportRect,be(z=>z.visibleHeight)),w.viewportHeight),{data:n,defaultItemHeight:l,firstItemIndex:s,fixedItemHeight:o,fixedGroupHeight:c,gap:f,groupCounts:D,heightEstimates:h,initialItemFinalLocationReached:k,initialTopMostItemIndex:N,scrolledToInitialItem:C,sizeRanges:p,topItemCount:E,topItemsIndexes:W,totalCount:b,..._,groupIndices:d,itemSize:x,listState:B,minOverscanItemCount:P,scrollToIndex:L,statefulTotalCount:v,trackItemSizes:j,rangeChanged:te,...Q,...R,...w,sizes:y,...A}},xt(ta,Fs,ln,Y2,G2,Rr,Vs,Z2,X2,zv,J2));function ek(n,l){const s={},o={};let c=0;const f=n.length;for(;c<f;)o[n[c]]=1,c+=1;for(const d in l)Object.hasOwn(o,d)||(s[d]=l[d]);return s}const io=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function Vv(n,l,s){const o=Object.keys(l.required||{}),c=Object.keys(l.optional||{}),f=Object.keys(l.methods||{}),d=Object.keys(l.events||{}),h=Ce.createContext({});function x(C,w){C.propsReady!==void 0&&Ve(C.propsReady,!1);for(const A of o){const _=C[l.required[A]];Ve(_,w[A])}for(const A of c)if(A in w){const _=C[l.optional[A]];Ve(_,w[A])}C.propsReady!==void 0&&Ve(C.propsReady,!0)}function p(C){return f.reduce((w,A)=>(w[A]=_=>{const H=C[l.methods[A]];Ve(H,_)},w),{})}function y(C){return d.reduce((w,A)=>(w[A]=x2(C[l.events[A]]),w),{})}const v=Ce.forwardRef(function(C,w){const{children:A,..._}=C,[H]=Ce.useState(()=>Io(v2(n),E=>{x(E,_)})),[L]=Ce.useState(Zx(y,H));io(()=>{for(const E of d)E in _&&at(L[E],_[E]);return()=>{Object.values(L).map(sf)}},[_,L,H]),io(()=>{x(H,_)}),Ce.useImperativeHandle(w,Qx(p(H)));const $=s;return a.jsx(h.Provider,{value:H,children:s!==void 0?a.jsx($,{...ek([...o,...c,...d],_),children:A}):A})}),b=C=>{const w=Ce.useContext(h);return Ce.useCallback(A=>{Ve(w[C],A)},[w,C])},j=C=>{const w=Ce.useContext(h)[C],A=Ce.useCallback(_=>at(w,_),[w]);return Ce.useSyncExternalStore(A,()=>bt(w),()=>bt(w))},k=C=>{const w=Ce.useContext(h)[C],[A,_]=Ce.useState(Zx(bt,w));return io(()=>at(w,H=>{H!==A&&_(Qx(H))}),[w,A]),A},N=parseInt(Ce.version)>=18?j:k;return{Component:v,useEmitter:(C,w)=>{const A=Ce.useContext(h)[C];io(()=>at(A,w),[w,A])},useEmitterValue:N,usePublisher:b}}const Fv=Ce.createContext(void 0),Gv=Ce.createContext(void 0),xd="-webkit-sticky",cg="sticky",hf=$v(()=>{if(typeof document>"u")return cg;const n=document.createElement("div");return n.style.position=xd,n.style.position===xd?xd:cg}),Wv=typeof document<"u"?Ce.useLayoutEffect:Ce.useEffect;function gd(n){return"self"in n}function tk(n){return"body"in n}function qv(n,l,s,o=Nl,c,f){const d=Ce.useRef(null),h=Ce.useRef(null),x=Ce.useRef(null),p=Ce.useCallback(b=>{let j,k,N;const C=b.target;if(tk(C)||gd(C)){const A=gd(C)?C:C.defaultView;N=f===!0?A.scrollX:A.scrollY,j=f===!0?A.document.documentElement.scrollWidth:A.document.documentElement.scrollHeight,k=f===!0?A.innerWidth:A.innerHeight}else N=f===!0?C.scrollLeft:C.scrollTop,j=f===!0?C.scrollWidth:C.scrollHeight,k=f===!0?C.offsetWidth:C.offsetHeight;const w=()=>{n({scrollHeight:j,scrollTop:Math.max(N,0),viewportHeight:k})};b.suppressFlushSync===!0?w():NS.flushSync(w),h.current!==null&&(N===h.current||N<=0||N===j-k)&&(h.current=null,l(!0),x.current&&(clearTimeout(x.current),x.current=null))},[n,l,f]);Ce.useEffect(()=>{const b=c||d.current;return o(c||d.current),p({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",p,{passive:!0}),()=>{o(null),b.removeEventListener("scroll",p)}},[d,p,s,o,c]);function y(b){const j=d.current;if(!j||(f===!0?"offsetWidth"in j&&j.offsetWidth===0:"offsetHeight"in j&&j.offsetHeight===0))return;const k=b.behavior==="smooth";let N,C,w;gd(j)?(C=Math.max(Ja(j.document.documentElement,f===!0?"width":"height"),f===!0?j.document.documentElement.scrollWidth:j.document.documentElement.scrollHeight),N=f===!0?j.innerWidth:j.innerHeight,w=f===!0?window.scrollX:window.scrollY):(C=j[f===!0?"scrollWidth":"scrollHeight"],N=Ja(j,f===!0?"width":"height"),w=j[f===!0?"scrollLeft":"scrollTop"]);const A=C-N;if(b.top=Math.ceil(Math.max(Math.min(A,b.top),0)),_v(N,C)||b.top===w){n({scrollHeight:C,scrollTop:w,viewportHeight:N}),k&&l(!0);return}k?(h.current=b.top,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,h.current=null,l(!0)},1e3)):h.current=null,f===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},left:b.top}),j.scrollTo(b)}function v(b){f===!0&&(b={...b.behavior!==void 0?{behavior:b.behavior}:{},...b.top!==void 0?{left:b.top}:{}}),d.current.scrollBy(b)}return{scrollByCallback:v,scrollerRef:d,scrollToCallback:y}}function xf(n){return n}const nk=tt(()=>{const n=me(h=>`Item ${h}`),l=me(h=>`Group ${h}`),s=me({}),o=me(xf),c=me("div"),f=me(Nl),d=(h,x=null)=>Jt(oe(s,be(p=>p[h]),ht()),x);return{components:s,computeItemKey:o,EmptyPlaceholder:d("EmptyPlaceholder"),FooterComponent:d("Footer"),GroupComponent:d("Group","div"),groupContent:l,HeaderComponent:d("Header"),HeaderFooterTag:c,ItemComponent:d("Item","div"),itemContent:n,ListComponent:d("List","div"),ScrollerComponent:d("Scroller","div"),scrollerRef:f,ScrollSeekPlaceholder:d("ScrollSeekPlaceholder"),TopItemListComponent:d("TopItemList")}}),ak=tt(([n,l])=>({...n,...l}),xt(Pv,nk)),rk=({height:n})=>a.jsx("div",{style:{height:n}}),lk={overflowAnchor:"none",position:hf(),zIndex:1},Yv={overflowAnchor:"none"},sk={...Yv,display:"inline-block",height:"100%"},ug=Ce.memo(function({showTopList:n=!1}){const l=He("listState"),s=Bn("sizeRanges"),o=He("useWindowScroll"),c=He("customScrollParent"),f=Bn("windowScrollContainerState"),d=Bn("scrollContainerState"),h=c||o?f:d,x=He("itemContent"),p=He("context"),y=He("groupContent"),v=He("trackItemSizes"),b=He("itemSize"),j=He("log"),k=Bn("gap"),N=He("horizontalDirection"),{callbackRef:C}=S2(s,b,v,n?Nl:h,j,k,c,N,He("skipAnimationFrameInResizeObserver")),[w,A]=Ce.useState(0);gf("deviation",Q=>{w!==Q&&A(Q)});const _=He("EmptyPlaceholder"),H=He("ScrollSeekPlaceholder")??rk,L=He("ListComponent"),$=He("ItemComponent"),E=He("GroupComponent"),D=He("computeItemKey"),R=He("isSeeking"),B=He("groupIndices").length>0,P=He("alignToBottom"),W=He("initialItemFinalLocationReached"),te=n?{}:{boxSizing:"border-box",...N?{display:"inline-block",height:"100%",marginLeft:w!==0?w:P?"auto":0,paddingLeft:l.offsetTop,paddingRight:l.offsetBottom,whiteSpace:"nowrap"}:{marginTop:w!==0?w:P?"auto":0,paddingBottom:l.offsetBottom,paddingTop:l.offsetTop},...W?{}:{visibility:"hidden"}};return!n&&l.totalCount===0&&_!==null&&_!==void 0?a.jsx(_,{...Zt(_,p)}):a.jsx(L,{...Zt(L,p),"data-testid":n?"virtuoso-top-item-list":"virtuoso-item-list",ref:C,style:te,children:(n?l.topItems:l.items).map(Q=>{const z=Q.originalIndex,M=D(z+l.firstItemIndex,Q.data,p);return R?g.createElement(H,{...Zt(H,p),height:Q.size,index:Q.index,key:M,type:Q.type||"item",...Q.type==="group"?{}:{groupIndex:Q.groupIndex}}):Q.type==="group"?g.createElement(E,{...Zt(E,p),"data-index":z,"data-item-index":Q.index,"data-known-size":Q.size,key:M,style:lk},y(Q.index,p)):g.createElement($,{...Zt($,p),...uk($,Q.data),"data-index":z,"data-item-group-index":Q.groupIndex,"data-item-index":Q.index,"data-known-size":Q.size,key:M,style:N?sk:Yv},B?x(Q.index,Q.groupIndex,Q.data,p):x(Q.index,Q.data,p))})})}),ik={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},ok={outline:"none",overflowX:"auto",position:"relative"},Uo=n=>({height:"100%",position:"absolute",top:0,width:"100%",...n?{display:"flex",flexDirection:"column"}:void 0}),ck={position:hf(),top:0,width:"100%",zIndex:1};function Zt(n,l){if(typeof n!="string")return{context:l}}function uk(n,l){return{item:typeof n=="string"?void 0:l}}const dk=Ce.memo(function(){const n=He("HeaderComponent"),l=Bn("headerHeight"),s=He("HeaderFooterTag"),o=Tr(Ce.useMemo(()=>f=>{l(Ja(f,"height"))},[l]),!0,He("skipAnimationFrameInResizeObserver")),c=He("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null}),fk=Ce.memo(function(){const n=He("FooterComponent"),l=Bn("footerHeight"),s=He("HeaderFooterTag"),o=Tr(Ce.useMemo(()=>f=>{l(Ja(f,"height"))},[l]),!0,He("skipAnimationFrameInResizeObserver")),c=He("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null});function Kv({useEmitter:n,useEmitterValue:l,usePublisher:s}){return Ce.memo(function({children:o,style:c,context:f,...d}){const h=s("scrollContainerState"),x=l("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=l("scrollerRef"),v=l("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:j,scrollToCallback:k}=qv(h,p,x,y,void 0,v);return n("scrollTo",k),n("scrollBy",b),a.jsx(x,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:j,style:{...v?ok:ik,...c},tabIndex:0,...d,...Zt(x,f),children:o})})}function Xv({useEmitter:n,useEmitterValue:l,usePublisher:s}){return Ce.memo(function({children:o,style:c,context:f,...d}){const h=s("windowScrollContainerState"),x=l("ScrollerComponent"),p=s("smoothScrollTargetReached"),y=l("totalListHeight"),v=l("deviation"),b=l("customScrollParent"),j=Ce.useRef(null),k=l("scrollerRef"),{scrollByCallback:N,scrollerRef:C,scrollToCallback:w}=qv(h,p,x,k,b);return Wv(()=>{var A;return C.current=b||((A=j.current)==null?void 0:A.ownerDocument.defaultView),()=>{C.current=null}},[C,b]),n("windowScrollTo",w),n("scrollBy",N),a.jsx(x,{ref:j,"data-virtuoso-scroller":!0,style:{position:"relative",...c,...y!==0?{height:y+v}:void 0},...d,...Zt(x,f),children:o})})}const pk=({children:n})=>{const l=Ce.useContext(Fv),s=Bn("viewportHeight"),o=Bn("fixedItemHeight"),c=He("alignToBottom"),f=He("horizontalDirection"),d=Ce.useMemo(()=>Sv(s,x=>Ja(x,f?"width":"height")),[s,f]),h=Tr(d,!0,He("skipAnimationFrameInResizeObserver"));return Ce.useEffect(()=>{l&&(s(l.viewportHeight),o(l.itemHeight))},[l,s,o]),a.jsx("div",{"data-viewport-type":"element",ref:h,style:Uo(c),children:n})},mk=({children:n})=>{const l=Ce.useContext(Fv),s=Bn("windowViewportRect"),o=Bn("fixedItemHeight"),c=He("customScrollParent"),f=kv(s,c,He("skipAnimationFrameInResizeObserver")),d=He("alignToBottom");return Ce.useEffect(()=>{l&&(o(l.itemHeight),s({listHeight:0,offsetTop:0,visibleHeight:l.viewportHeight,visibleWidth:100}))},[l,s,o]),a.jsx("div",{"data-viewport-type":"window",ref:f,style:Uo(d),children:n})},hk=({children:n})=>{const l=He("TopItemListComponent")??"div",s=He("headerHeight"),o={...ck,marginTop:`${s}px`},c=He("context");return a.jsx(l,{style:o,...Zt(l,c),children:n})},xk=Ce.memo(function(n){const l=He("useWindowScroll"),s=He("topItemsIndexes").length>0,o=He("customScrollParent"),c=He("context");return a.jsxs(o||l?yk:vk,{...n,context:c,children:[s&&a.jsx(hk,{children:a.jsx(ug,{showTopList:!0})}),a.jsxs(o||l?mk:pk,{children:[a.jsx(dk,{}),a.jsx(ug,{}),a.jsx(fk,{})]})]})}),{Component:gk,useEmitter:gf,useEmitterValue:He,usePublisher:Bn}=Vv(ak,{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"}},xk),vk=Kv({useEmitter:gf,useEmitterValue:He,usePublisher:Bn}),yk=Xv({useEmitter:gf,useEmitterValue:He,usePublisher:Bn}),bk=gk,Sk=tt(()=>{const n=me(p=>a.jsxs("td",{children:["Item $",p]})),l=me(null),s=me(p=>a.jsxs("td",{colSpan:1e3,children:["Group ",p]})),o=me(null),c=me(null),f=me({}),d=me(xf),h=me(Nl),x=(p,y=null)=>Jt(oe(f,be(v=>v[p]),ht()),y);return{components:f,computeItemKey:d,context:l,EmptyPlaceholder:x("EmptyPlaceholder"),FillerRow:x("FillerRow"),fixedFooterContent:c,fixedHeaderContent:o,itemContent:n,groupContent:s,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder"),TableBodyComponent:x("TableBody","tbody"),TableComponent:x("Table","table"),TableFooterComponent:x("TableFoot","tfoot"),TableHeadComponent:x("TableHead","thead"),TableRowComponent:x("TableRow","tr"),GroupComponent:x("Group","tr")}});xt(Pv,Sk);hf();const dg={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},jk={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:fg,floor:No,max:Ms,min:vd,round:pg}=Math;function mg(n,l,s){return Array.from({length:l-n+1}).map((o,c)=>({data:s===null?null:s[c+n],index:c+n}))}function kk(n){return{...jk,items:n}}function oo(n,l){return n!==void 0&&n.width===l.width&&n.height===l.height}function wk(n,l){return n!==void 0&&n.column===l.column&&n.row===l.row}const Ck=tt(([{increaseViewportBy:n,listBoundary:l,overscan:s,visibleRange:o},{footerHeight:c,headerHeight:f,scrollBy:d,scrollContainerState:h,scrollTo:x,scrollTop:p,smoothScrollTargetReached:y,viewportHeight:v},b,j,{didMount:k,propsReady:N},{customScrollParent:C,useWindowScroll:w,windowScrollContainerState:A,windowScrollTo:_,windowViewportRect:H},L])=>{const $=me(0),E=me(0),D=me(dg),R=me({height:0,width:0}),B=me({height:0,width:0}),P=Ze(),W=Ze(),te=me(0),Q=me(null),z=me({column:0,row:0}),M=Ze(),I=Ze(),X=me(!1),G=me(0),ce=me(!0),O=me(!1),Y=me(!1);at(oe(k,Ge(G),Le(([ie,je])=>je!==0)),()=>{Ve(ce,!1)}),at(oe(_t(k,ce,B,R,G,O),Le(([ie,je,_e,Ue,,ae])=>ie&&!je&&_e.height!==0&&Ue.height!==0&&!ae)),([,,,,ie])=>{Ve(O,!0),df(1,()=>{Ve(P,ie)}),Gn(oe(p),()=>{Ve(l,[0,0]),Ve(ce,!0)})}),Ee(oe(I,Le(ie=>ie!=null&&ie.scrollTop>0),Zn(0)),E),at(oe(k,Ge(I),Le(([,ie])=>ie!=null)),([,ie])=>{ie&&(Ve(R,ie.viewport),Ve(B,ie.item),Ve(z,ie.gap),ie.scrollTop>0&&(Ve(X,!0),Gn(oe(p,Er(1)),je=>{Ve(X,!1)}),Ve(x,{top:ie.scrollTop})))}),Ee(oe(R,be(({height:ie})=>ie)),v),Ee(oe(_t(Me(R,oo),Me(B,oo),Me(z,(ie,je)=>ie!==void 0&&ie.column===je.column&&ie.row===je.row),Me(p)),be(([ie,je,_e,Ue])=>({gap:_e,item:je,scrollTop:Ue,viewport:ie}))),M),Ee(oe(_t(Me($),o,Me(z,wk),Me(B,oo),Me(R,oo),Me(Q),Me(E),Me(X),Me(ce),Me(G)),Le(([,,,,,,,ie])=>!ie),be(([ie,[je,_e],Ue,ae,fe,de,he,,ye,Oe])=>{const{column:Ae,row:pe}=Ue,{height:ze,width:Be}=ae,{width:Ot}=fe;if(he===0&&(ie===0||Ot===0))return dg;if(Be===0){const lt=ff(Oe,ie),rr=lt+Math.max(he-1,0);return kk(mg(lt,rr,de))}const Ft=Qv(Ot,Be,Ae);let rt,jt;ye?je===0&&_e===0&&he>0?(rt=0,jt=he-1):(rt=Ft*No((je+pe)/(ze+pe)),jt=Ft*fg((_e+pe)/(ze+pe))-1,jt=vd(ie-1,Ms(jt,Ft-1)),rt=vd(jt,Ms(0,rt))):(rt=0,jt=-1);const ve=mg(rt,jt,de),{bottom:At,top:De}=hg(fe,Ue,ae,ve),gt=fg(ie/Ft),Xt=gt*ze+(gt-1)*pe-At;return{bottom:At,itemHeight:ze,items:ve,itemWidth:Be,offsetBottom:Xt,offsetTop:De,top:De}})),D),Ee(oe(Q,Le(ie=>ie!==null),be(ie=>ie.length)),$),Ee(oe(_t(R,B,D,z),Le(([ie,je,{items:_e}])=>_e.length>0&&je.height!==0&&ie.height!==0),be(([ie,je,{items:_e},Ue])=>{const{bottom:ae,top:fe}=hg(ie,Ue,je,_e);return[fe,ae]}),ht(Os)),l);const se=me(!1);Ee(oe(p,Ge(se),be(([ie,je])=>je||ie!==0)),se);const ue=kn(oe(_t(D,$),Le(([{items:ie}])=>ie.length>0),Ge(se),Le(([[ie,je],_e])=>{const Ue=ie.items[ie.items.length-1].index===je-1;return(_e||ie.bottom>0&&ie.itemHeight>0&&ie.offsetBottom===0&&ie.items.length===je)&&Ue}),be(([[,ie]])=>ie-1),ht())),ge=kn(oe(Me(D),Le(({items:ie})=>ie.length>0&&ie[0].index===0),Zn(0),ht())),xe=kn(oe(Me(D),Ge(X),Le(([{items:ie},je])=>ie.length>0&&!je),be(([{items:ie}])=>({endIndex:ie[ie.length-1].index,startIndex:ie[0].index})),ht(Rv),ja(0)));Ee(xe,j.scrollSeekRangeChanged),Ee(oe(P,Ge(R,B,$,z),be(([ie,je,_e,Ue,ae])=>{const fe=Dv(ie),{align:de,behavior:he,offset:ye}=fe;let Oe=fe.index;Oe==="LAST"&&(Oe=Ue-1),Oe=Ms(0,Oe,vd(Ue-1,Oe));let Ae=Fd(je,ae,_e,Oe);return de==="end"?Ae=pg(Ae-je.height+_e.height):de==="center"&&(Ae=pg(Ae-je.height/2+_e.height/2)),ye!==void 0&&ye!==0&&(Ae+=ye),{behavior:he,top:Ae}})),x);const we=Jt(oe(D,be(ie=>ie.offsetBottom+ie.bottom)),0);return Ee(oe(H,be(ie=>({height:ie.visibleHeight,width:ie.visibleWidth}))),R),{customScrollParent:C,data:Q,deviation:te,footerHeight:c,gap:z,headerHeight:f,increaseViewportBy:n,initialItemCount:E,itemDimensions:B,overscan:s,restoreStateFrom:I,scrollBy:d,scrollContainerState:h,scrollHeight:W,scrollTo:x,scrollToIndex:P,scrollTop:p,smoothScrollTargetReached:y,totalCount:$,useWindowScroll:w,viewportDimensions:R,windowScrollContainerState:A,windowScrollTo:_,windowViewportRect:H,...j,gridState:D,horizontalDirection:Y,initialTopMostItemIndex:G,totalListHeight:we,...b,endReached:ue,propsReady:N,rangeChanged:xe,startReached:ge,stateChanged:M,stateRestoreInProgress:X,...L}},xt(pf,ln,Gs,Uv,ar,mf,nr));function Qv(n,l,s){return Ms(1,No((n+s)/(No(l)+s)))}function hg(n,l,s,o){const{height:c}=s;if(c===void 0||o.length===0)return{bottom:0,top:0};const f=Fd(n,l,s,o[0].index);return{bottom:Fd(n,l,s,o[o.length-1].index)+c,top:f}}function Fd(n,l,s,o){const c=Qv(n.width,s.width,l.column),f=No(o/c),d=f*s.height+Ms(0,f-1)*l.row;return d>0?d+l.row:d}const Ek=tt(()=>{const n=me(v=>`Item ${v}`),l=me({}),s=me(null),o=me("virtuoso-grid-item"),c=me("virtuoso-grid-list"),f=me(xf),d=me("div"),h=me(Nl),x=(v,b=null)=>Jt(oe(l,be(j=>j[v]),ht()),b),p=me(!1),y=me(!1);return Ee(Me(y),p),{components:l,computeItemKey:f,context:s,FooterComponent:x("Footer"),HeaderComponent:x("Header"),headerFooterTag:d,itemClassName:o,ItemComponent:x("Item","div"),itemContent:n,listClassName:c,ListComponent:x("List","div"),readyStateChanged:p,reportReadyState:y,ScrollerComponent:x("Scroller","div"),scrollerRef:h,ScrollSeekPlaceholder:x("ScrollSeekPlaceholder","div")}}),Nk=tt(([n,l])=>({...n,...l}),xt(Ck,Ek)),Tk=Ce.memo(function(){const n=yt("gridState"),l=yt("listClassName"),s=yt("itemClassName"),o=yt("itemContent"),c=yt("computeItemKey"),f=yt("isSeeking"),d=In("scrollHeight"),h=yt("ItemComponent"),x=yt("ListComponent"),p=yt("ScrollSeekPlaceholder"),y=yt("context"),v=In("itemDimensions"),b=In("gap"),j=yt("log"),k=yt("stateRestoreInProgress"),N=In("reportReadyState"),C=Tr(Ce.useMemo(()=>w=>{const A=w.parentElement.parentElement.scrollHeight;d(A);const _=w.firstChild;if(_!==null){const{height:H,width:L}=_.getBoundingClientRect();v({height:H,width:L})}b({column:xg("column-gap",getComputedStyle(w).columnGap,j),row:xg("row-gap",getComputedStyle(w).rowGap,j)})},[d,v,b,j]),!0,!1);return Wv(()=>{n.itemHeight>0&&n.itemWidth>0&&N(!0)},[n]),k?null:a.jsx(x,{className:l,ref:C,...Zt(x,y),"data-testid":"virtuoso-item-list",style:{paddingBottom:n.offsetBottom,paddingTop:n.offsetTop},children:n.items.map(w=>{const A=c(w.index,w.data,y);return f?a.jsx(p,{...Zt(p,y),height:n.itemHeight,index:w.index,width:n.itemWidth},A):g.createElement(h,{...Zt(h,y),className:s,"data-index":w.index,key:A},o(w.index,w.data,y))})})}),Rk=Ce.memo(function(){const n=yt("HeaderComponent"),l=In("headerHeight"),s=yt("headerFooterTag"),o=Tr(Ce.useMemo(()=>f=>{l(Ja(f,"height"))},[l]),!0,!1),c=yt("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null}),Ak=Ce.memo(function(){const n=yt("FooterComponent"),l=In("footerHeight"),s=yt("headerFooterTag"),o=Tr(Ce.useMemo(()=>f=>{l(Ja(f,"height"))},[l]),!0,!1),c=yt("context");return n!=null?a.jsx(s,{ref:o,children:a.jsx(n,{...Zt(n,c)})}):null}),Mk=({children:n})=>{const l=Ce.useContext(Gv),s=In("itemDimensions"),o=In("viewportDimensions"),c=Tr(Ce.useMemo(()=>f=>{o(f.getBoundingClientRect())},[o]),!0,!1);return Ce.useEffect(()=>{l&&(o({height:l.viewportHeight,width:l.viewportWidth}),s({height:l.itemHeight,width:l.itemWidth}))},[l,o,s]),a.jsx("div",{ref:c,style:Uo(!1),children:n})},Lk=({children:n})=>{const l=Ce.useContext(Gv),s=In("windowViewportRect"),o=In("itemDimensions"),c=yt("customScrollParent"),f=kv(s,c,!1);return Ce.useEffect(()=>{l&&(o({height:l.itemHeight,width:l.itemWidth}),s({listHeight:0,offsetTop:0,visibleHeight:l.viewportHeight,visibleWidth:l.viewportWidth}))},[l,s,o]),a.jsx("div",{ref:f,style:Uo(!1),children:n})},zk=Ce.memo(function({...n}){const l=yt("useWindowScroll"),s=yt("customScrollParent"),o=s||l?_k:Dk,c=s||l?Lk:Mk,f=yt("context");return a.jsx(o,{...n,...Zt(o,f),children:a.jsxs(c,{children:[a.jsx(Rk,{}),a.jsx(Tk,{}),a.jsx(Ak,{})]})})}),{useEmitter:Zv,useEmitterValue:yt,usePublisher:In}=Vv(Nk,{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"}},zk),Dk=Kv({useEmitter:Zv,useEmitterValue:yt,usePublisher:In}),_k=Xv({useEmitter:Zv,useEmitterValue:yt,usePublisher:In});function xg(n,l,s){return l!=="normal"&&(l==null?void 0:l.endsWith("px"))!==!0&&s(`${n} was not resolved to pixel value correctly`,l,Ht.WARN),l==="normal"?0:parseInt(l??"0",10)}const Ok={source:"vskill-sidebar-own-collapsed",installed:"vskill-sidebar-installed-collapsed"},Jv={source:"Own",installed:"Installed"};function Bk(n){try{const l=localStorage.getItem(n);if(l!=null)return l==="true"}catch{}try{if(typeof sessionStorage<"u"){const l=sessionStorage.getItem(n);if(l!=null)return l==="true"}}catch{}return!1}function Ik(n,l){const s=l?"true":"false";try{localStorage.setItem(n,s)}catch{}try{typeof sessionStorage<"u"&&sessionStorage.setItem(n,s)}catch{}}function gg({origin:n,count:l,filteredCount:s,updateCount:o,children:c}){const f=Ok[n],[d,h]=g.useState(()=>Bk(f)),x=g.useCallback(()=>{h(b=>{const j=!b;return Ik(f,j),j})},[f]),p=Jv[n],y=`sidebar-section-${n}-header`,v=`sidebar-section-${n}-group`;return a.jsxs("section",{"aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:[a.jsxs("button",{id:y,type:"button","data-testid":"sidebar-section-header","aria-expanded":!d,"aria-controls":v,onClick:x,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 12px 6px 14px",background:"transparent",border:"none",cursor:"pointer",color:"var(--text-primary)",fontFamily:"var(--font-sans)",textAlign:"left"},children:[a.jsx(Uk,{collapsed:d}),a.jsx("h2",{"aria-level":2,style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)",margin:0},children:p}),a.jsx("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:s!=null&&s!==l?`(${s} of ${l})`:`(${l})`}),o!=null&&o>0&&a.jsx(Hk,{origin:n,updateCount:o})]}),!d&&a.jsx("div",{id:v,role:"group","aria-labelledby":y,style:{display:"flex",flexDirection:"column",minHeight:0},children:c})]})}function Hk({origin:n,updateCount:l}){const[s,o]=g.useState(!1),c=Jv[n].toLowerCase(),f=`${l} updates available in ${c} section, view all`;return a.jsxs("span",{role:"link",tabIndex:0,"data-testid":"sidebar-section-update-chip","aria-label":f,onClick:d=>{d.stopPropagation(),window.location.hash="#/updates"},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.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:s?"2px solid var(--border-focus)":"none",outlineOffset:2},children:[l," updates",a.jsx("span",{"aria-hidden":"true",style:{fontSize:9,marginLeft:2},children:"▾"})]})}function Uk({collapsed:n}){return a.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:n?"rotate(0deg)":"rotate(90deg)",transition:"transform var(--duration-fast, 120ms) var(--ease-standard, ease)",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function vf(n,l){const s=l.trim().toLowerCase();return s?n.skill.toLowerCase().includes(s)||n.plugin.toLowerCase().includes(s)||n.dir.toLowerCase().includes(s):!0}function $k({value:n,onChange:l,placeholder:s="Filter skills…",validationPattern:o,validationMessage:c="Invalid filter expression"}){const f=g.useRef(null),d=g.useId(),h=!!o&&n.trim()!==""&&!o.test(n);return g.useEffect(()=>{function x(p){var b;if(p.key!=="/")return;const y=p.target;if(!y)return;const v=y.tagName;v==="INPUT"||v==="TEXTAREA"||y.isContentEditable||(p.preventDefault(),(b=f.current)==null||b.focus())}return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]),a.jsxs("div",{role:"search",style:{display:"flex",alignItems:"center",gap:6,padding:"6px 12px",borderBottom:"1px solid var(--border-default)"},children:[a.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:[a.jsx("circle",{cx:"11",cy:"11",r:"8"}),a.jsx("path",{d:"M21 21l-4.35-4.35"})]}),a.jsx("input",{ref:f,type:"search","aria-label":"Filter skills","aria-invalid":h?!0:void 0,"aria-describedby":h?d:void 0,value:n,placeholder:s,onChange:x=>l(x.currentTarget.value),onKeyDown:x=>{x.key==="Escape"&&(l(""),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&&a.jsx("span",{id:d,role:"alert","aria-live":"polite",style:{fontFamily:"var(--font-sans)",fontSize:10,color:"var(--text-error, #B42318)",marginLeft:4,whiteSpace:"nowrap"},children:c}),a.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:n?"none":"inline-block"},children:"/"})]})}function Pk({target:n}){const l=typeof n=="string"&&n.length>0,s=l?`symlinked → ${n}`:"symlinked — cycle detected or target unresolved",o=l?`symlinked from ${n}`:"symlinked, target unresolved";return a.jsx("span",{"data-testid":"symlink-chip",role:"img","aria-label":o,title:s,tabIndex:0,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:14,height:14,borderRadius:3,color:"var(--text-secondary)",flexShrink:0},children:a.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:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})}function Vk({skill:n}){if(!n.updateAvailable)return null;const l=n.currentVersion??"",s=n.latestVersion,o=s?`Update available: ${l} → ${s}`.trim():"Update available";return a.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:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 19V5"}),a.jsx("path",{d:"M5 12l7-7 7 7"})]})})}function Fk({skillName:n,provenance:l,onRevert:s}){const o=l.promotedFrom;return a.jsxs("span",{"data-testid":"promoted-from-chip",style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,padding:"2px 6px",borderRadius:3,background:"color-mix(in srgb, var(--status-installed) 12%, transparent)",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",flexShrink:0},children:[a.jsx("span",{"aria-hidden":"true",children:"↑"}),a.jsxs("span",{children:["promoted from ",o]}),s&&a.jsx("button",{type:"button","data-testid":"promoted-from-chip-revert","aria-label":`Revert ${n} to ${o}`,onClick:c=>{c.stopPropagation(),s()},style:{marginLeft:2,padding:"1px 4px",background:"transparent",border:"1px solid var(--border-subtle, #ddd)",borderRadius:2,cursor:"pointer",fontSize:10,color:"var(--text-secondary)"},children:"Revert"})]})}function Gk({skill:n,isSelected:l,onSelect:s,onContextMenu:o,onRevert:c}){const f=n.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.jsxs("button",{type:"button",onClick:s,onContextMenu:o?d=>{d.preventDefault(),o(d,n)}:void 0,"aria-current":l?"true":void 0,"aria-selected":!!l,"data-testid":"skill-row","data-selected":l,"data-origin":n.origin,"data-skill-id":`${n.plugin}/${n.skill}`,style:{display:"flex",alignItems:"center",gap:8,width:"100%",height:36,padding:"0 12px 0 14px",background:l?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent",boxShadow:l?"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:[a.jsx("span",{"aria-hidden":"true","aria-label":n.updateAvailable?"Update available":void 0,title:n.updateAvailable?`Update available${n.latestVersion?` → ${n.latestVersion}`:""}`:void 0,style:{width:n.updateAvailable?10:6,height:n.updateAvailable?10:6,borderRadius:"50%",background:f,display:"inline-block",flexShrink:0,boxShadow:n.updateAvailable?"0 0 0 2px var(--color-own, #d97706)":"none",transition:"box-shadow 180ms ease, width 180ms ease, height 180ms ease"}}),a.jsx("span",{title:n.skill,style:{minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.skill}),n.version&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",flexShrink:0},children:n.version}),n.isSymlink&&a.jsx(Pk,{target:n.symlinkTarget??null}),n.provenance&&a.jsx(Fk,{skillName:n.skill,provenance:n.provenance,onRevert:c?()=>c({plugin:n.plugin,skill:n.skill}):void 0}),a.jsx(Vk,{skill:n})]})}const To=g.memo(Gk);function Wk({plugin:n,skills:l,selectedKey:s,onSelect:o,onContextMenu:c}){const f=[...l].sort((d,h)=>d.skill.localeCompare(h.skill));return a.jsxs("div",{role:"group","aria-label":`${n} (${l.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.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:n,children:n}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",l.length,")"]})]}),a.jsx("div",{role:"list",children:f.map(d=>{const h=!!s&&s.plugin===d.plugin&&s.skill===d.skill;return a.jsx("div",{role:"listitem",children:a.jsx(To,{skill:d,isSelected:h,onSelect:()=>o(d),onContextMenu:c})},`${d.plugin}/${d.skill}`)})})]})}function qk(n,l){if(!n||typeof window>"u")return l;try{const s=window.localStorage.getItem(n);return s===null?l:s==="true"}catch{return l}}function vg({skills:n,pluginName:l,initialCollapsed:s=!1,persistKey:o,renderSkill:c,headerActionSlot:f}){var v;const d=l??((v=n[0])==null?void 0:v.pluginName)??"unknown-plugin",[h,x]=g.useState(()=>qk(o,s)),p=g.useCallback(()=>{x(b=>{const j=!b;if(o&&typeof window<"u")try{window.localStorage.setItem(o,String(j))}catch{}return j})},[o]),y=h?"▸":"▾";return a.jsxs("div",{"data-vskill-plugin-tree":d,role:"group","aria-label":`${d} (${n.length})`,children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",paddingRight:6},children:[a.jsxs("button",{type:"button",onClick:p,"aria-expanded":!h,style:{display:"flex",alignItems:"center",gap:6,flex:1,padding:"4px 4px 4px 18px",background:"transparent",border:"none",cursor:"pointer",textAlign:"left",color:"var(--text-primary)",fontSize:12,fontWeight:500},children:[a.jsx("span",{"aria-hidden":!0,className:"vskill-chevron tabular-nums",style:{width:16,display:"inline-block",textAlign:"center",fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))"},children:y}),a.jsx("span",{className:"vskill-plugin-name",style:{fontFamily:"var(--font-mono)"},children:d}),a.jsxs("span",{className:"vskill-plugin-count tabular-nums",style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:["(",n.length,")"]})]}),f&&a.jsx("div",{style:{display:"inline-flex",alignItems:"center",flexShrink:0},children:f})]}),!h&&a.jsx("div",{className:"vskill-plugin-tree-children",style:{paddingLeft:36,borderLeft:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",marginLeft:24},children:n.map(b=>a.jsx("div",{"data-vskill-plugin-skill":b.pluginNamespace??b.skill,children:c(b)},`${b.pluginNamespace??b.skill}`))})]})}function Yk({pluginName:n,enabled:l,onAfterAction:s}){const[o,c]=g.useState(!1),[f,d]=g.useState(null),[h,x]=g.useState(null),p=g.useRef(null);g.useEffect(()=>{if(!o)return;function v(b){p.current&&!p.current.contains(b.target)&&c(!1)}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]);async function y(v){d(v),x(null);try{if(v==="uninstall"&&!window.confirm(`Uninstall ${n}? This removes the plugin and its skills.`)){d(null);return}const b=await fetch(`/api/plugins/${encodeURIComponent(n)}/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),j=await b.json().catch(()=>({}));if(!b.ok||!j.ok){x(j.error??`${v} failed (${b.status})`);return}rn("skills"),rn("plugins"),s==null||s(),c(!1)}catch(b){x(b instanceof Error?b.message:String(b))}finally{d(null)}}return a.jsxs("div",{ref:p,style:{position:"relative",display:"inline-flex"},children:[a.jsx("button",{type:"button","aria-label":`Manage ${n}`,title:`Manage ${n}`,onClick:v=>{v.stopPropagation(),c(b=>!b)},"data-vskill-plugin-action-trigger":n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,marginLeft:4,border:"none",background:o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent",color:"var(--text-tertiary)",borderRadius:4,cursor:"pointer",fontSize:14,lineHeight:1},onMouseEnter:v=>{v.currentTarget.style.color="var(--text-primary)",v.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.06))"},onMouseLeave:v=>{v.currentTarget.style.color="var(--text-tertiary)",v.currentTarget.style.background=o?"var(--surface-2, rgba(0,0,0,0.08))":"transparent"},children:"⋯"}),o&&a.jsxs("div",{role:"menu",style:{position:"absolute",top:"calc(100% + 2px)",right:0,minWidth:160,background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 8px 14px -4px rgba(0,0,0,0.12)",padding:4,zIndex:30,fontFamily:"var(--font-sans)"},children:[l?a.jsx(yd,{onClick:()=>void y("disable"),disabled:f!==null,busy:f==="disable",label:"Disable",hint:"Keep installed, turn off"}):a.jsx(yd,{onClick:()=>void y("enable"),disabled:f!==null,busy:f==="enable",label:"Enable",hint:"Activate plugin"}),a.jsx(yd,{onClick:()=>void y("uninstall"),disabled:f!==null,busy:f==="uninstall",label:"Uninstall",hint:"Remove plugin + skills",danger:!0}),h&&a.jsx("div",{style:{padding:"6px 8px",fontSize:11,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4,marginTop:4,lineHeight:1.4,maxWidth:240,wordBreak:"break-word"},children:h})]})]})}function yd({onClick:n,disabled:l,busy:s,label:o,hint:c,danger:f}){return a.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),n()},disabled:l,role:"menuitem",style:{display:"block",width:"100%",padding:"6px 10px",textAlign:"left",border:"none",background:"transparent",borderRadius:4,cursor:l?"not-allowed":"pointer",color:f?"var(--color-error, #b91c1c)":"var(--text-primary)",opacity:l&&!s?.5:1,fontFamily:"inherit"},onMouseEnter:d=>{l||(d.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.05))")},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:500},children:s?`${o}…`:o}),a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)"},children:c})]})}function yg({name:n,count:l,className:s,variant:o,collapsed:c,onToggle:f,action:d}){const h=o==="authoring"?"var(--color-own, #f59e0b)":"var(--color-accent, #2f6f8f)",x=o==="authoring"?"color-mix(in oklch, var(--color-own, #f59e0b) 10%, var(--color-paper, #fff))":"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))",p=typeof f=="function",y={position:"sticky",top:0,zIndex:4,backdropFilter:"saturate(1.4) blur(10px)",WebkitBackdropFilter:"saturate(1.4) blur(10px)",background:x,borderLeft:`3px solid ${h}`,borderBottom:"1px solid var(--border-subtle, rgba(128,128,128,0.2))",padding:"7px 10px 7px 9px",fontFamily:"var(--font-serif, ui-serif)",fontSize:13,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:8,width:"100%",cursor:p?"pointer":"default",border:"none",textAlign:"left"},v=c?"▸":"▾",b=a.jsxs(a.Fragment,{children:[p&&a.jsx("span",{"aria-hidden":!0,style:{fontSize:15,fontWeight:700,color:h,width:16,display:"inline-block",textAlign:"center",letterSpacing:0,textTransform:"none"},children:v}),a.jsx("span",{className:"vskill-group-header-name",children:n}),a.jsxs("span",{className:"vskill-group-header-count tabular-nums",style:{fontFamily:"var(--font-mono)",fontSize:11,fontWeight:500,color:"var(--text-secondary)",letterSpacing:0,textTransform:"none"},children:["(",l,")"]}),d&&a.jsx("span",{style:{marginLeft:"auto"},children:a.jsx(Kk,{label:d.label,title:d.title,icon:d.icon,onClick:d.onClick,accent:h})})]});return p?a.jsx("button",{type:"button","data-vskill-group-header":n,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,onClick:()=>f(!c),"aria-expanded":!c,children:b}):a.jsx("div",{"data-vskill-group-header":n,role:"heading","aria-level":3,className:["vskill-group-header select-none",s??""].join(" ").trim(),style:y,children:b})}function Kk({label:n,title:l,icon:s,onClick:o,accent:c}){return a.jsxs("button",{type:"button","aria-label":n,title:l??n,onClick:f=>{f.stopPropagation(),o()},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",gap:4,height:22,padding:"0 7px",border:`1px solid ${c}`,background:"transparent",color:c,borderRadius:4,fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",cursor:"pointer",fontFamily:"inherit"},onMouseEnter:f=>{f.currentTarget.style.background=`color-mix(in oklch, ${c} 15%, transparent)`},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:[s,n]})}function Xk(){return a.jsxs("div",{"aria-hidden":"true",role:"presentation",style:{display:"flex",alignItems:"center",gap:8,height:36,padding:"0 12px 0 14px"},children:[a.jsx("span",{className:"placeholder",style:{width:6,height:6,borderRadius:"50%",flexShrink:0}}),a.jsx("span",{className:"placeholder",style:{height:10,flex:1,borderRadius:3,maxWidth:180}})]})}function Qk(n){const l=n.key.split("+").map(h=>h.trim()).filter(Boolean);let s=!!n.meta,o=!!n.ctrl,c=!!n.shift,f=!!n.alt,d=n.key;if(l.length>1){for(const h of l.slice(0,-1)){const x=h.toLowerCase();x==="cmd"||x==="meta"||x==="⌘"?s=!0:x==="ctrl"||x==="control"?o=!0:x==="shift"?c=!0:(x==="alt"||x==="option")&&(f=!0)}d=l[l.length-1]}return{key:d.length===1?d.toLowerCase():d,meta:s,ctrl:o,shift:c,alt:f,allowInInputs:!!n.allowInInputs,handler:n.handler}}function Zk(n){if(!n||!(n instanceof HTMLElement))return!1;const l=n.tagName;if(l==="INPUT"||l==="TEXTAREA"||n.isContentEditable)return!0;const s=n.getAttribute("contenteditable");return s!=null&&s!=="false"||n.getAttribute("role")==="textbox"}function Jk(n,l){const s=!!n.metaKey,o=!!n.ctrlKey,c=!!n.shiftKey,f=!!n.altKey;return s!==l.meta||o!==l.ctrl||c!==l.shift||f!==l.alt?!1:(n.key.length===1?n.key.toLowerCase():n.key)===l.key}function Gd(n,l={}){const{enabled:s=!0,target:o}=l,c=g.useRef([]),f=Array.isArray(n)?n:[n];c.current=f.map(Qk),g.useEffect(()=>{if(!s)return;const d=o??(typeof window<"u"?window:void 0);if(!d)return;function h(x){const p=x,y=Zk(p.target);for(const v of c.current){if(!Jk(p,v))continue;const b=v.meta||v.ctrl||v.alt;if(!(y&&!v.allowInInputs&&!b)){v.handler(p);return}}}return d.addEventListener("keydown",h),()=>{d.removeEventListener("keydown",h)}},[s,o])}const ew=200;function tw(n){return n.scope==="own"||n.scope==="installed"||n.scope==="global"?n.scope:n.origin==="installed"?"installed":"own"}function nw(n,l){const s={availableProject:[],availablePersonal:[],availablePlugin:[],authoringProject:[],authoringPlugin:[]};for(const c of n){const f=c.scopeV2??(c.scope==="installed"?"available-project":c.scope==="global"?"available-personal":"authoring-project");f==="available-project"?s.availableProject.push(c):f==="available-personal"?s.availablePersonal.push(c):f==="available-plugin"?s.availablePlugin.push(c):f==="authoring-plugin"?s.authoringPlugin.push(c):s.authoringProject.push(c)}function o(c){const f=c.filter(x=>vf(x,l)),d={};for(const x of f){const p=x.pluginName??x.plugin;(d[p]||(d[p]=[])).push(x)}const h=Object.entries(d).sort((x,p)=>x[0].localeCompare(p[0]));return{total:c.length,filtered:f.length,byPlugin:h}}return{availableProject:o(s.availableProject),availablePersonal:o(s.availablePersonal),availablePlugin:o(s.availablePlugin),authoringProject:o(s.authoringProject),authoringPlugin:o(s.authoringPlugin)}}function aw(n,l){const s=[],o=[],c=[];for(const d of n){const h=tw(d);h==="global"?c.push(d):h==="installed"?o.push(d):s.push(d)}function f(d){var y;const h=d.filter(v=>vf(v,l)),x={};for(const v of h)(x[y=v.plugin]||(x[y]=[])).push(v);const p=Object.entries(x).sort((v,b)=>v[0].localeCompare(b[0]));return{total:d.length,filtered:h.length,byPlugin:p}}return{own:f(s),installed:f(o),global:f(c)}}function rw(n,l){const s=[],o=[];for(const f of n)(f.origin==="installed"?o:s).push(f);function c(f){var p;const d=f.filter(y=>vf(y,l)),h={};for(const y of d)(h[p=y.plugin]||(h[p]=[])).push(y);const x=Object.entries(h).sort((y,v)=>y[0].localeCompare(v[0]));return{total:f.length,filtered:d.length,byPlugin:x}}return{own:c(s),installed:c(o)}}function lw({skills:n,selectedKey:l,onSelect:s,isLoading:o,error:c,onRetry:f,onContextMenu:d,outdatedByOrigin:h,activeAgentId:x,outdatedByScope:p,topSlot:y}){const v=!!x||n.some(X=>X.scope!==void 0&&X.scope!==null),b=x??"claude-cli",[j,k]=g.useState(""),N=g.useDeferredValue(j),C=g.useMemo(()=>aw(n,N),[n,N]),w=g.useMemo(()=>nw(n,N),[n,N]),A=b==="claude-code",{data:_}=Cl("plugins",()=>fetch("/api/plugins").then(X=>X.json()),{enabled:A,ttl:6e4}),H=g.useMemo(()=>{const X=new Map;for(const G of(_==null?void 0:_.plugins)??[]){const ce=X.get(G.name);X.set(G.name,!!ce||!!G.enabled)}return X},[_==null?void 0:_.plugins]),[L,$]=g.useState(()=>Wd(`vskill-sidebar-${b}-group-available-collapsed`)),[E,D]=g.useState(()=>Wd(`vskill-sidebar-${b}-group-authoring-collapsed`)),R=g.useCallback(X=>{$(X);try{window.localStorage.setItem(`vskill-sidebar-${b}-group-available-collapsed`,String(X))}catch{}},[b]),B=g.useCallback(X=>{D(X);try{window.localStorage.setItem(`vskill-sidebar-${b}-group-authoring-collapsed`,String(X))}catch{}},[b]),{own:P,installed:W}=g.useMemo(()=>rw(n,N),[n,N]),Q=C.own.filtered+C.installed.filtered+C.global.filtered>=ew,z=g.useMemo(()=>{const X=G=>{const ce=[];for(const[,O]of G){const Y=[...O].sort((se,ue)=>se.skill.localeCompare(ue.skill));ce.push(...Y)}return ce};return v?[...X(C.own.byPlugin),...X(C.installed.byPlugin),...X(C.global.byPlugin)]:[...X(P.byPlugin),...X(W.byPlugin)]},[v,C.own.byPlugin,C.installed.byPlugin,C.global.byPlugin,P.byPlugin,W.byPlugin]),M=g.useMemo(()=>l?z.findIndex(X=>X.plugin===l.plugin&&X.skill===l.skill):-1,[z,l]),I=g.useCallback(X=>{if(z.length===0)return;const G=M<0?X>0?0:z.length-1:Math.min(Math.max(M+X,0),z.length-1);s(z[G])},[z,M,s]);return Gd([{key:"j",handler:()=>I(1)},{key:"k",handler:()=>I(-1)},{key:"Enter",handler:()=>{M>=0&&s(z[M])}}],{enabled:!o&&!c}),a.jsxs("div",{"data-testid":"sidebar",style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",fontFamily:"var(--font-sans)"},children:[y,a.jsx($k,{value:j,onChange:k}),o&&a.jsx(uw,{}),!o&&c&&a.jsx(dw,{error:c,onRetry:f}),!o&&!c&&v&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(yg,{name:J.scopeLabels.groupAvailable.toUpperCase(),variant:"available",collapsed:L,onToggle:R,count:w.availableProject.total+w.availablePersonal.total+w.availablePlugin.total}),!L&&a.jsxs(a.Fragment,{children:[a.jsx(ws,{label:J.scopeLabels.sourceProject,storageKey:`vskill-sidebar-${b}-available-project-collapsed`,count:w.availableProject.total,filteredCount:j?w.availableProject.filtered:null,updateCount:(p==null?void 0:p.installed)??(h==null?void 0:h.installed),children:w.availableProject.filtered===0?a.jsx(Sg,{queryActive:!!j,agentId:b}):a.jsx(Cs,{items:w.availableProject.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),a.jsx(ws,{label:J.scopeLabels.sourcePersonal,storageKey:`vskill-sidebar-${b}-available-personal-collapsed`,count:w.availablePersonal.total,filteredCount:j?w.availablePersonal.filtered:null,updateCount:p==null?void 0:p.global,children:w.availablePersonal.filtered===0?a.jsx(iw,{queryActive:!!j,agentId:b}):a.jsx(Cs,{items:w.availablePersonal.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),A&&a.jsxs(ws,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${b}-available-plugin-collapsed`,count:w.availablePlugin.total,filteredCount:j?w.availablePlugin.filtered:null,children:[a.jsxs("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("studio:open-marketplace")),style:{display:"flex",alignItems:"center",gap:6,margin:"4px 14px 6px",padding:"4px 8px",fontSize:11,fontWeight:500,border:"1px dashed var(--color-accent, #2f6f8f)",borderRadius:4,background:"transparent",color:"var(--color-accent, #2f6f8f)",cursor:"pointer"},children:[a.jsx("span",{"aria-hidden":!0,children:"🛒"})," Browse marketplaces…"]}),w.availablePlugin.filtered===0?a.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:"No plugin skills installed yet."}):w.availablePlugin.byPlugin.map(([X,G])=>a.jsx(vg,{pluginName:X,skills:G,persistKey:`vskill-plugin-available-${X}-collapsed`,headerActionSlot:A?a.jsx(Yk,{pluginName:X,enabled:H.get(X)??!0}):void 0,renderSkill:ce=>a.jsx(To,{skill:ce,isSelected:(l==null?void 0:l.plugin)===ce.plugin&&(l==null?void 0:l.skill)===ce.skill,onSelect:()=>s(ce),onContextMenu:d})},`available-${X}`))]})]}),a.jsx(cw,{}),a.jsx(yg,{name:J.scopeLabels.groupAuthoring.toUpperCase(),variant:"authoring",collapsed:E,onToggle:B,count:w.authoringProject.total+w.authoringPlugin.total,action:{label:"New",title:"Create a new skill (standalone or plugin)",icon:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),onClick:()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:request-create-skill",{detail:{mode:"standalone"}}))}}}),!E&&a.jsxs(a.Fragment,{children:[a.jsx(ws,{label:J.scopeLabels.authoringSkills,storageKey:`vskill-sidebar-${b}-authoring-project-collapsed`,count:w.authoringProject.total,filteredCount:j?w.authoringProject.filtered:null,updateCount:(p==null?void 0:p.own)??(h==null?void 0:h.source),children:w.authoringProject.filtered===0?a.jsx(bg,{queryActive:!!j}):a.jsx(Cs,{items:w.authoringProject.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),A&&a.jsx(ws,{label:J.scopeLabels.sourcePlugin,storageKey:`vskill-sidebar-${b}-authoring-plugin-collapsed`,count:w.authoringPlugin.total,filteredCount:j?w.authoringPlugin.filtered:null,children:w.authoringPlugin.filtered===0?a.jsxs("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--text-secondary)"},children:["No plugin sources in this project. Add ",a.jsx("code",{children:"<plugin>/.claude-plugin/plugin.json"}),"."]}):w.authoringPlugin.byPlugin.map(([X,G])=>a.jsx(vg,{pluginName:X,skills:G,persistKey:`vskill-plugin-authoring-${X}-collapsed`,renderSkill:ce=>a.jsx(To,{skill:ce,isSelected:(l==null?void 0:l.plugin)===ce.plugin&&(l==null?void 0:l.skill)===ce.skill,onSelect:()=>s(ce),onContextMenu:d})},`authoring-${X}`))})]})]}),!o&&!c&&!v&&a.jsxs("div",{style:{flex:1,overflowY:"auto",minHeight:0},children:[a.jsx(gg,{origin:"source",count:P.total,filteredCount:j?P.filtered:null,updateCount:h==null?void 0:h.source,children:P.filtered===0?a.jsx(bg,{queryActive:!!j}):a.jsx(Cs,{items:P.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})}),a.jsx(ow,{}),a.jsx(gg,{origin:"installed",count:W.total,filteredCount:j?W.filtered:null,updateCount:h==null?void 0:h.installed,children:W.filtered===0?a.jsx(Sg,{queryActive:!!j}):a.jsx(Cs,{items:W.byPlugin,selectedKey:l,onSelect:s,onContextMenu:d,useVirtual:Q})})]})]})}function Wd(n){if(typeof window>"u")return!1;try{return window.localStorage.getItem(n)==="true"}catch{return!1}}function ws({label:n,storageKey:l,count:s,filteredCount:o,updateCount:c,children:f}){const[d,h]=g.useState(()=>Wd(l)),x=g.useCallback(()=>{h(y=>{const v=!y;if(typeof window<"u")try{window.localStorage.setItem(l,String(v))}catch{}return v})},[l]),p=o!=null&&o!==s?`${o} of ${s}`:String(s);return a.jsxs("section",{"data-vskill-named-scope":n,children:[a.jsxs("button",{type:"button",onClick:x,"aria-expanded":!d,style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 12px",background:"transparent",border:"none",cursor:"pointer",fontFamily:"var(--font-sans)",textAlign:"left"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:14,fontWeight:700,color:"var(--color-ink, var(--text-primary))",width:16,display:"inline-block",textAlign:"center"},children:d?"▸":"▾"}),a.jsx("span",{style:{fontSize:12,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--text-primary)"},children:n}),a.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",p,")"]}),c!=null&&c>0&&a.jsxs("span",{style:{marginLeft:"auto",fontSize:10,color:"var(--color-own, #f59e0b)"},children:[c," update",c!==1?"s":""]})]}),!d&&a.jsx("div",{style:{paddingLeft:18},children:f})]})}function sw(n){const l=[];for(const[s,o]of n){const c=[...o].sort((f,d)=>f.skill.localeCompare(d.skill));l.push({kind:"header",plugin:s,count:c.length});for(const f of c)l.push({kind:"row",skill:f})}return l}function Cs({items:n,selectedKey:l,onSelect:s,onContextMenu:o,useVirtual:c}){if(c){const f=sw(n);return a.jsx("div",{"data-virtualized":"true",style:{height:420,minHeight:200},children:a.jsx(bk,{overscan:4,totalCount:f.length,itemContent:d=>{const h=f[d];if(!h)return null;if(h.kind==="header")return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px 4px 14px"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",fontFamily:"var(--font-sans)"},children:h.plugin}),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums",fontFamily:"var(--font-mono)"},children:["(",h.count,")"]})]});const x=h.skill,p=!!l&&l.plugin===x.plugin&&l.skill===x.skill;return a.jsx(To,{skill:x,isSelected:p,onSelect:()=>s(x),onContextMenu:o})}})})}return a.jsx("div",{"data-virtualized":"false",children:n.map(([f,d])=>a.jsx(Wk,{plugin:f,skills:d,selectedKey:l,onSelect:s,onContextMenu:o},f))})}function bg({queryActive:n}){return n?a.jsx(bl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(bl,{headline:"No skills yet.",body:a.jsxs(a.Fragment,{children:["Create one with ",a.jsx(yf,{children:"vskill new"})," or the"," ",a.jsx("strong",{style:{color:"var(--text-primary)"},children:"New skill"})," action in the top rail."]})})}function Sg({queryActive:n,agentId:l}){return n?a.jsx(bl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(bl,{headline:l?`No skills installed for ${l} in this project.`:"No installed skills.",body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(yf,{children:"vskill install <plugin>"})," to add one."]})})}function iw({queryActive:n,agentId:l}){return n?a.jsx(bl,{headline:"No matches in this section.",body:"Adjust the filter or press Escape to clear."}):a.jsx(bl,{headline:`No global skills for ${l}.`,body:a.jsxs(a.Fragment,{children:["Run ",a.jsx(yf,{children:"vskill install --global <plugin>"})," to add one."]})})}function bl({headline:n,body:l}){return a.jsxs("div",{style:{padding:"12px 14px 16px",fontSize:12,color:"var(--text-secondary)",lineHeight:1.5},children:[a.jsx("div",{style:{fontWeight:500,color:"var(--text-primary)",marginBottom:4},children:n}),a.jsx("div",{children:l})]})}function yf({children:n}){return a.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:n})}function ow(){return a.jsx("div",{"aria-hidden":"true",style:{height:1,background:"var(--border-default)",margin:"4px 14px"}})}function cw(){return a.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 uw(){return a.jsx("div",{style:{padding:"8px 0"},children:[0,1,2,3,4,5].map(n=>a.jsx(Xk,{},n))})}function dw({error:n,onRetry:l}){return a.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:[a.jsx("div",{style:{fontWeight:600,marginBottom:4},children:"Couldn't load skills."}),a.jsxs("details",{children:[a.jsx("summary",{style:{cursor:"pointer",color:"var(--text-secondary)",fontSize:11,marginBottom:4},children:fw(n)}),a.jsx("pre",{style:{whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",margin:"6px 0 0"},children:n})]}),l&&a.jsx("button",{type:"button",onClick:l,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 fw(n){const l=n.split(`
66
- `)[0]??n;return l.length>80?l.slice(0,77)+"…":l}const ey=240,ty=480,ny="vskill-sidebar-width",Ls=320;function bf(n){return Number.isFinite(n)?Math.round(Math.max(ey,Math.min(ty,n))):Ls}function pw(){try{const n=localStorage.getItem(ny);if(!n)return Ls;const l=Number(n);return Number.isFinite(l)?bf(l):Ls}catch{return Ls}}function mw(n){try{localStorage.setItem(ny,String(bf(n)))}catch{}}function hw({initialWidth:n,onChange:l}){const s=g.useRef({startX:0,startWidth:n,pointerId:null}),o=g.useRef(n);return g.useEffect(()=>{o.current=n},[n]),g.useEffect(()=>{function c(d){if(s.current.pointerId==null||d.pointerId!==s.current.pointerId)return;const h=d.clientX-s.current.startX,x=bf(s.current.startWidth+h);o.current=x,l(x)}function f(d){s.current.pointerId==null||d.pointerId!==s.current.pointerId||(s.current.pointerId=null,mw(o.current))}return window.addEventListener("pointermove",c),window.addEventListener("pointerup",f),window.addEventListener("pointercancel",f),()=>{window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f)}},[l]),a.jsx("div",{role:"separator","aria-orientation":"vertical","aria-valuemin":ey,"aria-valuemax":ty,"aria-valuenow":n,"aria-label":"Resize sidebar",title:"Drag to resize sidebar",onPointerDown:c=>{const f=c.currentTarget;s.current.startX=c.clientX,s.current.startWidth=o.current,s.current.pointerId=c.pointerId;try{f.setPointerCapture(c.pointerId)}catch{}},style:{width:4,alignSelf:"stretch",cursor:"col-resize",background:"var(--border-default)",userSelect:"none",touchAction:"none"}})}function xw({connected:n,hint:l,onRetry:s}){return n?null:a.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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--status-own)",display:"inline-block",flexShrink:0}}),a.jsx("span",{style:{fontWeight:500},children:"Disconnected — reconnecting…"}),l&&a.jsx("span",{style:{color:"var(--text-secondary)",fontSize:11},children:l}),a.jsx("div",{style:{flex:1}}),s&&a.jsx("button",{type:"button",onClick:s,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 ay(n){if(n!==void 0)try{return JSON.stringify(n)}catch(l){console.error("Failed to serialize request body:",l);try{const s=new WeakSet;return JSON.stringify(n,(o,c)=>{if(typeof c=="object"&&c!==null){if(s.has(c))return"[Circular]";s.add(c)}return c})}catch{return JSON.stringify({error:"Request body could not be serialized"})}}}function bd(){const[n,l]=g.useState([]),[s,o]=g.useState(!1),[c,f]=g.useState(!1),[d,h]=g.useState(null),x=g.useRef(null),p=g.useCallback(async(v,b)=>{l([]),o(!0),f(!1),h(null);const j=new AbortController;x.current=j;try{const k=ay(b),N=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:j.signal});if(!N.ok||!N.body){let H=`HTTP ${N.status}`;try{const L=await N.json();L.error&&(H=L.error)}catch{}throw new Error(H)}const C=N.body.getReader(),w=new TextDecoder;let A="",_="";for(;;){const{done:H,value:L}=await C.read();if(H)break;A+=w.decode(L,{stream:!0});const $=A.split(`
67
- `);A=$.pop()||"";for(const E of $)if(E.startsWith("event: "))_=E.slice(7).trim();else if(E.startsWith("data: ")){try{const D=JSON.parse(E.slice(6)),R={event:_,data:D};_==="done"?(f(!0),l(B=>[...B,R])):l(B=>[...B,R])}catch{}_=""}}}catch(k){k.name!=="AbortError"&&h(k.message)}finally{o(!1),x.current=null}},[]),y=g.useCallback(()=>{var v;(v=x.current)==null||v.abort()},[]);return{events:n,running:s,done:c,error:d,start:p,stop:y}}function gw(n){const l=g.useRef(n);l.current=n;const[s,o]=g.useState(new Set),c=g.useRef(new Map),f=g.useCallback(async(p,y,v)=>{var j;(j=c.current.get(p))==null||j.abort();const b=new AbortController;c.current.set(p,b),o(k=>{const N=new Set(k);return N.add(p),N});try{const k=ay(v),N=await fetch(y,{method:"POST",headers:{"Content-Type":"application/json"},body:k,signal:b.signal});if(!N.ok||!N.body){let H=`HTTP ${N.status}`;try{const L=await N.json();L.error&&(H=L.error)}catch{}throw new Error(H)}const C=N.body.getReader(),w=new TextDecoder;let A="",_="";for(;;){const{done:H,value:L}=await C.read();if(H)break;A+=w.decode(L,{stream:!0});const $=A.split(`
68
- `);A=$.pop()||"";for(const E of $)if(E.startsWith("event: "))_=E.slice(7).trim();else if(E.startsWith("data: ")){try{const D=JSON.parse(E.slice(6)),R={event:_,data:D};l.current.onEvent(p,R)}catch{}_=""}}l.current.onDone(p)}catch(k){k.name!=="AbortError"&&l.current.onError(p,k.message)}finally{o(k=>{const N=new Set(k);return N.delete(p),N}),c.current.delete(p)}},[]),d=g.useCallback(p=>{var y;(y=c.current.get(p))==null||y.abort()},[]),h=g.useCallback(()=>{for(const p of c.current.values())p.abort()},[]),x=s.size>0;return{runningSet:s,startCase:f,stopCase:d,stopAll:h,isAnyCaseRunning:x}}const vw={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 yw(n,l){var s,o;switch(l.type){case"SET_LOADING":return{...n,loading:l.loading};case"SET_ERROR":return{...n,error:l.error};case"INIT_DATA":{const c=new Map;if(l.benchmark)for(const d of l.benchmark.cases)c.set(d.eval_id,{status:d.status,passRate:d.pass_rate,errorMessage:d.error_message||void 0,durationMs:d.durationMs,tokens:d.tokens,output:d.output,assertions:d.assertions.map(h=>({assertion_id:h.id,text:h.text,pass:h.pass,reasoning:h.reasoning}))});const f=((o=(s=l.evals)==null?void 0:s.evals[0])==null?void 0:o.id)??null;return{...n,skillContent:l.skillContent,savedContent:l.skillContent,isDirty:!1,evals:l.evals,evalsError:l.evalsError??null,latestBenchmark:l.benchmark,inlineResults:c,selectedCaseId:f,loading:!1,error:null}}case"SET_PANEL":return{...n,activePanel:l.panel};case"SET_CONTENT":return{...n,skillContent:l.content,isDirty:l.content!==n.savedContent};case"CONTENT_SAVED":return{...n,savedContent:n.skillContent,isDirty:!1};case"SET_EVALS":return{...n,evals:l.evals};case"SELECT_CASE":return{...n,selectedCaseId:l.caseId};case"CASE_RUN_START":{const c=new Map(n.caseRunStates);return c.set(l.caseId,{status:"running",startedAt:Date.now(),mode:l.mode}),{...n,caseRunStates:c,runMode:l.mode,activePanel:"run"}}case"CASE_RUN_COMPLETE":{const c=new Map(n.caseRunStates),f=c.get(l.caseId);c.set(l.caseId,{status:"complete",mode:f==null?void 0:f.mode});const d=new Map(n.inlineResults);return d.set(l.caseId,l.result),{...n,caseRunStates:c,inlineResults:d}}case"CASE_RUN_ERROR":{const c=new Map(n.caseRunStates),f=c.get(l.caseId);c.set(l.caseId,{status:"error",mode:f==null?void 0:f.mode});const d=new Map(n.inlineResults);return d.set(l.caseId,{status:"error",errorMessage:l.error,assertions:[]}),{...n,caseRunStates:c,inlineResults:d}}case"CASE_RUN_CANCEL":{const c=new Map(n.caseRunStates),f=c.get(l.caseId);return c.set(l.caseId,{status:"cancelled",mode:f==null?void 0:f.mode}),{...n,caseRunStates:c}}case"BULK_RUN_START":{const c=new Map(n.caseRunStates);for(const f of l.caseIds)c.set(f,{status:"queued",mode:l.mode});return{...n,caseRunStates:c,bulkRunActive:!0,runMode:l.mode,activePanel:"run"}}case"BULK_RUN_COMPLETE":return{...n,bulkRunActive:!1,latestBenchmark:l.benchmark??n.latestBenchmark,iterationCount:n.iterationCount+1};case"CANCEL_ALL":{const c=new Map(n.caseRunStates);for(const[f,d]of c)(d.status==="running"||d.status==="queued")&&c.set(f,{status:"cancelled"});return{...n,caseRunStates:c,bulkRunActive:!1}}case"UPDATE_INLINE_RESULT":{const c=new Map(n.inlineResults);return c.set(l.evalId,l.result),{...n,inlineResults:c}}case"OPEN_IMPROVE":return{...n,improveTarget:l.evalId,activePanel:"editor"};case"CLOSE_IMPROVE":return{...n,improveTarget:null};case"OPEN_AI_EDIT":return{...n,aiEditOpen:!0,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"CLOSE_AI_EDIT":return{...n,aiEditOpen:!1,aiEditLoading:!1,aiEditResult:null,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[],aiEditEvalChanges:[],aiEditEvalSelections:new Map,aiEditEvalsRetry:null};case"AI_EDIT_LOADING":return{...n,aiEditLoading:!0,aiEditError:null,aiEditClassifiedError:null,aiEditProgress:[]};case"AI_EDIT_PROGRESS":return{...n,aiEditProgress:[...n.aiEditProgress,l.entry]};case"AI_EDIT_RESULT":{const c=l.evalChanges??[],f=new Map;for(let d=0;d<c.length;d++)f.set(d,!0);return{...n,aiEditLoading:!1,aiEditResult:{improved:l.improved,reasoning:l.reasoning,evalChanges:c},aiEditEvalChanges:c,aiEditEvalSelections:f}}case"AI_EDIT_ERROR":return{...n,aiEditLoading:!1,aiEditError:l.message,aiEditClassifiedError:l.classified??null};case"GENERATE_EVALS_START":return{...n,generateEvalsLoading:!0,generateEvalsProgress:[],generateEvalsError:null};case"GENERATE_EVALS_PROGRESS":return{...n,generateEvalsProgress:[...n.generateEvalsProgress,l.entry]};case"GENERATE_EVALS_DONE":return{...n,generateEvalsLoading:!1,evals:l.evals};case"GENERATE_EVALS_ERROR":return{...n,generateEvalsLoading:!1,generateEvalsError:l.classified};case"TOGGLE_EVAL_CHANGE":{const c=new Map(n.aiEditEvalSelections);return c.set(l.index,!c.get(l.index)),{...n,aiEditEvalSelections:c}}case"SELECT_ALL_EVAL_CHANGES":{const c=new Map(n.aiEditEvalSelections);for(const f of c.keys())c.set(f,!0);return{...n,aiEditEvalSelections:c}}case"DESELECT_ALL_EVAL_CHANGES":{const c=new Map(n.aiEditEvalSelections);for(const f of c.keys())c.set(f,!1);return{...n,aiEditEvalSelections:c}}case"SET_EVALS_RETRY":return{...n,aiEditEvalsRetry:l.evalsFile};case"SET_REGRESSIONS":return{...n,regressions:l.regressions};case"INCREMENT_ITERATION":return{...n,iterationCount:n.iterationCount+1};case"SET_ACTIVATION_PROMPTS":return{...n,activationPrompts:l.prompts};case"ACTIVATION_START":return{...n,activationRunning:!0,activationResults:[],activationSummary:null,activationError:null,activationClassifyingStatus:null,activationStartedAt:Date.now()};case"ACTIVATION_RESULT":return{...n,activationResults:[...n.activationResults,l.result]};case"ACTIVATION_DONE":return{...n,activationRunning:!1,activationSummary:l.summary,activationClassifyingStatus:null};case"ACTIVATION_CLASSIFYING":return{...n,activationClassifyingStatus:`Classifying prompt ${l.index}/${l.total}...`};case"ACTIVATION_ERROR":return{...n,activationRunning:!1,activationError:l.error,activationClassifyingStatus:null};case"ACTIVATION_RESET":return{...n,activationResults:[],activationSummary:null,activationError:null};case"ACTIVATION_TIMEOUT":return{...n,activationRunning:!1,activationError:"Activation test timed out after 120 seconds"};case"ACTIVATION_CANCEL":return{...n,activationRunning:!1};case"GENERATE_PROMPTS_START":return{...n,generatingPrompts:!0,generatingPromptsError:null};case"GENERATE_PROMPTS_DONE":return{...n,generatingPrompts:!1};case"GENERATE_PROMPTS_ERROR":return{...n,generatingPrompts:!1,generatingPromptsError:l.error};case"ACTIVATION_HISTORY_LOADED":return{...n,activationHistory:l.runs,activationHistoryLoading:!1};default:return n}}function bw(n){if(n==="unit"||n==="integration")return n}function Sw(n,l){const s=l.data;if(l.event==="output_ready"&&(n.output=s.output,s.durationMs!=null&&(n.durationMs=s.durationMs),s.tokens!=null&&(n.tokens=s.tokens)),l.event==="outputs_ready"&&(n.output=s.skillOutput,s.skillDurationMs!=null&&(n.durationMs=s.skillDurationMs),s.skillTokens!=null&&(n.tokens=s.skillTokens)),l.event==="assertion_result"){const o={assertion_id:s.assertion_id,text:s.text,pass:s.pass,reasoning:s.reasoning};n.assertions.find(c=>c.assertion_id===o.assertion_id)||n.assertions.push(o)}l.event==="case_complete"&&(n.status=s.status,n.passRate=s.pass_rate,n.errorMessage=s.error_message||void 0,n.classifiedError=s.classified_error||void 0)}const ry=g.createContext(null);function Cn(){const n=g.useContext(ry);if(!n)throw new Error("useWorkspace must be used within WorkspaceProvider");return n}function jg({plugin:n,skill:l,origin:s,children:o}){const c=s==="installed",[f,d]=g.useReducer(yw,{...vw,plugin:n,skill:l}),h=g.useRef(new Set),x=g.useRef(new Set),p=g.useRef(new Map),y=g.useCallback((ae,fe)=>{let de=p.current.get(ae);de||(de={assertions:[]},p.current.set(ae,de)),Sw(de,fe),d({type:"UPDATE_INLINE_RESULT",evalId:ae,result:{...de,assertions:[...de.assertions]}})},[]),v=g.useCallback(ae=>{if(x.current.has(ae))return;x.current.add(ae);const fe=p.current.get(ae)??{assertions:[]};d({type:"CASE_RUN_COMPLETE",caseId:ae,result:{...fe,assertions:[...fe.assertions]}}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(n,l).then(de=>d({type:"BULK_RUN_COMPLETE",benchmark:de})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null})))},[n,l]),b=g.useCallback((ae,fe)=>{x.current.has(ae)||(x.current.add(ae),d({type:"CASE_RUN_ERROR",caseId:ae,error:fe}),h.current.has(ae)&&(h.current.delete(ae),h.current.size===0&&Ne.getLatestBenchmark(n,l).then(de=>d({type:"BULK_RUN_COMPLETE",benchmark:de})).catch(()=>d({type:"BULK_RUN_COMPLETE",benchmark:null}))))},[n,l]),{startCase:j,stopCase:k,stopAll:N}=gw({onEvent:y,onDone:v,onError:b});g.useEffect(()=>()=>{N()},[N]);const C=g.useCallback(async()=>{try{const ae=await fetch(`/api/skills/${n}/${l}/activation-history`);if(!ae.ok){if(ae.status===404){d({type:"ACTIVATION_HISTORY_LOADED",runs:[]});return}return}const fe=await ae.json();d({type:"ACTIVATION_HISTORY_LOADED",runs:fe.runs||[]})}catch{}},[n,l]);g.useEffect(()=>{let ae=!1;async function fe(){try{const[de,he,ye]=await Promise.allSettled([Ne.getSkillDetail(n,l),Ne.getEvals(n,l),Ne.getLatestBenchmark(n,l)]);if(ae)return;let Oe=null,Ae=null;if(he.status==="fulfilled")Oe=he.value;else{const pe=he.reason;Ae=(pe==null?void 0:pe.message)??"Failed to load test cases"}d({type:"INIT_DATA",skillContent:de.status==="fulfilled"?de.value.skillContent:"",evals:Oe,evalsError:Ae,benchmark:ye.status==="fulfilled"?ye.value:null})}catch(de){ae||d({type:"SET_ERROR",error:de.message})}}return fe(),C(),()=>{ae=!0}},[n,l,C]);const w=g.useCallback(async()=>{if(!c)try{await Ne.applyImprovement(n,l,f.skillContent),d({type:"CONTENT_SAVED"})}catch(ae){d({type:"SET_ERROR",error:ae.message})}},[c,n,l,f.skillContent]),A=g.useCallback(async ae=>{if(!c)try{const fe=await Ne.saveEvals(n,l,ae);d({type:"SET_EVALS",evals:fe})}catch(fe){d({type:"SET_ERROR",error:fe.message})}},[c,n,l]),_=g.useCallback((ae,fe="benchmark")=>{if(c)return;const de=f.caseRunStates.get(ae);if((de==null?void 0:de.status)!=="running")if(p.current.delete(ae),x.current.delete(ae),d({type:"CASE_RUN_START",caseId:ae,mode:fe}),fe==="comparison"){const he=`/api/skills/${n}/${l}/compare`;j(ae,he,{eval_ids:[ae]})}else{const he=`/api/skills/${n}/${l}/benchmark/case/${ae}`;j(ae,he,fe==="baseline"?{baseline_only:!0}:void 0)}},[c,n,l,f.caseRunStates,j]),H=g.useCallback((ae="benchmark")=>{var he;if(c)return;const fe=((he=f.evals)==null?void 0:he.evals)??[];if(fe.length===0)return;const de=fe.map(ye=>ye.id);for(const ye of de)p.current.delete(ye),x.current.delete(ye);d({type:"BULK_RUN_START",caseIds:de,mode:ae}),h.current=new Set(de);for(const ye of de)if(ae==="comparison")j(ye,`/api/skills/${n}/${l}/compare`,{eval_ids:[ye]});else{const Oe=`/api/skills/${n}/${l}/benchmark/case/${ye}`;j(ye,Oe,ae==="baseline"?{baseline_only:!0}:void 0)}},[c,n,l,f.evals,j]),L=g.useCallback(ae=>{k(ae),d({type:"CASE_RUN_CANCEL",caseId:ae}),h.current.delete(ae),x.current.add(ae)},[k]),$=g.useCallback(()=>{N(),d({type:"CANCEL_ALL"}),h.current.clear()},[N]),E=g.useCallback(async(ae,fe)=>{d({type:"OPEN_IMPROVE",evalId:ae})},[]),D=g.useCallback(async(ae,fe)=>{try{await Ne.applyImprovement(n,l,fe),d({type:"SET_CONTENT",content:fe}),d({type:"CONTENT_SAVED"}),d({type:"CLOSE_IMPROVE"}),_(ae,"benchmark")}catch(de){d({type:"SET_ERROR",error:de.message})}},[n,l,_]),R=bd(),B=g.useRef(null),P=g.useRef(0);g.useEffect(()=>{const ae=R.events;for(let fe=P.current;fe<ae.length;fe++){const de=ae[fe],he=de.data;if(de.event==="progress"&&d({type:"AI_EDIT_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),de.event==="done"){const ye=he.improved,Oe=he.reasoning,Ae=he.evalChanges??[];d({type:"AI_EDIT_RESULT",improved:ye,reasoning:Oe,evalChanges:Ae})}if(de.event==="error"){const ye=he;d({type:"AI_EDIT_ERROR",message:ye.description||"Unknown error",classified:ye})}}P.current=ae.length},[R.events]),g.useEffect(()=>{R.error&&d({type:"AI_EDIT_ERROR",message:R.error})},[R.error]),g.useEffect(()=>()=>{R.stop()},[R.stop]);const W=g.useCallback(async(ae,fe,de)=>{c||(P.current=0,d({type:"AI_EDIT_LOADING"}),B.current=R.stop,R.start(`/api/skills/${n}/${l}/improve?sse`,{mode:"instruct",instruction:ae,content:f.skillContent,evals:f.evals??{skill_name:l,evals:[]},provider:fe,model:de}))},[c,n,l,f.skillContent,f.evals,R]),te=g.useCallback(()=>{R.stop(),d({type:"AI_EDIT_ERROR",message:"Cancelled"})},[R]),Q=g.useCallback(async()=>{const ae=f.aiEditResult;if(ae!=null&&ae.improved)try{if(await Ne.applyImprovement(n,l,ae.improved),d({type:"SET_CONTENT",content:ae.improved}),d({type:"CONTENT_SAVED"}),f.aiEditEvalChanges.length>0&&Array.from(f.aiEditEvalSelections.values()).some(Boolean)){const{mergeEvalChanges:de}=await _o(async()=>{const{mergeEvalChanges:Oe}=await import("./mergeEvalChanges-Dpbbs4d4.js");return{mergeEvalChanges:Oe}},[]),he=f.evals??{skill_name:l,evals:[]},ye=de(he,f.aiEditEvalChanges,f.aiEditEvalSelections);try{const Oe=await Ne.saveEvals(n,l,ye);d({type:"SET_EVALS",evals:Oe})}catch(Oe){d({type:"SET_EVALS_RETRY",evalsFile:ye}),d({type:"SET_ERROR",error:`SKILL.md saved, but test cases failed to save: ${Oe.message}. You can retry from the AI Edit panel.`});return}}d({type:"CLOSE_AI_EDIT"})}catch(fe){d({type:"SET_ERROR",error:fe.message})}},[n,l,f.aiEditResult,f.evals,f.aiEditEvalChanges,f.aiEditEvalSelections]),z=g.useCallback(()=>{d({type:"CLOSE_AI_EDIT"})},[]),M=g.useCallback(ae=>{d({type:"TOGGLE_EVAL_CHANGE",index:ae})},[]),I=g.useCallback(()=>{d({type:"SELECT_ALL_EVAL_CHANGES"})},[]),X=g.useCallback(()=>{d({type:"DESELECT_ALL_EVAL_CHANGES"})},[]),G=g.useCallback(async()=>{const ae=f.aiEditEvalsRetry;if(ae)try{const fe=await Ne.saveEvals(n,l,ae);d({type:"SET_EVALS",evals:fe}),d({type:"SET_ERROR",error:null}),d({type:"CLOSE_AI_EDIT"})}catch(fe){d({type:"SET_ERROR",error:`Retry failed: ${fe.message}`})}},[n,l,f.aiEditEvalsRetry]),ce=g.useCallback(async()=>{try{const ae=await Ne.getSkillDetail(n,l);d({type:"SET_CONTENT",content:ae.skillContent}),d({type:"CONTENT_SAVED"})}catch{}},[n,l]),{config:O}=Nr(),Y=bd(),se=g.useRef(0);g.useEffect(()=>{const ae=Y.events;for(let fe=se.current;fe<ae.length;fe++){const de=ae[fe],he=de.data;if(de.event==="progress"&&d({type:"GENERATE_EVALS_PROGRESS",entry:{timestamp:Date.now(),phase:he.phase,message:he.message}}),de.event==="done"){const ye=he;Ne.saveEvals(n,l,ye).then(Oe=>d({type:"GENERATE_EVALS_DONE",evals:Oe})).catch(Oe=>d({type:"SET_ERROR",error:Oe.message}))}de.event==="error"&&d({type:"GENERATE_EVALS_ERROR",classified:he})}se.current=ae.length},[Y.events,n,l]),g.useEffect(()=>{Y.error&&d({type:"SET_ERROR",error:Y.error})},[Y.error]),g.useEffect(()=>()=>{Y.stop()},[Y.stop]);const ue=g.useCallback(async ae=>{if(c)return;se.current=0,d({type:"GENERATE_EVALS_START"});const fe={};O!=null&&O.provider&&(fe.provider=O.provider),O!=null&&O.model&&(fe.model=O.model);const de=bw(ae==null?void 0:ae.testType);de&&(fe.testType=de),Y.start(`/api/skills/${n}/${l}/generate-evals?sse`,Object.keys(fe).length>0?fe:void 0)},[c,n,l,Y,O]),ge=bd(),xe=g.useRef(0);g.useEffect(()=>()=>{ge.stop()},[ge.stop]),g.useEffect(()=>{const ae=ge.events;for(let fe=xe.current;fe<ae.length;fe++){const de=ae[fe];if(de.event==="classifying"){const he=de.data;d({type:"ACTIVATION_CLASSIFYING",index:he.index,total:he.total})}if(de.event==="prompt_result"&&d({type:"ACTIVATION_RESULT",result:de.data}),de.event==="done"){we.current&&(clearTimeout(we.current),we.current=null);const he=de.data;if(he.error)d({type:"ACTIVATION_ERROR",error:he.error});else{d({type:"ACTIVATION_DONE",summary:he});const ye={id:`run-${Date.now()}`,timestamp:new Date().toISOString(),model:(O==null?void 0:O.model)||"unknown",provider:(O==null?void 0:O.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}};d({type:"ACTIVATION_HISTORY_LOADED",runs:[ye,...f.activationHistory??[]]})}}}xe.current=ae.length},[ge.events,O,f.activationHistory]),g.useEffect(()=>{ge.error&&(we.current&&(clearTimeout(we.current),we.current=null),d({type:"ACTIVATION_ERROR",error:ge.error}))},[ge.error]);const we=g.useRef(null),ie=g.useCallback(()=>{we.current&&(clearTimeout(we.current),we.current=null),ge.stop(),d({type:"ACTIVATION_CANCEL",totalPrompts:0})},[ge]),je=g.useCallback(ae=>{const de=ae.trim().split(`
69
- `).filter(Boolean).map(ye=>ye.startsWith("!")?{prompt:ye.slice(1).trim(),expected:"should_not_activate"}:ye.startsWith("+")?{prompt:ye.slice(1).trim(),expected:"should_activate"}:{prompt:ye.trim(),expected:"auto"});xe.current=0,d({type:"ACTIVATION_START"}),d({type:"SET_ACTIVATION_PROMPTS",prompts:ae});const he={prompts:de};O!=null&&O.provider&&(he.provider=O.provider),O!=null&&O.model&&(he.model=O.model),ge.start(`/api/skills/${n}/${l}/activation-test`,he),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{ge.stop(),d({type:"ACTIVATION_TIMEOUT"}),we.current=null},12e4)},[n,l,ge,O]),_e=g.useCallback(async(ae=8)=>{d({type:"GENERATE_PROMPTS_START"});try{const fe={count:ae};O!=null&&O.provider&&(fe.provider=O.provider),O!=null&&O.model&&(fe.model=O.model);const de=await fetch(`/api/skills/${n}/${l}/activation-prompts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)});if(!de.ok){let Be=`HTTP ${de.status}`;try{const Ot=await de.json();Ot.error&&(Be=Ot.error)}catch{}throw new Error(Be)}const he=de.body.getReader(),ye=new TextDecoder;let Oe="",Ae="",pe=[];for(;;){const{done:Be,value:Ot}=await he.read();if(Be)break;Oe+=ye.decode(Ot,{stream:!0});const Ft=Oe.split(`
70
- `);Oe=Ft.pop()||"";for(const rt of Ft)if(rt.startsWith("event: "))Ae=rt.slice(7).trim();else if(rt.startsWith("data: ")){try{const jt=JSON.parse(rt.slice(6));if(Ae==="done"){if(jt.error)throw new Error(jt.error);pe=jt.prompts||[]}if(Ae==="error")throw new Error(jt.message||jt.description||"Generation failed")}catch(jt){if(!(jt instanceof SyntaxError))throw jt}Ae=""}}const ze=pe.map(Be=>`${Be.expected==="should_activate"?"+":"!"}${Be.prompt}`).join(`
71
- `);d({type:"SET_ACTIVATION_PROMPTS",prompts:ze}),d({type:"GENERATE_PROMPTS_DONE"})}catch(fe){d({type:"GENERATE_PROMPTS_ERROR",error:fe.message})}},[n,l,O]),Ue=g.useMemo(()=>({state:f,dispatch:d,isReadOnly:c,saveContent:w,saveEvals:A,runCase:_,runAll:H,cancelCase:L,cancelAll:$,improveForCase:E,applyImproveAndRerun:D,refreshSkillContent:ce,generateEvals:ue,runActivationTest:je,cancelActivation:ie,generateActivationPrompts:_e,fetchActivationHistory:C,submitAiEdit:W,cancelAiEdit:te,applyAiEdit:Q,discardAiEdit:z,toggleEvalChange:M,selectAllEvalChanges:I,deselectAllEvalChanges:X,retryEvalsSave:G}),[f,c,w,A,_,H,L,$,E,D,ce,ue,je,ie,_e,C,W,te,Q,z,M,I,X,G]);return a.jsx(ry.Provider,{value:Ue,children:o})}function jw(n){if(!n)return[];const l=n.split(`
72
- `),s=[];for(const o of l)if(!(o.startsWith("--- ")||o.startsWith("+++ "))){if(o.startsWith("@@")){s.push({type:"header",content:o});continue}if(o.startsWith("+")){s.push({type:"add",content:o.slice(1)});continue}if(o.startsWith("-")){s.push({type:"remove",content:o.slice(1)});continue}(o.startsWith(" ")||o===""&&s.length>0)&&s.push({type:"context",content:o.startsWith(" ")?o.slice(1):""})}return s}function Sf({contentDiff:n,fromLabel:l,toLabel:s,diffSummary:o,maxHeight:c=480,collapsible:f=!1,renderContext:d="inline",onRetry:h}){const[x,p]=g.useState(f),[y,v]=g.useState("unified"),b=g.useRef(null),j=g.useRef(null),k=g.useMemo(()=>jw(n),[n]),N=g.useMemo(()=>{const L=k.filter(E=>E.type==="add").length,$=k.filter(E=>E.type==="remove").length;return{added:L,removed:$}},[k]),C=g.useMemo(()=>{let L=0,$=0;return k.filter(E=>E.type!=="header").map(E=>E.type==="remove"?(L++,{...E,origNum:L,newNum:null}):E.type==="add"?($++,{...E,origNum:null,newNum:$}):(L++,$++,{...E,origNum:L,newNum:$}))},[k]),w=g.useMemo(()=>{const L=[],$=[];for(const E of C)if(E.type==="remove")L.push(E);else if(E.type==="add")$.push(E);else{for(;L.length<$.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<L.length;)$.push({type:"context",content:"",origNum:null,newNum:null});L.push(E),$.push(E)}for(;L.length<$.length;)L.push({type:"context",content:"",origNum:null,newNum:null});for(;$.length<L.length;)$.push({type:"context",content:"",origNum:null,newNum:null});return{left:L,right:$}},[C]),A=g.useCallback(L=>{const $=L==="left"?b.current:j.current,E=L==="left"?j.current:b.current;$&&E&&(E.scrollTop=$.scrollTop)},[]);if(!n||k.length===0)return a.jsxs("div",{className:"rounded-lg p-6 text-center",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"Unable to load diff. Try again."}),h&&a.jsx("button",{onClick:h,className:"btn btn-secondary text-[12px]",children:"Retry"})]});const _=d==="modal"?"fixed inset-0 z-50 flex items-center justify-center bg-black/50":"",H=a.jsxs("div",{className:"rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:[l," → ",s]}),a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",N.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",N.removed]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>v(y==="unified"?"side-by-side":"unified"),className:"btn btn-ghost text-[11px]",children:y==="unified"?"Side-by-side":"Unified"}),f&&a.jsx("button",{onClick:()=>p(!x),className:"btn btn-ghost text-[11px]",children:x?"Expand":"Collapse"})]})]}),o&&a.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"?a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:c,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:C.map((L,$)=>a.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="remove"?"rgba(239,68,68,0.5)":"var(--text-tertiary)",opacity:L.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:L.type==="add"?"rgba(34,197,94,0.5)":"var(--text-tertiary)",opacity:L.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"transparent",borderRight:L.type==="add"?"2px solid var(--green)":L.type==="remove"?"2px solid var(--red)":"2px solid transparent"},children:L.type==="add"?"+":L.type==="remove"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||"​"})]},$))})})}):a.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:[a.jsx("div",{ref:b,style:{maxHeight:c,overflowY:"auto",borderRight:"1px solid var(--border-subtle)"},onScroll:()=>A("left"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:w.left.map((L,$)=>a.jsxs("tr",{style:{background:L.type==="remove"?"rgba(239,68,68,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.origNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="remove"?"var(--red)":"var(--text-secondary)"},children:L.content||"​"})]},$))})})}),a.jsx("div",{ref:j,style:{maxHeight:c,overflowY:"auto"},onScroll:()=>A("right"),children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:w.right.map((L,$)=>a.jsxs("tr",{style:{background:L.type==="add"?"rgba(34,197,94,0.08)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:35,fontSize:10,color:"var(--text-tertiary)",opacity:.6,borderRight:"1px solid var(--border-subtle)"},children:L.newNum??""}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:L.type==="add"?"var(--green)":"var(--text-secondary)"},children:L.content||"​"})]},$))})})})]}))]});return d==="modal"?a.jsx("div",{className:_,children:a.jsx("div",{style:{width:"80%",maxWidth:900},children:H})}):H}const kg={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 kw(n,l){return n?n.length>l?n.slice(0,l)+"…":n:""}function ly(){const{state:n}=Cn(),{plugin:l,skill:s}=n,{refreshSkills:o,updateCount:c}=Ca(),f=`versions/${l}/${s}`,d=g.useCallback(()=>Ne.getSkillVersions(l,s),[l,s]),{data:h,loading:x}=Cl(f,d),[p,y]=g.useState(null),[v,b]=g.useState(null),[j,k]=g.useState(null),[N,C]=g.useState(!1),[w,A]=g.useState("idle"),[_,H]=g.useState(null),L=g.useRef(null),$=g.useRef(null),E=g.useMemo(()=>(h==null?void 0:h.find(Q=>Q.isInstalled))??null,[h]),D=g.useMemo(()=>(h==null?void 0:h[0])??null,[h]),R=E&&D&&E.version!==D.version,B=g.useCallback(Q=>{p?!v&&Q!==p?b(Q):(y(Q),b(null),k(null)):(y(Q),k(null))},[p,v]),P=g.useCallback(async(Q,z)=>{C(!0);try{const M=await Ne.getVersionDiff(l,s,Q,z);k(M)}catch{k(null)}finally{C(!1)}},[l,s]);g.useEffect(()=>{if(p&&v){const Q=h||[],z=Q.findIndex(G=>G.version===p),M=Q.findIndex(G=>G.version===v),[I,X]=z>M?[p,v]:[v,p];P(I,X)}},[p,v,h,P]);const W=g.useCallback(()=>{!E||!D||(y(E.version),b(D.version))},[E,D]),te=g.useCallback(()=>{A("updating"),H(null);const Q=Ne.startSkillUpdate(l,s);L.current=Q,Q.addEventListener("progress",z=>{try{switch(JSON.parse(z.data).status){case"scanning":A("scanning");break;case"installing":A("installing");break;case"done":A("done");break}}catch{A("error"),H("Unexpected response from server")}}),Q.addEventListener("done",()=>{Q.close(),L.current=null,o(),rn(f),A("done")}),Q.addEventListener("error",z=>{const M=z;let I="Connection lost";if(M.data)try{I=JSON.parse(M.data).error||"Update failed"}catch{}A("error"),H(I),Q.close(),L.current=null})},[l,s,f,o]);return g.useEffect(()=>()=>{L.current&&(L.current.close(),L.current=null)},[]),x?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-40 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"}),a.jsx("div",{className:"skeleton h-14 rounded-lg"})]})]}):!h||h.length===0?a.jsx("div",{className:"flex flex-col items-center justify-center h-full py-16",children:a.jsx("div",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No version history available"})}):a.jsxs("div",{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Version History"}),a.jsxs("div",{className:"flex items-center gap-2",children:[R&&a.jsx("button",{onClick:W,className:"btn btn-secondary text-[11px]",children:"View changes since installed"}),R&&w!=="done"&&(w==="error"?a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--red)"},children:_||"Update failed"}),a.jsx("button",{onClick:te,className:"btn btn-secondary text-[11px]",children:"Retry"})]}):a.jsx("button",{onClick:te,disabled:w!=="idle",className:"btn btn-primary text-[11px]",children:w==="idle"?`Update to ${D==null?void 0:D.version}`:w==="updating"?"Starting update...":w==="scanning"?"Scanning...":"Installing..."})),c>1&&a.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 (",c,")"]})]})]}),p&&!v&&a.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]}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-3 top-0 bottom-0",style:{width:2,background:"var(--border-subtle)"}}),a.jsx("div",{className:"space-y-1",children:h.map(Q=>{const z=kg[Q.certTier]||kg.COMMUNITY,M=Q.version===p||Q.version===v,I=Q.isInstalled;return a.jsxs("button",{onClick:()=>B(Q.version),className:"w-full text-left pl-8 pr-4 py-3 relative rounded-lg transition-all duration-150",style:{background:M?"var(--accent-muted)":"transparent",border:M?"1px solid var(--accent)":"1px solid transparent",cursor:"pointer"},onMouseEnter:X=>{M||(X.currentTarget.style.background="var(--surface-1)")},onMouseLeave:X=>{M||(X.currentTarget.style.background="transparent")},children:[a.jsx("span",{className:"absolute left-1.5 top-4 rounded-full",style:{width:I?10:8,height:I?10:8,background:I?"var(--accent)":"var(--surface-3)",border:I?"2px solid var(--accent)":"2px solid var(--border-default)"}}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:Q.version}),a.jsx("span",{className:"text-[9px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.bg,color:z.text},children:Q.certTier}),I&&a.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"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:new Date(Q.createdAt).toLocaleDateString()})]}),Q.diffSummary&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:kw(Q.diffSummary,80)})]},Q.version)})}),a.jsx("div",{ref:$,style:{height:1}})]}),N&&a.jsx("div",{className:"mt-4",children:a.jsx("div",{className:"skeleton h-48 rounded-xl"})}),j&&!N&&a.jsx("div",{className:"mt-4",children:a.jsx(Sf,{contentDiff:j.contentDiff,fromLabel:j.from,toLabel:j.to,diffSummary:j.diffSummary,renderContext:"inline",onRetry:()=>p&&v&&P(j.from,j.to)})})]})}function ww(n){return n==null?"var(--text-tertiary)":n>=.7?"var(--green)":n>=.4?"var(--yellow)":"var(--red)"}function Cw(n){return n==null?"var(--surface-3)":n>=.7?"var(--green-muted)":n>=.4?"var(--yellow-muted)":"var(--red-muted)"}function wg(n,l="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:n,severity:l}}))}function jf(n){return n.skill?Nw({skill:n.skill}):Rw({state:n.state,isReadOnly:n.isReadOnly,onDelete:n.onDelete})}function Ew(n,l=48){if(n.length<=l)return n;const s=n.slice(0,12),o=n.slice(n.length-(l-12-1));return`${s}…${o}`}function Nw({skill:n}){const[l,s]=g.useState(!1),o=g.useCallback(async()=>{var d;try{await((d=navigator.clipboard)==null?void 0:d.writeText(n.dir)),s(!0),setTimeout(()=>s(!1),1500),wg(J.toasts.pathCopied,"info")}catch{wg(J.toasts.permissionDenied,"error")}},[n.dir]),c=n.origin==="installed"?"Project":"Skills",f=n.origin==="installed"?"var(--status-installed)":"var(--status-own)";return a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",marginBottom:4},children:[a.jsx("span",{"data-testid":"detail-header-plugin",children:n.plugin}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--text-secondary)"},children:"›"}),a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--text-secondary)",fontSize:11,letterSpacing:.3,textTransform:"uppercase"},children:[a.jsx("span",{"data-origin-dot":n.origin,"aria-label":`Origin: ${c}`,style:{display:"inline-block",width:7,height:7,borderRadius:999,background:f}}),c]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:12,marginBottom:8},children:[a.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:n.skill}),a.jsx("span",{"data-testid":"detail-header-version",style:{fontFamily:"var(--font-sans)",fontVariantNumeric:"tabular-nums",fontSize:12,color:"var(--text-secondary)",whiteSpace:"nowrap"},children:n.version??"—"})]}),a.jsx(Tw,{skill:n}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("button",{type:"button","data-testid":"detail-header-path-chip",title:n.dir,"aria-label":`Copy path ${n.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:Ew(n.dir||"—")}),a.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:[a.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),l?"Copied":"Copy"]})]})]})}function Tw({skill:n}){const l=n.installMethod,s=n.symlinkTarget;if(!l)return null;let o="";switch(l){case"symlinked":o=s?`Symlinked from ${s}`:"Symlinked (target unresolved)";break;case"copied":o="Copied (independent)";break;case"authored":o="Authored";break;default:return null}return a.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:[a.jsx("span",{style:{fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase",fontSize:10,color:"var(--text-tertiary)"},children:"Install method"}),a.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o})]})}function Rw({state:n,isReadOnly:l,onDelete:s}){const{plugin:o,skill:c,evals:f,latestBenchmark:d,isDirty:h,caseRunStates:x,regressions:p,iterationCount:y}=n,v=Array.from(x.values()).some(w=>w.status==="running"||w.status==="queued"),b=d==null?void 0:d.overall_pass_rate,j=(f==null?void 0:f.evals.reduce((w,A)=>w+A.assertions.length,0))??0,k=(f==null?void 0:f.evals.length)??0,N=ww(b),C=Cw(b);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:[a.jsxs("div",{className:"flex items-center gap-2 text-[13px]",children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:o}),a.jsx(Aw,{}),a.jsx("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:c}),l&&a.jsxs("span",{className:"ml-2 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"installed"]}),h&&a.jsx("span",{className:"ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded",style:{background:"var(--yellow-muted)",color:"var(--yellow)"},children:"unsaved"}),v&&a.jsxs("span",{className:"ml-2 flex items-center gap-1.5 text-[11px]",style:{color:"var(--accent)"},children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}}),"Running..."]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!l&&s&&a.jsx("button",{disabled:v,onClick:()=>{window.confirm(`Delete skill "${c}"? This cannot be undone.`)&&s()},title:"Delete skill",className:"flex items-center justify-center transition-colors duration-150",style:{background:"none",border:"none",cursor:v?"not-allowed":"pointer",color:"var(--text-tertiary)",padding:4,opacity:v?.4:1,borderRadius:4},onMouseEnter:w=>{v||(w.currentTarget.style.color="var(--red)")},onMouseLeave:w=>{w.currentTarget.style.color="var(--text-tertiary)"},children:a.jsx(Mw,{})}),p.length>0&&a.jsxs("span",{className:"pill",style:{background:"var(--red-muted)",color:"var(--red)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),p.length," regression",p.length>1?"s":""]}),y>0&&a.jsxs("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)"},children:["Iter ",y]}),a.jsx("span",{className:"pill",style:{background:C,color:N},children:b!=null?`${Math.round(b*100)}%`:"--"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[k," case",k!==1?"s":""," / ",j," assert",j!==1?"s":""]})]})]})}function Aw(){return a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function Mw(){return a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}const Lw=[{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 zw({id:n}){const l={width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"};switch(n){case"editor":return a.jsxs("svg",{...l,children:[a.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),a.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]});case"tests":return a.jsxs("svg",{...l,children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]});case"run":return a.jsx("svg",{...l,children:a.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})});case"activation":return a.jsxs("svg",{...l,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]});case"history":return a.jsxs("svg",{...l,children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"12 6 12 12 16 14"})]});case"leaderboard":return a.jsxs("svg",{...l,children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]});case"deps":return a.jsxs("svg",{...l,children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});case"versions":return a.jsxs("svg",{...l,children:[a.jsx("path",{d:"M12 8v4l3 3"}),a.jsx("path",{d:"M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"})]})}}function Dw({activePanel:n,onPanelChange:l,isDirty:s,isRunning:o,hasRegressions:c,isActivationRunning:f,hasUpdate:d}){return a.jsx("div",{className:"flex items-center gap-0.5 px-3 overflow-x-auto",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)",flexShrink:0},children:Lw.map((h,x)=>a.jsxs("div",{className:"flex items-center",children:[x>0&&a.jsx("div",{style:{width:1,height:20,background:"var(--border-subtle)",margin:"0 6px",flexShrink:0}}),h.tabs.map(p=>{const y=n===p.id,v=p.id==="editor"&&s||p.id==="run"&&o||p.id==="activation"&&f||p.id==="history"&&c||p.id==="versions"&&d,b=p.id==="run"||p.id==="activation"?"var(--accent)":p.id==="history"?"var(--red)":"var(--yellow)";return a.jsxs("button",{onClick:()=>l(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:j=>{y||(j.currentTarget.style.color="var(--text-secondary)")},onMouseLeave:j=>{y||(j.currentTarget.style.color="var(--text-tertiary)")},children:[a.jsx(zw,{id:p.id}),p.label,v&&a.jsx("span",{className:"absolute top-1.5 right-1 rounded-full",style:{width:5,height:5,background:b}})]},p.id)})]},h.label))})}const Cg={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 Ws({error:n,onRetry:l,onDismiss:s}){const[o,c]=g.useState(null),f=g.useRef(null);g.useEffect(()=>(n.category==="rate_limit"&&n.retryAfterMs?c(Math.ceil(n.retryAfterMs/1e3)):c(null),()=>{f.current&&clearInterval(f.current)}),[n]),g.useEffect(()=>{if(!(o==null||o<=0))return f.current=setInterval(()=>{c(x=>x==null||x<=1?(f.current&&clearInterval(f.current),0):x-1)},1e3),()=>{f.current&&clearInterval(f.current)}},[o!=null&&o>0]);const d=Cg[n.category]||Cg.unknown,h=o!=null&&o>0;return a.jsxs("div",{className:"rounded-lg overflow-hidden animate-fade-in",style:{border:`1px solid color-mix(in srgb, ${d.color} 30%, transparent)`,background:`color-mix(in srgb, ${d.color} 6%, var(--surface-1))`},children:[a.jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{style:{fontSize:14},children:d.icon}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:d.color},children:n.title})]}),s&&a.jsx("button",{onClick:s,className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-3.5 pb-3",children:[a.jsx("p",{className:"text-[11.5px] mb-1.5",style:{color:"var(--text-secondary)"},children:n.description}),a.jsx("p",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:n.hint}),(l||o!=null)&&a.jsx("div",{className:"flex items-center gap-2 mt-2.5",children:l&&a.jsx("button",{onClick:l,disabled:h,className:"btn btn-secondary text-[11px]",style:{padding:"4px 10px",opacity:h?.5:1},children:h?`Retry in ${o}s`:"Retry"})})]})]})}class _w extends g.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(l,s){console.error("ErrorBoundary caught:",l,s.componentStack)}render(){return this.state.hasError?a.jsxs("div",{style:{padding:24,textAlign:"center"},children:[a.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)"},children:"Something went wrong"}),a.jsx("p",{style:{fontSize:12,color:"var(--text-tertiary)",marginTop:8},children:"An unexpected error occurred in this panel."}),a.jsx("button",{onClick:()=>window.location.reload(),className:"btn btn-secondary",style:{marginTop:16,fontSize:12},children:"Reload"})]}):this.props.children}}function Ow(n){const l=n.toLowerCase();return/rate.?limit|429|quota.?exceeded/.test(l)?{category:"rate_limit",title:"Rate Limit",description:n,hint:"Wait a moment and try again.",retryable:!0}:/401|unauthorized|invalid.?api.?key|authentication/.test(l)?{category:"auth",title:"Authentication Failed",description:n,hint:"Check your API key or credentials.",retryable:!1}:/timeout|timed?.?out|etimedout/.test(l)?{category:"timeout",title:"Request Timed Out",description:n,hint:"The request took too long. Try again.",retryable:!0}:/model\b.*not found/.test(l)?{category:"model_not_found",title:"Model Not Found",description:n,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(l)?{category:"context_window",title:"Content Too Large",description:n,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(l)?{category:"provider_unavailable",title:"Provider Unavailable",description:n,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(l)?{category:"parse_error",title:"Response Parse Error",description:n,hint:"Try again. If this persists, try a different model.",retryable:!0}:{category:"unknown",title:"Error",description:n,hint:"",retryable:!1}}function Bw(n){const l=n.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);if(!l)return{metadata:{},body:n};const s=l[1],o=l[2].trim(),c={},f=s.split(`
73
- `);let d="",h=!1;for(const x of f){const p=x.match(/^[ \t]+([\w-]+):\s*(.*)$/);if(p&&d&&h){const b=p[1],j=p[2].trim();let k=c[d];if((typeof k!="object"||Array.isArray(k))&&(k={},c[d]=k),!j)k[b]=[];else{const N=j.match(/^\[(.+)\]$/);N?k[b]=N[1].split(",").map(C=>C.trim().replace(/^["']|["']$/g,"")).filter(Boolean):k[b]=j.replace(/^["']|["']$/g,"")}continue}const y=x.match(/^\s+-\s+(.+)$/);if(y&&d){h=!1;const b=c[d];Array.isArray(b)?b.push(y[1].trim().replace(/^["']|["']$/g,"")):c[d]=[y[1].trim().replace(/^["']|["']$/g,"")];continue}const v=x.match(/^([\w-]+):\s*(.*)$/);if(v){d=v[1];const b=v[2].trim();if(h=!1,!b){c[d]={},h=!0;continue}const j=b.match(/^\[(.+)\]$/);if(j){c[d]=j[1].split(",").map(k=>k.trim().replace(/^["']|["']$/g,"")).filter(Boolean);continue}c[d]=b.replace(/^["']|["']$/g,"")}}return{metadata:c,body:o}}function $o(n){if(!n)return"";try{let l=n.replace(/^---\n[\s\S]*?\n---\n?/,""),s=Iw(l);return s=s.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>'),s=s.replace(/^### (.+)$/gm,'<div style="font-weight:600;font-size:14px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^## (.+)$/gm,'<div style="font-weight:700;font-size:15px;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/^# (.+)$/gm,'<div style="font-weight:700;font-size:1rem;margin:0.75rem 0 0.25rem;color:var(--text-primary)">$1</div>'),s=s.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" target="_blank" rel="noopener noreferrer" style="color:var(--accent);text-decoration:underline">$1</a>'),s=s.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),s=s.replace(/\*([^*]+)\*/g,"<em>$1</em>"),s=s.replace(/`([^`]+)`/g,'<code style="background:var(--surface-3);padding:0.1rem 0.3rem;border-radius:3px;font-size:0.85em">$1</code>'),s=s.replace(/^- (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">• $1</div>'),s=s.replace(/^(\d+)\. (.+)$/gm,'<div style="padding-left:1rem;margin:0.15rem 0">$1. $2</div>'),s=s.replace(/\n\n/g,'<div style="height:0.5rem"></div>'),s=s.replace(/\n/g,"<br/>"),s}catch{return`<pre style="white-space:pre-wrap;font-size:12px;line-height:1.5">${n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</pre>`}}function Iw(n){const l=n.split(`
74
- `),s=[];let o=0;for(;o<l.length;)if(l[o].trim().startsWith("|")&&o+1<l.length&&l[o+1].trim().startsWith("|")&&/\|[\s-:]+\|/.test(l[o+1])){const c=Eg(l[o]);o+=2;const f=[];for(;o<l.length&&l[o].trim().startsWith("|");)f.push(Eg(l[o])),o++;const d='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 c)x+=`<th ${d}>${p}</th>`;x+="</tr></thead><tbody>";for(const p of f){x+="<tr>";for(const y of p)x+=`<td ${h}>${y}</td>`;x+="</tr>"}x+="</tbody></table>",s.push(x)}else s.push(l[o]),o++;return s.join(`
75
- `)}function Eg(n){return n.split("|").map(l=>l.trim()).filter(l=>l.length>0)}function Po(n,l){const s=n.split(`
76
- `),o=l.split(`
77
- `);if(s.length>1e3||o.length>1e3)return[...s.map(y=>({type:"unchanged",content:y}))];const c=s.length,f=o.length,d=Array.from({length:c+1},()=>new Array(f+1).fill(0));for(let y=1;y<=c;y++)for(let v=1;v<=f;v++)s[y-1]===o[v-1]?d[y][v]=d[y-1][v-1]+1:d[y][v]=Math.max(d[y-1][v],d[y][v-1]);const h=[];let x=c,p=f;for(;x>0||p>0;)x>0&&p>0&&s[x-1]===o[p-1]?(h.push({type:"unchanged",content:s[x-1]}),x--,p--):p>0&&(x===0||d[x][p-1]>=d[x-1][p])?(h.push({type:"added",content:o[p-1]}),p--):(h.push({type:"removed",content:s[x-1]}),x--);return h.reverse()}function Hw(n,l){if(l&&new Set(["generating","comparing","judging","judging_assertion","preparing","parsing","generating_skill","generating_baseline","scoring","action_items"]).has(n))return a.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 a.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:o.has(n)?"var(--accent)":"var(--green)"}})}function qs({entries:n,isRunning:l}){const[s,o]=g.useState(!1),c=g.useRef(null);return g.useEffect(()=>{c.current&&!s&&(c.current.scrollTop=c.current.scrollHeight)},[n,s]),n.length===0&&!l?null:a.jsxs("div",{className:"mt-2 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("button",{onClick:()=>o(!s),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:f=>{f.currentTarget.style.color="var(--text-primary)"},onMouseLeave:f=>{f.currentTarget.style.color="var(--text-tertiary)"},children:[a.jsxs("span",{className:"flex items-center gap-2",children:[l&&a.jsx("div",{className:"spinner",style:{width:10,height:10}}),"Progress Log (",n.length,")"]}),a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{transform:s?"rotate(0)":"rotate(180deg)",transition:"transform 0.2s ease"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),!s&&a.jsx("div",{ref:c,className:"px-3 pb-3 space-y-1 max-h-48 overflow-y-auto",children:n.map((f,d)=>{const h=d===n.length-1&&l,x=d===0?"0s":`+${((f.timestamp-n[0].timestamp)/1e3).toFixed(1)}s`;return a.jsxs("div",{className:"flex items-center gap-2 text-[11px] animate-fade-in",style:{opacity:h?1:.7},children:[Hw(f.phase,h),a.jsx("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)",width:40},children:x}),a.jsx("span",{style:{color:h?"var(--text-primary)":"var(--text-secondary)"},children:f.message}),f.current!=null&&f.total!=null&&a.jsxs("span",{className:"font-mono flex-shrink-0",style:{color:"var(--text-tertiary)"},children:["[",f.current,"/",f.total,"]"]})]},d)})})]})}function Uw({plugin:n,skill:l,skillContent:s,onApplied:o}){const[c,f]=g.useState("closed"),{config:d}=Nr(),[h,x]=g.useState("claude-cli"),[p,y]=g.useState("opus"),[v,b]=g.useState([]),[j,k]=g.useState(""),[N,C]=g.useState(""),[w,A]=g.useState(null),[_,H]=g.useState(null),[L,$]=g.useState([]),[E,D]=g.useState(!1),R=g.useRef(null);g.useEffect(()=>{if(!d)return;d.providers.find(I=>I.id==="claude-cli"&&I.available)&&(x("claude-cli"),y("opus"))},[d]),g.useEffect(()=>()=>{var M;(M=R.current)==null||M.abort()},[]);function B(){return d==null?void 0:d.providers.find(M=>M.id===h&&M.available)}const P=g.useCallback(()=>{var M;(M=R.current)==null||M.abort(),f("open")},[]);async function W(){f("loading"),A(null),H(null),$([]);const M=new AbortController;R.current=M;try{const I=await fetch(`/api/skills/${encodeURIComponent(n)}/${encodeURIComponent(l)}/improve?sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:h,model:p}),signal:M.signal});if(!I.ok||!I.body){let Y=`HTTP ${I.status}`;try{const se=await I.json();se.error&&(Y=se.error)}catch{}throw new Error(Y)}const X=I.body.getReader(),G=new TextDecoder;let ce="",O="";for(;;){const{done:Y,value:se}=await X.read();if(Y)break;ce+=G.decode(se,{stream:!0});const ue=ce.split(`
78
- `);ce=ue.pop()||"";for(const ge of ue)if(ge.startsWith("event: "))O=ge.slice(7).trim();else if(ge.startsWith("data: ")){try{const xe=JSON.parse(ge.slice(6));O==="progress"?$(we=>[...we,{phase:xe.phase,message:xe.message,timestamp:Date.now()}]):O==="done"||O==="complete"?(k(xe.improved),C(xe.reasoning||""),b(Po(xe.original||s,xe.improved)),f("diff_shown")):O==="error"&&(A(xe.message||xe.description||"Unknown error"),xe.category&&H(xe),f("open"))}catch{}O=""}}}catch(I){I.name!=="AbortError"&&(A(I.message),f("open"))}finally{R.current=null}}async function te(){D(!0);try{await Ne.applyImprovement(n,l,j),o(j),f("closed")}catch(M){A(M.message)}finally{D(!1)}}function Q(){f("closed"),b([]),k(""),C(""),A(null)}if(c==="closed")return a.jsxs("button",{onClick:()=>f("open"),className:"btn btn-secondary mb-5",disabled:!s,children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]}),"Improve Skill"]});const z=B();return a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden animate-fade-in",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Skill Improvement"})]}),a.jsx("button",{onClick:Q,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:M=>{M.currentTarget.style.background="var(--surface-3)"},onMouseLeave:M=>{M.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-5 py-4",children:[(c==="open"||c==="loading")&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-3 mb-4",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:h,onChange:M=>{x(M.target.value);const I=d==null?void 0:d.providers.find(X=>X.id===M.target.value);I!=null&&I.models[0]&&y(I.models[0].id)},disabled:c==="loading",children:d==null?void 0:d.providers.filter(M=>M.available).map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[12px] py-1.5",value:p,onChange:M=>y(M.target.value),disabled:c==="loading",children:z==null?void 0:z.models.map(M=>a.jsx("option",{value:M.id,children:M.label},M.id))})]}),c==="loading"?a.jsx("button",{onClick:P,className:"btn btn-secondary flex-shrink-0",children:"Cancel"}):a.jsx("button",{onClick:W,className:"btn btn-primary flex-shrink-0",children:"Improve"})]}),c==="loading"&&L.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx(qs,{entries:L,isRunning:!0})})]}),w&&a.jsx("div",{className:"mb-4",children:_?a.jsx(Ws,{error:_,onRetry:W,onDismiss:()=>{A(null),H(null)}}):a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:w})}),c==="diff_shown"&&a.jsxs(a.Fragment,{children:[N&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-lg text-[12px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),N]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-4",style:{border:"1px solid var(--border-subtle)",maxHeight:"400px",overflowY:"auto"},children:v.map((M,I)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:M.type==="added"?"rgba(34,197,94,0.1)":M.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:M.type==="added"?"var(--green)":M.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:M.type==="added"?"3px solid var(--green)":M.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:M.type==="added"?"+":M.type==="removed"?"-":" "}),M.content]},I))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:te,disabled:E,className:"btn btn-primary",children:E?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{width:12,height:12}})," Applying..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Apply"]})}),a.jsx("button",{onClick:Q,className:"btn btn-secondary",children:"Discard"})]})]})]})]})}const Ng={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"}},$w={remove:"var(--red)",modify:"#fbbf24",add:"var(--green)"};function Pw({change:n,index:l,selected:s,onToggle:o,originalEval:c}){var v;const[f,d]=g.useState(!1),h=Ng[n.action]??Ng.add,x=$w[n.action]??"var(--border-subtle)",p=n.action==="remove"?(c==null?void 0:c.name)??`Eval #${n.evalId}`:((v=n.eval)==null?void 0:v.name)??"Unnamed",y=g.useCallback(()=>o(l),[o,l]);return a.jsxs("div",{className:"rounded-lg transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderLeft:`3px solid ${x}`,opacity:s?1:.5},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[a.jsx("input",{type:"checkbox",checked:s,onChange:y,className:"flex-shrink-0",style:{accentColor:"var(--accent)"}}),a.jsx("span",{className:"pill text-[9px] font-bold flex-shrink-0",style:{background:h.bg,color:h.color,padding:"1px 6px"},children:h.label}),a.jsx("span",{className:"text-[12px] font-medium truncate",style:{color:"var(--text-primary)"},children:p}),a.jsx("span",{className:"text-[11px] truncate flex-1",style:{color:"var(--text-tertiary)"},children:n.reason}),a.jsx("button",{onClick:()=>d(!f),className:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded 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:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s ease"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})})]}),f&&a.jsxs("div",{className:"px-4 pb-3 animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)"},children:[n.action==="add"&&n.eval&&a.jsx(Vw,{evalCase:n.eval}),n.action==="modify"&&n.eval&&c&&a.jsx(Fw,{original:c,proposed:n.eval}),n.action==="remove"&&c&&a.jsx(Gw,{evalCase:c})]})]})}function Vw({evalCase:n}){var l;return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[a.jsx(qd,{label:"Prompt",value:n.prompt}),a.jsx(qd,{label:"Expected",value:n.expected_output}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((l=n.assertions)==null?void 0:l.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-1",children:(n.assertions??[]).map(s=>a.jsxs("div",{className:"text-[11px] flex items-start gap-1.5",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--green)"},children:"+"})," ",s.text]},s.id))})]})]})}function Fw({original:n,proposed:l}){const s=[];n.name!==l.name&&s.push({label:"Name",old:n.name,new:l.name}),n.prompt!==l.prompt&&s.push({label:"Prompt",old:n.prompt,new:l.prompt}),n.expected_output!==l.expected_output&&s.push({label:"Expected",old:n.expected_output,new:l.expected_output});const o=n.assertions??[],c=l.assertions??[],f=new Set(o.map(p=>p.text)),d=new Set(c.map(p=>p.text)),h=c.filter(p=>!f.has(p.text)),x=o.filter(p=>!d.has(p.text));return a.jsxs("div",{className:"pt-2.5 space-y-2",children:[s.map(p=>a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:p.label}),a.jsxs("div",{className:"mt-1 text-[11px] font-mono rounded p-2",style:{background:"var(--surface-1)"},children:[a.jsxs("div",{style:{color:"var(--red)",textDecoration:"line-through"},children:["- ",Yd(p.old,120)]}),a.jsxs("div",{style:{color:"var(--green)"},children:["+ ",Yd(p.new,120)]})]})]},p.label)),(h.length>0||x.length>0)&&a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Assertions"}),a.jsxs("div",{className:"mt-1 space-y-0.5",children:[x.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--red)"},children:["- ",p.text]},p.id)),h.map(p=>a.jsxs("div",{className:"text-[11px]",style:{color:"var(--green)"},children:["+ ",p.text]},p.id))]})]}),s.length===0&&h.length===0&&x.length===0&&a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"No visible field changes"})]})}function Gw({evalCase:n}){var l;return a.jsxs("div",{className:"pt-2.5 space-y-2",style:{opacity:.7},children:[a.jsx(qd,{label:"Prompt",value:n.prompt}),a.jsxs("div",{children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Assertions (",((l=n.assertions)==null?void 0:l.length)??0,")"]}),a.jsx("div",{className:"mt-1 space-y-0.5",children:(n.assertions??[]).map(s=>a.jsx("div",{className:"text-[11px]",style:{color:"var(--red)",textDecoration:"line-through"},children:s.text},s.id))})]})]})}function qd({label:n,value:l}){return a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:n}),a.jsx("div",{className:"mt-0.5 text-[11px] p-2 rounded font-mono",style:{background:"var(--surface-1)",color:"var(--text-secondary)",whiteSpace:"pre-wrap"},children:Yd(l,300)})]})}function Yd(n,l){return n.length>l?n.slice(0,l)+"...":n}const Tg={remove:0,modify:1,add:2};function Ww({changes:n,selections:l,currentEvals:s,onToggle:o,onSelectAll:c,onDeselectAll:f}){if(n.length===0)return null;const d=n.map((x,p)=>({change:x,originalIndex:p}));d.sort((x,p)=>(Tg[x.change.action]??2)-(Tg[p.change.action]??2));const h=Array.from(l.values()).filter(Boolean).length;return a.jsxs("div",{className:"mt-3 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"Test Case Changes"}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["(",h,"/",n.length," selected)"]})]}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("button",{onClick:c,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"}),a.jsx("button",{onClick:f,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"})]})]}),a.jsx("div",{className:"space-y-1.5 overflow-auto",style:{maxHeight:240},children:d.map(({change:x,originalIndex:p})=>a.jsx(Pw,{change:x,index:p,selected:l.get(p)??!1,onToggle:o,originalEval:x.evalId!=null?s.find(y=>y.id===x.evalId):void 0},p))})]})}function qw(){var M;const{state:n,dispatch:l,submitAiEdit:s,applyAiEdit:o,discardAiEdit:c,cancelAiEdit:f,toggleEvalChange:d,selectAllEvalChanges:h,deselectAllEvalChanges:x,retryEvalsSave:p}=Cn(),{aiEditLoading:y,aiEditResult:v,aiEditError:b,aiEditClassifiedError:j,aiEditProgress:k,aiEditEvalChanges:N,aiEditEvalSelections:C,aiEditEvalsRetry:w}=n,[A,_]=g.useState(""),{config:H}=Nr(),[L,$]=g.useState("claude-cli"),[E,D]=g.useState("opus"),R=g.useRef(null);g.useEffect(()=>{var I;(I=R.current)==null||I.focus()},[]),g.useEffect(()=>{if(!H)return;H.providers.find(X=>X.id==="claude-cli"&&X.available)&&($("claude-cli"),D("opus"))},[H]);const B=H==null?void 0:H.providers.find(I=>I.id===L&&I.available),P=g.useCallback(()=>{const I=A.trim();!I||y||s(I,L,E)},[A,y,s,L,E]),W=g.useCallback(I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),P()),I.key==="Escape"&&(I.preventDefault(),y?f():c())},[P,y,f,c]),te=g.useCallback(()=>{l({type:"CLOSE_AI_EDIT"}),l({type:"OPEN_AI_EDIT"})},[l]),Q=v?Po(n.skillContent,v.improved):[],z=((M=n.evals)==null?void 0:M.evals)??[];return a.jsxs("div",{className:"animate-fade-in",style:{background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#a855f7",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"AI Edit"}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Describe what to change — Enter to submit, Esc to dismiss"})]}),a.jsx("button",{onClick:c,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:I=>{I.currentTarget.style.background="var(--surface-3)"},onMouseLeave:I=>{I.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),a.jsxs("div",{className:"px-4 py-3",children:[!v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-end gap-2.5",children:[a.jsx("div",{className:"flex-1",children:a.jsx("textarea",{ref:R,value:A,onChange:I=>_(I.target.value),onKeyDown:W,placeholder:"e.g., Add an error handling section...",disabled:y,rows:1,className:"w-full resize-none outline-none",style:{background:"var(--surface-0)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)",borderRadius:6,padding:"8px 12px",fontSize:12.5,lineHeight:1.5,fontFamily:"var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",minHeight:36,maxHeight:96},onInput:I=>{const X=I.currentTarget;X.style.height="auto",X.style.height=Math.min(X.scrollHeight,96)+"px"}})}),a.jsxs("div",{style:{minWidth:100},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Provider"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:L,onChange:I=>{$(I.target.value);const X=H==null?void 0:H.providers.find(G=>G.id===I.target.value);X!=null&&X.models[0]&&D(X.models[0].id)},disabled:y,style:{width:"100%"},children:H==null?void 0:H.providers.filter(I=>I.available).map(I=>a.jsx("option",{value:I.id,children:I.label},I.id))})]}),a.jsxs("div",{style:{minWidth:80},children:[a.jsx("label",{className:"text-[10px] font-medium mb-0.5 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsx("select",{className:"input-field text-[11px] py-1",value:E,onChange:I=>D(I.target.value),disabled:y,style:{width:"100%"},children:B==null?void 0:B.models.map(I=>a.jsx("option",{value:I.id,children:I.label},I.id))})]}),y?a.jsx("button",{onClick:f,className:"btn btn-secondary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Cancel"}):a.jsx("button",{onClick:P,disabled:!A.trim(),className:"btn btn-primary flex-shrink-0 text-[11px]",style:{padding:"6px 14px"},children:"Submit"})]}),y&&k.length>0&&a.jsx("div",{className:"mt-2.5",children:a.jsx(qs,{entries:k,isRunning:!0})})]}),b&&a.jsx("div",{className:"mt-3",children:j?a.jsx(Ws,{error:j,onRetry:te,onDismiss:c}):a.jsx("div",{className:"px-3 py-2.5 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b})}),v&&a.jsxs("div",{className:"animate-fade-in",children:[v.reasoning&&a.jsxs("div",{className:"mb-3 px-3 py-2.5 rounded-lg text-[11.5px]",style:{background:"rgba(168,85,247,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(168,85,247,0.2)"},children:[a.jsx("span",{className:"font-semibold",style:{color:"#a855f7"},children:"AI Reasoning: "}),v.reasoning]}),a.jsx("div",{className:"mb-1",children:a.jsx("span",{className:"text-[11px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"})}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:300,overflowY:"auto"},children:Q.map((I,X)=>a.jsxs("div",{className:"px-3 py-0.5 text-[10.5px] font-mono",style:{background:I.type==="added"?"rgba(34,197,94,0.1)":I.type==="removed"?"rgba(239,68,68,0.1)":"transparent",color:I.type==="added"?"var(--green)":I.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:I.type==="added"?"3px solid var(--green)":I.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:I.type==="added"?"+":I.type==="removed"?"-":" "}),I.content]},X))}),a.jsx(Ww,{changes:N,selections:C,currentEvals:z,onToggle:d,onSelectAll:h,onDeselectAll:x}),w&&a.jsxs("div",{className:"mt-3 px-3 py-2.5 rounded-lg text-[12px] flex items-center justify-between",style:{background:"rgba(251,191,36,0.12)",border:"1px solid rgba(251,191,36,0.3)",color:"#fbbf24"},children:[a.jsx("span",{children:"Test case save failed. SKILL.md was saved successfully."}),a.jsx("button",{onClick:p,className:"btn text-[11px]",style:{background:"rgba(251,191,36,0.2)",color:"#fbbf24",padding:"3px 10px"},children:"Retry Save"})]}),a.jsxs("div",{className:"flex gap-2 mt-3",children:[a.jsxs("button",{onClick:o,className:"btn btn-primary text-[11px]",style:{padding:"5px 12px"},children:[a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:c,className:"btn btn-secondary text-[11px]",style:{padding:"5px 12px"},children:"Discard"}),a.jsx("button",{onClick:te,className:"btn btn-ghost text-[11px]",style:{padding:"5px 12px"},children:"Try Again"})]})]})]})]})}function Yw(n,l){const[s,o]=g.useState([]),[c,f]=g.useState("SKILL.md"),[d,h]=g.useState(null),[x,p]=g.useState(!1),[y,v]=g.useState(null),b=g.useCallback(async()=>{try{const N=await Ne.getSkillFiles(n,l);o(N.files)}catch{o([])}},[n,l]);g.useEffect(()=>{f("SKILL.md"),h(null),v(null),b()},[n,l,b]);const j=g.useCallback(async N=>{if(f(N),N==="SKILL.md"){h(null),v(null);return}p(!0),v(null);try{const C=await Ne.getSkillFile(n,l,N);h(C)}catch(C){v(`Unable to open file: ${C.message}`),h(null)}finally{p(!1)}},[n,l]),k=g.useCallback(()=>{b()},[b]);return{files:s,activeFile:c,secondaryContent:d,loading:x,error:y,selectFile:j,refresh:k,isSkillMd:c==="SKILL.md"}}function Kw(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function Xw(n){const l=[],s=new Map;for(const o of n){const c=o.path.split("/"),d={name:c[c.length-1],path:o.path,type:o.type,size:o.size,children:[]};s.set(o.path,d)}for(const o of n){const c=o.path.split("/");if(c.length===1){const f=s.get(o.path);f&&l.push(f)}else{const f=c.slice(0,-1).join("/"),d=s.get(f),h=s.get(o.path);d&&h&&d.children.push(h)}}return l}function sy({expanded:n}){return a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:n?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s"},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function iy(){return a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function Qw(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function Zw(){return a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"23 4 23 10 17 10"}),a.jsx("polyline",{points:"1 20 1 14 7 14"}),a.jsx("path",{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"})]})}function oy({node:n,depth:l,activeFile:s,onSelect:o}){const[c,f]=g.useState(!0),d=n.path===s;return n.type==="dir"?a.jsxs("div",{children:[a.jsxs("button",{onClick:()=>f(!c),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+l*14}px`,paddingTop:2,paddingBottom:2,background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left"},children:[a.jsx(sy,{expanded:c}),a.jsx(iy,{}),a.jsxs("span",{children:[n.name,"/"]})]}),c&&n.children.map(h=>a.jsx(oy,{node:h,depth:l+1,activeFile:s,onSelect:o},h.path))]}):a.jsxs("button",{onClick:()=>o(n.path),style:{display:"flex",alignItems:"center",gap:4,width:"100%",paddingLeft:`${4+l*14}px`,paddingTop:2,paddingBottom:2,background:d?"var(--accent-muted)":"none",border:"none",cursor:"pointer",color:d?"var(--accent)":"var(--text-tertiary)",fontSize:11,fontFamily:"var(--font-mono, monospace)",textAlign:"left",borderRadius:3},children:[a.jsx("span",{style:{width:10}}),a.jsx(Qw,{}),a.jsx("span",{style:{flex:1},children:n.name}),a.jsx("span",{style:{fontSize:9,color:"var(--text-tertiary)",marginRight:4,whiteSpace:"nowrap"},children:Kw(n.size)})]})}function Jw({files:n,activeFile:l,onSelect:s,onRefresh:o}){const[c,f]=g.useState(!1),d=g.useMemo(()=>Xw(n),[n]);return a.jsxs("div",{style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 8px",cursor:"pointer",userSelect:"none"},onClick:()=>f(!c),children:[a.jsx(sy,{expanded:c}),a.jsx(iy,{}),a.jsx("span",{style:{fontSize:11,fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l}),a.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:a.jsx(Zw,{})})]}),c&&a.jsx("div",{style:{maxHeight:240,overflowY:"auto",padding:"2px 4px 4px"},children:d.length===0?a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 8px"},children:"No files found"}):d.map(h=>a.jsx(oy,{node:h,depth:0,activeFile:l,onSelect:s},h.path))})]})}function co(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function eC(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function tC(n){const l=n.toLowerCase();return l.endsWith(".json")?"json":l.endsWith(".md")?"md":"other"}function Rg({content:n}){return a.jsx("textarea",{readOnly:!0,value:n,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 Ag({content:n,fileType:l}){if(l==="json"){const s=eC(n);return a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s})}return l==="md"?a.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px 20px",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:13,lineHeight:1.6},dangerouslySetInnerHTML:{__html:$o(n)}}):a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",color:"var(--text-primary)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:n})}function Mg(n){try{return JSON.stringify(JSON.parse(n),null,2).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"([^"\\]|\\.)*"\s*:/g,s=>`<span style="color:#6383ff">${s}</span>`).replace(/:\s*"([^"\\]|\\.)*"/g,s=>`<span style="color:#22c55e">${s.slice(0,2)}<span style="color:#22c55e">${s.slice(2)}</span></span>`).replace(/:\s*(-?\d+\.?\d*)/g,(s,o)=>`: <span style="color:#fb923c">${o}</span>`).replace(/:\s*(true|false|null)/g,(s,o)=>`: <span style="color:#a855f7">${o}</span>`)}catch{return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}function nC({file:n,loading:l,error:s,viewMode:o,plugin:c,skill:f,onSaved:d,onDirtyChange:h}){const[x,p]=g.useState(o),[y,v]=g.useState(!1),[b,j]=g.useState(""),[k,N]=g.useState(!1),[C,w]=g.useState(null),A=o!==x?o:x;g.useEffect(()=>{h==null||h(y)},[y,h]);const _=g.useCallback(()=>{(n==null?void 0:n.content)!=null&&(j(n.content),v(!0))},[n]),H=g.useCallback(()=>{v(!1)},[]),L=g.useCallback(async()=>{if(!(!c||!f||!n)){N(!0);try{await Ne.saveSkillFile(c,f,n.path,b),w("Saved"),v(!1),d==null||d(),setTimeout(()=>w(null),2e3)}catch(D){w(`Save failed: ${D.message}`),setTimeout(()=>w(null),3e3)}finally{N(!1)}}},[c,f,n,b,d]);if(g.useEffect(()=>{if(!y)return;const D=R=>{(R.ctrlKey||R.metaKey)&&R.key==="s"&&(R.preventDefault(),L())};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[y,L]),l)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:"Loading…"});if(s)return a.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:a.jsxs("div",{style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"16px 20px",maxWidth:400,textAlign:"center"},children:[a.jsx("div",{style:{fontSize:13,color:"var(--text-primary)",fontWeight:600,marginBottom:6},children:"Unable to open file"}),a.jsx("div",{style:{fontSize:12,color:"var(--text-tertiary)"},children:s})]})});if(!n)return null;if(n.binary)return a.jsxs("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-tertiary)",fontSize:13},children:["Binary file (",co(n.size),") — cannot be displayed"]});const $=n.content??"",E=tC(n.path);return a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[n.truncated&&a.jsxs("div",{style:{padding:"4px 12px",background:"var(--warning-muted, #fef3c7)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:"var(--warning-text, #92400e)"},children:["File truncated at ",co(512*1024)," — ",co(n.size)," total"]}),a.jsxs("div",{style:{display:"flex",gap:4,padding:"4px 8px",borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-0)"},children:[(E==="md"||E==="json")&&["raw","split","preview"].map(D=>a.jsx("button",{onClick:()=>p(D),style:{padding:"2px 8px",fontSize:11,background:A===D?"var(--accent-muted)":"none",color:A===D?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer",textTransform:"capitalize"},children:D},D)),a.jsxs("span",{style:{marginLeft:"auto",fontSize:11,color:"var(--text-tertiary)",display:"flex",alignItems:"center",gap:6},children:[co(n.size),c&&f&&!n.binary&&!y&&a.jsx("button",{onClick:_,style:{padding:"1px 6px",fontSize:10,background:"var(--accent-muted)",color:"var(--accent)",border:"none",borderRadius:3,cursor:"pointer"},children:"Edit"}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:L,disabled:k,style:{padding:"1px 6px",fontSize:10,background:"var(--accent)",color:"#fff",border:"none",borderRadius:3,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),a.jsx("button",{onClick:H,style:{padding:"1px 6px",fontSize:10,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:3,cursor:"pointer"},children:"Cancel"})]})]})]}),C&&a.jsx("div",{style:{padding:"4px 12px",background:C.startsWith("Save failed")?"var(--red-muted)":"var(--green-muted)",borderBottom:"1px solid var(--border-subtle)",fontSize:11,color:C.startsWith("Save failed")?"var(--red)":"var(--green)"},children:C}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:y?a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:[a.jsx("textarea",{value:b,onChange:D=>j(D.target.value),style:{flex:1,width:"100%",resize:"none",background:"var(--surface-0)",color:"var(--text-primary)",border:"none",outline:"none",padding:"12px 16px",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6}}),a.jsxs("div",{style:{position:"sticky",bottom:0,display:"flex",alignItems:"center",gap:8,padding:"6px 12px",background:"var(--surface-1)",borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("span",{style:{flex:1,fontSize:11,color:"var(--text-tertiary)"},children:"Unsaved changes"}),a.jsx("button",{onClick:L,disabled:k,style:{padding:"3px 12px",fontSize:11,background:"var(--accent)",color:"#fff",border:"none",borderRadius:4,cursor:"pointer",opacity:k?.6:1},children:k?"Saving...":"Save"}),a.jsx("button",{onClick:H,style:{padding:"3px 12px",fontSize:11,background:"var(--surface-3)",color:"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer"},children:"Cancel"})]})]}):A==="split"&&E!=="other"?a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-subtle)"},children:a.jsx(Rg,{content:$})}),a.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"auto"},children:E==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Mg($)}}):a.jsx(Ag,{content:$,fileType:E})})]}):A==="preview"&&E!=="other"?E==="json"?a.jsx("pre",{style:{flex:1,margin:0,padding:"12px 16px",overflow:"auto",background:"var(--surface-0)",fontSize:12,fontFamily:"var(--font-mono, monospace)",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:Mg($)}}):a.jsx(Ag,{content:$,fileType:E}):a.jsx(Rg,{content:$})})]})}function aC({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]})}function rC({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3"}),a.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"21"})]})}function lC({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function sC({size:n=15}){return a.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M15 4V2"}),a.jsx("path",{d:"M15 16v-2"}),a.jsx("path",{d:"M8 9h2"}),a.jsx("path",{d:"M20 9h2"}),a.jsx("path",{d:"M17.8 11.8L19 13"}),a.jsx("path",{d:"M15 9h.01"}),a.jsx("path",{d:"M17.8 6.2L19 5"}),a.jsx("path",{d:"M11 6.2L9.7 5"}),a.jsx("path",{d:"M3 21l9-9"})]})}function Sd({size:n=15}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5L12 3z"})})}function iC(){const{state:n,dispatch:l,saveContent:s,isReadOnly:o}=Cn(),{plugin:c,skill:f,skillContent:d,isDirty:h,improveTarget:x,aiEditOpen:p}=n,[y,v]=g.useState("split"),[b,j]=g.useState(!1),k=g.useRef(null),[N,C]=g.useState(!1),[w,A]=g.useState(""),[_,H]=g.useState(!1),[L,$]=g.useState(null),[E,D]=g.useState([]),[R,B]=g.useState([]),[P,W]=g.useState(null),te=g.useRef(null),{config:Q}=Nr(),{files:z,activeFile:M,secondaryContent:I,loading:X,error:G,selectFile:ce,refresh:O,isSkillMd:Y}=Yw(c??"",f??""),[se,ue]=g.useState(!1),ge=g.useCallback(ve=>{se&&!window.confirm("You have unsaved changes. Discard?")||ce(ve)},[se,ce]);g.useEffect(()=>()=>{var ve;(ve=te.current)==null||ve.abort()},[]);const{metadata:xe,body:we}=Bw(d),ie=xe["allowed-tools"],je=Array.isArray(ie)?ie:typeof ie=="string"?[ie]:[],_e=xe.name,Ue=xe.description,ae=xe.metadata,fe=typeof ae=="object"&&!Array.isArray(ae)?ae:null,de=xe.version||(fe==null?void 0:fe.version),he=xe.tags||(fe==null?void 0:fe.tags),ye=Array.isArray(he)?he:typeof he=="string"?he.split(",").map(ve=>ve.trim()).filter(Boolean):[],Oe=new Set(["name","description","metadata","allowed-tools","version","tags"]),Ae=Object.entries(xe).filter(([ve])=>!Oe.has(ve)),pe=g.useCallback(async()=>{j(!0),await s(),j(!1)},[s]),ze=g.useCallback(ve=>{(ve.ctrlKey||ve.metaKey)&&ve.key==="s"&&(ve.preventDefault(),ve.stopPropagation(),h&&pe()),(ve.ctrlKey||ve.metaKey)&&ve.key==="k"&&(ve.preventDefault(),ve.stopPropagation(),l({type:p?"CLOSE_AI_EDIT":"OPEN_AI_EDIT"}))},[h,pe,p,l]),Be=g.useCallback(async()=>{var At,De;if(!w.trim())return;(At=te.current)==null||At.abort();const ve=new AbortController;te.current=ve,H(!0),W(null),B([]),$(null),D([]);try{const gt=(Q==null?void 0:Q.provider)||"claude-cli",Xt=(Q==null?void 0:Q.model)||"sonnet",lt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:w,provider:gt,model:Xt}),signal:ve.signal});if(!lt.ok||!lt.body){let St=`HTTP ${lt.status}`;try{const Un=await lt.json();Un.error&&(St=Un.error)}catch{}throw new Error(St)}const rr=lt.body.getReader(),na=new TextDecoder;let Et="",kt="";for(;;){const{done:St,value:Un}=await rr.read();if(St)break;Et+=na.decode(Un,{stream:!0});const lr=Et.split(`
79
- `);Et=lr.pop()||"";for(const $n of lr)if($n.startsWith("event: "))kt=$n.slice(7).trim();else if($n.startsWith("data: ")){try{const Fe=JSON.parse($n.slice(6));if(kt==="progress")B($t=>[...$t,{phase:Fe.phase,message:Fe.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const $t=["---"];Fe.name&&$t.push(`name: ${Fe.name}`),Fe.description&&$t.push(`description: "${Fe.description.replace(/"/g,'\\"')}"`),Fe.model&&$t.push(`model: ${Fe.model}`),(De=Fe.allowedTools)!=null&&De.trim()&&$t.push(`allowed-tools: ${Fe.allowedTools.trim()}`),$t.push("---","",Fe.body||"");const aa=$t.join(`
80
- `);$(aa),D(Po(d,aa)),H(!1)}else kt==="error"&&(W(Fe.message||Fe.description||"Generation failed"),H(!1))}catch{}kt=""}}}catch(gt){gt.name!=="AbortError"&&W(gt.message)}finally{H(!1),te.current=null}},[w,Q,d]),Ot=g.useCallback(()=>{L&&l({type:"SET_CONTENT",content:L}),C(!1),$(null),D([]),A(""),B([])},[L,l]),Ft=g.useCallback(()=>{C(!1),$(null),D([]),A(""),B([]),W(null)},[]),rt=g.useCallback(()=>{var ve;N?((ve=te.current)==null||ve.abort(),Ft()):(p&&l({type:"CLOSE_AI_EDIT"}),C(!0))},[N,p,l,Ft]),jt=[{mode:"raw",icon:a.jsx(aC,{}),label:"Editor"},{mode:"split",icon:a.jsx(rC,{}),label:"Split"},{mode:"preview",icon:a.jsx(lC,{}),label:"Preview"}];return a.jsxs("div",{className:"flex flex-col h-full",onKeyDown:ze,tabIndex:-1,children:[a.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:jt.map(({mode:ve,icon:At,label:De})=>a.jsxs("button",{onClick:()=>v(ve),title:De,className:"flex items-center gap-1.5 rounded-md transition-all duration-150",style:{padding:"5px 10px",background:y===ve?"var(--surface-4)":"transparent",color:y===ve?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:y===ve?600:400,border:"none",cursor:"pointer"},children:[At,a.jsx("span",{style:{letterSpacing:"0.01em"},children:De})]},ve))}),Y?o?a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs("span",{className:"flex items-center gap-1.5 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Read-only"]})}):a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{onClick:()=>{p?l({type:"CLOSE_AI_EDIT"}):(N&&Ft(),l({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:[a.jsx(sC,{size:13}),a.jsx("span",{children:"AI Edit"})]}),a.jsxs("button",{onClick:rt,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:N?600:400,border:"none",cursor:"pointer",color:N?"var(--purple)":"var(--text-tertiary)",background:N?"var(--purple-muted)":"transparent"},children:[a.jsx(Sd,{size:13}),a.jsx("span",{children:"Regenerate"})]}),a.jsx("div",{style:{width:1,height:16,background:"var(--border-subtle)"}}),h&&a.jsx("button",{onClick:()=>l({type:"SET_CONTENT",content:n.savedContent}),className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Discard"}),a.jsx("button",{onClick:pe,disabled:!h||b,className:"btn btn-primary text-[11px]",style:{padding:"5px 14px"},children:b?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:11,height:11,borderWidth:1.5}})," Saving..."]}):"Save"})]}):null]}),c&&f&&a.jsx(Jw,{files:z,activeFile:M,onSelect:ge,onRefresh:O}),!Y&&a.jsx(nC,{file:I,loading:X,error:G,viewMode:y,plugin:c??void 0,skill:f??void 0,onSaved:()=>{ce(M),O()},onDirtyChange:ue}),Y&&a.jsxs("div",{className:"flex-1 overflow-hidden",style:{display:"grid",gridTemplateColumns:y==="raw"||y==="preview"?"1fr":"1fr 1fr"},children:[y!=="preview"&&a.jsx("div",{className:"flex flex-col overflow-hidden",style:{borderRight:y==="split"?"1px solid var(--border-subtle)":"none"},children:a.jsx("textarea",{ref:k,value:d,onChange:ve=>{o||l({type:"SET_CONTENT",content:ve.target.value})},onKeyDown:ze,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"&&a.jsx("div",{className:"overflow-auto",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{padding:"20px 24px",maxWidth:720},children:[(_e||de||Ue)&&a.jsxs("div",{style:{marginBottom:20},children:[a.jsxs("div",{className:"flex items-baseline gap-3",style:{marginBottom:8},children:[_e&&a.jsx("h2",{style:{fontSize:18,fontWeight:700,color:"var(--text-primary)",letterSpacing:"-0.02em",lineHeight:1.2,margin:0},children:_e}),de&&a.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4,letterSpacing:"0.03em",fontFamily:"var(--font-mono, ui-monospace, monospace)"},children:["v",de]})]}),Ue&&a.jsx("p",{style:{fontSize:12.5,lineHeight:1.65,color:"var(--text-secondary)",margin:0,paddingLeft:12,borderLeft:"2px solid var(--accent)",maxWidth:600},children:Ue})]}),ye.length>0&&a.jsx("div",{className:"flex flex-wrap items-center gap-1.5",style:{marginBottom:16},children:ye.map(ve=>a.jsx("span",{style:{fontSize:10,fontWeight:500,color:"var(--text-tertiary)",background:"var(--surface-2)",padding:"3px 8px",borderRadius:4,letterSpacing:"0.02em"},children:ve},ve))}),je.length>0&&a.jsx("div",{style:{marginBottom:16},children:a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",marginRight:4},children:"Tools"}),je.map(ve=>a.jsx("span",{style:{fontSize:10.5,fontFamily:"var(--font-mono, ui-monospace, monospace)",color:"var(--accent)",background:"var(--accent-muted)",padding:"2px 7px",borderRadius:4},children:ve},ve))]})}),Ae.length>0&&a.jsx("div",{style:{marginBottom:16,padding:"8px 0",borderTop:"1px solid var(--border-subtle)",borderBottom:"1px solid var(--border-subtle)"},children:Ae.map(([ve,At],De)=>{const gt=Array.isArray(At)?At.join(", "):typeof At=="object"?Object.entries(At).map(([Xt,lt])=>`${Xt}: ${Array.isArray(lt)?lt.join(", "):lt}`).join(" | "):At;return a.jsxs("div",{className:"flex items-baseline gap-3",style:{padding:"4px 0",borderTop:De>0?"1px solid var(--border-subtle)":"none"},children:[a.jsx("span",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.06em",color:"var(--text-tertiary)",minWidth:80,flexShrink:0},children:ve}),a.jsx("span",{style:{fontSize:12,color:"var(--text-secondary)"},children:gt})]},ve)})}),(_e||Ue||ye.length>0||je.length>0||Ae.length>0)&&we&&a.jsx("div",{style:{height:1,background:"linear-gradient(90deg, var(--accent) 0%, var(--border-subtle) 40%, transparent 100%)",marginBottom:20,opacity:.5}}),we&&a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto",style:{color:"var(--text-secondary)",wordBreak:"break-word"},dangerouslySetInnerHTML:{__html:$o(we)}})]})})]}),Y&&p&&a.jsx(qw,{}),Y&&N&&a.jsx("div",{className:"animate-fade-in",style:{borderTop:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:a.jsxs("div",{className:"px-4 py-3",children:[!L&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sd,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerate Skill"})]}),a.jsx("div",{className:"flex gap-2 mb-2",children:a.jsx("textarea",{value:w,onChange:ve=>A(ve.target.value),placeholder:"Describe what this skill should do...",rows:2,disabled:_,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:_?.5:1},onKeyDown:ve=>{ve.key==="Enter"&&(ve.ctrlKey||ve.metaKey)&&w.trim()&&!_&&(ve.preventDefault(),Be())}})}),a.jsxs("div",{className:"flex items-center gap-2",children:[_?a.jsx("button",{onClick:()=>{var ve;(ve=te.current)==null||ve.abort(),H(!1)},className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Cancel"}):a.jsx("button",{onClick:Be,disabled:!w.trim(),className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:"Generate"}),a.jsx("button",{onClick:Ft,className:"btn btn-ghost text-[11px]",style:{padding:"4px 8px"},children:"Close"})]}),_&&R.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx(qs,{entries:R,isRunning:!0})}),P&&a.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:[P,a.jsx("button",{onClick:Be,className:"ml-2 underline",style:{color:"var(--red)"},children:"Retry"})]})]}),L&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sd,{size:14}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:"Regenerated — Review Changes"})]}),a.jsx("div",{className:"rounded-lg overflow-hidden mb-3",style:{border:"1px solid var(--border-subtle)",maxHeight:"300px",overflowY:"auto"},children:E.map((ve,At)=>a.jsxs("div",{className:"px-3 py-0.5 text-[11px] font-mono",style:{background:ve.type==="added"?"var(--green-muted)":ve.type==="removed"?"var(--red-muted)":"transparent",color:ve.type==="added"?"var(--green)":ve.type==="removed"?"var(--red)":"var(--text-secondary)",borderLeft:ve.type==="added"?"3px solid var(--green)":ve.type==="removed"?"3px solid var(--red)":"3px solid transparent"},children:[a.jsx("span",{style:{userSelect:"none",opacity:.5,marginRight:8},children:ve.type==="added"?"+":ve.type==="removed"?"-":" "}),ve.content]},At))}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:Ot,className:"btn btn-primary text-[11px]",style:{padding:"4px 12px"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Apply"]}),a.jsx("button",{onClick:Ft,className:"btn btn-secondary text-[11px]",style:{padding:"4px 12px"},children:"Discard"})]})]})]})}),Y&&x!==null&&c&&f&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(Uw,{plugin:c,skill:f,skillContent:d,onApplied:ve=>{l({type:"SET_CONTENT",content:ve}),l({type:"CONTENT_SAVED"}),l({type:"CLOSE_IMPROVE"})}})})]})}function hl(n){return n.testType==="integration"?"integration":"unit"}function Sl(n){return n>=.8?"var(--green)":n>=.5?"var(--yellow)":"var(--red)"}function cy(n){const l=new Date(n);return l.toLocaleDateString(void 0,{month:"short",day:"numeric"})+", "+l.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function uy(n){return n==null?"--":n>=1e3?`${(n/1e3).toFixed(1)}s`:`${n}ms`}const oC=new Set(["benchmark","comparison","baseline"]);function Lg(n,l,s,o){return n.map(({rate:c,idx:f,total:d})=>{const h=o+f/(d-1)*(l-o*2),x=o+(s-o*2)-c*(s-o*2);return`${h},${x}`})}function dy({entries:n}){const l=n.filter(v=>oC.has(v.type)).slice().reverse(),s=l.map((v,b,j)=>({rate:v.pass_rate,idx:b,total:j.length})).filter((v,b)=>{const j=l[b].type;return j==="benchmark"||j==="comparison"}),o=l.flatMap((v,b)=>v.type==="baseline"?[{rate:v.pass_rate,idx:b,total:l.length}]:v.type==="comparison"&&v.baselinePassRate!=null?[{rate:v.baselinePassRate,idx:b,total:l.length}]:[]);if(s.length<2&&o.length<2)return null;const c=80,f=24,d=2,h=s.length>=2?Lg(s,c,f,d):[],x=o.length>=2?Lg(o,c,f,d):[],p=h[h.length-1],y=x[x.length-1];return a.jsxs("svg",{width:c,height:f,style:{display:"block",flexShrink:0},children:[x.length>0&&a.jsx("polyline",{points:x.join(" "),fill:"none",stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinejoin:"round",strokeDasharray:"3 2"}),h.length>0&&a.jsx("polyline",{points:h.join(" "),fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),y&&a.jsx("circle",{cx:parseFloat(y.split(",")[0]),cy:parseFloat(y.split(",")[1]),r:2.5,fill:"var(--text-tertiary)"}),p&&a.jsx("circle",{cx:parseFloat(p.split(",")[0]),cy:parseFloat(p.split(",")[1]),r:2.5,fill:"var(--accent)"})]})}function fy(n,l,s){const o=isNaN(l)?0:l,c=[],f=[],d=[];if((n==="PASS"||n==="EFFECTIVE")&&o>=.7){const p=c.length>0?` Met criteria: ${c.map(y=>y.criterion).join(", ")}.`:"";return{explanation:`${n} (score ${o.toFixed(2)}): evaluation met expectations.${p}`}}if(n==="FAIL"||n==="DEGRADING"){const p=f.length>0?` Failed criteria: ${f.map(v=>v.criterion).join(", ")}.`:"",y=[...f.map(v=>`Improve "${v.criterion}" (score: ${v.score.toFixed(2)})`),...d.map(v=>`Strengthen "${v.criterion}" (score: ${v.score.toFixed(2)})`)];return y.length===0&&y.push("Review prompt instructions and add more specific guidance"),{explanation:`${n} (score ${o.toFixed(2)}): evaluation did not meet expectations.${p}`,recommendations:y}}if(n==="INEFFECTIVE"){if(o<.2){const y=[...f.map(v=>`Rework "${v.criterion}" — currently at ${v.score.toFixed(2)}`),"Consider adding examples to your system prompt","Review the rubric criteria for achievability"];return{explanation:`${n} (score ${o.toFixed(2)}): evaluation is significantly below expectations.`,recommendations:y}}const p=[...f.map(y=>`Rework "${y.criterion}" — currently at ${y.score.toFixed(2)}`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push("Consider restructuring your prompt approach"),{explanation:`${n} (score ${o.toFixed(2)}): below expectations but showing some capability.`,recommendations:p}}if(n==="MARGINAL"){const p=[...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`),...f.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.length>0?"Assertion pass rate is below target despite strong rubric scores — review test case alignment":"Review prompt instructions for areas of improvement"),{explanation:`${n} (score ${o.toFixed(2)}): moderate improvement detected.`,recommendations:p}}if(n==="EMERGING"){const p=[...f.map(y=>`Improve "${y.criterion}" (score: ${y.score.toFixed(2)})`),...d.map(y=>`Strengthen "${y.criterion}" (score: ${y.score.toFixed(2)})`)];return p.length===0&&p.push(c.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:`${n} (score ${o.toFixed(2)}): early promise — focus on weak areas to improve.`,recommendations:p}}const h=c.length>0?` Passing: ${c.map(p=>p.criterion).join(", ")}.`:"",x=d.length>0?` Needs improvement: ${d.map(p=>p.criterion).join(", ")}.`:"";return{explanation:`${n} (score ${o.toFixed(2)}): mixed results.${h}${x}`}}const py={EFFECTIVE:"Strong Improvement",MARGINAL:"Moderate Improvement",EMERGING:"Early Promise",INEFFECTIVE:"Needs Work",DEGRADING:"Regression"};function cC(n){return Object.hasOwn(py,n)}function uC(n){return cC(n)?py[n]:n}function dC(){const{state:n}=Cn(),{plugin:l,skill:s}=n,[o,c]=g.useState([]),[f,d]=g.useState([]),[h,x]=g.useState(!0),[p,y]=g.useState(null),[v,b]=g.useState(new Set),[j,k]=g.useState({}),[N,C]=g.useState(null),[w,A]=g.useState(""),[_,H]=g.useState(!1),[L,$]=g.useState(""),[E,D]=g.useState(""),R=g.useCallback(async()=>{x(!0),y(null);try{const[z,M]=await Promise.all([Ne.getCredentials(l,s),Ne.getParams(l,s)]);c(z.credentials),d(M.params)}catch(z){y(z instanceof Error?z.message:"Failed to load parameters"),c([]),d([])}finally{x(!1)}},[l,s]);g.useEffect(()=>{R()},[R]);const B=g.useCallback(async(z,M)=>{H(!0),y(null);try{await Ne.setCredential(l,s,z,M),C(null),A(""),await R()}catch(I){y(I instanceof Error?I.message:`Failed to save ${z}`)}finally{H(!1)}},[l,s,R]),P=g.useCallback(async()=>{const z=L.trim().toUpperCase(),M=E.trim();if(!(!z||!M)){H(!0),y(null);try{await Ne.setCredential(l,s,z,M),$(""),D(""),await R()}catch(I){y(I instanceof Error?I.message:`Failed to add ${z}`)}finally{H(!1)}}},[l,s,L,E,R]),W=g.useCallback(async z=>{if(v.has(z)){b(M=>{const I=new Set(M);return I.delete(z),I}),k(M=>{const I={...M};return delete I[z],I});return}try{const I=(await Ne.getParamsRevealed(l,s,z)).params.find(X=>X.name===z);I!=null&&I.value&&(k(X=>({...X,[z]:I.value})),b(X=>new Set(X).add(z)))}catch{}},[l,s,v]),te=new Set(o.map(z=>z.name)),Q=[...o.map(z=>{const M=f.find(I=>I.name===z.name);return{name:z.name,status:z.status,maskedValue:(M==null?void 0:M.maskedValue)??""}}),...f.filter(z=>!te.has(z.name)).map(z=>({name:z.name,status:z.status,maskedValue:z.maskedValue}))];return a.jsxs("div",{className:"py-2 px-3",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters"}),p&&a.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&&Q.length===0&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"Loading..."}),!h&&Q.length===0&&!p&&a.jsx("div",{className:"text-[11px] py-2",style:{color:"var(--text-tertiary)"},children:"No parameters configured"}),Q.map(z=>a.jsxs("div",{className:"flex items-center gap-2 py-1.5",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("span",{className:"text-[10px] font-mono flex-1 truncate",style:{color:"var(--text-primary)"},children:z.name}),a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:z.status==="ready"?"var(--green-muted)":"var(--red-muted)",color:z.status==="ready"?"var(--green)":"var(--red)"},children:z.status}),(z.maskedValue||z.status==="ready")&&a.jsxs("span",{className:"text-[10px] font-mono",style:{color:"var(--text-secondary)"},children:[v.has(z.name)?j[z.name]??z.maskedValue:z.maskedValue||"***",a.jsx("button",{onClick:()=>W(z.name),className:"text-[9px] ml-1",style:{color:"var(--accent)",cursor:"pointer",background:"none",border:"none"},"aria-label":`${v.has(z.name)?"Hide":"Reveal"} value for ${z.name}`,children:v.has(z.name)?"hide":"show"})]}),N===z.name?a.jsxs("div",{className:"flex gap-1",children:[a.jsx("input",{value:w,onChange:M=>A(M.target.value),onKeyDown:M=>{M.key==="Enter"&&w.trim()&&B(z.name,w)},className:"input-field text-[10px] font-mono",style:{width:120},placeholder:"New value...","aria-label":`New value for ${z.name}`,autoFocus:!0}),a.jsx("button",{onClick:()=>B(z.name,w),disabled:_||!w.trim(),className:"text-[10px] font-medium",style:{color:"var(--green)",background:"none",border:"none",cursor:"pointer"},children:"Save"}),a.jsx("button",{onClick:()=>{C(null),A("")},className:"text-[10px]",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:"Cancel"})]}):a.jsx("button",{onClick:()=>{C(z.name),A("")},className:"text-[10px]",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"Edit"})]},z.name)),a.jsxs("div",{className:"mt-3 pt-2",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-medium mb-1.5",style:{color:"var(--text-secondary)"},children:"Add New Parameter"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:L,onChange:z=>$(z.target.value),className:"input-field text-[10px] font-mono flex-1",placeholder:"KEY_NAME","aria-label":"Parameter key name"}),a.jsx("input",{value:E,onChange:z=>D(z.target.value),onKeyDown:z=>{z.key==="Enter"&&L.trim()&&E.trim()&&P()},className:"input-field text-[10px] font-mono flex-1",placeholder:"value",type:"password","aria-label":"Parameter value"}),a.jsx("button",{onClick:P,disabled:_||!L.trim()||!E.trim(),className:"text-[10px] font-medium px-2 py-1 rounded",style:{background:"var(--accent-muted)",color:"var(--accent)",border:"none",cursor:_?"not-allowed":"pointer"},children:"Add"})]})]})]})}function fC(n,l,s){const[o,c]=g.useState(null),[f,d]=g.useState(!1),h=g.useRef("");g.useEffect(()=>{const p=`${n}/${l}/${s}`;h.current!==p&&(h.current=p,d(!0),Ne.getCaseHistory(n,l,s).then(y=>c(y)).catch(()=>c([])).finally(()=>d(!1)))},[n,l,s]);const x=g.useCallback(()=>{d(!0),h.current="",Ne.getCaseHistory(n,l,s).then(p=>c(p)).catch(()=>c([])).finally(()=>d(!1))},[n,l,s]);return{entries:o,loading:f,refetch:x}}function pC(n,l,s){const o={flaky:!1,nonDiscriminating:!1,regression:!1};if(!s||s.length===0)return o;const f=s.slice(0,10).map(x=>x.assertions.find(p=>p.id===n)).filter(Boolean);if(f.length>=2){const p=f.filter(y=>y.pass).length/f.length;p>=.3&&p<=.7&&(o.flaky=!0)}const d=s.find(x=>x.type==="benchmark"),h=s.find(x=>x.type==="baseline");if(d&&h){const x=d.assertions.find(y=>y.id===n),p=h.assertions.find(y=>y.id===n);x!=null&&x.pass&&(p!=null&&p.pass)&&(o.nonDiscriminating=!0)}if(l&&!l.pass&&s.length>=1){const p=s[0].assertions.find(y=>y.id===n);p!=null&&p.pass&&(o.regression=!0)}return o}function mC(){var X;const{state:n,dispatch:l,saveEvals:s,runCase:o,runAll:c,cancelCase:f,cancelAll:d,generateEvals:h,isReadOnly:x}=Cn(),{evals:p,evalsError:y,selectedCaseId:v,inlineResults:b,caseRunStates:j,generateEvalsLoading:k,generateEvalsProgress:N,generateEvalsError:C}=n,w=g.useMemo(()=>{for(const G of j.values())if(G.status==="running"||G.status==="queued")return!0;return!1},[j]),[A,_]=g.useState(!1),[H,L]=g.useState("all"),$={skill_name:n.skill,evals:[]},E=p??$,D=E.evals,R=g.useMemo(()=>H==="all"?D:D.filter(G=>hl(G)===H),[H,D]),B=R.find(G=>G.id===v)??null;g.useEffect(()=>{v!==null&&!R.find(G=>G.id===v)&&l({type:"SELECT_CASE",caseId:R.length>0?R[0].id:null})},[R,v,l]);const[P,W]=g.useState([]),te=g.useMemo(()=>D.some(G=>hl(G)==="integration"),[D]);g.useEffect(()=>{te&&Ne.getCredentials(n.plugin,n.skill).then(G=>W(G.credentials)).catch(()=>W([]))},[n.plugin,n.skill,te]);const Q=g.useMemo(()=>new Set(P.filter(G=>G.status==="missing").map(G=>G.name)),[P]),[z,M]=g.useState(!1),I=g.useCallback(G=>{M(!1),h(G?{testType:G}:void 0)},[h]);return!p||D.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:y?"var(--red-muted)":"var(--accent-muted)"},children:y?a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M9 11l3 3L22 4"}),a.jsx("path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"})]})}),a.jsx("div",{className:"text-center",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--red)"},children:"Invalid evals.json"}),a.jsx("div",{className:"text-[11px] font-mono px-3 py-2 rounded mt-1 max-w-sm text-left break-words",style:{color:"var(--text-secondary)",background:"var(--surface-2)"},children:y}),a.jsx("div",{className:"text-[12px] mt-2",style:{color:"var(--text-tertiary)"},children:"Fix the evals.json file and reload, or regenerate test cases with AI"})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No test cases yet"}),a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Create test cases to start evaluating your skill"})]})}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>_(!0),disabled:x,className:"btn btn-primary text-[12px]",children:"Create Test Case"}),a.jsxs("div",{style:{position:"relative"},children:[a.jsxs("div",{className:"flex",children:[a.jsx("button",{onClick:()=>I("unit"),disabled:k||x,className:"btn btn-secondary text-[12px]",style:{borderTopRightRadius:0,borderBottomRightRadius:0},children:k?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"spinner",style:{width:12,height:12,borderWidth:1.5}})," Generating..."]}):"Generate Unit Tests"}),a.jsx("button",{onClick:()=>M(!z),disabled:k||x,className:"btn btn-secondary text-[12px]",style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:"1px solid var(--border-default)",padding:"4px 6px"},children:a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),z&&a.jsx("div",{className:"absolute right-0 mt-1 rounded-lg py-1 z-50",style:{background:"var(--surface-1)",border:"1px solid var(--border-default)",minWidth:180,boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:a.jsx("button",{onClick:()=>I("integration"),className:"w-full text-left px-3 py-2 text-[12px] transition-colors duration-100",style:{color:"var(--text-secondary)",background:"transparent"},onMouseEnter:G=>{G.currentTarget.style.background="var(--surface-2)"},onMouseLeave:G=>{G.currentTarget.style.background="transparent"},children:"Generate Integration Tests"})})]})]}),k&&N.length>0&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(qs,{entries:N,isRunning:!0})}),C&&a.jsx("div",{className:"w-full max-w-md mt-3",children:a.jsx(Ws,{error:C,onRetry:()=>I()})}),A&&a.jsx(zg,{evals:E,onSave:G=>{s(G),_(!1)},onCancel:()=>_(!1)})]}):a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"280px 1fr",height:"100%",overflow:"hidden"},children:[a.jsxs("div",{className:"overflow-auto",style:{borderRight:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:["Test Cases (",R.length,")"]}),a.jsx("div",{className:"flex items-center gap-1.5",children:w?a.jsx("button",{onClick:d,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"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>c("benchmark"),disabled:R.length===0||x,className:"btn btn-primary text-[10px] px-2 py-0.5",children:"Run All"}),a.jsx("button",{onClick:()=>c("comparison"),disabled:R.length===0||x,className:"btn btn-purple text-[10px] px-2 py-0.5",children:"Compare All"})]})})]}),a.jsx("div",{className:"flex px-3 py-1.5 gap-1",style:{borderBottom:"1px solid var(--border-subtle)"},children:["all","unit","integration"].map(G=>a.jsx("button",{onClick:()=>L(G),style:{padding:"2px 8px",fontSize:10,fontWeight:H===G?600:400,background:H===G?"var(--accent-muted)":"transparent",color:H===G?"var(--accent)":"var(--text-tertiary)",border:"none",borderRadius:4,cursor:"pointer",textTransform:"capitalize"},children:G==="all"?`All (${D.length})`:G==="unit"?`Unit (${D.filter(ce=>hl(ce)==="unit").length})`:`Integration (${D.filter(ce=>hl(ce)==="integration").length})`},G))}),a.jsxs("div",{className:"py-1",children:[R.length===0&&D.length>0&&a.jsxs("div",{className:"flex items-center justify-center py-8 px-3 text-[12px]",style:{color:"var(--text-tertiary)"},children:["No ",H==="all"?"":H+" ","tests yet"]}),R.map(G=>{var se;const ce=b.get(G.id),O=v===G.id,Y=hl(G);return a.jsxs("button",{onClick:()=>l({type:"SELECT_CASE",caseId:G.id}),className:"w-full text-left px-3 py-2.5 transition-all duration-150",style:{background:O?"var(--accent-muted)":"transparent",borderLeft:O?"3px solid var(--accent)":"3px solid transparent"},onMouseEnter:ue=>{O||(ue.currentTarget.style.background="var(--surface-2)")},onMouseLeave:ue=>{O||(ue.currentTarget.style.background="transparent")},children:[a.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[a.jsxs("span",{className:"text-[12px] font-medium truncate flex items-center gap-1.5",style:{color:O?"var(--text-primary)":"var(--text-secondary)"},children:["#",G.id," ",G.name,a.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 5px",borderRadius:9999,background:Y==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:Y==="unit"?"var(--accent)":"var(--orange)",whiteSpace:"nowrap"},children:Y==="unit"?"U":"I"}),Y==="integration"&&((se=G.requiredCredentials)==null?void 0:se.some(ue=>Q.has(ue)))&&a.jsx("span",{title:"Configure credentials to run",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]})})]}),a.jsx(my,{result:ce})]}),a.jsxs("div",{className:"text-[11px] flex items-center gap-2",style:{color:"var(--text-tertiary)"},children:[G.assertions.length," assertion",G.assertions.length!==1?"s":"",(ce==null?void 0:ce.passRate)!=null&&a.jsx(gC,{passRate:ce.passRate})]})]},G.id)})]}),a.jsx("div",{className:"px-3 py-2",children:!x&&a.jsx("button",{onClick:()=>_(!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:G=>{G.currentTarget.style.borderColor="var(--accent)",G.currentTarget.style.color="var(--accent)"},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-default)",G.currentTarget.style.color="var(--text-tertiary)"},children:"+ Add Test Case"})}),a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle)"},children:a.jsx(dC,{})})]}),a.jsx("div",{className:"overflow-auto",children:B?a.jsx(hC,{evalCase:B,result:b.get(B.id),evals:p,caseStatus:((X=j.get(B.id))==null?void 0:X.status)??"idle",onSaveEvals:s,onRun:G=>o(G,"benchmark"),onCompare:G=>o(G,"comparison"),onCancel:G=>f(G),onImprove:G=>l({type:"OPEN_IMPROVE",evalId:G})}):a.jsx("div",{className:"flex items-center justify-center h-full text-[13px]",style:{color:"var(--text-tertiary)"},children:"Select a test case"})}),A&&a.jsx(zg,{evals:E,onSave:G=>{s(G),_(!1)},onCancel:()=>_(!1)})]})}function hC({evalCase:n,result:l,evals:s,caseStatus:o,onSaveEvals:c,onRun:f,onCompare:d,onCancel:h,onImprove:x}){const{state:p,isReadOnly:y}=Cn(),{plugin:v,skill:b}=p,{entries:j,loading:k}=fC(v,b,n.id),[N,C]=g.useState(!1),[w,A]=g.useState(n.prompt),[_,H]=g.useState(!1),[L,$]=g.useState(n.expected_output);g.useState(()=>{A(n.prompt),$(n.expected_output)});const E=g.useCallback(G=>{c({...s,evals:s.evals.map(ce=>ce.id===G.id?G:ce)})},[s,c]),D=g.useCallback(()=>{E({...n,prompt:w}),C(!1)},[n,w,E]),R=g.useCallback(()=>{E({...n,expected_output:L}),H(!1)},[n,L,E]),B=g.useCallback(()=>{E({...n,assertions:[...n.assertions,{id:`assert-${Date.now()}`,text:"New assertion",type:"boolean"}]})},[n,E]),P=g.useCallback((G,ce)=>{E({...n,assertions:n.assertions.map(O=>O.id===G?{...O,text:ce}:O)})},[n,E]),W=g.useCallback(G=>{E({...n,assertions:n.assertions.filter(ce=>ce.id!==G)})},[n,E]),te=g.useCallback(()=>{confirm("Delete this test case?")&&c({...s,evals:s.evals.filter(G=>G.id!==n.id)})},[s,n.id,c]),Q=l&&l.assertions.length>0&&l.assertions.every(G=>G.pass),z=l&&l.assertions.some(G=>!G.pass),M=hl(n),I=n.requiredCredentials??[],X=M==="integration"&&I.length>0;return a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["#",n.id," ",n.name]}),y?a.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:M==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:M==="unit"?"var(--accent)":"var(--orange)"},children:M==="unit"?"Unit":"Integration"}):a.jsx("button",{onClick:()=>{if((M==="unit"?"integration":"unit")==="unit"){const{requiredCredentials:ce,requirements:O,cleanup:Y,...se}=n;E({...se,testType:"unit"})}else E({...n,testType:"integration"})},title:`Click to switch to ${M==="unit"?"integration":"unit"}`,style:{fontSize:10,fontWeight:600,padding:"2px 7px",borderRadius:9999,background:M==="unit"?"var(--accent-muted)":"var(--orange-muted)",color:M==="unit"?"var(--accent)":"var(--orange)",border:"none",cursor:"pointer"},children:M==="unit"?"Unit":"Integration"}),a.jsx(my,{result:l})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o==="running"||o==="queued"?a.jsxs("button",{onClick:()=>h(n.id),className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel"]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>f(n.id),disabled:y,className:"btn btn-primary text-[12px]",children:"Run"}),a.jsx("button",{onClick:()=>d(n.id),disabled:y,className:"btn btn-purple text-[12px]",children:"A/B Compare"})]}),z&&!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:()=>x(n.id),className:"btn btn-secondary text-[12px]",children:"Fix with AI"}),!y&&o!=="running"&&o!=="queued"&&a.jsx("button",{onClick:te,className:"btn btn-ghost text-[12px]",style:{color:"var(--red)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),y&&M==="integration"&&a.jsxs("div",{"data-testid":"platform-integration-note",className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--accent-muted)",border:"1px solid var(--accent-muted)"},children:[a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),a.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),a.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--accent)"},children:"Run locally in vSkill Studio"})]}),Q&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl flex items-center gap-3",style:{background:"var(--green-muted)",border:"1px solid var(--green-muted)"},children:[a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",children:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--green)"},children:"All assertions passing"})]}),X&&a.jsxs("div",{className:"mb-4 px-4 py-3 rounded-xl",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"Required Credentials"})]}),a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:"This integration test requires the following environment variables:"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:I.map(G=>a.jsx("span",{style:{fontSize:10,fontFamily:"var(--font-mono, monospace)",padding:"2px 6px",borderRadius:4,background:"var(--orange-muted)",color:"var(--orange)"},children:G},G))})]}),!y&&M==="integration"&&a.jsx(bC,{evalCase:n,onUpdate:E}),a.jsx(uo,{title:"Prompt",children:N?a.jsxs("div",{children:[a.jsx("textarea",{value:w,onChange:G=>A(G.target.value),className:"input-field w-full",rows:4,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:D,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{A(n.prompt),C(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-secondary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||C(!0)},onMouseEnter:G=>{y||(G.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-subtle)"},children:n.prompt||a.jsx("span",{style:{color:"var(--text-tertiary)",fontStyle:"italic"},children:y?"No prompt":"Click to edit prompt..."})})}),a.jsx(uo,{title:"Expected Output",children:_?a.jsxs("div",{children:[a.jsx("textarea",{value:L,onChange:G=>$(G.target.value),className:"input-field w-full",rows:3,style:{fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:12},autoFocus:!0}),a.jsxs("div",{className:"flex gap-2 mt-2",children:[a.jsx("button",{onClick:R,className:"btn btn-primary text-[12px]",children:"Save"}),a.jsx("button",{onClick:()=>{$(n.expected_output),H(!1)},className:"btn btn-ghost text-[12px]",children:"Cancel"})]})]}):a.jsx("div",{className:"p-3 rounded-lg text-[12px] transition-all duration-150",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",border:"1px solid var(--border-subtle)",maxHeight:200,overflowY:"auto",cursor:y?"default":"pointer"},onClick:()=>{y||H(!0)},onMouseEnter:G=>{y||(G.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:G=>{G.currentTarget.style.borderColor="var(--border-subtle)"},children:n.expected_output||a.jsx("span",{style:{fontStyle:"italic"},children:y?"No expected output":"Click to edit expected output..."})})}),a.jsx(uo,{title:`Assertions (${n.assertions.length})`,action:y?void 0:a.jsx("button",{onClick:B,className:"btn btn-ghost text-[11px]",children:"+ Add"}),children:n.assertions.length===0?a.jsx("div",{className:"text-[12px] text-center py-4",style:{color:"var(--text-tertiary)"},children:'No assertions. Click "+ Add" to create one.'}):a.jsx("div",{className:"space-y-2",children:n.assertions.map(G=>{const ce=l==null?void 0:l.assertions.find(Y=>Y.assertion_id===G.id),O=pC(G.id,ce,j);return a.jsx(xC,{assertion:G,result:ce,badges:O,isReadOnly:y,onUpdate:Y=>P(G.id,Y),onDelete:()=>W(G.id)},G.id)})})}),(l==null?void 0:l.output)&&a.jsx(vC,{output:l.output,durationMs:l.durationMs,tokens:l.tokens}),l&&l.passRate!=null&&l.passRate<.2&&(()=>{const G=fy("INEFFECTIVE",l.passRate);return G.recommendations&&G.recommendations.length>0?a.jsx(uo,{title:"Recommendations",children:a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--orange)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),a.jsx("span",{className:"text-[12px] font-semibold",style:{color:"var(--orange)"},children:"This eval is significantly below expectations"})]}),a.jsx("ul",{className:"space-y-1.5 ml-1",children:G.recommendations.map((ce,O)=>a.jsxs("li",{className:"flex items-start gap-2 text-[12px]",style:{color:"var(--text-secondary)"},children:[a.jsx("span",{style:{color:"var(--orange)",fontWeight:600,flexShrink:0},children:"•"}),ce]},O))})]})}):null})(),a.jsx(yC,{evalId:n.id,sharedEntries:j,sharedLoading:k})]},n.id)}function xC({assertion:n,result:l,badges:s,isReadOnly:o,onUpdate:c,onDelete:f}){const[d,h]=g.useState(!1),[x,p]=g.useState(n.text),[y,v]=g.useState(!1),b=()=>{c(x),h(!1)};return a.jsx("div",{className:"rounded-lg px-3 py-2.5 transition-all duration-150",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsxs("div",{className:"flex items-start gap-2",children:[l?a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,display:"flex",alignItems:"center",justifyContent:"center",background:l.pass?"var(--green-muted)":"var(--red-muted)"},children:l.pass?a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:18,height:18,border:"1.5px dashed var(--text-tertiary)",background:"transparent"},title:"Not run yet"}),(s==null?void 0:s.regression)&&a.jsx("span",{className:"mt-0.5 flex-shrink-0",title:"Regression: was passing, now failing",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:16,height:18,color:"var(--red)",fontSize:14,fontWeight:700,lineHeight:1},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[10px] font-mono font-semibold",style:{color:"var(--text-tertiary)"},children:n.id}),(s==null?void 0:s.flaky)&&a.jsx("span",{title:"Flaky: 30-70% pass rate across recent runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--yellow-muted)",color:"var(--yellow)",whiteSpace:"nowrap"},children:"Flaky"}),(s==null?void 0:s.nonDiscriminating)&&a.jsx("span",{title:"Non-discriminating: passes on both skill and baseline runs",style:{display:"inline-block",fontSize:9,fontWeight:600,lineHeight:1,padding:"2px 6px",borderRadius:9999,background:"var(--surface-3)",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"Non-Discrim."})]}),d?a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{value:x,onChange:j=>p(j.target.value),onKeyDown:j=>{j.key==="Enter"&&b(),j.key==="Escape"&&h(!1)},className:"input-field flex-1 text-[12px]",autoFocus:!0}),a.jsx("button",{onClick:b,className:"btn btn-primary text-[11px]",children:"Save"})]}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-secondary)",cursor:o?"default":"pointer"},onClick:()=>{o||(p(n.text),h(!0))},children:n.text}),(l==null?void 0:l.reasoning)&&a.jsx("button",{onClick:()=>v(!y),className:"text-[11px] mt-1 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:y?"Hide reasoning":"Show reasoning"}),y&&(l==null?void 0:l.reasoning)&&a.jsx("div",{className:"mt-1 text-[11px] p-2 rounded",style:{background:"var(--surface-1)",color:"var(--text-tertiary)"},children:l.reasoning})]}),!o&&a.jsx("button",{onClick:f,className:"btn btn-ghost p-1 opacity-0 group-hover:opacity-100",style:{color:"var(--text-tertiary)"},onMouseEnter:j=>{j.currentTarget.style.color="var(--red)",j.currentTarget.style.opacity="1"},onMouseLeave:j=>{j.currentTarget.style.color="var(--text-tertiary)",j.currentTarget.style.opacity=""},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})}function uo({title:n,action:l,children:s}){return a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:n}),l]}),s]})}function my({result:n}){const[l,s]=g.useState(!1);if(!n||n.status==null)return a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"--"});const o=n.status==="pass",c=n.passRate??0,d=fy(o?"PASS":"FAIL",c);return a.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:()=>s(!0),onMouseLeave:()=>s(!1),"aria-describedby":l?"verdict-tooltip":void 0,children:[n.passRate!=null?`${Math.round(n.passRate*100)}%`:n.status,l&&a.jsx("div",{id:"verdict-tooltip",role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",right:0,padding:"6px 10px",background:"var(--surface-4)",border:"1px solid var(--border-subtle)",borderRadius:6,fontSize:11,color:"var(--text-secondary)",whiteSpace:"nowrap",zIndex:50,maxWidth:300,width:"max-content",boxShadow:"0 4px 12px rgba(0,0,0,0.15)"},children:d.explanation})]})}function gC({passRate:n}){const l=Math.round(n*100);return a.jsx("div",{className:"flex items-center gap-1",children:a.jsx("div",{className:"rounded-full overflow-hidden",style:{width:32,height:4,background:"var(--surface-4)"},children:a.jsx("div",{className:"h-full rounded-full",style:{width:`${l}%`,background:l>=80?"var(--green)":l>=50?"var(--yellow)":"var(--red)"}})})})}function vC({output:n,durationMs:l,tokens:s}){const[o,c]=g.useState(!1);return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:()=>c(!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:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"LLM Output",l!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",(l/1e3).toFixed(1),"s)"]}),s!=null&&a.jsxs("span",{style:{fontWeight:400},children:["(",s," tokens)"]})]}),o&&a.jsx("pre",{className:"text-[12px] p-4 rounded-lg overflow-auto animate-fade-in",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:400,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:n})]})}function jd(n){return n==="baseline"?"right":n==="comparison"?"full":"left"}function kd({entry:n}){return a.jsxs("div",{className:"rounded-lg px-3 py-2.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:cy(n.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:n.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:n.type==="benchmark"?"var(--accent-muted)":n.type==="comparison"?"var(--purple-muted)":"var(--orange-muted)",color:n.type==="benchmark"?"var(--accent)":n.type==="comparison"?"var(--purple)":"var(--orange)"},children:n.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Sl(n.pass_rate)},children:[Math.round(n.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-1.5 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[n.durationMs!=null&&a.jsx("span",{children:uy(n.durationMs)}),n.tokens!=null&&a.jsxs("span",{children:[n.tokens>=1e3?`${(n.tokens/1e3).toFixed(1)}k`:n.tokens," tok"]})]}),n.type==="comparison"&&n.baselinePassRate!=null&&(()=>{const l=n.pass_rate-n.baselinePassRate,s=l>.001?"skill":l<-.001?"baseline":"tie",o=l>0?"+":"",c=s==="skill"?"var(--green)":s==="baseline"?"var(--red)":"var(--text-tertiary)";return a.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"vs baseline:"}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:l>=0?"var(--green)":"var(--red)"},children:[o,(l*100).toFixed(1),"%"]}),a.jsx("span",{className:"pill text-[9px]",style:{padding:"1px 5px",background:"var(--surface-3)",color:c},children:s})]})})(),a.jsx("div",{className:"space-y-0.5",children:n.assertions.map(l=>a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsx("span",{className:"mt-0.5 rounded-full flex-shrink-0",style:{width:14,height:14,display:"flex",alignItems:"center",justifyContent:"center",background:l.pass?"var(--green-muted)":"var(--red-muted)"},children:l.pass?a.jsx("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:l.text})]},l.id))})]})}function yC({evalId:n,sharedEntries:l,sharedLoading:s}){const{state:o,dispatch:c}=Cn(),{plugin:f,skill:d}=o,[h,x]=g.useState(!0),p=l??null,y=s??!1,v=g.useCallback(()=>{x(N=>!N)},[]),b=p?p.slice(0,10):[],j=b.some(N=>{const C=jd(N.type);return C==="left"||C==="full"}),k=b.some(N=>{const C=jd(N.type);return C==="right"||C==="full"});return a.jsxs("div",{className:"mb-5",children:[a.jsxs("button",{onClick:v,className:"flex items-center gap-2 text-[11px] font-semibold uppercase tracking-wider mb-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:[a.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:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Execution History",p&&p.length>0&&a.jsxs("span",{style:{fontWeight:400},children:["(",p.length," run",p.length!==1?"s":"",")"]})]}),h&&a.jsx("div",{className:"animate-fade-in",children:y?a.jsxs("div",{className:"flex items-center gap-2 py-3",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):!p||p.length===0?a.jsx("div",{className:"text-[12px] py-3",style:{color:"var(--text-tertiary)"},children:"No history for this case"}):a.jsxs("div",{children:[b.length>=2&&a.jsx("div",{className:"mb-2",children:a.jsx(dy,{entries:b})}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"1"},children:"Skill"}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)",gridColumn:"2"},children:"Baseline"}),!j&&a.jsx("div",{style:{gridColumn:"1",fontSize:12,color:"var(--text-tertiary)"},children:"No skill runs"}),!k&&a.jsx("div",{style:{gridColumn:"2",fontSize:12,color:"var(--text-tertiary)"},children:"No baseline runs"}),b.map((N,C)=>{const w=jd(N.type);return w==="full"?a.jsx("div",{style:{gridColumn:"1 / -1"},children:a.jsx(kd,{entry:N})},C):w==="left"?a.jsxs(g.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"},children:a.jsx(kd,{entry:N})}),a.jsx("div",{style:{gridColumn:"2"}})]},C):a.jsxs(g.Fragment,{children:[a.jsx("div",{style:{gridColumn:"1"}}),a.jsx("div",{style:{gridColumn:"2"},children:a.jsx(kd,{entry:N})})]},C)})]}),a.jsx("button",{onClick:()=>c({type:"SET_PANEL",panel:"history"}),className:"mt-2 text-[11px] font-medium transition-colors duration-150",style:{color:"var(--accent)"},onMouseEnter:N=>{N.currentTarget.style.textDecoration="underline"},onMouseLeave:N=>{N.currentTarget.style.textDecoration="none"},children:"View full history →"})]})})]})}function zg({evals:n,onSave:l,onCancel:s}){const[o,c]=g.useState(""),[f,d]=g.useState(""),[h,x]=g.useState(""),[p,y]=g.useState([{id:`assert-${Date.now()}`,text:"",type:"boolean"}]),[v,b]=g.useState("unit"),[j,k]=g.useState(""),[N,C]=g.useState([]),[w,A]=g.useState(""),[_,H]=g.useState(""),L=Math.max(0,...n.evals.map(R=>R.id))+1,$=R=>{b(R),R==="unit"&&(C([]),k(""),A(""),H(""))},E=()=>{const R=j.trim().toUpperCase();R&&!N.includes(R)&&C([...N,R]),k("")},D=()=>{if(!o.trim()||!f.trim())return;const R={id:L,name:o.trim(),prompt:f.trim(),expected_output:h.trim(),files:[],assertions:p.filter(B=>B.text.trim()),...v==="integration"?{testType:"integration",...N.length>0?{requiredCredentials:N}:{},...w||_?{requirements:{...w?{platform:w}:{},..._?{chromeProfile:_}:{}}}:{}}:{}};l({...n,evals:[...n.evals,R]})};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center animate-overlay-in",style:{background:"rgba(0,0,0,0.6)"},children:a.jsxs("div",{className:"w-full max-w-lg rounded-xl p-6 animate-modal-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)",maxHeight:"85vh",overflowY:"auto"},children:[a.jsx("div",{className:"text-[15px] font-semibold mb-4",style:{color:"var(--text-primary)"},children:"New Test Case"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1.5 block",style:{color:"var(--text-tertiary)"},children:"Type"}),a.jsx("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)",display:"inline-flex"},children:["unit","integration"].map(R=>a.jsx("button",{onClick:()=>$(R),className:"px-3 py-1 rounded-md text-[12px] font-medium transition-all duration-150",style:{background:v===R?R==="unit"?"var(--accent-muted)":"var(--orange-muted)":"transparent",color:v===R?R==="unit"?"var(--accent)":"var(--orange)":"var(--text-tertiary)",border:"none",cursor:"pointer",textTransform:"capitalize"},children:R},R))})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Name"}),a.jsx("input",{value:o,onChange:R=>c(R.target.value),className:"input-field",placeholder:"e.g., auth-check",autoFocus:!0})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Prompt"}),a.jsx("textarea",{value:f,onChange:R=>d(R.target.value),className:"input-field",rows:3,placeholder:"User prompt to test..."})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Expected Output"}),a.jsx("textarea",{value:h,onChange:R=>x(R.target.value),className:"input-field",rows:2,placeholder:"Description of expected behavior..."})]}),a.jsxs("div",{className:"mb-4",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Assertions"}),p.map((R,B)=>a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:R.text,onChange:P=>y(p.map((W,te)=>te===B?{...W,text:P.target.value}:W)),className:"input-field flex-1 text-[12px]",placeholder:"e.g., Output includes a greeting"}),p.length>1&&a.jsx("button",{onClick:()=>y(p.filter((P,W)=>W!==B)),className:"btn btn-ghost p-1",style:{color:"var(--text-tertiary)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R.id)),a.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"})]}),v==="integration"&&a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:N.map(R=>a.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,a.jsx("button",{onClick:()=>C(N.filter(B=>B!==R)),style:{color:"var(--orange)",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},R))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:j,onChange:R=>k(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),E())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., SLACK_BOT_TOKEN"}),a.jsx("button",{onClick:E,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),a.jsxs("label",{className:"block mb-3",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:w,onChange:R=>A(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("label",{className:"block",children:[a.jsx("span",{className:"text-[11px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:_,onChange:R=>H(R.target.value),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{onClick:s,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsx("button",{onClick:D,disabled:!o.trim()||!f.trim(),className:"btn btn-primary text-[12px]",children:"Save"})]})]})})}function bC({evalCase:n,onUpdate:l}){var d,h;const[s,o]=g.useState(""),c=()=>{const x=s.trim().toUpperCase();x&&!(n.requiredCredentials??[]).includes(x)&&l({...n,requiredCredentials:[...n.requiredCredentials??[],x]}),o("")},f=x=>{const p=(n.requiredCredentials??[]).filter(y=>y!==x);l({...n,requiredCredentials:p.length>0?p:void 0})};return a.jsxs("div",{className:"mb-4 p-3 rounded-lg",style:{background:"var(--orange-muted)",border:"1px solid var(--orange-muted)"},children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 block",style:{color:"var(--orange)"},children:"Integration Settings"}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Required Credentials"}),a.jsx("div",{className:"flex flex-wrap gap-1.5 mb-1.5",children:(n.requiredCredentials??[]).map(x=>a.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,a.jsx("button",{onClick:()=>f(x),style:{color:"var(--orange)",lineHeight:1},children:a.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},x))}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx("input",{value:s,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),c())},className:"input-field flex-1 text-[11px] font-mono",placeholder:"e.g., GITHUB_TOKEN"}),a.jsx("button",{onClick:c,className:"btn btn-ghost text-[11px]",style:{color:"var(--orange)"},children:"Add"})]})]}),a.jsxs("div",{className:"mb-2.5",children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Platform"}),a.jsx("input",{value:((d=n.requirements)==null?void 0:d.platform)??"",onChange:x=>l({...n,requirements:{...n.requirements,platform:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., linkedin, twitter"})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[10px] mb-1 block",style:{color:"var(--text-secondary)"},children:"Chrome Profile"}),a.jsx("input",{value:((h=n.requirements)==null?void 0:h.chromeProfile)??"",onChange:x=>l({...n,requirements:{...n.requirements,chromeProfile:x.target.value||void 0}}),className:"input-field text-[11px]",placeholder:"e.g., Default"})]})]})}function wn(n,l){return l==="free"?"Free":l==="subscription"&&n==null?"Subscription":n==null?"N/A":n>=1?`$${n.toFixed(2)}`:n===0?"$0.00":n>=.001?`$${n.toFixed(4)}`:`$${n.toPrecision(3).replace(/0+$/,"").replace(/\.$/,"")}`}function hy(n,l){return n==null||l==null?"N/A":`${n.toLocaleString("en-US")} in / ${l.toLocaleString("en-US")} out`}function SC(n){return n==="baseline"?"Baseline Pass Rate":"Skill Pass Rate"}function jC(n,l){let s="";if(l){const c=new Date(l);isNaN(c.getTime())||(s=c.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}))}return[n,s].filter(Boolean).join(" · ")}function kC(n,l,s){const o=s===1?"test case":"test cases";if(n===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const c=Math.round(Math.abs(n)*l);if(c===0)return`Your skill performs the same as the baseline across ${s} ${o}`;const f=n>0?"more":"fewer";return`Your skill passes ${c} ${f} assertions across ${s} ${o}`}function Dg(n,l){const s=o=>{const c=o/5*100;return isFinite(c)?Math.round(Math.min(100,Math.max(0,c))):0};return{skill:s(n),baseline:s(l)}}function wC(n){return n==="skill"?{text:"Skill wins",isSkill:!0}:n==="baseline"?{text:"Baseline wins",isSkill:!1}:{text:"Tie",isSkill:!1}}function CC(n,l){const s=n+l,o=s*10,c=s*25,f=d=>d>=60?`${Math.round(d/60)}m`:`${d}s`;return`${f(o)}–${f(c)}`}const EC={anthropic:.01,openrouter:.01,ollama:0,"lm-studio":0,"claude-cli":0,"codex-cli":0,"gemini-cli":0};function NC(n,l){if(!n)return null;const s=EC[n];if(s==null||s===0)return null;const o=s*l*.5,c=s*l*2;return`${wn(o)}–${wn(c)}`}function TC(){const{state:n,runCase:l,runAll:s,cancelCase:o,cancelAll:c,isReadOnly:f}=Cn(),{evals:d,caseRunStates:h,bulkRunActive:x,latestBenchmark:p,inlineResults:y}=n,{config:v}=Nr(),b=(d==null?void 0:d.evals)??[],j=g.useMemo(()=>{for(const E of h.values())if(E.status==="running"||E.status==="queued")return!0;return!1},[h]),k=b.filter(E=>{const D=h.get(E.id);return D&&(D.status==="complete"||D.status==="error"||D.status==="cancelled")}).length,N=b.filter(E=>{const D=h.get(E.id);return D&&(D.status==="running"||D.status==="queued")}).length,C=g.useRef(null),[w,A]=g.useState(0);g.useEffect(()=>{if(j&&!C.current&&(C.current=Date.now()),!j){C.current=null,A(0);return}const E=setInterval(()=>{C.current&&A(Math.round((Date.now()-C.current)/1e3))},1e3);return()=>clearInterval(E)},[j]);const _=b.reduce((E,D)=>E+D.assertions.length,0),H=b.length+_,L=g.useMemo(()=>CC(b.length,_),[b.length,_]),$=g.useMemo(()=>NC((v==null?void 0:v.provider)??null,H),[v==null?void 0:v.provider,H]);return a.jsxs("div",{className:"p-5",children:[f&&a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-4 text-[11px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),a.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),"Installed skill — benchmarking is disabled. Edit the source skill to run benchmarks."]}),a.jsxs("div",{className:"rounded-xl p-4 mb-5",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Benchmark"}),j&&a.jsxs("span",{className:"text-[11px] font-medium",style:{color:"var(--accent)"},children:[N," running"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[j&&a.jsxs("button",{onClick:c,className:"btn text-[12px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor",style:{marginRight:4},children:a.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),"Cancel All"]}),a.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||j||f,className:"btn btn-primary text-[12px]",title:"Runs both your skill and the baseline, then compares results side by side",children:"Run A/B Test"}),a.jsx("button",{onClick:()=>s("benchmark"),disabled:b.length===0||j||f,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using your skill only",children:"Test Skill"}),a.jsx("button",{onClick:()=>s("baseline"),disabled:b.length===0||j||f,className:"btn btn-secondary text-[12px]",title:"Runs benchmark using the baseline (no skill) for reference",children:"Test Baseline"})]}),!j&&b.length>0&&a.jsxs("div",{className:"flex items-center gap-3 mt-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Est. duration: ",L]}),$&&a.jsxs("span",{children:["Est. cost: ",$]}),!$&&(v==null?void 0:v.provider)&&(v.provider==="claude-cli"||v.provider==="codex-cli")&&a.jsx("span",{children:"Cost: Subscription"}),!$&&(v==null?void 0:v.provider)&&(v.provider==="ollama"||v.provider==="lm-studio"||v.provider==="gemini-cli")&&a.jsx("span",{children:"Cost: Free"})]})]}),j&&b.length>0&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("span",{className:"text-[12px] font-medium",style:{color:"var(--text-secondary)"},children:["Progress: ",k,"/",b.length," cases"]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[Math.round(k/b.length*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${k/b.length*100}%`,background:"var(--accent)"}})}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Elapsed: ",w>=60?`${Math.floor(w/60)}m ${w%60}s`:`${w}s`]}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:["Est. total: ",L]})]})]}),a.jsx("div",{className:"space-y-3 stagger-children",children:b.map(E=>{const D=y.get(E.id),R=h.get(E.id),B=(R==null?void 0:R.status)??"idle",P=p==null?void 0:p.cases.find(W=>W.eval_id===E.id);return a.jsx(AC,{name:E.name,evalId:E.id,result:D,caseCost:P==null?void 0:P.cost,caseBillingMode:P==null?void 0:P.billingMode,caseInputTokens:P==null?void 0:P.inputTokens,caseOutputTokens:P==null?void 0:P.outputTokens,caseStatus:B,runMode:(R==null?void 0:R.mode)??null,comparisonDetail:P==null?void 0:P.comparisonDetail,isReadOnly:f,onRun:W=>l(W,"benchmark"),onBaseline:W=>l(W,"baseline"),onCompare:W=>l(W,"comparison"),onCancel:W=>o(W)},E.id)})}),!j&&p&&p.cases.length>0&&a.jsxs("div",{className:"mt-5",children:[a.jsxs("div",{className:"rounded-xl p-4 mb-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:SC(p.type)}),a.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&&a.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: ${hy(p.totalInputTokens,p.totalOutputTokens)}`,p.totalCost!=null&&` | Cost: ${wn(p.totalCost)}`]}),p.overall_pass_rate>=.9999&&!p.comparison&&a.jsx("button",{onClick:()=>s("comparison"),disabled:b.length===0||f,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:b.length===0?.5:1},children:"Run Final A/B Comparison"})]}),p.comparison&&a.jsxs("div",{className:"rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Skill vs Baseline"}),(()=>{const E=jC(p.model,p.timestamp);return E?a.jsx("div",{className:"text-[10px] mt-0.5 mb-3",style:{color:"var(--text-tertiary)"},children:E}):a.jsx("div",{className:"mb-3"})})(),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(_g,{label:"Skill",value:p.comparison.skillPassRate,color:"var(--accent)"}),a.jsx(_g,{label:"Baseline",value:p.comparison.baselinePassRate,color:"var(--text-tertiary)"})]}),a.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&&` | ${uC(p.verdict)}`]}),(()=>{const E=p.cases.reduce((R,B)=>R+B.assertions.length,0),D=kC(p.comparison.delta,E,p.cases.length);return a.jsx("div",{className:"mt-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:D})})()]})]})]})}const RC={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 AC({name:n,evalId:l,result:s,caseCost:o,caseBillingMode:c,caseInputTokens:f,caseOutputTokens:d,caseStatus:h,runMode:x,comparisonDetail:p,isReadOnly:y,onRun:v,onBaseline:b,onCompare:j,onCancel:k}){const[N,C]=g.useState(!1),w=h==="running"||h==="queued",A=h==="complete"||h==="error";return a.jsxs("div",{className:"rounded-xl overflow-hidden transition-all duration-200",style:{background:"var(--surface-1)",border:w?"1px solid var(--accent)":"1px solid var(--border-subtle)",boxShadow:w?"0 0 12px rgba(99, 131, 255, 0.15)":"none"},children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[h==="running"&&a.jsx("span",{className:"spinner",style:{width:14,height:14,borderWidth:1.5}}),h==="queued"&&a.jsx("span",{className:"text-[10px] font-medium",style:{color:"var(--text-tertiary)"},children:"queued"}),a.jsxs("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:["#",l," ",n]}),x&&(w||A)&&(()=>{const _=RC[x];return _?a.jsx("span",{className:"pill text-[9px] font-semibold",style:{background:_.bg,color:_.color,padding:"1px 6px"},children:_.label}):null})()]}),a.jsxs("div",{className:"flex items-center gap-2",children:[w?a.jsx("button",{onClick:()=>k(l),className:"btn text-[10px] px-2 py-1",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:"Cancel"}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>j(l),disabled:y,className:"btn btn-primary text-[10px] px-2 py-1",children:"Compare"}),a.jsx("button",{onClick:()=>v(l),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Skill"}),a.jsx("button",{onClick:()=>b(l),disabled:y,className:"btn btn-secondary text-[10px] px-2 py-1",children:"Base"})]}),s&&s.status!=null&&a.jsx("span",{className:"pill text-[10px]",style:{background:s.status==="pass"?"var(--green-muted)":"var(--red-muted)",color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.passRate!=null?`${Math.round(s.passRate*100)}%`:s.status}),f!=null&&d!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:hy(f,d)}),o!=null&&a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:wn(o,c)}),h==="cancelled"&&a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:"cancelled"})]})]}),s&&s.assertions.length>0&&a.jsxs("div",{className:"px-4 pb-3",children:[a.jsx("div",{className:"space-y-1",children:s.assertions.map(_=>a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsx("span",{style:{color:_.pass?"var(--green)":"var(--red)"},children:_.pass?"PASS":"FAIL"}),a.jsx("span",{style:{color:"var(--text-secondary)"},children:_.text})]},_.assertion_id))}),s.output&&a.jsx("button",{onClick:()=>C(!N),className:"text-[11px] mt-2 transition-colors duration-150",style:{color:"var(--text-tertiary)"},children:N?"Hide output":"Show output"}),N&&s.output&&a.jsx("pre",{className:"text-[11px] mt-2 p-3 rounded-lg overflow-auto",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",maxHeight:200,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap"},children:s.output})]}),p&&a.jsx("div",{className:"px-4 pb-3",children:a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:a.jsx("div",{className:"flex items-center gap-4 text-[11px] flex-wrap",children:(()=>{const _=Dg(p.skillContentScore,p.baselineContentScore),H=Dg(p.skillStructureScore,p.baselineStructureScore),L=wC(p.winner);return a.jsxs(a.Fragment,{children:[a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Content: Skill ",_.skill,"% / Baseline ",_.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsxs("span",{style:{color:"var(--text-secondary)"},children:["Structure: Skill ",H.skill,"% / Baseline ",H.baseline,"%"]}),a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"·"}),a.jsx("span",{style:{color:L.isSkill?"var(--accent)":"var(--text-tertiary)",fontWeight:500},children:L.text})]})})()})})}),s&&s.errorMessage&&a.jsx(MC,{errorMessage:s.errorMessage,classifiedError:s.classifiedError})]})}const wd={rate_limit:"⏱",context_window:"⚠",auth:"🔒",timeout:"⌛",provider_unavailable:"⚡",parse_error:"❓",unknown:"❌"};function MC({errorMessage:n,classifiedError:l}){const[s,o]=g.useState(!1),c=(l==null?void 0:l.title)??"Error",f=l==null?void 0:l.hint,d=l?wd[l.category]??wd.unknown:wd.unknown;return a.jsx("div",{className:"px-4 pb-3",children:a.jsxs("div",{className:"rounded-lg overflow-hidden",style:{background:"var(--red-muted)",border:"1px solid var(--red-muted)"},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[a.jsx("span",{style:{fontSize:12},children:d}),a.jsx("span",{className:"text-[11.5px] font-semibold flex-1",style:{color:"var(--red)"},children:c}),a.jsx("button",{onClick:()=>o(!s),className:"text-[10px] px-1.5 py-0.5 rounded transition-colors duration-150",style:{color:"var(--text-tertiary)",background:"transparent"},children:s?"Hide details":"Details"})]}),f&&a.jsx("div",{className:"px-3 pb-2 text-[10.5px]",style:{color:"var(--text-secondary)"},children:f}),s&&a.jsx("pre",{className:"text-[10px] px-3 pb-2.5 overflow-auto",style:{color:"var(--text-tertiary)",maxHeight:120,fontFamily:"var(--font-mono, ui-monospace, monospace)",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:n})]})})}function _g({label:n,value:l,color:s}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:n}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s},children:[Math.round(l*100),"%"]})]}),a.jsx("div",{className:"rounded-full overflow-hidden",style:{height:6,background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${l*100}%`,background:s}})})]})}const Og={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 LC(){const{state:n,dispatch:l,runActivationTest:s,cancelActivation:o,generateActivationPrompts:c}=Cn(),{plugin:f,skill:d,activationPrompts:h,activationResults:x,activationSummary:p,activationRunning:y,activationError:v,activationStartedAt:b,activationClassifyingStatus:j,generatingPrompts:k,generatingPromptsError:N,activationHistory:C}=n,[w,A]=g.useState(h),[_,H]=g.useState(null),[L,$]=g.useState(!1);g.useEffect(()=>{h&&h!==w&&A(h)},[h]),g.useEffect(()=>{l({type:"SET_ACTIVATION_PROMPTS",prompts:w})},[w,l]),g.useEffect(()=>{fetch(`/api/skills/${f}/${d}/description`).then(z=>z.json()).then(z=>H(z.rawContent||z.description||null)).catch(()=>H(null))},[f,d]);function E(){s(w)}function D(){c(8)}const R=w.trim().split(`
81
- `).filter(Boolean).length,B=x.filter(z=>z.classification==="TP"||z.classification==="TN"),P=x.filter(z=>z.classification==="FP"||z.classification==="FN"),W=(_==null?void 0:_.replace(/^---[\s\S]*?---\s*/,"").trim())??null,te=w.trim().length>0,Q=W?$o(W):"";return a.jsxs("div",{className:"p-5 space-y-5",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[14px] font-semibold",style:{color:"var(--text-primary)"},children:"Activation Test"}),a.jsx("div",{className:"text-[12px] mt-0.5",style:{color:"var(--text-tertiary)"},children:"Test whether this skill's description activates for relevant prompts and stays silent for irrelevant ones."})]}),a.jsxs("div",{className:"grid grid-cols-[3fr_2fr] gap-4 items-stretch",children:[a.jsxs("div",{className:"glass-card p-4 flex flex-col gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Test Prompts"}),a.jsx("div",{className:"flex gap-1.5",children:a.jsx("button",{onClick:D,disabled:k||!W||y,className:"text-[10px] px-2.5 py-1 rounded-md transition-colors duration-150 flex items-center gap-1.5",style:{background:k?"var(--surface-3)":"var(--surface-2)",color:W?"var(--accent)":"var(--text-tertiary)",border:"1px solid var(--border-subtle)",opacity:W?1:.5,cursor:W?"pointer":"not-allowed"},title:W?void 0:"No skill description available",onMouseEnter:z=>{W&&!k&&(z.currentTarget.style.background="var(--surface-3)")},onMouseLeave:z=>{k||(z.currentTarget.style.background="var(--surface-2)")},children:k?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--accent)",borderColor:"var(--border-subtle)",width:10,height:10}}),"Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3v3m6.36.64l-2.12 2.12M21 12h-3m-.64 6.36l-2.12-2.12M12 21v-3m-4.24.64l2.12-2.12M3 12h3m.64-6.36l2.12 2.12"})}),te?"Regenerate":"Generate"," Test Prompts"]})})})]}),!W&&!y&&a.jsx("div",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},"aria-live":"polite",children:"Add a description to your skill's frontmatter to enable prompt generation."}),N&&a.jsx("div",{className:"text-[11px] px-2 py-1 rounded",style:{color:"var(--red)",background:"var(--red-muted)"},children:N}),a.jsx("textarea",{className:"input-field resize-y font-mono text-[12px]",style:{minHeight:140,height:140},value:w,onChange:z=>A(z.target.value),placeholder:`How do I write a unit test?
82
- What edge cases should I test?
83
- +Deploy this to production
84
- !What's the weather like today?
85
- !Write me a poem about flowers`}),a.jsxs("div",{className:"flex items-center flex-wrap gap-x-3 gap-y-1 text-[11px]",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:"One prompt per line"}),a.jsx(fo,{}),a.jsx("span",{children:"No prefix = auto-classify"}),a.jsx(fo,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"+"}),"= must activate"]}),a.jsx(fo,{}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"px-1 rounded",style:{background:"var(--surface-2)"},children:"!"}),"= must NOT activate"]}),a.jsx(fo,{}),a.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[R," prompt",R!==1?"s":""]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:E,disabled:y||!w.trim(),className:"btn btn-primary",children:y?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"spinner",style:{borderTopColor:"var(--color-paper)",borderColor:"var(--border-default)",width:14,height:14}}),"Testing..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("circle",{cx:"12",cy:"12",r:"6"}),a.jsx("circle",{cx:"12",cy:"12",r:"2"})]}),"Run Activation Test"]})}),y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:o,className:"btn btn-secondary text-[12px]",children:"Cancel"}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[j||`${x.length} / ${R} prompts tested`,b&&a.jsx(OC,{startedAt:b})]})]})]})]}),a.jsxs("div",{className:"glass-card flex flex-col overflow-hidden",children:[a.jsx("div",{className:"px-4 pt-3.5 pb-2.5 flex-shrink-0",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:"Skill Description"})}),a.jsx("div",{className:"flex-1 overflow-auto px-4 py-3",style:{minHeight:0},children:W?a.jsx("div",{className:"text-[12px] leading-relaxed",style:{color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:Q}}):a.jsx("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No description available"})})]})]}),v&&a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid var(--red-muted)"},children:v}),y&&x.length===0&&a.jsxs("div",{className:"text-center py-12 animate-fade-in",children:[a.jsx("div",{className:"spinner-lg mx-auto mb-4"}),a.jsx("p",{className:"text-[14px]",style:{color:"var(--text-secondary)"},children:"Testing activation against skill description..."})]}),x.length>0&&a.jsxs("div",{className:"space-y-5",children:[P.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--red)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),a.jsx("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--red)"},children:["Incorrect (",P.length,")"]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"— These need attention"})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:P.map((z,M)=>a.jsx(Bg,{result:z},`incorrect-${M}`))})]}),B.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--green)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("polyline",{points:"16 10 11 15 8 12"})]}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--green)"},children:["Correct (",B.length,")"]})]}),a.jsx("div",{className:"space-y-1.5 stagger-children",children:B.map((z,M)=>a.jsx(Bg,{result:z},`correct-${M}`))})]})]}),p&&a.jsxs("div",{className:"glass-card p-6 animate-fade-in-scale",style:{borderColor:"var(--border-active)",borderWidth:2},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-2",style:{color:"var(--text-tertiary)"},children:"Summary"}),p.autoClassifiedCount!=null&&p.autoClassifiedCount>0&&a.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"]}),a.jsxs("div",{className:"grid grid-cols-3 gap-6 mb-5",children:[a.jsx(Cd,{label:"Precision",value:p.precision,description:"Of all activations, how many were correct?",detail:`${p.tp} true / ${p.tp+p.fp} total activations`}),a.jsx(Cd,{label:"Recall",value:p.recall,description:"Of expected activations, how many fired?",detail:`${p.tp} activated / ${p.tp+p.fn} expected`}),a.jsx(Cd,{label:"Reliability",value:p.reliability,description:"Overall correct classification rate",detail:`${p.tp+p.tn} correct / ${p.total} total`})]}),a.jsxs("div",{className:"pt-4",style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest mb-3 text-center",style:{color:"var(--text-tertiary)"},children:"Confusion Matrix"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 max-w-xs mx-auto",children:[a.jsx(po,{label:"True Positive",abbr:"TP",count:p.tp,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly activated"}),a.jsx(po,{label:"False Positive",abbr:"FP",count:p.fp,bg:"var(--red-muted)",color:"var(--red)",description:"Wrongly activated"}),a.jsx(po,{label:"False Negative",abbr:"FN",count:p.fn,bg:"var(--red-muted)",color:"var(--red)",description:"Missed activation"}),a.jsx(po,{label:"True Negative",abbr:"TN",count:p.tn,bg:"var(--green-muted)",color:"var(--green)",description:"Correctly silent"})]})]})]}),a.jsx(zC,{history:C,expanded:L,onToggle:()=>$(!L)})]})}function zC({history:n,expanded:l,onToggle:s}){return n===null?null:a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{className:"w-full px-4 py-3 flex items-center justify-between text-left",style:{borderBottom:l?"1px solid var(--border-subtle)":"none"},onClick:s,children:[a.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-widest",style:{color:"var(--text-tertiary)"},children:["Test History",n.length>0&&a.jsxs("span",{className:"ml-2 font-normal",style:{color:"var(--text-tertiary)"},children:["(",n.length," run",n.length!==1?"s":"",")"]})]}),a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:l?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),l&&a.jsx("div",{className:"px-4 py-3",children:n.length===0?a.jsx("div",{className:"text-[12px] py-4 text-center",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):a.jsx("div",{className:"space-y-2",children:n.map(o=>a.jsx(DC,{run:o},o.id))})})]})}function DC({run:n}){const l=Math.round(n.summary.reliability*100),s=l>=80?"var(--green)":l>=60?"var(--yellow)":"var(--red)",o=l>=80?"Good":l>=60?"Needs Work":"Poor",c=s;return a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{background:"var(--surface-1)"},children:[a.jsx("div",{className:"flex-1 min-w-0",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:_C(n.timestamp)}),a.jsx("span",{className:"pill text-[9px] px-1.5",style:{background:"var(--surface-2)",color:"var(--text-tertiary)"},children:n.model||n.provider}),a.jsxs("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[n.promptCount," prompts"]})]})}),a.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:s,fontVariantNumeric:"tabular-nums"},children:[l,"%"]}),a.jsx("span",{className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:c,background:`color-mix(in srgb, ${c} 10%, transparent)`},children:o})]})]})}function _C(n){const l=Date.now(),s=new Date(n).getTime(),o=Math.floor((l-s)/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c}m ago`;const f=Math.floor(c/60);if(f<24)return`${f}h ago`;const d=Math.floor(f/24);return d<7?`${d}d ago`:new Date(n).toLocaleDateString()}function fo(){return a.jsx("span",{style:{color:"var(--border-subtle)",userSelect:"none"},children:"·"})}function Bg({result:n}){const l=Og[n.classification]||Og.FN,s=n.classification==="TP"||n.classification==="TN";return a.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl transition-all duration-200",style:{background:l.bg,border:"1px solid transparent"},children:[a.jsx("div",{className:"flex-shrink-0 mt-0.5",children:a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:`color-mix(in srgb, ${l.text} 20%, transparent)`},children:s?a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:l.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})}):a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:l.text,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1",children:a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:n.prompt})}),a.jsxs("div",{className:"flex items-center gap-3 text-[12px]",children:[a.jsx("span",{className:"pill",style:{background:"var(--surface-3)",color:l.text,fontWeight:700,fontSize:"10px",padding:"1px 6px"},children:n.classification}),a.jsx("span",{style:{color:n.activate?"var(--green)":"var(--text-tertiary)"},children:n.activate?"Activated":"Silent"}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:["Expected: ",n.expected==="should_activate"?"activate":"stay silent"]}),a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[n.confidence," confidence"]}),n.autoClassified&&a.jsx("span",{className:"pill",style:{background:"var(--purple-muted)",color:"var(--purple)",fontSize:"9px",padding:"1px 5px"},children:"auto"})]}),n.reasoning&&a.jsx("div",{className:"text-[11px] mt-1.5",style:{color:"var(--text-tertiary)"},children:n.reasoning})]})]})}function Cd({label:n,value:l,description:s,detail:o}){const c=Math.round(l*100),f=c>=80?"var(--green)":c>=60?"var(--yellow)":"var(--red)";return a.jsxs("div",{className:"text-center",children:[a.jsxs("div",{className:"text-[28px] font-bold tracking-tight",style:{color:f},children:[c,"%"]}),a.jsx("div",{className:"text-[12px] font-medium mt-0.5",style:{color:"var(--text-secondary)"},children:n}),a.jsx("div",{className:"text-[10px] mt-1",style:{color:"var(--text-tertiary)"},children:s}),a.jsx("div",{className:"text-[10px] mt-0.5 font-mono",style:{color:"var(--text-tertiary)"},children:o})]})}function po({abbr:n,count:l,bg:s,color:o,description:c}){return a.jsxs("div",{className:"text-center p-3 rounded-lg",style:{background:s},children:[a.jsx("div",{className:"text-[20px] font-bold",style:{color:o},children:l}),a.jsx("div",{className:"text-[11px] font-semibold",style:{color:o},children:n}),a.jsx("div",{className:"text-[9px] mt-0.5",style:{color:"var(--text-tertiary)"},children:c})]})}function OC({startedAt:n}){const[l,s]=g.useState(0);return g.useEffect(()=>{const o=setInterval(()=>s(Math.floor((Date.now()-n)/1e3)),1e3);return()=>clearInterval(o)},[n]),a.jsxs("span",{className:"ml-2",children:["(",l,"s)"]})}const Ed={benchmark:"#6383ff",comparison:"#a78bfa",baseline:"#fb923c"},Ig={benchmark:"Benchmark",comparison:"Comparison",baseline:"Baseline"},Kd=600,Xd=180,nn=40,Nd=Kd-nn*2,Xa=Xd-nn*2,BC=[25,50,75,100];function Hg(n){return new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function IC(n){return n==null?"--":`${(n/1e3).toFixed(1)}s`}function HC({entries:n,onPointClick:l}){const[s,o]=g.useState(null),c=g.useMemo(()=>[...n].reverse(),[n]);if(c.length<2)return null;const f=c.length,d=c.map((p,y)=>{const v=nn+y/(f-1)*Nd,b=p.passRate*100,j=nn+Xa-b/100*Xa;return{x:v,y:j,pct:b,entry:p}}),h=d.map(p=>`${p.x},${p.y}`).join(" "),x=Array.from(new Set(c.map(p=>p.type)));return a.jsxs("div",{className:"glass-card p-5 animate-fade-in",style:{position:"relative",overflowX:f>=20?"auto":void 0},children:[a.jsx("div",{className:"text-[13px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Pass Rate Trend"}),a.jsx("div",{className:"flex items-center gap-5 mb-3",children:x.map(p=>a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("div",{className:"w-3 h-3 rounded-full",style:{background:Ed[p]??"var(--text-tertiary)"}}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:Ig[p]??p})]},p))}),a.jsxs("svg",{width:Kd,height:Xd,viewBox:`0 0 ${Kd} ${Xd}`,style:{display:"block",overflow:"visible"},children:[BC.map(p=>{const y=nn+Xa-p/100*Xa;return a.jsxs("g",{children:[a.jsx("line",{x1:nn,y1:y,x2:nn+Nd,y2:y,stroke:"var(--border-subtle)",strokeWidth:.5,strokeDasharray:"4 4"}),a.jsxs("text",{x:nn-8,y:y+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:[p,"%"]})]},p)}),a.jsx("line",{x1:nn,y1:nn+Xa,x2:nn+Nd,y2:nn+Xa,stroke:"var(--border-subtle)",strokeWidth:1}),a.jsx("text",{x:nn-8,y:nn+Xa+3.5,textAnchor:"end",style:{fill:"var(--text-tertiary)",fontSize:10},children:"0%"}),a.jsx("polyline",{points:h,fill:"none",stroke:"var(--border-subtle)",strokeWidth:1.5,strokeLinejoin:"round"}),d.map((p,y)=>a.jsx("circle",{cx:p.x,cy:p.y,r:5,fill:Ed[p.entry.type]??"var(--text-tertiary)",stroke:"var(--surface-2)",strokeWidth:2,style:{cursor:"pointer",transition:"r 0.15s ease"},onMouseEnter:v=>{v.currentTarget.setAttribute("r","7"),o({x:p.x,y:p.y,entry:p.entry})},onMouseLeave:v=>{v.currentTarget.setAttribute("r","5"),o(null)},onClick:()=>l==null?void 0:l(p.entry)},y)),UC(f).map(p=>a.jsx("text",{x:d[p].x,y:nn+Xa+16,textAnchor:"middle",style:{fill:"var(--text-tertiary)",fontSize:10},children:Hg(c[p].timestamp)},p))]}),s&&a.jsxs("div",{style:{position:"absolute",left:s.x,top:s.y-12,transform:"translate(-50%, -100%)",background:"var(--surface-3)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"8px 12px",pointerEvents:"none",zIndex:10,whiteSpace:"nowrap"},children:[a.jsx("div",{className:"text-[11px] font-medium",style:{color:"var(--text-primary)"},children:Hg(s.entry.timestamp)}),a.jsx("div",{className:"text-[11px] mt-0.5",style:{color:"var(--text-tertiary)"},children:s.entry.model}),a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[a.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:Ed[s.entry.type]??"var(--text-tertiary)",color:"#fff"},children:Ig[s.entry.type]??s.entry.type}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:"var(--text-primary)"},children:[Math.round(s.entry.passRate*100),"%"]})]}),a.jsxs("div",{className:"text-[10px] mt-1.5 flex items-center gap-3",style:{color:"var(--text-tertiary)"},children:[a.jsx("span",{children:IC(s.entry.totalDurationMs)}),a.jsx("span",{children:s.entry.totalTokens!=null?`${s.entry.totalTokens} tokens`:"--"})]})]})]})}function UC(n){if(n<=3)return Array.from({length:n},(o,c)=>c);if(n<=6)return[0,Math.floor(n/2),n-1];if(n<20)return[0,Math.floor(n/3),Math.floor(2*n/3),n-1];const l=Math.ceil(n/10),s=[0];for(let o=l;o<n-1;o+=l)s.push(o);return s.push(n-1),s}const Ns=new Map;let an=null,ko=null,mo=1e3,Ts=0;function xy(){if(an)return;an=new EventSource("/api/events");const n=l=>s=>{let o={};try{o=s.data?JSON.parse(s.data):{}}catch{}const c=Ns.get(l);if(c)for(const f of c)f(o)};an.addEventListener("benchmark:complete",n("benchmark:complete")),an.addEventListener("history:written",n("history:written")),an.addEventListener("leaderboard:updated",n("leaderboard:updated")),an.onerror=()=>{an==null||an.close(),an=null,Ts>0&&(ko=setTimeout(()=>{mo=Math.min(mo*2,3e4),xy()},mo))},an.onopen=()=>{mo=1e3}}function $C(){ko!=null&&(clearTimeout(ko),ko=null),an==null||an.close(),an=null}function PC(n,l){return Ns.has(n)||Ns.set(n,new Set),Ns.get(n).add(l),Ts++,xy(),()=>{var s;(s=Ns.get(n))==null||s.delete(l),Ts--,Ts<=0&&(Ts=0,$C())}}function Ro(n,l){const s=g.useRef(l);s.current=l,g.useEffect(()=>PC(n,c=>s.current(c)),[n])}function Ao(n){return n>=.8?"var(--green)":n>=.5?"var(--yellow)":"var(--red)"}function VC(n){return n>=1e3?`${(n/1e3).toFixed(1)}s`:`${Math.round(n)}ms`}function FC({rate:n,label:l}){const s=Math.round(n*100);return a.jsx("div",{className:"flex items-center gap-3",children:a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-[11px] truncate",style:{color:"var(--text-primary)",maxWidth:"70%"},children:l}),a.jsxs("span",{className:"text-[11px] font-semibold",style:{color:Ao(n)},children:[s,"%"]})]}),a.jsx("div",{className:"h-1.5 rounded-full overflow-hidden",style:{background:"var(--surface-3)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${s}%`,background:Ao(n)}})})]})})}function GC({points:n}){if(n.length<2)return null;const l=200,s=48,o=4,c=n.length,f=n.map((x,p)=>{const y=o+p/(c-1)*(l-o*2),v=o+(s-o*2)-x.passRate*(s-o*2);return{x:y,y:v}}),d=`M ${f[0].x},${s-o} `+f.map(x=>`L ${x.x},${x.y}`).join(" ")+` L ${f[f.length-1].x},${s-o} Z`,h=f.map((x,p)=>`${p===0?"M":"L"} ${x.x},${x.y}`).join(" ");return a.jsxs("svg",{width:l,height:s,style:{display:"block"},children:[a.jsx("path",{d,fill:"var(--accent-muted)"}),a.jsx("path",{d:h,fill:"none",stroke:"var(--accent)",strokeWidth:1.5,strokeLinejoin:"round"}),a.jsx("circle",{cx:f[f.length-1].x,cy:f[f.length-1].y,r:3,fill:"var(--accent)"})]})}function WC({plugin:n,skill:l}){const s=`stats/${n}/${l}`,o=g.useCallback(()=>Ne.getStats(n,l),[n,l]),{data:c,loading:f}=Cl(s,o),d=g.useCallback(()=>rn(s),[s]);if(Ro("benchmark:complete",d),Ro("history:written",d),f)return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"skeleton h-24 rounded-xl"}),a.jsx("div",{className:"skeleton h-48 rounded-xl"}),a.jsx("div",{className:"skeleton h-36 rounded-xl"})]});if(!c||c.totalRuns===0)return a.jsxs("div",{className:"text-center py-12",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center mx-auto mb-3",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark data yet"}),a.jsx("p",{className:"text-[11px] mt-1",style:{color:"var(--text-tertiary)"},children:"Run some benchmarks to see statistics"})]});const h=c.trendPoints.length>0?c.trendPoints[c.trendPoints.length-1].passRate:0,x=c.trendPoints.length>0?c.trendPoints[0].passRate:0,p=h-x,y=c.assertionStats.slice(0,10);return a.jsxs("div",{className:"space-y-4 stagger-children",children:[a.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Runs"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.totalRuns})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Latest Pass Rate"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:Ao(h)},children:[Math.round(h*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Trend"}),a.jsxs("div",{className:"text-[24px] font-bold",style:{color:p>=0?"var(--green)":"var(--red)"},children:[p>=0?"+":"",Math.round(p*100),"%"]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Models Tested"}),a.jsx("div",{className:"text-[24px] font-bold",style:{color:"var(--text-primary)"},children:c.modelStats.length})]}),c.totalCost!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Total Cost"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:wn(c.totalCost)})]}),c.costPerRun!=null&&a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("div",{className:"text-[10px] uppercase tracking-widest font-semibold mb-1",style:{color:"var(--text-tertiary)"},children:"Avg Cost/Run"}),a.jsx("div",{className:"text-[20px] font-bold",style:{color:"var(--text-primary)"},children:wn(c.costPerRun)})]})]}),c.trendPoints.length>=2&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Pass Rate Over Time"}),a.jsx(GC,{points:c.trendPoints})]}),c.modelStats.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Model Performance"}),a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("th",{style:{textAlign:"left",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Model"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Runs"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Pass Rate"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Duration"}),a.jsx("th",{style:{textAlign:"center",padding:"6px 8px",color:"var(--text-tertiary)",fontWeight:600,fontSize:11},children:"Avg Cost"})]})}),a.jsx("tbody",{children:c.modelStats.map(v=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("td",{style:{padding:"8px",color:"var(--text-primary)",fontWeight:500},children:v.model}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.runs}),a.jsx("td",{style:{padding:"8px",textAlign:"center"},children:a.jsxs("span",{className:"font-semibold",style:{color:Ao(v.avgPassRate)},children:[Math.round(v.avgPassRate*100),"%"]})}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:VC(v.avgDurationMs)}),a.jsx("td",{style:{padding:"8px",textAlign:"center",fontFamily:"var(--font-mono, monospace)",color:"var(--text-secondary)"},children:v.avgCost!=null?wn(v.avgCost):"N/A"})]},v.model))})]})]}),y.length>0&&a.jsxs("div",{className:"glass-card p-5",children:[a.jsx("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Weakest Assertions"}),a.jsx("div",{className:"space-y-3",children:y.map(v=>a.jsxs("button",{className:"block w-full text-left rounded-lg p-2 -mx-2 transition-colors duration-150",style:{background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--surface-2)"},onMouseLeave:b=>{b.currentTarget.style.background="transparent"},onClick:()=>{},children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsxs("span",{className:"text-[10px] font-mono px-1 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.evalId]}),a.jsx("span",{className:"text-[10px] truncate",style:{color:"var(--text-tertiary)"},children:v.evalName}),a.jsxs("span",{className:"text-[10px] ml-auto flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[v.totalRuns," runs"]})]}),a.jsx(FC,{rate:v.passRate,label:v.text})]},`${v.evalId}:${v.id}`))})]})]})}function qC({plugin:n,skill:l}){const[s,o]=g.useState(null),[c,f]=g.useState(null),[d,h]=g.useState({}),[x,p]=g.useState({});g.useEffect(()=>{Ne.getEvals(n,l).then(o).catch(()=>o(null))},[n,l]);async function y(v){if(c===v){f(null);return}if(f(v),!d[v]){p(b=>({...b,[v]:!0}));try{const b=await Ne.getCaseHistory(n,l,v);h(j=>({...j,[v]:b}))}catch{h(b=>({...b,[v]:[]}))}finally{p(b=>({...b,[v]:!1}))}}}return s?a.jsx("div",{className:"space-y-2 stagger-children",children:s.evals.map(v=>{const b=d[v.id]||[],j=c===v.id,k=x[v.id],N=b.length>0?b[0].pass_rate:null;return a.jsxs("div",{className:"glass-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>y(v.id),className:"w-full text-left p-4 flex items-center gap-3 transition-colors duration-150",style:{background:j?"var(--surface-2)":"transparent"},onMouseEnter:C=>{j||(C.currentTarget.style.background="var(--surface-2)")},onMouseLeave:C=>{j||(C.currentTarget.style.background="transparent")},children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2.5",strokeLinecap:"round",style:{transform:j?"rotate(90deg)":"rotate(0)",transition:"transform 0.2s ease",flexShrink:0},children:a.jsx("polyline",{points:"9 18 15 12 9 6"})}),a.jsxs("span",{className:"text-[11px] font-mono px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:["#",v.id]}),a.jsx("span",{className:"text-[13px] font-medium flex-1 truncate",style:{color:"var(--text-primary)"},children:v.name}),b.length>=2&&a.jsx(dy,{entries:b}),N!=null&&a.jsxs("span",{className:"text-[12px] font-semibold flex-shrink-0",style:{color:Sl(N)},children:[Math.round(N*100),"%"]}),b.length>0&&a.jsxs("span",{className:"text-[10px] flex-shrink-0",style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono, monospace)"},children:[b.length," runs"]})]}),j&&a.jsx("div",{className:"border-t animate-fade-in",style:{borderColor:"var(--border-subtle)"},children:k?a.jsxs("div",{className:"p-4 flex items-center gap-2",children:[a.jsx("div",{className:"spinner",style:{width:14,height:14}}),a.jsx("span",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Loading history..."})]}):b.length===0?a.jsx("div",{className:"p-4",children:a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"No history for this eval case"})}):a.jsx("div",{className:"divide-y",style:{borderColor:"var(--border-subtle)"},children:b.map((C,w)=>a.jsxs("div",{className:"p-4",style:{background:w===0?"var(--surface-2)":"transparent"},children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:cy(C.timestamp)}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:C.model}),a.jsx("span",{className:"pill",style:{fontSize:9,padding:"1px 6px",background:C.type==="benchmark"?"rgba(99,131,255,0.15)":C.type==="comparison"?"var(--purple-muted)":"rgba(251,146,60,0.15)",color:C.type==="benchmark"?"#6383ff":C.type==="comparison"?"var(--purple)":"#fb923c"},children:C.type}),a.jsxs("span",{className:"text-[12px] font-semibold ml-auto",style:{color:Sl(C.pass_rate)},children:[Math.round(C.pass_rate*100),"%"]})]}),a.jsxs("div",{className:"flex items-center gap-4 mb-2 text-[10px]",style:{fontFamily:"var(--font-mono, monospace)",color:"var(--text-tertiary)"},children:[C.durationMs!=null&&a.jsx("span",{children:uy(C.durationMs)}),C.tokens!=null&&a.jsxs("span",{children:[C.tokens>=1e3?`${(C.tokens/1e3).toFixed(1)}k`:C.tokens," tok"]})]}),a.jsx("div",{className:"space-y-1",children:C.assertions.map(A=>a.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[a.jsx("div",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",style:{background:A.pass?"var(--green)":"var(--red)"},children:a.jsx("svg",{width:"7",height:"7",viewBox:"0 0 24 24",fill:"none",stroke:"#fff",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",children:A.pass?a.jsx("polyline",{points:"20 6 9 17 4 12"}):a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"text-[11px]",style:{color:"var(--text-primary)"},children:A.text}),A.reasoning&&a.jsx("div",{className:"text-[10px] mt-0.5",style:{color:"var(--text-tertiary)"},children:A.reasoning})]})]},A.id))})]},w))})})]},v.id)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"No eval cases found"})})}function YC(){const{state:n,dispatch:l}=Cn(),{plugin:s,skill:o}=n,[c,f]=g.useState("timeline"),[d,h]=g.useState(""),[x,p]=g.useState(""),[y,v]=g.useState(!1),[b,j]=g.useState([]),[k,N]=g.useState(null),[C,w]=g.useState(!1),[A,_]=g.useState(null),[H,L]=g.useState(!1),$=`history/${s}/${o}?model=${d}&type=${x}`,E=g.useCallback(()=>Ne.getHistory(s,o,{model:d||void 0,type:x||void 0}),[s,o,d,x]),{data:D,loading:R}=Cl($,E),B=D??[];g.useEffect(()=>{!D||D.length<2||Ne.compareRuns(s,o,D[0].timestamp,D[1].timestamp).then(z=>{const M=z.regressions.filter(I=>I.change==="regression");l({type:"SET_REGRESSIONS",regressions:M})}).catch(()=>{})},[D,s,o,l]);const P=g.useCallback(()=>rn($),[$]);Ro("history:written",P);const W=g.useCallback(async z=>{if(y){j(M=>M.includes(z)?M.filter(I=>I!==z):M.length>=2?[M[1],z]:[...M,z]);return}L(!0);try{const M=await Ne.getHistoryEntry(s,o,z);_(M)}catch{}finally{L(!1)}},[s,o,y]),te=g.useCallback(async()=>{if(b.length===2){w(!0);try{const z=await Ne.compareRuns(s,o,b[0],b[1]);N(z)}catch{}finally{w(!1)}}},[s,o,b]),Q=[...new Set(B.map(z=>z.model))];return R?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-48 rounded-xl mb-4"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"skeleton h-12 rounded-lg"}),a.jsx("div",{className:"skeleton h-12 rounded-lg"})]})]}):a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"flex items-center gap-1 mb-4",children:["timeline","per-eval","statistics"].map(z=>a.jsx("button",{onClick:()=>f(z),className:"px-4 py-2 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:c===z?"var(--accent-muted)":"transparent",color:c===z?"var(--accent)":"var(--text-tertiary)"},children:z==="timeline"?"Timeline":z==="per-eval"?"Per Eval":"Statistics"},z))}),c==="timeline"&&a.jsxs("div",{children:[B.length>0&&a.jsx("div",{className:"mb-5 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:a.jsx(HC,{entries:B,onPointClick:z=>W(z.timestamp)})}),a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsxs("select",{value:d,onChange:z=>h(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Models"}),Q.map(z=>a.jsx("option",{value:z,children:z},z))]}),a.jsxs("select",{value:x,onChange:z=>p(z.target.value),className:"input-field text-[12px]",style:{width:150},children:[a.jsx("option",{value:"",children:"All Types"}),a.jsx("option",{value:"benchmark",children:"Benchmark"}),a.jsx("option",{value:"comparison",children:"Comparison"}),a.jsx("option",{value:"baseline",children:"Baseline"}),a.jsx("option",{value:"model-compare",children:"Model Compare"}),a.jsx("option",{value:"improve",children:"AI Improve"}),a.jsx("option",{value:"instruct",children:"AI Edit"}),a.jsx("option",{value:"ai-generate",children:"AI Generate"}),a.jsx("option",{value:"eval-generate",children:"Eval Generate"})]}),a.jsx("div",{className:"flex-1"}),a.jsx("button",{onClick:()=>{v(!y),j([]),N(null)},className:`btn text-[12px] ${y?"btn-primary":"btn-secondary"}`,children:y?"Exit Compare":"Compare Runs"}),y&&b.length===2&&a.jsx("button",{onClick:te,disabled:C,className:"btn btn-primary text-[12px]",children:C?"Comparing...":"Compare"})]}),a.jsx("div",{className:"space-y-2",children:B.length===0?a.jsx("div",{className:"text-center py-8 text-[13px]",style:{color:"var(--text-tertiary)"},children:"No benchmark runs yet"}):B.map(z=>{const M=b.includes(z.timestamp);return a.jsx("button",{onClick:()=>W(z.timestamp),className:"w-full text-left rounded-lg px-4 py-3 transition-all duration-150",style:{background:M?"var(--accent-muted)":"var(--surface-1)",border:M?"1px solid var(--accent)":"1px solid var(--border-subtle)"},onMouseEnter:I=>{M||(I.currentTarget.style.borderColor="var(--border-hover)")},onMouseLeave:I=>{M||(I.currentTarget.style.borderColor="var(--border-subtle)")},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[y&&a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:M?"var(--accent)":"var(--border-default)",background:M?"var(--accent)":"transparent"},children:M&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:new Date(z.timestamp).toLocaleString()}),a.jsx("span",{className:"pill text-[9px]",style:{background:z.type==="comparison"?"var(--purple-muted)":z.type==="baseline"?"var(--surface-3)":z.type==="model-compare"?"var(--accent-muted)":z.type==="improve"||z.type==="instruct"?"var(--purple-muted)":z.type==="ai-generate"?"var(--green-muted)":z.type==="eval-generate"?"var(--orange-muted)":"var(--accent-muted)",color:z.type==="comparison"?"var(--purple)":z.type==="baseline"?"var(--text-tertiary)":z.type==="model-compare"?"var(--accent)":z.type==="improve"||z.type==="instruct"?"var(--purple)":z.type==="ai-generate"?"var(--green)":z.type==="eval-generate"?"var(--orange)":"var(--accent)"},children:z.type==="model-compare"?"model compare":z.type==="improve"?"ai improve":z.type==="instruct"?"ai edit":z.type==="ai-generate"?"ai generate":z.type==="eval-generate"?"eval generate":z.type})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:z.model}),z.totalCost!=null&&z.totalCost>0&&a.jsx("span",{className:"text-[11px] font-mono",style:{color:"var(--text-tertiary)"},children:wn(z.totalCost)}),a.jsxs("span",{className:"text-[12px] font-semibold",style:{color:z.passRate>=.8?"var(--green)":z.passRate>=.5?"var(--yellow)":"var(--red)"},children:[Math.round(z.passRate*100),"%"]})]})]})},z.timestamp)})}),k&&a.jsx(KC,{result:k}),A&&!y&&a.jsx(XC,{run:A,onClose:()=>_(null)})]}),c==="per-eval"&&a.jsx(qC,{plugin:s,skill:o}),c==="statistics"&&a.jsx(WC,{plugin:s,skill:o})]})}function KC({result:n}){const l=n.regressions.filter(o=>o.change==="regression"),s=n.regressions.filter(o=>o.change==="improvement");return a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:["Comparison: ",new Date(n.runA.timestamp).toLocaleDateString()," vs ",new Date(n.runB.timestamp).toLocaleDateString()]}),(n.runA.totalCost!=null||n.runB.totalCost!=null)&&a.jsxs("div",{className:"flex items-center gap-4 mb-3 text-[11px]",style:{color:"var(--text-secondary)"},children:[a.jsxs("span",{children:["Run A cost: ",wn(n.runA.totalCost??null)]}),a.jsxs("span",{children:["Run B cost: ",wn(n.runB.totalCost??null)]}),n.runA.totalCost!=null&&n.runB.totalCost!=null&&a.jsxs("span",{style:{color:n.runB.totalCost<=n.runA.totalCost?"var(--green)":"var(--red)"},children:["Delta: ",wn(n.runB.totalCost-n.runA.totalCost)]})]}),l.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--red)"},children:["Regressions (",l.length,")"]}),l.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--red)"},children:o.assertionId})," (was passing, now failing)"]},`${o.evalId}-${o.assertionId}`))]}),s.length>0&&a.jsxs("div",{className:"mb-3",children:[a.jsxs("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-1",style:{color:"var(--green)"},children:["Improvements (",s.length,")"]}),s.map(o=>a.jsxs("div",{className:"text-[12px] py-1",style:{color:"var(--text-secondary)"},children:["#",o.evalId," ",o.evalName,": ",a.jsx("span",{style:{color:"var(--green)"},children:o.assertionId})," (was failing, now passing)"]},`${o.evalId}-${o.assertionId}`))]}),a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2 mt-3",style:{color:"var(--text-tertiary)"},children:"Case Diffs"}),a.jsx("div",{className:"rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:a.jsxs("table",{className:"w-full text-[12px]",children:[a.jsx("thead",{children:a.jsxs("tr",{style:{background:"var(--surface-2)"},children:[a.jsx("th",{className:"text-left px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Case"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run A"}),a.jsx("th",{className:"text-right px-3 py-2 font-medium",style:{color:"var(--text-tertiary)"},children:"Run B"})]})}),a.jsx("tbody",{children:n.caseDiffs.map(o=>a.jsxs("tr",{style:{borderTop:"1px solid var(--border-subtle)"},children:[a.jsxs("td",{className:"px-3 py-2",style:{color:"var(--text-secondary)"},children:["#",o.eval_id," ",o.eval_name]}),a.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}),a.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 XC({run:n,onClose:l}){return(n.type==="improve"||n.type==="instruct")&&n.improve?a.jsx(QC,{run:n,onClose:l}):a.jsxs("div",{className:"mt-4 rounded-xl p-4",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:["Run: ",new Date(n.timestamp).toLocaleString()]}),a.jsx("button",{onClick:l,className:"btn btn-ghost text-[11px]",children:"Close"})]}),a.jsxs("div",{className:"text-[11px] mb-3",style:{color:"var(--text-tertiary)"},children:["Model: ",n.model," | Cases: ",n.cases.length," | Pass Rate: ",n.overall_pass_rate!=null?`${Math.round(n.overall_pass_rate*100)}%`:"--",n.totalCost!=null&&n.totalCost>0&&` | Cost: ${wn(n.totalCost)}`]}),a.jsx("div",{className:"space-y-2",children:n.cases.map(s=>a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-2)"},children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[12px]",style:{color:"var(--text-secondary)"},children:["#",s.eval_id," ",s.eval_name]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s.cost!=null&&s.cost>0&&a.jsx("span",{className:"text-[10px] font-mono",style:{color:"var(--text-tertiary)"},children:wn(s.cost)}),a.jsx("span",{className:"text-[11px] font-semibold",style:{color:s.status==="pass"?"var(--green)":"var(--red)"},children:s.pass_rate!=null?`${Math.round(s.pass_rate*100)}%`:s.status})]})]})},s.eval_id))})]})}function QC({run:n,onClose:l}){var f;const s=g.useMemo(()=>n.improve?Po(n.improve.original,n.improve.improved):[],[n.improve]),o=g.useMemo(()=>{const d=s.filter(x=>x.type==="added").length,h=s.filter(x=>x.type==="removed").length;return{added:d,removed:h}},[s]),c=g.useMemo(()=>{let d=0,h=0;return s.map(x=>x.type==="removed"?(d++,{...x,origNum:d,newNum:null}):x.type==="added"?(h++,{...x,origNum:null,newNum:h}):(d++,h++,{...x,origNum:d,newNum:h}))},[s]);return a.jsxs("div",{className:"mt-4 rounded-xl overflow-hidden animate-fade-in",style:{background:"var(--surface-1)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{background:"var(--purple-muted)"},children:a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--purple)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),a.jsx("path",{d:"M2 17l10 5 10-5"}),a.jsx("path",{d:"M2 12l10 5 10-5"})]})}),a.jsxs("div",{children:[a.jsx("div",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md Changes"}),a.jsxs("div",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[new Date(n.timestamp).toLocaleString()," · ",n.model]})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{style:{color:"var(--green)"},children:["+",o.added]}),a.jsxs("span",{style:{color:"var(--red)"},children:["-",o.removed]})]}),a.jsx("button",{onClick:l,className:"w-7 h-7 rounded-lg flex items-center justify-center transition-colors duration-150",style:{color:"var(--text-tertiary)"},onMouseEnter:d=>{d.currentTarget.style.background="var(--surface-3)"},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),((f=n.improve)==null?void 0:f.reasoning)&&a.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:[a.jsx("span",{className:"font-semibold",style:{color:"var(--purple)"},children:"AI Reasoning: "}),n.improve.reasoning]}),a.jsx("div",{className:"mx-4 my-4 rounded-lg overflow-hidden",style:{border:"1px solid var(--border-subtle)",maxHeight:480,overflowY:"auto"},children:a.jsx("table",{className:"w-full",style:{borderCollapse:"collapse",fontFamily:"var(--font-mono, monospace)"},children:a.jsx("tbody",{children:c.map((d,h)=>a.jsxs("tr",{style:{background:d.type==="added"?"var(--green-muted)":d.type==="removed"?"var(--red-muted)":"transparent"},children:[a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="removed"?"var(--red)":"var(--text-tertiary)",opacity:d.origNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.origNum??""}),a.jsx("td",{className:"text-right select-none px-2",style:{width:40,fontSize:10,color:d.type==="added"?"var(--green)":"var(--text-tertiary)",opacity:d.newNum?.6:.2,borderRight:"1px solid var(--border-subtle)"},children:d.newNum??""}),a.jsx("td",{className:"select-none text-center",style:{width:20,fontSize:11,fontWeight:700,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"transparent",borderRight:d.type==="added"?"2px solid var(--green)":d.type==="removed"?"2px solid var(--red)":"2px solid transparent"},children:d.type==="added"?"+":d.type==="removed"?"-":" "}),a.jsx("td",{className:"px-3 py-px whitespace-pre-wrap",style:{fontSize:11,lineHeight:1.6,color:d.type==="added"?"var(--green)":d.type==="removed"?"var(--red)":"var(--text-secondary)"},children:d.content||"​"})]},h))})})})]})}function ZC({plugin:n,skill:l}){const[s,o]=g.useState([]),[c,f]=g.useState([]),[d,h]=g.useState(!0),[x,p]=g.useState(null);g.useEffect(()=>{Ne.getDependencies(n,l).then(v=>{o(v.mcpDependencies),f(v.skillDependencies)}).catch(()=>{}).finally(()=>h(!1))},[n,l]);async function y(v,b){try{await navigator.clipboard.writeText(b),p(v),setTimeout(()=>p(null),2e3)}catch{}}return d?null:s.length===0&&c.length===0?a.jsx("div",{className:"mb-5 px-4 py-3 rounded-lg text-[12px]",style:{background:"var(--surface-2)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:"No dependencies detected"}):a.jsxs("div",{className:"mb-5 rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsxs("div",{className:"flex items-center gap-2.5 px-5 py-3.5",style:{background:"var(--surface-2)",borderBottom:"1px solid var(--border-subtle)"},children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"rgba(234,179,8,0.15)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}),a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"Dependencies"}),a.jsx("span",{className:"pill text-[10px]",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:s.length+c.length})]}),a.jsxs("div",{className:"px-5 py-4",children:[s.length>0&&a.jsxs("div",{className:"space-y-3 mb-4",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"MCP Servers"}),s.map(v=>a.jsxs("div",{className:"p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:v.server}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.transport})]}),a.jsx("button",{onClick:()=>y(v.server,v.configSnippet),className:"btn btn-ghost text-[11px] py-1 px-2",style:{color:x===v.server?"var(--green)":"var(--accent)"},children:x===v.server?a.jsxs(a.Fragment,{children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})," Copied!"]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})," Copy Config"]})})]}),a.jsx("div",{className:"text-[11px] mb-2 font-mono",style:{color:"var(--text-tertiary)"},children:v.url}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.matchedTools.map(b=>a.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-mono",style:{background:"var(--surface-3)",color:"var(--text-secondary)"},children:b},b))})]},v.server))]}),c.length>0&&a.jsxs("div",{children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Skill Dependencies"}),a.jsx("div",{className:"space-y-1.5",children:c.map(v=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:v.name}),a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{background:"var(--surface-3)",color:"var(--text-tertiary)"},children:v.source==="frontmatter"?"frontmatter":"referenced"})]},v.name))})]})]})]})}function Ug({plugin:n,skill:l}){const[s,o]=g.useState([]),[c,f]=g.useState(!0),[d,h]=g.useState(null),[x,p]=g.useState(""),[y,v]=g.useState(!1),[b,j]=g.useState(null),[k,N]=g.useState(""),[C,w]=g.useState(""),[A,_]=g.useState(!1),[H,L]=g.useState(new Set),$=g.useCallback(async()=>{f(!0);try{const[B,P]=await Promise.all([Ne.getCredentials(n,l).catch(()=>({credentials:[]})),Ne.getParams(n,l).catch(()=>({params:[]}))]),W=new Map(P.params.map(z=>[z.name,z])),te=new Set,Q=[];for(const z of B.credentials){te.add(z.name);const M=W.get(z.name);Q.push({name:z.name,status:z.status==="ready"||z.status==="resolved"?"ready":"missing",source:z.source,maskedValue:M==null?void 0:M.maskedValue})}for(const z of P.params)te.has(z.name)||Q.push({name:z.name,status:z.status,maskedValue:z.maskedValue});o(Q)}finally{f(!1)}},[n,l]);g.useEffect(()=>{$()},[$]);const E=g.useCallback(async B=>{if(H.has(B)){L(P=>{const W=new Set(P);return W.delete(B),W}),o(P=>P.map(W=>W.name===B?{...W,revealedValue:void 0}:W));return}try{const W=(await Ne.getParamsRevealed(n,l,B)).params.find(te=>te.name===B);W&&(o(te=>te.map(Q=>Q.name===B?{...Q,revealedValue:W.value}:Q)),L(te=>new Set(te).add(B)))}catch{}},[n,l,H]),D=async(B,P)=>{if(!(!B.trim()||!P.trim())){v(!0),j(null);try{await Ne.setCredential(n,l,B,P),h(null),p(""),L(new Set),$()}catch(W){j(W.message)}finally{v(!1)}}},R=async()=>{if(!(!k.trim()||!C.trim())){v(!0),j(null);try{await Ne.setCredential(n,l,k.trim().toUpperCase(),C),N(""),w(""),_(!1),$()}catch(B){j(B.message)}finally{v(!1)}}};return c?a.jsxs("div",{className:"mt-6",children:[a.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wider mb-2",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("div",{className:"skeleton h-20 rounded-xl"})]}):a.jsxs("div",{className:"mt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Parameters & Secrets"}),a.jsx("button",{onClick:()=>_(!A),className:"text-[11px] transition-colors duration-150",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"+ Add Parameter"})]}),b&&a.jsx("div",{className:"mb-2 px-3 py-2 rounded-lg text-[11px]",style:{background:"var(--red-muted)",color:"var(--red)"},children:b}),s.length===0&&!A?a.jsx("div",{className:"text-[12px] text-center py-6 rounded-xl",style:{color:"var(--text-tertiary)",background:"var(--surface-2)"},children:"No credentials configured for this skill"}):a.jsx("div",{className:"rounded-xl overflow-hidden",style:{border:"1px solid var(--border-subtle)"},children:s.map(B=>a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",style:{borderBottom:"1px solid var(--border-subtle)",background:"var(--surface-1)"},children:[a.jsx("span",{className:"text-[11px] font-mono font-medium truncate",style:{color:"var(--text-primary)",minWidth:80},children:B.name}),B.maskedValue&&a.jsx("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)",maxWidth:120},children:H.has(B.name)&&B.revealedValue!=null?B.revealedValue:B.maskedValue}),B.maskedValue&&a.jsx("button",{onClick:()=>E(B.name),className:"btn btn-ghost px-1",title:H.has(B.name)?"Hide value":"Reveal value",style:{color:"var(--text-tertiary)",lineHeight:1},children:H.has(B.name)?a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"}),a.jsx("path",{d:"M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),a.jsx("span",{className:"text-[10px] font-semibold px-2 py-0.5 rounded-full",style:{background:B.status==="ready"?"var(--green-muted)":"var(--orange-muted)",color:B.status==="ready"?"var(--green)":"var(--orange)"},children:B.status==="ready"?"ready":"missing"}),B.source&&a.jsx("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:B.source}),d===B.name?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("input",{value:x,onChange:P=>p(P.target.value),onKeyDown:P=>{P.key==="Enter"&&D(B.name,x)},className:"input-field text-[11px] font-mono",style:{width:160},placeholder:"Value...",autoFocus:!0}),a.jsx("button",{onClick:()=>D(B.name,x),disabled:y||!x.trim(),className:"btn btn-primary text-[10px] px-2 py-0.5",children:y?"...":"Save"}),a.jsx("button",{onClick:()=>{h(null),p("")},className:"btn btn-ghost text-[10px] px-1",children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}):a.jsx("button",{onClick:()=>{h(B.name),p("")},className:"btn btn-ghost text-[10px] px-2 py-0.5",style:{color:"var(--accent)"},children:"Edit"})]},B.name))}),A&&a.jsxs("div",{className:"mt-2 p-3 rounded-lg",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsxs("div",{className:"flex gap-2 mb-2",children:[a.jsx("input",{value:k,onChange:B=>N(B.target.value),className:"input-field flex-1 text-[11px] font-mono",placeholder:"KEY_NAME",autoFocus:!0}),a.jsx("input",{value:C,onChange:B=>w(B.target.value),onKeyDown:B=>{B.key==="Enter"&&R()},className:"input-field flex-1 text-[11px] font-mono",placeholder:"Value",type:"password"})]}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{onClick:()=>{_(!1),N(""),w("")},className:"btn btn-ghost text-[10px]",children:"Cancel"}),a.jsx("button",{onClick:R,disabled:y||!k.trim()||!C.trim(),className:"btn btn-primary text-[10px]",children:y?"Saving...":"Save"})]})]})]})}function JC(){const{state:n}=Cn(),{plugin:l,skill:s}=n,[o,c]=g.useState(null),[f,d]=g.useState(!0);return g.useEffect(()=>{Ne.getDependencies(l,s).then(c).catch(()=>{}).finally(()=>d(!1))},[l,s]),f?a.jsxs("div",{className:"p-5",children:[a.jsx("div",{className:"skeleton h-5 w-32 mb-4"}),a.jsx("div",{className:"skeleton h-32 rounded-xl"})]}):o?a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx(ZC,{plugin:l,skill:s}),a.jsx(Ug,{plugin:l,skill:s})]}):a.jsxs("div",{className:"p-5 max-w-3xl",children:[a.jsx("div",{className:"text-[13px] mb-4",style:{color:"var(--text-tertiary)"},children:"No MCP dependency information available"}),a.jsx(Ug,{plugin:l,skill:s})]})}function gy({data:n}){if(n.length<2)return a.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:"--"});const l=n.slice(-10),s=80,o=24,c=2,f=s-c*2,d=o-c*2,h=l.length,x=Math.min(...l),y=Math.max(...l)-x||1,v=l.map((k,N)=>{const C=c+N/(h-1)*f,w=c+d-(k-x)/y*d;return`${C.toFixed(1)},${w.toFixed(1)}`}),b=l[l.length-1],j=Sl(b);return a.jsxs("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`,style:{display:"block"},children:[a.jsx("polyline",{points:v.join(" "),fill:"none",stroke:j,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}),(()=>{const[k,N]=v[v.length-1].split(",");return a.jsx("circle",{cx:k,cy:N,r:2.5,fill:j})})()]})}function eE(){return a.jsxs("span",{className:"pill",style:{background:"var(--yellow-muted)",color:"var(--yellow)",fontSize:9,fontWeight:700,gap:3},children:[a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"var(--yellow)",stroke:"none",children:a.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),"Best Model"]})}function tE({pct:n}){const l=n>=10?"var(--green)":n>=0?"var(--yellow)":"var(--red)",s=n>=10?"var(--green-muted)":n>=0?"var(--yellow-muted)":"var(--red-muted)",o=n>=0?"+":"";return a.jsxs("span",{className:"pill",style:{background:s,color:l,fontSize:10,fontWeight:600},children:[o,n.toFixed(1),"%"]})}function nE({score:n,rating:l}){const s={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=s[l]??s.minimal,c=n>=0?"+":"";return a.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[a.jsx("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:"Skill Quality:"}),a.jsxs("span",{className:"pill",style:{background:o.bg,color:o.fg,fontSize:11,fontWeight:600},children:[c,n.toFixed(1),"% (",l.toUpperCase(),")"]})]})}function aE({warning:n}){return a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg mb-3",style:{background:"var(--yellow-muted)",border:"1px solid var(--yellow-muted)"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--yellow)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),a.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),a.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),a.jsx("span",{className:"text-[11px]",style:{color:"var(--yellow)"},children:n})]})}function rE({active:n,onChange:l,hasBaseline:s}){return a.jsxs("div",{className:"flex gap-1 p-0.5 rounded-lg",style:{background:"var(--surface-2)"},children:[a.jsx("button",{onClick:()=>l("rankings"),className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:n==="rankings"?"var(--surface-3)":"transparent",color:n==="rankings"?"var(--text-primary)":"var(--text-tertiary)"},children:"Rankings"}),a.jsx("button",{onClick:()=>l("amplification"),disabled:!s,className:"px-3 py-1 rounded-md text-[11px] font-medium transition-all",style:{background:n==="amplification"?"var(--surface-3)":"transparent",color:s&&n==="amplification"?"var(--text-primary)":"var(--text-tertiary)",opacity:s?1:.5,cursor:s?"pointer":"not-allowed"},title:s?"View skill amplification data":"Run sweep with --baseline to see amplification data",children:"Skill Amplification"})]})}function lE(n){var o,c,f;if(n.length===0)return[];const l=new Map;for(const d of n)for(const h of d.models){if(h.status==="error")continue;const x=`${h.provider}/${h.model}`;l.has(x)||l.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=l.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=((c=h.cost)==null?void 0:c.total)??null,p.lastCompositeScore=h.compositeScore,h.baselinePassRate!=null&&(p.lastBaselinePassRate=h.baselinePassRate.mean,p.lastSkillDelta=(f=h.skillDelta)==null?void 0:f.mean,p.lastAmplificationPct=h.amplificationPct,p.hasBaseline=!0)}const s=[];for(const[d,h]of l){const[x,...p]=d.split("/");s.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 s.sort((d,h)=>{const x=d.compositeScore??d.passRate;return(h.compositeScore??h.passRate)-x}),s.forEach((d,h)=>{d.rank=h+1}),s.length>0&&(s[0].isBest=!0),s}const vy=(n="left")=>({padding:"10px 12px",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--text-tertiary)",textAlign:n,whiteSpace:"nowrap"});function sE({entries:n}){return a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","Pass Rate","Rubric","Duration","Cost","Trend"].map(l=>a.jsx("th",{style:vy(l==="#"?"center":"left"),children:l},l))})}),a.jsx("tbody",{children:n.map(l=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:s=>{s.currentTarget.style.background="var(--surface-2)"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:l.rank}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:l.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:l.provider}),l.isBest&&a.jsx(eE,{})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:l.passRate>=.7?"var(--green-muted)":l.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Sl(l.passRate),fontSize:11,fontWeight:600},children:[Math.round(l.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:l.rubricScore!=null?l.rubricScore.toFixed(1):"--"}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:l.duration<1e3?`${Math.round(l.duration)}ms`:`${(l.duration/1e3).toFixed(1)}s`}),a.jsx("td",{style:{padding:"10px 12px",fontSize:12,color:"var(--text-secondary)"},children:l.cost!=null?`$${l.cost.toFixed(4)}`:"N/A"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(gy,{data:l.sparklineData})})]},`${l.provider}/${l.model}`))})]})})}function iE({entries:n}){const l=[...n].filter(s=>s.hasBaseline).sort((s,o)=>(o.amplificationPct??0)-(s.amplificationPct??0));return l.length===0?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("div",{className:"text-center",children:a.jsxs("div",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:["No baseline data available. Run sweep with ",a.jsx("code",{children:"--baseline"})," flag."]})})}):a.jsx("div",{className:"glass-card",style:{overflow:"hidden"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[a.jsx("thead",{children:a.jsx("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},children:["#","Model","With Skill","Without Skill","Delta","Amplification","Trend"].map(s=>a.jsx("th",{style:vy(s==="#"?"center":"left"),children:s},s))})}),a.jsx("tbody",{children:l.map((s,o)=>a.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)"},onMouseEnter:c=>{c.currentTarget.style.background="var(--surface-2)"},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:[a.jsx("td",{style:{padding:"10px 12px",textAlign:"center",fontSize:12,fontWeight:600,color:"var(--text-tertiary)",width:40},children:o+1}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-[12px] font-medium",style:{color:"var(--text-primary)"},children:s.model}),a.jsx("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:s.provider})]})}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsxs("span",{className:"pill",style:{background:s.passRate>=.7?"var(--green-muted)":s.passRate>=.4?"var(--yellow-muted)":"var(--red-muted)",color:Sl(s.passRate),fontSize:11,fontWeight:600},children:[Math.round(s.passRate*100),"%"]})}),a.jsx("td",{style:{padding:"10px 12px"},children:s.baselinePassRate!=null?a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:[Math.round(s.baselinePassRate*100),"%"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.skillDelta!=null?a.jsxs("span",{className:"text-[11px] font-medium",style:{color:s.skillDelta>=0?"var(--green)":"var(--red)"},children:[s.skillDelta>=0?"+":"",(s.skillDelta*100).toFixed(1),"pp"]}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:s.amplificationPct!=null&&isFinite(s.amplificationPct)?a.jsx(tE,{pct:s.amplificationPct}):"--"}),a.jsx("td",{style:{padding:"10px 12px"},children:a.jsx(gy,{data:s.sparklineData})})]},`${s.provider}/${s.model}`))})]})})}function oE(){const{state:n}=Cn(),{plugin:l,skill:s}=n,[o,c]=g.useState("rankings"),f=`leaderboard/${l}/${s}`,d=g.useCallback(()=>Ne.getLeaderboard(l,s),[l,s]),{data:h,loading:x}=Cl(f,d),p=(h==null?void 0:h.entries)??[];g.useEffect(()=>{c("rankings")},[l,s]);const y=g.useCallback(()=>rn(f),[f]);Ro("leaderboard:updated",y);const v=g.useMemo(()=>lE(p),[p]),b=v.some(N=>N.hasBaseline),j=p[0],k=j==null?void 0:j.judgeBiasWarning;return x?a.jsx("div",{className:"flex items-center justify-center h-full",children:a.jsx("div",{className:"spinner spinner-lg"})}):v.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-8",children:[a.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M18 20V10"}),a.jsx("path",{d:"M12 20V4"}),a.jsx("path",{d:"M6 20v-6"})]})}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-primary)"},children:"No sweep results yet"}),a.jsx("div",{className:"text-[12px] mb-3",style:{color:"var(--text-tertiary)"},children:"Run your first model sweep to compare performance across models:"}),a.jsx("div",{className:"text-[11px] font-mono px-4 py-3 rounded-lg text-left",style:{background:"var(--surface-2)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)"},children:'vskill eval sweep --models "anthropic/claude-sonnet-4,openrouter/meta-llama/llama-3.1-70b" --judge "anthropic/claude-sonnet-4"'}),a.jsxs("div",{className:"text-[11px] mt-2",style:{color:"var(--text-tertiary)"},children:["Add ",a.jsx("code",{children:"--baseline"})," to measure skill amplification per model."]})]})]}):a.jsxs("div",{className:"p-5 animate-fade-in",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--text-primary)"},children:"Model Leaderboard"}),a.jsx(rE,{active:o,onChange:c,hasBaseline:b})]}),a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[p.length," sweep",p.length!==1?"s":""," · ",v.length," model",v.length!==1?"s":""]})]}),k&&a.jsx(aE,{warning:k}),o==="rankings"?a.jsx(sE,{entries:v}):a.jsx(iE,{entries:v}),o==="amplification"&&(j==null?void 0:j.skillQualityScore)!=null&&(j==null?void 0:j.skillQualityRating)&&a.jsx(nE,{score:j.skillQualityScore,rating:j.skillQualityRating})]})}const cE=["editor","tests","run","activation","history","leaderboard","deps","versions"];function uE(n){return n!=null&&cE.includes(n)}function dE({hideHeader:n=!1}={}){var b;const{state:l,dispatch:s,saveContent:o,isReadOnly:c}=Cn(),{state:f,refreshSkills:d,clearSelection:h}=Ca(),x=g.useCallback(async()=>{try{await Ne.deleteSkill(l.plugin,l.skill),d(),h()}catch(j){const k=j instanceof Error?j.message:String(j);s({type:"SET_ERROR",error:`Failed to delete skill: ${k}`})}},[l.plugin,l.skill,d,h,s]);g.useEffect(()=>{const k=new URLSearchParams(window.location.search).get("panel");uE(k)&&k!==l.activePanel&&s({type:"SET_PANEL",panel:k})},[]),g.useEffect(()=>{const j=new URLSearchParams(window.location.search);j.set("panel",l.activePanel);const k=`${window.location.pathname}?${j.toString()}${window.location.hash}`;history.replaceState(null,"",k)},[l.activePanel]);const p=g.useCallback(j=>{const k=j.ctrlKey||j.metaKey;if(k&&j.key>="1"&&j.key<="8"){j.preventDefault(),s({type:"SET_PANEL",panel:["editor","tests","run","activation","history","leaderboard","deps","versions"][parseInt(j.key)-1]});return}if(k&&j.key==="s"&&!j.shiftKey){j.preventDefault(),l.isDirty&&o();return}},[l.isDirty,o,s]);if(g.useEffect(()=>(window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)),[p]),l.loading)return a.jsx("div",{className:"flex items-center justify-center h-full",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx("div",{className:"spinner spinner-lg"}),a.jsx("span",{className:"text-[13px]",style:{color:"var(--text-tertiary)"},children:"Loading workspace..."})]})});const y=Array.from(l.caseRunStates.values()).some(j=>j.status==="running"||j.status==="queued"),v=((b=f.skills.find(j=>j.skill===l.skill&&j.plugin===l.plugin))==null?void 0:b.updateAvailable)??!1;return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[!n&&a.jsx(jf,{state:l,isReadOnly:c,onDelete:c?void 0:x}),l.error&&a.jsx("div",{className:"px-4 py-2",style:{borderBottom:"1px solid var(--border-subtle)"},children:a.jsx(Ws,{error:Ow(l.error),onDismiss:()=>s({type:"SET_ERROR",error:null})})}),a.jsx(Dw,{activePanel:l.activePanel,onPanelChange:j=>s({type:"SET_PANEL",panel:j}),isDirty:l.isDirty,isRunning:y,hasRegressions:l.regressions.length>0,isActivationRunning:l.activationRunning,hasUpdate:v}),a.jsx(_w,{children:a.jsx("div",{className:"flex-1 overflow-hidden",style:{background:"var(--surface-0)"},children:a.jsxs("div",{className:"animate-fade-in",style:{height:"100%",overflow:"auto"},children:[l.activePanel==="editor"&&a.jsx(iC,{}),l.activePanel==="tests"&&a.jsx(mC,{}),l.activePanel==="run"&&a.jsx(TC,{}),l.activePanel==="activation"&&a.jsx(LC,{}),l.activePanel==="history"&&a.jsx(YC,{}),l.activePanel==="leaderboard"&&a.jsx(oE,{}),l.activePanel==="deps"&&a.jsx(JC,{}),l.activePanel==="versions"&&a.jsx(ly,{})]},l.activePanel)})},`${l.plugin}/${l.skill}`)]})}function fE(n){const l={prompt:n.prompt,provider:n.provider,model:n.model};return n.targetAgents&&n.targetAgents.length>0&&(l.targetAgents=n.targetAgents),l}function Qd(n,l=!0){let s=n.toLowerCase().replace(/[^a-z0-9]+/g,"-");return l&&(s=s.replace(/^-+|-+$/g,"")),s}function pE(n,l,s,o){const f=`.../${n.split("/").slice(-2).join("/")}`;switch(l){case 1:return`${f}/${s}/skills/${o}/SKILL.md`;case 2:return`${f}/plugins/${s}/skills/${o}/SKILL.md`;case 3:return`${f}/skills/${o}/SKILL.md`}}function mE({onCreated:n,resolveAiConfigOverride:l}){const[s,o]=g.useState("ai"),[c,f]=g.useState(null),[d,h]=g.useState(!0),{config:x}=Nr(),[p,y]=g.useState(""),[v,b]=g.useState(3),[j,k]=g.useState(""),[N,C]=g.useState(""),[w,A]=g.useState(""),[_,H]=g.useState(""),[L,$]=g.useState(""),[E,D]=g.useState(""),[R,B]=g.useState("write"),[P,W]=g.useState([]),[te,Q]=g.useState(!1),[z,M]=g.useState(null),[I,X]=g.useState(""),[G,ce]=g.useState(!1),[O,Y]=g.useState(!1),[se,ue]=g.useState(null),[ge,xe]=g.useState(null),[we,ie]=g.useState([]),je=g.useRef(null),_e=g.useRef(null),Ue=g.useRef(null),ae=g.useRef(null),[fe,de]=g.useState(!1),[he,ye]=g.useState(!1);g.useEffect(()=>{Ne.getProjectLayout().then(De=>{f(De),b(De.suggestedLayout);const gt=De.detectedLayouts.find(Xt=>Xt.layout===De.suggestedLayout);gt!=null&&gt.existingPlugins.length&&k(gt.existingPlugins[0])}).catch(()=>{}).finally(()=>h(!1))},[]),g.useEffect(()=>{var De;s==="ai"&&((De=je.current)==null||De.focus())},[s]),g.useEffect(()=>()=>{var De;(De=_e.current)==null||De.abort()},[]);const Oe=g.useMemo(()=>{var De;return c?((De=c.detectedLayouts.find(gt=>gt.layout===v))==null?void 0:De.existingPlugins)||[]:[]},[c,v]),Ae=j==="__new__"?N:j,pe=c?pE(c.root,v,Ae||"{plugin}",p||"{skill}"):"",ze=g.useMemo(()=>c?c.detectedLayouts.filter(De=>De.layout!==4):[],[c]),Be=g.useMemo(()=>{if(!c)return null;const De=c.detectedLayouts.find(lt=>lt.layout===2&&lt.existingPlugins.length>0),gt=c.detectedLayouts.find(lt=>lt.layout===1&&lt.existingPlugins.length>0),Xt=De||gt;return Xt?{layout:Xt.layout,plugins:Xt.existingPlugins}:null},[c]),Ot=g.useCallback(()=>{if(l)return l();if(!x)return{provider:"claude-cli",model:"sonnet"};const De=x.provider||"claude-cli",gt=x.model||"sonnet";return{provider:De,model:gt}},[x,l]),Ft=g.useCallback(()=>{var De;(De=_e.current)==null||De.abort(),ce(!1)},[]),rt=g.useCallback(()=>{ue(null),xe(null)},[]),jt=g.useCallback(async()=>{if(ue(null),xe(null),ie([]),Ue.current=null,!I.trim()){ue("Describe what your skill should do");return}ce(!0);const De=new AbortController;_e.current=De;const{provider:gt,model:Xt}=Ot();try{const lt=await fetch("/api/skills/generate?sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fE({prompt:I.trim(),provider:gt,model:Xt,targetAgents:P})),signal:De.signal});if(!lt.ok||!lt.body){let St=`HTTP ${lt.status}`;try{const Un=await lt.json();Un.error&&(St=Un.error)}catch{}throw new Error(St)}const rr=lt.body.getReader(),na=new TextDecoder;let Et="",kt="";for(;;){const{done:St,value:Un}=await rr.read();if(St)break;Et+=na.decode(Un,{stream:!0});const lr=Et.split(`
86
- `);Et=lr.pop()||"";for(const $n of lr)if($n.startsWith("event: "))kt=$n.slice(7).trim();else if($n.startsWith("data: ")){try{const Fe=JSON.parse($n.slice(6));if(kt==="progress")ie($t=>[...$t,{phase:Fe.phase,message:Fe.message,timestamp:Date.now()}]);else if(kt==="done"||kt==="complete"){const $t={prompt:I.trim(),provider:Ot().provider,model:Ot().model,reasoning:Fe.reasoning||""};if(y(Fe.name),A(Fe.description),H(Fe.model||""),$(Fe.allowedTools||""),D(Fe.body),Y(!0),Ue.current=$t,o("manual"),Fe.suggestedPlugin&&typeof Fe.suggestedPlugin=="object"&&Fe.suggestedPlugin.plugin){const Nt=Fe.suggestedPlugin;if(((c==null?void 0:c.detectedLayouts.flatMap(En=>En.existingPlugins))??[]).includes(Nt.plugin))if(k(Nt.plugin),Nt.layout&&(Nt.layout===1||Nt.layout===2))b(Nt.layout);else{const En=c==null?void 0:c.detectedLayouts.find(Vo=>Vo.existingPlugins.includes(Nt.plugin));En&&(En.layout===1||En.layout===2)&&b(En.layout)}else k("__new__"),C(Nt.plugin)}else v===3&&Be&&ye(!0);const aa={name:Fe.name,plugin:Ae||"",layout:v,description:Fe.description,model:Fe.model||void 0,allowedTools:Fe.allowedTools||void 0,body:Fe.body,aiMeta:$t};Ne.saveDraft(aa).then(Nt=>{de(!0),Nt!=null&&Nt.dir&&(ae.current=Nt.dir)}).catch(()=>{})}else kt==="error"&&(ue(Fe.message||Fe.description||"Unknown error"),Fe.category&&xe(Fe))}catch{}kt=""}}}catch(lt){lt.name!=="AbortError"&&ue(lt.message)}finally{ce(!1),_e.current=null}},[I,Ot,v,Be,Ae,c,P]),ve=g.useCallback(async()=>{if(M(null),!p.trim()){M("Skill name is required");return}if(!w.trim()){M("Description is required");return}if(v!==3&&!Ae.trim()){M("Plugin name is required");return}Q(!0);try{const De=await Ne.createSkill({name:Qd(p),plugin:Ae||"",layout:v,description:w,model:_||void 0,allowedTools:L||void 0,body:E,aiMeta:Ue.current||void 0,draftDir:ae.current||void 0});ae.current=null,n(De.plugin,De.skill)}catch(De){M(De.message)}finally{Q(!1)}},[p,w,v,Ae,_,L,E,n]),At=g.useCallback(()=>{Be&&(b(Be.layout),k(Be.plugins[0]),ye(!1))},[Be]);return{mode:s,setMode:o,layout:c,layoutLoading:d,selectedLayout:v,setSelectedLayout:b,creatableLayouts:ze,availablePlugins:Oe,pathPreview:pe,plugin:j,setPlugin:k,newPlugin:N,setNewPlugin:C,effectivePlugin:Ae,name:p,setName:y,description:w,setDescription:A,model:_,setModel:H,allowedTools:L,setAllowedTools:$,body:E,setBody:D,bodyViewMode:R,setBodyViewMode:B,aiPrompt:I,setAiPrompt:X,generating:G,aiGenerated:O,aiError:se,aiClassifiedError:ge,aiProgress:we,promptRef:je,handleGenerate:jt,handleCancelGenerate:Ft,clearAiError:rt,targetAgents:P,setTargetAgents:W,draftSaved:fe,showPluginRecommendation:he,setShowPluginRecommendation:ye,pluginLayoutInfo:Be,applyPluginRecommendation:At,creating:te,error:z,handleCreate:ve}}function yy(){return a.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function hE(){return a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function by({node:n,depth:l=0}){var s;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",style:{paddingLeft:`${l*16}px`,color:n.type==="dir"?"var(--text-secondary)":"var(--text-tertiary)",fontSize:12,fontFamily:"var(--font-mono, monospace)"},children:[n.type==="dir"?a.jsx(yy,{}):a.jsx(hE,{}),a.jsxs("span",{children:[n.name,n.type==="dir"?"/":""]})]}),(s=n.children)==null?void 0:s.map(o=>a.jsx(by,{node:o,depth:l+1},o.name))]})}function xE(n,l,s){const o=[];l&&o.push({name:"evals.json",type:"file"}),o.push({name:"history",type:"dir"});const c=[{name:"SKILL.md",type:"file"},{name:"evals",type:"dir",children:o}];return s&&c.push({name:"draft.json",type:"file"}),{name:n||"{skill}",type:"dir",children:c}}function gE({skillName:n,hasEvals:l,isDraft:s}){const o=xE(n,l,s);return a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsx(yy,{})}),"Skill Structure"]}),a.jsx("div",{className:"rounded-lg px-3 py-2",style:{background:"var(--surface-0)",border:"1px solid var(--border-subtle)"},children:a.jsx(by,{node:o})})]})}const Qa={background:"var(--surface-3)",color:"var(--text-primary)",border:"1px solid var(--border-subtle)"};function Td({size:n=14,color:l="currentColor"}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:l,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M12 3l1.912 5.813a2 2 0 001.275 1.275L21 12l-5.813 1.912a2 2 0 00-1.275 1.275L12 21l-1.912-5.813a2 2 0 00-1.275-1.275L3 12l5.813-1.912a2 2 0 001.275-1.275L12 3z"})})}function vE({onCreated:n,onCancel:l}){const s=mE({onCreated:n});return a.jsxs("div",{className:"px-8 py-6 max-w-4xl animate-fade-in overflow-auto h-full",children:[a.jsxs("div",{className:"mb-5",children:[a.jsx("h2",{className:"text-[20px] font-semibold tracking-tight",style:{color:"var(--text-primary)"},children:"Create a New Skill"}),a.jsx("div",{className:"flex items-center justify-between mt-2",children:a.jsxs("div",{className:"inline-flex rounded-lg p-0.5",style:{background:"var(--surface-2)",border:"1px solid var(--border-subtle)"},children:[a.jsx("button",{onClick:()=>s.setMode("ai"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="ai"?"rgba(168,85,247,0.15)":"transparent",color:s.mode==="ai"?"#a855f7":"var(--text-tertiary)",boxShadow:s.mode==="ai"?"0 1px 3px rgba(168,85,247,0.15)":"none",cursor:"pointer",border:"none"},children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(Td,{size:12}),"AI-Assisted"]})}),a.jsx("button",{onClick:()=>s.setMode("manual"),className:"px-3 py-1.5 rounded-md text-[12px] font-medium transition-all duration-200",style:{background:s.mode==="manual"?"var(--surface-4, var(--surface-3))":"transparent",color:s.mode==="manual"?"var(--text-primary)":"var(--text-tertiary)",boxShadow:s.mode==="manual"?"0 1px 3px rgba(0,0,0,0.1)":"none",cursor:"pointer",border:"none"},children:"Manual"})]})})]}),s.layoutLoading&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"}),a.jsx("div",{className:"skeleton h-10 w-full rounded-lg"})]}),!s.layoutLoading&&s.layout&&s.mode==="ai"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("h3",{className:"text-[13px] font-semibold mb-3 flex items-center gap-2",style:{color:"var(--text-primary)"},children:[a.jsx("div",{className:"w-5 h-5 rounded-md flex items-center justify-center",style:{background:"rgba(168,85,247,0.15)"},children:a.jsx(Td,{size:11,color:"#a855f7"})}),"Describe Your Skill"]}),a.jsx("textarea",{ref:s.promptRef,value:s.aiPrompt,onChange:o=>s.setAiPrompt(o.target.value),placeholder:`e.g., A skill that helps format SQL queries, optimize them for performance, and explain query execution plans.
87
-
88
- Include any specific behaviors, constraints, or output formats you want.`,rows:5,disabled:s.generating,className:"w-full px-3 py-2.5 rounded-lg text-[13px] resize-y",style:{...Qa,minHeight:"120px"},onKeyDown:o=>{o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&(o.preventDefault(),s.handleGenerate())}}),a.jsx("p",{className:"text-[11px] mt-2",style:{color:"var(--text-quaternary, var(--text-tertiary))"},children:"Cmd+Enter to generate"})]}),s.generating&&s.aiProgress.length>0&&a.jsx(qs,{entries:s.aiProgress,isRunning:!0}),s.aiError&&a.jsx("div",{children:s.aiClassifiedError?a.jsx(Ws,{error:s.aiClassifiedError,onRetry:s.handleGenerate,onDismiss:s.clearAiError}):a.jsxs("div",{children:[a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.aiError}),a.jsx("button",{onClick:s.handleGenerate,className:"mt-2 text-[12px] font-medium",style:{color:"#a855f7",background:"none",border:"none",cursor:"pointer"},children:"Retry"})]})}),a.jsxs("div",{className:"flex items-center gap-3",children:[s.generating?a.jsx("button",{onClick:s.handleCancelGenerate,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150 flex items-center gap-2",style:{background:"var(--surface-3)",color:"var(--text-secondary)",border:"none",cursor:"pointer"},children:"Cancel Generation"}):a.jsxs("button",{onClick:s.handleGenerate,disabled:!s.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:s.aiPrompt.trim()?"#a855f7":"var(--surface-3)",color:s.aiPrompt.trim()?"#fff":"var(--text-tertiary)",cursor:s.aiPrompt.trim()?"pointer":"not-allowed",border:"none"},children:[a.jsx(Td,{size:14}),"Generate"]}),a.jsx("button",{onClick:l,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"}),!s.generating&&a.jsxs("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:["or fill in the form manually",a.jsx("button",{onClick:()=>s.setMode("manual"),className:"ml-1 font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer"},children:"below"})]})]})]}),!s.layoutLoading&&s.layout&&s.mode==="manual"&&a.jsxs("div",{className:"space-y-4 animate-fade-in",children:[a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Location"}),s.creatableLayouts.length>1&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Layout"}),a.jsx("div",{className:"flex gap-2",children:s.creatableLayouts.map(o=>a.jsx("button",{onClick:()=>{s.setSelectedLayout(o.layout),s.setPlugin(o.existingPlugins[0]||""),s.setNewPlugin("")},className:"px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all duration-150",style:{background:s.selectedLayout===o.layout?"var(--accent)":"var(--surface-3)",color:s.selectedLayout===o.layout?"#fff":"var(--text-secondary)",border:`1px solid ${s.selectedLayout===o.layout?"var(--accent)":"var(--border-subtle)"}`,cursor:"pointer"},children:o.label},o.layout))})]}),s.selectedLayout!==3&&a.jsxs("div",{className:"mb-3",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-2 block",style:{color:"var(--text-tertiary)"},children:"Plugin"}),a.jsxs("select",{value:s.plugin,onChange:o=>{s.setPlugin(o.target.value),s.setNewPlugin("")},className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Qa,children:[s.availablePlugins.map(o=>a.jsx("option",{value:o,children:o},o)),a.jsx("option",{value:"__new__",children:"+ New plugin..."})]}),s.plugin==="__new__"&&a.jsx("input",{type:"text",value:s.newPlugin,onChange:o=>s.setNewPlugin(Qd(o.target.value)),placeholder:"my-plugin",className:"w-full mt-2 px-3 py-2 rounded-lg text-[13px]",style:Qa})]}),a.jsx("div",{className:"px-3 py-2 rounded-lg text-[11px] font-mono",style:{background:"var(--surface-0)",color:"var(--text-tertiary)",border:"1px solid var(--border-subtle)"},children:s.pathPreview})]}),s.showPluginRecommendation&&s.pluginLayoutInfo&&s.selectedLayout===3&&a.jsxs("div",{className:"px-4 py-3 rounded-lg text-[12px] animate-fade-in flex items-center justify-between gap-3",style:{background:"rgba(59,130,246,0.08)",color:"var(--text-secondary)",border:"1px solid rgba(59,130,246,0.2)"},children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3b82f6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("circle",{cx:"12",cy:"12",r:"10"}),a.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),a.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),a.jsxs("span",{children:["Plugins detected (",a.jsx("strong",{children:s.pluginLayoutInfo.plugins.slice(0,3).join(", ")}),"). Add this skill to a plugin for better organization."]})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:s.applyPluginRecommendation,className:"px-3 py-1 rounded-md text-[11px] font-medium",style:{background:"#3b82f6",color:"#fff",border:"none",cursor:"pointer"},children:"Use plugin"}),a.jsx("button",{onClick:()=>s.setShowPluginRecommendation(!1),className:"w-5 h-5 rounded flex items-center justify-center",style:{color:"var(--text-tertiary)",background:"none",border:"none",cursor:"pointer"},children:a.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsx("h3",{className:"text-[13px] font-semibold mb-3",style:{color:"var(--text-primary)"},children:"Skill Details"}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Name ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("input",{type:"text",value:s.name,onChange:o=>s.setName(Qd(o.target.value,!1)),placeholder:"my-skill",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Qa})]}),a.jsxs("div",{className:"mb-3",children:[a.jsxs("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:["Description ",a.jsx("span",{style:{color:"var(--red)"},children:"*"})]}),a.jsx("textarea",{value:s.description,onChange:o=>s.setDescription(o.target.value),placeholder:"Brief description",rows:3,className:"w-full px-3 py-2 rounded-lg text-[13px] resize-y",style:{...Qa,minHeight:"72px"}})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Model"}),a.jsxs("select",{value:s.model,onChange:o=>s.setModel(o.target.value),className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Qa,children:[a.jsx("option",{value:"",children:"Any"}),a.jsx("option",{value:"opus",children:"Opus"}),a.jsx("option",{value:"sonnet",children:"Sonnet"}),a.jsx("option",{value:"haiku",children:"Haiku"})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] font-medium uppercase tracking-wider mb-1 block",style:{color:"var(--text-tertiary)"},children:"Allowed Tools"}),a.jsx("input",{type:"text",value:s.allowedTools,onChange:o=>s.setAllowedTools(o.target.value),placeholder:"Read, Write, Edit...",className:"w-full px-3 py-2 rounded-lg text-[13px]",style:Qa})]})]})]}),a.jsxs("div",{className:"glass-card p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--accent-muted)"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),a.jsx("polyline",{points:"14 2 14 8 20 8"}),a.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),a.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]})}),a.jsxs("div",{children:[a.jsx("span",{className:"text-[13px] font-semibold",style:{color:"var(--text-primary)"},children:"SKILL.md"}),a.jsx("span",{className:"text-[11px] ml-2",style:{color:"var(--text-tertiary)"},children:"Skill Definition"})]})]}),a.jsx("div",{className:"flex items-center",style:{background:"var(--surface-2)",borderRadius:8,padding:2,gap:1},children:["write","preview"].map(o=>a.jsxs("button",{onClick:()=>s.setBodyViewMode(o),className:"flex items-center gap-1 rounded-md transition-all duration-150",style:{padding:"4px 10px",background:s.bodyViewMode===o?"var(--surface-4)":"transparent",color:s.bodyViewMode===o?"var(--text-primary)":"var(--text-tertiary)",fontSize:11,fontWeight:s.bodyViewMode===o?600:400,border:"none",cursor:"pointer"},children:[o==="write"?a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("polyline",{points:"16 18 22 12 16 6"}),a.jsx("polyline",{points:"8 6 2 12 8 18"})]}):a.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),a.jsx("span",{children:o==="write"?"Write":"Preview"})]},o))})]}),s.bodyViewMode==="write"?a.jsx("textarea",{value:s.body,onChange:o=>s.setBody(o.target.value),placeholder:`# /my-skill
89
-
90
- You are an expert at...
91
- `,rows:8,className:"w-full px-3 py-2 rounded-lg text-[13px] font-mono resize-y",style:{...Qa,minHeight:"150px"}}):s.body.trim()?a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},dangerouslySetInnerHTML:{__html:$o(s.body)}}):a.jsx("div",{className:"text-[13px] leading-relaxed overflow-x-auto rounded-lg px-4 py-3",style:{background:"var(--surface-0)",color:"var(--text-secondary)",border:"1px solid var(--border-subtle)",minHeight:"150px",maxHeight:"400px",overflowY:"auto"},children:a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Start writing to see preview"})})]}),a.jsx(gE,{skillName:s.name||"{skill}",hasEvals:!1,isDraft:s.draftSaved}),s.error&&a.jsx("div",{className:"px-4 py-3 rounded-lg text-[13px]",style:{background:"var(--red-muted)",color:"var(--red)",border:"1px solid rgba(248,113,113,0.2)"},children:s.error}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:s.handleCreate,disabled:s.creating||!s.name||!s.description,className:"px-5 py-2.5 rounded-lg text-[13px] font-medium transition-all duration-150",style:{background:s.creating||!s.name||!s.description?"var(--surface-3)":"var(--accent)",color:s.creating||!s.name||!s.description?"var(--text-tertiary)":"#fff",cursor:s.creating||!s.name||!s.description?"not-allowed":"pointer",border:"none"},children:s.creating?"Creating...":"Create Skill"}),a.jsx("button",{onClick:l,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 yE(){return a.jsx("div",{className:"w-16 h-16 rounded-2xl flex items-center justify-center",style:{background:"var(--surface-2)"},children:a.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),a.jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]})})}function wo({variant:n,message:l,onRetry:s}){const{setMode:o,setSearch:c}=Ca(),[f,d]=g.useState(!1);return n==="no-selection"?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:[a.jsx("div",{className:"mb-5",children:f?a.jsx(yE,{}):a.jsx("img",{src:"/images/empty-studio.webp",width:128,height:128,alt:"",onError:()=>d(!0),style:{objectFit:"contain"}})}),a.jsx("p",{className:"text-[14px] font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Select a skill to view details"}),a.jsx("p",{className:"text-[12px]",style:{color:"var(--text-tertiary)"},children:"Choose a skill from the list to edit, test, and evaluate"})]}):n==="no-skills"?a.jsxs("div",{className:"text-center py-12 px-4 animate-fade-in-scale",children:[a.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mx-auto mb-4",style:{background:"var(--surface-2)"},children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})})}),a.jsx("p",{className:"text-[14px] font-medium",style:{color:"var(--text-secondary)"},children:"No skills found"}),a.jsxs("p",{className:"text-[12px] mt-1 mb-4",style:{color:"var(--text-tertiary)"},children:["Check your ",a.jsx("code",{className:"px-1.5 py-0.5 rounded text-[11px]",style:{background:"var(--surface-2)"},children:"--root"})," directory, or create your first skill"]}),a.jsxs("button",{onClick:()=>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:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Create Your First Skill"]})]}):n==="error"?a.jsx("div",{className:"flex flex-col items-center justify-center h-full px-8 animate-fade-in",children:a.jsxs("div",{className:"px-5 py-4 rounded-lg text-center max-w-sm",style:{background:"var(--red-muted)",border:"1px solid rgba(248,113,113,0.2)"},children:[a.jsx("p",{className:"text-[13px] mb-3",style:{color:"var(--red)"},children:l||"Failed to load skill data"}),s&&a.jsx("button",{onClick:s,className:"px-4 py-2 rounded-lg text-[12px] font-medium",style:{background:"var(--surface-3)",color:"var(--text-primary)",border:"none",cursor:"pointer"},children:"Retry"})]})}):a.jsxs("div",{className:"px-4 py-8 text-center animate-fade-in",children:[a.jsx("p",{className:"text-[13px] mb-2",style:{color:"var(--text-tertiary)"},children:"No skills match your search"}),a.jsx("button",{onClick:()=>c(""),className:"text-[12px] font-medium",style:{color:"var(--accent)",background:"none",border:"none",cursor:"pointer",textDecoration:"underline"},children:"Clear search"})]})}function bE(n,l){const[s,o]=n.split(".").map(Number),[c,f]=l.split(".").map(Number);return c>s?"major":f>o?"minor":"patch"}const SE={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 jE(){const[n,l]=g.useState([]),[s,o]=g.useState(!0),[c,f]=g.useState(new Set),[d,h]=g.useState(new Map),[x,p]=g.useState(!1),[y,v]=g.useState(new Set),[b,j]=g.useState(null),[k,N]=g.useState(null),[C,w]=g.useState(!1),A=g.useCallback(async()=>{o(!0);try{const R=await Ne.getSkillUpdates();l(R.filter(B=>B.updateAvailable))}catch{l([])}finally{o(!1)}},[]);g.useEffect(()=>{A()},[A]);const _=g.useMemo(()=>n.filter(R=>!R.pinned),[n]),H=g.useCallback(R=>{f(B=>{const P=new Set(B);return P.has(R)?P.delete(R):P.add(R),P})},[]),L=g.useCallback(()=>{c.size===_.length?f(new Set):f(new Set(_.map(R=>R.name)))},[c,_]),$=g.useCallback(()=>{const R=[...c];if(!R.length)return;p(!0),h(new Map(R.map(P=>[P,{skill:P,status:"pending"}])));const B=Ne.startBatchUpdate(R);B.addEventListener("progress",P=>{try{const W=JSON.parse(P.data);h(te=>new Map(te).set(W.skill,W))}catch{}}),B.addEventListener("done",P=>{B.close(),p(!1);try{const W=JSON.parse(P.data);j(`Updated ${W.updated??0} skills, ${W.failed??0} failed`),setTimeout(()=>j(null),5e3)}catch{}A()}),B.addEventListener("error",()=>{B.close(),p(!1),j("Batch update failed"),setTimeout(()=>j(null),5e3)})},[c,A]),E=g.useCallback(R=>{R.name.split("/").pop()||R.name;const B=R.name.split("/"),P=B.length>=3?B[B.length-2]:B[0],W=B[B.length-1];v(Q=>new Set(Q).add(R.name));const te=Ne.startSkillUpdate(P,W);te.addEventListener("done",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(R.name),z}),A()}),te.addEventListener("error",()=>{te.close(),v(Q=>{const z=new Set(Q);return z.delete(R.name),z})})},[A]),D=g.useCallback(async R=>{if(!R.latest)return;const B=R.name.split("/"),P=B.length>=3?B[B.length-2]:B[0],W=B[B.length-1];w(!0);try{const te=await Ne.getVersionDiff(P,W,R.installed,R.latest);N({skill:R,diff:te})}catch{N(null)}finally{w(!1)}},[]);return s?a.jsxs("div",{className:"p-6",children:[a.jsx("div",{className:"skeleton h-6 w-48 mb-4"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"skeleton h-16 rounded-lg"}),a.jsx("div",{className:"skeleton h-16 rounded-lg"})]})]}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-full py-16",children:[a.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:[a.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),a.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),a.jsx("div",{className:"text-[15px] font-semibold mb-2",style:{color:"var(--text-primary)"},children:"All skills are up to date"}),a.jsx("div",{className:"text-[12px] mb-4",style:{color:"var(--text-tertiary)"},children:"No updates available for installed skills."}),a.jsx("button",{onClick:A,className:"btn btn-secondary text-[12px]",children:"Refresh"})]}):a.jsxs("div",{className:"p-6",children:[b&&a.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:b}),a.jsxs("div",{className:"flex items-center justify-between mb-5",children:[a.jsxs("div",{className:"text-[16px] font-semibold",style:{color:"var(--text-primary)"},children:["Available Updates (",_.length,")"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:A,className:"btn btn-ghost text-[12px]",disabled:x,children:"Refresh"}),a.jsx("button",{onClick:$,disabled:c.size===0||x,className:"btn btn-primary text-[12px]",children:x?"Updating...":`Update Selected (${c.size})`})]})]}),a.jsx("div",{className:"flex items-center gap-2 mb-3",children:a.jsxs("button",{onClick:L,className:"flex items-center gap-2 text-[12px] font-medium",style:{color:"var(--text-secondary)",background:"transparent",border:"none",cursor:"pointer"},children:[a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:c.size===_.length&&_.length>0?"var(--accent)":"var(--border-default)",background:c.size===_.length&&_.length>0?"var(--accent)":"transparent"},children:c.size===_.length&&_.length>0&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})}),"Select All"]})}),a.jsx("div",{className:"space-y-2",children:n.map(R=>{const B=R.name.split("/").pop()||R.name,P=R.latest?bE(R.installed,R.latest):"patch",W=SE[P],te=!!R.pinned,Q=y.has(R.name),z=d.get(R.name),M=c.has(R.name);return a.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:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:()=>!te&&H(R.name),disabled:te,className:"flex-shrink-0",style:{background:"transparent",border:"none",cursor:te?"not-allowed":"pointer"},children:a.jsx("span",{className:"w-4 h-4 rounded border flex items-center justify-center",style:{borderColor:M?"var(--accent)":"var(--border-default)",background:M?"var(--accent)":"transparent",opacity:te?.4:1},children:M&&a.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"var(--color-paper)",strokeWidth:"3",children:a.jsx("polyline",{points:"20 6 9 17 4 12"})})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-[13px] font-medium",style:{color:"var(--text-primary)"},children:B}),te&&a.jsx("span",{className:"text-[10px]",title:"Pinned — unpin from CLI to update",children:"📌"}),a.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:W.bg,color:W.text},children:P})]}),a.jsxs("div",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:[R.installed," → ",R.latest||"?",te&&` (pinned at ${R.pinnedVersion||R.installed})`]})]}),z&&a.jsxs("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:z.status==="done"?"var(--green-muted)":z.status==="error"?"var(--red-muted)":"var(--yellow-muted)",color:z.status==="done"?"var(--green)":z.status==="error"?"var(--red)":"var(--yellow)"},children:[z.status,z.error&&`: ${z.error}`]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsx("button",{onClick:()=>D(R),className:"btn btn-ghost text-[11px]",disabled:C,children:"View Changes"}),a.jsx("button",{onClick:()=>E(R),disabled:te||Q||x,title:te?"Pinned — unpin from CLI to update":"",className:`btn ${te?"btn-ghost":"btn-primary"} text-[11px]`,children:Q?a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{className:"spinner spinner-sm"})," Updating"]}):(z==null?void 0:z.status)==="done"?a.jsx("span",{style:{color:"var(--green)"},children:"✓"}):"Update"})]})]})},R.name)})}),k&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)"},onClick:()=>N(null),children:a.jsxs("div",{style:{width:"80%",maxWidth:900},onClick:R=>R.stopPropagation(),children:[a.jsx("div",{className:"mb-2 flex justify-end",children:a.jsx("button",{onClick:()=>N(null),className:"btn btn-ghost text-[12px]",children:"Close"})}),a.jsx(Sf,{contentDiff:k.diff.contentDiff,fromLabel:k.diff.from,toLabel:k.diff.to,diffSummary:k.diff.diffSummary,renderContext:"inline"})]})})]})}const kE=[{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}}],Tl={fontFamily:"var(--font-serif)",fontSize:15,fontWeight:500,color:"var(--text-primary)",margin:"0 0 8px",letterSpacing:.1},Rl={background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px",boxShadow:"none"},wE={fontFamily:"var(--font-sans)",fontSize:11,color:"var(--text-secondary)",textTransform:"uppercase",letterSpacing:.4},Sy={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},jy={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",wordBreak:"break-all"},yl={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},CE={fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-secondary)"},EE={fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",overflowWrap:"anywhere",wordBreak:"break-word"},NE={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 TE(n){if(n==null||!Number.isFinite(n))return"—";if(n<1024)return`${n} B`;const l=n/1024;if(l<1024)return l>=10?`${Math.round(l)} KB`:`${l.toFixed(1).replace(/\.0$/,"")} KB`;const s=l/1024;return s>=10?`${Math.round(s)} MB`:`${s.toFixed(1).replace(/\.0$/,"")} MB`}function ky(n){if(!n)return"—";const l=new Date(n);if(Number.isNaN(l.getTime()))return n;const s=Date.now()-l.getTime(),o=Math.floor(s/1e3);if(o<60)return"just now";const c=Math.floor(o/60);if(c<60)return`${c} min ago`;const f=Math.floor(c/60);if(f<24)return`${f} hr ago`;const d=Math.floor(f/24);if(d<30)return`${d} day${d===1?"":"s"} ago`;const h=Math.floor(d/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 RE(n){const l=kE.find(s=>s.id===n);return(l==null?void 0:l.displayName)??n}function jl(n){const l=n?NE[n]:void 0;return a.jsx("span",{style:CE,title:l,children:"—"})}function jn(n,l,s){return a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"130px 1fr",alignItems:"baseline",gap:12,padding:"6px 0"},children:[a.jsx("span",{style:wE,children:n}),a.jsx("span",{style:{minWidth:0},children:l})]},n)}function xl(n,l,s={}){if(l==null||l==="")return jn(n,jl(n));if(s.path)return jn(n,a.jsx("span",{"data-path-value":"true",style:EE,children:l}));const o=s.tabular?yl:s.mono?jy:Sy;return jn(n,a.jsx("span",{style:o,children:l}))}function AE({skill:n,allSkills:l=[],onSelectSkill:s}){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:16},children:[ME(n),n.origin==="installed"?LE(n):null,zE(n),_E(n),OE(n),IE(n,l,s)]})}function ME(n){const l=n.homepage?a.jsxs("a",{href:n.homepage,target:"_blank",rel:"noopener noreferrer","data-external-link":"homepage",style:{...jy,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:[a.jsx("span",{children:n.homepage}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:11,color:"var(--text-accent)"},children:"↗"})]}):jl("Homepage"),s=n.tags&&n.tags.length>0?a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:n.tags.map(o=>a.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))}):jl("Tags");return a.jsxs("section",{style:Rl,"aria-labelledby":"md-frontmatter",children:[a.jsx("h3",{id:"md-frontmatter",style:Tl,children:"Frontmatter"}),xl("Description",n.description??null),xl("Version",n.version??null,{tabular:!0}),xl("Category",n.category??null),xl("Author",n.author??null),xl("License",n.license??null),jn("Homepage",l),jn("Tags",s)]},"frontmatter")}function LE(n){const l=n.sourceAgent,s=l?a.jsx("span",{style:Sy,"data-agent-id":l,children:RE(l)}):jl("Agent");return a.jsxs("section",{style:Rl,"aria-labelledby":"md-source-agent",children:[a.jsx("h3",{id:"md-source-agent",style:Tl,children:"Source agent"}),jn("Agent",s)]},"source-agent")}function zE(n){const l=n.lastModified?a.jsx("span",{style:yl,title:n.lastModified,children:ky(n.lastModified)}):jl("Last modified"),s=n.entryPoint??"SKILL.md",o=n.dir?`${n.dir.replace(/\/$/,"")}/${s}`:s,c=a.jsx("button",{type:"button","data-entry-chip":"true",title:`Copy ${o}`,"aria-label":`Copy entry-point path ${o} to clipboard`,onClick:()=>DE(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:s});return a.jsxs("section",{style:Rl,"aria-labelledby":"md-fs",children:[a.jsx("h3",{id:"md-fs",style:Tl,children:"Filesystem"}),xl("Directory",n.dir||null,{path:!0}),jn("Entry point",c),jn("Size",a.jsx("span",{style:yl,children:TE(n.sizeBytes)})),jn("Last modified",l)]},"filesystem")}function DE(n){var l;try{(l=navigator.clipboard)==null||l.writeText(n)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:`Copied ${n}`,severity:"info"}}))}function _E(n){const l=n.benchmarkStatus==="pass"?"var(--status-installed)":n.benchmarkStatus==="fail"?"var(--red, #b54444)":"var(--status-own)",s=a.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:7,height:7,borderRadius:999,background:l}}),n.benchmarkStatus]}),o=n.lastBenchmark?a.jsx("span",{style:yl,title:n.lastBenchmark,children:ky(n.lastBenchmark)}):jl("Last benchmark");return a.jsxs("section",{style:Rl,"aria-labelledby":"md-bench",children:[a.jsx("h3",{id:"md-bench",style:Tl,children:"Benchmark"}),jn("Eval count",a.jsx("span",{style:yl,children:n.evalCount})),jn("Assertions",a.jsx("span",{style:yl,children:n.assertionCount})),jn("Status",s),jn("Last benchmark",o)]},"benchmark")}function OE(n){const l=n.mcpDeps??[];return a.jsxs("section",{style:Rl,"aria-labelledby":"md-mcp",children:[a.jsx("h3",{id:"md-mcp",style:Tl,children:"MCP dependencies"}),l.length===0?a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No MCP dependencies"}):a.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:l.map(s=>a.jsxs("li",{"data-mcp-dep":s,style:{display:"flex",alignItems:"center",gap:8,padding:"6px 0",borderBottom:"1px solid var(--border-default)"},children:[a.jsx(BE,{}),a.jsx("span",{style:{fontFamily:"var(--font-sans)",fontSize:13,color:"var(--text-primary)"},children:s})]},s))})]},"mcp-deps")}function BE(){return a.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:[a.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),a.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"})]})}function IE(n,l,s){const o=n.deps??[];return a.jsxs("section",{style:Rl,"aria-labelledby":"md-skill-deps",children:[a.jsx("h3",{id:"md-skill-deps",style:Tl,children:"Skill dependencies"}),o.length===0?a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:0},children:"No skill dependencies"}):a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:o.map(c=>{const f=HE(c,l),d=f!=null,h={fontFamily:"var(--font-sans)",fontSize:12,padding:"3px 10px",border:"1px solid var(--border-default)",borderRadius:999,color:d?"var(--text-primary)":"var(--text-secondary)",background:"transparent",cursor:d?"pointer":"help"},x=d&&s?()=>s({plugin:f.plugin,skill:f.skill,origin:f.origin}):void 0,p=d&&s?y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),s({plugin:f.plugin,skill:f.skill,origin:f.origin}))}:void 0;return a.jsx("button",{type:"button","data-chip":"skill-dep","data-present":d?"true":"false",title:d?`Open ${c}`:"Not installed",onClick:x,onKeyDown:p,style:h,children:c},c)})})]},"skill-deps")}function HE(n,l){const[s,o]=n.includes("/")?n.split("/"):["",n];for(const c of l)if(s&&c.plugin===s&&c.skill===o||!s&&c.skill===o)return c;return null}const $g=g.memo(function({message:l,politeness:s="polite",role:o}){const c=o??(s==="assertive"?"alert":"status");return a.jsx("div",{"aria-live":s,"aria-atomic":"true",role:c,"data-testid":"aria-live","data-politeness":s,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:l})});function UE({toast:n,onDismiss:l}){const[s,o]=g.useState(!0),c=g.useRef(null);g.useEffect(()=>(c.current=requestAnimationFrame(()=>{c.current=requestAnimationFrame(()=>o(!1))}),()=>{c.current!=null&&cancelAnimationFrame(c.current)}),[]);const f={success:"var(--status-installed)",info:"var(--text-secondary)",error:"var(--color-accent, var(--accent-surface))"};return a.jsxs("div",{role:n.severity==="error"?"alert":"status","data-testid":"toast-item","data-severity":n.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 ${f[n.severity]}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.12)",fontFamily:"var(--font-sans)",fontSize:12,transform:s?"translateY(8px)":"translateY(0)",opacity:s?0:1,transition:"transform var(--duration-base, 180ms) var(--ease-standard, ease), opacity var(--duration-base, 180ms) var(--ease-standard, ease)"},children:[a.jsx("span",{style:{flex:1,minWidth:0},children:n.message}),n.action&&a.jsx("button",{type:"button",onClick:()=>{n.action.onInvoke(),l(n.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:n.action.label}),a.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>l(n.id),style:{background:"transparent",border:"none",padding:2,color:"var(--text-secondary)",cursor:"pointer",fontSize:14,lineHeight:1},children:"×"})]})}function $E({toasts:n,onDismiss:l,liveMessage:s,liveAssertiveMessage:o}){return a.jsxs(a.Fragment,{children:[a.jsx($g,{politeness:"polite",message:s}),a.jsx($g,{politeness:"assertive",message:o}),n.length>0&&a.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:n.map(c=>a.jsx("div",{style:{pointerEvents:"auto"},children:a.jsx(UE,{toast:c,onDismiss:l})},c.id))})]})}const wy=g.createContext(null);function kf(){const n=g.useContext(wy);if(!n)throw new Error("useToast must be used inside <ToastProvider>.");return n}function PE({children:n,maxVisible:l=4,defaultDurationMs:s=4e3}){const[o,c]=g.useState([]),[f,d]=g.useState(""),[h,x]=g.useState(""),p=g.useRef(new Map),y=g.useCallback(C=>{const w=p.current.get(C);w&&(clearTimeout(w),p.current.delete(C)),c(A=>A.filter(_=>_.id!==C))},[]),v=g.useCallback((C,w)=>{if(w<=0)return;const A=setTimeout(()=>{y(C)},w);p.current.set(C,A)},[y]),b=g.useCallback(C=>{const w=C.id??`toast-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,A={id:w,message:C.message,severity:C.severity??"info",durationMs:C.durationMs??s,action:C.action};return c(_=>[..._,A]),A.severity==="error"?x(A.message):d(A.message),v(w,A.durationMs),w},[s,v]),j=g.useCallback(()=>{for(const C of p.current.values())clearTimeout(C);p.current.clear(),c([])},[]);g.useEffect(()=>{function C(w){w.key==="Escape"&&c(A=>{if(A.length===0)return A;const _=A.slice(0,l),H=_[_.length-1],L=p.current.get(H.id);return L&&(clearTimeout(L),p.current.delete(H.id)),A.filter($=>$.id!==H.id)})}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[l]),g.useEffect(()=>()=>{for(const C of p.current.values())clearTimeout(C);p.current.clear()},[]);const k=o.slice(0,l),N=g.useMemo(()=>({toast:b,dismiss:y,clear:j}),[b,y,j]);return a.jsxs(wy.Provider,{value:N,children:[n,a.jsx($E,{toasts:k,onDismiss:y,liveMessage:f,liveAssertiveMessage:h})]})}function VE(n){const{toast:l}=kf(),s=g.useRef(n);s.current=n;const o=g.useCallback(async(...c)=>{const f=s.current,d=f.snapshot();f.apply(...c),f.confirmGraceMs;const h=f.timeoutMs??5e3;let x=!1,p,y=!1;const v=f.commit(...c).then(()=>{x=!0,y=!0},k=>{x=!0,p=k??new Error("Commit failed")}),b=new Promise(k=>{setTimeout(k,h)});if(await Promise.race([v,b]),!x)p=new Error("TIMEOUT");else if(y)return;f.rollback(d);const j=typeof f.failureMessage=="function"?f.failureMessage(p):f.failureMessage??"Couldn't complete that action.";l({message:j,severity:"error",durationMs:0,action:{label:"Retry",onInvoke:()=>{o(...c)}}})},[l]);return{run:o}}const Pg=6e4;function FE({skill:n}){const{refreshUpdates:l}=Ca(),{toast:s}=kf(),[o,c]=g.useState("idle"),[f,d]=g.useState(null),[h,x]=g.useState(!1),[p,y]=g.useState(null),[v,b]=g.useState(!1),j=g.useRef(null),k=g.useRef(null),N=g.useCallback(()=>new Promise((H,L)=>{if(!n){L(new Error("No skill selected"));return}const $=Ne.startSkillUpdate(n.plugin,n.skill);j.current=$;const E=()=>{k.current&&(clearTimeout(k.current),k.current=null);try{$.close()}catch{}j.current=null};k.current=setTimeout(()=>{E(),L(new Error("TIMEOUT"))},Pg),$.addEventListener("progress",D=>{try{const R=JSON.parse(D.data);typeof(R==null?void 0:R.status)=="string"&&d(R.status)}catch{}}),$.addEventListener("done",()=>{E(),c("done"),d(null),l(),s({message:`Updated ${n.skill}.`,severity:"success",durationMs:4e3}),H()}),$.addEventListener("error",D=>{E();let R="Stream error";try{const B=typeof D.data=="string"?JSON.parse(D.data):null;B!=null&&B.error&&(R=String(B.error))}catch{}L(new Error(R))})}),[n,l,s]),C=VE({snapshot:()=>({status:o}),apply:()=>{c("updating"),d("updating")},commit:()=>N(),rollback:H=>{c(H.status==="updating"?"idle":H.status),d(null)},failureMessage:H=>`Couldn't update ${(n==null?void 0:n.skill)??"skill"} — ${H.message}`,timeoutMs:Pg+1e3});if(g.useEffect(()=>{if(!h||p!=null||!n||!n.latestVersion)return;let H=!1;return b(!0),Ne.getVersionDiff(n.plugin,n.skill,n.currentVersion??"",n.latestVersion).then(L=>{H||y(L)}).catch(()=>{H||y(null)}).finally(()=>{H||b(!1)}),()=>{H=!0}},[h,p,n==null?void 0:n.plugin,n==null?void 0:n.skill,n==null?void 0:n.latestVersion,n==null?void 0:n.currentVersion,n]),g.useEffect(()=>()=>{if(k.current&&clearTimeout(k.current),j.current)try{j.current.close()}catch{}},[]),!n||n.updateAvailable!==!0)return null;const w=n.latestVersion,A=o==="updating"?"Updating…":w?`Update to ${w}`:"Update",_=o==="updating";return a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("button",{type:"button","data-testid":"update-action-button",onClick:()=>{C.run()},disabled:_,style:{height:36,padding:"0 14px",background:"var(--color-ink)",color:"var(--color-paper)",border:"none",borderRadius:4,cursor:_?"not-allowed":"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500},children:A}),a.jsx("button",{type:"button","data-testid":"update-action-toggle-changelog",onClick:()=>x(H=>!H),disabled:_||!w,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"})]}),f&&a.jsx("div",{"data-testid":"update-action-progress",role:"status",style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-muted, var(--text-secondary))"},children:f}),h&&w&&a.jsxs("div",{"data-testid":"update-action-changelog",style:{paddingTop:8},children:[v&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Loading changelog…"}),!v&&p&&a.jsx(Sf,{contentDiff:p.contentDiff,fromLabel:p.from,toLabel:p.to,diffSummary:p.diffSummary??void 0,renderContext:"inline"}),!v&&!p&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)"},children:"Couldn't load changelog."})]})]})}function Rd(){const{state:n,setMobileView:l}=Ca();return n.isMobile?a.jsxs("button",{onClick:()=>l("list"),className:"flex items-center gap-1.5 px-3 py-2 text-[12px] font-medium",style:{background:"var(--surface-1)",color:"var(--text-secondary)",border:"none",borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",width:"100%"},children:[a.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("polyline",{points:"15 18 9 12 15 6"})}),"Back to skills"]}):null}function GE(n={}){if(n.selectedSkillInfo!==void 0||n.loadError!==void 0)return WE(n);const{state:l,selectSkill:s,setMode:o,refreshSkills:c}=Ca(),[f,d]=g.useState(typeof window<"u"?window.location.hash:"");if(g.useEffect(()=>{const p=()=>d(window.location.hash);return window.addEventListener("hashchange",p),()=>window.removeEventListener("hashchange",p)},[]),f==="#/updates")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Rd,{}),a.jsx(jE,{})]});if(l.mode==="create")return a.jsxs("div",{className:"h-full overflow-auto animate-fade-in",children:[a.jsx(Rd,{}),a.jsx(vE,{onCreated:(p,y)=>{o("browse"),c(),s({plugin:p,skill:y,origin:"source"})},onCancel:()=>o("browse")})]});if(!l.selectedSkill)return l.skillsError?a.jsx(wo,{variant:"error",message:l.skillsError,onRetry:c}):!l.skillsLoading&&l.skills.length===0?a.jsx(wo,{variant:"no-skills"}):a.jsx(wo,{variant:"no-selection"});const h=l.selectedSkill,x=l.skills.find(p=>p.plugin===h.plugin&&p.skill===h.skill)??null;return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsx(Rd,{}),a.jsx(qE,{skillInfo:x,allSkills:l.skills,onSelectSkill:p=>s(p)})]})}function WE(n){const l=n.selectedSkillInfo??null,s=n.activeDetailTab??"overview";if(l==null)return XE();if(n.loadError)return QE(l,n.loadError);const o=n.allSkills&&n.onSelectSkill?{allSkills:n.allSkills,onSelectSkill:n.onSelectSkill}:void 0;return Cy(l,s,n.onDetailTabChange,o)}function qE({skillInfo:n,allSkills:l,onSelectSkill:s}){const[o,c]=g.useState("overview"),f=g.useMemo(()=>n?Cy(n,o,c,{allSkills:l,onSelectSkill:s}):a.jsx(wo,{variant:"no-selection"}),[n,o,l,s]);return a.jsx("div",{className:"flex flex-col h-full",style:{background:"var(--bg-canvas)"},children:f})}const YE=[{id:"overview",label:"Overview"},{id:"versions",label:"Versions"}];function KE(n,l){return a.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:YE.map(s=>{const o=s.id===n;return a.jsx("button",{type:"button",role:"tab","aria-selected":o,tabIndex:o?0:-1,id:`detail-tab-${s.id}`,"aria-controls":`detail-panel-${s.id}`,onClick:()=>l==null?void 0:l(s.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:s.label},s.id)})})}function XE(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:32,background:"var(--bg-canvas)"},children:[a.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"}),a.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 QE(n,l){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:24,background:"var(--bg-canvas)",height:"100%"},children:[jf({skill:n}),a.jsxs("section",{role:"alert",style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:8,padding:"14px 16px"},children:[a.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 ",n.skill]}),a.jsx("p",{style:{fontFamily:"var(--font-sans)",fontSize:12,color:"var(--text-secondary)",margin:"0 0 12px",wordBreak:"break-word"},children:l}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.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"}),a.jsx("button",{type:"button",onClick:()=>{var s;return(s=navigator.clipboard)==null?void 0:s.writeText(n.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 Cy(n,l,s,o){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-canvas)"},children:[a.jsx("div",{style:{padding:16,paddingBottom:12},children:jf({skill:n})}),a.jsx(FE,{skill:n}),KE(l,s),a.jsxs("div",{role:"tabpanel",id:`detail-panel-${l}`,"aria-labelledby":`detail-tab-${l}`,style:{flex:1,minHeight:0,overflow:"auto"},children:[l==="overview"&&a.jsxs(a.Fragment,{children:[AE({skill:n,allSkills:(o==null?void 0:o.allSkills)??[],onSelectSkill:o==null?void 0:o.onSelectSkill}),o!=null&&a.jsx(jg,{plugin:n.plugin,skill:n.skill,origin:n.origin,children:a.jsx("div",{style:{minHeight:520,display:"flex",flexDirection:"column"},children:a.jsx(dE,{hideHeader:!0})})},`${n.plugin}/${n.skill}-workspace`)]}),l==="versions"&&o!=null&&a.jsx(jg,{plugin:n.plugin,skill:n.skill,origin:n.origin,children:a.jsx("div",{style:{padding:16},children:a.jsx(ly,{})})},`${n.plugin}/${n.skill}-versions`),l==="versions"&&o==null&&a.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 ZE(){const{updateCount:n,state:l,dismissUpdateNotification:s}=Ca(),o=n>0&&!l.updateNotificationDismissed;return g.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(),1e4);return()=>clearTimeout(c)},[o,s]),o?a.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:[a.jsxs("span",{children:[n," update",n===1?"":"s"," available"]}),a.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"}),a.jsx("button",{onClick:s,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 JE=[{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 eN({open:n,onClose:l,groups:s=JE,title:o=J.shortcuts.title}){const c=g.useRef(null),f=g.useRef(null);return g.useEffect(()=>{var d;if(n)return c.current=document.activeElement??null,(d=f.current)==null||d.focus(),()=>{var h,x;(x=(h=c.current)==null?void 0:h.focus)==null||x.call(h),c.current=null}},[n]),g.useEffect(()=>{if(!n)return;function d(h){var x;if(h.key==="Escape"){h.preventDefault(),l();return}h.key==="Tab"&&(h.preventDefault(),(x=f.current)==null||x.focus())}return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[n,l]),n?a.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:d=>{d.target===d.currentTarget&&l()},children:a.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:[a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[a.jsx("h2",{id:"shortcut-modal-title",style:{margin:0,fontFamily:"var(--font-serif)",fontWeight:500,fontSize:18},children:o}),a.jsx("button",{ref:f,type:"button","aria-label":"Close",onClick:l,style:{background:"transparent",border:"1px solid var(--border-default)",borderRadius:4,padding:"2px 8px",color:"var(--text-secondary)",cursor:"pointer",fontSize:13},children:"Esc"})]}),s.map(d=>a.jsxs("section",{style:{marginBottom:12},children:[a.jsx("h3",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",color:"var(--text-secondary)",margin:"0 0 6px"},children:d.name}),a.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:d.items.map(h=>a.jsxs("li",{style:{display:"flex",justifyContent:"space-between",padding:"4px 0",borderTop:"1px solid var(--border-default)",fontSize:13},children:[a.jsx("span",{children:h.label}),a.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})]},`${d.name}:${h.keys}`))})]},d.name))]})}):null}function tN(n){const l=J.actions,s=[{action:"open",label:l.open},{action:"copy-path",label:l.copyPath},{action:"reveal",label:l.revealInEditor},{action:"run-benchmark",label:l.runBenchmark}];if(n.origin==="source"){const c=[...s,{action:"edit",label:l.edit},{action:"duplicate",label:l.duplicate},{action:"test-install",label:l.testInstall}];return n.provenance&&c.push({action:"revert",label:l.revert}),c}const o=[...s];return o.push({action:"promote",label:l.promote}),n.updateAvailable&&o.push({action:"update",label:l.update}),o.push({action:"uninstall",label:l.uninstall}),o}function nN({state:n,onClose:l,onAction:s,itemsOverride:o}){const c=g.useRef(null),f=g.useRef(null),[d,h]=g.useState(0),x=g.useMemo(()=>n.skill?o??tN(n.skill):[],[n.skill,o]),p=g.useMemo(()=>{if(typeof window>"u")return{left:n.x,top:n.y};const v=8,b=220,j=44+x.length*28;let k=n.x,N=n.y;return k+b+v>window.innerWidth&&(k=Math.max(v,n.x-b)),N+j+v>window.innerHeight&&(N=Math.max(v,n.y-j)),{left:k,top:N}},[n.x,n.y,x.length]);g.useEffect(()=>{if(n.open)return f.current=document.activeElement??null,h(0),requestAnimationFrame(()=>{var v;(v=c.current)==null||v.focus()}),()=>{var v,b;(b=(v=f.current)==null?void 0:v.focus)==null||b.call(v),f.current=null}},[n.open]);const y=g.useCallback(()=>{if(!n.skill)return;const v=x[d];!v||v.disabled||(s(v.action,n.skill),l())},[x,d,n.skill,s,l]);return g.useEffect(()=>{if(!n.open)return;function v(j){if(j.key==="Escape"){j.preventDefault(),l();return}if(j.key==="ArrowDown"){j.preventDefault(),h(k=>Math.min(k+1,Math.max(x.length-1,0)));return}if(j.key==="ArrowUp"){j.preventDefault(),h(k=>Math.max(k-1,0));return}if(j.key==="Enter"||j.key===" "){j.preventDefault(),y();return}}function b(j){c.current&&j.target instanceof Node&&(c.current.contains(j.target)||l())}return window.addEventListener("keydown",v,!0),window.addEventListener("mousedown",b,!0),()=>{window.removeEventListener("keydown",v,!0),window.removeEventListener("mousedown",b,!0)}},[n.open,l,x.length,y]),!n.open||!n.skill?null:a.jsx("div",{ref:c,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((v,b)=>a.jsx("div",{role:"menuitem","aria-disabled":v.disabled||void 0,"data-action":v.action,"data-selected":b===d||void 0,onMouseEnter:()=>h(b),onClick:()=>{v.disabled||(s(v.action,n.skill),l())},style:{padding:"5px 10px",borderRadius:4,cursor:v.disabled?"default":"pointer",opacity:v.disabled?.5:1,background:b===d?"color-mix(in srgb, var(--accent-surface) 10%, transparent)":"transparent"},children:v.label},v.action))})}const aN={"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 rN(n){return n?aN[n]??null:null}function lN({open:n,providerKey:l,onClose:s}){const o=g.useRef(null);if(g.useEffect(()=>{if(!n)return;const d=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[n,s]),g.useEffect(()=>{if(!n)return;const d=o.current;if(!d)return;const h=d.querySelector("button, a[href], [tabindex]:not([tabindex='-1']), input, textarea, select");h==null||h.focus()},[n]),!n||typeof document>"u")return null;const c=rN(l),f=(c==null?void 0:c.name)??J.setupDrawer.fallbackTitle;return Do.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-testid":"setup-drawer-backdrop","aria-hidden":"true",onClick:s,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.4)",zIndex:99,animation:"vskillDrawerBackdropIn 120ms ease"}}),a.jsxs("div",{"data-testid":"setup-drawer",ref:o,role:"dialog","aria-modal":"true","aria-label":J.setupDrawer.title(f),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:[a.jsx(sN,{title:f,onClose:s}),a.jsx("div",{"data-testid":"setup-drawer-body",style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:c?a.jsx(iN,{content:c}):a.jsx(oN,{})}),a.jsx("style",{children:`@keyframes vskillDrawerIn {
92
- from { transform: translateX(100%); }
93
- to { transform: translateX(0); }
94
- }
95
- @keyframes vskillDrawerBackdropIn {
96
- from { opacity: 0; }
97
- to { opacity: 1; }
98
- }`})]})]}),document.body)}function sN({title:n,onClose:l}){return a.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 20px",borderBottom:"1px solid var(--border-default, var(--border-subtle))"},children:[a.jsx("h2",{style:{fontFamily:"var(--font-serif)",fontSize:18,fontWeight:500,margin:0,color:"var(--text-primary)"},children:J.setupDrawer.title(n)}),a.jsx("button",{type:"button","data-testid":"setup-drawer-close",onClick:l,"aria-label":J.setupDrawer.close,style:{background:"transparent",border:"none",color:"var(--text-secondary)",cursor:"pointer",fontSize:18,padding:4,lineHeight:1},children:"×"})]})}function iN({content:n}){var l,s;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[a.jsx("p",{style:{fontSize:14,lineHeight:1.5,color:"var(--text-primary)",margin:0},children:n.description}),n.notes&&n.notes.length>0&&a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:n.notes.map(o=>a.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))}),n.envVars.length>0&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.requiredEnv}),a.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:6},children:n.envVars.map(o=>a.jsx("li",{children:a.jsx(cN,{name:o})},o))})]}),n.keyUrl&&a.jsx(uN,{href:n.keyUrl,label:J.setupDrawer.getKey,testId:"setup-drawer-get-key"}),(n.install||n.start||n.pullExample)&&a.jsxs("section",{children:[a.jsx("h3",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-secondary)",margin:"0 0 8px"},children:J.setupDrawer.installRun}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[(l=n.install)==null?void 0:l.map((o,c)=>a.jsx(Ad,{code:o},`install-${c}`)),(s=n.start)==null?void 0:s.map((o,c)=>a.jsx(Ad,{code:o},`start-${c}`)),n.pullExample&&a.jsx(Ad,{code:n.pullExample})]})]}),a.jsx("footer",{style:{marginTop:8},children:a.jsxs("a",{href:n.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 oN(){return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[a.jsx("h3",{style:{margin:0,fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:J.setupDrawer.fallbackTitle}),a.jsx("p",{style:{margin:0,fontSize:13,color:"var(--text-secondary)",lineHeight:1.5},children:J.setupDrawer.fallbackBody})]})}function cN({name:n}){const l=async()=>{var s;try{await((s=navigator.clipboard)==null?void 0:s.writeText(n))}catch{}};return a.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:[a.jsx("code",{style:{fontFamily:"var(--font-mono)",fontSize:12,color:"var(--text-primary)",flex:1},children:n}),a.jsx("button",{type:"button",onClick:l,"aria-label":`Copy ${n} 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 Ad({code:n}){return a.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:n})}function uN({href:n,label:l,testId:s}){return a.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer","data-testid":s,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:[l," →"]})}function dN(){const[n,l]=g.useState(!1),[s,o]=g.useState(null),c=g.useRef(null),f=g.useCallback((h,x)=>{var p;c.current=typeof document<"u"?document.activeElement:null,(p=x==null?void 0:x.beforeOpen)==null||p.call(x),o(h),l(!0)},[]),d=g.useCallback(()=>{l(!1);const h=c.current;h&&"focus"in h&&typeof h.focus=="function"&&queueMicrotask(()=>h.focus())},[]);return{open:f,close:d,isOpen:n,providerKey:s}}function fN(n){const l=[],s=[],o=new Set;for(const c of n){if(c.presence==="absent"||c.health==="missing"){s.push({kind:"individual",key:c.id,agent:c});continue}if(c.sharedFolderGroup&&c.sharedFolderGroup.length>1){const f=[...c.sharedFolderGroup].sort().join("+");if(o.has(f))continue;o.add(f);const d=n.filter(h=>c.sharedFolderGroup.includes(h.id));l.push({kind:"aggregate",key:`shared:${f}`,consumers:d,sharedFolderPath:c.sharedFolderPath??"~/.config/agents/skills",combinedCount:d.reduce((h,x)=>h+x.globalCount,0)});continue}l.push({kind:"individual",key:c.id,agent:c})}return{detected:l,notDetected:s}}function pN({agents:n,activeAgentId:l,focusedAgentId:s,onFocusAgent:o,onSwitch:c,onOpenSetup:f,onClose:d}){const h=g.useRef(null);g.useEffect(()=>{const y=v=>{v.key==="Escape"&&(v.preventDefault(),d())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[d]),g.useEffect(()=>{const y=b=>{h.current&&!h.current.contains(b.target)&&d()},v=setTimeout(()=>{document.addEventListener("mousedown",y)},0);return()=>{clearTimeout(v),document.removeEventListener("mousedown",y)}},[d]);const x=g.useMemo(()=>fN(n),[n]),p=n.find(y=>y.id===s)??n.find(y=>y.id===l)??n[0];return typeof document>"u"?null:Do.createPortal(a.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:[a.jsxs("div",{style:{display:"flex",height:360,maxHeight:"60vh"},children:[a.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&&a.jsx(Vg,{}),x.detected.map(y=>y.kind==="aggregate"?a.jsx(hN,{row:y,onFocus:()=>{var v;return o(((v=y.consumers[0])==null?void 0:v.id)??l??"")}},y.key):a.jsx(mN,{agent:y.agent,focused:y.agent.id===s,active:y.agent.id===l,onClick:()=>o(y.agent.id)},y.key)),x.notDetected.length>0&&a.jsxs(a.Fragment,{children:[a.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=>a.jsx(xN,{agent:y.agent,onSetUp:()=>f(y.agent.id)},y.key))]})]}),a.jsx("section",{"data-testid":"agent-scope-picker-stats",style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:p?a.jsx(gN,{agent:p,activeAgentId:l,onSwitch:()=>c(p.id)}):a.jsx(Vg,{})})]}),a.jsx("style",{children:`@keyframes scopePickerFadeIn {
99
- from { opacity: 0; transform: translateX(-50%) translateY(2px); }
100
- to { opacity: 1; transform: translateX(-50%) translateY(0); }
101
- }`})]}),document.body)}function mN({agent:n,focused:l,active:s,onClick:o}){const c=n.health==="ok"?"var(--color-ok, #22c55e)":n.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)";return a.jsxs("button",{type:"button","data-testid":"agent-scope-row","data-agent-id":n.id,"data-active":s?"true":"false",onClick:o,style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"8px 14px",background:l?"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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:c,flexShrink:0}}),a.jsx("span",{style:{flex:1,fontSize:13},children:n.displayName}),a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[n.installedCount,"·",n.globalCount]})]})}function hN({row:n,onFocus:l}){return a.jsxs("button",{type:"button","data-testid":"agent-scope-shared-folder-row",onClick:l,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:[a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-secondary)"},children:n.sharedFolderPath}),a.jsxs("span",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[n.consumers.map(s=>a.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:s.id},s.id)),a.jsxs("span",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"var(--font-mono)"},children:["· ",n.combinedCount," skills"]})]})]})}function xN({agent:n,onSetUp:l}){return a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"6px 14px",color:"var(--text-secondary)",fontFamily:"var(--font-sans)",fontSize:12},children:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--text-tertiary)",flexShrink:0}}),a.jsx("span",{style:{flex:1},children:n.displayName}),n.isRemoteOnly?a.jsx("span",{"data-testid":`agent-scope-remote-badge-${n.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"}):a.jsx("button",{type:"button","data-testid":`agent-scope-set-up-${n.id}`,onClick:l,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(n.displayName)})]})}function gN({agent:n,activeAgentId:l,onSwitch:s}){const o=n.id===l,c=n.isRemoteOnly===!0,f=o||c,d=o?"Active":c?"Remote-only":J.scopePicker.switchCta;return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontFamily:"var(--font-serif)",fontSize:16,fontWeight:500,color:"var(--text-primary)"},children:n.displayName}),a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:2},children:c?"Remote service — no local install":yN(n.health)})]}),a.jsxs("dl",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",margin:0,fontSize:12},children:[a.jsx(Md,{label:J.scopePicker.statsInstalled,value:String(n.installedCount)}),a.jsx(Md,{label:J.scopePicker.statsGlobal,value:String(n.globalCount)}),a.jsx(Md,{label:J.scopePicker.statsLastSync,value:n.lastSync?vN(n.lastSync):"—"})]}),a.jsx("button",{type:"button","data-testid":"agent-scope-switch",onClick:s,disabled:f,title:c?"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:f?"transparent":"color-mix(in srgb, var(--accent-surface) 20%, transparent)",color:"var(--text-primary)",fontSize:12,fontWeight:500,fontFamily:"var(--font-sans)",cursor:f?"default":"pointer",opacity:f?.5:1},children:d})]})}function Md({label:n,value:l}){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-secondary)",margin:0},children:n}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,fontFamily:"var(--font-mono)",fontVariantNumeric:"tabular-nums"},children:l})]})}function Vg(){return a.jsx("div",{style:{padding:"16px 18px",fontSize:12,color:"var(--text-secondary)"},children:"No agents detected yet."})}function vN(n){try{const l=new Date(n).getTime(),s=Date.now()-l;if(Number.isNaN(l))return"—";const o=Math.round(s/6e4);if(o<1)return"just now";if(o<60)return`${o}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:`${Math.round(c/24)}d ago`}catch{return"—"}}function yN(n){switch(n){case"ok":return J.scopePicker.statsHealthOk;case"stale":return J.scopePicker.statsHealthStale;case"missing":return J.scopePicker.statsHealthMissing}}function bN(n){const l=new Map;for(const s of n.sharedFolders??[])for(const o of s.consumers)l.set(o,s);return n.agents.map(s=>{const o=l.get(s.id);return{id:s.id,displayName:s.displayName,presence:s.detected?"detected":"absent",installedCount:s.localSkillCount,globalCount:s.globalSkillCount,lastSync:s.lastSync,health:s.health,sharedFolderGroup:o?o.consumers:void 0,sharedFolderPath:o?o.path:void 0,isRemoteOnly:s.isRemoteOnly}})}function SN({agents:n,activeAgentId:l,onActiveAgentChange:s,onOpenSetup:o}){const[c,f]=g.useState(!1),[d,h]=g.useState(null),x=g.useRef(null),p=g.useMemo(()=>n.find(j=>j.id===l)??n[0]??null,[n,l]),y=g.useMemo(()=>p?p.health==="ok"?"var(--color-ok, #22c55e)":p.health==="stale"?"var(--color-own, #f59e0b)":"var(--text-tertiary)":"var(--text-tertiary)",[p]),v=g.useCallback(()=>{var j;f(!1),(j=x.current)==null||j.focus()},[]),b=g.useCallback(j=>{s(j),f(!1)},[s]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{ref:x,type:"button","data-testid":"agent-scope-picker-trigger","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>f(j=>!j),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),f(!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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:y,flexShrink:0}}),a.jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.displayName)??"Select agent"}),a.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,")"]}),a.jsx("span",{"aria-hidden":"true",style:{fontSize:10,color:"var(--text-secondary)"},children:"▾"})]}),c&&a.jsx(pN,{agents:n,activeAgentId:l,focusedAgentId:d??l,onFocusAgent:h,onSwitch:b,onOpenSetup:j=>{o(j),v()},onClose:v})]})}const Ey="vskill-ccode-banner-dismissed",jN=new Set(["claude-cli","claude-code"]);function kN(){try{return sessionStorage.getItem(Ey)==="true"}catch{return!1}}function wN(){try{sessionStorage.setItem(Ey,"true")}catch{}}function CN({activeAgentId:n}){const[l,s]=g.useState(()=>kN()),o=g.useCallback(()=>{typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:open-setup-drawer",{detail:{provider:"claude-code"}}))},[]),c=g.useCallback(()=>{wN(),s(!0)},[]);return!n||!jN.has(n)||l?null:a.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:[a.jsx("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:"50%",background:"var(--color-ok, #22c55e)",marginTop:6,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{children:[J.claudeCodeLabel.firstUseBanner," "]}),a.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})]}),a.jsx("button",{type:"button","data-testid":"claude-code-first-use-banner-dismiss",onClick:c,"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 EN(){const[n,l]=g.useState(null),[s,o]=g.useState("loading"),[c,f]=g.useState(null),d=g.useCallback(async()=>{try{const h=await Ne.getAgents();l(h),o("ready"),f(null)}catch(h){o("error"),f(h.message)}},[]);return g.useEffect(()=>{d()},[d]),g.useEffect(()=>{const h=()=>void d();return window.addEventListener("studio:agent-changed",h),()=>window.removeEventListener("studio:agent-changed",h)},[d]),{status:s,response:n,error:c,refresh:()=>void d()}}const ho="workspace",NN=["skills","agents"];async function TN(){const n=await fetch("/api/workspace");if(!n.ok)throw new Error(`GET /api/workspace failed: ${n.status}`);return await n.json()}async function RN(n){const l=await fetch("/api/workspace/active",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n})});if(!l.ok){const s=await l.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/active failed: ${l.status}`)}return await l.json()}async function AN(n){const l=await fetch("/api/workspace/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!l.ok){const s=await l.json().catch(()=>({}));throw new Error(s.error??`POST /api/workspace/projects failed: ${l.status}`)}return await l.json()}async function MN(n){const l=await fetch(`/api/workspace/projects/${encodeURIComponent(n)}`,{method:"DELETE"});if(!l.ok){const s=await l.json().catch(()=>({}));throw new Error(s.error??`DELETE /api/workspace/projects/${n} failed: ${l.status}`)}return await l.json()}function Ld(){for(const n of NN)rn(n)}function LN(){const{data:n,loading:l,error:s,revalidate:o}=Cl(ho,TN),c=n,f=c==null?void 0:c.projects.find(p=>p.id===c.activeProjectId),d=g.useCallback(async p=>{await RN(p),rn(ho),Ld()},[]),h=g.useCallback(async p=>{await AN(p),rn(ho),Ld()},[]),x=g.useCallback(async p=>{await MN(p),rn(ho),Ld()},[]);return{workspace:c,activeProject:f,loading:l,error:s,switchProject:d,addProject:h,removeProject:x,revalidate:o}}function zN({workspace:n,onSwitch:l,onAdd:s,onRemove:o,isPathStale:c}){const[f,d]=g.useState(!1),[h,x]=g.useState(!1),[p,y]=g.useState(""),[v,b]=g.useState(null),[j,k]=g.useState(null),[N,C]=g.useState(null),[w,A]=g.useState(!1),_=g.useRef(null),H=(n==null?void 0:n.projects)??[],L=H.find(R=>R.id===(n==null?void 0:n.activeProjectId));g.useEffect(()=>{if(!f)return;function R(B){_.current&&!_.current.contains(B.target)&&(d(!1),x(!1),b(null))}return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[f]);async function $(){b(null);const R=p.trim();if(!R){b("Paste an absolute path (e.g. /Users/you/projects/my-skill)");return}if(!R.startsWith("/")&&!/^[A-Za-z]:[\\/]/.test(R)){b("Path must be absolute. In Terminal, cd to the folder and run: pwd — then paste the result here.");return}try{await s({path:R}),y(""),x(!1)}catch(B){const P=B instanceof Error?B.message:String(B);/does not exist/i.test(P)?b(`Path not found on disk: ${R}`):/Duplicate/i.test(P)?b("That project is already registered."):b(P)}}async function E(){if(b(null),typeof window<"u"&&"showDirectoryPicker"in window)try{const R=await window.showDirectoryPicker();y(R.name),x(!0)}catch{}else x(!0)}function D(R){if(R.length<=50)return R;const B=R.split("/");return B.length<=4?R:`${B.slice(0,3).join("/")}/…/${B.slice(-2).join("/")}`}return a.jsxs("div",{ref:_,"data-vskill-project-picker":!0,style:{position:"relative",display:"inline-block"},children:[a.jsxs("button",{type:"button",onClick:()=>d(R=>!R),"aria-expanded":f,"aria-haspopup":"menu",title:(L==null?void 0:L.path)??"No project selected",style:{display:"flex",alignItems:"center",gap:8,padding:"4px 10px",border:"1px solid transparent",borderRadius:6,background:f?"var(--surface-2, rgba(0,0,0,0.05))":"transparent",cursor:"pointer",fontFamily:"var(--font-mono)",fontSize:13,color:"var(--text-primary)",transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:8,height:8,borderRadius:"50%",flexShrink:0,backgroundColor:(L==null?void 0:L.colorDot)??"var(--text-tertiary, #999)"}}),a.jsx("span",{style:{maxWidth:180,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L?L.name:"No project"}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary, #999)",marginLeft:2},children:f?"▴":"▾"})]}),f&&a.jsxs("div",{role:"menu","aria-label":"Switch project",style:{position:"absolute",top:"calc(100% + 4px)",left:0,minWidth:280,maxWidth:420,width:"max-content",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:8,boxShadow:"0 4px 6px -1px rgba(0,0,0,0.08), 0 10px 20px -5px rgba(0,0,0,0.12)",overflow:"hidden",zIndex:50,fontFamily:"var(--font-sans)"},children:[H.length===0&&a.jsx("div",{style:{padding:"16px 16px 12px",fontSize:12,color:"var(--text-tertiary)",lineHeight:1.5},children:"No projects registered. Add one to get started."}),H.length>0&&a.jsx("ul",{role:"none",style:{listStyle:"none",margin:0,padding:4,maxHeight:320,overflowY:"auto"},children:H.map(R=>{const B=c?c(R.path):!1,P=R.id===(n==null?void 0:n.activeProjectId),W=j===R.id;return a.jsxs("li",{role:"menuitem","data-stale":B?"true":"false",onMouseEnter:()=>k(R.id),onMouseLeave:()=>k(te=>te===R.id?null:te),onClick:()=>{if(!B){if(P){d(!1);return}C(R)}},style:{display:"flex",alignItems:"center",gap:10,padding:"8px 10px",borderRadius:6,cursor:B?"not-allowed":"pointer",background:W&&!B?"var(--surface-2, rgba(0,0,0,0.04))":P?"var(--surface-1, rgba(0,0,0,0.02))":"transparent",opacity:B?.5:1,transition:"background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{width:10,height:10,borderRadius:"50%",flexShrink:0,backgroundColor:R.colorDot,boxShadow:P?"0 0 0 2px color-mix(in oklch, currentColor 20%, transparent)":"none"}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13,fontWeight:P?600:500,color:"var(--text-primary)",lineHeight:1.3},children:[a.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.name}),P&&a.jsx("span",{"aria-label":"Active",style:{fontSize:10,color:"var(--color-action, #2F5B8E)",letterSpacing:"0.05em",textTransform:"uppercase",fontWeight:600},children:"Active"})]}),a.jsx("div",{title:R.path,style:{fontFamily:"var(--font-mono)",fontSize:11,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D(R.path)}),B&&a.jsx("div",{style:{fontSize:10,color:"var(--color-own, #b45309)",marginTop:2},children:"Path no longer exists"})]}),a.jsx("button",{type:"button","aria-label":`Remove ${R.name}`,onClick:te=>{te.stopPropagation(),o(R.id)},style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",borderRadius:4,cursor:"pointer",color:"var(--text-tertiary)",opacity:W?1:0,transition:"opacity 120ms ease, color 120ms ease, background-color 120ms ease",flexShrink:0},onMouseEnter:te=>{te.currentTarget.style.color="var(--color-error, #b91c1c)",te.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-error, #b91c1c) 10%, transparent)"},onMouseLeave:te=>{te.currentTarget.style.color="var(--text-tertiary)",te.currentTarget.style.backgroundColor="transparent"},children:a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"}),a.jsx("path",{d:"M10 11v6"}),a.jsx("path",{d:"M14 11v6"}),a.jsx("path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"})]})})]},R.id)})}),a.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:h?8:6},children:[!h&&a.jsxs("button",{type:"button",onClick:()=>void E(),className:"vskill-project-add",style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"8px 10px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:13,fontWeight:500,color:"var(--color-action, #2F5B8E)",transition:"background-color 120ms ease"},onMouseEnter:R=>{R.currentTarget.style.backgroundColor="color-mix(in oklch, var(--color-action, #2F5B8E) 10%, transparent)"},onMouseLeave:R=>{R.currentTarget.style.backgroundColor="transparent"},children:[a.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add project"]}),h&&a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("input",{type:"text",value:p,onChange:R=>y(R.target.value),onKeyDown:R=>{R.key==="Enter"&&$(),R.key==="Escape"&&(x(!1),b(null))},placeholder:"/absolute/path/to/project",autoFocus:!0,style:{width:"100%",padding:"6px 8px",fontFamily:"var(--font-mono)",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsxs("div",{style:{display:"flex",gap:6,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:()=>{x(!1),b(null),y("")},style:{padding:"4px 10px",fontSize:12,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Cancel"}),a.jsx("button",{type:"button",onClick:()=>void $(),style:{padding:"4px 10px",fontSize:12,border:"none",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-paper, #fff)",cursor:"pointer",fontWeight:500},children:"Add"})]}),v&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:v})]})]})]}),N&&a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Switch project instructions",style:{position:"fixed",inset:0,zIndex:80,display:"flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(null),children:[a.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.40)"}}),a.jsxs("div",{onClick:R=>R.stopPropagation(),style:{position:"relative",width:"min(520px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",padding:18,fontFamily:"var(--font-sans)",color:"var(--text-primary)"},children:[a.jsxs("h2",{style:{margin:0,fontSize:16,fontWeight:600,fontFamily:"var(--font-serif, ui-serif)",marginBottom:8},children:["Switch to ",N.name]}),a.jsx("p",{style:{fontSize:13,color:"var(--text-secondary)",lineHeight:1.5,margin:0,marginBottom:12},children:"Skill Studio's skill scanner reads from the folder it was launched in, so switching projects from the browser isn't possible. Quit this server and relaunch from the target folder:"}),a.jsx("div",{style:{background:"var(--surface-1, #0f0f10)",color:"var(--text-primary)",padding:"10px 12px",borderRadius:6,fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-all",border:"1px solid var(--border-subtle, rgba(255,255,255,0.08))"},children:`cd "${N.path}" && npx vskill@latest studio`}),a.jsxs("div",{style:{display:"flex",gap:8,marginTop:14,justifyContent:"flex-end"},children:[a.jsx("button",{type:"button",onClick:async()=>{try{await navigator.clipboard.writeText(`cd "${N.path}" && npx vskill@latest studio`),A(!0),setTimeout(()=>A(!1),1600)}catch{}},style:{padding:"7px 14px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"#ffffff",cursor:"pointer",boxShadow:"0 1px 2px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.12)"},children:w?"Copied!":"Copy command"}),a.jsx("button",{type:"button",onClick:()=>C(null),style:{padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer"},children:"Close"})]})]})]})]})}function DN(n,l){const s=l.trim().toLowerCase().split(/\s+/).filter(Boolean);return s.length===0?n:n.filter(o=>{const c=`${o.name} ${o.path}`.toLowerCase();return s.every(f=>c.includes(f))})}function _N({open:n,projects:l,onSwitch:s,onClose:o}){const[c,f]=g.useState(""),[d,h]=g.useState(0),x=g.useMemo(()=>DN(l,c),[l,c]);g.useEffect(()=>{n||(f(""),h(0))},[n]),g.useEffect(()=>{d>=x.length&&h(0)},[x.length,d]);const p=y=>{if(y.key==="Escape"){y.preventDefault(),o();return}if(y.key==="ArrowDown"){y.preventDefault(),h(v=>Math.min(v+1,Math.max(x.length-1,0)));return}if(y.key==="ArrowUp"){y.preventDefault(),h(v=>Math.max(v-1,0));return}if(y.key==="Enter"){y.preventDefault();const v=x[d];v&&(s(v.id),o())}};return n?a.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:[a.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:o}),a.jsxs("div",{className:"relative w-[520px] max-w-[92vw] bg-background border rounded shadow-lg",children:[a.jsx("input",{type:"text",autoFocus:!0,value:c,onChange:y=>f(y.target.value),onKeyDown:p,placeholder:"Switch project…",className:"w-full px-3 py-2 text-sm border-b outline-none"}),a.jsxs("ul",{role:"listbox",className:"max-h-80 overflow-auto",children:[x.length===0&&a.jsx("li",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No matches."}),x.map((y,v)=>a.jsxs("li",{role:"option","aria-selected":v===d,"data-highlighted":v===d,className:["flex items-center gap-2 px-3 py-2 text-sm cursor-pointer",v===d?"bg-muted":""].join(" "),onMouseEnter:()=>h(v),onClick:()=>{s(y.id),o()},children:[a.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 h-2 rounded-full",style:{backgroundColor:y.colorDot}}),a.jsxs("span",{className:"flex-1",children:[a.jsx("span",{className:"vskill-palette-name",children:y.name}),a.jsx("span",{className:"ml-2 vskill-palette-path text-xs font-mono text-muted-foreground",children:y.path})]})]},y.id))]})]})]}):null}const Fg=/^[a-z][a-z0-9-]{0,62}[a-z0-9]$/;function ON({open:n,onClose:l,initialMode:s="standalone",isClaudeCode:o,projectRoot:c,onCreated:f}){const[d,h]=g.useState("destination"),[x,p]=g.useState(s),[y,v]=g.useState(""),[b,j]=g.useState(""),[k,N]=g.useState(""),[C,w]=g.useState([]),[A,_]=g.useState(!1),[H,L]=g.useState(null);if(g.useEffect(()=>{n&&(h("destination"),p(s),v(""),j(""),N(""),L(null))},[n,s]),g.useEffect(()=>{if(!n)return;let z=!0;return fetch("/api/authoring/plugins").then(M=>M.json()).then(M=>{z&&w(M.plugins??[])}).catch(()=>{}),()=>{z=!1}},[n]),g.useEffect(()=>{if(!n)return;function z(M){M.key==="Escape"&&(M.preventDefault(),l())}return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[n,l]),!n)return null;const $=C.length>0,E=o&&$,D=o,R=Fg.test(y),B=x==="existing-plugin"?b.length>0:Fg.test(b),P=!A&&R&&(x==="standalone"||B),W=BN(c,x,b,y);async function te(){L(null),_(!0);try{const I=new URLSearchParams;I.set("mode",x),I.set("skillName",y),b&&I.set("pluginName",b);const X=await fetch(`/api/authoring/skill-exists?${I.toString()}`),G=await X.json();if(!X.ok){L(G.error??`Check failed: ${X.status}`);return}if(G.exists){L(`Skill '${y}' already exists${G.path?` at ${G.path}`:""}`);return}}catch(I){L(I instanceof Error?I.message:String(I));return}finally{_(!1)}const z=new URLSearchParams;z.set("mode",x),z.set("skillName",y),k.trim()&&z.set("description",k.trim()),b&&z.set("pluginName",b);const M=`/#/create?${z.toString()}`;typeof window<"u"&&window.location.assign(M),l()}async function Q(){L(null),_(!0);try{const z=await fetch("/api/authoring/create-skill",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:x,skillName:y,description:k.trim()||void 0,pluginName:x==="standalone"?void 0:b})}),M=await z.json();if(!z.ok||!M.ok){L(M.error??`Create failed: ${z.status}`);return}rn("skills"),f==null||f({mode:x,skillName:y,pluginName:M.pluginName??null,skillMdPath:M.skillMdPath}),l()}catch(z){L(z instanceof Error?z.message:String(z))}finally{_(!1)}}return a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Create skill","data-vskill-create-skill-modal":!0,style:{position:"fixed",inset:0,zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},children:[a.jsx("div",{onClick:l,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)"}}),a.jsxs("div",{style:{position:"relative",width:"min(560px, 92vw)",maxHeight:"86vh",overflow:"auto",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:10,boxShadow:"0 10px 15px -3px rgba(0,0,0,0.12), 0 20px 40px -8px rgba(0,0,0,0.18)",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[a.jsx("h2",{style:{margin:0,fontSize:16,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",letterSpacing:"0.01em"},children:d==="destination"?"Create a skill":"Name and describe"}),a.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:"auto",fontVariantNumeric:"tabular-nums"},children:["Step ",d==="destination"?"1":"2"," of 2"]})]}),d==="destination"&&a.jsxs("div",{style:{padding:14,display:"flex",flexDirection:"column",gap:10},children:[a.jsx(zd,{title:"Standalone skill",subtitle:"A single skill in this project",description:"Lives at <project>/skills/<name>/SKILL.md. Works with every agent.",icon:"📄",selected:x==="standalone",onClick:()=>p("standalone")}),a.jsx(zd,{title:"Add to existing plugin",subtitle:E?`${C.length} plugin source${C.length===1?"":"s"} in this project`:o?"No plugin sources in this project yet":"Claude Code only",description:"Appends a skill to an existing <plugin>/.claude-plugin/plugin.json source.",icon:"🧩",disabled:!E,selected:x==="existing-plugin",onClick:()=>E&&p("existing-plugin")}),a.jsx(zd,{title:"New plugin",subtitle:D?"Bundles one or more skills for distribution":"Claude Code only",description:"Scaffolds <plugin>/.claude-plugin/plugin.json and its first skill.",icon:"📦",disabled:!D,selected:x==="new-plugin",onClick:()=>D&&p("new-plugin")})]}),d==="details"&&a.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:12},children:[x==="new-plugin"&&a.jsx(xo,{label:"Plugin name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:b,onChange:z=>j(z.target.value.trim()),placeholder:"my-first-plugin",autoFocus:!0,style:go(!b||B)})}),x==="existing-plugin"&&a.jsx(xo,{label:"Plugin",children:a.jsxs("select",{value:b,onChange:z=>j(z.target.value),style:{...go(!0),fontFamily:"var(--font-mono)"},children:[a.jsx("option",{value:"",children:"Select a plugin…"}),C.map(z=>a.jsx("option",{value:z.name,children:z.name},z.path))]})}),a.jsx(xo,{label:"Skill name",hint:"kebab-case",children:a.jsx("input",{type:"text",value:y,onChange:z=>v(z.target.value.trim()),placeholder:"my-new-skill",autoFocus:x!=="new-plugin",style:go(!y||R)})}),a.jsx(xo,{label:"Description",hint:"One short sentence — shown in frontmatter",children:a.jsx("textarea",{value:k,onChange:z=>N(z.target.value),rows:2,placeholder:"Does a thing when Claude needs X",style:{...go(!0),resize:"vertical",minHeight:52,fontFamily:"var(--font-sans)"}})}),W&&a.jsxs("div",{style:{padding:"8px 10px",fontSize:11,fontFamily:"var(--font-mono)",color:"var(--text-secondary)",background:"var(--surface-1, rgba(0,0,0,0.03))",border:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",borderRadius:4,wordBreak:"break-all"},children:[a.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:2,fontFamily:"var(--font-sans)"},children:"Will create:"}),W.map((z,M)=>a.jsx("div",{children:z},M))]}),H&&a.jsx("div",{style:{fontSize:12,color:"var(--color-error, #b91c1c)",padding:"6px 10px",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:H})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",background:"var(--surface-1, rgba(0,0,0,0.02))"},children:[a.jsx("button",{type:"button",onClick:l,style:Dd,children:"Cancel"}),d==="destination"&&a.jsx("button",{type:"button",onClick:()=>h("details"),style:Gg,children:"Continue →"}),d==="details"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>h("destination"),style:Dd,children:"← Back"}),a.jsx("button",{type:"button",onClick:()=>void te(),disabled:!P,style:{...Dd,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Opens the AI generation flow with this destination pre-selected (choose Claude Code, Anthropic API, OpenRouter, or local models)",children:"✨ Generate with AI"}),a.jsx("button",{type:"button",onClick:()=>void Q(),disabled:!P,style:{...Gg,opacity:P?1:.5,cursor:P?"pointer":"not-allowed"},title:"Creates an empty SKILL.md scaffold you can fill in by hand",children:A?"Creating…":"Create empty scaffold"})]})]})]})]})}function zd({title:n,subtitle:l,description:s,icon:o,selected:c,disabled:f,onClick:d}){return a.jsxs("button",{type:"button",onClick:d,disabled:f,"aria-pressed":c,style:{display:"flex",gap:12,padding:"12px 14px",textAlign:"left",borderRadius:8,border:c?"2px solid var(--color-accent, #2f6f8f)":"1px solid var(--border-default, rgba(0,0,0,0.12))",background:c?"color-mix(in oklch, var(--color-accent, #2f6f8f) 8%, var(--color-paper, #fff))":f?"var(--surface-1, rgba(0,0,0,0.02))":"var(--color-paper, #fff)",color:f?"var(--text-tertiary)":"var(--text-primary)",cursor:f?"not-allowed":"pointer",opacity:f?.6:1,fontFamily:"inherit",width:"100%",transition:"border-color 120ms ease, background-color 120ms ease"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:22,lineHeight:1,marginTop:2},children:o}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:14,fontWeight:600,lineHeight:1.3},children:n}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:l}),a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",marginTop:6,lineHeight:1.5},children:s})]})]})}function xo({label:n,hint:l,children:s}){return a.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4},children:[a.jsxs("span",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:n}),l&&a.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:l})]}),s]})}function go(n){return{width:"100%",padding:"7px 10px",fontSize:13,fontFamily:"var(--font-mono)",border:`1px solid ${n?"var(--border-default, rgba(0,0,0,0.12))":"var(--color-error, #b91c1c)"}`,borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none",boxSizing:"border-box"}}const Gg={padding:"8px 16px",fontSize:13,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:6,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:"pointer",fontFamily:"inherit",boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",letterSpacing:"0.01em"},Dd={padding:"7px 12px",fontSize:13,fontWeight:500,border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:6,background:"transparent",color:"var(--text-primary)",cursor:"pointer",fontFamily:"inherit"};function BN(n,l,s,o){const c=o||"<skill-name>",f=s||"<plugin-name>",d=n||"<project>";return l==="standalone"?[`${d}/skills/${c}/SKILL.md`]:l==="existing-plugin"?[`${d}/${f}/skills/${c}/SKILL.md`]:l==="new-plugin"?[`${d}/${f}/.claude-plugin/plugin.json`,`${d}/${f}/skills/${c}/SKILL.md`]:null}function IN({open:n,onClose:l,onInstall:s,installedNames:o}){const[c,f]=g.useState([]),[d,h]=g.useState(null),[x,p]=g.useState(null),[y,v]=g.useState(!1),[b,j]=g.useState(null);return g.useEffect(()=>{n&&(v(!0),j(null),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);f(k.marketplaces??[])}).catch(k=>j(k instanceof Error?k.message:String(k))).finally(()=>v(!1)))},[n]),g.useEffect(()=>{if(!d){p(null);return}v(!0),j(null),fetch(`/api/plugins/marketplaces/${encodeURIComponent(d)}`).then(k=>k.json()).then(k=>{if(k.error)throw new Error(k.error);p(k)}).catch(k=>j(k instanceof Error?k.message:String(k))).finally(()=>v(!1))},[d]),g.useEffect(()=>{if(!n)return;function k(N){N.key==="Escape"&&l()}return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[n,l]),n?a.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Plugin marketplace","data-vskill-marketplace-drawer":!0,style:{position:"fixed",inset:0,zIndex:80},children:[a.jsx("div",{onClick:l,style:{position:"absolute",inset:0,background:"rgba(0,0,0,0.38)"}}),a.jsxs("aside",{style:{position:"absolute",top:0,right:0,bottom:0,width:"min(480px, 94vw)",background:"var(--color-paper, #fff)",borderLeft:"1px solid var(--border-default, rgba(0,0,0,0.12))",boxShadow:"-10px 0 30px -8px rgba(0,0,0,0.18)",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.08))"},children:[d&&a.jsx("button",{type:"button",onClick:()=>h(null),"aria-label":"Back to marketplaces",style:{border:"none",background:"transparent",fontSize:14,color:"var(--text-secondary)",cursor:"pointer",padding:0},children:"← Back"}),a.jsx("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text-primary)",fontFamily:"var(--font-serif, ui-serif)",flex:1},children:d?(x==null?void 0:x.name)??d:"Browse plugins"}),a.jsx("button",{type:"button",onClick:l,"aria-label":"Close",style:{border:"none",background:"transparent",fontSize:16,color:"var(--text-secondary)",cursor:"pointer",padding:"4px 6px"},children:"✕"})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12},children:[y&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"Loading…"}),b&&a.jsx("div",{style:{padding:10,fontSize:12,color:"var(--color-error, #b91c1c)",background:"color-mix(in oklch, var(--color-error, #b91c1c) 8%, transparent)",borderRadius:4},children:b}),!d&&!y&&c.length===0&&!b&&a.jsx(HN,{}),!d&&c.map(k=>a.jsxs("button",{type:"button",onClick:()=>h(k.name),style:$N,onMouseEnter:N=>{N.currentTarget.style.background="var(--surface-2, rgba(0,0,0,0.04))"},onMouseLeave:N=>{N.currentTarget.style.background="transparent"},children:[a.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:k.name}),a.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.source})]},k.name)),d&&x&&a.jsxs(a.Fragment,{children:[x.description&&a.jsx("div",{style:{fontSize:12,color:"var(--text-secondary)",padding:"0 6px 12px",lineHeight:1.5},children:x.description}),x.plugins.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"var(--text-tertiary)"},children:"This marketplace has no plugins catalogued yet."}),x.plugins.map(k=>{const N=o.has(k.name);return a.jsx("div",{style:{padding:"10px 8px",borderBottom:"1px solid var(--border-subtle, rgba(0,0,0,0.05))"},children:a.jsxs("div",{style:{display:"flex",alignItems:"start",gap:8},children:[a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",display:"flex",alignItems:"baseline",gap:8},children:[k.name,k.version&&a.jsx("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)"},children:k.version}),k.category&&a.jsx("span",{style:{fontSize:10,padding:"1px 6px",borderRadius:10,background:"var(--surface-2, rgba(0,0,0,0.05))",color:"var(--text-secondary)"},children:k.category})]}),k.description&&a.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginTop:4,lineHeight:1.5},children:k.description})]}),a.jsx("button",{type:"button",disabled:N,onClick:()=>s(k.name,d),style:{flexShrink:0,padding:"5px 12px",fontSize:12,fontWeight:600,border:N?"none":"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:N?"var(--surface-2, rgba(0,0,0,0.05))":"var(--color-action, #2F5B8E)",color:N?"var(--text-tertiary)":"var(--color-action-ink, #FFFFFF)",cursor:N?"default":"pointer",fontFamily:"inherit",boxShadow:N?"none":"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)"},children:N?"Installed":"Install"})]})},k.name)})]})]}),!d&&a.jsx("div",{style:{borderTop:"1px solid var(--border-subtle, rgba(0,0,0,0.08))",padding:12},children:a.jsx(UN,{onAdded:()=>{rn("marketplaces"),fetch("/api/plugins/marketplaces").then(k=>k.json()).then(k=>f(k.marketplaces??[]))}})})]})]}):null}function HN(){return a.jsxs("div",{style:{padding:20,fontSize:12,color:"var(--text-tertiary)",lineHeight:1.6},children:["No marketplaces configured yet. Add one below — examples:",a.jsxs("ul",{style:{marginTop:8,paddingLeft:16},children:[a.jsx("li",{children:a.jsx("code",{children:"anthropics/claude-plugins-official"})}),a.jsx("li",{children:a.jsx("code",{children:"openai/codex-plugin-cc"})})]})]})}function UN({onAdded:n}){const[l,s]=g.useState(""),[o,c]=g.useState(!1),[f,d]=g.useState(null);async function h(){const x=l.trim();if(x){c(!0),d(null);try{const p=await fetch("/api/plugins/marketplaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:x})}),y=await p.json().catch(()=>({}));if(!p.ok||!y.ok){d(y.error??`Add failed (${p.status})`);return}s(""),n()}catch(p){d(p instanceof Error?p.message:String(p))}finally{c(!1)}}}return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[a.jsx("label",{style:{fontSize:11,color:"var(--text-tertiary)",fontWeight:500},children:"Add marketplace (GitHub owner/repo, URL, or path)"}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{type:"text",value:l,onChange:x=>s(x.target.value),onKeyDown:x=>{x.key==="Enter"&&h()},placeholder:"anthropics/claude-plugins-official",disabled:o,style:{flex:1,padding:"6px 8px",fontSize:12,fontFamily:"var(--font-mono)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderRadius:4,background:"var(--surface-0, #fff)",color:"var(--text-primary)",outline:"none"}}),a.jsx("button",{type:"button",onClick:()=>void h(),disabled:o||!l.trim(),style:{padding:"6px 14px",fontSize:12,fontWeight:600,border:"1px solid var(--color-action, #2F5B8E)",borderRadius:4,background:"var(--color-action, #2F5B8E)",color:"var(--color-action-ink, #FFFFFF)",cursor:o||!l.trim()?"not-allowed":"pointer",opacity:o||!l.trim()?.5:1,boxShadow:"0 1px 2px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.12)",fontFamily:"inherit"},children:o?"Adding…":"Add"})]}),f&&a.jsx("div",{style:{fontSize:11,color:"var(--color-error, #b91c1c)"},children:f})]})}const $N={display:"block",width:"100%",textAlign:"left",padding:"10px 12px",border:"none",borderRadius:6,background:"transparent",cursor:"pointer",fontFamily:"inherit",marginBottom:2},_d=12;function PN({job:n,onDone:l}){const[s,o]=g.useState([]),[c,f]=g.useState("running"),[d,h]=g.useState(!1);if(g.useEffect(()=>{if(!n)return;o([]),f("running"),h(!1);const v=new AbortController;let b=[],j="running";return(async()=>{try{const k=await fetch("/api/plugins/install/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify({plugin:n.ref}),signal:v.signal});if(!k.ok||!k.body){f("failed"),l({ok:!1,code:k.status,lines:[`HTTP ${k.status}`]});return}const N=k.body.getReader(),C=new TextDecoder;let w="";for(;;){const{value:A,done:_}=await N.read();if(_)break;w+=C.decode(A,{stream:!0});const H=w.split(/\n\n/);w=H.pop()??"";for(const L of H){const $=L.match(/^data:\s*(.*)$/m);if($)try{const E=JSON.parse($[1]);E.type==="stdout"&&E.line?(b=[...b,E.line].slice(-_d),o(b)):E.type==="stderr"&&E.line?(b=[...b,`⚠ ${E.line}`].slice(-_d),o(b)):E.type==="done"?(j=E.ok?"ok":"failed",f(j),rn("plugins"),rn("skills"),l({ok:E.ok??!1,code:E.code??null,lines:b})):E.type==="error"&&E.error&&(b=[...b,`✘ ${E.error}`].slice(-_d),o(b))}catch{}}}j==="running"&&l({ok:!0,code:0,lines:b})}catch(k){if(k.name==="AbortError")return;f("failed"),l({ok:!1,code:null,lines:[...b,k instanceof Error?k.message:String(k)]})}})(),()=>v.abort()},[n==null?void 0:n.ref]),!n)return null;const x=c==="ok"?"var(--color-installed, #2F6A4A)":c==="failed"?"var(--color-error, #b91c1c)":"var(--color-accent, #2f6f8f)",p=c==="ok"?"✔":c==="failed"?"✘":"…",y=c==="ok"?"Installed":c==="failed"?"Install failed":"Installing";return a.jsxs("div",{role:"status","aria-live":"polite","data-vskill-install-toast":!0,style:{position:"fixed",bottom:16,right:16,width:"min(420px, 92vw)",background:"var(--color-paper, #fff)",border:"1px solid var(--border-default, rgba(0,0,0,0.12))",borderLeft:`3px solid ${x}`,borderRadius:6,boxShadow:"0 10px 20px -6px rgba(0,0,0,0.18)",zIndex:90,fontFamily:"var(--font-sans)",overflow:"hidden"},children:[a.jsxs("button",{type:"button",onClick:()=>h(v=>!v),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 12px",border:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:16,color:x,width:16,textAlign:"center"},children:c==="running"?a.jsx(VN,{}):p}),a.jsxs("span",{style:{flex:1,minWidth:0},children:[a.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--text-primary)"},children:[y,": ",n.plugin,a.jsxs("span",{style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginLeft:4},children:["@",n.marketplace]})]}),!d&&s.length>0&&a.jsx("span",{style:{display:"block",fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s[s.length-1]})]}),a.jsx("span",{"aria-hidden":!0,style:{fontSize:10,color:"var(--text-tertiary)"},children:d?"▾":"▸"})]}),d&&a.jsx("pre",{style:{margin:0,padding:"0 12px 12px",maxHeight:180,overflowY:"auto",fontFamily:"var(--font-mono)",fontSize:10,lineHeight:1.5,color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:s.length===0?"Waiting for output…":s.join(`
102
- `)})]})}function VN(){return a.jsx("span",{"aria-hidden":!0,style:{display:"inline-block",width:10,height:10,borderRadius:"50%",border:"2px solid var(--color-accent, #2f6f8f)",borderTopColor:"transparent",animation:"vskill-spin 800ms linear infinite"},children:a.jsx("style",{children:"@keyframes vskill-spin { to { transform: rotate(360deg); } }"})})}const Ny="vskill.studio.prefs";function Ty(){try{return typeof window>"u"?null:window.localStorage??null}catch{return null}}function Ry(){const n=Ty();if(!n)return{};try{const l=n.getItem(Ny);if(!l)return{};const s=JSON.parse(l);return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}catch{return{}}}function FN(n,l){const s=Ty();if(s)try{const c={...Ry(),[n]:l};s.setItem(Ny,JSON.stringify(c))}catch{}}function GN(n,l){const o=Ry()[n];return o===void 0?l:o}const Wg={open:!1,x:0,y:0,skill:null};function WN(n,l){return{open:!0,x:n.clientX,y:n.clientY,skill:l}}function kr(n,l="info"){typeof window>"u"||window.dispatchEvent(new CustomEvent("studio:toast",{detail:{message:n,severity:l}}))}function qN(n,l){var s;switch(n){case"copy-path":try{(s=navigator.clipboard)==null||s.writeText(l.dir)}catch{kr(J.toasts.permissionDenied,"error");return}kr(J.toasts.pathCopied,"info");return;case"open":case"reveal":case"edit":kr(J.actions.editPlaceholder,"info");return;case"run-benchmark":kr(J.toasts.benchmarkQueued,"info");return;case"duplicate":kr(J.toasts.skillDuplicated,"info");return;case"update":kr(J.toasts.skillUpdated,"info");return;case"uninstall":kr(J.actions.editPlaceholder,"info");return;default:return}}const YN=g.lazy(()=>_o(()=>import("./CommandPalette-6cLEufX0.js"),__vite__mapDeps([2,1]))),KN=g.lazy(()=>_o(()=>import("./CreateSkillPage-kn7xDaAP.js"),__vite__mapDeps([3,1])).then(n=>({default:n.CreateSkillPage})));function XN(){const[n,l]=g.useState(()=>typeof window<"u"&&window.location.hash.startsWith("#/create"));return g.useEffect(()=>{function s(){l(window.location.hash.startsWith("#/create"))}return window.addEventListener("hashchange",s),s(),()=>window.removeEventListener("hashchange",s)},[]),n}function QN(){return a.jsx(XS,{children:a.jsx(qS,{children:a.jsxs(PE,{children:[a.jsx(ZN,{}),a.jsx(ZE,{})]})})})}function ZN(){var Oe,Ae;const{state:n,selectSkill:l,clearSelection:s,refreshSkills:o,outdatedByOrigin:c}=Ca(),{config:f}=Nr(),{mode:d,resolvedTheme:h,setTheme:x}=yv(),{toast:p}=kf(),[y,v]=g.useState(()=>pw()),[b]=g.useState(!0),[j,k]=g.useState(!1),[N,C]=g.useState(!1),[w,A]=g.useState(!1),[_,H]=g.useState("overview"),[L,$]=g.useState(Wg),E=g.useCallback((pe,ze)=>{$(WN(pe,ze))},[]),D=EN(),[R,B]=g.useState(()=>GN("activeAgent",null));g.useEffect(()=>{var pe;!R&&((pe=D.response)!=null&&pe.suggested)&&B(D.response.suggested)},[R,(Oe=D.response)==null?void 0:Oe.suggested]);const P=g.useCallback(pe=>{B(pe),FN("activeAgent",pe),typeof window<"u"&&window.dispatchEvent(new CustomEvent("studio:agent-changed",{detail:{agentId:pe}}))},[]),W=g.useMemo(()=>D.response?bN(D.response):[],[D.response]),{workspace:te,switchProject:Q,addProject:z,removeProject:M,activeProject:I}=LN(),[X,G]=g.useState(!1),[ce,O]=g.useState(!1),[Y,se]=g.useState("standalone"),ue=g.useCallback((pe="standalone")=>{se(pe),O(!0)},[]);g.useEffect(()=>{function pe(ze){if(!(ze instanceof CustomEvent))return;const Be=ze.detail;ue((Be==null?void 0:Be.mode)??"standalone")}return window.addEventListener("studio:request-create-skill",pe),()=>window.removeEventListener("studio:request-create-skill",pe)},[ue]);const[ge,xe]=g.useState(!1),[we,ie]=g.useState(null);g.useEffect(()=>{function pe(){xe(!0)}return window.addEventListener("studio:open-marketplace",pe),()=>window.removeEventListener("studio:open-marketplace",pe)},[]);const je=g.useMemo(()=>{const pe=new Set;for(const ze of n.skills)ze.source==="plugin"&&ze.pluginName&&pe.add(ze.pluginName);return pe},[n.skills]);Gd([{key:"p",meta:!0,handler:pe=>{var Be;const ze=typeof document<"u"?document.activeElement:null;ze&&ze.tagName==="INPUT"||((Be=pe==null?void 0:pe.preventDefault)==null||Be.call(pe),G(Ot=>!Ot))}}],{enabled:!0});const _e=dN();g.useEffect(()=>{function pe(ze){if(!(ze instanceof CustomEvent))return;const Be=ze.detail;Be!=null&&Be.provider&&_e.open(Be.provider)}return window.addEventListener("studio:open-setup-drawer",pe),()=>window.removeEventListener("studio:open-setup-drawer",pe)},[_e]);const Ue=g.useCallback(()=>{$(Wg)},[]);g.useEffect(()=>{function pe(ze){if(!(ze instanceof CustomEvent))return;const Be=ze.detail;Be!=null&&Be.message&&p({message:Be.message,severity:Be.severity??"info"})}return window.addEventListener("studio:toast",pe),()=>window.removeEventListener("studio:toast",pe)},[p]),g.useEffect(()=>{document.documentElement.style.setProperty("--sidebar-width",`${y}px`)},[y]);const ae=g.useMemo(()=>n.selectedSkill?n.skills.find(pe=>pe.plugin===n.selectedSkill.plugin&&pe.skill===n.selectedSkill.skill)??null:null,[n.skills,n.selectedSkill]),fe=g.useCallback(pe=>{l({plugin:pe.plugin,skill:pe.skill,origin:pe.origin})},[l]),de=g.useMemo(()=>{if(!n.selectedSkill)return"";const pe=n.selectedSkill.origin==="installed"?"Installed":"Own";return`Viewing ${n.selectedSkill.skill} (${pe})`},[n.selectedSkill]),he=g.useMemo(()=>[{id:"switch-theme",label:J.palette.actionSwitchTheme,description:"Cycle light / dark / auto",keywords:["theme","dark","light","mode"],onInvoke:()=>x(d==="light"?"dark":d==="dark"?"auto":"light")},{id:"toggle-sidebar",label:"Toggle sidebar",description:"Show or hide the skills sidebar",keywords:["sidebar","panel","hide","show","cmd+b"],onInvoke:()=>A(pe=>!pe)},{id:"show-shortcuts",label:"Show keyboard shortcuts",description:"Open the cheatsheet",keywords:["help","keys"],onInvoke:()=>C(!0)},{id:"refresh-skills",label:"Refresh skills",description:"Re-scan local + installed",keywords:["reload","scan"],onInvoke:()=>o()}],[d,x,o]);return Gd([{key:"cmd+k",handler:()=>k(pe=>!pe)},{key:"ctrl+k",handler:()=>k(pe=>!pe)},{key:"?",handler:()=>C(pe=>!pe)},{key:"cmd+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"ctrl+shift+d",handler:()=>x(h==="light"?"dark":"light")},{key:"cmd+b",handler:()=>A(pe=>!pe)},{key:"ctrl+b",handler:()=>A(pe=>!pe)},{key:"e",handler:()=>p({message:J.actions.editPlaceholder,severity:"info"})}]),XN()?a.jsx(g.Suspense,{fallback:a.jsx("div",{style:{padding:40},children:"Loading…"}),children:a.jsx(KN,{})}):a.jsxs(a.Fragment,{children:[a.jsx(QS,{sidebarWidth:y,sidebarHidden:w||n.isMobile&&n.mobileView==="detail",banner:a.jsx(xw,{connected:b}),liveMessage:de,topRail:a.jsx(Xj,{projectName:(f==null?void 0:f.projectName)??null,selected:n.selectedSkill,onOpenPalette:()=>k(!0),onHome:s,onRequestCreateSkill:()=>ue("standalone"),projectPickerSlot:te&&te.projects.length>0?a.jsx(zN,{workspace:te,onSwitch:Q,onAdd:z,onRemove:M}):void 0}),sidebar:a.jsx(lw,{skills:n.skills,selectedKey:n.selectedSkill?{plugin:n.selectedSkill.plugin,skill:n.selectedSkill.skill}:null,onSelect:fe,isLoading:n.skillsLoading,error:n.skillsError??null,onRetry:o,onContextMenu:E,outdatedByOrigin:c,activeAgentId:R,topSlot:D.status==="ready"&&W.length>0?a.jsxs(a.Fragment,{children:[a.jsx(SN,{agents:W,activeAgentId:R,onActiveAgentChange:P,onOpenSetup:pe=>_e.open(pe)}),a.jsx(CN,{activeAgentId:R})]}):null}),resizeHandle:a.jsx(hw,{initialWidth:y??Ls,onChange:v}),main:a.jsx(GE,{selectedSkillInfo:ae,activeDetailTab:_,onDetailTabChange:H,allSkills:n.skills,onSelectSkill:fe}),statusBar:a.jsx(i2,{projectPath:(f==null?void 0:f.root)??null,modelName:(f==null?void 0:f.model)??null,health:f!=null&&f.error?"degraded":"ok",providers:(Ae=f==null?void 0:f.providers)==null?void 0:Ae.map(pe=>{const ze=pe.id;return{id:ze,label:pe.label,available:pe.available,kind:ze==="ollama"||ze==="lm-studio"?"start-service":ze==="anthropic"||ze==="openrouter"?"api-key":"cli-install"}})})}),a.jsx(eN,{open:N,onClose:()=>C(!1)}),a.jsx(lN,{open:_e.isOpen,providerKey:_e.providerKey,onClose:_e.close}),a.jsx(nN,{state:L,onClose:Ue,onAction:(pe,ze)=>qN(pe,ze)}),j&&a.jsx(g.Suspense,{fallback:null,children:a.jsx(YN,{open:j,onClose:()=>k(!1),commands:he})}),a.jsx(_N,{open:X,projects:(te==null?void 0:te.projects)??[],onSwitch:pe=>{Q(pe)},onClose:()=>G(!1)}),a.jsx(ON,{open:ce,onClose:()=>O(!1),initialMode:Y,isClaudeCode:R==="claude-code",projectRoot:(I==null?void 0:I.path)??(f==null?void 0:f.projectName)??"",onCreated:pe=>{const ze=pe.pluginName??"";o(),setTimeout(()=>{l({plugin:ze,skill:pe.skillName,origin:"source"})},500)}}),a.jsx(IN,{open:ge,onClose:()=>xe(!1),installedNames:je,onInstall:(pe,ze)=>{ie({plugin:pe,marketplace:ze,ref:`${pe}@${ze}`}),xe(!1)}}),a.jsx(PN,{job:we,onDone:pe=>{pe.ok&&setTimeout(()=>ie(null),3e3)}})]})}const qg="vskill.migrations.scope-rename.v1",JN={own:"authoring-project",installed:"available-project",global:"available-personal"},eT=/^vskill-sidebar-(.+)-(own|installed|global)-collapsed$/;function tT(n){if(n.getItem(qg)==="done")return;const l=[];for(let s=0;s<n.length;s++){const o=n.key(s);if(!o)continue;const c=o.match(eT);if(!c)continue;const[,f,d]=c,h=JN[d];if(!h)continue;const x=n.getItem(o);x!==null&&l.push({oldKey:o,newKey:`vskill-sidebar-${f}-${h}-collapsed`,value:x})}for(const{oldKey:s,newKey:o,value:c}of l)n.getItem(o)===null&&n.setItem(o,c),n.removeItem(s);n.setItem(qg,"done")}if(typeof PerformanceObserver<"u")try{const n=new PerformanceObserver(l=>{for(const s of l.getEntries())if(s.name==="first-contentful-paint"){window.__vskillPaint=s.startTime,n.disconnect();return}});n.observe({type:"paint",buffered:!0})}catch{}if(typeof window<"u"&&window.localStorage)try{tT(window.localStorage)}catch{}Xb.createRoot(document.getElementById("root")).render(a.jsx(g.StrictMode,{children:a.jsx(gS,{children:a.jsx(n2,{children:a.jsx(QN,{})})})}));export{Ws as E,fv as L,qs as P,Ce as R,gE as S,Nr as a,Ry as b,mE as c,$o as d,GN as g,a as j,g as r,J as s,Qd as t,L0 as u,FN as w};