@grackle-ai/web 0.137.1 → 0.138.1

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.
@@ -0,0 +1,781 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/McpAppWidget-D-BOXq5b.js","assets/dagview-B70jDsRo.js","assets/grpc-atodrdN_.js","assets/KnowledgePage-BiRwaek_.js","assets/markdown-CPoGw-1N.js","assets/KnowledgePage-CcVVrk7r.css","assets/SessionsListPage-FmlKSLrz.js","assets/SessionsListPage-DXffE_Gw.css"])))=>i.map(i=>d[i]);
2
+ import{r as Z2,a as Y2,b as y,j as a,d as fd,H as zo,P as $o,i as U_,B as V_,c as q_,C as G_,M as F_,e as J2,f as Lc,h as W2,k as X2}from"./dagview-B70jDsRo.js";import{c as Q2,a as Td,G as ej,b as tj,d as nj,e as sj,p as aj,f as ij,g as oj,h as rj,i as lj,M as cj,D as K_,A as Z_,W as dj,O as uj,j as fj,C as Bs,k as jm,l as Y_,w as pj,t as mj,m as Bc,n as hj,R as zc,S as yy}from"./grpc-atodrdN_.js";import{v as gj,r as vj,t as $c,i as yj,f as bj,M as Tm,a as Nm}from"./markdown-CPoGw-1N.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))r(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function o(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(c){if(c.ep)return;c.ep=!0;const d=o(c);fetch(c.href,d)}})();var Xf={exports:{}},Hr={},Qf={exports:{}},ep={};/**
3
+ * @license React
4
+ * scheduler.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 by;function _j(){return by||(by=1,(function(t){function s(H,O){var q=H.length;H.push(O);e:for(;0<q;){var ge=q-1>>>1,se=H[ge];if(0<c(se,O))H[ge]=O,H[q]=se,q=ge;else break e}}function o(H){return H.length===0?null:H[0]}function r(H){if(H.length===0)return null;var O=H[0],q=H.pop();if(q!==O){H[0]=q;e:for(var ge=0,se=H.length,ce=se>>>1;ge<ce;){var me=2*(ge+1)-1,xe=H[me],De=me+1,ot=H[De];if(0>c(xe,q))De<se&&0>c(ot,xe)?(H[ge]=ot,H[De]=q,ge=De):(H[ge]=xe,H[me]=q,ge=me);else if(De<se&&0>c(ot,q))H[ge]=ot,H[De]=q,ge=De;else break e}}return O}function c(H,O){var q=H.sortIndex-O.sortIndex;return q!==0?q:H.id-O.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var u=Date,f=u.now();t.unstable_now=function(){return u.now()-f}}var m=[],h=[],v=1,b=null,_=3,x=!1,S=!1,j=!1,T=!1,N=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function A(H){for(var O=o(h);O!==null;){if(O.callback===null)r(h);else if(O.startTime<=H)r(h),O.sortIndex=O.expirationTime,s(m,O);else break;O=o(h)}}function E(H){if(j=!1,A(H),!S)if(o(m)!==null)S=!0,R||(R=!0,X());else{var O=o(h);O!==null&&ne(E,O.startTime-H)}}var R=!1,L=-1,M=5,$=-1;function Y(){return T?!0:!(t.unstable_now()-$<M)}function U(){if(T=!1,R){var H=t.unstable_now();$=H;var O=!0;try{e:{S=!1,j&&(j=!1,C(L),L=-1),x=!0;var q=_;try{t:{for(A(H),b=o(m);b!==null&&!(b.expirationTime>H&&Y());){var ge=b.callback;if(typeof ge=="function"){b.callback=null,_=b.priorityLevel;var se=ge(b.expirationTime<=H);if(H=t.unstable_now(),typeof se=="function"){b.callback=se,A(H),O=!0;break t}b===o(m)&&r(m),A(H)}else r(m);b=o(m)}if(b!==null)O=!0;else{var ce=o(h);ce!==null&&ne(E,ce.startTime-H),O=!1}}break e}finally{b=null,_=q,x=!1}O=void 0}}finally{O?X():R=!1}}}var X;if(typeof D=="function")X=function(){D(U)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,G=te.port2;te.port1.onmessage=U,X=function(){G.postMessage(null)}}else X=function(){N(U,0)};function ne(H,O){L=N(function(){H(t.unstable_now())},O)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(H){H.callback=null},t.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<H?Math.floor(1e3/H):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(H){switch(_){case 1:case 2:case 3:var O=3;break;default:O=_}var q=_;_=O;try{return H()}finally{_=q}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(H,O){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var q=_;_=H;try{return O()}finally{_=q}},t.unstable_scheduleCallback=function(H,O,q){var ge=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?ge+q:ge):q=ge,H){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=q+se,H={id:v++,callback:O,priorityLevel:H,startTime:q,expirationTime:se,sortIndex:-1},q>ge?(H.sortIndex=q,s(h,H),o(m)===null&&H===o(h)&&(j?(C(L),L=-1):j=!0,ne(E,q-ge))):(H.sortIndex=se,s(m,H),S||x||(S=!0,R||(R=!0,X()))),H},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(H){var O=_;return function(){var q=_;_=O;try{return H.apply(this,arguments)}finally{_=q}}}})(ep)),ep}var _y;function xj(){return _y||(_y=1,Qf.exports=_j()),Qf.exports}/**
11
+ * @license React
12
+ * react-dom-client.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 xy;function kj(){if(xy)return Hr;xy=1;var t=xj(),s=Z2(),o=Y2();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+e+"; visit "+n+" 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 d(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function u(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function f(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(d(e)!==e)throw Error(r(188))}function h(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,l=n;;){var p=i.return;if(p===null)break;var g=p.alternate;if(g===null){if(l=p.return,l!==null){i=l;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===i)return m(p),e;if(g===l)return m(p),n;g=g.sibling}throw Error(r(188))}if(i.return!==l.return)i=p,l=g;else{for(var k=!1,w=p.child;w;){if(w===i){k=!0,i=p,l=g;break}if(w===l){k=!0,l=p,i=g;break}w=w.sibling}if(!k){for(w=g.child;w;){if(w===i){k=!0,i=g,l=p;break}if(w===l){k=!0,l=g,i=p;break}w=w.sibling}if(!k)throw Error(r(189))}}if(i.alternate!==l)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function v(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=v(e),n!==null)return n;e=e.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),D=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),$=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var te=Symbol.for("react.client.reference");function G(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 j:return"Fragment";case N:return"Profiler";case T:return"StrictMode";case E:return"Suspense";case R:return"SuspenseList";case $:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case D:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case L:return n=e.displayName||null,n!==null?n:G(e.type)||"Memo";case M:n=e._payload,e=e._init;try{return G(e(n))}catch{}}return null}var ne=Array.isArray,H=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q={pending:!1,data:null,method:null,action:null},ge=[],se=-1;function ce(e){return{current:e}}function me(e){0>se||(e.current=ge[se],ge[se]=null,se--)}function xe(e,n){se++,ge[se]=e.current,e.current=n}var De=ce(null),ot=ce(null),_t=ce(null),lt=ce(null);function Pe(e,n){switch(xe(_t,n),xe(ot,e),xe(De,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?P0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=P0(n),e=U0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}me(De),xe(De,e)}function ke(){me(De),me(ot),me(_t)}function ct(e){e.memoizedState!==null&&xe(lt,e);var n=De.current,i=U0(n,e.type);n!==i&&(xe(ot,e),xe(De,i))}function ue(e){ot.current===e&&(me(De),me(ot)),lt.current===e&&(me(lt),Lr._currentValue=q)}var Ie,ee;function nt(e){if(Ie===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);Ie=n&&n[1]||"",ee=-1<i.stack.indexOf(`
19
+ at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
20
+ `+Ie+e+ee}var le=!1;function ve(e,n){if(!e||le)return"";le=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(J){var Z=J}Reflect.construct(e,[],oe)}else{try{oe.call()}catch(J){Z=J}e.call(oe.prototype)}}else{try{throw Error()}catch(J){Z=J}(oe=e())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(J){if(J&&Z&&typeof J.stack=="string")return[J.stack,Z.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=l.DetermineComponentFrameRoot(),k=g[0],w=g[1];if(k&&w){var I=k.split(`
21
+ `),K=w.split(`
22
+ `);for(p=l=0;l<I.length&&!I[l].includes("DetermineComponentFrameRoot");)l++;for(;p<K.length&&!K[p].includes("DetermineComponentFrameRoot");)p++;if(l===I.length||p===K.length)for(l=I.length-1,p=K.length-1;1<=l&&0<=p&&I[l]!==K[p];)p--;for(;1<=l&&0<=p;l--,p--)if(I[l]!==K[p]){if(l!==1||p!==1)do if(l--,p--,0>p||I[l]!==K[p]){var Q=`
23
+ `+I[l].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=l&&0<=p);break}}}finally{le=!1,Error.prepareStackTrace=i}return(i=e?e.displayName||e.name:"")?nt(i):""}function et(e,n){switch(e.tag){case 26:case 27:case 5:return nt(e.type);case 16:return nt("Lazy");case 13:return e.child!==n&&n!==null?nt("Suspense Fallback"):nt("Suspense");case 19:return nt("SuspenseList");case 0:case 15:return ve(e.type,!1);case 11:return ve(e.type.render,!1);case 1:return ve(e.type,!0);case 31:return nt("Activity");default:return""}}function on(e){try{var n="",i=null;do n+=et(e,i),i=e,e=e.return;while(e);return n}catch(l){return`
24
+ Error generating stack: `+l.message+`
25
+ `+l.stack}}var ks=Object.prototype.hasOwnProperty,us=t.unstable_scheduleCallback,Ps=t.unstable_cancelCallback,ya=t.unstable_shouldYield,Bi=t.unstable_requestPaint,Xt=t.unstable_now,ai=t.unstable_getCurrentPriorityLevel,ii=t.unstable_ImmediatePriority,ba=t.unstable_UserBlockingPriority,Us=t.unstable_NormalPriority,Ss=t.unstable_LowPriority,_a=t.unstable_IdlePriority,Ce=t.log,Ve=t.unstable_setDisableYieldValue,Qt=null,Ct=null;function yn(e){if(typeof Ce=="function"&&Ve(e),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(Qt,e)}catch{}}var en=Math.clz32?Math.clz32:Hi,zi=Math.log,$i=Math.LN2;function Hi(e){return e>>>=0,e===0?32:31-(zi(e)/$i|0)|0}var xa=256,V=262144,ie=4194304;function de(e){var n=e&42;if(n!==0)return n;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 pe(e,n,i){var l=e.pendingLanes;if(l===0)return 0;var p=0,g=e.suspendedLanes,k=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~g,l!==0?p=de(l):(k&=w,k!==0?p=de(k):i||(i=w&~e,i!==0&&(p=de(i))))):(w=l&~g,w!==0?p=de(w):k!==0?p=de(k):i||(i=l&~e,i!==0&&(p=de(i)))),p===0?0:n!==0&&n!==p&&(n&g)===0&&(g=p&-p,i=n&-n,g>=i||g===32&&(i&4194048)!==0)?n:p}function ye(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function tt(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 je(){var e=ie;return ie<<=1,(ie&62914560)===0&&(ie=4194304),e}function Be(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function Ue(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Mt(e,n,i,l,p,g){var k=e.pendingLanes;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=i,e.entangledLanes&=i,e.errorRecoveryDisabledLanes&=i,e.shellSuspendCounter=0;var w=e.entanglements,I=e.expirationTimes,K=e.hiddenUpdates;for(i=k&~i;0<i;){var Q=31-en(i),oe=1<<Q;w[Q]=0,I[Q]=-1;var Z=K[Q];if(Z!==null)for(K[Q]=null,Q=0;Q<Z.length;Q++){var J=Z[Q];J!==null&&(J.lane&=-536870913)}i&=~oe}l!==0&&qe(e,l,0),g!==0&&p===0&&e.tag!==0&&(e.suspendedLanes|=g&~(k&~n))}function qe(e,n,i){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-en(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|i&261930}function rn(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var l=31-en(i),p=1<<l;p&n|e[l]&n&&(e[l]|=n),i&=~p}}function En(e,n){var i=n&-n;return i=(i&42)!==0?1:xt(i),(i&(e.suspendedLanes|n))!==0?0:i}function xt(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 js(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Pi(){var e=O.p;return e!==0?e:(e=window.event,e===void 0?32:uy(e.type))}function Ts(e,n){var i=O.p;try{return O.p=e,n()}finally{O.p=i}}var Ns=Math.random().toString(36).slice(2),ln="__reactFiber$"+Ns,kn="__reactProps$"+Ns,Ui="__reactContainer$"+Ns,Ud="__reactEvents$"+Ns,Bk="__reactListeners$"+Ns,zk="__reactHandles$"+Ns,Ch="__reactResources$"+Ns,Wo="__reactMarker$"+Ns;function Vd(e){delete e[ln],delete e[kn],delete e[Ud],delete e[Bk],delete e[zk]}function Vi(e){var n=e[ln];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Ui]||i[ln]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=Y0(e);e!==null;){if(i=e[ln])return i;e=Y0(e)}return n}e=i,i=e.parentNode}return null}function qi(e){if(e=e[ln]||e[Ui]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Xo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Gi(e){var n=e[Ch];return n||(n=e[Ch]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function tn(e){e[Wo]=!0}var Eh=new Set,Ah={};function oi(e,n){Fi(e,n),Fi(e+"Capture",n)}function Fi(e,n){for(Ah[e]=n,e=0;e<n.length;e++)Eh.add(n[e])}var $k=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]*$"),Dh={},Mh={};function Hk(e){return ks.call(Mh,e)?!0:ks.call(Dh,e)?!1:$k.test(e)?Mh[e]=!0:(Dh[e]=!0,!1)}function jl(e,n,i){if(Hk(n))if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var l=n.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+i)}}function Tl(e,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+i)}}function Vs(e,n,i,l){if(l===null)e.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttributeNS(n,i,""+l)}}function Un(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Rh(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Pk(e,n,i){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var p=l.get,g=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return p.call(this)},set:function(k){i=""+k,g.call(this,k)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return i},setValue:function(k){i=""+k},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function qd(e){if(!e._valueTracker){var n=Rh(e)?"checked":"value";e._valueTracker=Pk(e,n,""+e[n])}}function Ih(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),l="";return e&&(l=Rh(e)?e.checked?"true":"false":e.value),e=l,e!==i?(n.setValue(e),!0):!1}function Nl(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 Uk=/[\n"\\]/g;function Vn(e){return e.replace(Uk,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Gd(e,n,i,l,p,g,k,w){e.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?e.type=k:e.removeAttribute("type"),n!=null?k==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Un(n)):e.value!==""+Un(n)&&(e.value=""+Un(n)):k!=="submit"&&k!=="reset"||e.removeAttribute("value"),n!=null?Fd(e,k,Un(n)):i!=null?Fd(e,k,Un(i)):l!=null&&e.removeAttribute("value"),p==null&&g!=null&&(e.defaultChecked=!!g),p!=null&&(e.checked=p&&typeof p!="function"&&typeof p!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Un(w):e.removeAttribute("name")}function Oh(e,n,i,l,p,g,k,w){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.type=g),n!=null||i!=null){if(!(g!=="submit"&&g!=="reset"||n!=null)){qd(e);return}i=i!=null?""+Un(i):"",n=n!=null?""+Un(n):i,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??p,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(e.name=k),qd(e)}function Fd(e,n,i){n==="number"&&Nl(e.ownerDocument)===e||e.defaultValue===""+i||(e.defaultValue=""+i)}function Ki(e,n,i,l){if(e=e.options,n){n={};for(var p=0;p<i.length;p++)n["$"+i[p]]=!0;for(i=0;i<e.length;i++)p=n.hasOwnProperty("$"+e[i].value),e[i].selected!==p&&(e[i].selected=p),p&&l&&(e[i].defaultSelected=!0)}else{for(i=""+Un(i),n=null,p=0;p<e.length;p++){if(e[p].value===i){e[p].selected=!0,l&&(e[p].defaultSelected=!0);return}n!==null||e[p].disabled||(n=e[p])}n!==null&&(n.selected=!0)}}function Lh(e,n,i){if(n!=null&&(n=""+Un(n),n!==e.value&&(e.value=n),i==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=i!=null?""+Un(i):""}function Bh(e,n,i,l){if(n==null){if(l!=null){if(i!=null)throw Error(r(92));if(ne(l)){if(1<l.length)throw Error(r(93));l=l[0]}i=l}i==null&&(i=""),n=i}i=Un(n),e.defaultValue=i,l=e.textContent,l===i&&l!==""&&l!==null&&(e.value=l),qd(e)}function Zi(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var Vk=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 zh(e,n,i){var l=n.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,i):typeof i!="number"||i===0||Vk.has(n)?n==="float"?e.cssFloat=i:e[n]=(""+i).trim():e[n]=i+"px"}function $h(e,n,i){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,i!=null){for(var l in i)!i.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var p in n)l=n[p],n.hasOwnProperty(p)&&i[p]!==l&&zh(e,p,l)}else for(var g in n)n.hasOwnProperty(g)&&zh(e,g,n[g])}function Kd(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 qk=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"]]),Gk=/^[\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 wl(e){return Gk.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function qs(){}var Zd=null;function Yd(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Yi=null,Ji=null;function Hh(e){var n=qi(e);if(n&&(e=n.stateNode)){var i=e[kn]||null;e:switch(e=n.stateNode,n.type){case"input":if(Gd(e,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Vn(""+n)+'"][type="radio"]'),n=0;n<i.length;n++){var l=i[n];if(l!==e&&l.form===e.form){var p=l[kn]||null;if(!p)throw Error(r(90));Gd(l,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(n=0;n<i.length;n++)l=i[n],l.form===e.form&&Ih(l)}break e;case"textarea":Lh(e,i.value,i.defaultValue);break e;case"select":n=i.value,n!=null&&Ki(e,!!i.multiple,n,!1)}}}var Jd=!1;function Ph(e,n,i){if(Jd)return e(n,i);Jd=!0;try{var l=e(n);return l}finally{if(Jd=!1,(Yi!==null||Ji!==null)&&(mc(),Yi&&(n=Yi,e=Ji,Ji=Yi=null,Hh(n),e)))for(n=0;n<e.length;n++)Hh(e[n])}}function Qo(e,n){var i=e.stateNode;if(i===null)return null;var l=i[kn]||null;if(l===null)return null;i=l[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Gs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wd=!1;if(Gs)try{var er={};Object.defineProperty(er,"passive",{get:function(){Wd=!0}}),window.addEventListener("test",er,er),window.removeEventListener("test",er,er)}catch{Wd=!1}var ka=null,Xd=null,Cl=null;function Uh(){if(Cl)return Cl;var e,n=Xd,i=n.length,l,p="value"in ka?ka.value:ka.textContent,g=p.length;for(e=0;e<i&&n[e]===p[e];e++);var k=i-e;for(l=1;l<=k&&n[i-l]===p[g-l];l++);return Cl=p.slice(e,1<l?1-l:void 0)}function El(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Al(){return!0}function Vh(){return!1}function Sn(e){function n(i,l,p,g,k){this._reactName=i,this._targetInst=p,this.type=l,this.nativeEvent=g,this.target=k,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(i=e[w],this[w]=i?i(g):g[w]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Al:Vh,this.isPropagationStopped=Vh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Al)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Al)},persist:function(){},isPersistent:Al}),n}var ri={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dl=Sn(ri),tr=b({},ri,{view:0,detail:0}),Fk=Sn(tr),Qd,eu,nr,Ml=b({},tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nu,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==nr&&(nr&&e.type==="mousemove"?(Qd=e.screenX-nr.screenX,eu=e.screenY-nr.screenY):eu=Qd=0,nr=e),Qd)},movementY:function(e){return"movementY"in e?e.movementY:eu}}),qh=Sn(Ml),Kk=b({},Ml,{dataTransfer:0}),Zk=Sn(Kk),Yk=b({},tr,{relatedTarget:0}),tu=Sn(Yk),Jk=b({},ri,{animationName:0,elapsedTime:0,pseudoElement:0}),Wk=Sn(Jk),Xk=b({},ri,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Qk=Sn(Xk),eS=b({},ri,{data:0}),Gh=Sn(eS),tS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nS={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"},sS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aS(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=sS[e])?!!n[e]:!1}function nu(){return aS}var iS=b({},tr,{key:function(e){if(e.key){var n=tS[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=El(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?nS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nu,charCode:function(e){return e.type==="keypress"?El(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?El(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),oS=Sn(iS),rS=b({},Ml,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fh=Sn(rS),lS=b({},tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nu}),cS=Sn(lS),dS=b({},ri,{propertyName:0,elapsedTime:0,pseudoElement:0}),uS=Sn(dS),fS=b({},Ml,{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}),pS=Sn(fS),mS=b({},ri,{newState:0,oldState:0}),hS=Sn(mS),gS=[9,13,27,32],su=Gs&&"CompositionEvent"in window,sr=null;Gs&&"documentMode"in document&&(sr=document.documentMode);var vS=Gs&&"TextEvent"in window&&!sr,Kh=Gs&&(!su||sr&&8<sr&&11>=sr),Zh=" ",Yh=!1;function Jh(e,n){switch(e){case"keyup":return gS.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wi=!1;function yS(e,n){switch(e){case"compositionend":return Wh(n);case"keypress":return n.which!==32?null:(Yh=!0,Zh);case"textInput":return e=n.data,e===Zh&&Yh?null:e;default:return null}}function bS(e,n){if(Wi)return e==="compositionend"||!su&&Jh(e,n)?(e=Uh(),Cl=Xd=ka=null,Wi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Kh&&n.locale!=="ko"?null:n.data;default:return null}}var _S={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 Xh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!_S[e.type]:n==="textarea"}function Qh(e,n,i,l){Yi?Ji?Ji.push(l):Ji=[l]:Yi=l,n=xc(n,"onChange"),0<n.length&&(i=new Dl("onChange","change",null,i,l),e.push({event:i,listeners:n}))}var ar=null,ir=null;function xS(e){O0(e,0)}function Rl(e){var n=Xo(e);if(Ih(n))return e}function eg(e,n){if(e==="change")return n}var tg=!1;if(Gs){var au;if(Gs){var iu="oninput"in document;if(!iu){var ng=document.createElement("div");ng.setAttribute("oninput","return;"),iu=typeof ng.oninput=="function"}au=iu}else au=!1;tg=au&&(!document.documentMode||9<document.documentMode)}function sg(){ar&&(ar.detachEvent("onpropertychange",ag),ir=ar=null)}function ag(e){if(e.propertyName==="value"&&Rl(ir)){var n=[];Qh(n,ir,e,Yd(e)),Ph(xS,n)}}function kS(e,n,i){e==="focusin"?(sg(),ar=n,ir=i,ar.attachEvent("onpropertychange",ag)):e==="focusout"&&sg()}function SS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rl(ir)}function jS(e,n){if(e==="click")return Rl(n)}function TS(e,n){if(e==="input"||e==="change")return Rl(n)}function NS(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var An=typeof Object.is=="function"?Object.is:NS;function or(e,n){if(An(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),l=Object.keys(n);if(i.length!==l.length)return!1;for(l=0;l<i.length;l++){var p=i[l];if(!ks.call(n,p)||!An(e[p],n[p]))return!1}return!0}function ig(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function og(e,n){var i=ig(e);e=0;for(var l;i;){if(i.nodeType===3){if(l=e+i.textContent.length,e<=n&&l>=n)return{node:i,offset:n-e};e=l}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=ig(i)}}function rg(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?rg(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function lg(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Nl(e.document);n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=Nl(e.document)}return n}function ou(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var wS=Gs&&"documentMode"in document&&11>=document.documentMode,Xi=null,ru=null,rr=null,lu=!1;function cg(e,n,i){var l=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;lu||Xi==null||Xi!==Nl(l)||(l=Xi,"selectionStart"in l&&ou(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),rr&&or(rr,l)||(rr=l,l=xc(ru,"onSelect"),0<l.length&&(n=new Dl("onSelect","select",null,n,i),e.push({event:n,listeners:l}),n.target=Xi)))}function li(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Qi={animationend:li("Animation","AnimationEnd"),animationiteration:li("Animation","AnimationIteration"),animationstart:li("Animation","AnimationStart"),transitionrun:li("Transition","TransitionRun"),transitionstart:li("Transition","TransitionStart"),transitioncancel:li("Transition","TransitionCancel"),transitionend:li("Transition","TransitionEnd")},cu={},dg={};Gs&&(dg=document.createElement("div").style,"AnimationEvent"in window||(delete Qi.animationend.animation,delete Qi.animationiteration.animation,delete Qi.animationstart.animation),"TransitionEvent"in window||delete Qi.transitionend.transition);function ci(e){if(cu[e])return cu[e];if(!Qi[e])return e;var n=Qi[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in dg)return cu[e]=n[i];return e}var ug=ci("animationend"),fg=ci("animationiteration"),pg=ci("animationstart"),CS=ci("transitionrun"),ES=ci("transitionstart"),AS=ci("transitioncancel"),mg=ci("transitionend"),hg=new Map,du="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(" ");du.push("scrollEnd");function fs(e,n){hg.set(e,n),oi(n,[e])}var Il=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},qn=[],eo=0,uu=0;function Ol(){for(var e=eo,n=uu=eo=0;n<e;){var i=qn[n];qn[n++]=null;var l=qn[n];qn[n++]=null;var p=qn[n];qn[n++]=null;var g=qn[n];if(qn[n++]=null,l!==null&&p!==null){var k=l.pending;k===null?p.next=p:(p.next=k.next,k.next=p),l.pending=p}g!==0&&gg(i,p,g)}}function Ll(e,n,i,l){qn[eo++]=e,qn[eo++]=n,qn[eo++]=i,qn[eo++]=l,uu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function fu(e,n,i,l){return Ll(e,n,i,l),Bl(e)}function di(e,n){return Ll(e,null,null,n),Bl(e)}function gg(e,n,i){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i);for(var p=!1,g=e.return;g!==null;)g.childLanes|=i,l=g.alternate,l!==null&&(l.childLanes|=i),g.tag===22&&(e=g.stateNode,e===null||e._visibility&1||(p=!0)),e=g,g=g.return;return e.tag===3?(g=e.stateNode,p&&n!==null&&(p=31-en(i),e=g.hiddenUpdates,l=e[p],l===null?e[p]=[n]:l.push(n),n.lane=i|536870912),g):null}function Bl(e){if(50<Er)throw Er=0,kf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var to={};function DS(e,n,i,l){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(e,n,i,l){return new DS(e,n,i,l)}function pu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fs(e,n){var i=e.alternate;return i===null?(i=Dn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&65011712,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function vg(e,n){e.flags&=65011714;var i=e.alternate;return i===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=i.childLanes,e.lanes=i.lanes,e.child=i.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=i.memoizedProps,e.memoizedState=i.memoizedState,e.updateQueue=i.updateQueue,e.type=i.type,n=i.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function zl(e,n,i,l,p,g){var k=0;if(l=e,typeof e=="function")pu(e)&&(k=1);else if(typeof e=="string")k=L2(e,i,De.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case $:return e=Dn(31,i,n,p),e.elementType=$,e.lanes=g,e;case j:return ui(i.children,p,g,n);case T:k=8,p|=24;break;case N:return e=Dn(12,i,n,p|2),e.elementType=N,e.lanes=g,e;case E:return e=Dn(13,i,n,p),e.elementType=E,e.lanes=g,e;case R:return e=Dn(19,i,n,p),e.elementType=R,e.lanes=g,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:k=10;break e;case C:k=9;break e;case A:k=11;break e;case L:k=14;break e;case M:k=16,l=null;break e}k=29,i=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Dn(k,i,n,p),n.elementType=e,n.type=l,n.lanes=g,n}function ui(e,n,i,l){return e=Dn(7,e,l,n),e.lanes=i,e}function mu(e,n,i){return e=Dn(6,e,null,n),e.lanes=i,e}function yg(e){var n=Dn(18,null,null,0);return n.stateNode=e,n}function hu(e,n,i){return n=Dn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var bg=new WeakMap;function Gn(e,n){if(typeof e=="object"&&e!==null){var i=bg.get(e);return i!==void 0?i:(n={value:e,source:n,stack:on(n)},bg.set(e,n),n)}return{value:e,source:n,stack:on(n)}}var no=[],so=0,$l=null,lr=0,Fn=[],Kn=0,Sa=null,ws=1,Cs="";function Ks(e,n){no[so++]=lr,no[so++]=$l,$l=e,lr=n}function _g(e,n,i){Fn[Kn++]=ws,Fn[Kn++]=Cs,Fn[Kn++]=Sa,Sa=e;var l=ws;e=Cs;var p=32-en(l)-1;l&=~(1<<p),i+=1;var g=32-en(n)+p;if(30<g){var k=p-p%5;g=(l&(1<<k)-1).toString(32),l>>=k,p-=k,ws=1<<32-en(n)+p|i<<p|l,Cs=g+e}else ws=1<<g|i<<p|l,Cs=e}function gu(e){e.return!==null&&(Ks(e,1),_g(e,1,0))}function vu(e){for(;e===$l;)$l=no[--so],no[so]=null,lr=no[--so],no[so]=null;for(;e===Sa;)Sa=Fn[--Kn],Fn[Kn]=null,Cs=Fn[--Kn],Fn[Kn]=null,ws=Fn[--Kn],Fn[Kn]=null}function xg(e,n){Fn[Kn++]=ws,Fn[Kn++]=Cs,Fn[Kn++]=Sa,ws=n.id,Cs=n.overflow,Sa=e}var cn=null,St=null,Je=!1,ja=null,Zn=!1,yu=Error(r(519));function Ta(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw cr(Gn(n,e)),yu}function kg(e){var n=e.stateNode,i=e.type,l=e.memoizedProps;switch(n[ln]=e,n[kn]=l,i){case"dialog":Fe("cancel",n),Fe("close",n);break;case"iframe":case"object":case"embed":Fe("load",n);break;case"video":case"audio":for(i=0;i<Dr.length;i++)Fe(Dr[i],n);break;case"source":Fe("error",n);break;case"img":case"image":case"link":Fe("error",n),Fe("load",n);break;case"details":Fe("toggle",n);break;case"input":Fe("invalid",n),Oh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Fe("invalid",n);break;case"textarea":Fe("invalid",n),Bh(n,l.value,l.defaultValue,l.children)}i=l.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||n.textContent===""+i||l.suppressHydrationWarning===!0||$0(n.textContent,i)?(l.popover!=null&&(Fe("beforetoggle",n),Fe("toggle",n)),l.onScroll!=null&&Fe("scroll",n),l.onScrollEnd!=null&&Fe("scrollend",n),l.onClick!=null&&(n.onclick=qs),n=!0):n=!1,n||Ta(e,!0)}function Sg(e){for(cn=e.return;cn;)switch(cn.tag){case 5:case 31:case 13:Zn=!1;return;case 27:case 3:Zn=!0;return;default:cn=cn.return}}function ao(e){if(e!==cn)return!1;if(!Je)return Sg(e),Je=!0,!1;var n=e.tag,i;if((i=n!==3&&n!==27)&&((i=n===5)&&(i=e.type,i=!(i!=="form"&&i!=="button")||Bf(e.type,e.memoizedProps)),i=!i),i&&St&&Ta(e),Sg(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));St=Z0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));St=Z0(e)}else n===27?(n=St,$a(e.type)?(e=Uf,Uf=null,St=e):St=n):St=cn?Jn(e.stateNode.nextSibling):null;return!0}function fi(){St=cn=null,Je=!1}function bu(){var e=ja;return e!==null&&(wn===null?wn=e:wn.push.apply(wn,e),ja=null),e}function cr(e){ja===null?ja=[e]:ja.push(e)}var _u=ce(null),pi=null,Zs=null;function Na(e,n,i){xe(_u,n._currentValue),n._currentValue=i}function Ys(e){e._currentValue=_u.current,me(_u)}function xu(e,n,i){for(;e!==null;){var l=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,l!==null&&(l.childLanes|=n)):l!==null&&(l.childLanes&n)!==n&&(l.childLanes|=n),e===i)break;e=e.return}}function ku(e,n,i,l){var p=e.child;for(p!==null&&(p.return=e);p!==null;){var g=p.dependencies;if(g!==null){var k=p.child;g=g.firstContext;e:for(;g!==null;){var w=g;g=p;for(var I=0;I<n.length;I++)if(w.context===n[I]){g.lanes|=i,w=g.alternate,w!==null&&(w.lanes|=i),xu(g.return,i,e),l||(k=null);break e}g=w.next}}else if(p.tag===18){if(k=p.return,k===null)throw Error(r(341));k.lanes|=i,g=k.alternate,g!==null&&(g.lanes|=i),xu(k,i,e),k=null}else k=p.child;if(k!==null)k.return=p;else for(k=p;k!==null;){if(k===e){k=null;break}if(p=k.sibling,p!==null){p.return=k.return,k=p;break}k=k.return}p=k}}function io(e,n,i,l){e=null;for(var p=n,g=!1;p!==null;){if(!g){if((p.flags&524288)!==0)g=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var k=p.alternate;if(k===null)throw Error(r(387));if(k=k.memoizedProps,k!==null){var w=p.type;An(p.pendingProps.value,k.value)||(e!==null?e.push(w):e=[w])}}else if(p===lt.current){if(k=p.alternate,k===null)throw Error(r(387));k.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(e!==null?e.push(Lr):e=[Lr])}p=p.return}e!==null&&ku(n,e,i,l),n.flags|=262144}function Hl(e){for(e=e.firstContext;e!==null;){if(!An(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function mi(e){pi=e,Zs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function dn(e){return jg(pi,e)}function Pl(e,n){return pi===null&&mi(e),jg(e,n)}function jg(e,n){var i=n._currentValue;if(n={context:n,memoizedValue:i,next:null},Zs===null){if(e===null)throw Error(r(308));Zs=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Zs=Zs.next=n;return i}var MS=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(i,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(i){return i()})}},RS=t.unstable_scheduleCallback,IS=t.unstable_NormalPriority,Vt={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Su(){return{controller:new MS,data:new Map,refCount:0}}function dr(e){e.refCount--,e.refCount===0&&RS(IS,function(){e.controller.abort()})}var ur=null,ju=0,oo=0,ro=null;function OS(e,n){if(ur===null){var i=ur=[];ju=0,oo=Cf(),ro={status:"pending",value:void 0,then:function(l){i.push(l)}}}return ju++,n.then(Tg,Tg),n}function Tg(){if(--ju===0&&ur!==null){ro!==null&&(ro.status="fulfilled");var e=ur;ur=null,oo=0,ro=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function LS(e,n){var i=[],l={status:"pending",value:null,reason:null,then:function(p){i.push(p)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var p=0;p<i.length;p++)(0,i[p])(n)},function(p){for(l.status="rejected",l.reason=p,p=0;p<i.length;p++)(0,i[p])(void 0)}),l}var Ng=H.S;H.S=function(e,n){c0=Xt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&OS(e,n),Ng!==null&&Ng(e,n)};var hi=ce(null);function Tu(){var e=hi.current;return e!==null?e:bt.pooledCache}function Ul(e,n){n===null?xe(hi,hi.current):xe(hi,n.pool)}function wg(){var e=Tu();return e===null?null:{parent:Vt._currentValue,pool:e}}var lo=Error(r(460)),Nu=Error(r(474)),Vl=Error(r(542)),ql={then:function(){}};function Cg(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Eg(e,n,i){switch(i=e[i],i===void 0?e.push(n):i!==n&&(n.then(qs,qs),n=i),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Dg(e),e;default:if(typeof n.status=="string")n.then(qs,qs);else{if(e=bt,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var p=n;p.status="fulfilled",p.value=l}},function(l){if(n.status==="pending"){var p=n;p.status="rejected",p.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Dg(e),e}throw vi=n,lo}}function gi(e){try{var n=e._init;return n(e._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(vi=i,lo):i}}var vi=null;function Ag(){if(vi===null)throw Error(r(459));var e=vi;return vi=null,e}function Dg(e){if(e===lo||e===Vl)throw Error(r(483))}var co=null,fr=0;function Gl(e){var n=fr;return fr+=1,co===null&&(co=[]),Eg(co,e,n)}function pr(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Fl(e,n){throw n.$$typeof===_?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Mg(e){function n(P,z){if(e){var F=P.deletions;F===null?(P.deletions=[z],P.flags|=16):F.push(z)}}function i(P,z){if(!e)return null;for(;z!==null;)n(P,z),z=z.sibling;return null}function l(P){for(var z=new Map;P!==null;)P.key!==null?z.set(P.key,P):z.set(P.index,P),P=P.sibling;return z}function p(P,z){return P=Fs(P,z),P.index=0,P.sibling=null,P}function g(P,z,F){return P.index=F,e?(F=P.alternate,F!==null?(F=F.index,F<z?(P.flags|=67108866,z):F):(P.flags|=67108866,z)):(P.flags|=1048576,z)}function k(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function w(P,z,F,ae){return z===null||z.tag!==6?(z=mu(F,P.mode,ae),z.return=P,z):(z=p(z,F),z.return=P,z)}function I(P,z,F,ae){var Ne=F.type;return Ne===j?Q(P,z,F.props.children,ae,F.key):z!==null&&(z.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===M&&gi(Ne)===z.type)?(z=p(z,F.props),pr(z,F),z.return=P,z):(z=zl(F.type,F.key,F.props,null,P.mode,ae),pr(z,F),z.return=P,z)}function K(P,z,F,ae){return z===null||z.tag!==4||z.stateNode.containerInfo!==F.containerInfo||z.stateNode.implementation!==F.implementation?(z=hu(F,P.mode,ae),z.return=P,z):(z=p(z,F.children||[]),z.return=P,z)}function Q(P,z,F,ae,Ne){return z===null||z.tag!==7?(z=ui(F,P.mode,ae,Ne),z.return=P,z):(z=p(z,F),z.return=P,z)}function oe(P,z,F){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=mu(""+z,P.mode,F),z.return=P,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case x:return F=zl(z.type,z.key,z.props,null,P.mode,F),pr(F,z),F.return=P,F;case S:return z=hu(z,P.mode,F),z.return=P,z;case M:return z=gi(z),oe(P,z,F)}if(ne(z)||X(z))return z=ui(z,P.mode,F,null),z.return=P,z;if(typeof z.then=="function")return oe(P,Gl(z),F);if(z.$$typeof===D)return oe(P,Pl(P,z),F);Fl(P,z)}return null}function Z(P,z,F,ae){var Ne=z!==null?z.key:null;if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return Ne!==null?null:w(P,z,""+F,ae);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case x:return F.key===Ne?I(P,z,F,ae):null;case S:return F.key===Ne?K(P,z,F,ae):null;case M:return F=gi(F),Z(P,z,F,ae)}if(ne(F)||X(F))return Ne!==null?null:Q(P,z,F,ae,null);if(typeof F.then=="function")return Z(P,z,Gl(F),ae);if(F.$$typeof===D)return Z(P,z,Pl(P,F),ae);Fl(P,F)}return null}function J(P,z,F,ae,Ne){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return P=P.get(F)||null,w(z,P,""+ae,Ne);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case x:return P=P.get(ae.key===null?F:ae.key)||null,I(z,P,ae,Ne);case S:return P=P.get(ae.key===null?F:ae.key)||null,K(z,P,ae,Ne);case M:return ae=gi(ae),J(P,z,F,ae,Ne)}if(ne(ae)||X(ae))return P=P.get(F)||null,Q(z,P,ae,Ne,null);if(typeof ae.then=="function")return J(P,z,F,Gl(ae),Ne);if(ae.$$typeof===D)return J(P,z,F,Pl(z,ae),Ne);Fl(z,ae)}return null}function _e(P,z,F,ae){for(var Ne=null,st=null,Se=z,$e=z=0,Ze=null;Se!==null&&$e<F.length;$e++){Se.index>$e?(Ze=Se,Se=null):Ze=Se.sibling;var at=Z(P,Se,F[$e],ae);if(at===null){Se===null&&(Se=Ze);break}e&&Se&&at.alternate===null&&n(P,Se),z=g(at,z,$e),st===null?Ne=at:st.sibling=at,st=at,Se=Ze}if($e===F.length)return i(P,Se),Je&&Ks(P,$e),Ne;if(Se===null){for(;$e<F.length;$e++)Se=oe(P,F[$e],ae),Se!==null&&(z=g(Se,z,$e),st===null?Ne=Se:st.sibling=Se,st=Se);return Je&&Ks(P,$e),Ne}for(Se=l(Se);$e<F.length;$e++)Ze=J(Se,P,$e,F[$e],ae),Ze!==null&&(e&&Ze.alternate!==null&&Se.delete(Ze.key===null?$e:Ze.key),z=g(Ze,z,$e),st===null?Ne=Ze:st.sibling=Ze,st=Ze);return e&&Se.forEach(function(qa){return n(P,qa)}),Je&&Ks(P,$e),Ne}function Ee(P,z,F,ae){if(F==null)throw Error(r(151));for(var Ne=null,st=null,Se=z,$e=z=0,Ze=null,at=F.next();Se!==null&&!at.done;$e++,at=F.next()){Se.index>$e?(Ze=Se,Se=null):Ze=Se.sibling;var qa=Z(P,Se,at.value,ae);if(qa===null){Se===null&&(Se=Ze);break}e&&Se&&qa.alternate===null&&n(P,Se),z=g(qa,z,$e),st===null?Ne=qa:st.sibling=qa,st=qa,Se=Ze}if(at.done)return i(P,Se),Je&&Ks(P,$e),Ne;if(Se===null){for(;!at.done;$e++,at=F.next())at=oe(P,at.value,ae),at!==null&&(z=g(at,z,$e),st===null?Ne=at:st.sibling=at,st=at);return Je&&Ks(P,$e),Ne}for(Se=l(Se);!at.done;$e++,at=F.next())at=J(Se,P,$e,at.value,ae),at!==null&&(e&&at.alternate!==null&&Se.delete(at.key===null?$e:at.key),z=g(at,z,$e),st===null?Ne=at:st.sibling=at,st=at);return e&&Se.forEach(function(K2){return n(P,K2)}),Je&&Ks(P,$e),Ne}function vt(P,z,F,ae){if(typeof F=="object"&&F!==null&&F.type===j&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case x:e:{for(var Ne=F.key;z!==null;){if(z.key===Ne){if(Ne=F.type,Ne===j){if(z.tag===7){i(P,z.sibling),ae=p(z,F.props.children),ae.return=P,P=ae;break e}}else if(z.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===M&&gi(Ne)===z.type){i(P,z.sibling),ae=p(z,F.props),pr(ae,F),ae.return=P,P=ae;break e}i(P,z);break}else n(P,z);z=z.sibling}F.type===j?(ae=ui(F.props.children,P.mode,ae,F.key),ae.return=P,P=ae):(ae=zl(F.type,F.key,F.props,null,P.mode,ae),pr(ae,F),ae.return=P,P=ae)}return k(P);case S:e:{for(Ne=F.key;z!==null;){if(z.key===Ne)if(z.tag===4&&z.stateNode.containerInfo===F.containerInfo&&z.stateNode.implementation===F.implementation){i(P,z.sibling),ae=p(z,F.children||[]),ae.return=P,P=ae;break e}else{i(P,z);break}else n(P,z);z=z.sibling}ae=hu(F,P.mode,ae),ae.return=P,P=ae}return k(P);case M:return F=gi(F),vt(P,z,F,ae)}if(ne(F))return _e(P,z,F,ae);if(X(F)){if(Ne=X(F),typeof Ne!="function")throw Error(r(150));return F=Ne.call(F),Ee(P,z,F,ae)}if(typeof F.then=="function")return vt(P,z,Gl(F),ae);if(F.$$typeof===D)return vt(P,z,Pl(P,F),ae);Fl(P,F)}return typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint"?(F=""+F,z!==null&&z.tag===6?(i(P,z.sibling),ae=p(z,F),ae.return=P,P=ae):(i(P,z),ae=mu(F,P.mode,ae),ae.return=P,P=ae),k(P)):i(P,z)}return function(P,z,F,ae){try{fr=0;var Ne=vt(P,z,F,ae);return co=null,Ne}catch(Se){if(Se===lo||Se===Vl)throw Se;var st=Dn(29,Se,null,P.mode);return st.lanes=ae,st.return=P,st}finally{}}}var yi=Mg(!0),Rg=Mg(!1),wa=!1;function wu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ca(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ea(e,n,i){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(rt&2)!==0){var p=l.pending;return p===null?n.next=n:(n.next=p.next,p.next=n),l.pending=n,n=Bl(e),gg(e,null,i),n}return Ll(e,l,n,i),Bl(e)}function mr(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,rn(e,i)}}function Eu(e,n){var i=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,i===l)){var p=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var k={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?p=g=k:g=g.next=k,i=i.next}while(i!==null);g===null?p=g=n:g=g.next=n}else p=g=n;i={baseState:l.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:l.shared,callbacks:l.callbacks},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}var Au=!1;function hr(){if(Au){var e=ro;if(e!==null)throw e}}function gr(e,n,i,l){Au=!1;var p=e.updateQueue;wa=!1;var g=p.firstBaseUpdate,k=p.lastBaseUpdate,w=p.shared.pending;if(w!==null){p.shared.pending=null;var I=w,K=I.next;I.next=null,k===null?g=K:k.next=K,k=I;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,w=Q.lastBaseUpdate,w!==k&&(w===null?Q.firstBaseUpdate=K:w.next=K,Q.lastBaseUpdate=I))}if(g!==null){var oe=p.baseState;k=0,Q=K=I=null,w=g;do{var Z=w.lane&-536870913,J=Z!==w.lane;if(J?(Ke&Z)===Z:(l&Z)===Z){Z!==0&&Z===oo&&(Au=!0),Q!==null&&(Q=Q.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var _e=e,Ee=w;Z=n;var vt=i;switch(Ee.tag){case 1:if(_e=Ee.payload,typeof _e=="function"){oe=_e.call(vt,oe,Z);break e}oe=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ee.payload,Z=typeof _e=="function"?_e.call(vt,oe,Z):_e,Z==null)break e;oe=b({},oe,Z);break e;case 2:wa=!0}}Z=w.callback,Z!==null&&(e.flags|=64,J&&(e.flags|=8192),J=p.callbacks,J===null?p.callbacks=[Z]:J.push(Z))}else J={lane:Z,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Q===null?(K=Q=J,I=oe):Q=Q.next=J,k|=Z;if(w=w.next,w===null){if(w=p.shared.pending,w===null)break;J=w,w=J.next,J.next=null,p.lastBaseUpdate=J,p.shared.pending=null}}while(!0);Q===null&&(I=oe),p.baseState=I,p.firstBaseUpdate=K,p.lastBaseUpdate=Q,g===null&&(p.shared.lanes=0),Ia|=k,e.lanes=k,e.memoizedState=oe}}function Ig(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function Og(e,n){var i=e.callbacks;if(i!==null)for(e.callbacks=null,e=0;e<i.length;e++)Ig(i[e],n)}var uo=ce(null),Kl=ce(0);function Lg(e,n){e=aa,xe(Kl,e),xe(uo,n),aa=e|n.baseLanes}function Du(){xe(Kl,aa),xe(uo,uo.current)}function Mu(){aa=Kl.current,me(uo),me(Kl)}var Mn=ce(null),Yn=null;function Aa(e){var n=e.alternate;xe(Lt,Lt.current&1),xe(Mn,e),Yn===null&&(n===null||uo.current!==null||n.memoizedState!==null)&&(Yn=e)}function Ru(e){xe(Lt,Lt.current),xe(Mn,e),Yn===null&&(Yn=e)}function Bg(e){e.tag===22?(xe(Lt,Lt.current),xe(Mn,e),Yn===null&&(Yn=e)):Da()}function Da(){xe(Lt,Lt.current),xe(Mn,Mn.current)}function Rn(e){me(Mn),Yn===e&&(Yn=null),me(Lt)}var Lt=ce(0);function Zl(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Hf(i)||Pf(i)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Js=0,ze=null,ht=null,qt=null,Yl=!1,fo=!1,bi=!1,Jl=0,vr=0,po=null,BS=0;function Rt(){throw Error(r(321))}function Iu(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!An(e[i],n[i]))return!1;return!0}function Ou(e,n,i,l,p,g){return Js=g,ze=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,H.H=e===null||e.memoizedState===null?_v:Ju,bi=!1,g=i(l,p),bi=!1,fo&&(g=$g(n,i,l,p)),zg(e),g}function zg(e){H.H=_r;var n=ht!==null&&ht.next!==null;if(Js=0,qt=ht=ze=null,Yl=!1,vr=0,po=null,n)throw Error(r(300));e===null||Gt||(e=e.dependencies,e!==null&&Hl(e)&&(Gt=!0))}function $g(e,n,i,l){ze=e;var p=0;do{if(fo&&(po=null),vr=0,fo=!1,25<=p)throw Error(r(301));if(p+=1,qt=ht=null,e.updateQueue!=null){var g=e.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}H.H=xv,g=n(i,l)}while(fo);return g}function zS(){var e=H.H,n=e.useState()[0];return n=typeof n.then=="function"?yr(n):n,e=e.useState()[0],(ht!==null?ht.memoizedState:null)!==e&&(ze.flags|=1024),n}function Lu(){var e=Jl!==0;return Jl=0,e}function Bu(e,n,i){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~i}function zu(e){if(Yl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Yl=!1}Js=0,qt=ht=ze=null,fo=!1,vr=Jl=0,po=null}function bn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?ze.memoizedState=qt=e:qt=qt.next=e,qt}function Bt(){if(ht===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=ht.next;var n=qt===null?ze.memoizedState:qt.next;if(n!==null)qt=n,ht=e;else{if(e===null)throw ze.alternate===null?Error(r(467)):Error(r(310));ht=e,e={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},qt===null?ze.memoizedState=qt=e:qt=qt.next=e}return qt}function Wl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yr(e){var n=vr;return vr+=1,po===null&&(po=[]),e=Eg(po,e,n),n=ze,(qt===null?n.memoizedState:qt.next)===null&&(n=n.alternate,H.H=n===null||n.memoizedState===null?_v:Ju),e}function Xl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return yr(e);if(e.$$typeof===D)return dn(e)}throw Error(r(438,String(e)))}function $u(e){var n=null,i=ze.updateQueue;if(i!==null&&(n=i.memoCache),n==null){var l=ze.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(p){return p.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),i===null&&(i=Wl(),ze.updateQueue=i),i.memoCache=n,i=n.data[n.index],i===void 0)for(i=n.data[n.index]=Array(e),l=0;l<e;l++)i[l]=Y;return n.index++,i}function Ws(e,n){return typeof n=="function"?n(e):n}function Ql(e){var n=Bt();return Hu(n,ht,e)}function Hu(e,n,i){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=i;var p=e.baseQueue,g=l.pending;if(g!==null){if(p!==null){var k=p.next;p.next=g.next,g.next=k}n.baseQueue=p=g,l.pending=null}if(g=e.baseState,p===null)e.memoizedState=g;else{n=p.next;var w=k=null,I=null,K=n,Q=!1;do{var oe=K.lane&-536870913;if(oe!==K.lane?(Ke&oe)===oe:(Js&oe)===oe){var Z=K.revertLane;if(Z===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),oe===oo&&(Q=!0);else if((Js&Z)===Z){K=K.next,Z===oo&&(Q=!0);continue}else oe={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},I===null?(w=I=oe,k=g):I=I.next=oe,ze.lanes|=Z,Ia|=Z;oe=K.action,bi&&i(g,oe),g=K.hasEagerState?K.eagerState:i(g,oe)}else Z={lane:oe,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},I===null?(w=I=Z,k=g):I=I.next=Z,ze.lanes|=oe,Ia|=oe;K=K.next}while(K!==null&&K!==n);if(I===null?k=g:I.next=w,!An(g,e.memoizedState)&&(Gt=!0,Q&&(i=ro,i!==null)))throw i;e.memoizedState=g,e.baseState=k,e.baseQueue=I,l.lastRenderedState=g}return p===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Pu(e){var n=Bt(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var l=i.dispatch,p=i.pending,g=n.memoizedState;if(p!==null){i.pending=null;var k=p=p.next;do g=e(g,k.action),k=k.next;while(k!==p);An(g,n.memoizedState)||(Gt=!0),n.memoizedState=g,n.baseQueue===null&&(n.baseState=g),i.lastRenderedState=g}return[g,l]}function Hg(e,n,i){var l=ze,p=Bt(),g=Je;if(g){if(i===void 0)throw Error(r(407));i=i()}else i=n();var k=!An((ht||p).memoizedState,i);if(k&&(p.memoizedState=i,Gt=!0),p=p.queue,qu(Vg.bind(null,l,p,e),[e]),p.getSnapshot!==n||k||qt!==null&&qt.memoizedState.tag&1){if(l.flags|=2048,mo(9,{destroy:void 0},Ug.bind(null,l,p,i,n),null),bt===null)throw Error(r(349));g||(Js&127)!==0||Pg(l,n,i)}return i}function Pg(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=ze.updateQueue,n===null?(n=Wl(),ze.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Ug(e,n,i,l){n.value=i,n.getSnapshot=l,qg(n)&&Gg(e)}function Vg(e,n,i){return i(function(){qg(n)&&Gg(e)})}function qg(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!An(e,i)}catch{return!0}}function Gg(e){var n=di(e,2);n!==null&&Cn(n,e,2)}function Uu(e){var n=bn();if(typeof e=="function"){var i=e;if(e=i(),bi){yn(!0);try{i()}finally{yn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ws,lastRenderedState:e},n}function Fg(e,n,i,l){return e.baseState=i,Hu(e,ht,typeof l=="function"?l:Ws)}function $S(e,n,i,l,p){if(nc(e))throw Error(r(485));if(e=n.action,e!==null){var g={payload:p,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(k){g.listeners.push(k)}};H.T!==null?i(!0):g.isTransition=!1,l(g),i=n.pending,i===null?(g.next=n.pending=g,Kg(n,g)):(g.next=i.next,n.pending=i.next=g)}}function Kg(e,n){var i=n.action,l=n.payload,p=e.state;if(n.isTransition){var g=H.T,k={};H.T=k;try{var w=i(p,l),I=H.S;I!==null&&I(k,w),Zg(e,n,w)}catch(K){Vu(e,n,K)}finally{g!==null&&k.types!==null&&(g.types=k.types),H.T=g}}else try{g=i(p,l),Zg(e,n,g)}catch(K){Vu(e,n,K)}}function Zg(e,n,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(l){Yg(e,n,l)},function(l){return Vu(e,n,l)}):Yg(e,n,i)}function Yg(e,n,i){n.status="fulfilled",n.value=i,Jg(n),e.state=i,n=e.pending,n!==null&&(i=n.next,i===n?e.pending=null:(i=i.next,n.next=i,Kg(e,i)))}function Vu(e,n,i){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=i,Jg(n),n=n.next;while(n!==l)}e.action=null}function Jg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function Wg(e,n){return n}function Xg(e,n){if(Je){var i=bt.formState;if(i!==null){e:{var l=ze;if(Je){if(St){t:{for(var p=St,g=Zn;p.nodeType!==8;){if(!g){p=null;break t}if(p=Jn(p.nextSibling),p===null){p=null;break t}}g=p.data,p=g==="F!"||g==="F"?p:null}if(p){St=Jn(p.nextSibling),l=p.data==="F!";break e}}Ta(l)}l=!1}l&&(n=i[0])}}return i=bn(),i.memoizedState=i.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wg,lastRenderedState:n},i.queue=l,i=vv.bind(null,ze,l),l.dispatch=i,l=Uu(!1),g=Yu.bind(null,ze,!1,l.queue),l=bn(),p={state:n,dispatch:null,action:e,pending:null},l.queue=p,i=$S.bind(null,ze,p,g,i),p.dispatch=i,l.memoizedState=e,[n,i,!1]}function Qg(e){var n=Bt();return ev(n,ht,e)}function ev(e,n,i){if(n=Hu(e,n,Wg)[0],e=Ql(Ws)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=yr(n)}catch(k){throw k===lo?Vl:k}else l=n;n=Bt();var p=n.queue,g=p.dispatch;return i!==n.memoizedState&&(ze.flags|=2048,mo(9,{destroy:void 0},HS.bind(null,p,i),null)),[l,g,e]}function HS(e,n){e.action=n}function tv(e){var n=Bt(),i=ht;if(i!==null)return ev(n,i,e);Bt(),n=n.memoizedState,i=Bt();var l=i.queue.dispatch;return i.memoizedState=e,[n,l,!1]}function mo(e,n,i,l){return e={tag:e,create:i,deps:l,inst:n,next:null},n=ze.updateQueue,n===null&&(n=Wl(),ze.updateQueue=n),i=n.lastEffect,i===null?n.lastEffect=e.next=e:(l=i.next,i.next=e,e.next=l,n.lastEffect=e),e}function nv(){return Bt().memoizedState}function ec(e,n,i,l){var p=bn();ze.flags|=e,p.memoizedState=mo(1|n,{destroy:void 0},i,l===void 0?null:l)}function tc(e,n,i,l){var p=Bt();l=l===void 0?null:l;var g=p.memoizedState.inst;ht!==null&&l!==null&&Iu(l,ht.memoizedState.deps)?p.memoizedState=mo(n,g,i,l):(ze.flags|=e,p.memoizedState=mo(1|n,g,i,l))}function sv(e,n){ec(8390656,8,e,n)}function qu(e,n){tc(2048,8,e,n)}function PS(e){ze.flags|=4;var n=ze.updateQueue;if(n===null)n=Wl(),ze.updateQueue=n,n.events=[e];else{var i=n.events;i===null?n.events=[e]:i.push(e)}}function av(e){var n=Bt().memoizedState;return PS({ref:n,nextImpl:e}),function(){if((rt&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function iv(e,n){return tc(4,2,e,n)}function ov(e,n){return tc(4,4,e,n)}function rv(e,n){if(typeof n=="function"){e=e();var i=n(e);return function(){typeof i=="function"?i():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function lv(e,n,i){i=i!=null?i.concat([e]):null,tc(4,4,rv.bind(null,n,e),i)}function Gu(){}function cv(e,n){var i=Bt();n=n===void 0?null:n;var l=i.memoizedState;return n!==null&&Iu(n,l[1])?l[0]:(i.memoizedState=[e,n],e)}function dv(e,n){var i=Bt();n=n===void 0?null:n;var l=i.memoizedState;if(n!==null&&Iu(n,l[1]))return l[0];if(l=e(),bi){yn(!0);try{e()}finally{yn(!1)}}return i.memoizedState=[l,n],l}function Fu(e,n,i){return i===void 0||(Js&1073741824)!==0&&(Ke&261930)===0?e.memoizedState=n:(e.memoizedState=i,e=u0(),ze.lanes|=e,Ia|=e,i)}function uv(e,n,i,l){return An(i,n)?i:uo.current!==null?(e=Fu(e,i,l),An(e,n)||(Gt=!0),e):(Js&42)===0||(Js&1073741824)!==0&&(Ke&261930)===0?(Gt=!0,e.memoizedState=i):(e=u0(),ze.lanes|=e,Ia|=e,n)}function fv(e,n,i,l,p){var g=O.p;O.p=g!==0&&8>g?g:8;var k=H.T,w={};H.T=w,Yu(e,!1,n,i);try{var I=p(),K=H.S;if(K!==null&&K(w,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var Q=LS(I,l);br(e,n,Q,Ln(e))}else br(e,n,l,Ln(e))}catch(oe){br(e,n,{then:function(){},status:"rejected",reason:oe},Ln())}finally{O.p=g,k!==null&&w.types!==null&&(k.types=w.types),H.T=k}}function US(){}function Ku(e,n,i,l){if(e.tag!==5)throw Error(r(476));var p=pv(e).queue;fv(e,p,n,q,i===null?US:function(){return mv(e),i(l)})}function pv(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:q,baseState:q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ws,lastRenderedState:q},next:null};var i={};return n.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ws,lastRenderedState:i},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function mv(e){var n=pv(e);n.next===null&&(n=e.alternate.memoizedState),br(e,n.next.queue,{},Ln())}function Zu(){return dn(Lr)}function hv(){return Bt().memoizedState}function gv(){return Bt().memoizedState}function VS(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var i=Ln();e=Ca(i);var l=Ea(n,e,i);l!==null&&(Cn(l,n,i),mr(l,n,i)),n={cache:Su()},e.payload=n;return}n=n.return}}function qS(e,n,i){var l=Ln();i={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},nc(e)?yv(n,i):(i=fu(e,n,i,l),i!==null&&(Cn(i,e,l),bv(i,n,l)))}function vv(e,n,i){var l=Ln();br(e,n,i,l)}function br(e,n,i,l){var p={lane:l,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(nc(e))yv(n,p);else{var g=e.alternate;if(e.lanes===0&&(g===null||g.lanes===0)&&(g=n.lastRenderedReducer,g!==null))try{var k=n.lastRenderedState,w=g(k,i);if(p.hasEagerState=!0,p.eagerState=w,An(w,k))return Ll(e,n,p,0),bt===null&&Ol(),!1}catch{}finally{}if(i=fu(e,n,p,l),i!==null)return Cn(i,e,l),bv(i,n,l),!0}return!1}function Yu(e,n,i,l){if(l={lane:2,revertLane:Cf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},nc(e)){if(n)throw Error(r(479))}else n=fu(e,i,l,2),n!==null&&Cn(n,e,2)}function nc(e){var n=e.alternate;return e===ze||n!==null&&n===ze}function yv(e,n){fo=Yl=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function bv(e,n,i){if((i&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,i|=l,n.lanes=i,rn(e,i)}}var _r={readContext:dn,use:Xl,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};_r.useEffectEvent=Rt;var _v={readContext:dn,use:Xl,useCallback:function(e,n){return bn().memoizedState=[e,n===void 0?null:n],e},useContext:dn,useEffect:sv,useImperativeHandle:function(e,n,i){i=i!=null?i.concat([e]):null,ec(4194308,4,rv.bind(null,n,e),i)},useLayoutEffect:function(e,n){return ec(4194308,4,e,n)},useInsertionEffect:function(e,n){ec(4,2,e,n)},useMemo:function(e,n){var i=bn();n=n===void 0?null:n;var l=e();if(bi){yn(!0);try{e()}finally{yn(!1)}}return i.memoizedState=[l,n],l},useReducer:function(e,n,i){var l=bn();if(i!==void 0){var p=i(n);if(bi){yn(!0);try{i(n)}finally{yn(!1)}}}else p=n;return l.memoizedState=l.baseState=p,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:p},l.queue=e,e=e.dispatch=qS.bind(null,ze,e),[l.memoizedState,e]},useRef:function(e){var n=bn();return e={current:e},n.memoizedState=e},useState:function(e){e=Uu(e);var n=e.queue,i=vv.bind(null,ze,n);return n.dispatch=i,[e.memoizedState,i]},useDebugValue:Gu,useDeferredValue:function(e,n){var i=bn();return Fu(i,e,n)},useTransition:function(){var e=Uu(!1);return e=fv.bind(null,ze,e.queue,!0,!1),bn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,i){var l=ze,p=bn();if(Je){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),bt===null)throw Error(r(349));(Ke&127)!==0||Pg(l,n,i)}p.memoizedState=i;var g={value:i,getSnapshot:n};return p.queue=g,sv(Vg.bind(null,l,g,e),[e]),l.flags|=2048,mo(9,{destroy:void 0},Ug.bind(null,l,g,i,n),null),i},useId:function(){var e=bn(),n=bt.identifierPrefix;if(Je){var i=Cs,l=ws;i=(l&~(1<<32-en(l)-1)).toString(32)+i,n="_"+n+"R_"+i,i=Jl++,0<i&&(n+="H"+i.toString(32)),n+="_"}else i=BS++,n="_"+n+"r_"+i.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Zu,useFormState:Xg,useActionState:Xg,useOptimistic:function(e){var n=bn();n.memoizedState=n.baseState=e;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=i,n=Yu.bind(null,ze,!0,i),i.dispatch=n,[e,n]},useMemoCache:$u,useCacheRefresh:function(){return bn().memoizedState=VS.bind(null,ze)},useEffectEvent:function(e){var n=bn(),i={impl:e};return n.memoizedState=i,function(){if((rt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}},Ju={readContext:dn,use:Xl,useCallback:cv,useContext:dn,useEffect:qu,useImperativeHandle:lv,useInsertionEffect:iv,useLayoutEffect:ov,useMemo:dv,useReducer:Ql,useRef:nv,useState:function(){return Ql(Ws)},useDebugValue:Gu,useDeferredValue:function(e,n){var i=Bt();return uv(i,ht.memoizedState,e,n)},useTransition:function(){var e=Ql(Ws)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:yr(e),n]},useSyncExternalStore:Hg,useId:hv,useHostTransitionStatus:Zu,useFormState:Qg,useActionState:Qg,useOptimistic:function(e,n){var i=Bt();return Fg(i,ht,e,n)},useMemoCache:$u,useCacheRefresh:gv};Ju.useEffectEvent=av;var xv={readContext:dn,use:Xl,useCallback:cv,useContext:dn,useEffect:qu,useImperativeHandle:lv,useInsertionEffect:iv,useLayoutEffect:ov,useMemo:dv,useReducer:Pu,useRef:nv,useState:function(){return Pu(Ws)},useDebugValue:Gu,useDeferredValue:function(e,n){var i=Bt();return ht===null?Fu(i,e,n):uv(i,ht.memoizedState,e,n)},useTransition:function(){var e=Pu(Ws)[0],n=Bt().memoizedState;return[typeof e=="boolean"?e:yr(e),n]},useSyncExternalStore:Hg,useId:hv,useHostTransitionStatus:Zu,useFormState:tv,useActionState:tv,useOptimistic:function(e,n){var i=Bt();return ht!==null?Fg(i,ht,e,n):(i.baseState=e,[e,i.queue.dispatch])},useMemoCache:$u,useCacheRefresh:gv};xv.useEffectEvent=av;function Wu(e,n,i,l){n=e.memoizedState,i=i(l,n),i=i==null?n:b({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var Xu={enqueueSetState:function(e,n,i){e=e._reactInternals;var l=Ln(),p=Ca(l);p.payload=n,i!=null&&(p.callback=i),n=Ea(e,p,l),n!==null&&(Cn(n,e,l),mr(n,e,l))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var l=Ln(),p=Ca(l);p.tag=1,p.payload=n,i!=null&&(p.callback=i),n=Ea(e,p,l),n!==null&&(Cn(n,e,l),mr(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=Ln(),l=Ca(i);l.tag=2,n!=null&&(l.callback=n),n=Ea(e,l,i),n!==null&&(Cn(n,e,i),mr(n,e,i))}};function kv(e,n,i,l,p,g,k){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,g,k):n.prototype&&n.prototype.isPureReactComponent?!or(i,l)||!or(p,g):!0}function Sv(e,n,i,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,l),n.state!==e&&Xu.enqueueReplaceState(n,n.state,null)}function _i(e,n){var i=n;if("ref"in n){i={};for(var l in n)l!=="ref"&&(i[l]=n[l])}if(e=e.defaultProps){i===n&&(i=b({},i));for(var p in e)i[p]===void 0&&(i[p]=e[p])}return i}function jv(e){Il(e)}function Tv(e){console.error(e)}function Nv(e){Il(e)}function sc(e,n){try{var i=e.onUncaughtError;i(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function wv(e,n,i){try{var l=e.onCaughtError;l(i.value,{componentStack:i.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Qu(e,n,i){return i=Ca(i),i.tag=3,i.payload={element:null},i.callback=function(){sc(e,n)},i}function Cv(e){return e=Ca(e),e.tag=3,e}function Ev(e,n,i,l){var p=i.type.getDerivedStateFromError;if(typeof p=="function"){var g=l.value;e.payload=function(){return p(g)},e.callback=function(){wv(n,i,l)}}var k=i.stateNode;k!==null&&typeof k.componentDidCatch=="function"&&(e.callback=function(){wv(n,i,l),typeof p!="function"&&(Oa===null?Oa=new Set([this]):Oa.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function GS(e,n,i,l,p){if(i.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=i.alternate,n!==null&&io(n,i,p,!0),i=Mn.current,i!==null){switch(i.tag){case 31:case 13:return Yn===null?hc():i.alternate===null&&It===0&&(It=3),i.flags&=-257,i.flags|=65536,i.lanes=p,l===ql?i.flags|=16384:(n=i.updateQueue,n===null?i.updateQueue=new Set([l]):n.add(l),Tf(e,l,p)),!1;case 22:return i.flags|=65536,l===ql?i.flags|=16384:(n=i.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},i.updateQueue=n):(i=n.retryQueue,i===null?n.retryQueue=new Set([l]):i.add(l)),Tf(e,l,p)),!1}throw Error(r(435,i.tag))}return Tf(e,l,p),hc(),!1}if(Je)return n=Mn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=p,l!==yu&&(e=Error(r(422),{cause:l}),cr(Gn(e,i)))):(l!==yu&&(n=Error(r(423),{cause:l}),cr(Gn(n,i))),e=e.current.alternate,e.flags|=65536,p&=-p,e.lanes|=p,l=Gn(l,i),p=Qu(e.stateNode,l,p),Eu(e,p),It!==4&&(It=2)),!1;var g=Error(r(520),{cause:l});if(g=Gn(g,i),Cr===null?Cr=[g]:Cr.push(g),It!==4&&(It=2),n===null)return!0;l=Gn(l,i),i=n;do{switch(i.tag){case 3:return i.flags|=65536,e=p&-p,i.lanes|=e,e=Qu(i.stateNode,l,e),Eu(i,e),!1;case 1:if(n=i.type,g=i.stateNode,(i.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Oa===null||!Oa.has(g))))return i.flags|=65536,p&=-p,i.lanes|=p,p=Cv(p),Ev(p,e,i,l),Eu(i,p),!1}i=i.return}while(i!==null);return!1}var ef=Error(r(461)),Gt=!1;function un(e,n,i,l){n.child=e===null?Rg(n,null,i,l):yi(n,e.child,i,l)}function Av(e,n,i,l,p){i=i.render;var g=n.ref;if("ref"in l){var k={};for(var w in l)w!=="ref"&&(k[w]=l[w])}else k=l;return mi(n),l=Ou(e,n,i,k,g,p),w=Lu(),e!==null&&!Gt?(Bu(e,n,p),Xs(e,n,p)):(Je&&w&&gu(n),n.flags|=1,un(e,n,l,p),n.child)}function Dv(e,n,i,l,p){if(e===null){var g=i.type;return typeof g=="function"&&!pu(g)&&g.defaultProps===void 0&&i.compare===null?(n.tag=15,n.type=g,Mv(e,n,g,l,p)):(e=zl(i.type,null,l,n,n.mode,p),e.ref=n.ref,e.return=n,n.child=e)}if(g=e.child,!cf(e,p)){var k=g.memoizedProps;if(i=i.compare,i=i!==null?i:or,i(k,l)&&e.ref===n.ref)return Xs(e,n,p)}return n.flags|=1,e=Fs(g,l),e.ref=n.ref,e.return=n,n.child=e}function Mv(e,n,i,l,p){if(e!==null){var g=e.memoizedProps;if(or(g,l)&&e.ref===n.ref)if(Gt=!1,n.pendingProps=l=g,cf(e,p))(e.flags&131072)!==0&&(Gt=!0);else return n.lanes=e.lanes,Xs(e,n,p)}return tf(e,n,i,l,p)}function Rv(e,n,i,l){var p=l.children,g=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((n.flags&128)!==0){if(g=g!==null?g.baseLanes|i:i,e!==null){for(l=n.child=e.child,p=0;l!==null;)p=p|l.lanes|l.childLanes,l=l.sibling;l=p&~g}else l=0,n.child=null;return Iv(e,n,g,i,l)}if((i&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ul(n,g!==null?g.cachePool:null),g!==null?Lg(n,g):Du(),Bg(n);else return l=n.lanes=536870912,Iv(e,n,g!==null?g.baseLanes|i:i,i,l)}else g!==null?(Ul(n,g.cachePool),Lg(n,g),Da(),n.memoizedState=null):(e!==null&&Ul(n,null),Du(),Da());return un(e,n,p,i),n.child}function xr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Iv(e,n,i,l,p){var g=Tu();return g=g===null?null:{parent:Vt._currentValue,pool:g},n.memoizedState={baseLanes:i,cachePool:g},e!==null&&Ul(n,null),Du(),Bg(n),e!==null&&io(e,n,l,!0),n.childLanes=p,null}function ac(e,n){return n=oc({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Ov(e,n,i){return yi(n,e.child,null,i),e=ac(n,n.pendingProps),e.flags|=2,Rn(n),n.memoizedState=null,e}function FS(e,n,i){var l=n.pendingProps,p=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Je){if(l.mode==="hidden")return e=ac(n,l),n.lanes=536870912,xr(null,e);if(Ru(n),(e=St)?(e=K0(e,Zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:ws,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=yg(e),i.return=n,n.child=i,cn=n,St=null)):e=null,e===null)throw Ta(n);return n.lanes=536870912,null}return ac(n,l)}var g=e.memoizedState;if(g!==null){var k=g.dehydrated;if(Ru(n),p)if(n.flags&256)n.flags&=-257,n=Ov(e,n,i);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(Gt||io(e,n,i,!1),p=(i&e.childLanes)!==0,Gt||p){if(l=bt,l!==null&&(k=En(l,i),k!==0&&k!==g.retryLane))throw g.retryLane=k,di(e,k),Cn(l,e,k),ef;hc(),n=Ov(e,n,i)}else e=g.treeContext,St=Jn(k.nextSibling),cn=n,Je=!0,ja=null,Zn=!1,e!==null&&xg(n,e),n=ac(n,l),n.flags|=4096;return n}return e=Fs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function ic(e,n){var i=n.ref;if(i===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(r(284));(e===null||e.ref!==i)&&(n.flags|=4194816)}}function tf(e,n,i,l,p){return mi(n),i=Ou(e,n,i,l,void 0,p),l=Lu(),e!==null&&!Gt?(Bu(e,n,p),Xs(e,n,p)):(Je&&l&&gu(n),n.flags|=1,un(e,n,i,p),n.child)}function Lv(e,n,i,l,p,g){return mi(n),n.updateQueue=null,i=$g(n,l,i,p),zg(e),l=Lu(),e!==null&&!Gt?(Bu(e,n,g),Xs(e,n,g)):(Je&&l&&gu(n),n.flags|=1,un(e,n,i,g),n.child)}function Bv(e,n,i,l,p){if(mi(n),n.stateNode===null){var g=to,k=i.contextType;typeof k=="object"&&k!==null&&(g=dn(k)),g=new i(l,g),n.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Xu,n.stateNode=g,g._reactInternals=n,g=n.stateNode,g.props=l,g.state=n.memoizedState,g.refs={},wu(n),k=i.contextType,g.context=typeof k=="object"&&k!==null?dn(k):to,g.state=n.memoizedState,k=i.getDerivedStateFromProps,typeof k=="function"&&(Wu(n,i,k,l),g.state=n.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(k=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),k!==g.state&&Xu.enqueueReplaceState(g,g.state,null),gr(n,l,g,p),hr(),g.state=n.memoizedState),typeof g.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){g=n.stateNode;var w=n.memoizedProps,I=_i(i,w);g.props=I;var K=g.context,Q=i.contextType;k=to,typeof Q=="object"&&Q!==null&&(k=dn(Q));var oe=i.getDerivedStateFromProps;Q=typeof oe=="function"||typeof g.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,Q||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(w||K!==k)&&Sv(n,g,l,k),wa=!1;var Z=n.memoizedState;g.state=Z,gr(n,l,g,p),hr(),K=n.memoizedState,w||Z!==K||wa?(typeof oe=="function"&&(Wu(n,i,oe,l),K=n.memoizedState),(I=wa||kv(n,i,I,l,Z,K,k))?(Q||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(n.flags|=4194308)):(typeof g.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=K),g.props=l,g.state=K,g.context=k,l=I):(typeof g.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{g=n.stateNode,Cu(e,n),k=n.memoizedProps,Q=_i(i,k),g.props=Q,oe=n.pendingProps,Z=g.context,K=i.contextType,I=to,typeof K=="object"&&K!==null&&(I=dn(K)),w=i.getDerivedStateFromProps,(K=typeof w=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(k!==oe||Z!==I)&&Sv(n,g,l,I),wa=!1,Z=n.memoizedState,g.state=Z,gr(n,l,g,p),hr();var J=n.memoizedState;k!==oe||Z!==J||wa||e!==null&&e.dependencies!==null&&Hl(e.dependencies)?(typeof w=="function"&&(Wu(n,i,w,l),J=n.memoizedState),(Q=wa||kv(n,i,Q,l,Z,J,I)||e!==null&&e.dependencies!==null&&Hl(e.dependencies))?(K||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(l,J,I),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(l,J,I)),typeof g.componentDidUpdate=="function"&&(n.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof g.componentDidUpdate!="function"||k===e.memoizedProps&&Z===e.memoizedState||(n.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||k===e.memoizedProps&&Z===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=J),g.props=l,g.state=J,g.context=I,l=Q):(typeof g.componentDidUpdate!="function"||k===e.memoizedProps&&Z===e.memoizedState||(n.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||k===e.memoizedProps&&Z===e.memoizedState||(n.flags|=1024),l=!1)}return g=l,ic(e,n),l=(n.flags&128)!==0,g||l?(g=n.stateNode,i=l&&typeof i.getDerivedStateFromError!="function"?null:g.render(),n.flags|=1,e!==null&&l?(n.child=yi(n,e.child,null,p),n.child=yi(n,null,i,p)):un(e,n,i,p),n.memoizedState=g.state,e=n.child):e=Xs(e,n,p),e}function zv(e,n,i,l){return fi(),n.flags|=256,un(e,n,i,l),n.child}var nf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sf(e){return{baseLanes:e,cachePool:wg()}}function af(e,n,i){return e=e!==null?e.childLanes&~i:0,n&&(e|=On),e}function $v(e,n,i){var l=n.pendingProps,p=!1,g=(n.flags&128)!==0,k;if((k=g)||(k=e!==null&&e.memoizedState===null?!1:(Lt.current&2)!==0),k&&(p=!0,n.flags&=-129),k=(n.flags&32)!==0,n.flags&=-33,e===null){if(Je){if(p?Aa(n):Da(),(e=St)?(e=K0(e,Zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:Sa!==null?{id:ws,overflow:Cs}:null,retryLane:536870912,hydrationErrors:null},i=yg(e),i.return=n,n.child=i,cn=n,St=null)):e=null,e===null)throw Ta(n);return Pf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,p?(Da(),p=n.mode,w=oc({mode:"hidden",children:w},p),l=ui(l,p,i,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=sf(i),l.childLanes=af(e,k,i),n.memoizedState=nf,xr(null,l)):(Aa(n),of(n,w))}var I=e.memoizedState;if(I!==null&&(w=I.dehydrated,w!==null)){if(g)n.flags&256?(Aa(n),n.flags&=-257,n=rf(e,n,i)):n.memoizedState!==null?(Da(),n.child=e.child,n.flags|=128,n=null):(Da(),w=l.fallback,p=n.mode,l=oc({mode:"visible",children:l.children},p),w=ui(w,p,i,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,yi(n,e.child,null,i),l=n.child,l.memoizedState=sf(i),l.childLanes=af(e,k,i),n.memoizedState=nf,n=xr(null,l));else if(Aa(n),Pf(w)){if(k=w.nextSibling&&w.nextSibling.dataset,k)var K=k.dgst;k=K,l=Error(r(419)),l.stack="",l.digest=k,cr({value:l,source:null,stack:null}),n=rf(e,n,i)}else if(Gt||io(e,n,i,!1),k=(i&e.childLanes)!==0,Gt||k){if(k=bt,k!==null&&(l=En(k,i),l!==0&&l!==I.retryLane))throw I.retryLane=l,di(e,l),Cn(k,e,l),ef;Hf(w)||hc(),n=rf(e,n,i)}else Hf(w)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,St=Jn(w.nextSibling),cn=n,Je=!0,ja=null,Zn=!1,e!==null&&xg(n,e),n=of(n,l.children),n.flags|=4096);return n}return p?(Da(),w=l.fallback,p=n.mode,I=e.child,K=I.sibling,l=Fs(I,{mode:"hidden",children:l.children}),l.subtreeFlags=I.subtreeFlags&65011712,K!==null?w=Fs(K,w):(w=ui(w,p,i,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,xr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=sf(i):(p=w.cachePool,p!==null?(I=Vt._currentValue,p=p.parent!==I?{parent:I,pool:I}:p):p=wg(),w={baseLanes:w.baseLanes|i,cachePool:p}),l.memoizedState=w,l.childLanes=af(e,k,i),n.memoizedState=nf,xr(e.child,l)):(Aa(n),i=e.child,e=i.sibling,i=Fs(i,{mode:"visible",children:l.children}),i.return=n,i.sibling=null,e!==null&&(k=n.deletions,k===null?(n.deletions=[e],n.flags|=16):k.push(e)),n.child=i,n.memoizedState=null,i)}function of(e,n){return n=oc({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function oc(e,n){return e=Dn(22,e,null,n),e.lanes=0,e}function rf(e,n,i){return yi(n,e.child,null,i),e=of(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Hv(e,n,i){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),xu(e.return,n,i)}function lf(e,n,i,l,p,g){var k=e.memoizedState;k===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:i,tailMode:p,treeForkCount:g}:(k.isBackwards=n,k.rendering=null,k.renderingStartTime=0,k.last=l,k.tail=i,k.tailMode=p,k.treeForkCount=g)}function Pv(e,n,i){var l=n.pendingProps,p=l.revealOrder,g=l.tail;l=l.children;var k=Lt.current,w=(k&2)!==0;if(w?(k=k&1|2,n.flags|=128):k&=1,xe(Lt,k),un(e,n,l,i),l=Je?lr:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hv(e,i,n);else if(e.tag===19)Hv(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(p){case"forwards":for(i=n.child,p=null;i!==null;)e=i.alternate,e!==null&&Zl(e)===null&&(p=i),i=i.sibling;i=p,i===null?(p=n.child,n.child=null):(p=i.sibling,i.sibling=null),lf(n,!1,p,i,g,l);break;case"backwards":case"unstable_legacy-backwards":for(i=null,p=n.child,n.child=null;p!==null;){if(e=p.alternate,e!==null&&Zl(e)===null){n.child=p;break}e=p.sibling,p.sibling=i,i=p,p=e}lf(n,!0,i,null,g,l);break;case"together":lf(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Xs(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Ia|=n.lanes,(i&n.childLanes)===0)if(e!==null){if(io(e,n,i,!1),(i&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=Fs(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=Fs(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function cf(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Hl(e)))}function KS(e,n,i){switch(n.tag){case 3:Pe(n,n.stateNode.containerInfo),Na(n,Vt,e.memoizedState.cache),fi();break;case 27:case 5:ct(n);break;case 4:Pe(n,n.stateNode.containerInfo);break;case 10:Na(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,Ru(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(Aa(n),n.flags|=128,null):(i&n.child.childLanes)!==0?$v(e,n,i):(Aa(n),e=Xs(e,n,i),e!==null?e.sibling:null);Aa(n);break;case 19:var p=(e.flags&128)!==0;if(l=(i&n.childLanes)!==0,l||(io(e,n,i,!1),l=(i&n.childLanes)!==0),p){if(l)return Pv(e,n,i);n.flags|=128}if(p=n.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),xe(Lt,Lt.current),l)break;return null;case 22:return n.lanes=0,Rv(e,n,i,n.pendingProps);case 24:Na(n,Vt,e.memoizedState.cache)}return Xs(e,n,i)}function Uv(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps)Gt=!0;else{if(!cf(e,i)&&(n.flags&128)===0)return Gt=!1,KS(e,n,i);Gt=(e.flags&131072)!==0}else Gt=!1,Je&&(n.flags&1048576)!==0&&_g(n,lr,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=gi(n.elementType),n.type=e,typeof e=="function")pu(e)?(l=_i(e,l),n.tag=1,n=Bv(null,n,e,l,i)):(n.tag=0,n=tf(null,n,e,l,i));else{if(e!=null){var p=e.$$typeof;if(p===A){n.tag=11,n=Av(null,n,e,l,i);break e}else if(p===L){n.tag=14,n=Dv(null,n,e,l,i);break e}}throw n=G(e)||e,Error(r(306,n,""))}}return n;case 0:return tf(e,n,n.type,n.pendingProps,i);case 1:return l=n.type,p=_i(l,n.pendingProps),Bv(e,n,l,p,i);case 3:e:{if(Pe(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var g=n.memoizedState;p=g.element,Cu(e,n),gr(n,l,null,i);var k=n.memoizedState;if(l=k.cache,Na(n,Vt,l),l!==g.cache&&ku(n,[Vt],i,!0),hr(),l=k.element,g.isDehydrated)if(g={element:l,isDehydrated:!1,cache:k.cache},n.updateQueue.baseState=g,n.memoizedState=g,n.flags&256){n=zv(e,n,l,i);break e}else if(l!==p){p=Gn(Error(r(424)),n),cr(p),n=zv(e,n,l,i);break e}else{switch(e=n.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(St=Jn(e.firstChild),cn=n,Je=!0,ja=null,Zn=!0,i=Rg(n,null,l,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(fi(),l===p){n=Xs(e,n,i);break e}un(e,n,l,i)}n=n.child}return n;case 26:return ic(e,n),e===null?(i=Q0(n.type,null,n.pendingProps,null))?n.memoizedState=i:Je||(i=n.type,e=n.pendingProps,l=kc(_t.current).createElement(i),l[ln]=n,l[kn]=e,fn(l,i,e),tn(l),n.stateNode=l):n.memoizedState=Q0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return ct(n),e===null&&Je&&(l=n.stateNode=J0(n.type,n.pendingProps,_t.current),cn=n,Zn=!0,p=St,$a(n.type)?(Uf=p,St=Jn(l.firstChild)):St=p),un(e,n,n.pendingProps.children,i),ic(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Je&&((p=l=St)&&(l=S2(l,n.type,n.pendingProps,Zn),l!==null?(n.stateNode=l,cn=n,St=Jn(l.firstChild),Zn=!1,p=!0):p=!1),p||Ta(n)),ct(n),p=n.type,g=n.pendingProps,k=e!==null?e.memoizedProps:null,l=g.children,Bf(p,g)?l=null:k!==null&&Bf(p,k)&&(n.flags|=32),n.memoizedState!==null&&(p=Ou(e,n,zS,null,null,i),Lr._currentValue=p),ic(e,n),un(e,n,l,i),n.child;case 6:return e===null&&Je&&((e=i=St)&&(i=j2(i,n.pendingProps,Zn),i!==null?(n.stateNode=i,cn=n,St=null,e=!0):e=!1),e||Ta(n)),null;case 13:return $v(e,n,i);case 4:return Pe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=yi(n,null,l,i):un(e,n,l,i),n.child;case 11:return Av(e,n,n.type,n.pendingProps,i);case 7:return un(e,n,n.pendingProps,i),n.child;case 8:return un(e,n,n.pendingProps.children,i),n.child;case 12:return un(e,n,n.pendingProps.children,i),n.child;case 10:return l=n.pendingProps,Na(n,n.type,l.value),un(e,n,l.children,i),n.child;case 9:return p=n.type._context,l=n.pendingProps.children,mi(n),p=dn(p),l=l(p),n.flags|=1,un(e,n,l,i),n.child;case 14:return Dv(e,n,n.type,n.pendingProps,i);case 15:return Mv(e,n,n.type,n.pendingProps,i);case 19:return Pv(e,n,i);case 31:return FS(e,n,i);case 22:return Rv(e,n,i,n.pendingProps);case 24:return mi(n),l=dn(Vt),e===null?(p=Tu(),p===null&&(p=bt,g=Su(),p.pooledCache=g,g.refCount++,g!==null&&(p.pooledCacheLanes|=i),p=g),n.memoizedState={parent:l,cache:p},wu(n),Na(n,Vt,p)):((e.lanes&i)!==0&&(Cu(e,n),gr(n,null,null,i),hr()),p=e.memoizedState,g=n.memoizedState,p.parent!==l?(p={parent:l,cache:l},n.memoizedState=p,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=p),Na(n,Vt,l)):(l=g.cache,Na(n,Vt,l),l!==p.cache&&ku(n,[Vt],i,!0))),un(e,n,n.pendingProps.children,i),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Qs(e){e.flags|=4}function df(e,n,i,l,p){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(p&335544128)===p)if(e.stateNode.complete)e.flags|=8192;else if(h0())e.flags|=8192;else throw vi=ql,Nu}else e.flags&=-16777217}function Vv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ay(n))if(h0())e.flags|=8192;else throw vi=ql,Nu}function rc(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?je():536870912,e.lanes|=n,yo|=n)}function kr(e,n){if(!Je)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function jt(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,l=0;if(n)for(var p=e.child;p!==null;)i|=p.lanes|p.childLanes,l|=p.subtreeFlags&65011712,l|=p.flags&65011712,p.return=e,p=p.sibling;else for(p=e.child;p!==null;)i|=p.lanes|p.childLanes,l|=p.subtreeFlags,l|=p.flags,p.return=e,p=p.sibling;return e.subtreeFlags|=l,e.childLanes=i,n}function ZS(e,n,i){var l=n.pendingProps;switch(vu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jt(n),null;case 1:return jt(n),null;case 3:return i=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Ys(Vt),ke(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ao(n)?Qs(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,bu())),jt(n),null;case 26:var p=n.type,g=n.memoizedState;return e===null?(Qs(n),g!==null?(jt(n),Vv(n,g)):(jt(n),df(n,p,null,l,i))):g?g!==e.memoizedState?(Qs(n),jt(n),Vv(n,g)):(jt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Qs(n),jt(n),df(n,p,e,l,i)),null;case 27:if(ue(n),i=_t.current,p=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Qs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return jt(n),null}e=De.current,ao(n)?kg(n):(e=J0(p,l,i),n.stateNode=e,Qs(n))}return jt(n),null;case 5:if(ue(n),p=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Qs(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return jt(n),null}if(g=De.current,ao(n))kg(n);else{var k=kc(_t.current);switch(g){case 1:g=k.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:g=k.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":g=k.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":g=k.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":g=k.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof l.is=="string"?k.createElement("select",{is:l.is}):k.createElement("select"),l.multiple?g.multiple=!0:l.size&&(g.size=l.size);break;default:g=typeof l.is=="string"?k.createElement(p,{is:l.is}):k.createElement(p)}}g[ln]=n,g[kn]=l;e:for(k=n.child;k!==null;){if(k.tag===5||k.tag===6)g.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===n)break e;for(;k.sibling===null;){if(k.return===null||k.return===n)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}n.stateNode=g;e:switch(fn(g,p,l),p){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Qs(n)}}return jt(n),df(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,i),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Qs(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=_t.current,ao(n)){if(e=n.stateNode,i=n.memoizedProps,l=null,p=cn,p!==null)switch(p.tag){case 27:case 5:l=p.memoizedProps}e[ln]=n,e=!!(e.nodeValue===i||l!==null&&l.suppressHydrationWarning===!0||$0(e.nodeValue,i)),e||Ta(n,!0)}else e=kc(e).createTextNode(l),e[ln]=n,n.stateNode=e}return jt(n),null;case 31:if(i=n.memoizedState,e===null||e.memoizedState!==null){if(l=ao(n),i!==null){if(e===null){if(!l)throw Error(r(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(557));e[ln]=n}else fi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),e=!1}else i=bu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),e=!0;if(!e)return n.flags&256?(Rn(n),n):(Rn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return jt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(p=ao(n),l!==null&&l.dehydrated!==null){if(e===null){if(!p)throw Error(r(318));if(p=n.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[ln]=n}else fi(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;jt(n),p=!1}else p=bu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=p),p=!0;if(!p)return n.flags&256?(Rn(n),n):(Rn(n),null)}return Rn(n),(n.flags&128)!==0?(n.lanes=i,n):(i=l!==null,e=e!==null&&e.memoizedState!==null,i&&(l=n.child,p=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(p=l.alternate.memoizedState.cachePool.pool),g=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(g=l.memoizedState.cachePool.pool),g!==p&&(l.flags|=2048)),i!==e&&i&&(n.child.flags|=8192),rc(n,n.updateQueue),jt(n),null);case 4:return ke(),e===null&&Mf(n.stateNode.containerInfo),jt(n),null;case 10:return Ys(n.type),jt(n),null;case 19:if(me(Lt),l=n.memoizedState,l===null)return jt(n),null;if(p=(n.flags&128)!==0,g=l.rendering,g===null)if(p)kr(l,!1);else{if(It!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(g=Zl(e),g!==null){for(n.flags|=128,kr(l,!1),e=g.updateQueue,n.updateQueue=e,rc(n,e),n.subtreeFlags=0,e=i,i=n.child;i!==null;)vg(i,e),i=i.sibling;return xe(Lt,Lt.current&1|2),Je&&Ks(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Xt()>fc&&(n.flags|=128,p=!0,kr(l,!1),n.lanes=4194304)}else{if(!p)if(e=Zl(g),e!==null){if(n.flags|=128,p=!0,e=e.updateQueue,n.updateQueue=e,rc(n,e),kr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!g.alternate&&!Je)return jt(n),null}else 2*Xt()-l.renderingStartTime>fc&&i!==536870912&&(n.flags|=128,p=!0,kr(l,!1),n.lanes=4194304);l.isBackwards?(g.sibling=n.child,n.child=g):(e=l.last,e!==null?e.sibling=g:n.child=g,l.last=g)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Xt(),e.sibling=null,i=Lt.current,xe(Lt,p?i&1|2:i&1),Je&&Ks(n,l.treeForkCount),e):(jt(n),null);case 22:case 23:return Rn(n),Mu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(i&536870912)!==0&&(n.flags&128)===0&&(jt(n),n.subtreeFlags&6&&(n.flags|=8192)):jt(n),i=n.updateQueue,i!==null&&rc(n,i.retryQueue),i=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==i&&(n.flags|=2048),e!==null&&me(hi),null;case 24:return i=null,e!==null&&(i=e.memoizedState.cache),n.memoizedState.cache!==i&&(n.flags|=2048),Ys(Vt),jt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function YS(e,n){switch(vu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ys(Vt),ke(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ue(n),null;case 31:if(n.memoizedState!==null){if(Rn(n),n.alternate===null)throw Error(r(340));fi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(Rn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));fi()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return me(Lt),null;case 4:return ke(),null;case 10:return Ys(n.type),null;case 22:case 23:return Rn(n),Mu(),e!==null&&me(hi),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ys(Vt),null;case 25:return null;default:return null}}function qv(e,n){switch(vu(n),n.tag){case 3:Ys(Vt),ke();break;case 26:case 27:case 5:ue(n);break;case 4:ke();break;case 31:n.memoizedState!==null&&Rn(n);break;case 13:Rn(n);break;case 19:me(Lt);break;case 10:Ys(n.type);break;case 22:case 23:Rn(n),Mu(),e!==null&&me(hi);break;case 24:Ys(Vt)}}function Sr(e,n){try{var i=n.updateQueue,l=i!==null?i.lastEffect:null;if(l!==null){var p=l.next;i=p;do{if((i.tag&e)===e){l=void 0;var g=i.create,k=i.inst;l=g(),k.destroy=l}i=i.next}while(i!==p)}}catch(w){ft(n,n.return,w)}}function Ma(e,n,i){try{var l=n.updateQueue,p=l!==null?l.lastEffect:null;if(p!==null){var g=p.next;l=g;do{if((l.tag&e)===e){var k=l.inst,w=k.destroy;if(w!==void 0){k.destroy=void 0,p=n;var I=i,K=w;try{K()}catch(Q){ft(p,I,Q)}}}l=l.next}while(l!==g)}}catch(Q){ft(n,n.return,Q)}}function Gv(e){var n=e.updateQueue;if(n!==null){var i=e.stateNode;try{Og(n,i)}catch(l){ft(e,e.return,l)}}}function Fv(e,n,i){i.props=_i(e.type,e.memoizedProps),i.state=e.memoizedState;try{i.componentWillUnmount()}catch(l){ft(e,n,l)}}function jr(e,n){try{var i=e.ref;if(i!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof i=="function"?e.refCleanup=i(l):i.current=l}}catch(p){ft(e,n,p)}}function Es(e,n){var i=e.ref,l=e.refCleanup;if(i!==null)if(typeof l=="function")try{l()}catch(p){ft(e,n,p)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(p){ft(e,n,p)}else i.current=null}function Kv(e){var n=e.type,i=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":i.autoFocus&&l.focus();break e;case"img":i.src?l.src=i.src:i.srcSet&&(l.srcset=i.srcSet)}}catch(p){ft(e,e.return,p)}}function uf(e,n,i){try{var l=e.stateNode;v2(l,e.type,i,n),l[kn]=n}catch(p){ft(e,e.return,p)}}function Zv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&$a(e.type)||e.tag===4}function ff(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zv(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&&$a(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 pf(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(e,n):(n=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,n.appendChild(e),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=qs));else if(l!==4&&(l===27&&$a(e.type)&&(i=e.stateNode,n=null),e=e.child,e!==null))for(pf(e,n,i),e=e.sibling;e!==null;)pf(e,n,i),e=e.sibling}function lc(e,n,i){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(l!==4&&(l===27&&$a(e.type)&&(i=e.stateNode),e=e.child,e!==null))for(lc(e,n,i),e=e.sibling;e!==null;)lc(e,n,i),e=e.sibling}function Yv(e){var n=e.stateNode,i=e.memoizedProps;try{for(var l=e.type,p=n.attributes;p.length;)n.removeAttributeNode(p[0]);fn(n,l,i),n[ln]=e,n[kn]=i}catch(g){ft(e,e.return,g)}}var ea=!1,Ft=!1,mf=!1,Jv=typeof WeakSet=="function"?WeakSet:Set,nn=null;function JS(e,n){if(e=e.containerInfo,Of=Ec,e=lg(e),ou(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var l=i.getSelection&&i.getSelection();if(l&&l.rangeCount!==0){i=l.anchorNode;var p=l.anchorOffset,g=l.focusNode;l=l.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var k=0,w=-1,I=-1,K=0,Q=0,oe=e,Z=null;t:for(;;){for(var J;oe!==i||p!==0&&oe.nodeType!==3||(w=k+p),oe!==g||l!==0&&oe.nodeType!==3||(I=k+l),oe.nodeType===3&&(k+=oe.nodeValue.length),(J=oe.firstChild)!==null;)Z=oe,oe=J;for(;;){if(oe===e)break t;if(Z===i&&++K===p&&(w=k),Z===g&&++Q===l&&(I=k),(J=oe.nextSibling)!==null)break;oe=Z,Z=oe.parentNode}oe=J}i=w===-1||I===-1?null:{start:w,end:I}}else i=null}i=i||{start:0,end:0}}else i=null;for(Lf={focusedElem:e,selectionRange:i},Ec=!1,nn=n;nn!==null;)if(n=nn,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,nn=e;else for(;nn!==null;){switch(n=nn,g=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(i=0;i<e.length;i++)p=e[i],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&g!==null){e=void 0,i=n,p=g.memoizedProps,g=g.memoizedState,l=i.stateNode;try{var _e=_i(i.type,p);e=l.getSnapshotBeforeUpdate(_e,g),l.__reactInternalSnapshotBeforeUpdate=e}catch(Ee){ft(i,i.return,Ee)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,i=e.nodeType,i===9)$f(e);else if(i===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":$f(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(r(163))}if(e=n.sibling,e!==null){e.return=n.return,nn=e;break}nn=n.return}}function Wv(e,n,i){var l=i.flags;switch(i.tag){case 0:case 11:case 15:na(e,i),l&4&&Sr(5,i);break;case 1:if(na(e,i),l&4)if(e=i.stateNode,n===null)try{e.componentDidMount()}catch(k){ft(i,i.return,k)}else{var p=_i(i.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(p,n,e.__reactInternalSnapshotBeforeUpdate)}catch(k){ft(i,i.return,k)}}l&64&&Gv(i),l&512&&jr(i,i.return);break;case 3:if(na(e,i),l&64&&(e=i.updateQueue,e!==null)){if(n=null,i.child!==null)switch(i.child.tag){case 27:case 5:n=i.child.stateNode;break;case 1:n=i.child.stateNode}try{Og(e,n)}catch(k){ft(i,i.return,k)}}break;case 27:n===null&&l&4&&Yv(i);case 26:case 5:na(e,i),n===null&&l&4&&Kv(i),l&512&&jr(i,i.return);break;case 12:na(e,i);break;case 31:na(e,i),l&4&&e0(e,i);break;case 13:na(e,i),l&4&&t0(e,i),l&64&&(e=i.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(i=i2.bind(null,i),T2(e,i))));break;case 22:if(l=i.memoizedState!==null||ea,!l){n=n!==null&&n.memoizedState!==null||Ft,p=ea;var g=Ft;ea=l,(Ft=n)&&!g?sa(e,i,(i.subtreeFlags&8772)!==0):na(e,i),ea=p,Ft=g}break;case 30:break;default:na(e,i)}}function Xv(e){var n=e.alternate;n!==null&&(e.alternate=null,Xv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Vd(n)),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 Et=null,jn=!1;function ta(e,n,i){for(i=i.child;i!==null;)Qv(e,n,i),i=i.sibling}function Qv(e,n,i){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Qt,i)}catch{}switch(i.tag){case 26:Ft||Es(i,n),ta(e,n,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Ft||Es(i,n);var l=Et,p=jn;$a(i.type)&&(Et=i.stateNode,jn=!1),ta(e,n,i),Rr(i.stateNode),Et=l,jn=p;break;case 5:Ft||Es(i,n);case 6:if(l=Et,p=jn,Et=null,ta(e,n,i),Et=l,jn=p,Et!==null)if(jn)try{(Et.nodeType===9?Et.body:Et.nodeName==="HTML"?Et.ownerDocument.body:Et).removeChild(i.stateNode)}catch(g){ft(i,n,g)}else try{Et.removeChild(i.stateNode)}catch(g){ft(i,n,g)}break;case 18:Et!==null&&(jn?(e=Et,G0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,i.stateNode),No(e)):G0(Et,i.stateNode));break;case 4:l=Et,p=jn,Et=i.stateNode.containerInfo,jn=!0,ta(e,n,i),Et=l,jn=p;break;case 0:case 11:case 14:case 15:Ma(2,i,n),Ft||Ma(4,i,n),ta(e,n,i);break;case 1:Ft||(Es(i,n),l=i.stateNode,typeof l.componentWillUnmount=="function"&&Fv(i,n,l)),ta(e,n,i);break;case 21:ta(e,n,i);break;case 22:Ft=(l=Ft)||i.memoizedState!==null,ta(e,n,i),Ft=l;break;default:ta(e,n,i)}}function e0(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{No(e)}catch(i){ft(n,n.return,i)}}}function t0(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{No(e)}catch(i){ft(n,n.return,i)}}function WS(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Jv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Jv),n;default:throw Error(r(435,e.tag))}}function cc(e,n){var i=WS(e);n.forEach(function(l){if(!i.has(l)){i.add(l);var p=o2.bind(null,e,l);l.then(p,p)}})}function Tn(e,n){var i=n.deletions;if(i!==null)for(var l=0;l<i.length;l++){var p=i[l],g=e,k=n,w=k;e:for(;w!==null;){switch(w.tag){case 27:if($a(w.type)){Et=w.stateNode,jn=!1;break e}break;case 5:Et=w.stateNode,jn=!1;break e;case 3:case 4:Et=w.stateNode.containerInfo,jn=!0;break e}w=w.return}if(Et===null)throw Error(r(160));Qv(g,k,p),Et=null,jn=!1,g=p.alternate,g!==null&&(g.return=null),p.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)n0(n,e),n=n.sibling}var ps=null;function n0(e,n){var i=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Tn(n,e),Nn(e),l&4&&(Ma(3,e,e.return),Sr(3,e),Ma(5,e,e.return));break;case 1:Tn(n,e),Nn(e),l&512&&(Ft||i===null||Es(i,i.return)),l&64&&ea&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=i===null?l:i.concat(l))));break;case 26:var p=ps;if(Tn(n,e),Nn(e),l&512&&(Ft||i===null||Es(i,i.return)),l&4){var g=i!==null?i.memoizedState:null;if(l=e.memoizedState,i===null)if(l===null)if(e.stateNode===null){e:{l=e.type,i=e.memoizedProps,p=p.ownerDocument||p;t:switch(l){case"title":g=p.getElementsByTagName("title")[0],(!g||g[Wo]||g[ln]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=p.createElement(l),p.head.insertBefore(g,p.querySelector("head > title"))),fn(g,l,i),g[ln]=e,tn(g),l=g;break e;case"link":var k=ny("link","href",p).get(l+(i.href||""));if(k){for(var w=0;w<k.length;w++)if(g=k[w],g.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&g.getAttribute("rel")===(i.rel==null?null:i.rel)&&g.getAttribute("title")===(i.title==null?null:i.title)&&g.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){k.splice(w,1);break t}}g=p.createElement(l),fn(g,l,i),p.head.appendChild(g);break;case"meta":if(k=ny("meta","content",p).get(l+(i.content||""))){for(w=0;w<k.length;w++)if(g=k[w],g.getAttribute("content")===(i.content==null?null:""+i.content)&&g.getAttribute("name")===(i.name==null?null:i.name)&&g.getAttribute("property")===(i.property==null?null:i.property)&&g.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&g.getAttribute("charset")===(i.charSet==null?null:i.charSet)){k.splice(w,1);break t}}g=p.createElement(l),fn(g,l,i),p.head.appendChild(g);break;default:throw Error(r(468,l))}g[ln]=e,tn(g),l=g}e.stateNode=l}else sy(p,e.type,e.stateNode);else e.stateNode=ty(p,l,e.memoizedProps);else g!==l?(g===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):g.count--,l===null?sy(p,e.type,e.stateNode):ty(p,l,e.memoizedProps)):l===null&&e.stateNode!==null&&uf(e,e.memoizedProps,i.memoizedProps)}break;case 27:Tn(n,e),Nn(e),l&512&&(Ft||i===null||Es(i,i.return)),i!==null&&l&4&&uf(e,e.memoizedProps,i.memoizedProps);break;case 5:if(Tn(n,e),Nn(e),l&512&&(Ft||i===null||Es(i,i.return)),e.flags&32){p=e.stateNode;try{Zi(p,"")}catch(_e){ft(e,e.return,_e)}}l&4&&e.stateNode!=null&&(p=e.memoizedProps,uf(e,p,i!==null?i.memoizedProps:p)),l&1024&&(mf=!0);break;case 6:if(Tn(n,e),Nn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,i=e.stateNode;try{i.nodeValue=l}catch(_e){ft(e,e.return,_e)}}break;case 3:if(Tc=null,p=ps,ps=Sc(n.containerInfo),Tn(n,e),ps=p,Nn(e),l&4&&i!==null&&i.memoizedState.isDehydrated)try{No(n.containerInfo)}catch(_e){ft(e,e.return,_e)}mf&&(mf=!1,s0(e));break;case 4:l=ps,ps=Sc(e.stateNode.containerInfo),Tn(n,e),Nn(e),ps=l;break;case 12:Tn(n,e),Nn(e);break;case 31:Tn(n,e),Nn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,cc(e,l)));break;case 13:Tn(n,e),Nn(e),e.child.flags&8192&&e.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(uc=Xt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,cc(e,l)));break;case 22:p=e.memoizedState!==null;var I=i!==null&&i.memoizedState!==null,K=ea,Q=Ft;if(ea=K||p,Ft=Q||I,Tn(n,e),Ft=Q,ea=K,Nn(e),l&8192)e:for(n=e.stateNode,n._visibility=p?n._visibility&-2:n._visibility|1,p&&(i===null||I||ea||Ft||xi(e)),i=null,n=e;;){if(n.tag===5||n.tag===26){if(i===null){I=i=n;try{if(g=I.stateNode,p)k=g.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none";else{w=I.stateNode;var oe=I.memoizedProps.style,Z=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;w.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===6){if(i===null){I=n;try{I.stateNode.nodeValue=p?"":I.memoizedProps}catch(_e){ft(I,I.return,_e)}}}else if(n.tag===18){if(i===null){I=n;try{var J=I.stateNode;p?F0(J,!0):F0(I.stateNode,!1)}catch(_e){ft(I,I.return,_e)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;i===n&&(i=null),n=n.return}i===n&&(i=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(i=l.retryQueue,i!==null&&(l.retryQueue=null,cc(e,i))));break;case 19:Tn(n,e),Nn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,cc(e,l)));break;case 30:break;case 21:break;default:Tn(n,e),Nn(e)}}function Nn(e){var n=e.flags;if(n&2){try{for(var i,l=e.return;l!==null;){if(Zv(l)){i=l;break}l=l.return}if(i==null)throw Error(r(160));switch(i.tag){case 27:var p=i.stateNode,g=ff(e);lc(e,g,p);break;case 5:var k=i.stateNode;i.flags&32&&(Zi(k,""),i.flags&=-33);var w=ff(e);lc(e,w,k);break;case 3:case 4:var I=i.stateNode.containerInfo,K=ff(e);pf(e,K,I);break;default:throw Error(r(161))}}catch(Q){ft(e,e.return,Q)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function s0(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;s0(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function na(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)Wv(e,n.alternate,n),n=n.sibling}function xi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ma(4,n,n.return),xi(n);break;case 1:Es(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Fv(n,n.return,i),xi(n);break;case 27:Rr(n.stateNode);case 26:case 5:Es(n,n.return),xi(n);break;case 22:n.memoizedState===null&&xi(n);break;case 30:xi(n);break;default:xi(n)}e=e.sibling}}function sa(e,n,i){for(i=i&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,p=e,g=n,k=g.flags;switch(g.tag){case 0:case 11:case 15:sa(p,g,i),Sr(4,g);break;case 1:if(sa(p,g,i),l=g,p=l.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(K){ft(l,l.return,K)}if(l=g,p=l.updateQueue,p!==null){var w=l.stateNode;try{var I=p.shared.hiddenCallbacks;if(I!==null)for(p.shared.hiddenCallbacks=null,p=0;p<I.length;p++)Ig(I[p],w)}catch(K){ft(l,l.return,K)}}i&&k&64&&Gv(g),jr(g,g.return);break;case 27:Yv(g);case 26:case 5:sa(p,g,i),i&&l===null&&k&4&&Kv(g),jr(g,g.return);break;case 12:sa(p,g,i);break;case 31:sa(p,g,i),i&&k&4&&e0(p,g);break;case 13:sa(p,g,i),i&&k&4&&t0(p,g);break;case 22:g.memoizedState===null&&sa(p,g,i),jr(g,g.return);break;case 30:break;default:sa(p,g,i)}n=n.sibling}}function hf(e,n){var i=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==i&&(e!=null&&e.refCount++,i!=null&&dr(i))}function gf(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&dr(e))}function ms(e,n,i,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)a0(e,n,i,l),n=n.sibling}function a0(e,n,i,l){var p=n.flags;switch(n.tag){case 0:case 11:case 15:ms(e,n,i,l),p&2048&&Sr(9,n);break;case 1:ms(e,n,i,l);break;case 3:ms(e,n,i,l),p&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&dr(e)));break;case 12:if(p&2048){ms(e,n,i,l),e=n.stateNode;try{var g=n.memoizedProps,k=g.id,w=g.onPostCommit;typeof w=="function"&&w(k,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){ft(n,n.return,I)}}else ms(e,n,i,l);break;case 31:ms(e,n,i,l);break;case 13:ms(e,n,i,l);break;case 23:break;case 22:g=n.stateNode,k=n.alternate,n.memoizedState!==null?g._visibility&2?ms(e,n,i,l):Tr(e,n):g._visibility&2?ms(e,n,i,l):(g._visibility|=2,ho(e,n,i,l,(n.subtreeFlags&10256)!==0||!1)),p&2048&&hf(k,n);break;case 24:ms(e,n,i,l),p&2048&&gf(n.alternate,n);break;default:ms(e,n,i,l)}}function ho(e,n,i,l,p){for(p=p&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var g=e,k=n,w=i,I=l,K=k.flags;switch(k.tag){case 0:case 11:case 15:ho(g,k,w,I,p),Sr(8,k);break;case 23:break;case 22:var Q=k.stateNode;k.memoizedState!==null?Q._visibility&2?ho(g,k,w,I,p):Tr(g,k):(Q._visibility|=2,ho(g,k,w,I,p)),p&&K&2048&&hf(k.alternate,k);break;case 24:ho(g,k,w,I,p),p&&K&2048&&gf(k.alternate,k);break;default:ho(g,k,w,I,p)}n=n.sibling}}function Tr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var i=e,l=n,p=l.flags;switch(l.tag){case 22:Tr(i,l),p&2048&&hf(l.alternate,l);break;case 24:Tr(i,l),p&2048&&gf(l.alternate,l);break;default:Tr(i,l)}n=n.sibling}}var Nr=8192;function go(e,n,i){if(e.subtreeFlags&Nr)for(e=e.child;e!==null;)i0(e,n,i),e=e.sibling}function i0(e,n,i){switch(e.tag){case 26:go(e,n,i),e.flags&Nr&&e.memoizedState!==null&&B2(i,ps,e.memoizedState,e.memoizedProps);break;case 5:go(e,n,i);break;case 3:case 4:var l=ps;ps=Sc(e.stateNode.containerInfo),go(e,n,i),ps=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Nr,Nr=16777216,go(e,n,i),Nr=l):go(e,n,i));break;default:go(e,n,i)}}function o0(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function wr(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];nn=l,l0(l,e)}o0(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)r0(e),e=e.sibling}function r0(e){switch(e.tag){case 0:case 11:case 15:wr(e),e.flags&2048&&Ma(9,e,e.return);break;case 3:wr(e);break;case 12:wr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,dc(e)):wr(e);break;default:wr(e)}}function dc(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var i=0;i<n.length;i++){var l=n[i];nn=l,l0(l,e)}o0(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ma(8,n,n.return),dc(n);break;case 22:i=n.stateNode,i._visibility&2&&(i._visibility&=-3,dc(n));break;default:dc(n)}e=e.sibling}}function l0(e,n){for(;nn!==null;){var i=nn;switch(i.tag){case 0:case 11:case 15:Ma(8,i,n);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var l=i.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:dr(i.memoizedState.cache)}if(l=i.child,l!==null)l.return=i,nn=l;else e:for(i=e;nn!==null;){l=nn;var p=l.sibling,g=l.return;if(Xv(l),l===i){nn=null;break e}if(p!==null){p.return=g,nn=p;break e}nn=g}}}var XS={getCacheForType:function(e){var n=dn(Vt),i=n.data.get(e);return i===void 0&&(i=e(),n.data.set(e,i)),i},cacheSignal:function(){return dn(Vt).controller.signal}},QS=typeof WeakMap=="function"?WeakMap:Map,rt=0,bt=null,Ge=null,Ke=0,ut=0,In=null,Ra=!1,vo=!1,vf=!1,aa=0,It=0,Ia=0,ki=0,yf=0,On=0,yo=0,Cr=null,wn=null,bf=!1,uc=0,c0=0,fc=1/0,pc=null,Oa=null,Kt=0,La=null,bo=null,ia=0,_f=0,xf=null,d0=null,Er=0,kf=null;function Ln(){return(rt&2)!==0&&Ke!==0?Ke&-Ke:H.T!==null?Cf():Pi()}function u0(){if(On===0)if((Ke&536870912)===0||Je){var e=V;V<<=1,(V&3932160)===0&&(V=262144),On=e}else On=536870912;return e=Mn.current,e!==null&&(e.flags|=32),On}function Cn(e,n,i){(e===bt&&(ut===2||ut===9)||e.cancelPendingCommit!==null)&&(_o(e,0),Ba(e,Ke,On,!1)),Ue(e,i),((rt&2)===0||e!==bt)&&(e===bt&&((rt&2)===0&&(ki|=i),It===4&&Ba(e,Ke,On,!1)),As(e))}function f0(e,n,i){if((rt&6)!==0)throw Error(r(327));var l=!i&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),p=l?n2(e,n):jf(e,n,!0),g=l;do{if(p===0){vo&&!l&&Ba(e,n,0,!1);break}else{if(i=e.current.alternate,g&&!e2(i)){p=jf(e,n,!1),g=!1;continue}if(p===2){if(g=n,e.errorRecoveryDisabledLanes&g)var k=0;else k=e.pendingLanes&-536870913,k=k!==0?k:k&536870912?536870912:0;if(k!==0){n=k;e:{var w=e;p=Cr;var I=w.current.memoizedState.isDehydrated;if(I&&(_o(w,k).flags|=256),k=jf(w,k,!1),k!==2){if(vf&&!I){w.errorRecoveryDisabledLanes|=g,ki|=g,p=4;break e}g=wn,wn=p,g!==null&&(wn===null?wn=g:wn.push.apply(wn,g))}p=k}if(g=!1,p!==2)continue}}if(p===1){_o(e,0),Ba(e,n,0,!0);break}e:{switch(l=e,g=p,g){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:Ba(l,n,On,!Ra);break e;case 2:wn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(p=uc+300-Xt(),10<p)){if(Ba(l,n,On,!Ra),pe(l,0,!0)!==0)break e;ia=n,l.timeoutHandle=V0(p0.bind(null,l,i,wn,pc,bf,n,On,ki,yo,Ra,g,"Throttled",-0,0),p);break e}p0(l,i,wn,pc,bf,n,On,ki,yo,Ra,g,null,-0,0)}}break}while(!0);As(e)}function p0(e,n,i,l,p,g,k,w,I,K,Q,oe,Z,J){if(e.timeoutHandle=-1,oe=n.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qs},i0(n,g,oe);var _e=(g&62914560)===g?uc-Xt():(g&4194048)===g?c0-Xt():0;if(_e=z2(oe,_e),_e!==null){ia=g,e.cancelPendingCommit=_e(x0.bind(null,e,n,g,i,l,p,k,w,I,Q,oe,null,Z,J)),Ba(e,g,k,!K);return}}x0(e,n,g,i,l,p,k,w,I)}function e2(e){for(var n=e;;){var i=n.tag;if((i===0||i===11||i===15)&&n.flags&16384&&(i=n.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var l=0;l<i.length;l++){var p=i[l],g=p.getSnapshot;p=p.value;try{if(!An(g(),p))return!1}catch{return!1}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function Ba(e,n,i,l){n&=~yf,n&=~ki,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var p=n;0<p;){var g=31-en(p),k=1<<g;l[g]=-1,p&=~k}i!==0&&qe(e,i,n)}function mc(){return(rt&6)===0?(Ar(0),!1):!0}function Sf(){if(Ge!==null){if(ut===0)var e=Ge.return;else e=Ge,Zs=pi=null,zu(e),co=null,fr=0,e=Ge;for(;e!==null;)qv(e.alternate,e),e=e.return;Ge=null}}function _o(e,n){var i=e.timeoutHandle;i!==-1&&(e.timeoutHandle=-1,_2(i)),i=e.cancelPendingCommit,i!==null&&(e.cancelPendingCommit=null,i()),ia=0,Sf(),bt=e,Ge=i=Fs(e.current,null),Ke=n,ut=0,In=null,Ra=!1,vo=ye(e,n),vf=!1,yo=On=yf=ki=Ia=It=0,wn=Cr=null,bf=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var p=31-en(l),g=1<<p;n|=e[p],l&=~g}return aa=n,Ol(),i}function m0(e,n){ze=null,H.H=_r,n===lo||n===Vl?(n=Ag(),ut=3):n===Nu?(n=Ag(),ut=4):ut=n===ef?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,In=n,Ge===null&&(It=1,sc(e,Gn(n,e.current)))}function h0(){var e=Mn.current;return e===null?!0:(Ke&4194048)===Ke?Yn===null:(Ke&62914560)===Ke||(Ke&536870912)!==0?e===Yn:!1}function g0(){var e=H.H;return H.H=_r,e===null?_r:e}function v0(){var e=H.A;return H.A=XS,e}function hc(){It=4,Ra||(Ke&4194048)!==Ke&&Mn.current!==null||(vo=!0),(Ia&134217727)===0&&(ki&134217727)===0||bt===null||Ba(bt,Ke,On,!1)}function jf(e,n,i){var l=rt;rt|=2;var p=g0(),g=v0();(bt!==e||Ke!==n)&&(pc=null,_o(e,n)),n=!1;var k=It;e:do try{if(ut!==0&&Ge!==null){var w=Ge,I=In;switch(ut){case 8:Sf(),k=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(n=!0);var K=ut;if(ut=0,In=null,xo(e,w,I,K),i&&vo){k=0;break e}break;default:K=ut,ut=0,In=null,xo(e,w,I,K)}}t2(),k=It;break}catch(Q){m0(e,Q)}while(!0);return n&&e.shellSuspendCounter++,Zs=pi=null,rt=l,H.H=p,H.A=g,Ge===null&&(bt=null,Ke=0,Ol()),k}function t2(){for(;Ge!==null;)y0(Ge)}function n2(e,n){var i=rt;rt|=2;var l=g0(),p=v0();bt!==e||Ke!==n?(pc=null,fc=Xt()+500,_o(e,n)):vo=ye(e,n);e:do try{if(ut!==0&&Ge!==null){n=Ge;var g=In;t:switch(ut){case 1:ut=0,In=null,xo(e,n,g,1);break;case 2:case 9:if(Cg(g)){ut=0,In=null,b0(n);break}n=function(){ut!==2&&ut!==9||bt!==e||(ut=7),As(e)},g.then(n,n);break e;case 3:ut=7;break e;case 4:ut=5;break e;case 7:Cg(g)?(ut=0,In=null,b0(n)):(ut=0,In=null,xo(e,n,g,7));break;case 5:var k=null;switch(Ge.tag){case 26:k=Ge.memoizedState;case 5:case 27:var w=Ge;if(k?ay(k):w.stateNode.complete){ut=0,In=null;var I=w.sibling;if(I!==null)Ge=I;else{var K=w.return;K!==null?(Ge=K,gc(K)):Ge=null}break t}}ut=0,In=null,xo(e,n,g,5);break;case 6:ut=0,In=null,xo(e,n,g,6);break;case 8:Sf(),It=6;break e;default:throw Error(r(462))}}s2();break}catch(Q){m0(e,Q)}while(!0);return Zs=pi=null,H.H=l,H.A=p,rt=i,Ge!==null?0:(bt=null,Ke=0,Ol(),It)}function s2(){for(;Ge!==null&&!ya();)y0(Ge)}function y0(e){var n=Uv(e.alternate,e,aa);e.memoizedProps=e.pendingProps,n===null?gc(e):Ge=n}function b0(e){var n=e,i=n.alternate;switch(n.tag){case 15:case 0:n=Lv(i,n,n.pendingProps,n.type,void 0,Ke);break;case 11:n=Lv(i,n,n.pendingProps,n.type.render,n.ref,Ke);break;case 5:zu(n);default:qv(i,n),n=Ge=vg(n,aa),n=Uv(i,n,aa)}e.memoizedProps=e.pendingProps,n===null?gc(e):Ge=n}function xo(e,n,i,l){Zs=pi=null,zu(n),co=null,fr=0;var p=n.return;try{if(GS(e,p,n,i,Ke)){It=1,sc(e,Gn(i,e.current)),Ge=null;return}}catch(g){if(p!==null)throw Ge=p,g;It=1,sc(e,Gn(i,e.current)),Ge=null;return}n.flags&32768?(Je||l===1?e=!0:vo||(Ke&536870912)!==0?e=!1:(Ra=e=!0,(l===2||l===9||l===3||l===6)&&(l=Mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),_0(n,e)):gc(n)}function gc(e){var n=e;do{if((n.flags&32768)!==0){_0(n,Ra);return}e=n.return;var i=ZS(n.alternate,n,aa);if(i!==null){Ge=i;return}if(n=n.sibling,n!==null){Ge=n;return}Ge=n=e}while(n!==null);It===0&&(It=5)}function _0(e,n){do{var i=YS(e.alternate,e);if(i!==null){i.flags&=32767,Ge=i;return}if(i=e.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!n&&(e=e.sibling,e!==null)){Ge=e;return}Ge=e=i}while(e!==null);It=6,Ge=null}function x0(e,n,i,l,p,g,k,w,I){e.cancelPendingCommit=null;do vc();while(Kt!==0);if((rt&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(g=n.lanes|n.childLanes,g|=uu,Mt(e,i,g,k,w,I),e===bt&&(Ge=bt=null,Ke=0),bo=n,La=e,ia=i,_f=g,xf=p,d0=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,r2(Us,function(){return N0(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=H.T,H.T=null,p=O.p,O.p=2,k=rt,rt|=4;try{JS(e,n,i)}finally{rt=k,O.p=p,H.T=l}}Kt=1,k0(),S0(),j0()}}function k0(){if(Kt===1){Kt=0;var e=La,n=bo,i=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||i){i=H.T,H.T=null;var l=O.p;O.p=2;var p=rt;rt|=4;try{n0(n,e);var g=Lf,k=lg(e.containerInfo),w=g.focusedElem,I=g.selectionRange;if(k!==w&&w&&w.ownerDocument&&rg(w.ownerDocument.documentElement,w)){if(I!==null&&ou(w)){var K=I.start,Q=I.end;if(Q===void 0&&(Q=K),"selectionStart"in w)w.selectionStart=K,w.selectionEnd=Math.min(Q,w.value.length);else{var oe=w.ownerDocument||document,Z=oe&&oe.defaultView||window;if(Z.getSelection){var J=Z.getSelection(),_e=w.textContent.length,Ee=Math.min(I.start,_e),vt=I.end===void 0?Ee:Math.min(I.end,_e);!J.extend&&Ee>vt&&(k=vt,vt=Ee,Ee=k);var P=og(w,Ee),z=og(w,vt);if(P&&z&&(J.rangeCount!==1||J.anchorNode!==P.node||J.anchorOffset!==P.offset||J.focusNode!==z.node||J.focusOffset!==z.offset)){var F=oe.createRange();F.setStart(P.node,P.offset),J.removeAllRanges(),Ee>vt?(J.addRange(F),J.extend(z.node,z.offset)):(F.setEnd(z.node,z.offset),J.addRange(F))}}}}for(oe=[],J=w;J=J.parentNode;)J.nodeType===1&&oe.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<oe.length;w++){var ae=oe[w];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Ec=!!Of,Lf=Of=null}finally{rt=p,O.p=l,H.T=i}}e.current=n,Kt=2}}function S0(){if(Kt===2){Kt=0;var e=La,n=bo,i=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||i){i=H.T,H.T=null;var l=O.p;O.p=2;var p=rt;rt|=4;try{Wv(e,n.alternate,n)}finally{rt=p,O.p=l,H.T=i}}Kt=3}}function j0(){if(Kt===4||Kt===3){Kt=0,Bi();var e=La,n=bo,i=ia,l=d0;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Kt=5:(Kt=0,bo=La=null,T0(e,e.pendingLanes));var p=e.pendingLanes;if(p===0&&(Oa=null),js(i),n=n.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(Qt,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=H.T,p=O.p,O.p=2,H.T=null;try{for(var g=e.onRecoverableError,k=0;k<l.length;k++){var w=l[k];g(w.value,{componentStack:w.stack})}}finally{H.T=n,O.p=p}}(ia&3)!==0&&vc(),As(e),p=e.pendingLanes,(i&261930)!==0&&(p&42)!==0?e===kf?Er++:(Er=0,kf=e):Er=0,Ar(0)}}function T0(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,dr(n)))}function vc(){return k0(),S0(),j0(),N0()}function N0(){if(Kt!==5)return!1;var e=La,n=_f;_f=0;var i=js(ia),l=H.T,p=O.p;try{O.p=32>i?32:i,H.T=null,i=xf,xf=null;var g=La,k=ia;if(Kt=0,bo=La=null,ia=0,(rt&6)!==0)throw Error(r(331));var w=rt;if(rt|=4,r0(g.current),a0(g,g.current,k,i),rt=w,Ar(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(Qt,g)}catch{}return!0}finally{O.p=p,H.T=l,T0(e,n)}}function w0(e,n,i){n=Gn(i,n),n=Qu(e.stateNode,n,2),e=Ea(e,n,2),e!==null&&(Ue(e,2),As(e))}function ft(e,n,i){if(e.tag===3)w0(e,e,i);else for(;n!==null;){if(n.tag===3){w0(n,e,i);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Oa===null||!Oa.has(l))){e=Gn(i,e),i=Cv(2),l=Ea(n,i,2),l!==null&&(Ev(i,l,n,e),Ue(l,2),As(l));break}}n=n.return}}function Tf(e,n,i){var l=e.pingCache;if(l===null){l=e.pingCache=new QS;var p=new Set;l.set(n,p)}else p=l.get(n),p===void 0&&(p=new Set,l.set(n,p));p.has(i)||(vf=!0,p.add(i),e=a2.bind(null,e,n,i),n.then(e,e))}function a2(e,n,i){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&i,e.warmLanes&=~i,bt===e&&(Ke&i)===i&&(It===4||It===3&&(Ke&62914560)===Ke&&300>Xt()-uc?(rt&2)===0&&_o(e,0):yf|=i,yo===Ke&&(yo=0)),As(e)}function C0(e,n){n===0&&(n=je()),e=di(e,n),e!==null&&(Ue(e,n),As(e))}function i2(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),C0(e,i)}function o2(e,n){var i=0;switch(e.tag){case 31:case 13:var l=e.stateNode,p=e.memoizedState;p!==null&&(i=p.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(n),C0(e,i)}function r2(e,n){return us(e,n)}var yc=null,ko=null,Nf=!1,bc=!1,wf=!1,za=0;function As(e){e!==ko&&e.next===null&&(ko===null?yc=ko=e:ko=ko.next=e),bc=!0,Nf||(Nf=!0,c2())}function Ar(e,n){if(!wf&&bc){wf=!0;do for(var i=!1,l=yc;l!==null;){if(e!==0){var p=l.pendingLanes;if(p===0)var g=0;else{var k=l.suspendedLanes,w=l.pingedLanes;g=(1<<31-en(42|e)+1)-1,g&=p&~(k&~w),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,M0(l,g))}else g=Ke,g=pe(l,l===bt?g:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(g&3)===0||ye(l,g)||(i=!0,M0(l,g));l=l.next}while(i);wf=!1}}function l2(){E0()}function E0(){bc=Nf=!1;var e=0;za!==0&&b2()&&(e=za);for(var n=Xt(),i=null,l=yc;l!==null;){var p=l.next,g=A0(l,n);g===0?(l.next=null,i===null?yc=p:i.next=p,p===null&&(ko=i)):(i=l,(e!==0||(g&3)!==0)&&(bc=!0)),l=p}Kt!==0&&Kt!==5||Ar(e),za!==0&&(za=0)}function A0(e,n){for(var i=e.suspendedLanes,l=e.pingedLanes,p=e.expirationTimes,g=e.pendingLanes&-62914561;0<g;){var k=31-en(g),w=1<<k,I=p[k];I===-1?((w&i)===0||(w&l)!==0)&&(p[k]=tt(w,n)):I<=n&&(e.expiredLanes|=w),g&=~w}if(n=bt,i=Ke,i=pe(e,e===n?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,i===0||e===n&&(ut===2||ut===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&Ps(l),e.callbackNode=null,e.callbackPriority=0;if((i&3)===0||ye(e,i)){if(n=i&-i,n===e.callbackPriority)return n;switch(l!==null&&Ps(l),js(i)){case 2:case 8:i=ba;break;case 32:i=Us;break;case 268435456:i=_a;break;default:i=Us}return l=D0.bind(null,e),i=us(i,l),e.callbackPriority=n,e.callbackNode=i,n}return l!==null&&l!==null&&Ps(l),e.callbackPriority=2,e.callbackNode=null,2}function D0(e,n){if(Kt!==0&&Kt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var i=e.callbackNode;if(vc()&&e.callbackNode!==i)return null;var l=Ke;return l=pe(e,e===bt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(f0(e,l,n),A0(e,Xt()),e.callbackNode!=null&&e.callbackNode===i?D0.bind(null,e):null)}function M0(e,n){if(vc())return null;f0(e,n,!0)}function c2(){x2(function(){(rt&6)!==0?us(ii,l2):E0()})}function Cf(){if(za===0){var e=oo;e===0&&(e=xa,xa<<=1,(xa&261888)===0&&(xa=256)),za=e}return za}function R0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:wl(""+e)}function I0(e,n){var i=n.ownerDocument.createElement("input");return i.name=n.name,i.value=n.value,e.id&&i.setAttribute("form",e.id),n.parentNode.insertBefore(i,n),e=new FormData(e),i.parentNode.removeChild(i),e}function d2(e,n,i,l,p){if(n==="submit"&&i&&i.stateNode===p){var g=R0((p[kn]||null).action),k=l.submitter;k&&(n=(n=k[kn]||null)?R0(n.formAction):k.getAttribute("formAction"),n!==null&&(g=n,k=null));var w=new Dl("action","action",null,l,p);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(za!==0){var I=k?I0(p,k):new FormData(p);Ku(i,{pending:!0,data:I,method:p.method,action:g},null,I)}}else typeof g=="function"&&(w.preventDefault(),I=k?I0(p,k):new FormData(p),Ku(i,{pending:!0,data:I,method:p.method,action:g},g,I))},currentTarget:p}]})}}for(var Ef=0;Ef<du.length;Ef++){var Af=du[Ef],u2=Af.toLowerCase(),f2=Af[0].toUpperCase()+Af.slice(1);fs(u2,"on"+f2)}fs(ug,"onAnimationEnd"),fs(fg,"onAnimationIteration"),fs(pg,"onAnimationStart"),fs("dblclick","onDoubleClick"),fs("focusin","onFocus"),fs("focusout","onBlur"),fs(CS,"onTransitionRun"),fs(ES,"onTransitionStart"),fs(AS,"onTransitionCancel"),fs(mg,"onTransitionEnd"),Fi("onMouseEnter",["mouseout","mouseover"]),Fi("onMouseLeave",["mouseout","mouseover"]),Fi("onPointerEnter",["pointerout","pointerover"]),Fi("onPointerLeave",["pointerout","pointerover"]),oi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),oi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),oi("onBeforeInput",["compositionend","keypress","textInput","paste"]),oi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),oi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dr="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(" "),p2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Dr));function O0(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var l=e[i],p=l.event;l=l.listeners;e:{var g=void 0;if(n)for(var k=l.length-1;0<=k;k--){var w=l[k],I=w.instance,K=w.currentTarget;if(w=w.listener,I!==g&&p.isPropagationStopped())break e;g=w,p.currentTarget=K;try{g(p)}catch(Q){Il(Q)}p.currentTarget=null,g=I}else for(k=0;k<l.length;k++){if(w=l[k],I=w.instance,K=w.currentTarget,w=w.listener,I!==g&&p.isPropagationStopped())break e;g=w,p.currentTarget=K;try{g(p)}catch(Q){Il(Q)}p.currentTarget=null,g=I}}}}function Fe(e,n){var i=n[Ud];i===void 0&&(i=n[Ud]=new Set);var l=e+"__bubble";i.has(l)||(L0(n,e,2,!1),i.add(l))}function Df(e,n,i){var l=0;n&&(l|=4),L0(i,e,l,n)}var _c="_reactListening"+Math.random().toString(36).slice(2);function Mf(e){if(!e[_c]){e[_c]=!0,Eh.forEach(function(i){i!=="selectionchange"&&(p2.has(i)||Df(i,!1,e),Df(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[_c]||(n[_c]=!0,Df("selectionchange",!1,n))}}function L0(e,n,i,l){switch(uy(n)){case 2:var p=P2;break;case 8:p=U2;break;default:p=Kf}i=p.bind(null,n,i,e),p=void 0,!Wd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(p=!0),l?p!==void 0?e.addEventListener(n,i,{capture:!0,passive:p}):e.addEventListener(n,i,!0):p!==void 0?e.addEventListener(n,i,{passive:p}):e.addEventListener(n,i,!1)}function Rf(e,n,i,l,p){var g=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var k=l.tag;if(k===3||k===4){var w=l.stateNode.containerInfo;if(w===p)break;if(k===4)for(k=l.return;k!==null;){var I=k.tag;if((I===3||I===4)&&k.stateNode.containerInfo===p)return;k=k.return}for(;w!==null;){if(k=Vi(w),k===null)return;if(I=k.tag,I===5||I===6||I===26||I===27){l=g=k;continue e}w=w.parentNode}}l=l.return}Ph(function(){var K=g,Q=Yd(i),oe=[];e:{var Z=hg.get(e);if(Z!==void 0){var J=Dl,_e=e;switch(e){case"keypress":if(El(i)===0)break e;case"keydown":case"keyup":J=oS;break;case"focusin":_e="focus",J=tu;break;case"focusout":_e="blur",J=tu;break;case"beforeblur":case"afterblur":J=tu;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=qh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=Zk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=cS;break;case ug:case fg:case pg:J=Wk;break;case mg:J=uS;break;case"scroll":case"scrollend":J=Fk;break;case"wheel":J=pS;break;case"copy":case"cut":case"paste":J=Qk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Fh;break;case"toggle":case"beforetoggle":J=hS}var Ee=(n&4)!==0,vt=!Ee&&(e==="scroll"||e==="scrollend"),P=Ee?Z!==null?Z+"Capture":null:Z;Ee=[];for(var z=K,F;z!==null;){var ae=z;if(F=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||F===null||P===null||(ae=Qo(z,P),ae!=null&&Ee.push(Mr(z,ae,F))),vt)break;z=z.return}0<Ee.length&&(Z=new J(Z,_e,null,i,Q),oe.push({event:Z,listeners:Ee}))}}if((n&7)===0){e:{if(Z=e==="mouseover"||e==="pointerover",J=e==="mouseout"||e==="pointerout",Z&&i!==Zd&&(_e=i.relatedTarget||i.fromElement)&&(Vi(_e)||_e[Ui]))break e;if((J||Z)&&(Z=Q.window===Q?Q:(Z=Q.ownerDocument)?Z.defaultView||Z.parentWindow:window,J?(_e=i.relatedTarget||i.toElement,J=K,_e=_e?Vi(_e):null,_e!==null&&(vt=d(_e),Ee=_e.tag,_e!==vt||Ee!==5&&Ee!==27&&Ee!==6)&&(_e=null)):(J=null,_e=K),J!==_e)){if(Ee=qh,ae="onMouseLeave",P="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(Ee=Fh,ae="onPointerLeave",P="onPointerEnter",z="pointer"),vt=J==null?Z:Xo(J),F=_e==null?Z:Xo(_e),Z=new Ee(ae,z+"leave",J,i,Q),Z.target=vt,Z.relatedTarget=F,ae=null,Vi(Q)===K&&(Ee=new Ee(P,z+"enter",_e,i,Q),Ee.target=F,Ee.relatedTarget=vt,ae=Ee),vt=ae,J&&_e)t:{for(Ee=m2,P=J,z=_e,F=0,ae=P;ae;ae=Ee(ae))F++;ae=0;for(var Ne=z;Ne;Ne=Ee(Ne))ae++;for(;0<F-ae;)P=Ee(P),F--;for(;0<ae-F;)z=Ee(z),ae--;for(;F--;){if(P===z||z!==null&&P===z.alternate){Ee=P;break t}P=Ee(P),z=Ee(z)}Ee=null}else Ee=null;J!==null&&B0(oe,Z,J,Ee,!1),_e!==null&&vt!==null&&B0(oe,vt,_e,Ee,!0)}}e:{if(Z=K?Xo(K):window,J=Z.nodeName&&Z.nodeName.toLowerCase(),J==="select"||J==="input"&&Z.type==="file")var st=eg;else if(Xh(Z))if(tg)st=TS;else{st=SS;var Se=kS}else J=Z.nodeName,!J||J.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?K&&Kd(K.elementType)&&(st=eg):st=jS;if(st&&(st=st(e,K))){Qh(oe,st,i,Q);break e}Se&&Se(e,Z,K),e==="focusout"&&K&&Z.type==="number"&&K.memoizedProps.value!=null&&Fd(Z,"number",Z.value)}switch(Se=K?Xo(K):window,e){case"focusin":(Xh(Se)||Se.contentEditable==="true")&&(Xi=Se,ru=K,rr=null);break;case"focusout":rr=ru=Xi=null;break;case"mousedown":lu=!0;break;case"contextmenu":case"mouseup":case"dragend":lu=!1,cg(oe,i,Q);break;case"selectionchange":if(wS)break;case"keydown":case"keyup":cg(oe,i,Q)}var $e;if(su)e:{switch(e){case"compositionstart":var Ze="onCompositionStart";break e;case"compositionend":Ze="onCompositionEnd";break e;case"compositionupdate":Ze="onCompositionUpdate";break e}Ze=void 0}else Wi?Jh(e,i)&&(Ze="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Ze="onCompositionStart");Ze&&(Kh&&i.locale!=="ko"&&(Wi||Ze!=="onCompositionStart"?Ze==="onCompositionEnd"&&Wi&&($e=Uh()):(ka=Q,Xd="value"in ka?ka.value:ka.textContent,Wi=!0)),Se=xc(K,Ze),0<Se.length&&(Ze=new Gh(Ze,e,null,i,Q),oe.push({event:Ze,listeners:Se}),$e?Ze.data=$e:($e=Wh(i),$e!==null&&(Ze.data=$e)))),($e=vS?yS(e,i):bS(e,i))&&(Ze=xc(K,"onBeforeInput"),0<Ze.length&&(Se=new Gh("onBeforeInput","beforeinput",null,i,Q),oe.push({event:Se,listeners:Ze}),Se.data=$e)),d2(oe,e,K,i,Q)}O0(oe,n)})}function Mr(e,n,i){return{instance:e,listener:n,currentTarget:i}}function xc(e,n){for(var i=n+"Capture",l=[];e!==null;){var p=e,g=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||g===null||(p=Qo(e,i),p!=null&&l.unshift(Mr(e,p,g)),p=Qo(e,n),p!=null&&l.push(Mr(e,p,g))),e.tag===3)return l;e=e.return}return[]}function m2(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function B0(e,n,i,l,p){for(var g=n._reactName,k=[];i!==null&&i!==l;){var w=i,I=w.alternate,K=w.stateNode;if(w=w.tag,I!==null&&I===l)break;w!==5&&w!==26&&w!==27||K===null||(I=K,p?(K=Qo(i,g),K!=null&&k.unshift(Mr(i,K,I))):p||(K=Qo(i,g),K!=null&&k.push(Mr(i,K,I)))),i=i.return}k.length!==0&&e.push({event:n,listeners:k})}var h2=/\r\n?/g,g2=/\u0000|\uFFFD/g;function z0(e){return(typeof e=="string"?e:""+e).replace(h2,`
26
+ `).replace(g2,"")}function $0(e,n){return n=z0(n),z0(e)===n}function gt(e,n,i,l,p,g){switch(i){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Zi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Zi(e,""+l);break;case"className":Tl(e,"class",l);break;case"tabIndex":Tl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Tl(e,i,l);break;case"style":$h(e,l,g);break;case"data":if(n!=="object"){Tl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||i!=="href")){e.removeAttribute(i);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=wl(""+l),e.setAttribute(i,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(i,"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 g=="function"&&(i==="formAction"?(n!=="input"&&gt(e,n,"name",p.name,p,null),gt(e,n,"formEncType",p.formEncType,p,null),gt(e,n,"formMethod",p.formMethod,p,null),gt(e,n,"formTarget",p.formTarget,p,null)):(gt(e,n,"encType",p.encType,p,null),gt(e,n,"method",p.method,p,null),gt(e,n,"target",p.target,p,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(i);break}l=wl(""+l),e.setAttribute(i,l);break;case"onClick":l!=null&&(e.onclick=qs);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(p.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}i=wl(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""+l):e.removeAttribute(i);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":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,""):e.removeAttribute(i);break;case"capture":case"download":l===!0?e.setAttribute(i,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(i,l):e.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(i,l):e.removeAttribute(i);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(i):e.setAttribute(i,l);break;case"popover":Fe("beforetoggle",e),Fe("toggle",e),jl(e,"popover",l);break;case"xlinkActuate":Vs(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Vs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Vs(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Vs(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Vs(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Vs(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Vs(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Vs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Vs(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":jl(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=qk.get(i)||i,jl(e,i,l))}}function If(e,n,i,l,p,g){switch(i){case"style":$h(e,l,g);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(i=l.__html,i!=null){if(p.children!=null)throw Error(r(60));e.innerHTML=i}}break;case"children":typeof l=="string"?Zi(e,l):(typeof l=="number"||typeof l=="bigint")&&Zi(e,""+l);break;case"onScroll":l!=null&&Fe("scroll",e);break;case"onScrollEnd":l!=null&&Fe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=qs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ah.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(p=i.endsWith("Capture"),n=i.slice(2,p?i.length-7:void 0),g=e[kn]||null,g=g!=null?g[i]:null,typeof g=="function"&&e.removeEventListener(n,g,p),typeof l=="function")){typeof g!="function"&&g!==null&&(i in e?e[i]=null:e.hasAttribute(i)&&e.removeAttribute(i)),e.addEventListener(n,l,p);break e}i in e?e[i]=l:l===!0?e.setAttribute(i,""):jl(e,i,l)}}}function fn(e,n,i){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Fe("error",e),Fe("load",e);var l=!1,p=!1,g;for(g in i)if(i.hasOwnProperty(g)){var k=i[g];if(k!=null)switch(g){case"src":l=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:gt(e,n,g,k,i,null)}}p&&gt(e,n,"srcSet",i.srcSet,i,null),l&&gt(e,n,"src",i.src,i,null);return;case"input":Fe("invalid",e);var w=g=k=p=null,I=null,K=null;for(l in i)if(i.hasOwnProperty(l)){var Q=i[l];if(Q!=null)switch(l){case"name":p=Q;break;case"type":k=Q;break;case"checked":I=Q;break;case"defaultChecked":K=Q;break;case"value":g=Q;break;case"defaultValue":w=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,n));break;default:gt(e,n,l,Q,i,null)}}Oh(e,g,w,I,K,k,p,!1);return;case"select":Fe("invalid",e),l=k=g=null;for(p in i)if(i.hasOwnProperty(p)&&(w=i[p],w!=null))switch(p){case"value":g=w;break;case"defaultValue":k=w;break;case"multiple":l=w;default:gt(e,n,p,w,i,null)}n=g,i=k,e.multiple=!!l,n!=null?Ki(e,!!l,n,!1):i!=null&&Ki(e,!!l,i,!0);return;case"textarea":Fe("invalid",e),g=p=l=null;for(k in i)if(i.hasOwnProperty(k)&&(w=i[k],w!=null))switch(k){case"value":l=w;break;case"defaultValue":p=w;break;case"children":g=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:gt(e,n,k,w,i,null)}Bh(e,l,p,g);return;case"option":for(I in i)if(i.hasOwnProperty(I)&&(l=i[I],l!=null))switch(I){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:gt(e,n,I,l,i,null)}return;case"dialog":Fe("beforetoggle",e),Fe("toggle",e),Fe("cancel",e),Fe("close",e);break;case"iframe":case"object":Fe("load",e);break;case"video":case"audio":for(l=0;l<Dr.length;l++)Fe(Dr[l],e);break;case"image":Fe("error",e),Fe("load",e);break;case"details":Fe("toggle",e);break;case"embed":case"source":case"link":Fe("error",e),Fe("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 i)if(i.hasOwnProperty(K)&&(l=i[K],l!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:gt(e,n,K,l,i,null)}return;default:if(Kd(n)){for(Q in i)i.hasOwnProperty(Q)&&(l=i[Q],l!==void 0&&If(e,n,Q,l,i,void 0));return}}for(w in i)i.hasOwnProperty(w)&&(l=i[w],l!=null&&gt(e,n,w,l,i,null))}function v2(e,n,i,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,g=null,k=null,w=null,I=null,K=null,Q=null;for(J in i){var oe=i[J];if(i.hasOwnProperty(J)&&oe!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":I=oe;default:l.hasOwnProperty(J)||gt(e,n,J,null,l,oe)}}for(var Z in l){var J=l[Z];if(oe=i[Z],l.hasOwnProperty(Z)&&(J!=null||oe!=null))switch(Z){case"type":g=J;break;case"name":p=J;break;case"checked":K=J;break;case"defaultChecked":Q=J;break;case"value":k=J;break;case"defaultValue":w=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,n));break;default:J!==oe&&gt(e,n,Z,J,l,oe)}}Gd(e,k,w,I,K,Q,g,p);return;case"select":J=k=w=Z=null;for(g in i)if(I=i[g],i.hasOwnProperty(g)&&I!=null)switch(g){case"value":break;case"multiple":J=I;default:l.hasOwnProperty(g)||gt(e,n,g,null,l,I)}for(p in l)if(g=l[p],I=i[p],l.hasOwnProperty(p)&&(g!=null||I!=null))switch(p){case"value":Z=g;break;case"defaultValue":w=g;break;case"multiple":k=g;default:g!==I&&gt(e,n,p,g,l,I)}n=w,i=k,l=J,Z!=null?Ki(e,!!i,Z,!1):!!l!=!!i&&(n!=null?Ki(e,!!i,n,!0):Ki(e,!!i,i?[]:"",!1));return;case"textarea":J=Z=null;for(w in i)if(p=i[w],i.hasOwnProperty(w)&&p!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:gt(e,n,w,null,l,p)}for(k in l)if(p=l[k],g=i[k],l.hasOwnProperty(k)&&(p!=null||g!=null))switch(k){case"value":Z=p;break;case"defaultValue":J=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(r(91));break;default:p!==g&&gt(e,n,k,p,l,g)}Lh(e,Z,J);return;case"option":for(var _e in i)if(Z=i[_e],i.hasOwnProperty(_e)&&Z!=null&&!l.hasOwnProperty(_e))switch(_e){case"selected":e.selected=!1;break;default:gt(e,n,_e,null,l,Z)}for(I in l)if(Z=l[I],J=i[I],l.hasOwnProperty(I)&&Z!==J&&(Z!=null||J!=null))switch(I){case"selected":e.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:gt(e,n,I,Z,l,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in i)Z=i[Ee],i.hasOwnProperty(Ee)&&Z!=null&&!l.hasOwnProperty(Ee)&&gt(e,n,Ee,null,l,Z);for(K in l)if(Z=l[K],J=i[K],l.hasOwnProperty(K)&&Z!==J&&(Z!=null||J!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,n));break;default:gt(e,n,K,Z,l,J)}return;default:if(Kd(n)){for(var vt in i)Z=i[vt],i.hasOwnProperty(vt)&&Z!==void 0&&!l.hasOwnProperty(vt)&&If(e,n,vt,void 0,l,Z);for(Q in l)Z=l[Q],J=i[Q],!l.hasOwnProperty(Q)||Z===J||Z===void 0&&J===void 0||If(e,n,Q,Z,l,J);return}}for(var P in i)Z=i[P],i.hasOwnProperty(P)&&Z!=null&&!l.hasOwnProperty(P)&&gt(e,n,P,null,l,Z);for(oe in l)Z=l[oe],J=i[oe],!l.hasOwnProperty(oe)||Z===J||Z==null&&J==null||gt(e,n,oe,Z,l,J)}function H0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function y2(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,i=performance.getEntriesByType("resource"),l=0;l<i.length;l++){var p=i[l],g=p.transferSize,k=p.initiatorType,w=p.duration;if(g&&w&&H0(k)){for(k=0,w=p.responseEnd,l+=1;l<i.length;l++){var I=i[l],K=I.startTime;if(K>w)break;var Q=I.transferSize,oe=I.initiatorType;Q&&H0(oe)&&(I=I.responseEnd,k+=Q*(I<w?1:(w-K)/(I-K)))}if(--l,n+=8*(g+k)/(p.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Of=null,Lf=null;function kc(e){return e.nodeType===9?e:e.ownerDocument}function P0(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 U0(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function Bf(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var zf=null;function b2(){var e=window.event;return e&&e.type==="popstate"?e===zf?!1:(zf=e,!0):(zf=null,!1)}var V0=typeof setTimeout=="function"?setTimeout:void 0,_2=typeof clearTimeout=="function"?clearTimeout:void 0,q0=typeof Promise=="function"?Promise:void 0,x2=typeof queueMicrotask=="function"?queueMicrotask:typeof q0<"u"?function(e){return q0.resolve(null).then(e).catch(k2)}:V0;function k2(e){setTimeout(function(){throw e})}function $a(e){return e==="head"}function G0(e,n){var i=n,l=0;do{var p=i.nextSibling;if(e.removeChild(i),p&&p.nodeType===8)if(i=p.data,i==="/$"||i==="/&"){if(l===0){e.removeChild(p),No(n);return}l--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")l++;else if(i==="html")Rr(e.ownerDocument.documentElement);else if(i==="head"){i=e.ownerDocument.head,Rr(i);for(var g=i.firstChild;g;){var k=g.nextSibling,w=g.nodeName;g[Wo]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&g.rel.toLowerCase()==="stylesheet"||i.removeChild(g),g=k}}else i==="body"&&Rr(e.ownerDocument.body);i=p}while(i);No(n)}function F0(e,n){var i=e;e=0;do{var l=i.nextSibling;if(i.nodeType===1?n?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(n?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),l&&l.nodeType===8)if(i=l.data,i==="/$"){if(e===0)break;e--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||e++;i=l}while(i)}function $f(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var i=n;switch(n=n.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":$f(i),Vd(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}e.removeChild(i)}}function S2(e,n,i,l){for(;e.nodeType===1;){var p=i;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Wo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(g=e.getAttribute("rel"),g==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(g!==p.rel||e.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||e.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||e.getAttribute("title")!==(p.title==null?null:p.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(g=e.getAttribute("src"),(g!==(p.src==null?null:p.src)||e.getAttribute("type")!==(p.type==null?null:p.type)||e.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&g&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var g=p.name==null?null:""+p.name;if(p.type==="hidden"&&e.getAttribute("name")===g)return e}else return e;if(e=Jn(e.nextSibling),e===null)break}return null}function j2(e,n,i){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Jn(e.nextSibling),e===null))return null;return e}function K0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Jn(e.nextSibling),e===null))return null;return e}function Hf(e){return e.data==="$?"||e.data==="$~"}function Pf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function T2(e,n){var i=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||i.readyState!=="loading")n();else{var l=function(){n(),i.removeEventListener("DOMContentLoaded",l)};i.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Jn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var Uf=null;function Z0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"||i==="/&"){if(n===0)return Jn(e.nextSibling);n--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||n++}e=e.nextSibling}return null}function Y0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(n===0)return e;n--}else i!=="/$"&&i!=="/&"||n++}e=e.previousSibling}return null}function J0(e,n,i){switch(n=kc(i),e){case"html":if(e=n.documentElement,!e)throw Error(r(452));return e;case"head":if(e=n.head,!e)throw Error(r(453));return e;case"body":if(e=n.body,!e)throw Error(r(454));return e;default:throw Error(r(451))}}function Rr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Vd(e)}var Wn=new Map,W0=new Set;function Sc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var oa=O.d;O.d={f:N2,r:w2,D:C2,C:E2,L:A2,m:D2,X:R2,S:M2,M:I2};function N2(){var e=oa.f(),n=mc();return e||n}function w2(e){var n=qi(e);n!==null&&n.tag===5&&n.type==="form"?mv(n):oa.r(e)}var So=typeof document>"u"?null:document;function X0(e,n,i){var l=So;if(l&&typeof n=="string"&&n){var p=Vn(n);p='link[rel="'+e+'"][href="'+p+'"]',typeof i=="string"&&(p+='[crossorigin="'+i+'"]'),W0.has(p)||(W0.add(p),e={rel:e,crossOrigin:i,href:n},l.querySelector(p)===null&&(n=l.createElement("link"),fn(n,"link",e),tn(n),l.head.appendChild(n)))}}function C2(e){oa.D(e),X0("dns-prefetch",e,null)}function E2(e,n){oa.C(e,n),X0("preconnect",e,n)}function A2(e,n,i){oa.L(e,n,i);var l=So;if(l&&e&&n){var p='link[rel="preload"][as="'+Vn(n)+'"]';n==="image"&&i&&i.imageSrcSet?(p+='[imagesrcset="'+Vn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(p+='[imagesizes="'+Vn(i.imageSizes)+'"]')):p+='[href="'+Vn(e)+'"]';var g=p;switch(n){case"style":g=jo(e);break;case"script":g=To(e)}Wn.has(g)||(e=b({rel:"preload",href:n==="image"&&i&&i.imageSrcSet?void 0:e,as:n},i),Wn.set(g,e),l.querySelector(p)!==null||n==="style"&&l.querySelector(Ir(g))||n==="script"&&l.querySelector(Or(g))||(n=l.createElement("link"),fn(n,"link",e),tn(n),l.head.appendChild(n)))}}function D2(e,n){oa.m(e,n);var i=So;if(i&&e){var l=n&&typeof n.as=="string"?n.as:"script",p='link[rel="modulepreload"][as="'+Vn(l)+'"][href="'+Vn(e)+'"]',g=p;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=To(e)}if(!Wn.has(g)&&(e=b({rel:"modulepreload",href:e},n),Wn.set(g,e),i.querySelector(p)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Or(g)))return}l=i.createElement("link"),fn(l,"link",e),tn(l),i.head.appendChild(l)}}}function M2(e,n,i){oa.S(e,n,i);var l=So;if(l&&e){var p=Gi(l).hoistableStyles,g=jo(e);n=n||"default";var k=p.get(g);if(!k){var w={loading:0,preload:null};if(k=l.querySelector(Ir(g)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},i),(i=Wn.get(g))&&Vf(e,i);var I=k=l.createElement("link");tn(I),fn(I,"link",e),I._p=new Promise(function(K,Q){I.onload=K,I.onerror=Q}),I.addEventListener("load",function(){w.loading|=1}),I.addEventListener("error",function(){w.loading|=2}),w.loading|=4,jc(k,n,l)}k={type:"stylesheet",instance:k,count:1,state:w},p.set(g,k)}}}function R2(e,n){oa.X(e,n);var i=So;if(i&&e){var l=Gi(i).hoistableScripts,p=To(e),g=l.get(p);g||(g=i.querySelector(Or(p)),g||(e=b({src:e,async:!0},n),(n=Wn.get(p))&&qf(e,n),g=i.createElement("script"),tn(g),fn(g,"link",e),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},l.set(p,g))}}function I2(e,n){oa.M(e,n);var i=So;if(i&&e){var l=Gi(i).hoistableScripts,p=To(e),g=l.get(p);g||(g=i.querySelector(Or(p)),g||(e=b({src:e,async:!0,type:"module"},n),(n=Wn.get(p))&&qf(e,n),g=i.createElement("script"),tn(g),fn(g,"link",e),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},l.set(p,g))}}function Q0(e,n,i,l){var p=(p=_t.current)?Sc(p):null;if(!p)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(n=jo(i.href),i=Gi(p).hoistableStyles,l=i.get(n),l||(l={type:"style",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){e=jo(i.href);var g=Gi(p).hoistableStyles,k=g.get(e);if(k||(p=p.ownerDocument||p,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(e,k),(g=p.querySelector(Ir(e)))&&!g._p&&(k.instance=g,k.state.loading=5),Wn.has(e)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Wn.set(e,i),g||O2(p,e,i,k.state))),n&&l===null)throw Error(r(528,""));return k}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=i.async,i=i.src,typeof i=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=To(i),i=Gi(p).hoistableScripts,l=i.get(n),l||(l={type:"script",instance:null,count:0,state:null},i.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function jo(e){return'href="'+Vn(e)+'"'}function Ir(e){return'link[rel="stylesheet"]['+e+"]"}function ey(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function O2(e,n,i,l){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?l.loading=1:(n=e.createElement("link"),l.preload=n,n.addEventListener("load",function(){return l.loading|=1}),n.addEventListener("error",function(){return l.loading|=2}),fn(n,"link",i),tn(n),e.head.appendChild(n))}function To(e){return'[src="'+Vn(e)+'"]'}function Or(e){return"script[async]"+e}function ty(e,n,i){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Vn(i.href)+'"]');if(l)return n.instance=l,tn(l),l;var p=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),tn(l),fn(l,"style",p),jc(l,i.precedence,e),n.instance=l;case"stylesheet":p=jo(i.href);var g=e.querySelector(Ir(p));if(g)return n.state.loading|=4,n.instance=g,tn(g),g;l=ey(i),(p=Wn.get(p))&&Vf(l,p),g=(e.ownerDocument||e).createElement("link"),tn(g);var k=g;return k._p=new Promise(function(w,I){k.onload=w,k.onerror=I}),fn(g,"link",l),n.state.loading|=4,jc(g,i.precedence,e),n.instance=g;case"script":return g=To(i.src),(p=e.querySelector(Or(g)))?(n.instance=p,tn(p),p):(l=i,(p=Wn.get(g))&&(l=b({},i),qf(l,p)),e=e.ownerDocument||e,p=e.createElement("script"),tn(p),fn(p,"link",l),e.head.appendChild(p),n.instance=p);case"void":return null;default:throw Error(r(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,jc(l,i.precedence,e));return n.instance}function jc(e,n,i){for(var l=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=l.length?l[l.length-1]:null,g=p,k=0;k<l.length;k++){var w=l[k];if(w.dataset.precedence===n)g=w;else if(g!==p)break}g?g.parentNode.insertBefore(e,g.nextSibling):(n=i.nodeType===9?i.head:i,n.insertBefore(e,n.firstChild))}function Vf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function qf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var Tc=null;function ny(e,n,i){if(Tc===null){var l=new Map,p=Tc=new Map;p.set(i,l)}else p=Tc,l=p.get(i),l||(l=new Map,p.set(i,l));if(l.has(e))return l;for(l.set(e,null),i=i.getElementsByTagName(e),p=0;p<i.length;p++){var g=i[p];if(!(g[Wo]||g[ln]||e==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var k=g.getAttribute(n)||"";k=e+k;var w=l.get(k);w?w.push(g):l.set(k,[g])}}return l}function sy(e,n,i){e=e.ownerDocument||e,e.head.insertBefore(i,n==="title"?e.querySelector("head > title"):null)}function L2(e,n,i){if(i===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;switch(n.rel){case"stylesheet":return e=n.disabled,typeof n.precedence=="string"&&e==null;default:return!0}case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function ay(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function B2(e,n,i,l){if(i.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var p=jo(l.href),g=n.querySelector(Ir(p));if(g){n=g._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Nc.bind(e),n.then(e,e)),i.state.loading|=4,i.instance=g,tn(g);return}g=n.ownerDocument||n,l=ey(l),(p=Wn.get(p))&&Vf(l,p),g=g.createElement("link"),tn(g);var k=g;k._p=new Promise(function(w,I){k.onload=w,k.onerror=I}),fn(g,"link",l),i.instance=g}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(i,n),(n=i.state.preload)&&(i.state.loading&3)===0&&(e.count++,i=Nc.bind(e),n.addEventListener("load",i),n.addEventListener("error",i))}}var Gf=0;function z2(e,n){return e.stylesheets&&e.count===0&&Cc(e,e.stylesheets),0<e.count||0<e.imgCount?function(i){var l=setTimeout(function(){if(e.stylesheets&&Cc(e,e.stylesheets),e.unsuspend){var g=e.unsuspend;e.unsuspend=null,g()}},6e4+n);0<e.imgBytes&&Gf===0&&(Gf=62500*y2());var p=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Cc(e,e.stylesheets),e.unsuspend)){var g=e.unsuspend;e.unsuspend=null,g()}},(e.imgBytes>Gf?50:800)+n);return e.unsuspend=i,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(p)}}:null}function Nc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Cc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wc=null;function Cc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wc=new Map,n.forEach($2,e),wc=null,Nc.call(e))}function $2(e,n){if(!(n.state.loading&4)){var i=wc.get(e);if(i)var l=i.get(null);else{i=new Map,wc.set(e,i);for(var p=e.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<p.length;g++){var k=p[g];(k.nodeName==="LINK"||k.getAttribute("media")!=="not all")&&(i.set(k.dataset.precedence,k),l=k)}l&&i.set(null,l)}p=n.instance,k=p.getAttribute("data-precedence"),g=i.get(k)||l,g===l&&i.set(null,p),i.set(k,p),this.count++,l=Nc.bind(this),p.addEventListener("load",l),p.addEventListener("error",l),g?g.parentNode.insertBefore(p,g.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(p,e.firstChild)),n.state.loading|=4}}var Lr={$$typeof:D,Provider:null,Consumer:null,_currentValue:q,_currentValue2:q,_threadCount:0};function H2(e,n,i,l,p,g,k,w,I){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=Be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.hiddenUpdates=Be(null),this.identifierPrefix=l,this.onUncaughtError=p,this.onCaughtError=g,this.onRecoverableError=k,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function iy(e,n,i,l,p,g,k,w,I,K,Q,oe){return e=new H2(e,n,i,k,I,K,Q,oe,w),n=1,g===!0&&(n|=24),g=Dn(3,null,null,n),e.current=g,g.stateNode=e,n=Su(),n.refCount++,e.pooledCache=n,n.refCount++,g.memoizedState={element:l,isDehydrated:i,cache:n},wu(g),e}function oy(e){return e?(e=to,e):to}function ry(e,n,i,l,p,g){p=oy(p),l.context===null?l.context=p:l.pendingContext=p,l=Ca(n),l.payload={element:i},g=g===void 0?null:g,g!==null&&(l.callback=g),i=Ea(e,l,n),i!==null&&(Cn(i,e,n),mr(i,e,n))}function ly(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function Ff(e,n){ly(e,n),(e=e.alternate)&&ly(e,n)}function cy(e){if(e.tag===13||e.tag===31){var n=di(e,67108864);n!==null&&Cn(n,e,67108864),Ff(e,67108864)}}function dy(e){if(e.tag===13||e.tag===31){var n=Ln();n=xt(n);var i=di(e,n);i!==null&&Cn(i,e,n),Ff(e,n)}}var Ec=!0;function P2(e,n,i,l){var p=H.T;H.T=null;var g=O.p;try{O.p=2,Kf(e,n,i,l)}finally{O.p=g,H.T=p}}function U2(e,n,i,l){var p=H.T;H.T=null;var g=O.p;try{O.p=8,Kf(e,n,i,l)}finally{O.p=g,H.T=p}}function Kf(e,n,i,l){if(Ec){var p=Zf(l);if(p===null)Rf(e,n,l,Ac,i),fy(e,l);else if(q2(p,e,n,i,l))l.stopPropagation();else if(fy(e,l),n&4&&-1<V2.indexOf(e)){for(;p!==null;){var g=qi(p);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var k=de(g.pendingLanes);if(k!==0){var w=g;for(w.pendingLanes|=2,w.entangledLanes|=2;k;){var I=1<<31-en(k);w.entanglements[1]|=I,k&=~I}As(g),(rt&6)===0&&(fc=Xt()+500,Ar(0))}}break;case 31:case 13:w=di(g,2),w!==null&&Cn(w,g,2),mc(),Ff(g,2)}if(g=Zf(l),g===null&&Rf(e,n,l,Ac,i),g===p)break;p=g}p!==null&&l.stopPropagation()}else Rf(e,n,l,null,i)}}function Zf(e){return e=Yd(e),Yf(e)}var Ac=null;function Yf(e){if(Ac=null,e=Vi(e),e!==null){var n=d(e);if(n===null)e=null;else{var i=n.tag;if(i===13){if(e=u(n),e!==null)return e;e=null}else if(i===31){if(e=f(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Ac=e,null}function uy(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(ai()){case ii:return 2;case ba:return 8;case Us:case Ss:return 32;case _a:return 268435456;default:return 32}default:return 32}}var Jf=!1,Ha=null,Pa=null,Ua=null,Br=new Map,zr=new Map,Va=[],V2="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 fy(e,n){switch(e){case"focusin":case"focusout":Ha=null;break;case"dragenter":case"dragleave":Pa=null;break;case"mouseover":case"mouseout":Ua=null;break;case"pointerover":case"pointerout":Br.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":zr.delete(n.pointerId)}}function $r(e,n,i,l,p,g){return e===null||e.nativeEvent!==g?(e={blockedOn:n,domEventName:i,eventSystemFlags:l,nativeEvent:g,targetContainers:[p]},n!==null&&(n=qi(n),n!==null&&cy(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,p!==null&&n.indexOf(p)===-1&&n.push(p),e)}function q2(e,n,i,l,p){switch(n){case"focusin":return Ha=$r(Ha,e,n,i,l,p),!0;case"dragenter":return Pa=$r(Pa,e,n,i,l,p),!0;case"mouseover":return Ua=$r(Ua,e,n,i,l,p),!0;case"pointerover":var g=p.pointerId;return Br.set(g,$r(Br.get(g)||null,e,n,i,l,p)),!0;case"gotpointercapture":return g=p.pointerId,zr.set(g,$r(zr.get(g)||null,e,n,i,l,p)),!0}return!1}function py(e){var n=Vi(e.target);if(n!==null){var i=d(n);if(i!==null){if(n=i.tag,n===13){if(n=u(i),n!==null){e.blockedOn=n,Ts(e.priority,function(){dy(i)});return}}else if(n===31){if(n=f(i),n!==null){e.blockedOn=n,Ts(e.priority,function(){dy(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Zf(e.nativeEvent);if(i===null){i=e.nativeEvent;var l=new i.constructor(i.type,i);Zd=l,i.target.dispatchEvent(l),Zd=null}else return n=qi(i),n!==null&&cy(n),e.blockedOn=i,!1;n.shift()}return!0}function my(e,n,i){Dc(e)&&i.delete(n)}function G2(){Jf=!1,Ha!==null&&Dc(Ha)&&(Ha=null),Pa!==null&&Dc(Pa)&&(Pa=null),Ua!==null&&Dc(Ua)&&(Ua=null),Br.forEach(my),zr.forEach(my)}function Mc(e,n){e.blockedOn===n&&(e.blockedOn=null,Jf||(Jf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,G2)))}var Rc=null;function hy(e){Rc!==e&&(Rc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rc===e&&(Rc=null);for(var n=0;n<e.length;n+=3){var i=e[n],l=e[n+1],p=e[n+2];if(typeof l!="function"){if(Yf(l||i)===null)continue;break}var g=qi(i);g!==null&&(e.splice(n,3),n-=3,Ku(g,{pending:!0,data:p,method:i.method,action:l},l,p))}}))}function No(e){function n(I){return Mc(I,e)}Ha!==null&&Mc(Ha,e),Pa!==null&&Mc(Pa,e),Ua!==null&&Mc(Ua,e),Br.forEach(n),zr.forEach(n);for(var i=0;i<Va.length;i++){var l=Va[i];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Va.length&&(i=Va[0],i.blockedOn===null);)py(i),i.blockedOn===null&&Va.shift();if(i=(e.ownerDocument||e).$$reactFormReplay,i!=null)for(l=0;l<i.length;l+=3){var p=i[l],g=i[l+1],k=p[kn]||null;if(typeof g=="function")k||hy(i);else if(k){var w=null;if(g&&g.hasAttribute("formAction")){if(p=g,k=g[kn]||null)w=k.formAction;else if(Yf(p)!==null)continue}else w=k.action;typeof w=="function"?i[l+1]=w:(i.splice(l,3),l-=3),hy(i)}}}function gy(){function e(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(k){return p=k})},focusReset:"manual",scroll:"manual"})}function n(){p!==null&&(p(),p=null),l||setTimeout(i,20)}function i(){if(!l&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,p=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(i,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),p!==null&&(p(),p=null)}}}function Wf(e){this._internalRoot=e}Ic.prototype.render=Wf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var i=n.current,l=Ln();ry(i,l,e,n,null,null)},Ic.prototype.unmount=Wf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;ry(e.current,2,null,e,null,null),mc(),n[Ui]=null}};function Ic(e){this._internalRoot=e}Ic.prototype.unstable_scheduleHydration=function(e){if(e){var n=Pi();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Va.length&&n!==0&&n<Va[i].priority;i++);Va.splice(i,0,e),i===0&&py(e)}};var vy=s.version;if(vy!=="19.2.4")throw Error(r(527,vy,"19.2.4"));O.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=h(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var F2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Oc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oc.isDisabled&&Oc.supportsFiber)try{Qt=Oc.inject(F2),Ct=Oc}catch{}}return Hr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var i=!1,l="",p=jv,g=Tv,k=Nv;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(p=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(k=n.onRecoverableError)),n=iy(e,1,!1,null,null,i,l,null,p,g,k,gy),e[Ui]=n.current,Mf(e),new Wf(n)},Hr.hydrateRoot=function(e,n,i){if(!c(e))throw Error(r(299));var l=!1,p="",g=jv,k=Tv,w=Nv,I=null;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(k=i.onCaughtError),i.onRecoverableError!==void 0&&(w=i.onRecoverableError),i.formState!==void 0&&(I=i.formState)),n=iy(e,1,!0,n,i??null,l,p,I,g,k,w,gy),n.context=oy(null),i=n.current,l=Ln(),l=xt(l),p=Ca(l),p.callback=null,Ea(i,p,l),i=l,n.current.lanes=i,Ue(n,i),As(n),e[Ui]=n.current,Mf(e),new Ic(n)},Hr.version="19.2.4",Hr}var ky;function Sj(){if(ky)return Xf.exports;ky=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),Xf.exports=kj(),Xf.exports}var jj=Sj();const Tj="modulepreload",Nj=function(t){return"/"+t},Sy={},wm=function(s,o,r){let c=Promise.resolve();if(o&&o.length>0){let u=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));c=u(o.map(h=>{if(h=Nj(h),h in Sy)return;Sy[h]=!0;const v=h.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":Tj,v||(_.as="script"),_.crossOrigin="",_.href=h,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((x,S)=>{_.addEventListener("load",x),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function d(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return c.then(u=>{for(const f of u||[])f.status==="rejected"&&d(f.reason);return s().catch(d)})},wj=new Proxy(globalThis.fetch,{apply(t,s,o){return Reflect.apply(globalThis.fetch,s,o)}}),Nd=Q2({baseUrl:"/",fetch:wj}),Le=Td(ej,Nd),zn=Td(tj,Nd),Hc=Td(nj,Nd),Pc=Td(sj,Nd),Cj="_bar_1xlm9_1",Ej="_textarea_1xlm9_32",Aj="_select_1xlm9_73",Dj="_btnPrimary_1xlm9_109",Mj="_btnGhost_1xlm9_179",Rj="_badge_1xlm9_201",Ij="_disconnectHint_1xlm9_211",bs={bar:Cj,textarea:Ej,select:Aj,btnPrimary:Dj,btnGhost:Mj,badge:Rj,disconnectHint:Ij},Oj=200;function Lj(t,s){if(!t)return!1;const o=s.find(r=>r.id===t);return o!==void 0&&(o.status==="disconnected"||o.status==="error")}function Bj({environmentId:t,onReconnect:s}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:bs.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),a.jsx("button",{type:"button",onClick:()=>s(t),className:bs.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function tp({value:t,onChange:s,onSubmit:o,placeholder:r,disabled:c,autoFocus:d,ariaLabel:u}){const f=y.useRef(null);y.useLayoutEffect(()=>{const h=f.current;h&&(h.style.height="auto",h.style.height=`${Math.min(h.scrollHeight,Oj)}px`)},[t]);const m=h=>{h.key==="Enter"&&(h.metaKey||h.ctrlKey)&&!h.nativeEvent.isComposing&&(h.preventDefault(),o())};return a.jsx("textarea",{ref:f,rows:1,value:t,onChange:h=>s(h.target.value),onKeyDown:m,placeholder:r,disabled:c,autoFocus:d,className:bs.textarea,"aria-label":u})}function wd({mode:t,sessionId:s,environmentId:o,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:f,onSpawn:m,onStartTask:h,onProvisionEnvironment:v,onShowToast:b}){const[_,x]=y.useState(""),[S,j]=y.useState(""),T=Lj(o,u),N=()=>{if(_.trim())if(t==="send"){if(!s||T)return;f(s,_),x("")}else if(t==="spawn"){if(!o)return;m(o,_,S),b==null||b("Session started","success"),x(""),j("")}else{if(!r)return;h(r,void 0,o,_),x("")}},C=D=>{D.preventDefault(),N()};return t==="spawn"?a.jsxs("form",{onSubmit:C,className:bs.bar,children:[a.jsx("span",{className:bs.badge,children:"new chat"}),a.jsx(tp,{value:_,onChange:x,onSubmit:N,placeholder:"Enter prompt...",autoFocus:!0,ariaLabel:"Enter prompt"}),c&&a.jsxs("select",{value:S,onChange:D=>j(D.target.value),className:bs.select,"aria-label":"Select persona",children:[a.jsx("option",{value:"",children:"(Default)"}),d.map(D=>a.jsx("option",{value:D.id,children:D.name},D.id))]}),a.jsx("button",{type:"submit",disabled:!_.trim()||!o,className:bs.btnPrimary,children:"Go"})]}):t==="start"?a.jsxs("form",{onSubmit:C,className:bs.bar,children:[a.jsx(tp,{value:_,onChange:x,onSubmit:N,placeholder:"Type a message...",autoFocus:!0,ariaLabel:"Type a message"}),a.jsx("button",{type:"submit",disabled:!_.trim(),className:bs.btnPrimary,children:"Send"})]}):a.jsxs("form",{onSubmit:C,className:bs.bar,children:[T&&o&&a.jsx(Bj,{environmentId:o,onReconnect:v}),a.jsx(tp,{value:_,onChange:x,onSubmit:N,placeholder:"Type a message...",autoFocus:!T,disabled:T,ariaLabel:"Type a message"}),a.jsx("span",{title:T?"Environment is unavailable — reconnect first":void 0,children:a.jsx("button",{type:"submit",disabled:!_.trim()||T,className:bs.btnPrimary,children:"Send"})})]})}const jy=220,Ty=70,zj=40,$j=60,Hj="hierarchy",Pj="dependency";function Uj(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new fd.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:zj,ranksep:$j});const o=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&o.has(u.parentTaskId)){const f=r.get(u.parentTaskId)||[];f.push(u),r.set(u.parentTaskId,f)}for(const u of t)s.setNode(u.id,{width:jy,height:Ty});const c=[];for(const u of t){if(u.parentTaskId&&o.has(u.parentTaskId)){const f=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},f),c.push({id:f,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:Hj},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const f of u.dependsOn)if(o.has(f)){const m=`dependency-${f}-${u.id}`;s.setEdge(f,u.id,{},m),c.push({id:m,source:f,target:u.id,type:"smoothstep",data:{edgeType:Pj},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return fd.layout(s),{nodes:t.map(u=>{const f=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:f.x-jy/2,y:f.y-Ty/2},data:{task:u,childCount:m.length,doneChildCount:m.filter(h=>h.status==="complete").length,hasDependencies:u.dependsOn.length>0}}}),edges:c}},[t])}/**
27
+ * @license lucide-react v0.474.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Vj=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),J_=(...t)=>t.filter((s,o,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===o).join(" ").trim();/**
32
+ * @license lucide-react v0.474.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */var qj={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
37
+ * @license lucide-react v0.474.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const Gj=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...f},m)=>y.createElement("svg",{ref:m,...qj,width:s,height:s,stroke:t,strokeWidth:r?Number(o)*24/Number(s):o,className:J_("lucide",c),...f},[...u.map(([h,v])=>y.createElement(h,v)),...Array.isArray(d)?d:[d]]));/**
42
+ * @license lucide-react v0.474.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Me=(t,s)=>{const o=y.forwardRef(({className:r,...c},d)=>y.createElement(Gj,{ref:d,iconNode:s,className:J_(`lucide-${Vj(t)}`,r),...c}));return o.displayName=`${t}`,o};/**
47
+ * @license lucide-react v0.474.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Fj=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Kj=Me("Activity",Fj);/**
52
+ * @license lucide-react v0.474.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const Zj=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ny=Me("ArrowDown",Zj);/**
57
+ * @license lucide-react v0.474.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const Yj=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],wy=Me("ArrowUp",Yj);/**
62
+ * @license lucide-react v0.474.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */const Jj=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],Wj=Me("Ban",Jj);/**
67
+ * @license lucide-react v0.474.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const Xj=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]],Qj=Me("Brain",Xj);/**
72
+ * @license lucide-react v0.474.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const eT=[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],tT=Me("CalendarClock",eT);/**
77
+ * @license lucide-react v0.474.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const nT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Mi=Me("Check",nT);/**
82
+ * @license lucide-react v0.474.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const sT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],W_=Me("ChevronDown",sT);/**
87
+ * @license lucide-react v0.474.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const aT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],va=Me("ChevronRight",aT);/**
92
+ * @license lucide-react v0.474.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const iT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ai=Me("Circle",iT);/**
97
+ * @license lucide-react v0.474.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const oT=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],rT=Me("ClipboardList",oT);/**
102
+ * @license lucide-react v0.474.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const lT=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],X_=Me("Clipboard",lT);/**
107
+ * @license lucide-react v0.474.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const cT=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],dT=Me("CodeXml",cT);/**
112
+ * @license lucide-react v0.474.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const uT=[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]],fT=Me("Cog",uT);/**
117
+ * @license lucide-react v0.474.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const pT=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],mT=Me("Copy",pT);/**
122
+ * @license lucide-react v0.474.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const hT=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],gT=Me("CornerDownRight",hT);/**
127
+ * @license lucide-react v0.474.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const vT=[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]],yT=Me("FilePen",vT);/**
132
+ * @license lucide-react v0.474.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const bT=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],_T=Me("FileText",bT);/**
137
+ * @license lucide-react v0.474.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const xT=[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]],kT=Me("Forward",xT);/**
142
+ * @license lucide-react v0.474.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const ST=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],jT=Me("GitBranch",ST);/**
147
+ * @license lucide-react v0.474.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const TT=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],NT=Me("Github",TT);/**
152
+ * @license lucide-react v0.474.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const wT=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],CT=Me("Hash",wT);/**
157
+ * @license lucide-react v0.474.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const ET=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],AT=Me("House",ET);/**
162
+ * @license lucide-react v0.474.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const DT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Cm=Me("Info",DT);/**
167
+ * @license lucide-react v0.474.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const MT=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],RT=Me("Key",MT);/**
172
+ * @license lucide-react v0.474.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const IT=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],OT=Me("Keyboard",IT);/**
177
+ * @license lucide-react v0.474.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const LT=[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]],BT=Me("ListChecks",LT);/**
182
+ * @license lucide-react v0.474.0 - ISC
183
+ *
184
+ * This source code is licensed under the ISC license.
185
+ * See the LICENSE file in the root directory of this source tree.
186
+ */const zT=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],$T=Me("List",zT);/**
187
+ * @license lucide-react v0.474.0 - ISC
188
+ *
189
+ * This source code is licensed under the ISC license.
190
+ * See the LICENSE file in the root directory of this source tree.
191
+ */const HT=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],PT=Me("Loader",HT);/**
192
+ * @license lucide-react v0.474.0 - ISC
193
+ *
194
+ * This source code is licensed under the ISC license.
195
+ * See the LICENSE file in the root directory of this source tree.
196
+ */const UT=[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]],VT=Me("Menu",UT);/**
197
+ * @license lucide-react v0.474.0 - ISC
198
+ *
199
+ * This source code is licensed under the ISC license.
200
+ * See the LICENSE file in the root directory of this source tree.
201
+ */const qT=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]],GT=Me("MessageSquare",qT);/**
202
+ * @license lucide-react v0.474.0 - ISC
203
+ *
204
+ * This source code is licensed under the ISC license.
205
+ * See the LICENSE file in the root directory of this source tree.
206
+ */const FT=[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]],KT=Me("MessagesSquare",FT);/**
207
+ * @license lucide-react v0.474.0 - ISC
208
+ *
209
+ * This source code is licensed under the ISC license.
210
+ * See the LICENSE file in the root directory of this source tree.
211
+ */const ZT=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],YT=Me("Monitor",ZT);/**
212
+ * @license lucide-react v0.474.0 - ISC
213
+ *
214
+ * This source code is licensed under the ISC license.
215
+ * See the LICENSE file in the root directory of this source tree.
216
+ */const JT=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],WT=Me("Network",JT);/**
217
+ * @license lucide-react v0.474.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const XT=[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]],QT=Me("Palette",XT);/**
222
+ * @license lucide-react v0.474.0 - ISC
223
+ *
224
+ * This source code is licensed under the ISC license.
225
+ * See the LICENSE file in the root directory of this source tree.
226
+ */const eN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],tN=Me("PanelLeftClose",eN);/**
227
+ * @license lucide-react v0.474.0 - ISC
228
+ *
229
+ * This source code is licensed under the ISC license.
230
+ * See the LICENSE file in the root directory of this source tree.
231
+ */const nN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]],sN=Me("PanelLeftOpen",nN);/**
232
+ * @license lucide-react v0.474.0 - ISC
233
+ *
234
+ * This source code is licensed under the ISC license.
235
+ * See the LICENSE file in the root directory of this source tree.
236
+ */const aN=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],iN=Me("PanelLeft",aN);/**
237
+ * @license lucide-react v0.474.0 - ISC
238
+ *
239
+ * This source code is licensed under the ISC license.
240
+ * See the LICENSE file in the root directory of this source tree.
241
+ */const oN=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],rN=Me("Pause",oN);/**
242
+ * @license lucide-react v0.474.0 - ISC
243
+ *
244
+ * This source code is licensed under the ISC license.
245
+ * See the LICENSE file in the root directory of this source tree.
246
+ */const lN=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],cN=Me("Pencil",lN);/**
247
+ * @license lucide-react v0.474.0 - ISC
248
+ *
249
+ * This source code is licensed under the ISC license.
250
+ * See the LICENSE file in the root directory of this source tree.
251
+ */const dN=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],uN=Me("Puzzle",dN);/**
252
+ * @license lucide-react v0.474.0 - ISC
253
+ *
254
+ * This source code is licensed under the ISC license.
255
+ * See the LICENSE file in the root directory of this source tree.
256
+ */const fN=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],pN=Me("RefreshCw",fN);/**
257
+ * @license lucide-react v0.474.0 - ISC
258
+ *
259
+ * This source code is licensed under the ISC license.
260
+ * See the LICENSE file in the root directory of this source tree.
261
+ */const mN=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Gp=Me("Search",mN);/**
262
+ * @license lucide-react v0.474.0 - ISC
263
+ *
264
+ * This source code is licensed under the ISC license.
265
+ * See the LICENSE file in the root directory of this source tree.
266
+ */const hN=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],gN=Me("Settings",hN);/**
267
+ * @license lucide-react v0.474.0 - ISC
268
+ *
269
+ * This source code is licensed under the ISC license.
270
+ * See the LICENSE file in the root directory of this source tree.
271
+ */const vN=[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],yN=Me("SquareCheckBig",vN);/**
272
+ * @license lucide-react v0.474.0 - ISC
273
+ *
274
+ * This source code is licensed under the ISC license.
275
+ * See the LICENSE file in the root directory of this source tree.
276
+ */const bN=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],_N=Me("Star",bN);/**
277
+ * @license lucide-react v0.474.0 - ISC
278
+ *
279
+ * This source code is licensed under the ISC license.
280
+ * See the LICENSE file in the root directory of this source tree.
281
+ */const xN=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Em=Me("TriangleAlert",xN);/**
282
+ * @license lucide-react v0.474.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const kN=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],SN=Me("User",kN);/**
287
+ * @license lucide-react v0.474.0 - ISC
288
+ *
289
+ * This source code is licensed under the ISC license.
290
+ * See the LICENSE file in the root directory of this source tree.
291
+ */const jN=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zs=Me("X",jN),Q_=8,Ye=12,Pt=14,pt=16,Fp={not_started:{color:"var(--text-tertiary)",icon:a.jsx(Ai,{size:Ye}),label:"Not Started"},working:{color:"var(--accent-green)",icon:a.jsx(Ai,{size:Ye,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:a.jsx(rN,{size:Ye}),label:"Paused"},complete:{color:"var(--accent-green)",icon:a.jsx(Mi,{size:Ye}),label:"Complete"},failed:{color:"var(--accent-red)",icon:a.jsx(zs,{size:Ye}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:a.jsx(Wj,{size:Ye}),label:"Blocked"}};function Qa(t){return t==="blocked"?Fp.blocked:Fp[ml(t)]}const TN={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function NN(t){return TN[ml(t)]??"statusPending"}const wN=["working","paused","failed","not_started","blocked","complete"],Cy=["not_started","working","paused","complete","failed"],CN={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function ml(t){return t in Fp&&t!=="blocked"?t:CN[t]??"not_started"}const EN={not_started:"--text-tertiary",working:"--accent-green",paused:"--accent-yellow",complete:"--accent-green",failed:"--accent-red",pending:"--text-tertiary",assigned:"--text-tertiary",in_progress:"--accent-green",review:"--accent-yellow",done:"--accent-green",waiting_input:"--accent-yellow"},AN="_dagContainer_9nmbw_1",DN="_taskNode_9nmbw_26",MN="_taskNodeBorder_9nmbw_54",RN="_taskNodeContent_9nmbw_60",IN="_taskNodeHeader_9nmbw_70",ON="_taskNodeIcon_9nmbw_77",LN="_taskNodeTitle_9nmbw_82",BN="_taskNodeBadges_9nmbw_90",zN="_childBadge_9nmbw_95",$N="_depBadge_9nmbw_107",HN="_handle_9nmbw_119",PN="_emptyCta_9nmbw_126",UN="_ctaDescription_9nmbw_137",VN="_ctaButton_9nmbw_144",xn={dagContainer:AN,taskNode:DN,taskNodeBorder:MN,taskNodeContent:RN,taskNodeHeader:IN,taskNodeIcon:ON,taskNodeTitle:LN,taskNodeBadges:BN,childBadge:zN,depBadge:$N,handle:HN,emptyCta:PN,ctaDescription:UN,ctaButton:VN};function qN({data:t}){const{task:s,childCount:o,doneChildCount:r,hasDependencies:c}=t,d=Qa(s.status);return a.jsxs("div",{className:xn.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[a.jsx(zo,{type:"target",position:$o.Top,isConnectable:!1,className:xn.handle}),a.jsx("div",{className:xn.taskNodeBorder,style:{backgroundColor:d.color}}),a.jsxs("div",{className:xn.taskNodeContent,children:[a.jsxs("div",{className:xn.taskNodeHeader,children:[a.jsx("span",{className:xn.taskNodeIcon,style:{color:d.color},children:d.icon}),a.jsx("span",{className:xn.taskNodeTitle,children:s.title})]}),a.jsxs("div",{className:xn.taskNodeBadges,children:[o>0&&a.jsxs("span",{className:xn.childBadge,children:[r,"/",o]}),c&&a.jsx("span",{className:xn.depBadge,children:"dep"})]})]}),a.jsx(zo,{type:"source",position:$o.Bottom,isConnectable:!1,className:xn.handle})]})}/**
292
+ * react-router v7.13.2
293
+ *
294
+ * Copyright (c) Remix Software Inc.
295
+ *
296
+ * This source code is licensed under the MIT license found in the
297
+ * LICENSE.md file in the root directory of this source tree.
298
+ *
299
+ * @license MIT
300
+ */var Ey="popstate";function Ay(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function GN(t={}){function s(r,c){var h;let d=(h=c.state)==null?void 0:h.masked,{pathname:u,search:f,hash:m}=d||r.location;return Kp("",{pathname:u,search:f,hash:m},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function o(r,c){return typeof c=="string"?c:il(c)}return KN(s,o,null,t)}function Nt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function ls(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function FN(){return Math.random().toString(36).substring(2,10)}function Dy(t,s){return{usr:t.state,key:t.key,idx:s,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Kp(t,s,o=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Fo(s):s,state:o,key:s&&s.key||r||FN(),unstable_mask:c}}function il({pathname:t="/",search:s="",hash:o=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),o&&o!=="#"&&(t+=o.charAt(0)==="#"?o:"#"+o),t}function Fo(t){let s={};if(t){let o=t.indexOf("#");o>=0&&(s.hash=t.substring(o),t=t.substring(0,o));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function KN(t,s,o,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,f="POP",m=null,h=v();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function v(){return(u.state||{idx:null}).idx}function b(){f="POP";let T=v(),N=T==null?null:T-h;h=T,m&&m({action:f,location:j.location,delta:N})}function _(T,N){f="PUSH";let C=Ay(T)?T:Kp(j.location,T,N);h=v()+1;let D=Dy(C,h),A=j.createHref(C.unstable_mask||C);try{u.pushState(D,"",A)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;c.location.assign(A)}d&&m&&m({action:f,location:j.location,delta:1})}function x(T,N){f="REPLACE";let C=Ay(T)?T:Kp(j.location,T,N);h=v();let D=Dy(C,h),A=j.createHref(C.unstable_mask||C);u.replaceState(D,"",A),d&&m&&m({action:f,location:j.location,delta:0})}function S(T){return ZN(T)}let j={get action(){return f},get location(){return t(c,u)},listen(T){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(Ey,b),m=T,()=>{c.removeEventListener(Ey,b),m=null}},createHref(T){return s(c,T)},createURL:S,encodeLocation(T){let N=S(T);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:_,replace:x,go(T){return u.go(T)}};return j}function ZN(t,s=!1){let o="http://localhost";typeof window<"u"&&(o=window.location.origin!=="null"?window.location.origin:window.location.href),Nt(o,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:il(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=o+r),new URL(r,o)}function ex(t,s,o="/"){return YN(t,s,o,!1)}function YN(t,s,o,r){let c=typeof s=="string"?Fo(s):s,d=ma(c.pathname||"/",o);if(d==null)return null;let u=tx(t);JN(u);let f=null;for(let m=0;f==null&&m<u.length;++m){let h=sx(d);f=iw(u[m],h,r)}return f}function tx(t,s=[],o=[],r="",c=!1){let d=(u,f,m=c,h)=>{let v={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;Nt(v.relativePath.startsWith(r),`Absolute route path "${v.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(r.length)}let b=Is([r,v.relativePath]),_=o.concat(v);u.children&&u.children.length>0&&(Nt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),tx(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:sw(b,u.index),routesMeta:_})};return t.forEach((u,f)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,f);else for(let h of nx(u.path))d(u,f,!0,h)}),s}function nx(t){let s=t.split("/");if(s.length===0)return[];let[o,...r]=s,c=o.endsWith("?"),d=o.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=nx(r.join("/")),f=[];return f.push(...u.map(m=>m===""?d:[d,m].join("/"))),c&&f.push(...u),f.map(m=>t.startsWith("/")&&m===""?"/":m)}function JN(t){t.sort((s,o)=>s.score!==o.score?o.score-s.score:aw(s.routesMeta.map(r=>r.childrenIndex),o.routesMeta.map(r=>r.childrenIndex)))}var WN=/^:[\w-]+$/,XN=3,QN=2,ew=1,tw=10,nw=-2,My=t=>t==="*";function sw(t,s){let o=t.split("/"),r=o.length;return o.some(My)&&(r+=nw),s&&(r+=QN),o.filter(c=>!My(c)).reduce((c,d)=>c+(WN.test(d)?XN:d===""?ew:tw),r)}function aw(t,s){return t.length===s.length&&t.slice(0,-1).every((r,c)=>r===s[c])?t[t.length-1]-s[s.length-1]:0}function iw(t,s,o=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let f=0;f<r.length;++f){let m=r[f],h=f===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=ol({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},v),_=m.route;if(!b&&h&&o&&!r[r.length-1].route.index&&(b=ol({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:Is([d,b.pathname]),pathnameBase:dw(Is([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=Is([d,b.pathnameBase]))}return u}function ol(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[o,r]=ow(t.path,t.caseSensitive,t.end),c=s.match(o);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),f=c.slice(1);return{params:r.reduce((h,{paramName:v,isOptional:b},_)=>{if(v==="*"){let S=f[_]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const x=f[_];return b&&!x?h[v]=void 0:h[v]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:d,pathnameBase:u,pattern:t}}function ow(t,s=!1,o=!0){ls(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,f,m,h,v)=>{if(r.push({paramName:f,isOptional:m!=null}),m){let b=v.charAt(h+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function sx(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return ls(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function ma(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let o=s.endsWith("/")?s.length-1:s.length,r=t.charAt(o);return r&&r!=="/"?null:t.slice(o)||"/"}var rw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function lw(t,s="/"){let{pathname:o,search:r="",hash:c=""}=typeof t=="string"?Fo(t):t,d;return o?(o=o.replace(/\/\/+/g,"/"),o.startsWith("/")?d=Ry(o.substring(1),"/"):d=Ry(o,s)):d=s,{pathname:d,search:uw(r),hash:fw(c)}}function Ry(t,s){let o=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?o.length>1&&o.pop():c!=="."&&o.push(c)}),o.length>1?o.join("/"):"/"}function np(t,s,o,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function cw(t){return t.filter((s,o)=>o===0||s.route.path&&s.route.path.length>0)}function Am(t){let s=cw(t);return s.map((o,r)=>r===s.length-1?o.pathname:o.pathnameBase)}function Cd(t,s,o,r=!1){let c;typeof t=="string"?c=Fo(t):(c={...t},Nt(!c.pathname||!c.pathname.includes("?"),np("?","pathname","search",c)),Nt(!c.pathname||!c.pathname.includes("#"),np("#","pathname","hash",c)),Nt(!c.search||!c.search.includes("#"),np("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,f;if(u==null)f=o;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}f=b>=0?s[b]:"/"}let m=lw(c,f),h=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&o.endsWith("/");return!m.pathname.endsWith("/")&&(h||v)&&(m.pathname+="/"),m}var Is=t=>t.join("/").replace(/\/\/+/g,"/"),dw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),uw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,fw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,pw=class{constructor(t,s,o,r=!1){this.status=t,this.statusText=s||"",this.internal=r,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function mw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function hw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var ax=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ix(t,s){let o=t;if(typeof o!="string"||!rw.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let r=o,c=!1;if(ax)try{let d=new URL(window.location.href),u=o.startsWith("//")?new URL(d.protocol+o):new URL(o),f=ma(u.pathname,s);u.origin===d.origin&&f!=null?o=f+u.search+u.hash:c=!0}catch{ls(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ox=["POST","PUT","PATCH","DELETE"];new Set(ox);var gw=["GET",...ox];new Set(gw);var Ko=y.createContext(null);Ko.displayName="DataRouter";var Ed=y.createContext(null);Ed.displayName="DataRouterState";var vw=y.createContext(!1),rx=y.createContext({isTransitioning:!1});rx.displayName="ViewTransition";var yw=y.createContext(new Map);yw.displayName="Fetchers";var bw=y.createContext(null);bw.displayName="Await";var Pn=y.createContext(null);Pn.displayName="Navigation";var hl=y.createContext(null);hl.displayName="Location";var ds=y.createContext({outlet:null,matches:[],isDataRoute:!1});ds.displayName="Route";var Dm=y.createContext(null);Dm.displayName="RouteError";var lx="REACT_ROUTER_ERROR",_w="REDIRECT",xw="ROUTE_ERROR_RESPONSE";function kw(t){if(t.startsWith(`${lx}:${_w}:{`))try{let s=JSON.parse(t.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function Sw(t){if(t.startsWith(`${lx}:${xw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new pw(s.status,s.statusText,s.data)}catch{}}function jw(t,{relative:s}={}){Nt(Ri(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:r}=y.useContext(Pn),{hash:c,pathname:d,search:u}=gl(t,{relative:s}),f=d;return o!=="/"&&(f=d==="/"?o:Is([o,d])),r.createHref({pathname:f,search:u,hash:c})}function Ri(){return y.useContext(hl)!=null}function Wt(){return Nt(Ri(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(hl).location}function sn(t){Nt(Ri(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Wt();return y.useMemo(()=>ol(t,sx(s)),[s,t])}var cx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function dx(t){y.useContext(Pn).static||y.useLayoutEffect(t)}function Ad(){let{isDataRoute:t}=y.useContext(ds);return t?$w():Tw()}function Tw(){Nt(Ri(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Ko),{basename:s,navigator:o}=y.useContext(Pn),{matches:r}=y.useContext(ds),{pathname:c}=Wt(),d=JSON.stringify(Am(r)),u=y.useRef(!1);return dx(()=>{u.current=!0}),y.useCallback((m,h={})=>{if(ls(u.current,cx),!u.current)return;if(typeof m=="number"){o.go(m);return}let v=Cd(m,JSON.parse(d),c,h.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:Is([s,v.pathname])),(h.replace?o.replace:o.push)(v,h.state,h)},[s,o,d,c,t])}var Nw=y.createContext(null);function ww(t){let s=y.useContext(ds).outlet;return y.useMemo(()=>s&&y.createElement(Nw.Provider,{value:t},s),[s,t])}function $s(){let{matches:t}=y.useContext(ds),s=t[t.length-1];return s?s.params:{}}function gl(t,{relative:s}={}){let{matches:o}=y.useContext(ds),{pathname:r}=Wt(),c=JSON.stringify(Am(o));return y.useMemo(()=>Cd(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Cw(t,s){return ux(t,s)}function ux(t,s,o){var T;Nt(Ri(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Pn),{matches:c}=y.useContext(ds),d=c[c.length-1],u=d?d.params:{},f=d?d.pathname:"/",m=d?d.pathnameBase:"/",h=d&&d.route;{let N=h&&h.path||"";px(f,!h||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${N}">) 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.
301
+
302
+ Please change the parent <Route path="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let v=Wt(),b;if(s){let N=typeof s=="string"?Fo(s):s;Nt(m==="/"||((T=N.pathname)==null?void 0:T.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${N.pathname}" was given in the \`location\` prop.`),b=N}else b=v;let _=b.pathname||"/",x=_;if(m!=="/"){let N=m.replace(/^\//,"").split("/");x="/"+_.replace(/^\//,"").split("/").slice(N.length).join("/")}let S=ex(t,{pathname:x});ls(h||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),ls(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.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.`);let j=Rw(S&&S.map(N=>Object.assign({},N,{params:Object.assign({},u,N.params),pathname:Is([m,r.encodeLocation?r.encodeLocation(N.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?m:Is([m,r.encodeLocation?r.encodeLocation(N.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),c,o);return s&&j?y.createElement(hl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function Ew(){let t=zw(),s=mw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),o=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=y.createElement(y.Fragment,null,y.createElement("p",null,"💿 Hey developer 👋"),y.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",y.createElement("code",{style:d},"ErrorBoundary")," or"," ",y.createElement("code",{style:d},"errorElement")," prop on your route.")),y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},s),o?y.createElement("pre",{style:c},o):null,u)}var Aw=y.createElement(Ew,null),fx=class extends y.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const o=Sw(t.digest);o&&(t=o)}let s=t!==void 0?y.createElement(ds.Provider,{value:this.props.routeContext},y.createElement(Dm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(Dw,{error:t},s):s}};fx.contextType=vw;var sp=new WeakMap;function Dw({children:t,error:s}){let{basename:o}=y.useContext(Pn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=kw(s.digest);if(r){let c=sp.get(s);if(c)throw c;let d=ix(r.location,o);if(ax&&!sp.get(s))if(d.isExternal||r.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:r.replace}));throw sp.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function Mw({routeContext:t,match:s,children:o}){let r=y.useContext(Ko);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(ds.Provider,{value:t},o)}function Rw(t,s=[],o){let r=o==null?void 0:o.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(s.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let c=t,d=r==null?void 0:r.errors;if(d!=null){let v=c.findIndex(b=>b.route.id&&(d==null?void 0:d[b.route.id])!==void 0);Nt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let u=!1,f=-1;if(o&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(f=v),b.route.id){let{loaderData:_,errors:x}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!x||x[b.route.id]===void 0);if(b.route.lazy||S){o.isStatic&&(u=!0),f>=0?c=c.slice(0,f+1):c=[c[0]];break}}}}let m=o==null?void 0:o.onError,h=r&&m?(v,b)=>{var _,x;m(v,{location:r.location,params:((x=(_=r.matches)==null?void 0:_[0])==null?void 0:x.params)??{},unstable_pattern:hw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let x,S=!1,j=null,T=null;r&&(x=d&&b.route.id?d[b.route.id]:void 0,j=b.route.errorElement||Aw,u&&(f<0&&_===0?(px("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,T=null):f===_&&(S=!0,T=b.route.hydrateFallbackElement||null)));let N=s.concat(c.slice(0,_+1)),C=()=>{let D;return x?D=j:S?D=T:b.route.Component?D=y.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,y.createElement(Mw,{match:b,routeContext:{outlet:v,matches:N,isDataRoute:r!=null},children:D})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(fx,{location:r.location,revalidation:r.revalidation,component:j,error:x,children:C(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:h}):C()},null)}function Mm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Iw(t){let s=y.useContext(Ko);return Nt(s,Mm(t)),s}function Ow(t){let s=y.useContext(Ed);return Nt(s,Mm(t)),s}function Lw(t){let s=y.useContext(ds);return Nt(s,Mm(t)),s}function Rm(t){let s=Lw(t),o=s.matches[s.matches.length-1];return Nt(o.route.id,`${t} can only be used on routes that contain a unique "id"`),o.route.id}function Bw(){return Rm("useRouteId")}function zw(){var r;let t=y.useContext(Dm),s=Ow("useRouteError"),o=Rm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[o]}function $w(){let{router:t}=Iw("useNavigate"),s=Rm("useNavigate"),o=y.useRef(!1);return dx(()=>{o.current=!0}),y.useCallback(async(c,d={})=>{ls(o.current,cx),o.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var Iy={};function px(t,s,o){!s&&!Iy[t]&&(Iy[t]=!0,ls(!1,o))}y.memo(Hw);function Hw({routes:t,future:s,state:o,isStatic:r,onError:c}){return ux(t,void 0,{state:o,isStatic:r,onError:c})}function gn({to:t,replace:s,state:o,relative:r}){Nt(Ri(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Pn);ls(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=y.useContext(ds),{pathname:u}=Wt(),f=Ad(),m=Cd(t,Am(d),u,r==="path"),h=JSON.stringify(m);return y.useEffect(()=>{f(JSON.parse(h),{replace:s,state:o,relative:r})},[f,h,r,s,o]),null}function Ii(t){return ww(t.context)}function we(t){Nt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Pw({basename:t="/",children:s=null,location:o,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){Nt(!Ri(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:f,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[f,c,d,u]);typeof o=="string"&&(o=Fo(o));let{pathname:h="/",search:v="",hash:b="",state:_=null,key:x="default",unstable_mask:S}=o,j=y.useMemo(()=>{let T=ma(h,f);return T==null?null:{location:{pathname:T,search:v,hash:b,state:_,key:x,unstable_mask:S},navigationType:r}},[f,h,v,b,_,x,r,S]);return ls(j!=null,`<Router basename="${f}"> is not able to match the URL "${h}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:y.createElement(Pn.Provider,{value:m},y.createElement(hl.Provider,{children:s,value:j}))}function Uw({children:t,location:s}){return Cw(Zp(t),s)}function Zp(t,s=[]){let o=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){o.push.apply(o,Zp(r.props.children,d));return}Nt(r.type===we,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Nt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=Zp(r.props.children,d)),o.push(u)}),o}var sd="get",ad="application/x-www-form-urlencoded";function Dd(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Vw(t){return Dd(t)&&t.tagName.toLowerCase()==="button"}function qw(t){return Dd(t)&&t.tagName.toLowerCase()==="form"}function Gw(t){return Dd(t)&&t.tagName.toLowerCase()==="input"}function Fw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Kw(t,s){return t.button===0&&(!s||s==="_self")&&!Fw(t)}function Yp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,o)=>{let r=t[o];return s.concat(Array.isArray(r)?r.map(c=>[o,c]):[[o,r]])},[]))}function Zw(t,s){let o=Yp(t);return s&&s.forEach((r,c)=>{o.has(c)||s.getAll(c).forEach(d=>{o.append(c,d)})}),o}var Uc=null;function Yw(){if(Uc===null)try{new FormData(document.createElement("form"),0),Uc=!1}catch{Uc=!0}return Uc}var Jw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ap(t){return t!=null&&!Jw.has(t)?(ls(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ad}"`),null):t}function Ww(t,s){let o,r,c,d,u;if(qw(t)){let f=t.getAttribute("action");r=f?ma(f,s):null,o=t.getAttribute("method")||sd,c=ap(t.getAttribute("enctype"))||ad,d=new FormData(t)}else if(Vw(t)||Gw(t)&&(t.type==="submit"||t.type==="image")){let f=t.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||f.getAttribute("action");if(r=m?ma(m,s):null,o=t.getAttribute("formmethod")||f.getAttribute("method")||sd,c=ap(t.getAttribute("formenctype"))||ap(f.getAttribute("enctype"))||ad,d=new FormData(f,t),!Yw()){let{name:h,type:v,value:b}=t;if(v==="image"){let _=h?`${h}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else h&&d.append(h,b)}}else{if(Dd(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=sd,r=null,c=ad,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:o.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Im(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Xw(t,s,o,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return o?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&ma(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Qw(t,s){if(t.id in s)return s[t.id];try{let o=await import(t.module);return s[t.id]=o,o}catch(o){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function eC(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function tC(t,s,o){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Qw(d,o);return u.links?u.links():[]}return[]}));return iC(r.flat(1).filter(eC).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Oy(t,s,o,r,c,d){let u=(m,h)=>o[h]?m.route.id!==o[h].route.id:!0,f=(m,h)=>{var v;return o[h].pathname!==m.pathname||((v=o[h].route.path)==null?void 0:v.endsWith("*"))&&o[h].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,h)=>u(m,h)||f(m,h)):d==="data"?s.filter((m,h)=>{var b;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let _=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=o[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function nC(t,s,{includeHydrateFallback:o}={}){return sC(t.map(r=>{let c=s.routes[r.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),o&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function sC(t){return[...new Set(t)]}function aC(t){let s={},o=Object.keys(t).sort();for(let r of o)s[r]=t[r];return s}function iC(t,s){let o=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(aC(c));return o.has(d)||(o.add(d),r.push({key:d,link:c})),r},[])}function mx(){let t=y.useContext(Ko);return Im(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function oC(){let t=y.useContext(Ed);return Im(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Om=y.createContext(void 0);Om.displayName="FrameworkContext";function hx(){let t=y.useContext(Om);return Im(t,"You must render this element inside a <HydratedRouter> element"),t}function rC(t,s){let o=y.useContext(Om),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=N=>{N.forEach(C=>{u(C.isIntersecting)})},T=new IntersectionObserver(j,{threshold:.5});return _.current&&T.observe(_.current),()=>{T.disconnect()}}},[t]),y.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let x=()=>{c(!0)},S=()=>{c(!1),u(!1)};return o?t!=="intent"?[d,_,{}]:[d,_,{onFocus:Pr(f,x),onBlur:Pr(m,S),onMouseEnter:Pr(h,x),onMouseLeave:Pr(v,S),onTouchStart:Pr(b,x)}]:[!1,_,{}]}function Pr(t,s){return o=>{t&&t(o),o.defaultPrevented||s(o)}}function lC({page:t,...s}){let{router:o}=mx(),r=y.useMemo(()=>ex(o.routes,t,o.basename),[o.routes,t,o.basename]);return r?y.createElement(dC,{page:t,matches:r,...s}):null}function cC(t){let{manifest:s,routeModules:o}=hx(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return tC(t,s,o).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,o]),r}function dC({page:t,matches:s,...o}){let r=Wt(),{future:c,manifest:d,routeModules:u}=hx(),{basename:f}=mx(),{loaderData:m,matches:h}=oC(),v=y.useMemo(()=>Oy(t,s,h,d,r,"data"),[t,s,h,d,r]),b=y.useMemo(()=>Oy(t,s,h,d,r,"assets"),[t,s,h,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,T=!1;if(s.forEach(C=>{var A;let D=d.routes[C.route.id];!D||!D.hasLoader||(!v.some(E=>E.route.id===C.route.id)&&C.route.id in m&&((A=u[C.route.id])!=null&&A.shouldRevalidate)||D.hasClientLoader?T=!0:j.add(C.route.id))}),j.size===0)return[];let N=Xw(t,f,c.unstable_trailingSlashAwareDataRequests,"data");return T&&j.size>0&&N.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[N.pathname+N.search]},[f,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),x=y.useMemo(()=>nC(b,d),[b,d]),S=cC(b);return y.createElement(y.Fragment,null,_.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...o})),x.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...o})),S.map(({key:j,link:T})=>y.createElement("link",{key:j,nonce:o.nonce,...T,crossOrigin:T.crossOrigin??o.crossOrigin})))}function uC(...t){return s=>{t.forEach(o=>{typeof o=="function"?o(s):o!=null&&(o.current=s)})}}var fC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{fC&&(window.__reactRouterVersion="7.13.2")}catch{}function pC({basename:t,children:s,unstable_useTransitions:o,window:r}){let c=y.useRef();c.current==null&&(c.current=GN({window:r,v5Compat:!0}));let d=c.current,[u,f]=y.useState({action:d.action,location:d.location}),m=y.useCallback(h=>{o===!1?f(h):y.startTransition(()=>f(h))},[o]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(Pw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:o})}var gx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vl=y.forwardRef(function({onClick:s,discover:o="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:f,state:m,target:h,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:x,...S},j){let{basename:T,navigator:N,unstable_useTransitions:C}=y.useContext(Pn),D=typeof v=="string"&&gx.test(v),A=ix(v,T);v=A.to;let E=jw(v,{relative:c}),R=Wt(),L=null;if(f){let ne=Cd(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);T!=="/"&&(ne.pathname=ne.pathname==="/"?T:Is([T,ne.pathname])),L=N.createHref(ne)}let[M,$,Y]=rC(r,S),U=vC(v,{replace:u,unstable_mask:f,state:m,target:h,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:x,unstable_useTransitions:C});function X(ne){s&&s(ne),ne.defaultPrevented||U(ne)}let te=!(A.isExternal||d),G=y.createElement("a",{...S,...Y,href:(te?L:void 0)||A.absoluteURL||E,onClick:te?X:s,ref:uC(j,$),target:h,"data-discover":!D&&o==="render"?"true":void 0});return M&&!D?y.createElement(y.Fragment,null,G,y.createElement(lC,{page:E})):G});vl.displayName="Link";var mC=y.forwardRef(function({"aria-current":s="page",caseSensitive:o=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:f,children:m,...h},v){let b=gl(u,{relative:h.relative}),_=Wt(),x=y.useContext(Ed),{navigator:S,basename:j}=y.useContext(Pn),T=x!=null&&kC(b)&&f===!0,N=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,D=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;o||(C=C.toLowerCase(),D=D?D.toLowerCase():null,N=N.toLowerCase()),D&&j&&(D=ma(D,j)||D);const A=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let E=C===N||!c&&C.startsWith(N)&&C.charAt(A)==="/",R=D!=null&&(D===N||!c&&D.startsWith(N)&&D.charAt(N.length)==="/"),L={isActive:E,isPending:R,isTransitioning:T},M=E?s:void 0,$;typeof r=="function"?$=r(L):$=[r,E?"active":null,R?"pending":null,T?"transitioning":null].filter(Boolean).join(" ");let Y=typeof d=="function"?d(L):d;return y.createElement(vl,{...h,"aria-current":M,className:$,ref:v,style:Y,to:u,viewTransition:f},typeof m=="function"?m(L):m)});mC.displayName="NavLink";var hC=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:o,reloadDocument:r,replace:c,state:d,method:u=sd,action:f,onSubmit:m,relative:h,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...x},S)=>{let{unstable_useTransitions:j}=y.useContext(Pn),T=_C(),N=xC(f,{relative:h}),C=u.toLowerCase()==="get"?"get":"post",D=typeof f=="string"&&gx.test(f),A=E=>{if(m&&m(E),E.defaultPrevented)return;E.preventDefault();let R=E.nativeEvent.submitter,L=(R==null?void 0:R.getAttribute("formmethod"))||u,M=()=>T(R||E.currentTarget,{fetcherKey:s,method:L,navigate:o,replace:c,state:d,relative:h,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});j&&o!==!1?y.startTransition(()=>M()):M()};return y.createElement("form",{ref:S,method:C,action:N,onSubmit:r?m:A,...x,"data-discover":!D&&t==="render"?"true":void 0})});hC.displayName="Form";function gC(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function vx(t){let s=y.useContext(Ko);return Nt(s,gC(t)),s}function vC(t,{target:s,replace:o,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let v=Ad(),b=Wt(),_=gl(t,{relative:u});return y.useCallback(x=>{if(Kw(x,s)){x.preventDefault();let S=o!==void 0?o:il(b)===il(_),j=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:f,unstable_defaultShouldRevalidate:m});h?y.startTransition(()=>j()):j()}},[b,v,_,o,r,c,s,t,d,u,f,m,h])}function Lm(t){ls(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let s=y.useRef(Yp(t)),o=y.useRef(!1),r=Wt(),c=y.useMemo(()=>Zw(r.search,o.current?null:s.current),[r.search]),d=Ad(),u=y.useCallback((f,m)=>{const h=Yp(typeof f=="function"?f(new URLSearchParams(c)):f);o.current=!0,d("?"+h,m)},[d,c]);return[c,u]}var yC=0,bC=()=>`__${String(++yC)}__`;function _C(){let{router:t}=vx("useSubmit"),{basename:s}=y.useContext(Pn),o=Bw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:f,method:m,encType:h,formData:v,body:b}=Ww(d,s);if(u.navigate===!1){let _=u.fetcherKey||bC();await r(_,o,u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||h,flushSync:u.flushSync})}else await c(u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:o,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,o])}function xC(t,{relative:s}={}){let{basename:o}=y.useContext(Pn),r=y.useContext(ds);Nt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...gl(t||".",{relative:s})},u=Wt();if(t==null){d.search=u.search;let f=new URLSearchParams(d.search),m=f.getAll("index");if(m.some(v=>v==="")){f.delete("index"),m.filter(b=>b).forEach(b=>f.append("index",b));let v=f.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(d.pathname=d.pathname==="/"?o:Is([o,d.pathname])),il(d)}function kC(t,{relative:s}={}){let o=y.useContext(rx);Nt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=vx("useViewTransitionState"),c=gl(t,{relative:s});if(!o.isTransitioning)return!1;let d=ma(o.currentLocation.pathname,r)||o.currentLocation.pathname,u=ma(o.nextLocation.pathname,r)||o.nextLocation.pathname;return ol(c.pathname,u)!=null||ol(c.pathname,d)!=null}function kt(){const t=Ad();return y.useCallback((s,o)=>{typeof s=="number"?t(s):t(s,o)},[t])}function yl(t){return`/sessions/${encodeURIComponent(t)}`}function Di(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function cs(t,s,o,r){const c=encodeURIComponent(t);let d;return o&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(o)}/tasks/${c}`:o?d=`/workspaces/${encodeURIComponent(o)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Oi(t,s,o){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&o){const d=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function yx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const Ho="/environments",SC="/environments/new";function Po(t){return`/environments/${encodeURIComponent(t)}`}function jC(t){return`/environments/${encodeURIComponent(t)}/edit`}const Bo="/settings",TC="/settings/credentials",rl="/personas",NC="/personas/new";function Bm(t){return`/personas/${encodeURIComponent(t)}`}const ip="/settings/schedules",wC="/settings/schedules/new";function bx(t){return`/settings/schedules/${encodeURIComponent(t)}`}const CC="/settings/shortcuts",EC="/pair",AC="/chat",_x="/coordination",xx="/sessions",Zo="/",DC="/tasks",kx="/workspaces/new",Sx="/knowledge",MC=EN,RC={task:qN};function IC({workspaceId:t,environmentId:s,tasks:o,resolvedThemeId:r}){const c=kt(),d=y.useMemo(()=>o.filter(b=>b.workspaceId===t),[o,t]),{nodes:u,edges:f}=Uj(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[x,S]of Object.entries(MC))_[x]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),h=y.useCallback((b,_)=>{c(cs(_.id,void 0,t,s))},[c,t,s]),v=y.useCallback(b=>{const _=b.data;return m[_.task.status]||m.pending},[m]);return d.length===0?a.jsxs("div",{className:xn.emptyCta,children:[a.jsx("button",{className:xn.ctaButton,onClick:()=>c(Oi(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:xn.ctaDescription,children:"Create tasks to see the dependency graph"})]}):a.jsx("div",{className:xn.dagContainer,children:a.jsxs(U_,{nodes:u,edges:f,nodeTypes:RC,onNodeClick:h,nodesConnectable:!1,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(V_,{variant:q_.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(G_,{showInteractive:!1}),a.jsx(F_,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const OC="_breadcrumbs_17or2_1",LC="_list_17or2_11",BC="_item_17or2_21",zC="_separator_17or2_28",$C="_link_17or2_34",HC="_current_17or2_57",wo={breadcrumbs:OC,list:LC,item:BC,separator:zC,link:$C,current:HC};function Hs({segments:t}){return a.jsx("nav",{className:wo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:a.jsx("ol",{className:wo.list,children:t.map((s,o)=>{const r=o===t.length-1;return a.jsxs("li",{className:wo.item,children:[o>0&&a.jsx("span",{className:wo.separator,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),s.url&&!r?a.jsx(vl,{className:wo.link,to:s.url,title:s.label,children:s.label}):a.jsx("span",{className:wo.current,"aria-current":"page",title:s.label,children:s.label})]},o)})})})}const PC="_btn_dwk2o_1",UC="_sm_dwk2o_22",VC="_md_dwk2o_28",qC="_lg_dwk2o_34",GC="_primary_dwk2o_40",FC="_danger_dwk2o_55",KC="_outline_dwk2o_70",ZC="_ghost_dwk2o_80",op={btn:PC,sm:UC,md:VC,lg:qC,primary:GC,danger:FC,outline:KC,ghost:ZC},an=y.forwardRef(function({variant:s="primary",size:o="md",className:r,children:c,...d},u){const f=[op.btn,op[s],op[o],r].filter(Boolean).join(" ");return a.jsx("button",{ref:u,className:f,...d,children:c})}),YC="_copyButton_1bqk0_1",JC={copyButton:YC},WC=2e3;function XC({text:t,className:s,"data-testid":o}){const[r,c]=y.useState(!1),d=y.useRef(void 0);y.useEffect(()=>()=>{d.current!==void 0&&clearTimeout(d.current)},[]);const u=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),d.current!==void 0&&clearTimeout(d.current),d.current=setTimeout(()=>{c(!1),d.current=void 0},WC)}catch{}},[t]);return a.jsx("button",{type:"button",className:`${JC.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":o??"copy-button",children:r?a.jsx(Mi,{size:Pt,"aria-hidden":"true"}):a.jsx(X_,{size:Pt,"aria-hidden":"true"})})}const QC="_banner_bxqlh_1",eE="_label_bxqlh_15",tE="_text_bxqlh_25",nE="_link_bxqlh_29",Vc={banner:QC,label:eE,text:tE,link:nE};function sE(){return a.jsxs("div",{className:Vc.banner,"data-testid":"demo-banner",children:[a.jsx("span",{className:Vc.label,children:"DEMO"}),a.jsxs("span",{className:Vc.text,children:["This is an interactive demo with mock data."," ",a.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:Vc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const aE="_container_og0yp_1",iE="_chevronButton_og0yp_6",oE="_mainButton_og0yp_6",rE="_sm_og0yp_34",lE="_md_og0yp_34",cE="_lg_og0yp_34",dE="_primary_og0yp_57",uE="_danger_og0yp_70",fE="_outline_og0yp_83",pE="_ghost_og0yp_92",mE="_dropdown_og0yp_100",hE="_option_og0yp_113",gE="_optionLabel_og0yp_130",vE="_optionDesc_og0yp_135",ra={container:aE,chevronButton:iE,mainButton:oE,sm:rE,md:lE,lg:cE,primary:dE,danger:uE,outline:fE,ghost:pE,dropdown:mE,option:hE,optionLabel:gE,optionDesc:vE};function jx({label:t,onClick:s,options:o,variant:r="primary",size:c="md","data-testid":d}){const[u,f]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function _(x){m.current&&x.target instanceof Node&&!m.current.contains(x.target)&&f(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(x){x.key==="Escape"&&f(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const h=ra[r]||"",v=ra[c]||"",b=()=>{u&&f(!1),s()};return a.jsxs("div",{ref:m,className:ra.container,"data-testid":d,children:[a.jsx("button",{type:"button",className:`${ra.mainButton} ${h} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),a.jsx("button",{type:"button",className:`${ra.chevronButton} ${h} ${v}`,onClick:()=>f(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:a.jsx(W_,{size:Pt,"aria-hidden":"true"})}),u&&a.jsx("div",{className:ra.dropdown,"data-testid":d?`${d}-menu`:void 0,children:o.map((_,x)=>a.jsxs("button",{type:"button",className:ra.option,onClick:()=>{_.onClick(),f(!1)},children:[a.jsx("span",{className:ra.optionLabel,children:_.label}),_.description&&a.jsx("span",{className:ra.optionDesc,children:_.description})]},x))})]})}function Jp(){Jp=function(c,d){return new o(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function o(c,d,u){var f=new RegExp(c,d);return s.set(f,u||s.get(c)),pd(f,o.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(f,m){var h=u[m];if(typeof h=="number")f[m]=c[h];else{for(var v=0;c[h[v]]===void 0&&v+1<h.length;)v++;f[m]=c[h[v]]}return f},Object.create(null))}return(function(c,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),d&&pd(c,d)})(o,RegExp),o.prototype.exec=function(c){var d=t.exec.call(this,c);if(d){d.groups=r(d,this);var u=d.indices;u&&(u.groups=r(u,this))}return d},o.prototype[Symbol.replace]=function(c,d){if(typeof d=="string"){var u=s.get(this);return t[Symbol.replace].call(this,c,d.replace(/\$<([^>]+)>/g,function(m,h){var v=u[h];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var f=this;return t[Symbol.replace].call(this,c,function(){var m=arguments;return typeof m[m.length-1]!="object"&&(m=[].slice.call(m)).push(r(m,f)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},Jp.apply(this,arguments)}function pd(t,s){return pd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(o,r){return o.__proto__=r,o},pd(t,s)}function Ly(t,s){(s==null||s>t.length)&&(s=t.length);for(var o=0,r=new Array(s);o<s;o++)r[o]=t[o];return r}function rp(t,s){var o=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(o)return(o=o.call(t)).next.bind(o);if(Array.isArray(t)||(o=(function(c,d){if(c){if(typeof c=="string")return Ly(c,d);var u=Object.prototype.toString.call(c).slice(8,-1);return u==="Object"&&c.constructor&&(u=c.constructor.name),u==="Map"||u==="Set"?Array.from(c):u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u)?Ly(c,d):void 0}})(t))||s){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
303
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var yE=(function(t){return function(s){return s===void 0&&(s={}),(function(r,c){if(c&&!r.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(t,s.defaultLanguage),function(r){gj(r,"element",o)};function o(r,c,d){var u,f;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(f=r.properties)==null?void 0:f.metastring)||"";r.properties.className?typeof r.properties.className=="boolean"?r.properties.className=[]:Array.isArray(r.properties.className)||(r.properties.className=[r.properties.className]):r.properties.className=[];var h,v,b=(function(E){for(var R,L=rp(E.properties.className);!(R=L()).done;){var M=R.value;if(M.slice(0,9)==="language-")return M.slice(9).toLowerCase()}return null})(r);if(!b&&s.defaultLanguage&&r.properties.className.push("language-"+(b=s.defaultLanguage)),r.properties.className.push("code-highlight"),b)try{var _,x;x=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,h=t.highlight($c(r),x),d.properties.className=(d.properties.className||[]).concat("language-"+x)}catch(E){if(!s.ignoreMissing||!/Unknown language/.test(E.message))throw E;h=r}else h=r;h.children=(v=1,function E(R){return R.reduce(function(L,M){if(M.type==="text"){var $=M.value,Y=($.match(/\n/g)||"").length;if(Y===0)M.position={start:{line:v,column:1},end:{line:v,column:1}},L.push(M);else for(var U,X=$.split(`
304
+ `),te=rp(X.entries());!(U=te()).done;){var G=U.value,ne=G[0],H=G[1];L.push({type:"text",value:ne===X.length-1?H:H+`
305
+ `,position:{start:{line:v+ne,column:1},end:{line:v+ne,column:1}}})}return v+=Y,L}if(Object.prototype.hasOwnProperty.call(M,"children")){var O=v;return M.children=E(M.children),L.push(M),M.position={start:{line:O,column:1},end:{line:v,column:1}},L}return L.push(M),L},[])})(h.children),h.position=h.children.length>0?{start:{line:h.children[0].position.start.line,column:0},end:{line:h.children[h.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var S,j=(function(E){var R=/{([\d,-]+)}/,L=E.split(",").map(function(Y){return Y.trim()}).join();if(R.test(L)){var M=R.exec(L)[1],$=yj(M);return function(Y){return $.includes(Y+1)}}return function(){return!1}})(m),T=(function(E){var R=Jp(/showLineNumbers=(\d+)/i,{lines:1});if(R.test(E)){var L=R.exec(E);return Number(L.groups.lines)}return 1})(m),N=(function(E){for(var R=new Array(E),L=0;L<E;L++)R[L]={type:"element",tagName:"span",properties:{className:[]},children:[]};return R})(h.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],D=function(){var E,R,L=S.value,M=L[0],$=L[1];$.properties.className=["code-line"];var Y=bj(h,function(U){return U.position.start.line<=M+1&&U.position.end.line>=M+1});$.children=Y.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(U){return m.toLowerCase().includes(U)})&&($.properties.line=[(M+T).toString()],$.properties.className.push("line-number")),j(M)&&$.properties.className.push("highlight-line"),(b==="diff"||(E=b)!=null&&E.includes("diff-"))&&$c($).substring(0,1)==="-"?$.properties.className.push("deleted"):(b==="diff"||(R=b)!=null&&R.includes("diff-"))&&$c($).substring(0,1)==="+"&&$.properties.className.push("inserted")},A=rp(N.entries());!(S=A()).done;)D();N.length>0&&$c(N[N.length-1]).trim()===""&&N.pop(),r.children=N}}}})(vj);function Uo(t){if(t>=1e6)return`${(t/1e6).toFixed(1)}M`;if(t>=1e3){const s=Number((t/1e3).toFixed(1));return s>=1e3?`${(t/1e6).toFixed(1)}M`:`${s.toFixed(1)}k`}return String(t)}function Rs(t){if(t===0)return"-";const s=t/1e5;if(s<.01){const o=t<5?5:4;return`$${s.toFixed(o)}`}return`$${s.toFixed(2)}`}const By=new Set(["grackle"]);function bl(t){if(!t)return"";if(t.startsWith("mcp__")){const o=t.indexOf("__",5);if(o>5){const r=t.slice(5,o);if(By.has(r))return t.slice(o+2)}}const s=t.indexOf("-");if(s>0){const o=t.slice(0,s);if(By.has(o))return t.slice(s+1)}return t}const bE={read:"file-read",view:"file-read",edit:"file-edit",file_change:"file-edit",write:"file-write",bash:"shell",powershell:"shell",command_execution:"shell",grep:"search",glob:"search",todowrite:"todo",update_plan:"todo",todo_write:"todo",report_intent:"metadata",task_list:"task",task_create:"task",task_show:"task",task_update:"task",task_start:"task",task_complete:"task",task_resume:"task",task_delete:"task",workpad_write:"workpad",workpad_read:"workpad",knowledge_search:"knowledge",knowledge_get_node:"knowledge",knowledge_create_node:"knowledge",ipc_spawn:"ipc",ipc_write:"ipc",ipc_close:"ipc",ipc_list_fds:"ipc",ipc_terminate:"ipc",ipc_create_stream:"ipc",ipc_attach:"ipc",ipc_share_stream:"ipc",ipc_list_streams:"ipc",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function _E(t){const s=bl(t);return bE[s.toLowerCase()]??"generic"}const xE="_card_qkm9i_2",kE="_cardBlue_qkm9i_20",SE="_cardOrange_qkm9i_24",jE="_cardGreen_qkm9i_28",TE="_cardPurple_qkm9i_32",NE="_cardNeutral_qkm9i_36",wE="_cardRed_qkm9i_40",CE="_cardTeal_qkm9i_44",EE="_header_qkm9i_48",AE="_icon_qkm9i_55",DE="_toolName_qkm9i_64",ME="_fileName_qkm9i_71",RE="_badge_qkm9i_80",IE="_spacer_qkm9i_87",OE="_bodyToggle_qkm9i_91",LE="_chevron_qkm9i_109",BE="_chevronExpanded_qkm9i_115",zE="_pre_qkm9i_119",$E="_diffAdd_qkm9i_143",HE="_diffRemove_qkm9i_155",PE="_diffContext_qkm9i_167",UE="_diffHeader_qkm9i_176",VE="_diffLine_qkm9i_182",qE="_exitOk_qkm9i_188",GE="_exitError_qkm9i_194",FE="_exitPending_qkm9i_200",KE="_inProgress_qkm9i_228",ZE="_metadata_qkm9i_232",YE="_metadataPrefix_qkm9i_239",B={card:xE,cardBlue:kE,cardOrange:SE,cardGreen:jE,cardPurple:TE,cardNeutral:NE,cardRed:wE,cardTeal:CE,header:EE,icon:AE,toolName:DE,fileName:ME,badge:RE,spacer:IE,bodyToggle:OE,chevron:LE,chevronExpanded:BE,pre:zE,diffAdd:$E,diffRemove:HE,diffContext:PE,diffHeader:UE,diffLine:VE,exitOk:qE,exitError:GE,exitPending:FE,inProgress:KE,metadata:ZE,metadataPrefix:YE};function JE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"?s.file_path:typeof s.path=="string"?s.path:""}function WE(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const lp=5;function zy({tool:t,args:s,result:o,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),f=JE(s),m=WE(f),h=o===void 0,v=r?B.cardRed:c?B.cardGreen:B.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?a.jsx(yT,{size:Pt}):a.jsx(_T,{size:Pt}),x=c?"tool-card-file-write":"tool-card-file-read",S=(o==null?void 0:o.split(`
306
+ `))??[],j=S.length>lp,T=d?S:S.slice(0,lp);return a.jsxs("div",{className:`${B.card} ${v} ${h?B.inProgress:""}`,"data-testid":x,children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,children:_}),a.jsx("span",{className:B.toolName,style:{color:b},children:t}),m&&a.jsx("span",{className:B.fileName,title:f,children:m}),!h&&S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,children:[S.length," lines"]})]})]}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&!h&&S.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-content",children:T.map((N,C)=>a.jsxs("span",{className:B.diffLine,children:[a.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),N]},C))}),j&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${d?B.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),d?"collapse":`${S.length-lp} more lines`]})]})]})}function XE(t){const s=t.split(`
307
+ `),o=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?o.push({type:"header",content:r}):r.startsWith("+")?o.push({type:"add",content:r.slice(1)}):r.startsWith("-")?o.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?o.push({type:"context",content:r.slice(1)}):r===""&&o.push({type:"context",content:""}));return o}function QE(t,s){const o=t.split(`
308
+ `),r=s.split(`
309
+ `),c=[];for(const d of o)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function eA(t){let s=0,o=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&o++;return{added:s,removed:o}}function tA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.file_path=="string"&&s.file_path||typeof s.path=="string"&&s.path||""}function nA(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,o=(typeof s.old_string=="string"?s.old_string:void 0)??(typeof s.old_str=="string"?s.old_str:void 0),r=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(o!==void 0&&r!==void 0)return{oldStr:o,newStr:r}}function sA(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function aA(t,s){if(s){let r=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(r=c.detailedContent)}catch{}if(r.includes("@@")||r.startsWith("diff ")){const c=XE(r);if(c.length>0)return c}}const o=nA(t);if(o)return QE(o.oldStr,o.newStr)}const cp=5;function iA({tool:t,args:s,result:o,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),f=tA(s),m=sA(f),h=o===void 0,v=aA(s,c),b=v?eA(v):null,_=((v==null?void 0:v.length)??0)>cp,x=d?v:v==null?void 0:v.slice(0,cp);return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardOrange} ${h?B.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,children:a.jsx(cN,{size:Pt})}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&a.jsx("span",{className:B.fileName,title:f,children:m}),b&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-diff-stats",children:[a.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",a.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&x&&x.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-diff",children:x.map((S,j)=>{let T=B.diffContext;return S.type==="add"&&(T=B.diffAdd),S.type==="remove"&&(T=B.diffRemove),S.type==="header"&&(T=B.diffHeader),a.jsx("span",{className:`${B.diffLine} ${T}`,children:S.content},j)})}),_&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${d?B.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),d?"collapse":`${((v==null?void 0:v.length)??0)-cp} more lines`]})]}),!r&&!v&&!h&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-content",children:o})]})}const oA=/^\[exit (\d+)\]\s*/;function rA(t){const s=oA.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function lA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function cA(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const o=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return o?o[1]:t}const dp=3;function dA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=lA(s),f=cA(u),m=o===void 0,h=o?rA(o):null,v=(h==null?void 0:h.output.split(`
310
+ `))??[],b=v.length>dp,_=c?v:v.slice(0,dp),x=h==null?void 0:h.exitCode,S=r||x!==void 0&&x!==0;return a.jsxs("div",{className:`${B.card} ${S?B.cardRed:B.cardNeutral}`,"data-testid":"tool-card-shell",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),a.jsx("span",{className:B.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==f?u:void 0,"data-testid":"tool-card-command",children:f}),x!==void 0&&a.jsxs("span",{className:x===0?B.exitOk:B.exitError,"data-testid":"tool-card-exit-code",children:[x===0?a.jsx(Mi,{size:Ye,"aria-hidden":"true"}):a.jsx(zs,{size:Ye,"aria-hidden":"true"})," ","exit ",x]}),m&&a.jsx("span",{className:B.exitPending,"data-testid":"tool-card-pending",children:a.jsx(PT,{size:Ye,"aria-hidden":"true"})})]}),!m&&h&&h.output.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-output",children:_.join(`
311
+ `)}),b&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),c?"collapse":`${v.length-dp} more lines`]})]})]})}function uA(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,o=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:o,path:r}}const up=5;function fA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:f}=uA(s),m=o===void 0,h=(o==null?void 0:o.split(`
312
+ `).filter(_=>_.length>0))??[],v=h.length>up,b=c?h:h.slice(0,up);return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardPurple} ${m?B.inProgress:""}`,"data-testid":"tool-card-search",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,children:a.jsx(Gp,{size:Pt})}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&a.jsxs("span",{className:B.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),f&&a.jsxs("span",{className:B.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",f]}),!m&&!r&&h.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-match-count",children:[h.length," ",h.length===1?"match":"matches"]})]})]}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&b.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-results",children:b.join(`
313
+ `)}),v&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),c?"collapse":`${h.length-up} more matches`]})]})]})}const pA="_progressBar_14f5c_1",mA="_progressFill_14f5c_9",hA="_activeTask_14f5c_16",gA="_activeIcon_14f5c_27",vA="_todoPulse_14f5c_1",yA="_activeText_14f5c_34",bA="_checklist_14f5c_48",_A="_item_14f5c_55",xA="_itemIcon_14f5c_65",kA="_itemText_14f5c_73",SA="_pending_14f5c_78",jA="_in_progress_14f5c_85",TA="_completed_14f5c_97",NA="_emptyMessage_14f5c_108",hs={progressBar:pA,progressFill:mA,activeTask:hA,activeIcon:gA,todoPulse:vA,activeText:yA,checklist:bA,item:_A,itemIcon:xA,itemText:kA,pending:SA,in_progress:jA,completed:TA,emptyMessage:NA},wA=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function CA(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(o=>typeof o=="object"&&o!==null&&typeof o.content=="string"&&typeof o.status=="string").map(o=>({content:o.content,activeForm:typeof o.activeForm=="string"?o.activeForm:void 0,status:$y(o.status)})):Array.isArray(s.plan)?s.plan.filter(o=>typeof o=="object"&&o!==null&&typeof o.step=="string"&&typeof o.status=="string").map(o=>({content:o.step,status:$y(o.status)})):typeof s.content=="string"?EA(s.content):[]}function $y(t){switch(t.toLowerCase()){case"completed":case"done":case"complete":return"completed";case"in_progress":case"in-progress":case"working":case"active":return"in_progress";default:return"pending"}}function EA(t){const s=t.split(`
314
+ `),o=[];for(const r of s){const c=wA.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let f="pending";d==="x"||d==="X"?f="completed":(d==="~"||d==="/"||d==="!")&&(f="in_progress"),o.push({content:u,status:f})}}return o}function AA(t){switch(t){case"completed":return a.jsx(Mi,{size:Ye});case"in_progress":return a.jsx(Ai,{size:Ye,fill:"currentColor"});default:return a.jsx(Ai,{size:Ye})}}function DA({args:t}){const s=CA(t),o=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return a.jsxs("div",{className:`${B.card} ${B.cardBlue}`,"data-testid":"tool-card-todo",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,children:a.jsx(BT,{size:Pt})}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-todo-progress",children:[o,"/",s.length]})]})]}),!c&&a.jsx("div",{className:hs.progressBar,"data-testid":"tool-card-todo-bar",children:a.jsx("div",{className:hs.progressFill,style:{width:`${o/s.length*100}%`}})}),r&&a.jsxs("div",{className:hs.activeTask,"data-testid":"tool-card-todo-active",children:[a.jsx("span",{className:hs.activeIcon,children:a.jsx(Ai,{size:Ye,fill:"currentColor"})}),a.jsx("span",{className:hs.activeText,children:r.activeForm||r.content})]}),!c&&a.jsx("div",{className:hs.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>a.jsxs("div",{className:`${hs.item} ${hs[d.status]}`,"data-testid":"tool-card-todo-item",children:[a.jsx("span",{className:hs.itemIcon,children:AA(d.status)}),a.jsx("span",{className:hs.itemText,children:d.content})]},u))}),c&&a.jsx("div",{className:hs.emptyMessage,children:"All items completed and cleared."})]})}function MA(t,s){if(s==null||typeof s!="object")return"";const o=s;if(typeof o.intent=="string")return o.intent;for(const r of Object.values(o))if(typeof r=="string")return r;return t}function RA({tool:t,args:s}){const o=MA(t,s);return a.jsxs("div",{className:B.metadata,"data-testid":"tool-card-metadata",children:[a.jsx("span",{className:B.metadataPrefix,children:a.jsx(gT,{size:Ye})}),o]})}function IA(t){if(t==null||typeof t!="object")return{};const s=t;return{taskId:typeof s.taskId=="string"?s.taskId:void 0,title:typeof s.title=="string"?s.title:void 0,status:typeof s.status=="string"?s.status:void 0}}function OA(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(o=>o!==null&&typeof o=="object")};if(typeof s=="object"&&s!==null){const o=s;return typeof o.sessionId=="string"?{sessionId:o.sessionId,single:o}:{single:o}}}catch{}return{}}function Hy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function LA(t){switch(t){case"complete":case"completed":return"var(--accent-green, #4ade80)";case"working":case"in_progress":return"var(--accent-blue, #60a5fa)";case"failed":return"var(--accent-red, #f87171)";case"paused":return"var(--text-tertiary, #888)";default:return"var(--text-secondary, #aaa)"}}const fp=5;function BA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=bl(t),f=IA(s),m=o===void 0,{single:h,list:v,sessionId:b}=OA(o),_=(h==null?void 0:h.title)??f.title,x=(h==null?void 0:h.status)??f.status;return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardBlue} ${m?B.inProgress:""}`,"data-testid":"tool-card-task",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,"aria-hidden":"true",children:"📋"}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&a.jsxs("span",{className:B.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&f.taskId&&a.jsx("span",{className:B.fileName,"data-testid":"tool-card-task-id",children:f.taskId}),x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,style:{color:LA(x)},"data-testid":"tool-card-task-status",children:[Hy(x)," ",x]})]}),v&&!x&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!f.taskId&&s!==null&&s!==void 0&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&b&&a.jsxs("div",{className:B.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&h&&!v&&!b&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-task-detail",children:[h.id?`id: ${h.id}`:null,h.status?`status: ${h.status}`:null,h.branch?`branch: ${h.branch}`:null,h.latestSessionId?`session: ${h.latestSessionId}`:null].filter(Boolean).join(`
315
+ `)}),!r&&v&&v.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,fp)).map(S=>{const j=Hy(S.status),T=S.title??S.id??"untitled";return`${j} ${T}`}).join(`
316
+ `)}),v.length>fp&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-fp} more tasks`]})]})]})}function zA(t){if(t==null||typeof t!="object")return{};const s=t;return{status:typeof s.status=="string"?s.status:void 0,summary:typeof s.summary=="string"?s.summary:void 0}}function $A(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s,r=typeof o.workpad=="object"&&o.workpad!==null?o.workpad:o;return{status:typeof r.status=="string"?r.status:void 0,summary:typeof r.summary=="string"?r.summary:void 0,extra:typeof r.extra=="object"&&r.extra!==null?r.extra:void 0}}catch{}return{}}function HA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=bl(t),f=zA(s),m=o===void 0,h=$A(o),v=h.status??f.status,b=h.summary??f.summary;return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardGreen} ${m?B.inProgress:""}`,"data-testid":"tool-card-workpad",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,"aria-hidden":"true",children:"📓"}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsx("span",{className:B.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&a.jsx("pre",{className:B.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&!b&&!v&&!h.extra&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-result",children:o}),!r&&h.extra&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(h.extra,null,2)})]})]})}function PA(t){if(t==null||typeof t!="object")return{};const s=t;return{query:typeof s.query=="string"?s.query:void 0,id:typeof s.id=="string"?s.id:void 0}}function UA(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;if(Array.isArray(o.results))return{results:o.results.filter(r=>r!==null&&typeof r=="object")};if(typeof o.node=="object"&&o.node!==null){const r=Array.isArray(o.edges)?o.edges.length:0;return{node:o.node,edgeCount:r}}if(typeof o.id=="string")return{node:o}}catch{}return{}}const pp=5;function VA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=bl(t),f=PA(s),m=o===void 0,h=UA(o);return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardPurple} ${m?B.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,"aria-hidden":"true",children:"🧠"}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),f.query&&a.jsxs("span",{className:B.fileName,"data-testid":"tool-card-knowledge-query",children:['"',f.query,'"']}),f.id&&!f.query&&a.jsx("span",{className:B.fileName,"data-testid":"tool-card-knowledge-id",children:f.id}),h.results&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-knowledge-count",children:[h.results.length," ",h.results.length===1?"result":"results"]})]}),h.node&&h.edgeCount!==void 0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-knowledge-edges",children:[h.edgeCount," ",h.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!f.query&&!f.id&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&h.results&&h.results.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-knowledge-results",children:(c?h.results:h.results.slice(0,pp)).map(v=>{var x,S,j;const b=((x=v.node)==null?void 0:x.title)??((S=v.node)==null?void 0:S.label)??((j=v.node)==null?void 0:j.id)??"node",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${b}${_}`}).join(`
317
+ `)}),h.results.length>pp&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${h.results.length-pp} more results`]})]}),!r&&h.node&&!h.results&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-knowledge-node",children:[h.node.id?`id: ${h.node.id}`:null,h.node.title?`title: ${h.node.title}`:null,h.node.category?`category: ${h.node.category}`:null,h.node.kind?`kind: ${h.node.kind}`:null,h.node.content?`content: ${h.node.content.length>100?h.node.content.slice(0,100)+"...":h.node.content}`:null].filter(Boolean).join(`
318
+ `)})]})}function qA(t){if(t==null||typeof t!="object")return{};const s=t;return{fd:typeof s.fd=="number"?s.fd:void 0,pipe:typeof s.pipe=="string"?s.pipe:void 0,prompt:typeof s.prompt=="string"?s.prompt:void 0,name:typeof s.name=="string"?s.name:void 0,message:typeof s.message=="string"?s.message:void 0}}function GA(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const o=s;return{sessionId:typeof o.sessionId=="string"?o.sessionId:void 0,fd:typeof o.fd=="number"?o.fd:void 0,fds:Array.isArray(o.fds)?o.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof o.success=="boolean"?o.success:void 0,output:typeof o.output=="string"?o.output:void 0}}catch{}return{}}function FA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),u=bl(t),f=qA(s),m=o===void 0,h=GA(o);let v="";f.pipe?v=`[${f.pipe}]`:f.fd!==void 0?v=`fd:${f.fd}`:f.name&&(v=`"${f.name}"`);const b=f.prompt?f.prompt.length>60?`${f.prompt.slice(0,60)}...`:f.prompt:void 0;return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardOrange} ${m?B.inProgress:""}`,"data-testid":"tool-card-ipc",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,"aria-hidden":"true",children:"🔀"}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&a.jsx("span",{className:B.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&a.jsx("span",{className:B.fileName,title:f.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),h.fds&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-ipc-fd-count",children:[h.fds.length," ",h.fds.length===1?"fd":"fds"]})]}),h.success!==void 0&&!h.fds&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsx("span",{className:B.badge,style:{color:h.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:h.success?"✓ ok":"✗ failed"})]})]}),m&&!b&&!v&&s!==null&&s!==void 0&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&h.sessionId&&a.jsxs("div",{className:B.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",h.sessionId,h.fd!==void 0&&` | fd: ${h.fd}`]}),!r&&h.output&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-ipc-output",children:h.output}),!r&&h.fds&&h.fds.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-ipc-fds",children:(c?h.fds:h.fds.slice(0,5)).map(_=>{const x=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&x.push(_.streamName),_.owned&&x.push("(owned)"),x.filter(Boolean).join(" ")}).join(`
319
+ `)}),h.fds.length>5&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${h.fds.length-5} more fds`]})]})]})}function KA(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const mp=8;function ZA({args:t,result:s,isError:o}){const[r,c]=y.useState(!1),d=KA(t),u=s===void 0,f=(s==null?void 0:s.split(`
320
+ `))??[],m=f.length>mp,h=r?s:f.slice(0,mp).join(`
321
+ `);return a.jsxs("div",{className:`${B.card} ${o?B.cardRed:B.cardNeutral} ${u?B.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,"aria-hidden":"true",children:"🔧"}),a.jsx("span",{className:B.toolName,children:"ToolSearch"}),d&&a.jsxs("span",{className:B.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!o&&s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:B.spacer}),a.jsxs("span",{className:B.badge,"data-testid":"tool-card-tool-search-count",children:[f.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),o&&s&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:s}),!o&&!u&&s&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-tool-search-result",children:h}),m&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${r?B.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${f.length-mp} more lines`]})]})]})}function YA(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function JA(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;if(typeof s.command=="string")return s.command;if(typeof s.file_path=="string")return s.file_path;if(typeof s.path=="string")return s.path;if(typeof s.query=="string")return s.query;if(typeof s.url=="string")return s.url;try{const o=JSON.stringify(t);return o.length>120?`${o.slice(0,120)}…`:o}catch{return""}}const hp=5;function WA({tool:t,args:s,result:o,isError:r}){const[c,d]=y.useState(!1),{display:u}=YA(t),f=JA(s),m=o===void 0,h=(o==null?void 0:o.split(`
322
+ `))??[],v=h.length>hp,b=c?o:h.slice(0,hp).join(`
323
+ `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardBlue} ${m?B.inProgress:""}`,"data-testid":"tool-card-generic",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,children:a.jsx(fT,{size:Pt,"aria-hidden":"true"})}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-blue)"},children:u}),f&&a.jsx("span",{className:B.fileName,children:f})]}),m&&_&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-args",children:_}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&!m&&o&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-result",children:b}),v&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{d(x=>!x)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${c?B.chevronExpanded:""}`,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),c?"collapse":`${h.length-hp} more lines`]})]})]})}const XA="_badgePill_1piak_1",QA="_modelBadge_1piak_14",eD="_backgroundBadge_1piak_26",tD="_backgroundDot_1piak_36",nD="_backgroundDotPulsing_1piak_41",sD="_viewActivity_1piak_55",aD="_description_1piak_74",iD="_statusLine_1piak_81",oD="_statusCompleted_1piak_91",rD="_statusRunning_1piak_96",lD="_statusError_1piak_102",cD="_promptToggle_1piak_107",Xn={badgePill:XA,modelBadge:QA,backgroundBadge:eD,backgroundDot:tD,backgroundDotPulsing:nD,viewActivity:sD,description:aD,statusLine:iD,statusCompleted:oD,statusRunning:rD,statusError:lD,promptToggle:cD},dD=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function uD(t){const s=dD.exec(t);if(!s)return;const o=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:o?o.trim():void 0}}const gp=5;function fD({tool:t,args:s,result:o,isError:r,childSessionId:c}){const[d,u]=y.useState(!1),[f,m]=y.useState(!1),h=aj(t,s),v=o===void 0,b=h.isPoll&&o?uD(o):void 0,_=(b==null?void 0:b.content)??o,x=(_==null?void 0:_.split(`
324
+ `))??[],S=x.length>gp,j=d?_:x.slice(0,gp).join(`
325
+ `),T=h.isPoll?"Subagent":"Agent";return a.jsxs("div",{className:`${B.card} ${r?B.cardRed:B.cardTeal} ${v?B.inProgress:""}`,"data-testid":"tool-card-agent",children:[a.jsxs("div",{className:B.header,children:[a.jsx("span",{className:B.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),a.jsx("span",{className:B.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:T}),h.agentType&&a.jsx("span",{className:Xn.badgePill,"data-testid":"tool-card-agent-type",children:h.agentType}),h.model&&a.jsx("span",{className:Xn.modelBadge,"data-testid":"tool-card-agent-model",children:h.model}),h.isBackground&&a.jsxs("span",{className:Xn.backgroundBadge,"data-testid":"tool-card-agent-background",children:[a.jsx("span",{className:v?Xn.backgroundDotPulsing:Xn.backgroundDot,children:"●"}),"BG"]}),h.agentName&&a.jsx("span",{className:B.fileName,"data-testid":"tool-card-agent-name",children:h.agentName}),h.agentId&&a.jsx("span",{className:B.fileName,"data-testid":"tool-card-agent-id",children:h.agentId}),a.jsx("span",{className:B.spacer}),c&&a.jsx(vl,{to:yl(c),className:Xn.viewActivity,"data-testid":"tool-card-agent-view-activity",children:"View activity →"}),v&&!h.isBackground&&a.jsx("span",{className:B.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),h.description&&a.jsx("div",{className:Xn.description,"data-testid":"tool-card-agent-description",children:h.isResume?`Resuming: ${h.description}`:h.description}),b&&a.jsxs("div",{className:Xn.statusLine,"data-testid":"tool-card-agent-status",children:[a.jsx("span",{className:b.status==="completed"?Xn.statusCompleted:b.status==="running"?Xn.statusRunning:Xn.statusError,children:b.status}),b.metadata&&a.jsx("span",{children:b.metadata})]}),h.prompt&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:Xn.promptToggle,onClick:()=>{m(N=>!N)},"aria-expanded":f,"data-testid":"tool-card-prompt-toggle",children:[a.jsx("span",{className:`${B.chevron} ${f?B.chevronExpanded:""}`,children:"▸"}),"prompt"]}),f&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-prompt",children:h.prompt})]}),r&&o&&a.jsx("pre",{className:B.pre,"data-testid":"tool-card-error",children:o}),!r&&!v&&_&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:B.pre,"data-testid":"tool-card-result",children:j}),S&&a.jsxs("button",{type:"button",className:B.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[a.jsx("span",{className:`${B.chevron} ${d?B.chevronExpanded:""}`,children:"▸"}),d?"collapse":`${x.length-gp} more lines`]})]})]})}function vp(t){switch(_E(t.tool)){case"file-read":return a.jsx(zy,{...t});case"file-edit":return a.jsx(iA,{...t});case"file-write":return a.jsx(zy,{...t,writeVariant:!0});case"shell":return a.jsx(dA,{...t});case"search":return a.jsx(fA,{...t});case"todo":return a.jsx(DA,{...t});case"metadata":return a.jsx(RA,{...t});case"task":return a.jsx(BA,{...t});case"workpad":return a.jsx(HA,{...t});case"knowledge":return a.jsx(VA,{...t});case"ipc":return a.jsx(FA,{...t});case"tool-search":return a.jsx(ZA,{...t});case"agent":return a.jsx(fD,{...t});default:return a.jsx(WA,{...t})}}const pD="_systemContextEvent_1oqvt_1",mD="_systemContextHeader_1oqvt_7",hD="_systemContextBadge_1oqvt_28",gD="_systemContextToggle_1oqvt_37",vD="_systemContextPre_1oqvt_43",yD="_systemContextEllipsis_1oqvt_54",bD="_systemEvent_1oqvt_58",_D="_systemTimestamp_1oqvt_65",xD="_textEvent_1oqvt_69",kD="_codeBlockWrapper_1oqvt_163",SD="_codeBlockCopyButton_1oqvt_166",jD="_errorEvent_1oqvt_170",TD="_statusEvent_1oqvt_178",ND="_userInputEvent_1oqvt_187",wD="_userInputContent_1oqvt_193",CD="_signalEvent_1oqvt_307",ED="_signalBadge_1oqvt_318",AD="_signalContent_1oqvt_327",DD="_usageEvent_1oqvt_332",MD="_usageBadge_1oqvt_339",RD="_defaultEvent_1oqvt_348",Ht={systemContextEvent:pD,systemContextHeader:mD,systemContextBadge:hD,systemContextToggle:gD,systemContextPre:vD,systemContextEllipsis:yD,systemEvent:bD,systemTimestamp:_D,textEvent:xD,codeBlockWrapper:kD,codeBlockCopyButton:SD,errorEvent:jD,statusEvent:TD,userInputEvent:ND,userInputContent:wD,signalEvent:CD,signalBadge:ED,signalContent:AD,usageEvent:DD,usageBadge:MD,defaultEvent:RD},Py=y.lazy(()=>wm(()=>import("./McpAppWidget-D-BOXq5b.js"),__vite__mapDeps([0,1,2])).then(t=>({default:t.McpAppWidget})));function Uy(t,s,o,r){if(!t||!s)return;const c=ij(o,r);if(c)return oj(t,rj(c,s))}const Vy=3;function ID({content:t}){const[s,o]=y.useState(!1),r=t.split(`
326
+ `),c=r.length>Vy,d=s?t:r.slice(0,Vy).join(`
327
+ `);return a.jsxs("div",{className:Ht.systemContextEvent,"data-testid":"system-context-event",children:[a.jsxs("button",{type:"button",className:Ht.systemContextHeader,onClick:()=>{o(u=>!u)},"aria-expanded":s,children:[a.jsx("span",{className:Ht.systemContextBadge,children:"SYSTEM PROMPT"}),c&&a.jsx("span",{className:Ht.systemContextToggle,"aria-hidden":"true",children:s?a.jsx(W_,{size:Ye}):a.jsx(va,{size:Ye})})]}),a.jsxs("pre",{className:Ht.systemContextPre,children:[d,!s&&c&&a.jsx("span",{className:Ht.systemContextEllipsis,children:"…"})]})]})}function OD({time:t,content:s}){return a.jsxs("div",{className:Ht.systemEvent,children:[a.jsxs("span",{className:Ht.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Wp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Wp).join(""):t!=null&&typeof t=="object"&&"props"in t?Wp(t.props.children):""}function LD({children:t,node:s,...o}){const r=Wp(t);return a.jsxs("div",{className:Ht.codeBlockWrapper,children:[a.jsx("pre",{...o,children:t}),a.jsx(XC,{text:r,"data-testid":"copy-code-block",className:Ht.codeBlockCopyButton})]})}const BD={pre:LD};function Tx({content:t}){return a.jsx(Tm,{remarkPlugins:[Nm],rehypePlugins:[yE],components:BD,children:t})}function zD({content:t}){return a.jsx("div",{className:Ht.textEvent,children:a.jsx(Tx,{content:t})})}function $D({content:t}){return a.jsxs("div",{className:Ht.errorEvent,children:["Error: ",t]})}function HD({content:t}){return a.jsxs("div",{className:Ht.statusEvent,children:["--- ",t," ---"]})}function PD({content:t}){return a.jsx("div",{className:Ht.userInputEvent,children:a.jsx("div",{className:Ht.userInputContent,"data-testid":"user-input-content",children:a.jsx(Tx,{content:t})})})}function UD({content:t}){return a.jsxs("div",{className:Ht.signalEvent,"data-testid":"signal-event",children:[a.jsx("span",{className:Ht.signalBadge,children:"SIGNAL"}),a.jsx("span",{className:Ht.signalContent,children:t})]})}function VD({content:t}){let s=t;try{const o=JSON.parse(t),r=Number(o.input_tokens)||0,c=Number(o.output_tokens)||0,d=Uo(r+c),u=Rs(Number(o.cost_millicents)||0);s=`${d} tokens · ${u}`}catch{}return a.jsx("div",{className:Ht.usageEvent,"data-testid":"usage-event",children:a.jsx("span",{className:Ht.usageBadge,children:s})})}function Ur({content:t}){return a.jsx("div",{className:Ht.defaultEvent,children:t})}function qD({event:t,toolUseCtx:s,settled:o,sandboxProxyUrl:r}){const c=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"widget":{if(!r)return a.jsx(Ur,{content:t.content});let d={};try{d=JSON.parse(t.content)}catch{}const u=d.rendererKind??"mcp-app-html";if(u==="grackle-react"&&d.html){const m=`<!doctype html><html><head><meta charset="utf-8"></head><body><div id="grackle-root"></div><script type="module" src="${new URL(r,window.location.href).origin}/runtime.js"><\/script></body></html>`;return a.jsx(y.Suspense,{fallback:a.jsx(Ur,{content:"Loading widget..."}),children:a.jsx(Py,{widgetHtml:m,sandboxProxyUrl:r,csp:d.csp,toolInput:{source:d.html,props:d.toolInput??{},components:d.components??[]}})})}return u!=="mcp-app-html"||!d.html?a.jsx(Ur,{content:t.content}):a.jsx(y.Suspense,{fallback:a.jsx(Ur,{content:"Loading widget..."}),children:a.jsx(Py,{widgetHtml:d.html,sandboxProxyUrl:r,csp:d.csp,toolInput:d.toolInput,toolResult:d.toolResult})})}case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return a.jsx(ID,{content:t.content})}catch{}return a.jsx(OD,{time:c,content:t.content})}case"text":case"output":return a.jsx(zD,{content:t.content});case"tool_use":{let d="",u={};try{const f=JSON.parse(t.content);d=f.tool||"",u=f.args}catch{}return a.jsx(vp,{tool:d,args:u,result:o?"":void 0,childSessionId:Uy(t.sessionId,t.toolCallId,d,u)})}case"tool_result":{let d=t.toolError===!0;if(!d)try{JSON.parse(t.content).is_ok===!1&&(d=!0)}catch{}if(!d&&t.raw)try{d=JSON.parse(t.raw).is_error===!0}catch{}let u=t.content;if(t.content.trimStart().startsWith("{"))try{const f=JSON.parse(t.content);typeof f.content=="string"&&(u=f.content)}catch{}return s?a.jsx(vp,{tool:s.tool,args:s.args,result:u,isError:d,detailedResult:s.detailedResult,childSessionId:Uy(t.sessionId,t.toolCallId,s.tool,s.args)}):a.jsx(vp,{tool:"Tool output",args:void 0,result:u,isError:d})}case"error":return a.jsx($D,{content:t.content});case"status":return a.jsx(HD,{content:t.content});case"user_input":return a.jsx(PD,{content:t.content});case"signal":return a.jsx(UD,{content:t.content});case"usage":return a.jsx(VD,{content:t.content});default:return a.jsx(Ur,{content:t.content})}}const zm=y.createContext({});function $m(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const Md=y.createContext(null),Hm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class GD extends y.Component{getSnapshotBeforeUpdate(s){const o=this.props.childRef.current;if(o&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=o.offsetHeight||0,r.width=o.offsetWidth||0,r.top=o.offsetTop,r.left=o.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function FD({children:t,isPresent:s}){const o=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(Hm);return y.useInsertionEffect(()=>{const{width:u,height:f,top:m,left:h}=c.current;if(s||!r.current||!u||!f)return;r.current.dataset.motionPopId=o;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
328
+ [data-motion-pop-id="${o}"] {
329
+ position: absolute !important;
330
+ width: ${u}px !important;
331
+ height: ${f}px !important;
332
+ top: ${m}px !important;
333
+ left: ${h}px !important;
334
+ }
335
+ `),()=>{document.head.removeChild(v)}},[s]),a.jsx(GD,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const KD=({children:t,initial:s,isPresent:o,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const f=$m(ZD),m=y.useId(),h=y.useCallback(b=>{f.set(b,!0);for(const _ of f.values())if(!_)return;r&&r()},[f,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:o,custom:c,onExitComplete:h,register:b=>(f.set(b,!1),()=>f.delete(b))}),d?[Math.random(),h]:[o,h]);return y.useMemo(()=>{f.forEach((b,_)=>f.set(_,!1))},[o]),y.useEffect(()=>{!o&&!f.size&&r&&r()},[o]),u==="popLayout"&&(t=a.jsx(FD,{isPresent:o,children:t})),a.jsx(Md.Provider,{value:v,children:t})};function ZD(){return new Map}function Nx(t=!0){const s=y.useContext(Md);if(s===null)return[!0,null];const{isPresent:o,onExitComplete:r,register:c}=s,d=y.useId();y.useEffect(()=>{t&&c(d)},[t]);const u=y.useCallback(()=>t&&r&&r(d),[d,r,t]);return!o&&r?[!1,u]:[!0]}const qc=t=>t.key||"";function qy(t){const s=[];return y.Children.forEach(t,o=>{y.isValidElement(o)&&s.push(o)}),s}const Pm=typeof window<"u",wx=Pm?y.useLayoutEffect:y.useEffect,rs=({children:t,custom:s,initial:o=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[f,m]=Nx(u),h=y.useMemo(()=>qy(t),[t]),v=u&&!f?[]:h.map(qc),b=y.useRef(!0),_=y.useRef(h),x=$m(()=>new Map),[S,j]=y.useState(h),[T,N]=y.useState(h);wx(()=>{b.current=!1,_.current=h;for(let A=0;A<T.length;A++){const E=qc(T[A]);v.includes(E)?x.delete(E):x.get(E)!==!0&&x.set(E,!1)}},[T,v.length,v.join("-")]);const C=[];if(h!==S){let A=[...h];for(let E=0;E<T.length;E++){const R=T[E],L=qc(R);v.includes(L)||(A.splice(E,0,R),C.push(R))}d==="wait"&&C.length&&(A=C),N(qy(A)),j(h);return}const{forceRender:D}=y.useContext(zm);return a.jsx(a.Fragment,{children:T.map(A=>{const E=qc(A),R=u&&!f?!1:h===T||v.includes(E),L=()=>{if(x.has(E))x.set(E,!0);else return;let M=!0;x.forEach($=>{$||(M=!1)}),M&&(D==null||D(),N(_.current),u&&(m==null||m()),r&&r())};return a.jsx(KD,{isPresent:R,initial:!b.current||o?void 0:!1,custom:R?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:R?void 0:L,children:A},E)})})},$n=t=>t;let Cx=$n;const YD={useManualTiming:!1};function JD(t){let s=new Set,o=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function f(h){d.has(h)&&(m.schedule(h),t()),h(u)}const m={schedule:(h,v=!1,b=!1)=>{const x=b&&r?s:o;return v&&d.add(h),x.has(h)||x.add(h),h},cancel:h=>{o.delete(h),d.delete(h)},process:h=>{if(u=h,r){c=!0;return}r=!0,[s,o]=[o,s],s.forEach(f),s.clear(),r=!1,c&&(c=!1,m.process(h))}};return m}const Gc=["read","resolveKeyframes","update","preRender","render","postRender"],WD=40;function Ex(t,s){let o=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>o=!0,u=Gc.reduce((N,C)=>(N[C]=JD(d),N),{}),{read:f,resolveKeyframes:m,update:h,preRender:v,render:b,postRender:_}=u,x=()=>{const N=performance.now();o=!1,c.delta=r?1e3/60:Math.max(Math.min(N-c.timestamp,WD),1),c.timestamp=N,c.isProcessing=!0,f.process(c),m.process(c),h.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,o&&s&&(r=!1,t(x))},S=()=>{o=!0,r=!0,c.isProcessing||t(x)};return{schedule:Gc.reduce((N,C)=>{const D=u[C];return N[C]=(A,E=!1,R=!1)=>(o||S(),D.schedule(A,E,R)),N},{}),cancel:N=>{for(let C=0;C<Gc.length;C++)u[Gc[C]].cancel(N)},state:c,steps:u}}const{schedule:wt,cancel:ei,state:pn,steps:yp}=Ex(typeof requestAnimationFrame<"u"?requestAnimationFrame:$n,!0),Ax=y.createContext({strict:!1}),Gy={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Vo={};for(const t in Gy)Vo[t]={isEnabled:s=>Gy[t].some(o=>!!s[o])};function XD(t){for(const s in t)Vo[s]={...Vo[s],...t[s]}}const QD=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function md(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||QD.has(t)}let Dx=t=>!md(t);function eM(t){t&&(Dx=s=>s.startsWith("on")?!md(s):t(s))}try{eM(require("@emotion/is-prop-valid").default)}catch{}function tM(t,s,o){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(Dx(c)||o===!0&&md(c)||!s&&!md(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function nM(t){if(typeof Proxy>"u")return t;const s=new Map,o=(...r)=>t(...r);return new Proxy(o,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const Rd=y.createContext({});function ll(t){return typeof t=="string"||Array.isArray(t)}function Id(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const Um=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Vm=["initial",...Um];function Od(t){return Id(t.animate)||Vm.some(s=>ll(t[s]))}function Mx(t){return!!(Od(t)||t.variants)}function sM(t,s){if(Od(t)){const{initial:o,animate:r}=t;return{initial:o===!1||ll(o)?o:void 0,animate:ll(r)?r:void 0}}return t.inherit!==!1?s:{}}function aM(t){const{initial:s,animate:o}=sM(t,y.useContext(Rd));return y.useMemo(()=>({initial:s,animate:o}),[Fy(s),Fy(o)])}function Fy(t){return Array.isArray(t)?t.join(" "):t}const iM=Symbol.for("motionComponentSymbol");function Mo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function oM(t,s,o){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),o&&(typeof o=="function"?o(r):Mo(o)&&(o.current=r))},[s])}const qm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),rM="framerAppearId",Rx="data-"+qm(rM),{schedule:Gm}=Ex(queueMicrotask,!1),Ix=y.createContext({});function lM(t,s,o,r,c){var d,u;const{visualElement:f}=y.useContext(Rd),m=y.useContext(Ax),h=y.useContext(Md),v=y.useContext(Hm).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:f,props:o,presenceContext:h,blockInitialAnimation:h?h.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,x=y.useContext(Ix);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&cM(b.current,o,c,x);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(o,h)});const j=o[Rx],T=y.useRef(!!j&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,j))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,j)));return wx(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),Gm.render(_.render),T.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!T.current&&_.animationState&&_.animationState.animateChanges(),T.current&&(queueMicrotask(()=>{var N;(N=window.MotionHandoffMarkAsComplete)===null||N===void 0||N.call(window,j)}),T.current=!1))}),_}function cM(t,s,o,r){const{layoutId:c,layout:d,drag:u,dragConstraints:f,layoutScroll:m,layoutRoot:h}=s;t.projection=new o(t.latestValues,s["data-framer-portal-id"]?void 0:Ox(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||f&&Mo(f),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:h})}function Ox(t){if(t)return t.options.allowProjection!==!1?t.projection:Ox(t.parent)}function dM({preloadedFeatures:t,createVisualElement:s,useRender:o,useVisualState:r,Component:c}){var d,u;t&&XD(t);function f(h,v){let b;const _={...y.useContext(Hm),...h,layoutId:uM(h)},{isStatic:x}=_,S=aM(h),j=r(h,x);if(!x&&Pm){fM();const T=pM(_);b=T.MeasureLayout,S.visualElement=lM(c,j,_,s,T.ProjectionNode)}return a.jsxs(Rd.Provider,{value:S,children:[b&&S.visualElement?a.jsx(b,{visualElement:S.visualElement,..._}):null,o(c,h,oM(j,S.visualElement,v),j,x,S.visualElement)]})}f.displayName=`motion.${typeof c=="string"?c:`create(${(u=(d=c.displayName)!==null&&d!==void 0?d:c.name)!==null&&u!==void 0?u:""})`}`;const m=y.forwardRef(f);return m[iM]=c,m}function uM({layoutId:t}){const s=y.useContext(zm).id;return s&&t!==void 0?s+"-"+t:t}function fM(t,s){y.useContext(Ax).strict}function pM(t){const{drag:s,layout:o}=Vo;if(!s&&!o)return{};const r={...s,...o};return{MeasureLayout:s!=null&&s.isEnabled(t)||o!=null&&o.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const mM=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Fm(t){return typeof t!="string"||t.includes("-")?!1:!!(mM.indexOf(t)>-1||/[A-Z]/u.test(t))}function Ky(t){const s=[{},{}];return t==null||t.values.forEach((o,r)=>{s[0][r]=o.get(),s[1][r]=o.getVelocity()}),s}function Km(t,s,o,r){if(typeof s=="function"){const[c,d]=Ky(r);s=s(o!==void 0?o:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=Ky(r);s=s(o!==void 0?o:t.custom,c,d)}return s}const Xp=t=>Array.isArray(t),hM=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),gM=t=>Xp(t)?t[t.length-1]||0:t,vn=t=>!!(t&&t.getVelocity);function id(t){const s=vn(t)?t.get():t;return hM(s)?s.toValue():s}function vM({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:o},r,c,d){const u={latestValues:yM(r,c,d,t),renderState:s()};return o&&(u.onMount=f=>o({props:r,current:f,...u}),u.onUpdate=f=>o(f)),u}const Lx=t=>(s,o)=>{const r=y.useContext(Rd),c=y.useContext(Md),d=()=>vM(t,s,r,c);return o?d():$m(d)};function yM(t,s,o,r){const c={},d=r(t,{});for(const _ in d)c[_]=id(d[_]);let{initial:u,animate:f}=t;const m=Od(t),h=Mx(t);s&&h&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),f===void 0&&(f=s.animate));let v=o?o.initial===!1:!1;v=v||u===!1;const b=v?f:u;if(b&&typeof b!="boolean"&&!Id(b)){const _=Array.isArray(b)?b:[b];for(let x=0;x<_.length;x++){const S=Km(t,_[x]);if(S){const{transitionEnd:j,transition:T,...N}=S;for(const C in N){let D=N[C];if(Array.isArray(D)){const A=v?D.length-1:0;D=D[A]}D!==null&&(c[C]=D)}for(const C in j)c[C]=j[C]}}}return c}const Yo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Li=new Set(Yo),Bx=t=>s=>typeof s=="string"&&s.startsWith(t),zx=Bx("--"),bM=Bx("var(--"),Zm=t=>bM(t)?_M.test(t.split("/*")[0].trim()):!1,_M=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,$x=(t,s)=>s&&typeof t=="number"?s.transform(t):t,ha=(t,s,o)=>o>s?s:o<t?t:o,Jo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},cl={...Jo,transform:t=>ha(0,1,t)},Fc={...Jo,default:1},_l=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Wa=_l("deg"),Os=_l("%"),Ae=_l("px"),xM=_l("vh"),kM=_l("vw"),Zy={...Os,parse:t=>Os.parse(t)/100,transform:t=>Os.transform(t*100)},SM={borderWidth:Ae,borderTopWidth:Ae,borderRightWidth:Ae,borderBottomWidth:Ae,borderLeftWidth:Ae,borderRadius:Ae,radius:Ae,borderTopLeftRadius:Ae,borderTopRightRadius:Ae,borderBottomRightRadius:Ae,borderBottomLeftRadius:Ae,width:Ae,maxWidth:Ae,height:Ae,maxHeight:Ae,top:Ae,right:Ae,bottom:Ae,left:Ae,padding:Ae,paddingTop:Ae,paddingRight:Ae,paddingBottom:Ae,paddingLeft:Ae,margin:Ae,marginTop:Ae,marginRight:Ae,marginBottom:Ae,marginLeft:Ae,backgroundPositionX:Ae,backgroundPositionY:Ae},jM={rotate:Wa,rotateX:Wa,rotateY:Wa,rotateZ:Wa,scale:Fc,scaleX:Fc,scaleY:Fc,scaleZ:Fc,skew:Wa,skewX:Wa,skewY:Wa,distance:Ae,translateX:Ae,translateY:Ae,translateZ:Ae,x:Ae,y:Ae,z:Ae,perspective:Ae,transformPerspective:Ae,opacity:cl,originX:Zy,originY:Zy,originZ:Ae},Yy={...Jo,transform:Math.round},Ym={...SM,...jM,zIndex:Yy,size:Ae,fillOpacity:cl,strokeOpacity:cl,numOctaves:Yy},TM={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},NM=Yo.length;function wM(t,s,o){let r="",c=!0;for(let d=0;d<NM;d++){const u=Yo[d],f=t[u];if(f===void 0)continue;let m=!0;if(typeof f=="number"?m=f===(u.startsWith("scale")?1:0):m=parseFloat(f)===0,!m||o){const h=$x(f,Ym[u]);if(!m){c=!1;const v=TM[u]||u;r+=`${v}(${h}) `}o&&(s[u]=h)}}return r=r.trim(),o?r=o(s,c?"":r):c&&(r="none"),r}function Jm(t,s,o){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,f=!1;for(const m in s){const h=s[m];if(Li.has(m)){u=!0;continue}else if(zx(m)){c[m]=h;continue}else{const v=$x(h,Ym[m]);m.startsWith("origin")?(f=!0,d[m]=v):r[m]=v}}if(s.transform||(u||o?r.transform=wM(s,t.transform,o):r.transform&&(r.transform="none")),f){const{originX:m="50%",originY:h="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${h} ${v}`}}const CM={offset:"stroke-dashoffset",array:"stroke-dasharray"},EM={offset:"strokeDashoffset",array:"strokeDasharray"};function AM(t,s,o=1,r=0,c=!0){t.pathLength=1;const d=c?CM:EM;t[d.offset]=Ae.transform(-r);const u=Ae.transform(s),f=Ae.transform(o);t[d.array]=`${u} ${f}`}function Jy(t,s,o){return typeof t=="string"?t:Ae.transform(s+o*t)}function DM(t,s,o){const r=Jy(s,t.x,t.width),c=Jy(o,t.y,t.height);return`${r} ${c}`}function Wm(t,{attrX:s,attrY:o,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:f=1,pathOffset:m=0,...h},v,b){if(Jm(t,h,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:x,dimensions:S}=t;_.transform&&(S&&(x.transform=_.transform),delete _.transform),S&&(c!==void 0||d!==void 0||x.transform)&&(x.transformOrigin=DM(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),o!==void 0&&(_.y=o),r!==void 0&&(_.scale=r),u!==void 0&&AM(_,u,f,m,!1)}const Xm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Hx=()=>({...Xm(),attrs:{}}),Qm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Px(t,{style:s,vars:o},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in o)t.style.setProperty(d,o[d])}const Ux=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function Vx(t,s,o,r){Px(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Ux.has(c)?c:qm(c),s.attrs[c])}const hd={};function MM(t){Object.assign(hd,t)}function qx(t,{layout:s,layoutId:o}){return Li.has(t)||t.startsWith("origin")||(s||o!==void 0)&&(!!hd[t]||t==="opacity")}function eh(t,s,o){var r;const{style:c}=t,d={};for(const u in c)(vn(c[u])||s.style&&vn(s.style[u])||qx(u,t)||((r=o==null?void 0:o.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function Gx(t,s,o){const r=eh(t,s,o);for(const c in t)if(vn(t[c])||vn(s[c])){const d=Yo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function RM(t,s){try{s.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{s.dimensions={x:0,y:0,width:0,height:0}}}const Wy=["x","y","width","height","cx","cy","r"],IM={useVisualState:Lx({scrapeMotionValuesFromProps:Gx,createRenderState:Hx,onUpdate:({props:t,prevProps:s,current:o,renderState:r,latestValues:c})=>{if(!o)return;let d=!!t.drag;if(!d){for(const f in c)if(Li.has(f)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let f=0;f<Wy.length;f++){const m=Wy[f];t[m]!==s[m]&&(u=!0)}u&&wt.read(()=>{RM(o,r),wt.render(()=>{Wm(r,c,Qm(o.tagName),t.transformTemplate),Vx(o,r)})})}})},OM={useVisualState:Lx({scrapeMotionValuesFromProps:eh,createRenderState:Xm})};function Fx(t,s,o){for(const r in s)!vn(s[r])&&!qx(r,o)&&(t[r]=s[r])}function LM({transformTemplate:t},s){return y.useMemo(()=>{const o=Xm();return Jm(o,s,t),Object.assign({},o.vars,o.style)},[s])}function BM(t,s){const o=t.style||{},r={};return Fx(r,o,t),Object.assign(r,LM(t,s)),r}function zM(t,s){const o={},r=BM(t,s);return t.drag&&t.dragListener!==!1&&(o.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(o.tabIndex=0),o.style=r,o}function $M(t,s,o,r){const c=y.useMemo(()=>{const d=Hx();return Wm(d,s,Qm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};Fx(d,t.style,t),c.style={...d,...c.style}}return c}function HM(t=!1){return(o,r,c,{latestValues:d},u)=>{const m=(Fm(o)?$M:zM)(r,d,u,o),h=tM(r,typeof o=="string",t),v=o!==y.Fragment?{...h,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>vn(b)?b.get():b,[b]);return y.createElement(o,{...v,children:_})}}function PM(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...Fm(r)?IM:OM,preloadedFeatures:t,useRender:HM(c),createVisualElement:s,Component:r};return dM(u)}}function Kx(t,s){if(!Array.isArray(s))return!1;const o=s.length;if(o!==t.length)return!1;for(let r=0;r<o;r++)if(s[r]!==t[r])return!1;return!0}function Ld(t,s,o){const r=t.getProps();return Km(r,s,o!==void 0?o:r.custom,t)}function th(t,s){return t?t[s]||t.default||t:void 0}const Zx=new Set(["width","height","top","left","right","bottom",...Yo]);let od;function UM(){od=void 0}const Ls={now:()=>(od===void 0&&Ls.set(pn.isProcessing||YD.useManualTiming?pn.timestamp:performance.now()),od),set:t=>{od=t,queueMicrotask(UM)}};function nh(t,s){t.indexOf(s)===-1&&t.push(s)}function sh(t,s){const o=t.indexOf(s);o>-1&&t.splice(o,1)}class ah{constructor(){this.subscriptions=[]}add(s){return nh(this.subscriptions,s),()=>sh(this.subscriptions,s)}notify(s,o,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,o,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,o,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function Yx(t,s){return s?t*(1e3/s):0}const Xy=30,VM=t=>!isNaN(parseFloat(t));class qM{constructor(s,o={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=Ls.now();this.updatedAt!==d&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=o.owner}setCurrent(s){this.current=s,this.updatedAt=Ls.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=VM(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,o){this.events[s]||(this.events[s]=new ah);const r=this.events[s].add(o);return s==="change"?()=>{r(),wt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,o){this.passiveEffect=s,this.stopPassiveEffect=o}set(s,o=!0){!o||!this.passiveEffect?this.updateAndNotify(s,o):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,o,r){this.set(o),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,o=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,o&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=Ls.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Xy)return 0;const o=Math.min(this.updatedAt-this.prevUpdatedAt,Xy);return Yx(parseFloat(this.current)-parseFloat(this.prevFrameValue),o)}start(s){return this.stop(),new Promise(o=>{this.hasAnimated=!0,this.animation=s(o),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function dl(t,s){return new qM(t,s)}function GM(t,s,o){t.hasValue(s)?t.getValue(s).set(o):t.addValue(s,dl(o))}function FM(t,s){const o=Ld(t,s);let{transitionEnd:r={},transition:c={},...d}=o||{};d={...d,...r};for(const u in d){const f=gM(d[u]);GM(t,u,f)}}function KM(t){return!!(vn(t)&&t.add)}function Qp(t,s){const o=t.getValue("willChange");if(KM(o))return o.add(s)}function Jx(t){return t.props[Rx]}function ih(t){let s;return()=>(s===void 0&&(s=t()),s)}const ZM=ih(()=>window.ScrollTimeline!==void 0);class YM{constructor(s){this.stop=()=>this.runAll("stop"),this.animations=s.filter(Boolean)}get finished(){return Promise.all(this.animations.map(s=>"finished"in s?s.finished:s))}getAll(s){return this.animations[0][s]}setAll(s,o){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=o}attachTimeline(s,o){const r=this.animations.map(c=>{if(ZM()&&c.attachTimeline)return c.attachTimeline(s);if(typeof o=="function")return o(c)});return()=>{r.forEach((c,d)=>{c&&c(),this.animations[d].stop()})}}get time(){return this.getAll("time")}set time(s){this.setAll("time",s)}get speed(){return this.getAll("speed")}set speed(s){this.setAll("speed",s)}get startTime(){return this.getAll("startTime")}get duration(){let s=0;for(let o=0;o<this.animations.length;o++)s=Math.max(s,this.animations[o].duration);return s}runAll(s){this.animations.forEach(o=>o[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class JM extends YM{then(s,o){return Promise.all(this.animations).then(s).catch(o)}}const fa=t=>t*1e3,pa=t=>t/1e3;function oh(t){return typeof t=="function"}function Qy(t,s){t.timeline=s,t.onfinish=null}const rh=t=>Array.isArray(t)&&typeof t[0]=="number",WM={linearEasing:void 0};function XM(t,s){const o=ih(t);return()=>{var r;return(r=WM[s])!==null&&r!==void 0?r:o()}}const gd=XM(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),qo=(t,s,o)=>{const r=s-t;return r===0?1:(o-t)/r},Wx=(t,s,o=10)=>{let r="";const c=Math.max(Math.round(s/o),2);for(let d=0;d<c;d++)r+=t(qo(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function Xx(t){return!!(typeof t=="function"&&gd()||!t||typeof t=="string"&&(t in em||gd())||rh(t)||Array.isArray(t)&&t.every(Xx))}const Yr=([t,s,o,r])=>`cubic-bezier(${t}, ${s}, ${o}, ${r})`,em={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yr([0,.65,.55,1]),circOut:Yr([.55,0,1,.45]),backIn:Yr([.31,.01,.66,-.59]),backOut:Yr([.33,1.53,.69,.99])};function Qx(t,s){if(t)return typeof t=="function"&&gd()?Wx(t,s):rh(t)?Yr(t):Array.isArray(t)?t.map(o=>Qx(o,s)||em.easeOut):em[t]}const e1=(t,s,o)=>(((1-3*o+3*s)*t+(3*o-6*s))*t+3*s)*t,QM=1e-7,e4=12;function t4(t,s,o,r,c){let d,u,f=0;do u=s+(o-s)/2,d=e1(u,r,c)-t,d>0?o=u:s=u;while(Math.abs(d)>QM&&++f<e4);return u}function xl(t,s,o,r){if(t===s&&o===r)return $n;const c=d=>t4(d,0,1,t,o);return d=>d===0||d===1?d:e1(c(d),s,r)}const t1=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,n1=t=>s=>1-t(1-s),s1=xl(.33,1.53,.69,.99),lh=n1(s1),a1=t1(lh),i1=t=>(t*=2)<1?.5*lh(t):.5*(2-Math.pow(2,-10*(t-1))),ch=t=>1-Math.sin(Math.acos(t)),o1=n1(ch),r1=t1(ch),l1=t=>/^0[^.\s]+$/u.test(t);function n4(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||l1(t):!0}const Qr=t=>Math.round(t*1e5)/1e5,dh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function s4(t){return t==null}const a4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,uh=(t,s)=>o=>!!(typeof o=="string"&&a4.test(o)&&o.startsWith(t)||s&&!s4(o)&&Object.prototype.hasOwnProperty.call(o,s)),c1=(t,s,o)=>r=>{if(typeof r!="string")return r;const[c,d,u,f]=r.match(dh);return{[t]:parseFloat(c),[s]:parseFloat(d),[o]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},i4=t=>ha(0,255,t),bp={...Jo,transform:t=>Math.round(i4(t))},Ci={test:uh("rgb","red"),parse:c1("red","green","blue"),transform:({red:t,green:s,blue:o,alpha:r=1})=>"rgba("+bp.transform(t)+", "+bp.transform(s)+", "+bp.transform(o)+", "+Qr(cl.transform(r))+")"};function o4(t){let s="",o="",r="",c="";return t.length>5?(s=t.substring(1,3),o=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),o=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,o+=o,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(o,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const tm={test:uh("#"),parse:o4,transform:Ci.transform},Ro={test:uh("hsl","hue"),parse:c1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:o,alpha:r=1})=>"hsla("+Math.round(t)+", "+Os.transform(Qr(s))+", "+Os.transform(Qr(o))+", "+Qr(cl.transform(r))+")"},hn={test:t=>Ci.test(t)||tm.test(t)||Ro.test(t),parse:t=>Ci.test(t)?Ci.parse(t):Ro.test(t)?Ro.parse(t):tm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ci.transform(t):Ro.transform(t)},r4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function l4(t){var s,o;return isNaN(t)&&typeof t=="string"&&(((s=t.match(dh))===null||s===void 0?void 0:s.length)||0)+(((o=t.match(r4))===null||o===void 0?void 0:o.length)||0)>0}const d1="number",u1="color",c4="var",d4="var(",eb="${}",u4=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ul(t){const s=t.toString(),o=[],r={color:[],number:[],var:[]},c=[];let d=0;const f=s.replace(u4,m=>(hn.test(m)?(r.color.push(d),c.push(u1),o.push(hn.parse(m))):m.startsWith(d4)?(r.var.push(d),c.push(c4),o.push(m)):(r.number.push(d),c.push(d1),o.push(parseFloat(m))),++d,eb)).split(eb);return{values:o,split:f,indexes:r,types:c}}function f1(t){return ul(t).values}function p1(t){const{split:s,types:o}=ul(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const f=o[u];f===d1?d+=Qr(c[u]):f===u1?d+=hn.transform(c[u]):d+=c[u]}return d}}const f4=t=>typeof t=="number"?0:t;function p4(t){const s=f1(t);return p1(t)(s.map(f4))}const ti={test:l4,parse:f1,createTransformer:p1,getAnimatableNone:p4},m4=new Set(["brightness","contrast","saturate","opacity"]);function h4(t){const[s,o]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=o.match(dh)||[];if(!r)return t;const c=o.replace(r,"");let d=m4.has(s)?1:0;return r!==o&&(d*=100),s+"("+d+c+")"}const g4=/\b([a-z-]*)\(.*?\)/gu,nm={...ti,getAnimatableNone:t=>{const s=t.match(g4);return s?s.map(h4).join(" "):t}},v4={...Ym,color:hn,backgroundColor:hn,outlineColor:hn,fill:hn,stroke:hn,borderColor:hn,borderTopColor:hn,borderRightColor:hn,borderBottomColor:hn,borderLeftColor:hn,filter:nm,WebkitFilter:nm},fh=t=>v4[t];function m1(t,s){let o=fh(t);return o!==nm&&(o=ti),o.getAnimatableNone?o.getAnimatableNone(s):void 0}const y4=new Set(["auto","none","0"]);function b4(t,s,o){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!y4.has(d)&&ul(d).values.length&&(c=t[r]),r++}if(c&&o)for(const d of s)t[d]=m1(o,c)}const tb=t=>t===Jo||t===Ae,nb=(t,s)=>parseFloat(t.split(", ")[s]),sb=(t,s)=>(o,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return nb(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?nb(d[1],t):0}},_4=new Set(["x","y","z"]),x4=Yo.filter(t=>!_4.has(t));function k4(t){const s=[];return x4.forEach(o=>{const r=t.getValue(o);r!==void 0&&(s.push([o,r.get()]),r.set(o.startsWith("scale")?1:0))}),s}const Go={width:({x:t},{paddingLeft:s="0",paddingRight:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),height:({y:t},{paddingTop:s="0",paddingBottom:o="0"})=>t.max-t.min-parseFloat(s)-parseFloat(o),top:(t,{top:s})=>parseFloat(s),left:(t,{left:s})=>parseFloat(s),bottom:({y:t},{top:s})=>parseFloat(s)+(t.max-t.min),right:({x:t},{left:s})=>parseFloat(s)+(t.max-t.min),x:sb(4,13),y:sb(5,14)};Go.translateX=Go.x;Go.translateY=Go.y;const Ei=new Set;let sm=!1,am=!1;function h1(){if(am){const t=Array.from(Ei).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),o=new Map;s.forEach(r=>{const c=k4(r);c.length&&(o.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=o.get(r);c&&c.forEach(([d,u])=>{var f;(f=r.getValue(d))===null||f===void 0||f.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}am=!1,sm=!1,Ei.forEach(t=>t.complete()),Ei.clear()}function g1(){Ei.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(am=!0)})}function S4(){g1(),h1()}class ph{constructor(s,o,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=o,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ei.add(this),sm||(sm=!0,wt.read(g1),wt.resolveKeyframes(h1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:o,element:r,motionValue:c}=this;for(let d=0;d<s.length;d++)if(s[d]===null)if(d===0){const u=c==null?void 0:c.get(),f=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&o){const m=r.readValue(o,f);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=f),c&&u===void 0&&c.set(s[0])}else s[d]=s[d-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ei.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ei.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const v1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),j4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function T4(t){const s=j4.exec(t);if(!s)return[,];const[,o,r,c]=s;return[`--${o??r}`,c]}function y1(t,s,o=1){const[r,c]=T4(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return v1(u)?parseFloat(u):u}return Zm(c)?y1(c,s,o+1):c}const b1=t=>s=>s.test(t),N4={test:t=>t==="auto",parse:t=>t},_1=[Jo,Ae,Os,Wa,kM,xM,N4],ab=t=>_1.find(b1(t));class x1 extends ph{constructor(s,o,r,c,d){super(s,o,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:o,name:r}=this;if(!o||!o.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let h=s[m];if(typeof h=="string"&&(h=h.trim(),Zm(h))){const v=y1(h,o.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!Zx.has(r)||s.length!==2)return;const[c,d]=s,u=ab(c),f=ab(d);if(u!==f)if(tb(u)&&tb(f))for(let m=0;m<s.length;m++){const h=s[m];typeof h=="string"&&(s[m]=parseFloat(h))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:o}=this,r=[];for(let c=0;c<s.length;c++)n4(s[c])&&r.push(c);r.length&&b4(s,r,o)}measureInitialState(){const{element:s,unresolvedKeyframes:o,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Go[r](s.measureViewportBox(),window.getComputedStyle(s.current)),o[0]=this.measuredOrigin;const c=o[o.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:o,name:r,unresolvedKeyframes:c}=this;if(!o||!o.current)return;const d=o.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,f=c[u];c[u]=Go[r](o.measureViewportBox(),window.getComputedStyle(o.current)),f!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=f),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,h])=>{o.getValue(m).set(h)}),this.resolveNoneKeyframes()}}const ib=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(ti.test(t)||t==="0")&&!t.startsWith("url("));function w4(t){const s=t[0];if(t.length===1)return!0;for(let o=0;o<t.length;o++)if(t[o]!==s)return!0}function C4(t,s,o,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=ib(c,s),f=ib(d,s);return!u||!f?!1:w4(t)||(o==="spring"||oh(o))&&r}const E4=t=>t!==null;function Bd(t,{repeat:s,repeatType:o="loop"},r){const c=t.filter(E4),d=s&&o!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const A4=40;class k1{constructor({autoplay:s=!0,delay:o=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...f}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ls.now(),this.options={autoplay:s,delay:o,type:r,repeat:c,repeatDelay:d,repeatType:u,...f},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>A4?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&S4(),this._resolved}onKeyframesResolved(s,o){this.resolvedAt=Ls.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:f,onUpdate:m,isGenerator:h}=this.options;if(!h&&!C4(s,r,c,d))if(u)this.options.duration=0;else{m&&m(Bd(s,this.options,o)),f&&f(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,o);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:o,...v},this.onPostResolved())}onPostResolved(){}then(s,o){return this.currentFinishedPromise.then(s,o)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const im=2e4;function S1(t){let s=0;const o=50;let r=t.next(s);for(;!r.done&&s<im;)s+=o,r=t.next(s);return s>=im?1/0:s}const Dt=(t,s,o)=>t+(s-t)*o;function _p(t,s,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?t+(s-t)*6*o:o<1/2?s:o<2/3?t+(s-t)*(2/3-o)*6:t}function D4({hue:t,saturation:s,lightness:o,alpha:r}){t/=360,s/=100,o/=100;let c=0,d=0,u=0;if(!s)c=d=u=o;else{const f=o<.5?o*(1+s):o+s-o*s,m=2*o-f;c=_p(m,f,t+1/3),d=_p(m,f,t),u=_p(m,f,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function vd(t,s){return o=>o>0?s:t}const xp=(t,s,o)=>{const r=t*t,c=o*(s*s-r)+r;return c<0?0:Math.sqrt(c)},M4=[tm,Ci,Ro],R4=t=>M4.find(s=>s.test(t));function ob(t){const s=R4(t);if(!s)return!1;let o=s.parse(t);return s===Ro&&(o=D4(o)),o}const rb=(t,s)=>{const o=ob(t),r=ob(s);if(!o||!r)return vd(t,s);const c={...o};return d=>(c.red=xp(o.red,r.red,d),c.green=xp(o.green,r.green,d),c.blue=xp(o.blue,r.blue,d),c.alpha=Dt(o.alpha,r.alpha,d),Ci.transform(c))},I4=(t,s)=>o=>s(t(o)),kl=(...t)=>t.reduce(I4),om=new Set(["none","hidden"]);function O4(t,s){return om.has(t)?o=>o<=0?t:s:o=>o>=1?s:t}function L4(t,s){return o=>Dt(t,s,o)}function mh(t){return typeof t=="number"?L4:typeof t=="string"?Zm(t)?vd:hn.test(t)?rb:$4:Array.isArray(t)?j1:typeof t=="object"?hn.test(t)?rb:B4:vd}function j1(t,s){const o=[...t],r=o.length,c=t.map((d,u)=>mh(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)o[u]=c[u](d);return o}}function B4(t,s){const o={...t,...s},r={};for(const c in o)t[c]!==void 0&&s[c]!==void 0&&(r[c]=mh(t[c])(t[c],s[c]));return c=>{for(const d in r)o[d]=r[d](c);return o}}function z4(t,s){var o;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],f=t.indexes[u][c[u]],m=(o=t.values[f])!==null&&o!==void 0?o:0;r[d]=m,c[u]++}return r}const $4=(t,s)=>{const o=ti.createTransformer(s),r=ul(t),c=ul(s);return r.indexes.var.length===c.indexes.var.length&&r.indexes.color.length===c.indexes.color.length&&r.indexes.number.length>=c.indexes.number.length?om.has(t)&&!c.values.length||om.has(s)&&!r.values.length?O4(t,s):kl(j1(z4(r,c),c.values),o):vd(t,s)};function T1(t,s,o){return typeof t=="number"&&typeof s=="number"&&typeof o=="number"?Dt(t,s,o):mh(t)(t,s)}const H4=5;function N1(t,s,o){const r=Math.max(s-H4,0);return Yx(o-t(r),s-r)}const Ot={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},kp=.001;function P4({duration:t=Ot.duration,bounce:s=Ot.bounce,velocity:o=Ot.velocity,mass:r=Ot.mass}){let c,d,u=1-s;u=ha(Ot.minDamping,Ot.maxDamping,u),t=ha(Ot.minDuration,Ot.maxDuration,pa(t)),u<1?(c=h=>{const v=h*u,b=v*t,_=v-o,x=rm(h,u),S=Math.exp(-b);return kp-_/x*S},d=h=>{const b=h*u*t,_=b*o+o,x=Math.pow(u,2)*Math.pow(h,2)*t,S=Math.exp(-b),j=rm(Math.pow(h,2),u);return(-c(h)+kp>0?-1:1)*((_-x)*S)/j}):(c=h=>{const v=Math.exp(-h*t),b=(h-o)*t+1;return-kp+v*b},d=h=>{const v=Math.exp(-h*t),b=(o-h)*(t*t);return v*b});const f=5/t,m=V4(c,d,f);if(t=fa(t),isNaN(m))return{stiffness:Ot.stiffness,damping:Ot.damping,duration:t};{const h=Math.pow(m,2)*r;return{stiffness:h,damping:u*2*Math.sqrt(r*h),duration:t}}}const U4=12;function V4(t,s,o){let r=o;for(let c=1;c<U4;c++)r=r-t(r)/s(r);return r}function rm(t,s){return t*Math.sqrt(1-s*s)}const q4=["duration","bounce"],G4=["stiffness","damping","mass"];function lb(t,s){return s.some(o=>t[o]!==void 0)}function F4(t){let s={velocity:Ot.velocity,stiffness:Ot.stiffness,damping:Ot.damping,mass:Ot.mass,isResolvedFromDuration:!1,...t};if(!lb(t,G4)&&lb(t,q4))if(t.visualDuration){const o=t.visualDuration,r=2*Math.PI/(o*1.2),c=r*r,d=2*ha(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Ot.mass,stiffness:c,damping:d}}else{const o=P4(t);s={...s,...o,mass:Ot.mass},s.isResolvedFromDuration=!0}return s}function w1(t=Ot.visualDuration,s=Ot.bounce){const o=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=o;const d=o.keyframes[0],u=o.keyframes[o.keyframes.length-1],f={done:!1,value:d},{stiffness:m,damping:h,mass:v,duration:b,velocity:_,isResolvedFromDuration:x}=F4({...o,velocity:-pa(o.velocity||0)}),S=_||0,j=h/(2*Math.sqrt(m*v)),T=u-d,N=pa(Math.sqrt(m/v)),C=Math.abs(T)<5;r||(r=C?Ot.restSpeed.granular:Ot.restSpeed.default),c||(c=C?Ot.restDelta.granular:Ot.restDelta.default);let D;if(j<1){const E=rm(N,j);D=R=>{const L=Math.exp(-j*N*R);return u-L*((S+j*N*T)/E*Math.sin(E*R)+T*Math.cos(E*R))}}else if(j===1)D=E=>u-Math.exp(-N*E)*(T+(S+N*T)*E);else{const E=N*Math.sqrt(j*j-1);D=R=>{const L=Math.exp(-j*N*R),M=Math.min(E*R,300);return u-L*((S+j*N*T)*Math.sinh(M)+E*T*Math.cosh(M))/E}}const A={calculatedDuration:x&&b||null,next:E=>{const R=D(E);if(x)f.done=E>=b;else{let L=0;j<1&&(L=E===0?fa(S):N1(D,E,R));const M=Math.abs(L)<=r,$=Math.abs(u-R)<=c;f.done=M&&$}return f.value=f.done?u:R,f},toString:()=>{const E=Math.min(S1(A),im),R=Wx(L=>A.next(E*L).value,E,30);return E+"ms "+R}};return A}function cb({keyframes:t,velocity:s=0,power:o=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:f,max:m,restDelta:h=.5,restSpeed:v}){const b=t[0],_={done:!1,value:b},x=M=>f!==void 0&&M<f||m!==void 0&&M>m,S=M=>f===void 0?m:m===void 0||Math.abs(f-M)<Math.abs(m-M)?f:m;let j=o*s;const T=b+j,N=u===void 0?T:u(T);N!==T&&(j=N-b);const C=M=>-j*Math.exp(-M/r),D=M=>N+C(M),A=M=>{const $=C(M),Y=D(M);_.done=Math.abs($)<=h,_.value=_.done?N:Y};let E,R;const L=M=>{x(_.value)&&(E=M,R=w1({keyframes:[_.value,S(_.value)],velocity:N1(D,M,_.value),damping:c,stiffness:d,restDelta:h,restSpeed:v}))};return L(0),{calculatedDuration:null,next:M=>{let $=!1;return!R&&E===void 0&&($=!0,A(M),L(M)),E!==void 0&&M>=E?R.next(M-E):(!$&&A(M),_)}}}const K4=xl(.42,0,1,1),Z4=xl(0,0,.58,1),C1=xl(.42,0,.58,1),Y4=t=>Array.isArray(t)&&typeof t[0]!="number",J4={linear:$n,easeIn:K4,easeInOut:C1,easeOut:Z4,circIn:ch,circInOut:r1,circOut:o1,backIn:lh,backInOut:a1,backOut:s1,anticipate:i1},db=t=>{if(rh(t)){Cx(t.length===4);const[s,o,r,c]=t;return xl(s,o,r,c)}else if(typeof t=="string")return J4[t];return t};function W4(t,s,o){const r=[],c=o||T1,d=t.length-1;for(let u=0;u<d;u++){let f=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||$n:s;f=kl(m,f)}r.push(f)}return r}function X4(t,s,{clamp:o=!0,ease:r,mixer:c}={}){const d=t.length;if(Cx(d===s.length),d===1)return()=>s[0];if(d===2&&s[0]===s[1])return()=>s[1];const u=t[0]===t[1];t[0]>t[d-1]&&(t=[...t].reverse(),s=[...s].reverse());const f=W4(s,r,c),m=f.length,h=v=>{if(u&&v<t[0])return s[0];let b=0;if(m>1)for(;b<t.length-2&&!(v<t[b+1]);b++);const _=qo(t[b],t[b+1],v);return f[b](_)};return o?v=>h(ha(t[0],t[d-1],v)):h}function Q4(t,s){const o=t[t.length-1];for(let r=1;r<=s;r++){const c=qo(0,s,r);t.push(Dt(o,1,c))}}function eR(t){const s=[0];return Q4(s,t.length-1),s}function tR(t,s){return t.map(o=>o*s)}function nR(t,s){return t.map(()=>s||C1).splice(0,t.length-1)}function yd({duration:t=300,keyframes:s,times:o,ease:r="easeInOut"}){const c=Y4(r)?r.map(db):db(r),d={done:!1,value:s[0]},u=tR(o&&o.length===s.length?o:eR(s),t),f=X4(u,s,{ease:Array.isArray(c)?c:nR(s,c)});return{calculatedDuration:t,next:m=>(d.value=f(m),d.done=m>=t,d)}}const sR=t=>{const s=({timestamp:o})=>t(o);return{start:()=>wt.update(s,!0),stop:()=>ei(s),now:()=>pn.isProcessing?pn.timestamp:Ls.now()}},aR={decay:cb,inertia:cb,tween:yd,keyframes:yd,spring:w1},iR=t=>t/100;class hh extends k1{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:m}=this.options;m&&m()};const{name:o,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||ph,f=(m,h)=>this.onKeyframesResolved(m,h);this.resolver=new u(d,f,o,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:o="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,f=oh(o)?o:aR[o]||yd;let m,h;f!==yd&&typeof s[0]!="number"&&(m=kl(iR,T1(s[0],s[1])),s=[0,100]);const v=f({...this.options,keyframes:s});d==="mirror"&&(h=f({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=S1(v));const{calculatedDuration:b}=v,_=b+c,x=_*(r+1)-c;return{generator:v,mirroredGenerator:h,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:x}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,o=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:f,keyframes:m,calculatedDuration:h,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:x,repeatType:S,repeatDelay:j,onUpdate:T}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),o?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const N=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?N<0:N>v;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let D=this.currentTime,A=d;if(x){const M=Math.min(this.currentTime,v)/b;let $=Math.floor(M),Y=M%1;!Y&&M>=1&&(Y=1),Y===1&&$--,$=Math.min($,x+1),!!($%2)&&(S==="reverse"?(Y=1-Y,j&&(Y-=j/b)):S==="mirror"&&(A=u)),D=ha(0,1,Y)*b}const E=C?{done:!1,value:m[0]}:A.next(D);f&&(E.value=f(E.value));let{done:R}=E;!C&&h!==null&&(R=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const L=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return L&&c!==void 0&&(E.value=Bd(m,this.options,c)),T&&T(E.value),L&&this.finish(),E}get duration(){const{resolved:s}=this;return s?pa(s.calculatedDuration):0}get time(){return pa(this.currentTime)}set time(s){s=fa(s),this.currentTime=s,this.holdTime!==null||this.speed===0?this.holdTime=s:this.driver&&(this.startTime=this.driver.now()-s/this.speed)}get speed(){return this.playbackSpeed}set speed(s){const o=this.playbackSpeed!==s;this.playbackSpeed=s,o&&(this.time=pa(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=sR,onPlay:o,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),o&&o();const c=this.driver.now();this.holdTime!==null?this.startTime=c-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=c):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var s;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(s=this.currentTime)!==null&&s!==void 0?s:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:s}=this.options;s&&s()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(s){return this.startTime=0,this.tick(s,!0)}}const oR=new Set(["opacity","clipPath","filter","transform"]);function rR(t,s,o,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:f="easeInOut",times:m}={}){const h={[s]:o};m&&(h.offset=m);const v=Qx(f,c);return Array.isArray(v)&&(h.easing=v),t.animate(h,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const lR=ih(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),bd=10,cR=2e4;function dR(t){return oh(t.type)||t.type==="spring"||!Xx(t.ease)}function uR(t,s){const o=new hh({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:t[0]};const c=[];let d=0;for(;!r.done&&d<cR;)r=o.sample(d),c.push(r.value),d+=bd;return{times:void 0,keyframes:c,duration:d-bd,ease:"linear"}}const E1={anticipate:i1,backInOut:a1,circInOut:r1};function fR(t){return t in E1}class ub extends k1{constructor(s){super(s);const{name:o,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new x1(d,(u,f)=>this.onKeyframesResolved(u,f),o,r,c),this.resolver.scheduleResolve()}initPlayback(s,o){let{duration:r=300,times:c,ease:d,type:u,motionValue:f,name:m,startTime:h}=this.options;if(!f.owner||!f.owner.current)return!1;if(typeof d=="string"&&gd()&&fR(d)&&(d=E1[d]),dR(this.options)){const{onComplete:b,onUpdate:_,motionValue:x,element:S,...j}=this.options,T=uR(s,j);s=T.keyframes,s.length===1&&(s[1]=s[0]),r=T.duration,c=T.times,d=T.ease,u="keyframes"}const v=rR(f.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=h??this.calcStartTime(),this.pendingTimeline?(Qy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;f.set(Bd(s,this.options,o)),b&&b(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:r,times:c,type:u,ease:d,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:o}=s;return pa(o)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:o}=s;return pa(o.currentTime||0)}set time(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.currentTime=fa(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:o}=s;return o.playbackRate}set speed(s){const{resolved:o}=this;if(!o)return;const{animation:r}=o;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:o}=s;return o.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:o}=s;return o.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:o}=this;if(!o)return $n;const{animation:r}=o;Qy(r,s)}return $n}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.playState==="finished"&&this.updateFinishedPromise(),o.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:o}=s;o.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:s}=this;if(!s)return;const{animation:o,keyframes:r,duration:c,type:d,ease:u,times:f}=s;if(o.playState==="idle"||o.playState==="finished")return;if(this.time){const{motionValue:h,onUpdate:v,onComplete:b,element:_,...x}=this.options,S=new hh({...x,keyframes:r,duration:c,type:d,ease:u,times:f,isGenerator:!0}),j=fa(this.time);h.setWithVelocity(S.sample(j-bd).value,S.sample(j).value,bd)}const{onStop:m}=this.options;m&&m(),this.cancel()}complete(){const{resolved:s}=this;s&&s.animation.finish()}cancel(){const{resolved:s}=this;s&&s.animation.cancel()}static supports(s){const{motionValue:o,name:r,repeatDelay:c,repeatType:d,damping:u,type:f}=s;if(!o||!o.owner||!(o.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:h}=o.owner.getProps();return lR()&&r&&oR.has(r)&&!m&&!h&&!c&&d!=="mirror"&&u!==0&&f!=="inertia"}}const pR={type:"spring",stiffness:500,damping:25,restSpeed:10},mR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),hR={type:"keyframes",duration:.8},gR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},vR=(t,{keyframes:s})=>s.length>2?hR:Li.has(t)?t.startsWith("scale")?mR(s[1]):pR:gR;function yR({when:t,delay:s,delayChildren:o,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:f,from:m,elapsed:h,...v}){return!!Object.keys(v).length}const gh=(t,s,o,r={},c,d)=>u=>{const f=th(r,t)||{},m=f.delay||r.delay||0;let{elapsed:h=0}=r;h=h-fa(m);let v={keyframes:Array.isArray(o)?o:[null,o],ease:"easeOut",velocity:s.getVelocity(),...f,delay:-h,onUpdate:_=>{s.set(_),f.onUpdate&&f.onUpdate(_)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:t,motionValue:s,element:d?void 0:c};yR(f)||(v={...v,...vR(t,v)}),v.duration&&(v.duration=fa(v.duration)),v.repeatDelay&&(v.repeatDelay=fa(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let b=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(b=!0)),b&&!d&&s.get()!==void 0){const _=Bd(v.keyframes,f);if(_!==void 0)return wt.update(()=>{v.onUpdate(_),v.onComplete()}),new JM([])}return!d&&ub.supports(v)?new ub(v):new hh(v)};function bR({protectedKeys:t,needsAnimating:s},o){const r=t.hasOwnProperty(o)&&s[o]!==!0;return s[o]=!1,r}function A1(t,s,{delay:o=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:f,...m}=s;r&&(u=r);const h=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const b in m){const _=t.getValue(b,(d=t.latestValues[b])!==null&&d!==void 0?d:null),x=m[b];if(x===void 0||v&&bR(v,b))continue;const S={delay:o,...th(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const N=Jx(t);if(N){const C=window.MotionHandoffAnimation(N,b,wt);C!==null&&(S.startTime=C,j=!0)}}Qp(t,b),_.start(gh(b,_,x,t.shouldReduceMotion&&Zx.has(b)?{type:!1}:S,t,j));const T=_.animation;T&&h.push(T)}return f&&Promise.all(h).then(()=>{wt.update(()=>{f&&FM(t,f)})}),h}function lm(t,s,o={}){var r;const c=Ld(t,s,o.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};o.transitionOverride&&(d=o.transitionOverride);const u=c?()=>Promise.all(A1(t,c,o)):()=>Promise.resolve(),f=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return _R(t,s,v+h,b,_,o)}:()=>Promise.resolve(),{when:m}=d;if(m){const[h,v]=m==="beforeChildren"?[u,f]:[f,u];return h().then(()=>v())}else return Promise.all([u(),f(o.delay)])}function _R(t,s,o=0,r=0,c=1,d){const u=[],f=(t.variantChildren.size-1)*r,m=c===1?(h=0)=>h*r:(h=0)=>f-h*r;return Array.from(t.variantChildren).sort(xR).forEach((h,v)=>{h.notify("AnimationStart",s),u.push(lm(h,s,{...d,delay:o+m(v)}).then(()=>h.notify("AnimationComplete",s)))}),Promise.all(u)}function xR(t,s){return t.sortNodePosition(s)}function kR(t,s,o={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>lm(t,d,o));r=Promise.all(c)}else if(typeof s=="string")r=lm(t,s,o);else{const c=typeof s=="function"?Ld(t,s,o.custom):s;r=Promise.all(A1(t,c,o))}return r.then(()=>{t.notify("AnimationComplete",s)})}const SR=Vm.length;function D1(t){if(!t)return;if(!t.isControllingVariants){const o=t.parent?D1(t.parent)||{}:{};return t.props.initial!==void 0&&(o.initial=t.props.initial),o}const s={};for(let o=0;o<SR;o++){const r=Vm[o],c=t.props[r];(ll(c)||c===!1)&&(s[r]=c)}return s}const jR=[...Um].reverse(),TR=Um.length;function NR(t){return s=>Promise.all(s.map(({animation:o,options:r})=>kR(t,o,r)))}function wR(t){let s=NR(t),o=fb(),r=!0;const c=m=>(h,v)=>{var b;const _=Ld(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:x,transitionEnd:S,...j}=_;h={...h,...j,...S}}return h};function d(m){s=m(t)}function u(m){const{props:h}=t,v=D1(t.parent)||{},b=[],_=new Set;let x={},S=1/0;for(let T=0;T<TR;T++){const N=jR[T],C=o[N],D=h[N]!==void 0?h[N]:v[N],A=ll(D),E=N===m?C.isActive:null;E===!1&&(S=T);let R=D===v[N]&&D!==h[N]&&A;if(R&&r&&t.manuallyAnimateOnMount&&(R=!1),C.protectedKeys={...x},!C.isActive&&E===null||!D&&!C.prevProp||Id(D)||typeof D=="boolean")continue;const L=CR(C.prevProp,D);let M=L||N===m&&C.isActive&&!R&&A||T>S&&A,$=!1;const Y=Array.isArray(D)?D:[D];let U=Y.reduce(c(N),{});E===!1&&(U={});const{prevResolvedValues:X={}}=C,te={...X,...U},G=O=>{M=!0,_.has(O)&&($=!0,_.delete(O)),C.needsAnimating[O]=!0;const q=t.getValue(O);q&&(q.liveStyle=!1)};for(const O in te){const q=U[O],ge=X[O];if(x.hasOwnProperty(O))continue;let se=!1;Xp(q)&&Xp(ge)?se=!Kx(q,ge):se=q!==ge,se?q!=null?G(O):_.add(O):q!==void 0&&_.has(O)?G(O):C.protectedKeys[O]=!0}C.prevProp=D,C.prevResolvedValues=U,C.isActive&&(x={...x,...U}),r&&t.blockInitialAnimation&&(M=!1),M&&(!(R&&L)||$)&&b.push(...Y.map(O=>({animation:O,options:{type:N}})))}if(_.size){const T={};_.forEach(N=>{const C=t.getBaseTarget(N),D=t.getValue(N);D&&(D.liveStyle=!0),T[N]=C??null}),b.push({animation:T})}let j=!!b.length;return r&&(h.initial===!1||h.initial===h.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(b):Promise.resolve()}function f(m,h){var v;if(o[m].isActive===h)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(_=>{var x;return(x=_.animationState)===null||x===void 0?void 0:x.setActive(m,h)}),o[m].isActive=h;const b=u(m);for(const _ in o)o[_].protectedKeys={};return b}return{animateChanges:u,setActive:f,setAnimateFunction:d,getState:()=>o,reset:()=>{o=fb(),r=!0}}}function CR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!Kx(s,t):!1}function Si(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fb(){return{animate:Si(!0),whileInView:Si(),whileHover:Si(),whileTap:Si(),whileDrag:Si(),whileFocus:Si(),exit:Si()}}class si{constructor(s){this.isMounted=!1,this.node=s}update(){}}class ER extends si{constructor(s){super(s),s.animationState||(s.animationState=wR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();Id(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:o}=this.node.prevProps||{};s!==o&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let AR=0;class DR extends si{constructor(){super(...arguments),this.id=AR++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:o}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);o&&!s&&c.then(()=>o(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const MR={animation:{Feature:ER},exit:{Feature:DR}},ys={x:!1,y:!1};function M1(){return ys.x||ys.y}function RR(t){return t==="x"||t==="y"?ys[t]?null:(ys[t]=!0,()=>{ys[t]=!1}):ys.x||ys.y?null:(ys.x=ys.y=!0,()=>{ys.x=ys.y=!1})}const vh=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function fl(t,s,o,r={passive:!0}){return t.addEventListener(s,o,r),()=>t.removeEventListener(s,o)}function Sl(t){return{point:{x:t.pageX,y:t.pageY}}}const IR=t=>s=>vh(s)&&t(s,Sl(s));function el(t,s,o,r){return fl(t,s,IR(o),r)}const pb=(t,s)=>Math.abs(t-s);function OR(t,s){const o=pb(t.x,s.x),r=pb(t.y,s.y);return Math.sqrt(o**2+r**2)}class R1{constructor(s,o,{transformPagePoint:r,contextWindow:c,dragSnapToOrigin:d=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=jp(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,x=OR(b.offset,{x:0,y:0})>=3;if(!_&&!x)return;const{point:S}=b,{timestamp:j}=pn;this.history.push({...S,timestamp:j});const{onStart:T,onMove:N}=this.handlers;_||(T&&T(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),N&&N(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=Sp(_,this.transformPagePoint),wt.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:x,onSessionEnd:S,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=jp(b.type==="pointercancel"?this.lastMoveEventInfo:Sp(_,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,T),S&&S(b,T)},!vh(s))return;this.dragSnapToOrigin=d,this.handlers=o,this.transformPagePoint=r,this.contextWindow=c||window;const u=Sl(s),f=Sp(u,this.transformPagePoint),{point:m}=f,{timestamp:h}=pn;this.history=[{...m,timestamp:h}];const{onSessionStart:v}=o;v&&v(s,jp(f,this.history)),this.removeListeners=kl(el(this.contextWindow,"pointermove",this.handlePointerMove),el(this.contextWindow,"pointerup",this.handlePointerUp),el(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),ei(this.updatePoint)}}function Sp(t,s){return s?{point:s(t.point)}:t}function mb(t,s){return{x:t.x-s.x,y:t.y-s.y}}function jp({point:t},s){return{point:t,delta:mb(t,I1(s)),offset:mb(t,LR(s)),velocity:BR(s,.1)}}function LR(t){return t[0]}function I1(t){return t[t.length-1]}function BR(t,s){if(t.length<2)return{x:0,y:0};let o=t.length-1,r=null;const c=I1(t);for(;o>=0&&(r=t[o],!(c.timestamp-r.timestamp>fa(s)));)o--;if(!r)return{x:0,y:0};const d=pa(c.timestamp-r.timestamp);if(d===0)return{x:0,y:0};const u={x:(c.x-r.x)/d,y:(c.y-r.y)/d};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}const O1=1e-4,zR=1-O1,$R=1+O1,L1=.01,HR=0-L1,PR=0+L1;function Hn(t){return t.max-t.min}function UR(t,s,o){return Math.abs(t-s)<=o}function hb(t,s,o,r=.5){t.origin=r,t.originPoint=Dt(s.min,s.max,t.origin),t.scale=Hn(o)/Hn(s),t.translate=Dt(o.min,o.max,t.origin)-t.originPoint,(t.scale>=zR&&t.scale<=$R||isNaN(t.scale))&&(t.scale=1),(t.translate>=HR&&t.translate<=PR||isNaN(t.translate))&&(t.translate=0)}function tl(t,s,o,r){hb(t.x,s.x,o.x,r?r.originX:void 0),hb(t.y,s.y,o.y,r?r.originY:void 0)}function gb(t,s,o){t.min=o.min+s.min,t.max=t.min+Hn(s)}function VR(t,s,o){gb(t.x,s.x,o.x),gb(t.y,s.y,o.y)}function vb(t,s,o){t.min=s.min-o.min,t.max=t.min+Hn(s)}function nl(t,s,o){vb(t.x,s.x,o.x),vb(t.y,s.y,o.y)}function qR(t,{min:s,max:o},r){return s!==void 0&&t<s?t=r?Dt(s,t,r.min):Math.max(t,s):o!==void 0&&t>o&&(t=r?Dt(o,t,r.max):Math.min(t,o)),t}function yb(t,s,o){return{min:s!==void 0?t.min+s:void 0,max:o!==void 0?t.max+o-(t.max-t.min):void 0}}function GR(t,{top:s,left:o,bottom:r,right:c}){return{x:yb(t.x,o,c),y:yb(t.y,s,r)}}function bb(t,s){let o=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([o,r]=[r,o]),{min:o,max:r}}function FR(t,s){return{x:bb(t.x,s.x),y:bb(t.y,s.y)}}function KR(t,s){let o=.5;const r=Hn(t),c=Hn(s);return c>r?o=qo(s.min,s.max-r,t.min):r>c&&(o=qo(t.min,t.max-c,s.min)),ha(0,1,o)}function ZR(t,s){const o={};return s.min!==void 0&&(o.min=s.min-t.min),s.max!==void 0&&(o.max=s.max-t.min),o}const cm=.35;function YR(t=cm){return t===!1?t=0:t===!0&&(t=cm),{x:_b(t,"left","right"),y:_b(t,"top","bottom")}}function _b(t,s,o){return{min:xb(t,s),max:xb(t,o)}}function xb(t,s){return typeof t=="number"?t:t[s]||0}const kb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Io=()=>({x:kb(),y:kb()}),Sb=()=>({min:0,max:0}),zt=()=>({x:Sb(),y:Sb()});function is(t){return[t("x"),t("y")]}function B1({top:t,left:s,right:o,bottom:r}){return{x:{min:s,max:o},y:{min:t,max:r}}}function JR({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function WR(t,s){if(!s)return t;const o=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:o.y,left:o.x,bottom:r.y,right:r.x}}function Tp(t){return t===void 0||t===1}function dm({scale:t,scaleX:s,scaleY:o}){return!Tp(t)||!Tp(s)||!Tp(o)}function Ni(t){return dm(t)||z1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function z1(t){return jb(t.x)||jb(t.y)}function jb(t){return t&&t!=="0%"}function _d(t,s,o){const r=t-o,c=s*r;return o+c}function Tb(t,s,o,r,c){return c!==void 0&&(t=_d(t,c,r)),_d(t,o,r)+s}function um(t,s=0,o=1,r,c){t.min=Tb(t.min,s,o,r,c),t.max=Tb(t.max,s,o,r,c)}function $1(t,{x:s,y:o}){um(t.x,s.translate,s.scale,s.originPoint),um(t.y,o.translate,o.scale,o.originPoint)}const Nb=.999999999999,wb=1.0000000000001;function XR(t,s,o,r=!1){const c=o.length;if(!c)return;s.x=s.y=1;let d,u;for(let f=0;f<c;f++){d=o[f],u=d.projectionDelta;const{visualElement:m}=d.options;m&&m.props.style&&m.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Lo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,$1(t,u)),r&&Ni(d.latestValues)&&Lo(t,d.latestValues))}s.x<wb&&s.x>Nb&&(s.x=1),s.y<wb&&s.y>Nb&&(s.y=1)}function Oo(t,s){t.min=t.min+s,t.max=t.max+s}function Cb(t,s,o,r,c=.5){const d=Dt(t.min,t.max,c);um(t,s,o,d,r)}function Lo(t,s){Cb(t.x,s.x,s.scaleX,s.scale,s.originX),Cb(t.y,s.y,s.scaleY,s.scale,s.originY)}function H1(t,s){return B1(WR(t.getBoundingClientRect(),s))}function QR(t,s,o){const r=H1(t,o),{scroll:c}=s;return c&&(Oo(r.x,c.offset.x),Oo(r.y,c.offset.y)),r}const P1=({current:t})=>t?t.ownerDocument.defaultView:null,e3=new WeakMap;class t3{constructor(s){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=zt(),this.visualElement=s}start(s,{snapToCursor:o=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),o&&this.snapToCursor(Sl(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:x,onDragStart:S}=this.getProps();if(_&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=RR(_),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),is(T=>{let N=this.getAxisMotionValue(T).get()||0;if(Os.test(N)){const{projection:C}=this.visualElement;if(C&&C.layout){const D=C.layout.layoutBox[T];D&&(N=Hn(D)*(parseFloat(N)/100))}}this.originPoint[T]=N}),S&&wt.postRender(()=>S(v,b)),Qp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:x,onDirectionLock:S,onDrag:j}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:T}=b;if(x&&this.currentDirection===null){this.currentDirection=n3(T),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,T),this.updateAxis("y",b.point,T),this.visualElement.render(),j&&j(v,b)},f=(v,b)=>this.stop(v,b),m=()=>is(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:h}=this.getProps();this.panSession=new R1(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:f,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:h,contextWindow:P1(this.visualElement)})}stop(s,o){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=o;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&wt.postRender(()=>d(s,o))}cancel(){this.isDragging=!1;const{projection:s,animationState:o}=this.visualElement;s&&(s.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),o&&o.setActive("whileDrag",!1)}updateAxis(s,o,r){const{drag:c}=this.getProps();if(!r||!Kc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=qR(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:o,dragElastic:r}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)===null||s===void 0?void 0:s.layout,d=this.constraints;o&&Mo(o)?this.constraints||(this.constraints=this.resolveRefConstraints()):o&&c?this.constraints=GR(c.layoutBox,o):this.constraints=!1,this.elastic=YR(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&is(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=ZR(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:o}=this.getProps();if(!s||!Mo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=QR(r,c.root,this.visualElement.getTransformPagePoint());let u=FR(c.layout.layoutBox,d);if(o){const f=o(JR(u));this.hasMutatedConstraints=!!f,f&&(u=B1(f))}return u}startAnimation(s){const{drag:o,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},h=is(v=>{if(!Kc(v,o,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,x=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(h).then(f)}startAxisValueAnimation(s,o){const r=this.getAxisMotionValue(s);return Qp(this.visualElement,s),r.start(gh(s,r,0,o,this.visualElement,!1))}stopAnimation(){is(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){is(s=>{var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.pause()})}getAnimationState(s){var o;return(o=this.getAxisMotionValue(s).animation)===null||o===void 0?void 0:o.state}getAxisMotionValue(s){const o=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[o];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){is(o=>{const{drag:r}=this.getProps();if(!Kc(o,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(o);if(c&&c.layout){const{min:u,max:f}=c.layout.layoutBox[o];d.set(s[o]-Dt(u,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:o}=this.getProps(),{projection:r}=this.visualElement;if(!Mo(o)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};is(u=>{const f=this.getAxisMotionValue(u);if(f&&this.constraints!==!1){const m=f.get();c[u]=KR({min:m,max:m},this.constraints[u])}});const{transformTemplate:d}=this.visualElement.getProps();this.visualElement.current.style.transform=d?d({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),is(u=>{if(!Kc(u,s,null))return;const f=this.getAxisMotionValue(u),{min:m,max:h}=this.constraints[u];f.set(Dt(m,h,c[u]))})}addListeners(){if(!this.visualElement.current)return;e3.set(this.visualElement,this);const s=this.visualElement.current,o=el(s,"pointerdown",m=>{const{drag:h,dragListener:v=!0}=this.getProps();h&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();Mo(m)&&m.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),wt.read(r);const u=fl(window,"resize",()=>this.scalePositionWithinConstraints()),f=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:h})=>{this.isDragging&&h&&(is(v=>{const b=this.getAxisMotionValue(v);b&&(this.originPoint[v]+=m[v].translate,b.set(b.get()+m[v].translate))}),this.visualElement.render())}));return()=>{u(),o(),d(),f&&f()}}getProps(){const s=this.visualElement.getProps(),{drag:o=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=cm,dragMomentum:f=!0}=s;return{...s,drag:o,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:f}}}function Kc(t,s,o){return(s===!0||s===t)&&(o===null||o===t)}function n3(t,s=10){let o=null;return Math.abs(t.y)>s?o="y":Math.abs(t.x)>s&&(o="x"),o}class s3 extends si{constructor(s){super(s),this.removeGroupControls=$n,this.removeListeners=$n,this.controls=new t3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||$n}unmount(){this.removeGroupControls(),this.removeListeners()}}const Eb=t=>(s,o)=>{t&&wt.postRender(()=>t(s,o))};class a3 extends si{constructor(){super(...arguments),this.removePointerDownListener=$n}onPointerDown(s){this.session=new R1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:P1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:o,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:Eb(s),onStart:Eb(o),onMove:r,onEnd:(d,u)=>{delete this.session,c&&wt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=el(this.node.current,"pointerdown",s=>this.onPointerDown(s))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const rd={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ab(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Vr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const o=Ab(t,s.target.x),r=Ab(t,s.target.y);return`${o}% ${r}%`}},i3={correct:(t,{treeScale:s,projectionDelta:o})=>{const r=t,c=ti.parse(t);if(c.length>5)return r;const d=ti.createTransformer(t),u=typeof c[0]!="number"?1:0,f=o.x.scale*s.x,m=o.y.scale*s.y;c[0+u]/=f,c[1+u]/=m;const h=Dt(f,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=h),typeof c[3+u]=="number"&&(c[3+u]/=h),d(c)}};class o3 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;MM(r3),d&&(o.group&&o.group.add(d),r&&r.register&&c&&r.register(d),d.root.didUpdate(),d.addEventListener("animationComplete",()=>{this.safeToRemove()}),d.setOptions({...d.options,onExitComplete:()=>this.safeToRemove()})),rd.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:o,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==o||o===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||wt.postRender(()=>{const f=u.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),Gm.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:o,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),o&&o.group&&o.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function U1(t){const[s,o]=Nx(),r=y.useContext(zm);return a.jsx(o3,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(Ix),isPresent:s,safeToRemove:o})}const r3={borderRadius:{...Vr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Vr,borderTopRightRadius:Vr,borderBottomLeftRadius:Vr,borderBottomRightRadius:Vr,boxShadow:i3};function l3(t,s,o){const r=vn(t)?t:dl(t);return r.start(gh("",r,s,o)),r.animation}function c3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const d3=(t,s)=>t.depth-s.depth;class u3{constructor(){this.children=[],this.isDirty=!1}add(s){nh(this.children,s),this.isDirty=!0}remove(s){sh(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(d3),this.isDirty=!1,this.children.forEach(s)}}function f3(t,s){const o=Ls.now(),r=({timestamp:c})=>{const d=c-o;d>=s&&(ei(r),t(d-s))};return wt.read(r,!0),()=>ei(r)}const V1=["TopLeft","TopRight","BottomLeft","BottomRight"],p3=V1.length,Db=t=>typeof t=="string"?parseFloat(t):t,Mb=t=>typeof t=="number"||Ae.test(t);function m3(t,s,o,r,c,d){c?(t.opacity=Dt(0,o.opacity!==void 0?o.opacity:1,h3(r)),t.opacityExit=Dt(s.opacity!==void 0?s.opacity:1,0,g3(r))):d&&(t.opacity=Dt(s.opacity!==void 0?s.opacity:1,o.opacity!==void 0?o.opacity:1,r));for(let u=0;u<p3;u++){const f=`border${V1[u]}Radius`;let m=Rb(s,f),h=Rb(o,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||Mb(m)===Mb(h)?(t[f]=Math.max(Dt(Db(m),Db(h),r),0),(Os.test(h)||Os.test(m))&&(t[f]+="%")):t[f]=h}(s.rotate||o.rotate)&&(t.rotate=Dt(s.rotate||0,o.rotate||0,r))}function Rb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const h3=q1(0,.5,o1),g3=q1(.5,.95,$n);function q1(t,s,o){return r=>r<t?0:r>s?1:o(qo(t,s,r))}function Ib(t,s){t.min=s.min,t.max=s.max}function Qn(t,s){Ib(t.x,s.x),Ib(t.y,s.y)}function Ob(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Lb(t,s,o,r,c){return t-=s,t=_d(t,1/o,r),c!==void 0&&(t=_d(t,1/c,r)),t}function v3(t,s=0,o=1,r=.5,c,d=t,u=t){if(Os.test(s)&&(s=parseFloat(s),s=Dt(u.min,u.max,s/100)-u.min),typeof s!="number")return;let f=Dt(d.min,d.max,r);t===d&&(f-=s),t.min=Lb(t.min,s,o,f,c),t.max=Lb(t.max,s,o,f,c)}function Bb(t,s,[o,r,c],d,u){v3(t,s[o],s[r],s[c],s.scale,d,u)}const y3=["x","scaleX","originX"],b3=["y","scaleY","originY"];function zb(t,s,o,r){Bb(t.x,s,y3,o?o.x:void 0,r?r.x:void 0),Bb(t.y,s,b3,o?o.y:void 0,r?r.y:void 0)}function $b(t){return t.translate===0&&t.scale===1}function G1(t){return $b(t.x)&&$b(t.y)}function Hb(t,s){return t.min===s.min&&t.max===s.max}function _3(t,s){return Hb(t.x,s.x)&&Hb(t.y,s.y)}function Pb(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function F1(t,s){return Pb(t.x,s.x)&&Pb(t.y,s.y)}function Ub(t){return Hn(t.x)/Hn(t.y)}function Vb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class x3{constructor(){this.members=[]}add(s){nh(this.members,s),s.scheduleRender()}remove(s){if(sh(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const o=this.members[this.members.length-1];o&&this.promote(o)}}relegate(s){const o=this.members.findIndex(c=>s===c);if(o===0)return!1;let r;for(let c=o;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,o){const r=this.lead;if(s!==r&&(this.prevLead=r,this.lead=s,s.show(),r)){r.instance&&r.scheduleRender(),s.scheduleRender(),s.resumeFrom=r,o&&(s.resumeFrom.preserveOpacity=!0),r.snapshot&&(s.snapshot=r.snapshot,s.snapshot.latestValues=r.animationValues||r.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:o,resumingFrom:r}=s;o.onExitComplete&&o.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function k3(t,s,o){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(o==null?void 0:o.z)||0;if((c||d||u)&&(r=`translate3d(${c}px, ${d}px, ${u}px) `),(s.x!==1||s.y!==1)&&(r+=`scale(${1/s.x}, ${1/s.y}) `),o){const{transformPerspective:h,rotate:v,rotateX:b,rotateY:_,skewX:x,skewY:S}=o;h&&(r=`perspective(${h}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),x&&(r+=`skewX(${x}deg) `),S&&(r+=`skewY(${S}deg) `)}const f=t.x.scale*s.x,m=t.y.scale*s.y;return(f!==1||m!==1)&&(r+=`scale(${f}, ${m})`),r||"none"}const wi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Jr=typeof window<"u"&&window.MotionDebug!==void 0,Np=["","X","Y","Z"],S3={visibility:"hidden"},qb=1e3;let j3=0;function wp(t,s,o,r){const{latestValues:c}=s;c[t]&&(o[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function K1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const o=Jx(s);if(window.MotionHasOptimisedAnimation(o,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(o,"transform",wt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&K1(r)}function Z1({attachResizeListener:t,defaultParent:s,measureScroll:o,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},f=s==null?void 0:s()){this.id=j3++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Jr&&(wi.totalNodes=wi.resolvedTargetDeltas=wi.recalculatedProjection=0),this.nodes.forEach(w3),this.nodes.forEach(M3),this.nodes.forEach(R3),this.nodes.forEach(C3),Jr&&window.MotionDebug.record(wi)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new u3)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new ah),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const m=this.eventHandlers.get(u);m&&m.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,f=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=c3(u),this.instance=u;const{layoutId:m,layout:h,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),f&&(h||m)&&(this.isLayoutDirty=!0),t){let b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=f3(_,250),rd.hasAnimatedSinceResize&&(rd.hasAnimatedSinceResize=!1,this.nodes.forEach(Fb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||h)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:x,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||z3,{onLayoutAnimationStart:T,onLayoutAnimationComplete:N}=v.getProps(),C=!this.targetLayout||!F1(this.targetLayout,S)||x,D=!_&&x;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||D||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,D);const A={...th(j,"layout"),onPlay:T,onComplete:N};(v.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else _||Fb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,ei(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(I3),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&K1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const b=this.path[v];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Gb);return}this.isUpdating||this.nodes.forEach(A3),this.isUpdating=!1,this.nodes.forEach(D3),this.nodes.forEach(T3),this.nodes.forEach(N3),this.clearAllSnapshots();const f=Ls.now();pn.delta=ha(0,1e3/60,f-pn.timestamp),pn.timestamp=f,pn.isProcessing=!0,yp.update.process(pn),yp.preRender.process(pn),yp.render.process(pn),pn.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Gm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(E3),this.sharedNodes.forEach(O3)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=zt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(f=!1),f){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:o(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!G1(this.projectionDelta),m=this.getTransformTemplate(),h=m?m(this.latestValues,""):void 0,v=h!==this.prevTransformTemplateValue;u&&(f||Ni(this.latestValues)||v)&&(c(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return u&&(m=this.removeTransform(m)),$3(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:f}=this.options;if(!f)return zt();const m=f.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(H3))){const{scroll:v}=this.root;v&&(Oo(m.x,v.offset.x),Oo(m.y,v.offset.y))}return m}removeElementScroll(u){var f;const m=zt();if(Qn(m,u),!((f=this.scroll)===null||f===void 0)&&f.wasRoot)return m;for(let h=0;h<this.path.length;h++){const v=this.path[h],{scroll:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Qn(m,u),Oo(m.x,b.offset.x),Oo(m.y,b.offset.y))}return m}applyTransform(u,f=!1){const m=zt();Qn(m,u);for(let h=0;h<this.path.length;h++){const v=this.path[h];!f&&v.options.layoutScroll&&v.scroll&&v!==v.root&&Lo(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),Ni(v.latestValues)&&Lo(m,v.latestValues)}return Ni(this.latestValues)&&Lo(m,this.latestValues),m}removeTransform(u){const f=zt();Qn(f,u);for(let m=0;m<this.path.length;m++){const h=this.path[m];if(!h.instance||!Ni(h.latestValues))continue;dm(h.latestValues)&&h.updateSnapshot();const v=zt(),b=h.measurePageBox();Qn(v,b),zb(f,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,v)}return Ni(this.latestValues)&&zb(f,this.latestValues),f}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==pn.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var f;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==m;if(!(u||h&&this.isSharedProjectionDirty||this.isProjectionDirty||!((f=this.parent)===null||f===void 0)&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=pn.timestamp,!this.targetDelta&&!this.relativeTarget){const x=this.getClosestProjectingParent();x&&x.layout&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=zt(),this.relativeTargetOrigin=zt(),nl(this.relativeTargetOrigin,this.layout.layoutBox,x.layout.layoutBox),Qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=zt(),this.targetWithTransforms=zt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),VR(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Qn(this.target,this.layout.layoutBox),$1(this.target,this.targetDelta)):Qn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const x=this.getClosestProjectingParent();x&&!!x.resumingFrom==!!this.resumingFrom&&!x.options.layoutScroll&&x.target&&this.animationProgress!==1?(this.relativeParent=x,this.forceRelativeParentToResolveTarget(),this.relativeTarget=zt(),this.relativeTargetOrigin=zt(),nl(this.relativeTargetOrigin,this.target,x.target),Qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Jr&&wi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||dm(this.parent.latestValues)||z1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var u;const f=this.getLead(),m=!!this.resumingFrom||this!==f;let h=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(h=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===pn.timestamp&&(h=!1),h)return;const{layout:v,layoutId:b}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(v||b))return;Qn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,x=this.treeScale.y;XR(this.layoutCorrected,this.treeScale,this.path,m),f.layout&&!f.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(f.target=f.layout.layoutBox,f.targetWithTransforms=zt());const{target:S}=f;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Ob(this.prevProjectionDelta.x,this.projectionDelta.x),Ob(this.prevProjectionDelta.y,this.projectionDelta.y)),tl(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==x||!Vb(this.projectionDelta.x,this.prevProjectionDelta.x)||!Vb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Jr&&wi.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var f;if((f=this.options.visualElement)===null||f===void 0||f.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Io(),this.projectionDelta=Io(),this.projectionDeltaWithTransform=Io()}setAnimationOrigin(u,f=!1){const m=this.snapshot,h=m?m.latestValues:{},v={...this.latestValues},b=Io();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const _=zt(),x=m?m.source:void 0,S=this.layout?this.layout.source:void 0,j=x!==S,T=this.getStack(),N=!T||T.members.length<=1,C=!!(j&&!N&&this.options.crossfade===!0&&!this.path.some(B3));this.animationProgress=0;let D;this.mixTargetDelta=A=>{const E=A/1e3;Kb(b.x,u.x,E),Kb(b.y,u.y,E),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(nl(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),L3(this.relativeTarget,this.relativeTargetOrigin,_,E),D&&_3(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=zt()),Qn(D,this.relativeTarget)),j&&(this.animationValues=v,m3(v,h,this.latestValues,E,C,N)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=E},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(ei(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wt.update(()=>{rd.hasAnimatedSinceResize=!0,this.currentAnimation=l3(0,qb,{...u,onUpdate:f=>{this.mixTargetDelta(f),u.onUpdate&&u.onUpdate(f)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(qb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:f,target:m,layout:h,latestValues:v}=u;if(!(!f||!m||!h)){if(this!==u&&this.layout&&h&&Y1(this.options.animationType,this.layout.layoutBox,h.layoutBox)){m=this.target||zt();const b=Hn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Hn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Qn(f,m),Lo(f,v),tl(this.projectionDeltaWithTransform,this.layoutCorrected,f,v)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new x3),this.sharedNodes.get(u).add(f);const h=f.options.initialPromotionConfig;f.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(f):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:f}=this.options;return f?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:f}=this.options;return f?(u=this.getStack())===null||u===void 0?void 0:u.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:f,preserveFollowOpacity:m}={}){const h=this.getStack();h&&h.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let f=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const h={};m.z&&wp("z",u,h,this.animationValues);for(let v=0;v<Np.length;v++)wp(`rotate${Np[v]}`,u,h,this.animationValues),wp(`skew${Np[v]}`,u,h,this.animationValues);u.render();for(const v in h)u.setStaticValue(v,h[v]),this.animationValues&&(this.animationValues[v]=h[v]);u.scheduleRender()}getProjectionStyles(u){var f,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return S3;const h={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,h.opacity="",h.pointerEvents=id(u==null?void 0:u.pointerEvents)||"",h.transform=v?v(this.latestValues,""):"none",h;const b=this.getLead();if(!this.projectionDelta||!this.layout||!b.target){const j={};return this.options.layoutId&&(j.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,j.pointerEvents=id(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!Ni(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),h.transform=k3(this.projectionDeltaWithTransform,this.treeScale,_),v&&(h.transform=v(_,h.transform));const{x,y:S}=this.projectionDelta;h.transformOrigin=`${x.origin*100}% ${S.origin*100}% 0`,b.animationValues?h.opacity=b===this?(m=(f=_.opacity)!==null&&f!==void 0?f:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:h.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const j in hd){if(_[j]===void 0)continue;const{correct:T,applyTo:N}=hd[j],C=h.transform==="none"?_[j]:T(_[j],b);if(N){const D=N.length;for(let A=0;A<D;A++)h[N[A]]=C}else h[j]=C}return this.options.layoutId&&(h.pointerEvents=b===this?id(u==null?void 0:u.pointerEvents)||"":"none"),h}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var f;return(f=u.currentAnimation)===null||f===void 0?void 0:f.stop()}),this.root.nodes.forEach(Gb),this.root.sharedNodes.clear()}}}function T3(t){t.updateLayout()}function N3(t){var s;const o=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&o&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=o.source!==t.layout.source;d==="size"?is(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],x=Hn(_);_.min=r[b].min,_.max=_.min+x}):Y1(d,o.layoutBox,r)&&is(b=>{const _=u?o.measuredBox[b]:o.layoutBox[b],x=Hn(r[b]);_.max=_.min+x,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+x)});const f=Io();tl(f,r,o.layoutBox);const m=Io();u?tl(m,t.applyTransform(c,!0),o.measuredBox):tl(m,r,o.layoutBox);const h=!G1(f);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:x}=b;if(_&&x){const S=zt();nl(S,o.layoutBox,_.layoutBox);const j=zt();nl(j,r,x.layoutBox),F1(S,j)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=S,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:o,delta:m,layoutDelta:f,hasLayoutChanged:h,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function w3(t){Jr&&wi.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function C3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function E3(t){t.clearSnapshot()}function Gb(t){t.clearMeasurements()}function A3(t){t.isLayoutDirty=!1}function D3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function Fb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function M3(t){t.resolveTargetDelta()}function R3(t){t.calcProjection()}function I3(t){t.resetSkewAndRotation()}function O3(t){t.removeLeadSnapshot()}function Kb(t,s,o){t.translate=Dt(s.translate,0,o),t.scale=Dt(s.scale,1,o),t.origin=s.origin,t.originPoint=s.originPoint}function Zb(t,s,o,r){t.min=Dt(s.min,o.min,r),t.max=Dt(s.max,o.max,r)}function L3(t,s,o,r){Zb(t.x,s.x,o.x,r),Zb(t.y,s.y,o.y,r)}function B3(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const z3={duration:.45,ease:[.4,0,.1,1]},Yb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Jb=Yb("applewebkit/")&&!Yb("chrome/")?Math.round:$n;function Wb(t){t.min=Jb(t.min),t.max=Jb(t.max)}function $3(t){Wb(t.x),Wb(t.y)}function Y1(t,s,o){return t==="position"||t==="preserve-aspect"&&!UR(Ub(s),Ub(o),.2)}function H3(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const P3=Z1({attachResizeListener:(t,s)=>fl(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Cp={current:void 0},J1=Z1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Cp.current){const t=new P3({});t.mount(window),t.setOptions({layoutScroll:!0}),Cp.current=t}return Cp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),U3={pan:{Feature:a3},drag:{Feature:s3,ProjectionNode:J1,MeasureLayout:U1}};function V3(t,s,o){var r;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const d=(r=void 0)!==null&&r!==void 0?r:c.querySelectorAll(t);return d?Array.from(d):[]}return Array.from(t)}function W1(t,s){const o=V3(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[o,c,()=>r.abort()]}function Xb(t){return s=>{s.pointerType==="touch"||M1()||t(s)}}function q3(t,s,o={}){const[r,c,d]=W1(t,o),u=Xb(f=>{const{target:m}=f,h=s(f);if(typeof h!="function"||!m)return;const v=Xb(b=>{h(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(f=>{f.addEventListener("pointerenter",u,c)}),d}function Qb(t,s,o){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",o==="Start");const c="onHover"+o,d=r[c];d&&wt.postRender(()=>d(s,Sl(s)))}class G3 extends si{mount(){const{current:s}=this.node;s&&(this.unmount=q3(s,o=>(Qb(this.node,o,"Start"),r=>Qb(this.node,r,"End"))))}unmount(){}}class F3 extends si{constructor(){super(...arguments),this.isActive=!1}onFocus(){let s=!1;try{s=this.node.current.matches(":focus-visible")}catch{s=!0}!s||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=kl(fl(this.node.current,"focus",()=>this.onFocus()),fl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const X1=(t,s)=>s?t===s?!0:X1(t,s.parentElement):!1,K3=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Z3(t){return K3.has(t.tagName)||t.tabIndex!==-1}const Wr=new WeakSet;function e_(t){return s=>{s.key==="Enter"&&t(s)}}function Ep(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const Y3=(t,s)=>{const o=t.currentTarget;if(!o)return;const r=e_(()=>{if(Wr.has(o))return;Ep(o,"down");const c=e_(()=>{Ep(o,"up")}),d=()=>Ep(o,"cancel");o.addEventListener("keyup",c,s),o.addEventListener("blur",d,s)});o.addEventListener("keydown",r,s),o.addEventListener("blur",()=>o.removeEventListener("keydown",r),s)};function t_(t){return vh(t)&&!M1()}function J3(t,s,o={}){const[r,c,d]=W1(t,o),u=f=>{const m=f.currentTarget;if(!t_(f)||Wr.has(m))return;Wr.add(m);const h=s(f),v=(x,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!t_(x)||!Wr.has(m))&&(Wr.delete(m),typeof h=="function"&&h(x,{success:S}))},b=x=>{v(x,o.useGlobalTarget||X1(m,x.target))},_=x=>{v(x,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(f=>{!Z3(f)&&f.getAttribute("tabindex")===null&&(f.tabIndex=0),(o.useGlobalTarget?window:f).addEventListener("pointerdown",u,c),f.addEventListener("focus",h=>Y3(h,c),c)}),d}function n_(t,s,o){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",o==="Start");const c="onTap"+(o==="End"?"":o),d=r[c];d&&wt.postRender(()=>d(s,Sl(s)))}class W3 extends si{mount(){const{current:s}=this.node;s&&(this.unmount=J3(s,o=>(n_(this.node,o,"Start"),(r,{success:c})=>n_(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const fm=new WeakMap,Ap=new WeakMap,X3=t=>{const s=fm.get(t.target);s&&s(t)},Q3=t=>{t.forEach(X3)};function e6({root:t,...s}){const o=t||document;Ap.has(o)||Ap.set(o,{});const r=Ap.get(o),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(Q3,{root:t,...s})),r[c]}function t6(t,s,o){const r=e6(s);return fm.set(t,o),r.observe(t),()=>{fm.delete(t),r.unobserve(t)}}const n6={some:0,all:1};class s6 extends si{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:o,margin:r,amount:c="some",once:d}=s,u={root:o?o.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:n6[c]},f=m=>{const{isIntersecting:h}=m;if(this.isInView===h||(this.isInView=h,d&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=h?v:b;_&&_(m)};return t6(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:o}=this.node;["amount","margin","root"].some(a6(s,o))&&this.startObserver()}unmount(){}}function a6({viewport:t={}},{viewport:s={}}={}){return o=>t[o]!==s[o]}const i6={inView:{Feature:s6},tap:{Feature:W3},focus:{Feature:F3},hover:{Feature:G3}},o6={layout:{ProjectionNode:J1,MeasureLayout:U1}},xd={current:null},yh={current:!1};function Q1(){if(yh.current=!0,!!Pm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>xd.current=t.matches;t.addListener(s),s()}else xd.current=!1}const r6=[..._1,hn,ti],l6=t=>r6.find(b1(t)),s_=new WeakMap;function c6(t,s,o){for(const r in s){const c=s[r],d=o[r];if(vn(c))t.addValue(r,c);else if(vn(d))t.addValue(r,dl(c,{owner:t}));else if(d!==c)if(t.hasValue(r)){const u=t.getValue(r);u.liveStyle===!0?u.jump(c):u.hasAnimated||u.set(c)}else{const u=t.getStaticValue(r);t.addValue(r,dl(u!==void 0?u:c,{owner:t}))}}for(const r in o)s[r]===void 0&&t.removeValue(r);return s}const a_=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class d6{scrapeMotionValuesFromProps(s,o,r){return{}}constructor({parent:s,props:o,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ph,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=Ls.now();this.renderScheduledAt<x&&(this.renderScheduledAt=x,wt.render(this.render,!1,!0))};const{latestValues:m,renderState:h,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=o.initial?{...m}:{},this.renderState=h,this.parent=s,this.props=o,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=f,this.blockInitialAnimation=!!d,this.isControllingVariants=Od(o),this.isVariantNode=Mx(o),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(o,{},this);for(const x in _){const S=_[x];m[x]!==void 0&&vn(S)&&S.set(m[x],!1)}}mount(s){this.current=s,s_.set(s,this),this.projection&&!this.projection.instance&&this.projection.mount(s),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((o,r)=>this.bindToMotionValue(r,o)),yh.current||Q1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:xd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){s_.delete(this.current),this.projection&&this.projection.unmount(),ei(this.notifyUpdate),ei(this.render),this.valueSubscriptions.forEach(s=>s()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const s in this.events)this.events[s].clear();for(const s in this.features){const o=this.features[s];o&&(o.unmount(),o.isMounted=!1)}this.current=null}bindToMotionValue(s,o){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Li.has(s),c=o.on("change",f=>{this.latestValues[s]=f,this.props.onUpdate&&wt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=o.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,o)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),o.owner&&o.stop()})}sortNodePosition(s){return!this.current||!this.sortInstanceNodePosition||this.type!==s.type?0:this.sortInstanceNodePosition(this.current,s.current)}updateFeatures(){let s="animation";for(s in Vo){const o=Vo[s];if(!o)continue;const{isEnabled:r,Feature:c}=o;if(!this.features[s]&&c&&r(this.props)&&(this.features[s]=new c(this)),this.features[s]){const d=this.features[s];d.isMounted?d.update():(d.mount(),d.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):zt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,o){this.latestValues[s]=o}update(s,o){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=o;for(let r=0;r<a_.length;r++){const c=a_[r];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const d="on"+c,u=s[d];u&&(this.propEventSubscriptions[c]=this.on(c,u))}this.prevMotionValues=c6(this,this.scrapeMotionValuesFromProps(s,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(s){return this.props.variants?this.props.variants[s]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(s){const o=this.getClosestVariantNode();if(o)return o.variantChildren&&o.variantChildren.add(s),()=>o.variantChildren.delete(s)}addValue(s,o){const r=this.values.get(s);o!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,o),this.values.set(s,o),this.latestValues[s]=o.get())}removeValue(s){this.values.delete(s);const o=this.valueSubscriptions.get(s);o&&(o(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,o){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&o!==void 0&&(r=dl(o===null?void 0:o,{owner:this}),this.addValue(s,r)),r}readValue(s,o){var r;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(r=this.getBaseTargetFromProps(this.props,s))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(v1(c)||l1(c))?c=parseFloat(c):!l6(c)&&ti.test(o)&&(c=m1(s,o)),this.setBaseTarget(s,vn(c)?c.get():c)),vn(c)?c.get():c}setBaseTarget(s,o){this.baseTarget[s]=o}getBaseTarget(s){var o;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=Km(this.props,r,(o=this.presenceContext)===null||o===void 0?void 0:o.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!vn(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,o){return this.events[s]||(this.events[s]=new ah),this.events[s].add(o)}notify(s,...o){this.events[s]&&this.events[s].notify(...o)}}class ek extends d6{constructor(){super(...arguments),this.KeyframeResolver=x1}sortInstanceNodePosition(s,o){return s.compareDocumentPosition(o)&2?1:-1}getBaseTargetFromProps(s,o){return s.style?s.style[o]:void 0}removeValueFromRenderState(s,{vars:o,style:r}){delete o[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;vn(s)&&(this.childSubscription=s.on("change",o=>{this.current&&(this.current.textContent=`${o}`)}))}}function u6(t){return window.getComputedStyle(t)}class f6 extends ek{constructor(){super(...arguments),this.type="html",this.renderInstance=Px}readValueFromInstance(s,o){if(Li.has(o)){const r=fh(o);return r&&r.default||0}else{const r=u6(s),c=(zx(o)?r.getPropertyValue(o):r[o])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:o}){return H1(s,o)}build(s,o,r){Jm(s,o,r.transformTemplate)}scrapeMotionValuesFromProps(s,o,r){return eh(s,o,r)}}class p6 extends ek{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=zt}getBaseTargetFromProps(s,o){return s[o]}readValueFromInstance(s,o){if(Li.has(o)){const r=fh(o);return r&&r.default||0}return o=Ux.has(o)?o:qm(o),s.getAttribute(o)}scrapeMotionValuesFromProps(s,o,r){return Gx(s,o,r)}build(s,o,r){Wm(s,o,this.isSVGTag,r.transformTemplate)}renderInstance(s,o,r,c){Vx(s,o,r,c)}mount(s){this.isSVGTag=Qm(s.tagName),super.mount(s)}}const m6=(t,s)=>Fm(t)?new p6(s):new f6(s,{allowProjection:t!==y.Fragment}),h6=PM({...MR,...i6,...U3,...o6},m6),Ut=nM(h6);function g6(){!yh.current&&Q1();const[t]=y.useState(xd.current);return t}const v6="_overlay_cmicx_1",y6="_dialog_cmicx_11",b6="_title_cmicx_30",_6="_description_cmicx_38",x6="_actions_cmicx_45",k6="_cancelButton_cmicx_52",S6="_confirmButton_cmicx_79",ji={overlay:v6,dialog:y6,title:b6,description:_6,actions:x6,cancelButton:k6,confirmButton:S6};function _s({isOpen:t,title:s,description:o,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),f=y.useId();return a.jsx(rs,{children:t&&a.jsx(Ut.div,{className:ji.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:m=>{m.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":o?f:void 0,children:a.jsxs(Ut.div,{className:ji.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:m=>m.stopPropagation(),children:[a.jsx("h3",{id:u,className:ji.title,children:s}),o&&a.jsx("p",{id:f,className:ji.description,children:o}),a.jsxs("div",{className:ji.actions,children:[a.jsx("button",{type:"button",className:ji.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),a.jsx("button",{type:"button",className:ji.confirmButton,onClick:c,children:r})]})]})})})}const j6="_skeleton_1gqp4_9",T6="_circular_1gqp4_17",N6="_textContainer_1gqp4_26",w6="_card_1gqp4_31",kd={skeleton:j6,circular:T6,textContainer:N6,card:w6};function Te({width:t="100%",height:s="1rem",borderRadius:o,variant:r="rectangular",className:c}){const d=[kd.skeleton,r==="circular"?kd.circular:"",c??""].filter(Boolean).join(" ");return a.jsx("div",{className:d,style:{width:t,height:s,...o&&r!=="circular"?{borderRadius:o}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function pm({lines:t=3,lastLineWidth:s="60%",lineHeight:o="0.75rem",gap:r="var(--space-sm)",className:c}){return a.jsx("div",{className:`${kd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>a.jsx(Te,{width:u===t-1&&t>1?s:"100%",height:o},u))})}function mm({lines:t=2,className:s}){return a.jsxs("div",{className:`${kd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[a.jsx(Te,{width:"40%",height:"1.25rem"}),a.jsx(pm,{lines:t})]})}const C6="_spinner_1uyt1_1",E6="_spin_1uyt1_1",A6="_sm_1uyt1_14",D6="_md_1uyt1_20",M6="_lg_1uyt1_26",R6="_xl_1uyt1_32",i_={spinner:C6,spin:E6,sm:A6,md:D6,lg:M6,xl:R6};function tk({size:t="md",className:s,label:o="Loading",liveRegion:r=!1}){return a.jsx("span",{className:`${i_.spinner} ${i_[t]} ${s??""}`,role:r?"status":void 0,"aria-label":o,"aria-hidden":r?void 0:!0})}function zd(t){return`/${t.replace(/^\//,"")}`}const I6="_splash_1bn1g_1",O6="_logo_1bn1g_11",o_={splash:I6,logo:O6};function hm(){return a.jsxs("div",{className:o_.splash,"data-testid":"splash-screen",children:[a.jsx("img",{src:zd("grackle-logo.png"),alt:"Grackle",className:o_.logo}),a.jsx(tk,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const L6="_wrapper_4e5yt_1",B6="_wrapperBlock_4e5yt_6",z6="_tooltip_4e5yt_11",$6="_visible_4e5yt_31",H6="_top_4e5yt_41",P6="_bottom_4e5yt_48",U6="_left_4e5yt_55",V6="_right_4e5yt_62",qr={wrapper:L6,wrapperBlock:B6,tooltip:z6,visible:$6,top:H6,bottom:P6,left:U6,right:V6},q6=300,Zc=6;function ni({text:t,placement:s="top",delayMs:o=q6,inline:r=!0,children:c,className:d,"data-testid":u}){const[f,m]=y.useState(!1),[h,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),x=y.useRef(void 0),S=y.useId(),j=typeof document<"u",T=y.useCallback(()=>{if(!b.current||!_.current)return;const $=b.current.getBoundingClientRect(),Y=_.current.getBoundingClientRect();let U=0,X=0;switch(s){case"top":U=$.top-Y.height-Zc,X=$.left+$.width/2-Y.width/2;break;case"bottom":U=$.bottom+Zc,X=$.left+$.width/2-Y.width/2;break;case"left":U=$.top+$.height/2-Y.height/2,X=$.left-Y.width-Zc;break;case"right":U=$.top+$.height/2-Y.height/2,X=$.right+Zc;break}v({top:U,left:X})},[s]),N=y.useCallback($=>{x.current!==void 0&&clearTimeout(x.current),x.current=setTimeout(()=>{T(),m(!0),x.current=void 0},$)},[T]),C=y.useCallback(()=>{N(o)},[o,N]),D=y.useCallback(()=>{N(0)},[N]),A=y.useCallback(()=>{x.current!==void 0&&(clearTimeout(x.current),x.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!f)return;const $=Y=>{Y.key==="Escape"&&A()};return document.addEventListener("keydown",$),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{document.removeEventListener("keydown",$),window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[f,A,T]),y.useEffect(()=>()=>{x.current!==void 0&&clearTimeout(x.current)},[]);const E=r?"span":"div",R=[r?qr.wrapper:qr.wrapperBlock,d].filter(Boolean).join(" ");let L=c;if(y.isValidElement(c)){const $=c,Y=$.props["aria-describedby"],U=f?Y?`${Y} ${S}`:S:Y;L=y.cloneElement($,{"aria-describedby":U})}const M=a.jsx("div",{ref:_,id:S,role:"tooltip",className:`${qr.tooltip} ${qr[s]} ${f?qr.visible:""}`,style:{top:h.top,left:h.left},"data-testid":u??"tooltip",children:t});return a.jsxs(E,{ref:b,className:R,onMouseEnter:C,onMouseLeave:A,onFocus:D,onBlur:A,children:[L,j?J2.createPortal(M,document.body):null]})}const G6="_attemptSelector_ggigl_1",F6="_attemptLabel_ggigl_17",K6="_attemptButton_ggigl_21",Z6="_attemptActive_ggigl_38",Y6="_attemptStatus_ggigl_44",Gr={attemptSelector:G6,attemptLabel:F6,attemptButton:K6,attemptActive:Z6,attemptStatus:Y6};function J6({taskSessions:t,selectedSessionId:s,onSelect:o}){if(!(t.length<2))return a.jsxs("div",{className:Gr.attemptSelector,"data-testid":"attempt-selector",children:[a.jsx("span",{className:Gr.attemptLabel,children:"Attempts:"}),t.map((r,c)=>{const d=r.id===s,u=r.status==="stopped"&&r.endReason==="completed"?"✓":r.status==="stopped"?"✗":r.status==="running"||r.status==="idle"?"●":"";return a.jsxs("button",{className:`${Gr.attemptButton} ${d?Gr.attemptActive:""}`,onClick:()=>o(r.id),title:`Attempt #${c+1} — ${r.status}`,"aria-label":`Attempt #${c+1}, ${r.status}`,"aria-pressed":d,"data-testid":`attempt-${c+1}`,children:["#",c+1,u&&a.jsx("span",{className:Gr.attemptStatus,children:u})]},r.id)})]})}const W6="_row_ldkru_1",X6="_hoverActions_ldkru_5",Q6="_hoverButton_ldkru_31",eI="_selectingRow_ldkru_72",tI="_selected_ldkru_83",nI="_checkboxArea_ldkru_90",sI="_checkbox_ldkru_90",aI="_contentArea_ldkru_106",gs={row:W6,hoverActions:X6,hoverButton:Q6,selectingRow:eI,selected:tI,checkboxArea:nI,checkbox:sI,contentArea:aI};function iI({copyText:t,isContentBearing:s,isSelecting:o,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:f,children:m}){const[h,v]=y.useState(!1),b=y.useRef(void 0);y.useEffect(()=>()=>{b.current!==void 0&&clearTimeout(b.current)},[]);const _=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),f==null||f(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,f]),x=y.useCallback(S=>{!o||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[o,u]);return s?o?a.jsxs("div",{className:`${gs.row} ${gs.selectingRow} ${r?gs.selected:""}`,onClick:x,"data-testid":"event-selectable-row",children:[a.jsx("div",{className:gs.checkboxArea,children:a.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:gs.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),a.jsx("div",{className:gs.contentArea,children:m})]}):a.jsxs("div",{className:gs.row,"data-testid":"event-hover-row",children:[a.jsxs("div",{className:gs.hoverActions,"data-testid":"event-hover-actions",children:[a.jsx("button",{type:"button",className:gs.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:h?a.jsx(Mi,{size:Ye,"aria-hidden":"true"}):a.jsx(X_,{size:Ye,"aria-hidden":"true"})}),a.jsx("button",{type:"button",className:gs.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:a.jsx(yN,{size:Ye,"aria-hidden":"true"})})]}),m]}):a.jsx("div",{className:gs.row,children:m})}const oI="_bar_lagql_1",rI="_left_lagql_21",lI="_right_lagql_27",cI="_count_lagql_33",dI="_toggleButton_lagql_40",uI="_copyButton_lagql_68",fI="_forwardButton_lagql_108",pI="_cancelButton_lagql_148",Ga={bar:oI,left:rI,right:lI,count:cI,toggleButton:dI,copyButton:uI,forwardButton:fI,cancelButton:pI};function mI({selectedCount:t,totalSelectable:s,onSelectAll:o,onDeselectAll:r,onCopy:c,onForward:d,forwardDisabled:u=!1,onCancel:f}){const m=t>0&&t>=s;return a.jsxs(Ut.div,{className:Ga.bar,initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.15},"data-testid":"floating-action-bar",children:[a.jsxs("div",{className:Ga.left,children:[a.jsxs("span",{className:Ga.count,"data-testid":"floating-bar-count",children:[t," selected"]}),a.jsx("button",{type:"button",className:Ga.toggleButton,onClick:m?r:o,"data-testid":"floating-bar-select-all",children:m?"Deselect all":"Select all"})]}),a.jsxs("div",{className:Ga.right,children:[a.jsxs("button",{type:"button",className:Ga.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[a.jsx(mT,{size:Ye,"aria-hidden":"true"}),"Copy"]}),d!==void 0&&a.jsx(ni,{text:u?"No active sessions to forward to":"Forward to another session",children:a.jsxs("button",{type:"button",className:Ga.forwardButton,"aria-disabled":u||t===0,onClick:()=>{!u&&t>0&&d()},"data-testid":"floating-bar-forward",children:[a.jsx(kT,{size:Ye,"aria-hidden":"true"}),"Forward"]})}),a.jsx("button",{type:"button",className:Ga.cancelButton,onClick:f,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:a.jsx(zs,{size:Ye,"aria-hidden":"true"})})]})]})}const hI="_overlay_1hra6_1",gI="_dialog_1hra6_11",vI="_header_1hra6_27",yI="_title_1hra6_35",bI="_closeButton_1hra6_42",_I="_filterRow_1hra6_78",xI="_searchIcon_1hra6_86",kI="_filterInput_1hra6_91",SI="_list_1hra6_108",jI="_emptyItem_1hra6_116",TI="_sessionRow_1hra6_123",NI="_sessionMain_1hra6_158",wI="_envName_1hra6_165",CI="_personaName_1hra6_175",EI="_statusBadge_1hra6_189",AI="_status_running_1hra6_198",DI="_status_idle_1hra6_202",MI="_status_other_1hra6_206",RI="_sessionPrompt_1hra6_211",II="_noSessions_1hra6_220",Zt={overlay:hI,dialog:gI,header:vI,title:yI,closeButton:bI,filterRow:_I,searchIcon:xI,filterInput:kI,list:SI,emptyItem:jI,sessionRow:TI,sessionMain:NI,envName:wI,personaName:CI,statusBadge:EI,status_running:AI,status_idle:DI,status_other:MI,sessionPrompt:RI,noSessions:II};function OI(t){return t==="running"?"running":t==="idle"?"idle":t}function LI({isOpen:t,sessions:s,environments:o,personas:r,onSelect:c,onCancel:d}){const[u,f]=y.useState(""),m=y.useRef(null),h=y.useRef(null);y.useEffect(()=>{var j;t&&s.length<=4&&((j=h.current)==null||j.focus())},[t,s.length]);const v=new Map(o.map(j=>[j.id,j.displayName])),b=new Map((r??[]).map(j=>[j.id,j.name])),_=s.map(j=>({session:j,environmentName:v.get(j.environmentId)??j.environmentId})),x=s.length>4,S=u.trim()?_.filter(({session:j,environmentName:T})=>T.toLowerCase().includes(u.toLowerCase())||j.prompt.toLowerCase().includes(u.toLowerCase())):_;return a.jsx(rs,{children:t&&a.jsx(Ut.div,{className:Zt.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:j=>{j.key==="Escape"&&d()},role:"dialog","aria-modal":"true","aria-label":"Forward to session","data-testid":"session-picker-overlay",children:a.jsxs(Ut.div,{ref:m,className:Zt.dialog,initial:{opacity:0,scale:.93,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.93,y:-10},transition:{duration:.15,ease:[.16,1,.3,1]},onClick:j=>{j.stopPropagation()},"data-testid":"session-picker-dialog",children:[a.jsxs("div",{className:Zt.header,children:[a.jsx("h3",{className:Zt.title,children:"Forward to session"}),a.jsx("button",{ref:h,type:"button",className:Zt.closeButton,onClick:d,"aria-label":"Close session picker","data-testid":"session-picker-close",children:a.jsx(zs,{size:Ye,"aria-hidden":"true"})})]}),x&&a.jsxs("div",{className:Zt.filterRow,children:[a.jsx(Gp,{size:Ye,className:Zt.searchIcon,"aria-hidden":"true"}),a.jsx("input",{type:"text",className:Zt.filterInput,placeholder:"Filter sessions...",value:u,onChange:j=>{f(j.target.value)},"data-testid":"session-picker-filter",autoFocus:!0})]}),s.length===0?a.jsxs("div",{className:Zt.noSessions,"data-testid":"session-picker-no-sessions",children:[a.jsx(Gp,{size:Pt,"aria-hidden":"true"}),a.jsx("p",{children:"No active sessions to forward to."})]}):a.jsx("ul",{className:Zt.list,"data-testid":"session-picker-list",children:S.length===0?a.jsx("li",{className:Zt.emptyItem,"data-testid":"session-picker-empty",children:"No matching sessions"}):S.map(({session:j,environmentName:T})=>{const N=j.personaId?b.get(j.personaId)??void 0:void 0;return a.jsx("li",{children:a.jsxs("button",{type:"button",className:Zt.sessionRow,onClick:()=>{c(j.id)},"data-testid":`session-picker-item-${j.id}`,children:[a.jsxs("div",{className:Zt.sessionMain,children:[a.jsx("span",{className:Zt.envName,children:T}),N!==void 0&&a.jsx("span",{className:Zt.personaName,"data-testid":`session-picker-persona-${j.id}`,children:N}),a.jsx("span",{className:`${Zt.statusBadge} ${Zt[`status_${j.status}`]??Zt.status_other}`,"data-testid":`session-picker-status-${j.id}`,children:OI(j.status)})]}),a.jsx("div",{className:Zt.sessionPrompt,children:j.prompt.length>80?`${j.prompt.slice(0,80)}...`:j.prompt})]})},j.id)})})]})})})}const nk=50;function BI(t,s,o,r,c=nk){return r?t<c:s-t-o<c}function zI(t,s){const o=s-t;return o>0?o:0}function $I({scrollRef:t,contentLength:s,isReversed:o,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),f=y.useRef(!1),m=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let b=!0;const _=()=>{m.current||(m.current=requestAnimationFrame(()=>{m.current=0;const x=BI(v.scrollTop,v.scrollHeight,v.clientHeight,o,nk);x!==b&&(b=x,d(x))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,o]),y.useLayoutEffect(()=>{const v=t.current;!v||f.current||(f.current=!0,o?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,o]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(o&&!c){const b=zI(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(o?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,o,r,t]);const h=y.useCallback(()=>{const v=t.current;if(!v)return;const b=o?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,o]);return{isAtAnchor:c,scrollToAnchor:h}}const HI=new Set(["text","output","user_input","tool_use","tool_result","error"]);function pl(t){return HI.has(t.eventType)}function PI(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let o=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(o=r.content)}catch{}return o}case"tool_use":try{const o=JSON.parse(t.content),r=o.tool??"tool",c=o.args!==void 0?JSON.stringify(o.args,void 0,2):"";return`${r}
336
+ ${c}`}catch{return t.content}default:return t.content}}function r_(t){if(t==null)return"";if(typeof t!="object")return String(t);const s=t;return typeof s.command=="string"?`\`${s.command}\``:typeof s.file_path=="string"||typeof s.filePath=="string"?`\`${s.file_path??s.filePath}\``:typeof s.path=="string"?`\`${s.path}\``:typeof s.query=="string"?`\`${s.query}\``:typeof s.pattern=="string"?`\`${s.pattern}\``:""}function sk(t){var o;const s=[];for(const r of t){if(!pl(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
337
+ ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
338
+ ${r.content}`);break}case"tool_result":{let d=((o=r.toolUseCtx)==null?void 0:o.detailedResult)??void 0;if(!d&&(d=r.content,r.content.trimStart().startsWith("{")))try{const u=JSON.parse(r.content);typeof u.content=="string"&&(d=u.content)}catch{}if(r.toolUseCtx){const u=r_(r.toolUseCtx.args),f=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${f} (${c}):
339
+ ${d}`)}else s.push(`**Tool output** (${c}):
340
+ ${d}`);break}case"tool_use":{let d="tool",u;try{const h=JSON.parse(r.content);d=h.tool??"tool",u=h.args}catch{}const f=r_(u),m=f?`**Tool: ${d}** ${f}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
341
+ \`\`\`json
342
+ ${JSON.stringify(u,void 0,2)}
343
+ \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
344
+ ${r.content}`);break}}}return s.join(`
345
+
346
+ `)}function UI(t,s){const o=VI(t),r=sk(s);return`--- Forwarded from ${o} ---
347
+
348
+ ${r}
349
+
350
+ --- End forwarded ---`}function VI(t){return t.replace(/[\r\n]+/g," ").trim().replace(/---/g,"—")}function qI({events:t,formatForClipboard:s}){const[o,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),f=y.useMemo(()=>c.size,[c]),m=y.useCallback(S=>{r(!0),S!==void 0?(d(new Set([S])),u.current=S):(d(new Set),u.current=void 0)},[]),h=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((S,j)=>{if(j&&u.current!==void 0){const T=Math.min(u.current,S),N=Math.max(u.current,S);d(C=>{const D=new Set(C);for(let A=T;A<=N;A++)A<t.length&&pl(t[A])&&D.add(A);return D})}else d(T=>{const N=new Set(T);return N.has(S)?N.delete(S):N.add(S),N.size===0?(r(!1),u.current=void 0):u.current=S,N})},[t]),b=y.useCallback(()=>{const S=new Set;for(let j=0;j<t.length;j++)pl(t[j])&&S.add(j);d(S)},[t]),_=y.useCallback(()=>{d(new Set)},[]),x=y.useCallback(async()=>{const j=[...c].sort((N,C)=>N-C).filter(N=>N<t.length).map(N=>t[N]);if(j.length===0)return!1;const T=s(j);try{return await navigator.clipboard.writeText(T),!0}catch{return!1}},[c,t,s]);return{isSelecting:o,selectedIndices:c,selectedCount:f,enterSelectionMode:m,cancelSelection:h,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:x}}const GI="_wrapper_1cdza_1",FI="_scrollContainer_1cdza_9",KI="_selectingPadding_1cdza_16",ZI="_toolbar_1cdza_20",YI="_directionToggle_1cdza_27",JI="_scrollToAnchor_1cdza_65",WI="_scrollToAnchorBottom_1cdza_89",XI="_scrollToAnchorTop_1cdza_93",QI="_eventOverflowWarning_1cdza_97",ca={wrapper:GI,scrollContainer:FI,selectingPadding:KI,toolbar:ZI,directionToggle:YI,scrollToAnchor:JI,scrollToAnchorBottom:WI,scrollToAnchorTop:XI,eventOverflowWarning:QI},e5=10*1024,t5=new Set(["running","idle"]);function n5(t){const s=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"text":case"output":return`Select message from assistant at ${s}`;case"user_input":return`Select message from user at ${s}`;case"tool_result":case"tool_use":return`Select tool event at ${s}`;case"error":return`Select error at ${s}`;default:return`Select event at ${s}`}}const ak="grackle-stream-direction";function s5(){try{return localStorage.getItem(ak)==="reversed"}catch{return!1}}function a5({eventsDropped:t}){return t<=0?a.jsx(a.Fragment,{}):a.jsxs("div",{className:ca.eventOverflowWarning,role:"alert",children:[a.jsx(Em,{size:Pt,"aria-hidden":"true"})," ",t.toLocaleString()," older event",t===1?"":"s"," were dropped — only the most recent 5,000 are shown. Full history is available in the session log."]})}function bh({events:t,eventsDropped:s,emptyState:o,onShowToast:r,sessions:c,currentSessionId:d,environments:u,personas:f,onForward:m,sandboxProxyUrl:h}){const v=y.useRef(null),[b,_]=y.useState(s5),x=g6(),[S,j]=y.useState(!1),[T,N]=y.useState(!1),[C,D]=y.useState(void 0),A=qI({events:t,formatForClipboard:sk}),E=y.useMemo(()=>t.filter(pl).length,[t]),R=y.useMemo(()=>c?c.filter(ce=>t5.has(ce.status)&&ce.id!==d):[],[c,d]),L=y.useMemo(()=>b?[...t].reverse():t,[t,b]),{isAtAnchor:M,scrollToAnchor:$}=$I({scrollRef:v,contentLength:t.length,isReversed:b,paused:A.isSelecting}),Y=()=>{const ce=!b;_(ce);try{localStorage.setItem(ak,ce?"reversed":"default")}catch{}};y.useEffect(()=>{if(!A.isSelecting)return;const ce=me=>{me.key==="Escape"&&!S&&!T&&A.cancelSelection()};return window.addEventListener("keydown",ce),()=>{window.removeEventListener("keydown",ce)}},[A.isSelecting,A.cancelSelection,S,T]);const U=y.useCallback(async()=>{await A.copySelected()&&(r==null||r(`Copied ${A.selectedCount} message${A.selectedCount===1?"":"s"} to clipboard`,"success"))},[A,r]),X=y.useCallback(()=>[...A.selectedIndices].sort((me,xe)=>me-xe).filter(me=>me<t.length).map(me=>t[me]),[A.selectedIndices,t]),te=y.useCallback(ce=>{if(!ce)return"this session";const me=c==null?void 0:c.find(De=>De.id===ce);if(!me)return ce.slice(0,8);const xe=u==null?void 0:u.find(De=>De.id===me.environmentId);return(xe==null?void 0:xe.displayName)??me.environmentId.slice(0,8)},[c,u]),G=y.useCallback(async(ce,me)=>{if(!m)return;const xe=te(ce);try{await m(ce,me);const De=A.selectedCount;r==null||r(`Forwarded ${De} message${De===1?"":"s"} to ${xe}`,"success"),A.cancelSelection()}catch{r==null||r("Failed to forward messages","error")}},[m,te,r,A]),ne=y.useCallback(ce=>{j(!1);const me=X(),xe=te(d),De=UI(xe,me);if(new TextEncoder().encode(De).length>e5){D({sessionId:ce,text:De}),N(!0);return}G(ce,De).catch(()=>{})},[X,te,d,G]),H=y.useCallback(()=>{N(!1),C&&(G(C.sessionId,C.text).catch(()=>{}),D(void 0))},[C,G]),O=y.useCallback(()=>{N(!1),D(void 0)},[]),q=x?0:.2,ge=b?-8:8,se=C?Math.round(new TextEncoder().encode(C.text).length/1024):0;return a.jsxs("div",{className:ca.wrapper,children:[a.jsx("div",{className:ca.toolbar,children:a.jsx(ni,{text:b?"Showing newest first":"Showing oldest first",children:a.jsx("button",{className:ca.directionToggle,onClick:Y,"aria-label":b?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:b?a.jsx(Ny,{size:Pt,"aria-hidden":"true"}):a.jsx(wy,{size:Pt,"aria-hidden":"true"})})})}),a.jsxs("div",{ref:v,className:`${ca.scrollContainer} ${A.isSelecting?ca.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&o,a.jsx(a5,{eventsDropped:s}),a.jsx(rs,{initial:!1,children:L.map((ce,me)=>{const xe=b?t.length-1-me:me;return a.jsx(Ut.div,{initial:{opacity:0,y:ge},animate:{opacity:1,y:0},transition:{duration:q,ease:"easeOut"},children:a.jsx(iI,{copyText:PI(ce),isContentBearing:pl(ce),isSelecting:A.isSelecting,isSelected:A.selectedIndices.has(xe),checkboxLabel:n5(ce),onSelect:()=>{A.enterSelectionMode(xe)},onToggle:De=>{A.toggleEvent(xe,De)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:a.jsx(qD,{event:ce,toolUseCtx:ce.toolUseCtx,settled:ce.settled,sandboxProxyUrl:h})})},`${ce.sessionId}-${ce.timestamp}-${xe}`)})})]}),a.jsx(rs,{children:A.isSelecting&&a.jsx(mI,{selectedCount:A.selectedCount,totalSelectable:E,onSelectAll:A.selectAll,onDeselectAll:A.deselectAll,onCopy:()=>{U().catch(()=>{})},onForward:m!==void 0?()=>{j(!0)}:void 0,forwardDisabled:R.length===0,onCancel:A.cancelSelection})}),a.jsx(LI,{isOpen:S,sessions:R,environments:u??[],personas:f,onSelect:ne,onCancel:()=>{j(!1)}}),a.jsx(_s,{isOpen:T,title:"Send large message?",description:`This will forward a large message (${se} KB). Continue?`,confirmLabel:"Send",onConfirm:H,onCancel:O}),a.jsx(rs,{children:!M&&a.jsxs(Ut.button,{className:`${ca.scrollToAnchor} ${b?ca.scrollToAnchorTop:ca.scrollToAnchorBottom}`,onClick:$,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[b?a.jsx(wy,{size:Pt,"aria-hidden":"true"}):a.jsx(Ny,{size:Pt,"aria-hidden":"true"})," ","New events"]})})]})}function gm(t){const s=new Date(t),o=new Date,r=o.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),f=Math.floor(u/24);if(c<60)return"just now";if(d<60)return`${d}m ago`;if(u<24)return`${u}h ago`;if(f===1)return"yesterday";if(f<7)return`${f} days ago`;const m=s.getFullYear()===o.getFullYear(),h=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${h} ${v}`:`${h} ${v} ${s.getFullYear()}`}function ik(t){const s=new Date(t);if(Number.isNaN(s.getTime()))return"—";const o=new Date,r=s.getTime()-o.getTime();if(r<=0)return"overdue";const c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),f=Math.floor(u/24);if(c<60)return`in ${c}s`;if(d<60)return`in ${d}m`;if(u<24)return`in ${u}h`;if(f<7)return`in ${f} day${f===1?"":"s"}`;const m=s.getFullYear()===o.getFullYear(),h=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${h} ${v}`:`${h} ${v} ${s.getFullYear()}`}function Dp(t){return t.length>0?t.charAt(0).toUpperCase()+t.slice(1):t}const i5=["--accent-green","--accent-yellow","--accent-red","--text-tertiary"];function ok(t,s){if(s)return{varName:"--text-tertiary",label:"External"};switch(t){case"running":return{varName:"--accent-green",label:"Running"};case"idle":case"suspended":case"hibernating":return{varName:"--accent-yellow",label:Dp(t)};case"failed":case"interrupted":return{varName:"--accent-red",label:Dp(t)};default:return{varName:"--text-tertiary",label:t.length>0?Dp(t):"Unknown"}}}function _h(t){const{value:s,onSave:o,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:f=!0,trimOnSave:m=!0}=t,[h,v]=y.useState(""),[b,_]=y.useState(""),x=y.useRef(!1),S=d===c,j=y.useCallback(L=>{v(L),_("")},[]),T=y.useCallback(()=>{_("")},[]),N=y.useCallback(()=>{x.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const L=m?h.trim():h;if(r){const $=r(h);if($){_($);return}}const M=m?s.trim():s;if(L===M){N();return}o(L),N()},[h,s,m,r,o,N]),D=y.useCallback(()=>{x.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),A=y.useCallback(L=>{if(x.current){x.current=!1;return}L.relatedTarget instanceof HTMLElement&&L.relatedTarget.dataset.editAction===c||C()},[c,C]),E=y.useCallback(L=>{L.key==="Escape"?N():L.key==="Enter"&&f&&C()},[N,f,C]),R=(()=>{if(!S)return!1;const L=m?s.trim():s;return(m?h.trim():h)!==L})();return y.useEffect(()=>{!S&&(h!==""||b!=="")&&(v(""),_(""))},[S,h,b]),{isEditing:S,draft:h,error:b,isDirty:R,startEdit:D,cancelEdit:N,save:C,setDraft:j,clearError:T,handleBlur:A,handleKeyDown:E,ignoreInitialBlurRef:x}}const o5="_editFieldWrapper_yuzty_1",r5="_editInput_yuzty_10",l5="_editTextarea_yuzty_42",c5="_editSelect_yuzty_78",d5="_editError_yuzty_111",u5="_editInputInvalid_yuzty_118",f5="_editHint_yuzty_123",p5="_unsavedDot_yuzty_132",m5="_metaValueClickable_yuzty_140",h5="_editButton_yuzty_159",g5="_metaPlaceholder_yuzty_175",v5="_worktreeToggle_yuzty_180",it={editFieldWrapper:o5,editInput:r5,editTextarea:l5,editSelect:c5,editError:d5,editInputInvalid:u5,editHint:f5,unsavedDot:p5,metaValueClickable:m5,editButton:h5,metaPlaceholder:g5,worktreeToggle:v5};function $t(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:f,onChange:m,renderDisplay:h,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":x}=t,S=y.useRef(null),j=_h({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:f,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const N=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(N)}},[j.isEditing]),c==="create"){const N=D=>{m==null||m(D.target.value)},C=r==null?void 0:r(s);return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("input",{className:`${it.editInput} ${C?it.editInputInvalid:""}`,value:s,onChange:N,maxLength:b,placeholder:v,"aria-label":_,"data-testid":x?`${x}-input`:void 0}),C&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("input",{ref:S,className:`${it.editInput} ${j.error?it.editInputInvalid:""}`,value:j.draft,onChange:N=>j.setDraft(N.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":x?`${x}-input`:void 0}),j.isDirty&&a.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),j.error&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:j.error}),a.jsx("span",{className:it.editHint,children:"Enter to save · Esc to cancel"})]});const T=h==null?void 0:h(s);return a.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":_,"data-testid":x?`${x}-button`:void 0,children:[T!==void 0?T:s?a.jsx("span",{children:s}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function vm(t){const{value:s,onSave:o,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:f,onChange:m,renderDisplay:h,placeholder:v,ariaLabel:b,"data-testid":_}=t,x=y.useRef(null),S=_h({value:s,onSave:o,validate:r,fieldId:d,activeFieldId:u,onActivate:f,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(S.isEditing){const T=window.setTimeout(()=>{var N;(N=x.current)==null||N.focus()},0);return()=>window.clearTimeout(T)}},[S.isEditing]),c==="create"){const T=C=>{m==null||m(C.target.value)},N=r==null?void 0:r(s);return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("textarea",{className:`${it.editTextarea} ${N?it.editInputInvalid:""}`,value:s,onChange:T,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),N&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:N})]})}if(S.isEditing)return a.jsxs("div",{className:it.editFieldWrapper,children:[a.jsx("textarea",{ref:x,className:`${it.editTextarea} ${S.error?it.editInputInvalid:""}`,value:S.draft,onChange:T=>S.setDraft(T.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),S.isDirty&&a.jsx("span",{className:it.unsavedDot,title:"Unsaved changes"}),S.error&&a.jsx("span",{className:it.editError,"data-testid":"edit-error",children:S.error}),a.jsx("span",{className:it.editHint,children:"Tab to save · Esc to cancel"})]});const j=h==null?void 0:h(s);return a.jsxs("span",{role:"button",tabIndex:0,className:it.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[j!==void 0?j:s?a.jsx("span",{children:s}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function Sd(t){var D;const{value:s,onSave:o,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:f,onChange:m,renderDisplay:h,placeholder:v,ariaLabel:b,"data-testid":_}=t,x=y.useRef(null),S=_h({value:s,onSave:o,fieldId:d,activeFieldId:u,onActivate:f,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const A=window.setTimeout(()=>{var E;(E=x.current)==null||E.focus()},0);return()=>window.clearTimeout(A)}},[S.isEditing]);const j=y.useCallback(A=>{const E=A.target.value;S.ignoreInitialBlurRef.current=!1,E!==s&&o(E),S.cancelEdit()},[s,o,S]),T=y.useCallback(A=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}A.relatedTarget instanceof HTMLElement&&A.relatedTarget.dataset.editAction===d||S.cancelEdit()},[d,S]);if(r==="create")return a.jsx("select",{className:it.editSelect,value:s,onChange:A=>m==null?void 0:m(A.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>a.jsx("option",{value:A.value,children:A.label},A.value))});if(S.isEditing)return a.jsx("select",{ref:x,className:it.editSelect,value:S.draft,onChange:j,onBlur:T,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(A=>a.jsx("option",{value:A.value,children:A.label},A.value))});const N=h==null?void 0:h(s),C=(D=c.find(A=>A.value===s))==null?void 0:D.label;return a.jsxs("button",{type:"button",className:it.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[N!==void 0?N:C?a.jsx("span",{children:C}):a.jsx("span",{className:it.metaPlaceholder,children:v||"None"}),a.jsx("span",{className:it.editButton,"aria-hidden":"true",children:"✏️"})]})}function y5(t){const{checked:s,onChange:o,label:r,ariaLabel:c,"data-testid":d}=t;return a.jsxs("label",{className:it.worktreeToggle,"data-testid":d,children:[a.jsx("input",{type:"checkbox",checked:s,onChange:u=>o(u.target.checked),"aria-label":c}),a.jsx("span",{children:r})]})}const b5="_nav_1snmp_1",_5="_searchForm_1snmp_8",x5="_searchInput_1snmp_15",k5="_searchButton_1snmp_33",S5="_clearButton_1snmp_68",j5="_workspaceSelect_1snmp_85",T5="_listHeader_1snmp_99",N5="_nodeList_1snmp_108",w5="_nodeItem_1snmp_116",C5="_indicator_1snmp_129",E5="_label_1snmp_136",A5="_badge_1snmp_145",es={nav:b5,searchForm:_5,searchInput:x5,searchButton:k5,clearButton:S5,workspaceSelect:j5,listHeader:T5,nodeList:N5,nodeItem:w5,indicator:C5,label:E5,badge:A5};function D5({nodes:t,workspaces:s,loading:o,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:f}){const[m,h]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{h(""),d()},[d]),_=y.useCallback(S=>{u(S)},[u]),x=y.useCallback(S=>{h(""),f(S)},[f]);return a.jsxs("div",{className:es.nav,"data-testid":"knowledge-nav",children:[a.jsxs("form",{className:es.searchForm,onSubmit:v,children:[a.jsx("input",{className:es.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{h(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),a.jsx("button",{type:"submit",className:es.searchButton,disabled:o,children:"Go"})]}),r&&a.jsx("button",{type:"button",className:es.clearButton,onClick:b,children:"Clear search"}),a.jsxs("select",{className:es.workspaceSelect,onChange:S=>{x(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[a.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>a.jsx("option",{value:S.id,children:S.name},S.id))]}),a.jsxs("div",{className:es.listHeader,children:["Nodes (",t.length,")"]}),a.jsx("ul",{className:es.nodeList,children:t.map(S=>a.jsxs("li",{className:es.nodeItem,onClick:()=>{_(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[a.jsx("span",{className:es.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),a.jsx("span",{className:es.label,children:S.label}),a.jsx("span",{className:es.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const M5="_container_1s4d1_1",R5="_drawerControls_1s4d1_33",I5="_hamburger_1s4d1_44",O5="_brand_1s4d1_60",L5="_brandLogo_1s4d1_79",B5="_info_1s4d1_86",z5="_connectionLabel_1s4d1_101",$5="_connectionDot_1s4d1_114",H5="_connected_1s4d1_117",P5="_disconnected_1s4d1_121",U5="_connecting_1s4d1_124",os={container:M5,drawerControls:R5,hamburger:I5,brand:O5,brandLogo:L5,info:B5,connectionLabel:z5,connectionDot:$5,connected:H5,disconnected:P5,connecting:U5},V5={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},q5={connected:os.connected,connecting:os.connecting,disconnected:os.disconnected};function G5({connectionStatus:t,environments:s,sessions:o,onToggleSidebar:r,sidebarOpen:c,onToggleContextNav:d,contextNavOpen:u}){const f=kt(),m=s.length,h=s.filter(_=>_.status==="connected").length,v=o.filter(_=>["running","idle"].includes(_.status)).length,b=V5[t];return a.jsxs("div",{className:os.container,children:[(d??r)&&a.jsxs("div",{className:os.drawerControls,children:[d&&a.jsx("button",{type:"button",className:os.hamburger,onClick:d,"aria-label":"Toggle contexts","aria-expanded":u,"data-testid":"statusbar-context-toggle",children:a.jsx(iN,{size:pt,"aria-hidden":"true"})}),r&&a.jsx("button",{type:"button",className:os.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:a.jsx(VT,{size:pt,"aria-hidden":"true"})})]}),a.jsx(ni,{text:"Home",placement:"bottom",children:a.jsxs("button",{type:"button",className:os.brand,onClick:()=>f(Zo),"data-testid":"statusbar-brand",children:[a.jsx("img",{src:zd("icon-192x192.png"),alt:"",className:os.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),a.jsxs("div",{className:os.info,children:[a.jsxs("span",{"aria-label":b,children:[a.jsx("span",{className:`${os.connectionDot} ${q5[t]}`,"aria-hidden":"true",children:a.jsx(Ai,{size:Q_,fill:"currentColor"})})," ",a.jsx("span",{className:os.connectionLabel,"aria-hidden":"true",children:b})]}),a.jsxs("span",{children:[h,"/",m," env",m!==1?"s":""]}),a.jsxs("span",{children:[v," active"]})]})]})}const F5="_nav_gx5h3_1",K5="_tab_gx5h3_35",Z5="_tabIcon_gx5h3_68",Y5="_tabLabel_gx5h3_79",J5="_tabActive_gx5h3_84",W5="_tabEnd_gx5h3_90",Co={nav:F5,tab:K5,tabIcon:Z5,tabLabel:Y5,tabActive:J5,tabEnd:W5},ld=[{view:"dashboard",label:"Dashboard",icon:a.jsx(AT,{size:pt}),route:Zo,testId:"sidebar-tab-dashboard",order:0,group:"workbench"},{view:"tasks",label:"Tasks",icon:a.jsx(rT,{size:pt}),route:DC,testId:"sidebar-tab-tasks",order:1,group:"workbench"},{view:"personas",label:"Personas",icon:a.jsx(SN,{size:pt}),route:rl,testId:"sidebar-tab-personas",order:1.5,group:"workbench"},{view:"chat",label:"Root",icon:a.jsx(GT,{size:pt}),route:AC,testId:"sidebar-tab-chat",order:3,group:"workbench"},{view:"sessions",label:"Sessions",icon:a.jsx(Kj,{size:pt}),route:xx,testId:"sidebar-tab-sessions",order:4,group:"workbench"},{view:"knowledge",label:"Knowledge",icon:a.jsx(Qj,{size:pt}),route:Sx,testId:"sidebar-tab-knowledge",order:5,group:"workbench"},{view:"coordination",label:"Coordination",icon:a.jsx(WT,{size:pt}),route:_x,testId:"sidebar-tab-coordination",order:6,group:"fleet"},{view:"environments",label:"Environments",icon:a.jsx(YT,{size:pt}),route:Ho,testId:"sidebar-tab-environments",align:"end",group:"global"},{view:"settings",label:"Settings",icon:a.jsx(gN,{size:pt}),route:TC,testId:"sidebar-tab-settings",align:"end",group:"global"}];function X5(t){return t===Zo||t==="/"?"dashboard":t.startsWith(rl)?"personas":t.startsWith(_x)?"coordination":t.startsWith(xx)?"sessions":t.startsWith("/chat")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(Sx)?"knowledge":t.startsWith(Bo)?"settings":"tasks"}function Q5({tabs:t=ld,groups:s}){var v;const o=Wt(),r=kt(),c=y.useRef(null),d=X5(o.pathname),u=y.useMemo(()=>{const b=(x,S)=>(x.order??Number.MAX_SAFE_INTEGER)-(S.order??Number.MAX_SAFE_INTEGER),_=s===void 0?t:t.filter(x=>s.includes(x.group??"workbench"));return[..._.filter(x=>x.align!=="end").sort(b),..._.filter(x=>x.align==="end")]},[t,s]),f=(v=u.find(b=>b.align==="end"))==null?void 0:v.view,m=y.useCallback(b=>{r(b.route)},[r]),h=y.useCallback(b=>{var T,N;const _=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!_)return;const x=Array.from(_).findIndex(C=>C===document.activeElement),S=x>=0?x:u.findIndex(C=>C.view===d);let j=S;if(b.key==="ArrowRight"||b.key==="j"||b.key==="J")b.preventDefault(),j=(S+1)%u.length;else if(b.key==="ArrowLeft"||b.key==="k"||b.key==="K")b.preventDefault(),j=(S-1+u.length)%u.length;else if(b.key==="Home")b.preventDefault(),j=0;else if(b.key==="End")b.preventDefault(),j=u.length-1;else return;r(u[j].route),(N=_[j])==null||N.focus()},[d,r,u]);return a.jsx("nav",{className:Co.nav,ref:c,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:h,"data-testid":"sidebar-nav",children:u.map(b=>{const _=b.view===d,x=b.view===f;return a.jsx(ni,{text:b.label,placement:"bottom",className:x?Co.tabEnd:void 0,children:a.jsxs("button",{role:"tab",type:"button","aria-selected":_,tabIndex:_?0:-1,className:`${Co.tab} ${_?Co.tabActive:""}`,onClick:()=>m(b),"data-testid":b.testId,"aria-label":b.label,children:[a.jsx("span",{className:Co.tabIcon,"aria-hidden":"true",children:b.icon}),a.jsx("span",{className:Co.tabLabel,children:b.label})]})},b.view)})})}const eO="_rail_15t33_3",tO="_tabList_15t33_41",nO="_tabWrapper_15t33_50",sO="_tab_15t33_41",aO="_tabActive_15t33_85",iO="_tabIcon_15t33_92",oO="_tabLabel_15t33_97",rO="_toggle_15t33_102",Ds={rail:eO,tabList:tO,tabWrapper:nO,tab:sO,tabActive:aO,tabIcon:iO,tabLabel:oO,toggle:rO},rk="code",l_="Context navigation",lO=[{id:rk,label:"Code",icon:a.jsx(dT,{size:pt}),testId:"context-code"}];function cO({contexts:t,activeContextId:s,onSelectContext:o,collapsed:r=!1,onToggleCollapsed:c}){const d=y.useRef(null),u=y.useCallback(f=>{var _,x;const m=(_=d.current)==null?void 0:_.querySelectorAll('[role="tab"]');if(!m||m.length===0)return;const h=Array.from(m).findIndex(S=>S===document.activeElement),v=h>=0?h:t.findIndex(S=>S.id===s);let b=v;if(f.key==="ArrowDown"||f.key==="j"||f.key==="J")f.preventDefault(),b=(v+1)%t.length;else if(f.key==="ArrowUp"||f.key==="k"||f.key==="K")f.preventDefault(),b=(v-1+t.length)%t.length;else if(f.key==="Home")f.preventDefault(),b=0;else if(f.key==="End")f.preventDefault(),b=t.length-1;else return;o(t[b].id),(x=m[b])==null||x.focus()},[s,t,o]);return a.jsxs("nav",{className:Ds.rail,"aria-label":l_,"data-testid":"context-nav","data-collapsed":r,children:[a.jsx("div",{className:Ds.tabList,ref:d,role:"tablist","aria-label":l_,"aria-orientation":"vertical",onKeyDown:u,children:t.map(f=>{const m=f.id===s,h=a.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Ds.tab} ${m?Ds.tabActive:""}`,onClick:()=>o(f.id),"data-testid":f.testId,"aria-label":f.label,children:[a.jsx("span",{className:Ds.tabIcon,"aria-hidden":"true",children:f.icon}),!r&&a.jsx("span",{className:Ds.tabLabel,children:f.label})]});return r?a.jsx(ni,{text:f.label,placement:"right",inline:!1,children:h},f.id):a.jsx("div",{className:Ds.tabWrapper,children:h},f.id)})}),c&&a.jsxs("button",{type:"button",className:Ds.toggle,onClick:c,"aria-label":r?"Expand context navigation":"Collapse context navigation","aria-expanded":!r,"data-testid":"context-nav-toggle",children:[a.jsx("span",{className:Ds.tabIcon,"aria-hidden":"true",children:r?a.jsx(sN,{size:pt}):a.jsx(tN,{size:pt})}),!r&&a.jsx("span",{className:Ds.tabLabel,children:"Collapse"})]})]})}const dO="_container_pi6ii_1",uO="_content_pi6ii_66",c_={container:dO,content:uO},fO=320,lk=220,ck=600,dk="grackle-sidebar-width";function pO(){try{const t=localStorage.getItem(dk);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=lk&&s<=ck)return s}}catch{}return fO}function mO(t){try{localStorage.setItem(dk,String(t))}catch{}}function hO({content:t}){const[s]=y.useState(pO),o=y.useRef(null);if(y.useEffect(()=>{const r=o.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const f=u.borderBoxSize[0];if(f){const m=Math.round(f.inlineSize);m>=lk&&m<=ck&&mO(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return a.jsx("div",{className:c_.container,ref:o,"data-testid":"sidebar",style:{width:s},children:a.jsx("div",{className:c_.content,children:t})})}const gO="_bar_tnfsh_1",vO="_btnPrimary_tnfsh_32",yO="_statusText_tnfsh_85",bO="_statusCompleted_tnfsh_90",_O="_statusFailed_tnfsh_94",xO="_statusBlocked_tnfsh_98",kO="_hintText_tnfsh_103",At={bar:gO,btnPrimary:vO,statusText:yO,statusCompleted:bO,statusFailed:_O,statusBlocked:xO,hintText:kO};function SO({sessions:t,tasks:s,environments:o}){const r=kt(),c=Wt(),d=sn("/sessions/:sessionId"),u=sn("/tasks/:taskId"),f=sn("/tasks/:taskId/stream"),m=sn("/tasks/:taskId/edit"),h=sn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),v=sn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=sn("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),_=sn("/sessions/new"),x=sn("/environments/:environmentId/workspaces/:workspaceId"),S=sn("/tasks/new"),j=sn("/chat"),T=sn("/"),N=sn("/settings/*"),C=d==null?void 0:d.params.sessionId,D=(u==null?void 0:u.params.taskId)??(f==null?void 0:f.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId),A=h??v??b,E=(A==null?void 0:A.params.environmentId)??(x==null?void 0:x.params.environmentId),R=c.pathname.startsWith("/environments")&&!x&&!A,L=!!j,M=!!_,$=!!x&&!h&&!v&&!b,Y=!!S;if(!!T&&!M&&!$&&!Y||!!N||(!!m||!!b)||Y||R||M)return a.jsx(a.Fragment,{});if(L)return o.find(ne=>ne.adapterType==="local"&&ne.status==="connected")?a.jsx(a.Fragment,{}):a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Add a local environment to start chatting"})});if($)return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Select a task or click + to create one"})});if(D){const G=s.find(O=>O.id===D);if(!G)return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Loading..."})});const ne=new Map(s.map(O=>[O.id,O])),H=G.dependsOn.some(O=>{const q=ne.get(O);return q!==void 0&&q.status!=="complete"});if(G.status==="not_started"){const O=H?G.dependsOn.map(q=>ne.get(q)).filter(q=>q&&q.status!=="complete").map(q=>q.title):[];return a.jsx("div",{className:At.bar,children:H?a.jsxs("span",{className:At.statusBlocked,children:["Blocked by: ",O.join(", ")]}):a.jsx("span",{className:At.hintText,children:"Use the buttons above to start or manage this task"})})}if(G.status==="working"||G.status==="paused"){const O=G.latestSessionId||void 0,q=O?t.find(se=>se.id===O):void 0;return q&&q.status!=="stopped"?a.jsx(a.Fragment,{}):a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Waiting for agent..."})})}if(G.status==="complete")return a.jsxs("div",{className:At.bar,children:[a.jsx("span",{className:`${At.statusText} ${At.statusCompleted}`,children:"Task completed"}),a.jsx("button",{onClick:()=>r(Oi(G.workspaceId,void 0,E)),className:At.btnPrimary,children:"+ New Task"})]});if(G.status==="failed")return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:`${At.statusText} ${At.statusFailed}`,children:"Task failed"})})}if(C){const G=t.find(O=>O.id===C),ne=(G==null?void 0:G.status)==="stopped";if(G!==void 0&&!ne)return a.jsx(a.Fragment,{});if(ne)return a.jsxs("div",{className:At.bar,children:[a.jsxs("span",{className:`${At.statusText} ${At.hintText}`,children:["Session ",G.endReason||G.status]}),a.jsx("button",{onClick:()=>r(yx(G.environmentId)),className:At.btnPrimary,children:"+ New Chat"})]})}return a.jsx("div",{className:At.bar,children:a.jsx("span",{className:At.hintText,children:"Loading..."})})}const jO="_nav_14i94_1",TO="_tab_14i94_24",NO="_tabActive_14i94_62",wO="_tabLabel_14i94_75",CO="_statusDot_14i94_81",EO="_pulse_14i94_87",AO="_addButton_14i94_99",DO="_empty_14i94_132",Fa={nav:jO,tab:TO,tabActive:NO,tabLabel:wO,statusDot:CO,pulse:EO,addButton:AO,empty:DO},MO={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function RO({environments:t}){const s=kt(),o=y.useRef(null),r=sn("/environments/:environmentId"),c=sn("/environments/:environmentId/edit"),d=sn("/environments/:environmentId/workspaces/:workspaceId"),u=sn("/environments/:environmentId/workspaces/:workspaceId/*"),f=(r==null?void 0:r.params.environmentId)??(c==null?void 0:c.params.environmentId)??(d==null?void 0:d.params.environmentId)??(u==null?void 0:u.params.environmentId),m=f==="new"?void 0:f,h=y.useCallback(_=>{s(Po(_))},[s]),v=y.useCallback(_=>{var N;const x=(N=o.current)==null?void 0:N.querySelectorAll('[role="tab"]');if(!x||x.length===0)return;const S=Array.from(x).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===m);let T=j;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),T=(j+1)%x.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),T=(j-1+x.length)%x.length;else if(_.key==="Home")_.preventDefault(),T=0;else if(_.key==="End")_.preventDefault(),T=x.length-1;else return;T<t.length&&s(Po(t[T].id)),x[T].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return a.jsxs("div",{className:Fa.nav,"data-testid":"environment-nav",children:[a.jsx("nav",{ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const x=_.id===m,S=_.id===b,j=MO[_.status]||"var(--text-tertiary)",T=_.status==="connected";return a.jsxs("button",{role:"tab",type:"button","aria-selected":x,tabIndex:S?0:-1,className:`${Fa.tab} ${x?Fa.tabActive:""}`,onClick:()=>h(_.id),"data-testid":"env-nav-item",children:[a.jsx("span",{className:`${Fa.statusDot} ${T?Fa.pulse:""}`,style:{color:j},"aria-hidden":"true",children:a.jsx(Ai,{size:Q_,fill:"currentColor"})}),a.jsx("span",{className:Fa.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),a.jsx("button",{type:"button",className:Fa.addButton,onClick:()=>s(SC),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&a.jsx("div",{className:Fa.empty,children:"No environments yet."})]})}function IO(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),o=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=o[o.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):o.push([d,u])}return o}function uk({text:t,indices:s,highlightClass:o}){if(!s||s.length===0)return a.jsx(a.Fragment,{children:t});const r=IO(s),c=[];let d=0;for(const[u,f]of r)u>d&&c.push(a.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(a.jsx("mark",{className:o,children:t.slice(u,f+1)},`m${u}`)),d=f+1;return d<t.length&&c.push(a.jsx("span",{children:t.slice(d)},`p${d}`)),a.jsx(a.Fragment,{children:c})}function OO(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),o=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):o.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return o.sort((r,c)=>r.sortOrder-c.sortOrder)}function LO(t,s){const o=new Map;for(const d of t){const f=d.dependsOn.length>0&&d.dependsOn.some(h=>s.get(h)!=="complete")?"blocked":d.status,m=o.get(f);m?m.push(d):o.set(f,[d])}const r=[],c=new Set;for(const d of wN){c.add(d);const u=o.get(d);if(u&&u.length>0){u.sort((m,h)=>m.sortOrder-h.sortOrder);const f=Qa(d);r.push({status:d,label:f.label,style:f,tasks:u})}}for(const[d,u]of o)if(!c.has(d)&&u.length>0){u.sort((m,h)=>m.sortOrder-h.sortOrder);const f=Qa(d);r.push({status:d,label:f.label,style:f,tasks:u})}return r}const BO="_container_z4i38_1",zO="_header_z4i38_5",$O="_headerActions_z4i38_17",HO="_searchInput_z4i38_23",PO="_searchHighlight_z4i38_56",UO="_groupToggle_z4i38_62",VO="_groupToggleActive_z4i38_89",qO="_addButton_z4i38_93",GO="_taskRow_z4i38_120",FO="_selected_z4i38_140",KO="_expandArrow_z4i38_150",ZO="_expanded_z4i38_157",YO="_leafSpacer_z4i38_161",JO="_taskStatusIcon_z4i38_166",WO="_taskTitle_z4i38_170",XO="_workspaceBadge_z4i38_177",QO="_childCountBadge_z4i38_195",eL="_dependencyBadge_z4i38_208",tL="_blockedBadge_z4i38_220",nL="_addChildButton_z4i38_225",sL="_emptyState_z4i38_268",aL="_statusGroupHeader_z4i38_275",iL="_statusGroupIcon_z4i38_294",oL="_statusGroupLabel_z4i38_298",rL="_statusGroupCount_z4i38_303",We={container:BO,header:zO,headerActions:$O,searchInput:HO,searchHighlight:PO,groupToggle:UO,groupToggleActive:VO,addButton:qO,taskRow:GO,selected:FO,expandArrow:KO,expanded:ZO,leafSpacer:YO,taskStatusIcon:JO,taskTitle:WO,workspaceBadge:XO,childCountBadge:QO,dependencyBadge:eL,blockedBadge:tL,addChildButton:nL,emptyState:sL,statusGroupHeader:aL,statusGroupIcon:iL,statusGroupLabel:oL,statusGroupCount:rL},lL=[{name:"title",weight:2},{name:"description",weight:1}],fk=16,cL=16,pk="grackle-task-group-by-status";function d_(){try{return localStorage.getItem(pk)==="true"}catch{return!1}}function dL(t){try{localStorage.setItem(pk,String(t))}catch{}}function uL({group:t,isExpanded:s,onToggle:o,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return a.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[a.jsxs("div",{className:We.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:o,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o())},children:[a.jsx("span",{className:`${We.expandArrow} ${s?We.expanded:""}`,"aria-hidden":"true",children:a.jsx(va,{size:Ye})}),a.jsx("span",{className:We.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),a.jsx("span",{className:We.statusGroupLabel,children:t.label}),a.jsx("span",{className:We.statusGroupCount,children:t.tasks.length})]}),a.jsx(rs,{children:s&&a.jsx(Ut.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},style:{overflow:"hidden"},children:t.tasks.map(f=>{const m=Qa(f.status),h=r===f.id,v=f.parentTaskId||!f.workspaceId?void 0:u.get(f.workspaceId);return a.jsxs("div",{onClick:()=>c(cs(f.id)),role:"button",tabIndex:0,"aria-label":f.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(cs(f.id)))},className:`${We.taskRow} ${h?We.selected:""}`,style:{"--task-indent":`${fk}px`},"data-task-id":f.id,children:[a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${ml(f.status)}`,children:m.icon}),a.jsx("span",{className:We.taskTitle,title:f.title,children:a.jsx(uk,{text:f.title,indices:d.get(f.id),highlightClass:We.searchHighlight})}),v&&a.jsx("span",{className:We.workspaceBadge,title:v,children:v})]},f.id)})})})]})}function mk({node:t,depth:s,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:f,workspaceNames:m}){const h=Qa(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(N=>u.get(N)!=="complete"),b=o.has(t.id),_=t.children.length>0,x=c===t.id,S=fk+s*cL,T=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>d(cs(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:N=>{N.currentTarget===N.target&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),d(cs(t.id)))},className:`${We.taskRow} ${x?We.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&a.jsx("span",{className:`${We.expandArrow} ${b?We.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:N=>{N.stopPropagation(),r(t.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),N.stopPropagation(),r(t.id))},children:a.jsx(va,{size:Ye,"aria-hidden":"true"})}),!_&&a.jsx("span",{className:We.leafSpacer}),a.jsx("span",{className:We.taskStatusIcon,style:{color:h.color},"aria-hidden":"true","data-testid":`task-status-${ml(t.status)}`,children:h.icon}),a.jsx("span",{className:We.taskTitle,title:t.title,children:a.jsx(uk,{text:t.title,indices:f.get(t.id),highlightClass:We.searchHighlight})}),T&&a.jsx("span",{className:We.workspaceBadge,title:T,children:T}),_&&a.jsxs("span",{className:We.childCountBadge,children:[t.children.filter(N=>N.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&a.jsx("span",{className:`${We.dependencyBadge} ${v?We.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<cj&&a.jsx(ni,{text:"Add child task",children:a.jsx("button",{onClick:N=>{N.stopPropagation(),d(Oi(t.workspaceId,t.id))},"aria-label":"Add child task",className:We.addChildButton,children:"+"})})]}),a.jsx(rs,{children:_&&b&&a.jsx(Ut.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},style:{overflow:"hidden"},children:t.children.map(N=>a.jsx(mk,{node:N,depth:s+1,expandedTasks:o,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:f,workspaceNames:m},N.id))})})]})}function fL({workspaces:t,tasks:s}){const o=kt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[f,m]=y.useState(d_),[h,v]=y.useState(d_),[b,_]=y.useState(new Map),x=sn("/tasks/:taskId/*"),S=(x==null?void 0:x.params.taskId)!=="new"?x==null?void 0:x.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(G=>[G.id,G.status])),[s]),T=y.useMemo(()=>new Map(t.map(G=>[G.id,G.name])),[t]),N=()=>{const G=!f;dL(G),m(G),G&&(v(!0),_(new Map))},C=G=>{_(ne=>{const H=new Map(ne),O=H.has(G)?H.get(G):h;return H.set(G,!O),H})},D=G=>b.has(G)?b.get(G):h,A=G=>{c(ne=>{const H=new Set(ne);return H.has(G)?(H.delete(G),u(O=>new Set(O).add(G))):(H.add(G),u(O=>{const q=new Set(O);return q.delete(G),q})),H})};y.useEffect(()=>{const G=new Set(s.filter(ne=>ne.parentTaskId).map(ne=>ne.parentTaskId));G.size>0&&c(ne=>{const H=new Set(ne);for(const O of G)d.has(O)||H.add(O);return H})},[s,d]);const[E,R]=y.useState(""),{directMatchTaskIds:L,treeMatchTaskIds:M,titleHighlights:$}=y.useMemo(()=>{if(!E.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const G=lj(s,E,lL),ne=new Set(G.map(ge=>ge.item.id)),H=new Map;for(const ge of G){const se=ge.matches.find(ce=>ce.key==="title");se&&H.set(ge.item.id,se.indices)}const O=new Set(ne),q=new Map(s.map(ge=>[ge.id,ge]));for(const ge of[...ne]){let se=q.get(ge);for(;se!=null&&se.parentTaskId;)O.add(se.parentTaskId),se=q.get(se.parentTaskId)}return{directMatchTaskIds:ne,treeMatchTaskIds:O,titleHighlights:H}},[E,s]),Y=L!==null,U=Y?f?L:M:null,X=U?s.filter(G=>U.has(G.id)):s,te=f?[]:OO(X);return a.jsxs("div",{className:We.container,children:[a.jsxs("div",{className:We.header,children:[a.jsx("span",{children:"Tasks"}),a.jsxs("div",{className:We.headerActions,children:[a.jsx(ni,{text:f?"Switch to tree view":"Group tasks by status",children:a.jsx("button",{className:`${We.groupToggle} ${f?We.groupToggleActive:""}`,onClick:N,"aria-label":f?"Switch to tree view":"Group tasks by status","aria-pressed":f,"data-testid":"task-group-by-status-toggle",children:a.jsx($T,{size:Pt})})}),a.jsx(ni,{text:"New task",children:a.jsx("button",{className:We.addButton,onClick:()=>o(Oi()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&a.jsx("input",{type:"text",value:E,onChange:G=>R(G.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:We.searchInput,"data-testid":"sidebar-search"}),f?LO(X,j).map(G=>a.jsx(uL,{group:G,isExpanded:D(G.status),onToggle:()=>C(G.status),selectedTaskId:S,navigate:o,titleHighlights:$,workspaceNames:T},G.status)):te.map(G=>a.jsx(mk,{node:G,depth:0,expandedTasks:r,toggleTask:A,selectedTaskId:S,navigate:o,taskStatusById:j,titleHighlights:$,workspaceNames:T},G.id)),X.length===0&&!Y&&a.jsx("div",{className:We.emptyState,children:"No tasks yet. Click + to create one."}),X.length===0&&Y&&a.jsx("div",{className:We.emptyState,children:"No matching tasks"})]})}const pL="_toast_ed2dk_1",mL="_success_ed2dk_18",hL="_icon_ed2dk_22",gL="_error_ed2dk_25",vL="_warning_ed2dk_32",yL="_info_ed2dk_38",bL="_message_ed2dk_53",_L="_close_ed2dk_60",Fr={toast:pL,success:mL,icon:hL,error:gL,warning:vL,info:yL,message:bL,close:_L},xL={success:a.jsx(Mi,{size:pt}),error:a.jsx(zs,{size:pt}),warning:a.jsx(Em,{size:pt}),info:a.jsx(Cm,{size:pt})};function kL({toast:t,onDismiss:s}){return y.useEffect(()=>{const o=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(o)},[t.id,t.duration,s]),a.jsxs(Ut.div,{className:`${Fr.toast} ${Fr[t.variant]}`,role:"status",initial:{opacity:0,y:-16,scale:.94},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.94},transition:{duration:.2,ease:"easeOut"},layout:!0,children:[a.jsx("span",{className:Fr.icon,"aria-hidden":"true",children:xL[t.variant]}),a.jsx("span",{className:Fr.message,children:t.message}),a.jsx("button",{type:"button",className:Fr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:a.jsx(zs,{size:Pt,"aria-hidden":"true"})})]})}const SL="_container_qqse2_1",jL={container:SL};function TL({toasts:t,onDismiss:s}){return a.jsx("div",{className:jL.container,"data-testid":"toast-container",children:a.jsx(rs,{children:t.map(o=>a.jsx(kL,{toast:o,onDismiss:s},o.id))})})}const NL="_callout_e5awm_1",wL="_success_e5awm_11",CL="_icon_e5awm_15",EL="_error_e5awm_18",AL="_warning_e5awm_25",DL="_info_e5awm_32",ML="_content_e5awm_48",RL="_close_e5awm_53",Kr={callout:NL,success:wL,icon:CL,error:EL,warning:AL,info:DL,content:ML,close:RL},IL={success:a.jsx(Mi,{size:pt}),error:a.jsx(zs,{size:pt}),warning:a.jsx(Em,{size:pt}),info:a.jsx(Cm,{size:pt})};function OL({variant:t="info",children:s,dismissible:o=!1,className:r}){const[c,d]=y.useState(!1);return a.jsx(a.Fragment,{children:!c&&a.jsxs("div",{className:[Kr.callout,Kr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[a.jsx("span",{className:Kr.icon,"aria-hidden":"true",children:IL[t]}),a.jsx("span",{className:Kr.content,children:s}),o&&a.jsx("button",{type:"button",className:Kr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:a.jsx(zs,{size:Pt,"aria-hidden":"true"})})]})})}function LL({currentVersion:t,latestVersion:s,updateAvailable:o,isDocker:r}){if(!o)return a.jsx(a.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return a.jsx("div",{"data-testid":"update-banner",children:a.jsxs(OL,{variant:"info",dismissible:!0,children:[a.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,"). Run:"," ",a.jsx("code",{children:c})]})})}const BL="_container_m1fsr_1",zL="_heading_m1fsr_7",$L="_section_m1fsr_14",HL="_sectionTitle_m1fsr_26",PL="_sectionDescription_m1fsr_35",UL="_emptyState_m1fsr_41",VL="_tokenList_m1fsr_48",qL="_tokenRow_m1fsr_55",GL="_tokenBadge_m1fsr_68",FL="_tokenName_m1fsr_83",KL="_tokenTarget_m1fsr_90",ZL="_deleteButton_m1fsr_99",YL="_addForm_m1fsr_113",JL="_formRow_m1fsr_119",WL="_input_m1fsr_125",XL="_select_m1fsr_155",QL="_addButton_m1fsr_187",eB="_emptyStateInfo_m1fsr_221",tB="_themeOptions_m1fsr_229",nB="_themeOption_m1fsr_229",sB="_themeOptionSelected_m1fsr_254",aB="_themeOptionHeader_m1fsr_259",iB="_themeOptionLabel_m1fsr_266",oB="_themeOptionDesc_m1fsr_273",rB="_variantToggle_m1fsr_279",lB="_variantButton_m1fsr_286",cB="_variantActive_m1fsr_305",dB="_themeSwatches_m1fsr_311",uB="_themeSwatch_m1fsr_311",fB="_systemToggle_m1fsr_325",pB="_systemToggleHint_m1fsr_341",mB="_themeActive_m1fsr_348",hB="_aboutGrid_m1fsr_354",gB="_aboutItem_m1fsr_360",vB="_aboutLabel_m1fsr_373",yB="_aboutValue_m1fsr_379",bB="_aboutDot_m1fsr_387",_B="_aboutDotConnected_m1fsr_394",xB="_aboutDotDisconnected_m1fsr_398",kB="_aboutDotConnecting_m1fsr_402",fe={container:BL,heading:zL,section:$L,sectionTitle:HL,sectionDescription:PL,emptyState:UL,tokenList:VL,tokenRow:qL,tokenBadge:GL,tokenName:FL,tokenTarget:KL,deleteButton:ZL,addForm:YL,formRow:JL,input:WL,select:XL,addButton:QL,emptyStateInfo:eB,themeOptions:tB,themeOption:nB,themeOptionSelected:sB,themeOptionHeader:aB,themeOptionLabel:iB,themeOptionDesc:oB,variantToggle:rB,variantButton:lB,variantActive:cB,themeSwatches:dB,themeSwatch:uB,systemToggle:fB,systemToggleHint:pB,themeActive:mB,aboutGrid:hB,aboutItem:gB,aboutLabel:vB,aboutValue:yB,aboutDot:bB,aboutDotConnected:_B,aboutDotDisconnected:xB,aboutDotConnecting:kB},SB=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function jB({tokens:t,onSetToken:s,onDeleteToken:o,onShowToast:r}){const[c,d]=y.useState(""),[u,f]=y.useState(""),[m,h]=y.useState("env_var"),[v,b]=y.useState(""),[_,x]=y.useState(null),S=N=>{if(N.preventDefault(),!c||!u)return;const C=m==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,m,C,m==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),f(""),b("")},j=N=>{x(N)},T=()=>{_&&(o(_),r==null||r("Token deleted","info")),x(null)};return a.jsxs(a.Fragment,{children:[a.jsx(_s,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:T,onCancel:()=>x(null)}),a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Tokens"}),a.jsx("p",{className:fe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):a.jsx("div",{className:fe.tokenList,children:t.map(N=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenBadge,children:N.tokenType}),a.jsx("span",{className:fe.tokenName,children:N.name}),a.jsx("span",{className:fe.tokenTarget,children:N.tokenType==="env_var"?N.envVar:N.filePath}),a.jsx("button",{className:fe.deleteButton,onClick:()=>j(N.name),title:`Delete ${N.name}`,"aria-label":`Delete ${N.name}`,children:a.jsx(zs,{size:Pt,"aria-hidden":"true"})})]},N.name))}),a.jsxs("form",{className:fe.addForm,onSubmit:S,children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Token name",value:c,onChange:N=>d(N.target.value)}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Value",value:u,onChange:N=>f(N.target.value)})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsx("select",{className:fe.select,value:m,onChange:N=>h(N.target.value),children:SB.map(N=>a.jsx("option",{value:N.value,children:N.label},N.value))}),a.jsx("input",{className:fe.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:N=>b(N.target.value)}),a.jsx("button",{className:fe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const $d=[{id:"grackle",label:"Grackle",description:"The default Grackle theme — iridescent purple on clean dark.",swatches:["#0e1218","#8b5cf6","#60a5fa","#e5e7eb","#34d399"],variantLightId:"grackle-light",variantDarkId:"grackle-dark"},{id:"grackle-light",label:"Grackle Light",description:"Light Grackle variant.",hidden:!0},{id:"grackle-dark",label:"Grackle Dark",description:"Dark Grackle variant.",hidden:!0},{id:"glass",label:"Glassmorphism",description:"Dark frosted-glass aesthetic with backdrop blur effects.",swatches:["#0a0c14","#4ecca3","#70a1ff","#e2e8f0","#a855f7"]},{id:"matrix",label:"Matrix",description:"Phosphor-green CRT terminal with scanlines and glow.",swatches:["#050505","#00ff41","#00bfff","#33ff77","#ffb000"]},{id:"brutalist",label:"Neubrutalism",description:"Thick borders, raw colors, bold type — ugly on purpose.",swatches:["#f5f0e8","#ff5757","#5ce1e6","#1a1a1a","#ffde59"],variantLightId:"brutalist-light",variantDarkId:"brutalist-dark"},{id:"brutalist-light",label:"Neubrutalism Light",description:"Light neubrutalism variant.",hidden:!0},{id:"brutalist-dark",label:"Neubrutalism Dark",description:"Dark neubrutalism variant.",hidden:!0},{id:"monokai",label:"Monokai",description:"Classic warm editor palette — pink, green, and purple.",swatches:["#272822","#f92672","#a6e22e","#f8f8f2","#ae81ff"],variantLightId:"monokai-light",variantDarkId:"monokai-dark"},{id:"monokai-dark",label:"Monokai Dark",description:"Dark Monokai variant.",hidden:!0},{id:"monokai-light",label:"Monokai Light",description:"Light Monokai variant.",hidden:!0},{id:"ubuntu",label:"Ubuntu",description:"Aubergine terminal with the GNOME Tango palette.",swatches:["#300a24","#8ae234","#ef2929","#eeeeec","#fce94f"]},{id:"sandstone",label:"Sandstone",description:"Warm terracotta accent on dark brown, in the style of Claude Code.",swatches:["#1a1815","#C15F3C","#6b8afd","#e8e6e3","#a78bfa"]},{id:"verdigris",label:"Verdigris",description:"Teal accent on charcoal, in the style of ChatGPT.",swatches:["#141414","#00a67e","#3b82f6","#ececec","#ab68ff"]},{id:"primer",label:"Primer",description:"Blue accent on ink-dark grey, in the style of GitHub.",swatches:["#0d1117","#58a6ff","#3fb950","#c9d1d9","#bc8cff"]}],hk=new Set($d.map(t=>t.id)),u_="grackle";function ym(t){return $d.find(s=>s.id===t)}function TB({themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c}){return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Appearance"}),a.jsx("p",{className:fe.sectionDescription,children:"Choose how Grackle looks across the app."}),a.jsx("div",{className:fe.themeOptions,children:$d.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),f=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return a.jsxs("button",{type:"button",className:`${fe.themeOption} ${f?fe.themeOptionSelected:""}`,"aria-pressed":f,onClick:()=>o(d.id),children:[a.jsxs("span",{className:fe.themeOptionHeader,children:[a.jsxs("span",{children:[a.jsx("span",{className:fe.themeOptionLabel,children:d.label}),a.jsx("span",{className:fe.themeOptionDesc,children:d.description})]}),u&&a.jsxs("span",{className:fe.variantToggle,children:[a.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${f&&m?fe.variantActive:""}`,onClick:h=>{h.stopPropagation(),c(!1),o(d.variantLightId)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),c(!1),o(d.variantLightId))},"aria-label":"Light variant","aria-pressed":f&&m,children:"☼"}),a.jsx("span",{role:"button",tabIndex:0,className:`${fe.variantButton} ${f&&!m?fe.variantActive:""}`,onClick:h=>{h.stopPropagation(),c(!1),o(d.variantDarkId)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),h.stopPropagation(),c(!1),o(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":f&&!m,children:"☾"})]})]}),d.swatches&&a.jsx("span",{className:fe.themeSwatches,children:d.swatches.map((h,v)=>a.jsx("span",{className:fe.themeSwatch,style:{background:h}},v))})]},d.id)})}),a.jsxs("label",{className:fe.systemToggle,children:[a.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),a.jsx("span",{children:"Match system light/dark preference"})]}),a.jsx("p",{className:fe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),a.jsxs("p",{className:fe.themeActive,children:["Active theme: ",a.jsx("strong",{children:s})]})]})}const NB={connected:"Connected",connecting:"Connecting...",disconnected:"Disconnected"},wB={connected:fe.aboutDotConnected,connecting:fe.aboutDotConnecting,disconnected:fe.aboutDotDisconnected};function CB({connectionStatus:t,environments:s,sessions:o}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=o.filter(u=>["running","idle"].includes(u.status)).length;return a.jsxs("section",{className:fe.section,"data-testid":"about-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"About"}),a.jsx("p",{className:fe.sectionDescription,children:"Connection status and application information."}),a.jsxs("div",{className:fe.aboutGrid,children:[a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Connection"}),a.jsxs("span",{className:fe.aboutValue,children:[a.jsx("span",{className:`${fe.aboutDot} ${wB[t]}`}),NB[t]]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Environments"}),a.jsxs("span",{className:fe.aboutValue,children:[r,"/",c," connected"]})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Active Sessions"}),a.jsx("span",{className:fe.aboutValue,children:d})]}),a.jsxs("div",{className:fe.aboutItem,children:[a.jsx("span",{className:fe.aboutLabel,children:"Version"}),a.jsx("span",{className:fe.aboutValue,children:"0.138.0"})]})]})]})}const EB="_container_cddyd_1",AB="_header_cddyd_8",DB="_headerTitle_cddyd_35",MB="_badge_cddyd_44",RB="_headerActions_cddyd_54",IB="_body_cddyd_61",OB="_formContent_cddyd_73",LB="_section_cddyd_85",BB="_label_cddyd_91",zB="_titleInput_cddyd_98",$B="_descriptionTextarea_cddyd_131",HB="_parentContext_cddyd_167",PB="_parentLabel_cddyd_175",UB="_parentName_cddyd_182",VB="_personaSelect_cddyd_186",qB="_depList_cddyd_220",GB="_depItem_cddyd_226",FB="_depItemSelected_cddyd_248",KB="_noDeps_cddyd_252",ZB="_btnPrimary_cddyd_258",YB="_btnGhost_cddyd_289",Qe={container:EB,header:AB,headerTitle:DB,badge:MB,headerActions:RB,body:IB,formContent:OB,section:LB,label:BB,titleInput:zB,descriptionTextarea:$B,parentContext:HB,parentLabel:PB,parentName:UB,personaSelect:VB,depList:qB,depItem:GB,depItemSelected:FB,noDeps:KB,btnPrimary:ZB,btnGhost:YB};function gk({mode:t,taskId:s,workspaceId:o,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:f,onCreateTask:m,onUpdateTask:h,onEditDone:v,onShowToast:b}){const _=kt(),x=t==="edit",S=x&&s?d.find(ke=>ke.id===s):void 0,j=x?(S==null?void 0:S.workspaceId)??"":o??"",[T,N]=y.useState(j),C=j||T,D=u.find(ke=>ke.id===C),A=c??(D==null?void 0:D.linkedEnvironmentIds[0]),E=!x&&!o,R=x?(S==null?void 0:S.parentTaskId)??"":r??"",L=R?d.find(ke=>ke.id===R):void 0,[M,$]=y.useState((S==null?void 0:S.title)??""),[Y,U]=y.useState((S==null?void 0:S.description)??""),[X,te]=y.useState((S==null?void 0:S.dependsOn)??[]),[G,ne]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[H,O]=y.useState((S==null?void 0:S.canDecompose)??!1),[q,ge]=y.useState((S==null?void 0:S.injectKnowledge)??!0),[se,ce]=y.useState(!1),me=y.useRef(!1);y.useEffect(()=>{x&&S&&!me.current&&(me.current=!0,$(S.title),U(S.description),te(S.dependsOn),ne(S.defaultPersonaId),O(S.canDecompose),ge(S.injectKnowledge))},[x,S]);const xe=d.filter(ke=>ke.workspaceId===C&&(!x||ke.id!==s)&&ke.id!==R),De=M.trim().length>0&&(!x||S!==void 0)&&C.length>0,ot=ke=>{te(ct=>ct.includes(ke)?ct.filter(ue=>ue!==ke):[...ct,ke])},_t=()=>{!De||se||x&&S===void 0||(x&&s?(h(s,M.trim(),Y,X,G),b==null||b("Task updated","success"),v?v():_(cs(s,void 0,C,A),{replace:!0})):(ce(!0),m(C,M.trim(),Y,X.length>0?X:void 0,R||void 0,G,H,q,()=>{b==null||b("Task created","success"),_(o?Di(o,A):"/tasks",{replace:!0})},ke=>{b==null||b(ke,"error"),ce(!1)})))},lt=()=>{if(v){v();return}_(x&&s?cs(s,void 0,C,A):o?Di(o,A):"/tasks")},Pe=x?"edit task":R?"child task":"new task";return a.jsxs("div",{className:Qe.container,children:[a.jsxs("div",{className:Qe.header,children:[a.jsxs("div",{className:Qe.headerTitle,children:[a.jsx("span",{className:Qe.badge,children:Pe}),L&&a.jsxs("span",{className:Qe.parentContext,children:[a.jsx("span",{className:Qe.parentLabel,children:"Child of"}),a.jsx("span",{className:Qe.parentName,children:L.title})]})]}),a.jsxs("div",{className:Qe.headerActions,children:[a.jsx("button",{onClick:_t,disabled:!De||se,className:Qe.btnPrimary,"data-testid":"task-edit-save",children:se?"Creating…":x?"Save Changes":"Create"}),a.jsx("button",{onClick:lt,className:Qe.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:Qe.body,children:a.jsxs("div",{className:Qe.formContent,children:[E&&a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-workspace",children:"Workspace"}),a.jsxs("select",{id:"task-edit-workspace",value:T,onChange:ke=>N(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-workspace",children:[a.jsx("option",{value:"",children:"Select a workspace..."}),u.map(ke=>a.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-title",children:"Title"}),a.jsx("input",{id:"task-edit-title",type:"text",value:M,onChange:ke=>$(ke.target.value),placeholder:"Task title...",autoFocus:!0,className:Qe.titleInput,"data-testid":"task-edit-title",onKeyDown:ke=>{ke.key==="Enter"&&De&&_t()}})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-description",children:"Description"}),a.jsx("textarea",{id:"task-edit-description",value:Y,onChange:ke=>U(ke.target.value),placeholder:"Describe the task... (markdown supported)",className:Qe.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),a.jsxs("div",{className:Qe.section,children:[a.jsx("label",{className:Qe.label,htmlFor:"task-edit-persona",children:"Default Persona"}),a.jsxs("select",{id:"task-edit-persona",value:G,onChange:ke=>ne(ke.target.value),className:Qe.personaSelect,"data-testid":"task-edit-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),f.map(ke=>a.jsx("option",{value:ke.id,children:ke.name},ke.id))]})]}),!x&&a.jsx("div",{className:Qe.section,children:a.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-can-decompose",children:[a.jsx("input",{type:"checkbox",checked:H,onChange:ke=>O(ke.target.checked)}),"Can spawn subtasks"]})}),!x&&a.jsx("div",{className:Qe.section,children:a.jsxs("label",{className:Qe.depItem,"data-testid":"task-edit-inject-knowledge",children:[a.jsx("input",{type:"checkbox",checked:q,onChange:ke=>ge(ke.target.checked)}),"Inject related prior work from the knowledge graph"]})}),a.jsxs("div",{className:Qe.section,children:[a.jsx("div",{className:Qe.label,children:"Dependencies"}),xe.length===0?a.jsx("div",{className:Qe.noDeps,children:"No other tasks in this workspace"}):a.jsx("div",{className:Qe.depList,children:xe.map(ke=>{const ct=X.includes(ke.id);return a.jsxs("label",{className:`${Qe.depItem} ${ct?Qe.depItemSelected:""}`,"data-testid":`dep-option-${ke.id}`,children:[a.jsx("input",{type:"checkbox",checked:ct,onChange:()=>ot(ke.id)}),ke.title,a.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",ke.status,")"]})]},ke.id)})})]})]})})]})}const JB="_actionButtons_1rjka_1",WB="_btnPrimary_1rjka_8",XB="_btnDanger_1rjka_39",QB="_btnGhost_1rjka_78",Yt={actionButtons:JB,btnPrimary:WB,btnDanger:XB,btnGhost:QB},e8=new Set(["stopped","suspended"]);function t8({task:t,sessionId:s,latestSessionStatus:o,isBlocked:r,onStart:c,onResume:d,onStop:u,onPause:f,onDelete:m,onEdit:h}){if(t.status==="not_started")return r?a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:h,className:Yt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:m,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]}):a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{"data-testid":"task-header-start",onClick:c,className:Yt.btnPrimary,children:"Start"}),a.jsx("button",{onClick:h,className:Yt.btnGhost,"data-testid":"task-action-edit",children:"Edit"}),a.jsx("button",{onClick:m,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]});if(t.status==="working")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:u,className:Yt.btnDanger,"data-testid":"task-action-stop",children:"Stop"}),a.jsx("button",{onClick:f,disabled:!s,className:Yt.btnGhost,"data-testid":"task-action-pause",children:"Pause"})]});if(t.status==="paused"){const v=o!==void 0&&e8.has(o);return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:u,className:Yt.btnPrimary,"data-testid":"task-action-stop",children:"Stop"}),v&&a.jsx("button",{onClick:d,className:Yt.btnGhost,"data-testid":"task-action-resume",children:"Resume"}),a.jsx("button",{onClick:m,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}if(t.status==="complete")return a.jsx("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:a.jsx("button",{onClick:m,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})});if(t.status==="failed")return a.jsxs("div",{className:Yt.actionButtons,"data-testid":"task-action-buttons",children:[a.jsx("button",{onClick:c,className:Yt.btnPrimary,"data-testid":"task-header-start",children:"Retry"}),a.jsx("button",{onClick:m,className:Yt.btnDanger,"data-testid":"task-action-delete",children:"Delete"})]})}const n8="_workpadSection_y8nj9_1",s8="_workpadLabel_y8nj9_9",a8="_workpadStatus_y8nj9_17",i8="_workpadSummary_y8nj9_23",o8="_workpadExtra_y8nj9_29",Ka={workpadSection:n8,workpadLabel:s8,workpadStatus:a8,workpadSummary:i8,workpadExtra:o8};function r8({workpad:t}){if(!t)return;let s;try{const o=JSON.parse(t);if(o==null||typeof o!="object"||Array.isArray(o))return;s=o}catch{return a.jsxs("div",{className:Ka.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Ka.workpadLabel,children:"Workpad"}),a.jsx("div",{className:Ka.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return a.jsxs("div",{className:Ka.workpadSection,"data-testid":"workpad-panel",children:[a.jsx("div",{className:Ka.workpadLabel,children:"Workpad"}),s.status&&a.jsx("div",{className:Ka.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&a.jsx("div",{className:Ka.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&a.jsx("div",{className:Ka.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const l8="_overviewDashboard_ng7kf_1",c8="_overviewHero_ng7kf_7",d8="_statusBadge_ng7kf_14",u8="_statusPending_ng7kf_26",f8="_statusAssigned_ng7kf_31",p8="_statusInProgress_ng7kf_36",m8="_statusReview_ng7kf_41",h8="_statusDone_ng7kf_46",g8="_statusFailed_ng7kf_51",v8="_statusWaitingInput_ng7kf_56",y8="_overviewBranchPill_ng7kf_61",b8="_branchLink_ng7kf_76",_8="_overviewSection_ng7kf_87",x8="_overviewLabel_ng7kf_93",k8="_overviewValue_ng7kf_100",S8="_overviewMuted_ng7kf_105",j8="_overviewMarkdown_ng7kf_111",T8="_envRow_ng7kf_186",N8="_envDot_ng7kf_192",w8="_envDotGreen_ng7kf_199",C8="_envDotYellow_ng7kf_203",E8="_envDotRed_ng7kf_207",A8="_envDotGray_ng7kf_211",D8="_depList_ng7kf_215",M8="_depItem_ng7kf_221",R8="_depBlocked_ng7kf_228",I8="_depDone_ng7kf_232",O8="_timeline_ng7kf_236",L8="_timelineRow_ng7kf_242",B8="_timelineKey_ng7kf_249",z8="_timelineValue_ng7kf_255",$8="_timelineDelta_ng7kf_259",H8="_reviewNotes_ng7kf_270",be={overviewDashboard:l8,overviewHero:c8,statusBadge:d8,statusPending:u8,statusAssigned:f8,statusInProgress:p8,statusReview:m8,statusDone:h8,statusFailed:g8,statusWaitingInput:v8,overviewBranchPill:y8,branchLink:b8,overviewSection:_8,overviewLabel:x8,overviewValue:k8,overviewMuted:S8,overviewMarkdown:j8,envRow:T8,envDot:N8,envDotGreen:w8,envDotYellow:C8,envDotRed:E8,envDotGray:A8,depList:D8,depItem:M8,depBlocked:R8,depDone:I8,timeline:O8,timelineRow:L8,timelineKey:B8,timelineValue:z8,timelineDelta:$8,reviewNotes:H8};function Yc(t){if(!t)return"—";const s=new Date(t);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function Mp(t,s){if(!t||!s)return;const o=new Date(s).getTime()-new Date(t).getTime();if(isNaN(o)||o<0)return;const r=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3);if(r===0)return`${c}s`;const d=Math.floor(r/60),u=r%60;return d===0?`${r}m ${c}s`:`${d}h ${u}m`}function f_(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?be.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?be.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?be.envDotRed:be.envDotGray}function P8({status:t}){const s=Qa(t),o=NN(t);return a.jsx("span",{className:`${be.statusBadge} ${be[o]??be.statusPending}`,"data-testid":"task-overview-status-badge",children:s.label})}function U8({task:t,tasksById:s,environments:o,workspaces:r,taskSessions:c,selectedEnvId:d,taskUsage:u,treeUsage:f}){const m=c.length>0?c[c.length-1]:void 0,h=(m==null?void 0:m.environmentId)??"",v=h?o.find(S=>S.id===h):void 0,b=r.find(S=>S.id===t.workspaceId),_=o.find(S=>S.id===d),x=t.branch&&(b!=null&&b.repoUrl)?`${b.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return a.jsxs("div",{className:be.overviewDashboard,"data-testid":"task-overview-panel",children:[a.jsxs("div",{className:be.overviewHero,children:[a.jsx(P8,{status:t.status}),t.branch&&a.jsx("span",{className:be.overviewBranchPill,"data-testid":"task-overview-branch",children:x?a.jsxs("a",{href:x,target:"_blank",rel:"noreferrer noopener",className:be.branchLink,children:["🔗"," ",t.branch]}):a.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-description",children:[a.jsx("div",{className:be.overviewLabel,children:"Description"}),a.jsx("div",{className:be.overviewMarkdown,children:a.jsx(Tm,{remarkPlugins:[Nm],children:t.description})})]}),t.workpad&&a.jsx(r8,{workpad:t.workpad}),a.jsxs("div",{className:be.overviewSection,children:[a.jsx("div",{className:be.overviewLabel,children:"Environment"}),h&&v?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${f_(v.status)}`,title:v.status,"aria-label":`Status: ${v.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:v.displayName})]}):_?a.jsxs("div",{className:be.envRow,"data-testid":"task-overview-environment",children:[a.jsx("span",{className:`${be.envDot} ${f_(_.status)}`,title:_.status,"aria-label":`Status: ${_.status}`,role:"img"}),a.jsx("span",{className:be.overviewValue,children:_.displayName}),a.jsx("span",{className:be.overviewMuted,children:"(workspace default)"})]}):a.jsx("div",{className:be.overviewMuted,children:"Set in workspace settings"})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-dependencies",children:[a.jsx("div",{className:be.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?a.jsx("div",{className:be.overviewMuted,children:"None"}):a.jsx("div",{className:be.depList,children:t.dependsOn.map(S=>{const j=s.get(S),T=(j==null?void 0:j.status)==="complete";return a.jsxs("div",{className:`${be.depItem} ${T?be.depDone:be.depBlocked}`,children:[a.jsx("span",{children:T?"✓":"○"}),a.jsx("span",{children:(j==null?void 0:j.title)??S})]},S)})})]}),a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-timeline",children:[a.jsx("div",{className:be.overviewLabel,children:"Timeline"}),a.jsxs("div",{className:be.timeline,children:[t.createdAt&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Created"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.createdAt)})]}),t.assignedAt&&(()=>{const S=Mp(t.createdAt,t.assignedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Assigned"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.assignedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.startedAt&&(()=>{const S=Mp(t.assignedAt??t.createdAt,t.startedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Started"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.startedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),t.completedAt&&(()=>{const S=Mp(t.startedAt,t.completedAt);return a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Completed"}),a.jsx("span",{className:be.timelineValue,children:Yc(t.completedAt)}),S!==void 0&&a.jsx("span",{className:be.timelineDelta,children:S})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&a.jsx("div",{className:be.overviewMuted,children:"No timing data"})]})]}),u&&u.costMillicents>0&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-usage",children:[a.jsx("div",{className:be.overviewLabel,children:"Usage"}),a.jsxs("div",{className:be.timeline,children:[a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsx("span",{className:be.timelineValue,children:Rs(u.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[u.sessionCount," session",u.sessionCount!==1?"s":""]})]}),f&&f.costMillicents>u.costMillicents&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Total (incl. subtasks)"}),a.jsx("span",{className:be.timelineValue,children:Rs(f.costMillicents)}),a.jsxs("span",{className:be.timelineDelta,children:[f.sessionCount," session",f.sessionCount!==1?"s":""]})]})]})]}),(t.tokenBudget>0||t.costBudgetMillicents>0)&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-budget",children:[a.jsx("div",{className:be.overviewLabel,children:"Budget"}),a.jsxs("div",{className:be.timeline,children:[t.tokenBudget>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Tokens"}),a.jsxs("span",{className:be.timelineValue,children:[Uo(((u==null?void 0:u.inputTokens)??0)+((u==null?void 0:u.outputTokens)??0))," /"," ",Uo(t.tokenBudget)]})]}),t.costBudgetMillicents>0&&a.jsxs("div",{className:be.timelineRow,children:[a.jsx("span",{className:be.timelineKey,children:"Cost"}),a.jsxs("span",{className:be.timelineValue,children:[Rs((u==null?void 0:u.costMillicents)??0)," /"," ",Rs(t.costBudgetMillicents)]})]})]})]}),t.reviewNotes&&a.jsxs("div",{className:be.overviewSection,"data-testid":"task-overview-review-notes",children:[a.jsx("div",{className:be.overviewLabel,children:"Review Notes"}),a.jsx("div",{className:be.reviewNotes,children:t.reviewNotes})]})]})}function V8({plugins:t,loading:s,onSetPluginEnabled:o}){return a.jsxs("div",{className:fe.container,"data-testid":"plugins-panel",children:[a.jsx("h2",{className:fe.heading,children:"Plugins"}),a.jsxs("div",{className:fe.section,children:[a.jsx("p",{className:fe.sectionDescription,children:"Enable or disable optional Grackle plugins. A server restart is required for changes to take effect."}),s&&a.jsx("p",{className:fe.emptyState,children:"Loading plugins..."}),!s&&t.length===0&&a.jsx("p",{className:fe.emptyState,children:"No plugins found."}),!s&&t.map(r=>{const c=r.enabled!==r.loaded;return a.jsxs("div",{className:fe.tokenRow,"data-testid":`plugin-row-${r.name}`,children:[a.jsxs("div",{style:{flex:1},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx("span",{className:fe.tokenName,children:r.name}),r.required&&a.jsx("span",{className:fe.tokenBadge,title:"Required — cannot be disabled",children:"required"})]}),a.jsx("div",{className:fe.tokenTarget,children:r.description}),c&&a.jsx("div",{style:{fontSize:"var(--font-size-xs)",color:"var(--accent-yellow)",marginTop:"2px"},"data-testid":`plugin-restart-notice-${r.name}`,children:"Restart Grackle to apply changes"})]}),a.jsx("label",{style:{display:"flex",alignItems:"center",gap:"6px",cursor:r.required?"not-allowed":"pointer"},title:r.required?"Core is required and cannot be disabled":void 0,children:a.jsx("input",{type:"checkbox",checked:r.enabled,disabled:r.required,onChange:d=>o(r.name,d.target.checked),"data-testid":`plugin-toggle-${r.name}`,"aria-label":`Enable or disable ${r.name} plugin`,style:{accentColor:"var(--accent-green)",width:"16px",height:"16px"}})})]},r.name)})]})]})}function q8({githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u}){const[f,m]=y.useState(""),[h,v]=y.useState(""),[b,_]=y.useState(!1),[x,S]=y.useState(!1),[j,T]=y.useState(!1),[N,C]=y.useState(null),D=t.find(M=>M.id===N),A=async M=>{if(M.preventDefault(),!(!f.trim()||!h.trim())){S(!0);try{await o(f.trim(),h.trim(),"",b),u==null||u("GitHub account added","success"),m(""),v(""),_(!1)}catch($){const Y=$ instanceof Error?$.message:"Failed to add account";u==null||u(Y,"error")}finally{S(!1)}}},E=async M=>{try{await r(M,{isDefault:!0}),u==null||u("Default account updated","success")}catch($){const Y=$ instanceof Error?$.message:"Failed to update account";u==null||u(Y,"error")}},R=async()=>{if(N)try{await c(N),u==null||u("GitHub account removed","info")}catch(M){const $=M instanceof Error?M.message:"Failed to remove account";u==null||u($,"error")}finally{C(null)}},L=async()=>{T(!0);try{const M=await d();M.imported>0?u==null||u(`Imported ${M.imported} account(s): ${M.usernames.join(", ")}`,"success"):u==null||u("No new accounts to import","info")}catch(M){const $=M instanceof Error?M.message:"Import failed";u==null||u($,"error")}finally{T(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(_s,{isOpen:N!==null,title:"Remove GitHub Account?",description:D?`"${D.label}"${D.username?` (@${D.username})`:""} will be permanently removed.`:void 0,onConfirm:()=>{R().catch(()=>{})},onCancel:()=>C(null)}),a.jsxs("section",{className:fe.section,"data-testid":"github-accounts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"GitHub Accounts"}),a.jsx("p",{className:fe.sectionDescription,children:"Register multiple GitHub accounts to use different identities per environment. The default account is used when no specific account is assigned."}),s&&t.length===0?a.jsx("div",{className:fe.emptyState,children:"Loading..."}):t.length===0?a.jsx("div",{className:fe.emptyStateInfo,children:"No GitHub accounts registered. Add one below or import from the gh CLI."}):a.jsx("div",{className:fe.tokenList,children:t.map(M=>a.jsxs("div",{className:fe.tokenRow,"data-testid":`github-account-row-${M.id}`,children:[M.isDefault&&a.jsx("span",{className:fe.tokenBadge,title:"Default account",children:"default"}),a.jsx("span",{className:fe.tokenName,children:M.label}),M.username&&a.jsxs("span",{className:fe.tokenTarget,children:["@",M.username]}),!M.isDefault&&a.jsx("button",{className:fe.deleteButton,onClick:()=>{E(M.id).catch(()=>{})},title:"Set as default","aria-label":`Set ${M.label} as default`,"data-testid":`github-account-set-default-${M.id}`,children:a.jsx(_N,{size:Pt,"aria-hidden":"true"})}),a.jsx("button",{className:fe.deleteButton,onClick:()=>C(M.id),title:`Remove ${M.label}`,"aria-label":`Remove ${M.label}`,"data-testid":`github-account-remove-${M.id}`,children:a.jsx(zs,{size:Pt,"aria-hidden":"true"})})]},M.id))}),a.jsxs("form",{className:fe.addForm,onSubmit:M=>{A(M).catch(()=>{})},children:[a.jsxs("div",{className:fe.formRow,children:[a.jsx("input",{className:fe.input,type:"text",placeholder:"Label (e.g. personal, work)",value:f,onChange:M=>m(M.target.value),"data-testid":"github-account-label-input"}),a.jsx("input",{className:fe.input,type:"password",placeholder:"Personal access token",value:h,onChange:M=>v(M.target.value),"data-testid":"github-account-token-input"})]}),a.jsxs("div",{className:fe.formRow,children:[a.jsxs("label",{className:fe.tokenTarget,style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:b,onChange:M=>_(M.target.checked),"data-testid":"github-account-default-checkbox"}),"Set as default"]}),a.jsx("button",{className:fe.addButton,type:"submit",disabled:!f.trim()||!h.trim()||x,"data-testid":"github-account-add-button",children:x?"Adding...":"Add Account"}),a.jsx("button",{className:fe.addButton,type:"button",onClick:()=>{L().catch(()=>{})},disabled:j,"data-testid":"github-account-import-button",children:j?"Importing...":"Import from gh CLI"})]})]})]})]})}const G8="_container_legrg_1",F8="_header_legrg_8",K8="_headerTitle_legrg_35",Z8="_badge_legrg_44",Y8="_headerActions_legrg_54",J8="_body_legrg_61",W8="_formContent_legrg_73",X8="_section_legrg_85",Q8="_label_legrg_91",e7="_nameInput_legrg_98",t7="_fieldInput_legrg_131",n7="_adapterSelect_legrg_164",s7="_readOnlyValue_legrg_198",a7="_codespaceSection_legrg_204",i7="_codespaceActions_legrg_210",o7="_creatingHint_legrg_216",r7="_errorHint_legrg_222",l7="_btnPrimary_legrg_235",c7="_btnGhost_legrg_266",re={container:G8,header:F8,headerTitle:K8,badge:Z8,headerActions:Y8,body:J8,formContent:W8,section:X8,label:Q8,nameInput:e7,fieldInput:t7,adapterSelect:n7,readOnlyValue:s7,codespaceSection:a7,codespaceActions:i7,creatingHint:o7,errorHint:r7,btnPrimary:l7,btnGhost:c7},cd=1,dd=65535;function Rp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=cd&&s<=dd}function Ip(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function d7({codespaceName:t,onCodespaceNameChange:s,envName:o,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:f,onCreateCodespace:m}){const[h,v]=y.useState("pick"),[b,_]=y.useState(""),[x,S]=y.useState("");return h==="create"?a.jsxs("div",{className:re.codespaceSection,children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Repository"}),a.jsx("input",{type:"text",value:b,onChange:j=>_(j.target.value),placeholder:"owner/repo",className:re.fieldInput,"data-testid":"env-codespace-repo"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Machine Type"}),a.jsx("input",{type:"text",value:x,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:re.fieldInput,"data-testid":"env-codespace-machine"})]}),a.jsxs("div",{className:re.codespaceActions,children:[a.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),x.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:re.btnPrimary,children:"Create"}),a.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:re.btnGhost,children:"Cancel"})]})]}):a.jsx("div",{className:re.codespaceSection,children:a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Codespace"}),!u&&a.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!o.trim()&&r(j.target.value))},disabled:f,className:re.adapterSelect,"data-testid":"env-codespace-select",children:[a.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>a.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),a.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),f&&a.jsx("span",{className:re.creatingHint,children:"Creating codespace..."}),u&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:re.errorHint,children:u}),a.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:re.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&a.jsx("span",{className:re.errorHint,children:d})]})})}function vk({mode:t,environmentId:s,environments:o,githubAccounts:r,onAddEnvironment:c,onUpdateEnvironment:d,onListCodespaces:u,codespaces:f,codespaceError:m,codespaceListError:h,codespaceCreating:v,onCreateCodespace:b,onListDockerContainers:_,dockerContainers:x,dockerContainersError:S,onShowToast:j}){const T=kt(),N=t==="edit",C=N&&s?o.find(le=>le.id===s):void 0,[D,A]=y.useState(""),[E,R]=y.useState("local"),[L,M]=y.useState(""),[$,Y]=y.useState(""),[U,X]=y.useState(""),[te,G]=y.useState(""),[ne,H]=y.useState(""),[O,q]=y.useState(""),[ge,se]=y.useState(""),[ce,me]=y.useState(""),[xe,De]=y.useState("create"),[ot,_t]=y.useState(""),[lt,Pe]=y.useState(null),ke=y.useCallback(()=>{const le={};if(E==="local"){if(L.trim()&&(le.host=L.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(le.port=ve)}}else if(E==="ssh"){if(le.host=L.trim(),U.trim()&&(le.user=U.trim()),$.trim()){const ve=Number($);Number.isInteger(ve)&&(le.sshPort=ve)}te.trim()&&(le.identityFile=te.trim())}else E==="docker"?xe==="attach"?ot.trim()&&(le.attach=ot.trim()):(ne.trim()&&(le.image=ne.trim()),O.trim()&&(le.repo=O.trim())):E==="codespace"&&(le.codespaceName=ge.trim());return le},[E,L,$,U,te,ne,O,ge,xe,ot]),ct=()=>!(!D.trim()||E==="ssh"&&!L.trim()||E==="codespace"&&!ge.trim()||E==="docker"&&xe==="attach"&&!ot.trim()||(E==="local"||E==="ssh")&&!Rp($)),ue=()=>{ct()&&(c(D.trim(),E,ke(),ce||void 0),j==null||j("Environment added successfully","success"),T(Ho,{replace:!0}))},Ie=()=>{T(s?Po(s):Ho)},ee=y.useCallback((le,ve)=>{if(!C||!s)return;const et=Ip(C.adapterConfig),on=ve.trim();on?et[le]=on:delete et[le],d(s,{adapterConfig:et})},[C,s,d]),nt=y.useCallback((le,ve)=>{if(!C||!s)return;const et=Ip(C.adapterConfig);if(ve.trim()){const on=Number(ve);Number.isInteger(on)&&on>=cd&&on<=dd&&(et[le]=on)}else delete et[le];d(s,{adapterConfig:et})},[C,s,d]);if(N){if(!C)return a.jsxs("div",{className:re.container,children:[a.jsxs("div",{className:re.header,children:[a.jsx("div",{className:re.headerTitle,children:a.jsx("span",{className:re.badge,children:"edit environment"})}),a.jsx("div",{className:re.headerActions,children:a.jsx("button",{onClick:Ie,className:re.btnGhost,children:"Back"})})]}),a.jsx("div",{className:re.body,children:a.jsx("div",{className:re.formContent,children:a.jsx("span",{className:re.readOnlyValue,children:"Environment not found"})})})]});const le=Ip(C.adapterConfig);return a.jsxs("div",{className:re.container,"data-testid":"env-edit-panel",children:[a.jsxs("div",{className:re.header,children:[a.jsx("div",{className:re.headerTitle,children:a.jsx("span",{className:re.badge,children:"edit environment"})}),a.jsx("div",{className:re.headerActions,children:a.jsx("button",{onClick:Ie,className:re.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),a.jsx("div",{className:re.body,children:a.jsxs("div",{className:re.formContent,children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Name"}),a.jsx($t,{value:C.displayName,onSave:ve=>{s&&d(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:lt,onActivate:Pe,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Adapter Type"}),a.jsx("span",{className:re.readOnlyValue,"data-testid":"env-edit-adapter-type",children:C.adapterType})]}),(C.adapterType==="codespace"||C.adapterType==="docker")&&(r.length>0||!!C.githubAccountId)&&a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"GitHub Account"}),a.jsxs("select",{value:C.githubAccountId||"",onChange:ve=>{s&&d(s,{githubAccountId:ve.target.value})},className:re.adapterSelect,"data-testid":"env-edit-github-account",children:[a.jsx("option",{value:"",children:"(Default)"}),r.map(ve=>a.jsxs("option",{value:ve.id,children:[ve.label,ve.username?` (@${ve.username})`:"",ve.isDefault?" — default":""]},ve.id))]})]}),C.adapterType==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Host"}),a.jsx($t,{value:String(le.host??""),onSave:ve=>ee("host",ve),mode:"edit",fieldId:"host",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Port"}),a.jsx($t,{value:String(le.port??""),onSave:ve=>nt("port",ve),validate:ve=>Rp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),C.adapterType==="ssh"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Host"}),a.jsx($t,{value:String(le.host??""),onSave:ve=>ee("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:lt,onActivate:Pe,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"User"}),a.jsx($t,{value:String(le.user??""),onSave:ve=>ee("user",ve),mode:"edit",fieldId:"user",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"SSH Port"}),a.jsx($t,{value:String(le.sshPort??""),onSave:ve=>nt("sshPort",ve),validate:ve=>Rp(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:lt,onActivate:Pe,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Identity File"}),a.jsx($t,{value:String(le.identityFile??""),onSave:ve=>ee("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:lt,onActivate:Pe,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),C.adapterType==="docker"&&le.attach!==void 0&&a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Attach (container)"}),a.jsx($t,{value:String(le.attach??""),onSave:ve=>ee("attach",ve),validate:ve=>ve.trim()===""?"Container name is required":void 0,mode:"edit",fieldId:"attach",activeFieldId:lt,onActivate:Pe,placeholder:"container name or ID",ariaLabel:"Attach container","data-testid":"env-edit-attach"})]}),C.adapterType==="docker"&&le.attach===void 0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Image"}),a.jsx($t,{value:String(le.image??""),onSave:ve=>ee("image",ve),mode:"edit",fieldId:"image",activeFieldId:lt,onActivate:Pe,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Repo"}),a.jsx($t,{value:String(le.repo??""),onSave:ve=>ee("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:lt,onActivate:Pe,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),C.adapterType==="codespace"&&a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Codespace Name"}),a.jsx($t,{value:String(le.codespaceName??""),onSave:ve=>ee("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:lt,onActivate:Pe,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return a.jsxs("div",{className:re.container,"data-testid":"env-create-panel",children:[a.jsxs("div",{className:re.header,children:[a.jsx("div",{className:re.headerTitle,children:a.jsx("span",{className:re.badge,children:"new environment"})}),a.jsxs("div",{className:re.headerActions,children:[a.jsx("button",{onClick:ue,disabled:!ct(),className:re.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),a.jsx("button",{onClick:Ie,className:re.btnGhost,children:"Cancel"})]})]}),a.jsx("div",{className:re.body,children:a.jsxs("div",{className:re.formContent,children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-name",children:"Name"}),a.jsx("input",{id:"env-create-name",type:"text",value:D,onChange:le=>A(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:re.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&ct()&&ue()}})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),a.jsxs("select",{id:"env-create-adapter",value:E,onChange:le=>{R(le.target.value),le.target.value==="codespace"&&u(ce||void 0)},className:re.adapterSelect,"data-testid":"env-create-adapter",children:[a.jsx("option",{value:"local",children:"local"}),a.jsx("option",{value:"ssh",children:"ssh"}),a.jsx("option",{value:"docker",children:"docker"}),a.jsx("option",{value:"codespace",children:"codespace"})]})]}),(E==="codespace"||E==="docker")&&r.length>0&&a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-github-account",children:"GitHub Account"}),a.jsxs("select",{id:"env-create-github-account",value:ce,onChange:le=>{me(le.target.value),E==="codespace"&&u(le.target.value||void 0)},className:re.adapterSelect,"data-testid":"env-create-github-account",children:[a.jsx("option",{value:"",children:"(Default)"}),r.map(le=>a.jsxs("option",{value:le.id,children:[le.label," (@",le.username,")",le.isDefault?" — default":""]},le.id))]})]}),E==="local"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-host",children:"Host"}),a.jsx("input",{id:"env-create-host",type:"text",value:L,onChange:le=>M(le.target.value),placeholder:"Host (optional)...",className:re.fieldInput,"data-testid":"env-create-host"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-port",children:"Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:cd,max:dd,value:$,onChange:le=>Y(le.target.value),placeholder:"Port (optional)...",className:re.fieldInput,"data-testid":"env-create-port"})]})]}),E==="ssh"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-host",children:"Host"}),a.jsx("input",{id:"env-create-host",type:"text",value:L,onChange:le=>M(le.target.value),placeholder:"Host (required)...",className:re.fieldInput,"data-testid":"env-create-host"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-user",children:"User"}),a.jsx("input",{id:"env-create-user",type:"text",value:U,onChange:le=>X(le.target.value),placeholder:"User (optional)...",className:re.fieldInput,"data-testid":"env-create-user"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-port",children:"SSH Port"}),a.jsx("input",{id:"env-create-port",type:"number",min:cd,max:dd,value:$,onChange:le=>Y(le.target.value),placeholder:"SSH port (optional)...",className:re.fieldInput,"data-testid":"env-create-port"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-identity",children:"Identity File"}),a.jsx("input",{id:"env-create-identity",type:"text",value:te,onChange:le=>G(le.target.value),placeholder:"Identity file (optional)...",className:re.fieldInput,"data-testid":"env-create-identity"})]})]}),E==="docker"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-docker-mode",children:"Source"}),a.jsxs("select",{id:"env-docker-mode",value:xe,onChange:le=>{const ve=le.target.value;De(ve),ve==="attach"&&_()},className:re.adapterSelect,"data-testid":"env-docker-mode",children:[a.jsx("option",{value:"create",children:"Create new container"}),a.jsx("option",{value:"attach",children:"Attach to existing container"})]})]}),xe==="create"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-image",children:"Image"}),a.jsx("input",{id:"env-create-image",type:"text",value:ne,onChange:le=>H(le.target.value),placeholder:"Image (optional)...",className:re.fieldInput,"data-testid":"env-create-image"})]}),a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,htmlFor:"env-create-repo",children:"Repo"}),a.jsx("input",{id:"env-create-repo",type:"text",value:O,onChange:le=>q(le.target.value),placeholder:"Repo (optional)...",className:re.fieldInput,"data-testid":"env-create-repo"})]})]}):a.jsxs("div",{className:re.section,children:[a.jsx("label",{className:re.label,children:"Container"}),!S&&x.length>0&&a.jsxs("select",{value:ot,onChange:le=>{_t(le.target.value),le.target.value&&!D.trim()&&A(le.target.value)},className:re.adapterSelect,"data-testid":"env-docker-container-select",children:[a.jsx("option",{value:"",children:"Select a container..."}),x.map(le=>a.jsxs("option",{value:le.name,children:[le.name," (",le.image,") ",le.status]},le.id))]}),(S||x.length===0)&&a.jsxs(a.Fragment,{children:[S?a.jsx("span",{className:re.errorHint,children:S}):a.jsx("span",{className:re.creatingHint,children:"No running containers found."}),a.jsx("input",{type:"text",value:ot,onChange:le=>{_t(le.target.value),le.target.value&&!D.trim()&&A(le.target.value)},placeholder:"Enter container name/ID...",className:re.fieldInput,"data-testid":"env-docker-container-manual"})]})]})]}),E==="codespace"&&a.jsx(d7,{codespaceName:ge,onCodespaceNameChange:se,envName:D,onEnvNameChange:A,codespaces:f,codespaceError:m,codespaceListError:h,codespaceCreating:v,onCreateCodespace:b})]})})]})}const u7="_group_1iprv_1",f7="_groupTitle_1iprv_8",p7="_shortcutList_1iprv_17",m7="_shortcutRow_1iprv_23",h7="_keys_1iprv_36",g7="_kbd_1iprv_43",v7="_description_1iprv_60",Ti={group:u7,groupTitle:f7,shortcutList:p7,shortcutRow:m7,keys:h7,kbd:g7,description:v7},y7=[{title:"Global",shortcuts:[{keys:["?"],description:"Open keyboard shortcuts reference"},{keys:["N"],description:"Create a new task"},{keys:["Escape"],description:"Close dialog or cancel editing"}]},{title:"Task Page",shortcuts:[{keys:["1"],description:"Switch to Overview tab"},{keys:["2"],description:"Switch to Stream tab"}]},{title:"Workspace Page",shortcuts:[{keys:["1"],description:"Switch to Graph view"},{keys:["2"],description:"Switch to Board view"},{keys:["3"],description:"Switch to Tasks view"}]},{title:"Navigation Lists",shortcuts:[{keys:["←"],description:"Previous tab (horizontal nav)"},{keys:["→"],description:"Next tab (horizontal nav)"},{keys:["↑"],description:"Previous item (vertical nav)"},{keys:["↓"],description:"Next item (vertical nav)"},{keys:["J"],description:"Next item (alias for arrow down/right)"},{keys:["K"],description:"Previous item (alias for arrow up/left)"},{keys:["Home"],description:"Jump to first item"},{keys:["End"],description:"Jump to last item"}]},{title:"Editing",shortcuts:[{keys:["Enter"],description:"Activate / save inline edit"},{keys:["Space"],description:"Activate button or start editing"},{keys:["Escape"],description:"Cancel edit and discard changes"}]},{title:"Root",shortcuts:[{keys:["Ctrl/Cmd","Enter"],description:"Send message (when the composer is focused)"},{keys:["Enter"],description:"Insert a new line in the message composer"}]}];function b7(){return a.jsxs("section",{className:fe.section,"data-testid":"keyboard-shortcuts-panel",children:[a.jsx("h3",{className:fe.sectionTitle,children:"Keyboard Shortcuts"}),a.jsx("p",{className:fe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),y7.map(t=>a.jsxs("div",{className:Ti.group,children:[a.jsx("h4",{className:Ti.groupTitle,children:t.title}),a.jsx("div",{className:Ti.shortcutList,children:t.shortcuts.map(s=>a.jsxs("div",{className:Ti.shortcutRow,children:[a.jsx("span",{className:Ti.keys,children:s.keys.map(o=>a.jsx("kbd",{className:Ti.kbd,children:o},o))}),a.jsx("span",{className:Ti.description,children:s.description})]},s.description))})]},t.title))]})}const _7=[{key:"claude",label:"Claude",description:"Forward Claude credentials for AI agent access.",options:[{value:"off",label:"Off"},{value:"subscription",label:"Subscription"},{value:"api_key",label:"API Key"}]},{key:"github",label:"GitHub",description:"Forward GITHUB_TOKEN and GH_TOKEN for git operations.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"copilot",label:"Copilot",description:"Forward Copilot tokens (COPILOT_GITHUB_TOKEN, CLI config).",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"codex",label:"Codex",description:"Forward OPENAI_API_KEY for Codex/OpenAI access.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]},{key:"goose",label:"Goose",description:"Forward Goose config and API keys for Goose agent access.",options:[{value:"off",label:"Off"},{value:"on",label:"On"}]}];function x7({credentialProviders:t,onUpdateCredentialProviders:s}){const o=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return a.jsxs("section",{className:fe.section,children:[a.jsx("h3",{className:fe.sectionTitle,children:"Credential Providers"}),a.jsx("p",{className:fe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),a.jsx("div",{className:fe.tokenList,children:_7.map(r=>a.jsxs("div",{className:fe.tokenRow,children:[a.jsx("span",{className:fe.tokenName,children:r.label}),a.jsx("span",{className:fe.tokenTarget,children:r.description}),a.jsx("select",{className:fe.select,value:t[r.key],onChange:c=>o(r.key,c.target.value),children:r.options.map(c=>a.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const k7="_container_10efq_1",S7="_header_10efq_7",j7="_list_10efq_105",T7="_card_10efq_111",N7="_cardHeader_10efq_125",w7="_cardTitle_10efq_135",C7="_defaultBadge_10efq_141",E7="_cardActions_10efq_155",A7="_description_10efq_160",D7="_meta_10efq_166",M7="_empty_10efq_212",R7="_typeBadge_10efq_362",ts={container:k7,header:S7,list:j7,card:T7,cardHeader:N7,cardTitle:w7,defaultBadge:C7,cardActions:E7,description:A7,meta:D7,empty:M7,typeBadge:R7};function I7({personas:t,appDefaultPersonaId:s,onDeletePersona:o,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,f]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,h=async v=>{await o(v),f(null)};return a.jsxs("div",{className:ts.container,children:[a.jsxs("div",{className:ts.header,children:[a.jsx("h2",{children:"Personas"}),a.jsx(an,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?a.jsx("p",{className:ts.empty,children:"No personas yet. Create one to get started."}):a.jsx("div",{className:ts.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return a.jsxs("div",{className:ts.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(v.id))},children:[a.jsxs("div",{className:ts.cardHeader,children:[a.jsxs("span",{className:ts.cardTitle,children:[a.jsx("strong",{children:v.name}),a.jsx("span",{className:ts.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&a.jsx("span",{className:ts.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),a.jsxs("div",{className:ts.cardActions,onClick:x=>x.stopPropagation(),children:[!b&&a.jsx(an,{variant:"ghost",size:"sm",onClick:()=>{r(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),a.jsx(an,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),a.jsx(an,{variant:"ghost",size:"sm",onClick:()=>f(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&a.jsx("p",{className:ts.description,children:v.description}),a.jsxs("div",{className:ts.meta,children:[v.runtime&&a.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&a.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&a.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),a.jsx(_s,{isOpen:u!==null,title:"Delete Persona?",description:`"${(m==null?void 0:m.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&h(u).catch(()=>{})},onCancel:()=>f(null)})]})}const O7="_container_uy08i_1",L7="_header_uy08i_7",B7="_count_uy08i_13",z7="_presets_uy08i_18",$7="_presetButton_uy08i_24",H7="_filterInput_uy08i_41",P7="_groups_uy08i_53",U7="_group_uy08i_53",V7="_groupHeader_uy08i_68",q7="_groupName_uy08i_77",G7="_groupCount_uy08i_81",F7="_toolList_uy08i_87",K7="_toolItem_uy08i_95",Z7="_toolName_uy08i_103",_n={container:O7,header:L7,count:B7,presets:z7,presetButton:$7,filterInput:H7,groups:P7,group:U7,groupHeader:V7,groupName:q7,groupCount:G7,toolList:F7,toolItem:K7,toolName:Z7},Y7=(()=>{const t=new Map;for(const s of Z_){const o=s==="get_version_status"?"version":s.split("_")[0];t.has(o)||t.set(o,[]),t.get(o).push(s)}return[...t.entries()].sort(([s],[o])=>s.localeCompare(o)).map(([s,o])=>({group:s,tools:o.sort()}))})(),J7=[{name:"default",label:"Default",tools:K_},{name:"worker",label:"Worker",tools:dj},{name:"orchestrator",label:"Orchestrator",tools:uj},{name:"admin",label:"Admin",tools:fj}];function p_({selectedTools:t,onChange:s,disabled:o}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(o)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,o]),f=y.useCallback((v,b)=>{if(o)return;const _=new Set(d);for(const x of v)b?_.delete(x):_.add(x);s([..._].sort())},[d,s,o]),m=y.useCallback(v=>{o||s([...v].sort())},[s,o]),h=r.toLowerCase();return a.jsxs("div",{className:_n.container,"data-testid":"mcp-tool-selector",children:[a.jsx("div",{className:_n.header,children:a.jsx("span",{className:_n.count,children:t.length===0?`Using default (${K_.length} tools)`:`${t.length} of ${Z_.size} tools selected`})}),a.jsxs("div",{className:_n.presets,"data-testid":"mcp-tool-presets",children:[J7.map(v=>a.jsx("button",{type:"button",className:_n.presetButton,disabled:o,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),a.jsx("button",{type:"button",className:_n.presetButton,disabled:o,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),a.jsx("input",{type:"text",className:_n.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:o,"data-testid":"mcp-tool-filter"}),a.jsx("div",{className:_n.groups,children:Y7.map(({group:v,tools:b})=>{const _=h?b.filter(S=>S.toLowerCase().includes(h)):b;if(_.length===0)return null;const x=_.every(S=>d.has(S));return a.jsxs("div",{className:_n.group,"data-testid":`tool-group-${v}`,children:[a.jsxs("label",{className:_n.groupHeader,children:[a.jsx("input",{type:"checkbox",checked:x,onChange:()=>f(_,x),disabled:o,"data-testid":`group-toggle-${v}`}),a.jsx("span",{className:_n.groupName,children:v}),a.jsxs("span",{className:_n.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),a.jsx("div",{className:_n.toolList,children:_.map(S=>a.jsxs("label",{className:_n.toolItem,children:[a.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:o,"data-testid":`tool-${S}`}),a.jsx("span",{className:_n.toolName,children:S})]},S))})]},v)})})]})}const W7="_container_1gfuq_1",X7="_header_1gfuq_7",Q7="_list_1gfuq_19",ez="_card_1gfuq_25",tz="_cardHeader_1gfuq_40",nz="_cardTitle_1gfuq_46",sz="_statusBadge_1gfuq_56",az="_enabled_1gfuq_68",iz="_disabled_1gfuq_71",oz="_cardActions_1gfuq_75",rz="_cardMeta_1gfuq_80",lz="_empty_1gfuq_98",ns={container:W7,header:X7,list:Q7,card:ez,cardHeader:tz,cardTitle:nz,statusBadge:sz,enabled:az,disabled:iz,cardActions:oz,cardMeta:rz,empty:lz};function cz({schedules:t,personas:s,onDeleteSchedule:o,onToggleEnabled:r,onNavigateToNew:c,onNavigateToSchedule:d}){const[u,f]=y.useState(null),m=u?t.find(_=>_.id===u):void 0,h=async _=>{await o(_),f(null)},v=y.useMemo(()=>{const _=new Map;for(const x of s)_.set(x.id,x.name);return _},[s]),b=_=>v.get(_)??_;return a.jsxs("div",{className:ns.container,children:[a.jsxs("div",{className:ns.header,children:[a.jsx("h2",{children:"Schedules"}),a.jsx(an,{variant:"primary",size:"md",onClick:c,"data-testid":"schedule-new-button",children:"+ New Schedule"})]}),t.length===0?a.jsx("p",{className:ns.empty,"data-testid":"schedule-empty-state",children:"No schedules yet. Create one to run tasks on a recurring cadence."}):a.jsx("div",{className:ns.list,children:t.map(_=>a.jsxs("div",{className:ns.card,"data-testid":`schedule-card-${_.id}`,onClick:()=>d(_.id),role:"button",tabIndex:0,onKeyDown:x=>{x.currentTarget===x.target&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d(_.id))},children:[a.jsxs("div",{className:ns.cardHeader,children:[a.jsxs("span",{className:ns.cardTitle,children:[a.jsx("strong",{children:_.title}),a.jsx("span",{className:`${ns.statusBadge} ${_.enabled?ns.enabled:ns.disabled}`,"data-testid":`schedule-status-badge-${_.id}`,children:_.enabled?"Enabled":"Disabled"})]}),a.jsxs("div",{className:ns.cardActions,onClick:x=>x.stopPropagation(),children:[a.jsx(an,{variant:"ghost",size:"sm",onClick:()=>{(async()=>{await r(_.id,{enabled:!_.enabled})})().catch(()=>{})},"data-testid":`schedule-toggle-${_.id}`,title:_.enabled?"Disable schedule":"Enable schedule",children:_.enabled?"Disable":"Enable"}),a.jsx(an,{variant:"ghost",size:"sm",onClick:()=>d(_.id),"data-testid":`schedule-edit-${_.id}`,children:"Edit"}),a.jsx(an,{variant:"ghost",size:"sm",onClick:()=>f(_.id),"data-testid":`schedule-delete-${_.id}`,children:"Delete"})]})]}),a.jsxs("div",{className:ns.cardMeta,children:[a.jsx("span",{"data-testid":`schedule-expression-${_.id}`,children:_.scheduleExpression}),_.personaId&&a.jsxs("span",{"data-testid":`schedule-persona-${_.id}`,children:["Persona: ",b(_.personaId)]}),a.jsxs("span",{"data-testid":`schedule-last-run-${_.id}`,children:["Last run: ",_.lastRunAt?gm(_.lastRunAt):"Never"]}),_.enabled&&_.nextRunAt?a.jsxs("span",{"data-testid":`schedule-next-run-${_.id}`,children:["Next run: ",ik(_.nextRunAt)]}):null,_.runCount>0&&a.jsxs("span",{"data-testid":`schedule-run-count-${_.id}`,children:["Runs: ",_.runCount]})]})]},_.id))}),a.jsx(_s,{isOpen:u!==null,title:"Delete Schedule?",description:`"${(m==null?void 0:m.title)??""}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:()=>{u&&h(u).catch(()=>{})},onCancel:()=>f(null)})]})}const dz="_nav_1bhou_1",uz="_tab_1bhou_24",fz="_tabIcon_1bhou_62",pz="_tabActive_1bhou_68",Jc={nav:dz,tab:uz,tabIcon:fz,tabActive:pz},la=[{path:"credentials",label:"Credentials",icon:a.jsx(RT,{size:pt})},{path:"github-accounts",label:"GitHub Accounts",icon:a.jsx(NT,{size:pt})},{path:"schedules",label:"Schedules",icon:a.jsx(tT,{size:pt})},{path:"appearance",label:"Appearance",icon:a.jsx(QT,{size:pt})},{path:"shortcuts",label:"Shortcuts",icon:a.jsx(OT,{size:pt})},{path:"plugins",label:"Plugins",icon:a.jsx(uN,{size:pt})},{path:"about",label:"About",icon:a.jsx(Cm,{size:pt})}];function mz(){var u;const t=Wt(),s=kt(),o=y.useRef(null),r=((u=la.find(f=>{const m=`${Bo}/${f.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??la[0].path,c=y.useCallback(f=>{s(`${Bo}/${f}`)},[s]),d=y.useCallback(f=>{var x,S;const m=(x=o.current)==null?void 0:x.querySelectorAll('[role="tab"]');if(!m)return;const h=Array.from(m).findIndex(j=>j===document.activeElement),v=h>=0?h:la.findIndex(j=>j.path===r);let b=v;if(f.key==="ArrowDown"||f.key==="j"||f.key==="J")f.preventDefault(),b=(v+1)%la.length;else if(f.key==="ArrowUp"||f.key==="k"||f.key==="K")f.preventDefault(),b=(v-1+la.length)%la.length;else if(f.key==="Home")f.preventDefault(),b=0;else if(f.key==="End")f.preventDefault(),b=la.length-1;else return;const _=la[b].path;s(`${Bo}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return a.jsx("nav",{className:Jc.nav,ref:o,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:la.map(f=>{const m=f.path===r;return a.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Jc.tab} ${m?Jc.tabActive:""}`,onClick:()=>c(f.path),children:[a.jsx("span",{className:Jc.tabIcon,"aria-hidden":"true",children:f.icon}),f.label]},f.path)})})}const hz=["lifecycle:","pipe:","stdin:"];function xh(t){return t.selfEcho?"chatroom":t.name.startsWith("pipe:")?"pipe":"channel"}function yk(t,s){let o=!1;for(const r of t.subscribers){const c=s.get(r.sessionId);if(c&&(o=!0,c.taskId))return{kind:"task",taskId:c.taskId}}return o?{kind:"unattached"}:{kind:"external"}}function gz(t,s){const o=new Map(s.map(u=>[u.id,u])),r=new Map,c=[];for(const u of t){const f=yk(u,o);if(f.kind==="task"){const m=r.get(f.taskId);m?m.push(u):r.set(f.taskId,[u])}else c.push(u)}const d=Array.from(r,([u,f])=>({taskId:u,streams:f}));return c.length>0&&d.push({taskId:void 0,streams:c}),d}const vz="_container_16qkd_1",yz="_header_16qkd_7",bz="_title_16qkd_15",_z="_headerActions_16qkd_21",xz="_internalsToggle_16qkd_27",kz="_refreshButton_16qkd_37",Sz="_state_16qkd_52",jz="_group_16qkd_59",Tz="_groupHeader_16qkd_63",Nz="_row_16qkd_72",wz="_selected_16qkd_92",Cz="_kindBadge_16qkd_96",Ez="_kindChatroom_16qkd_108",Az="_kindPipe_16qkd_114",Dz="_kindChannel_16qkd_120",Mz="_streamName_16qkd_126",Rz="_meta_16qkd_135",Jt={container:vz,header:yz,title:bz,headerActions:_z,internalsToggle:xz,refreshButton:kz,state:Sz,group:jz,groupHeader:Tz,row:Nz,selected:wz,kindBadge:Cz,kindChatroom:Ez,kindPipe:Az,kindChannel:Dz,streamName:Mz,meta:Rz},Iz={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function Oz({kind:t}){return t==="chatroom"?a.jsx(KT,{size:Ye,"aria-hidden":"true"}):t==="pipe"?a.jsx(jT,{size:Ye,"aria-hidden":"true"}):a.jsx(CT,{size:Ye,"aria-hidden":"true"})}function Lz({streams:t,sessions:s,tasks:o,loading:r,loadError:c=!1,loadedOnce:d=!0,showInternals:u,onToggleInternals:f,selectedStreamId:m,onSelectStream:h,onRefresh:v,hideHeaderControls:b=!1}){const _=gz(t,s),x={chatroom:Jt.kindChatroom,pipe:Jt.kindPipe,channel:Jt.kindChannel},S=j=>{var T;return((T=o.find(N=>N.id===j))==null?void 0:T.title)??j};return a.jsxs("div",{className:Jt.container,"data-testid":"coordination-list",children:[a.jsxs("div",{className:Jt.header,children:[a.jsx("span",{className:Jt.title,children:"Coordination"}),!b&&a.jsxs("div",{className:Jt.headerActions,children:[a.jsxs("label",{className:Jt.internalsToggle,children:[a.jsx("input",{type:"checkbox",checked:u,onChange:j=>f(j.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),v&&a.jsx("button",{type:"button",className:Jt.refreshButton,onClick:v,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:a.jsx(pN,{size:Ye,"aria-hidden":"true"})})]})]}),r&&t.length===0&&a.jsxs("div",{className:Jt.state,children:["Loading","…"]}),!r&&c&&a.jsx("div",{className:Jt.state,"data-testid":"coordination-error",children:"Unable to load streams"}),!r&&!c&&d&&t.length===0&&a.jsx("div",{className:Jt.state,"data-testid":"coordination-empty",children:"No active streams"}),_.map(j=>a.jsxs("div",{className:Jt.group,children:[a.jsx("div",{className:Jt.groupHeader,children:j.taskId?S(j.taskId):"Unattached / external (CLI · MCP)"}),j.streams.map(T=>{const N=xh(T),C=T.id===m;return a.jsxs("button",{type:"button",className:`${Jt.row}${C?` ${Jt.selected}`:""}`,onClick:()=>h(T.id),"data-testid":`coordination-row-${T.id}`,"aria-current":C?"page":void 0,children:[a.jsxs("span",{className:`${Jt.kindBadge} ${x[N]}`,children:[a.jsx(Oz,{kind:N})," ",Iz[N]]}),a.jsx("span",{className:Jt.streamName,children:T.name}),a.jsxs("span",{className:Jt.meta,children:[T.subscriberCount," ",T.subscriberCount===1?"sub":"subs"," ","·"," ",T.messageBufferDepth," buffered"]})]},T.id)})]},j.taskId??"__orphans__"))]})}const Bz="_transcript_1p4cm_1",zz="_message_1p4cm_10",$z="_meta_1p4cm_16",Hz="_sender_1p4cm_24",Pz="_time_1p4cm_29",Uz="_content_1p4cm_34",Vz="_state_1p4cm_42",Za={transcript:Bz,message:zz,meta:$z,sender:Hz,time:Pz,content:Uz,state:Vz};function qz(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleTimeString()}function Gz({messages:t,loading:s=!1}){return s?a.jsx("div",{className:Za.state,"data-testid":"stream-transcript-loading",children:"Loading transcript…"}):t.length===0?a.jsx("div",{className:Za.state,"data-testid":"stream-transcript-empty",children:"No messages yet."}):a.jsx("div",{className:Za.transcript,"data-testid":"stream-transcript",children:t.map(o=>a.jsxs("div",{className:Za.message,"data-testid":"stream-transcript-message",children:[a.jsxs("div",{className:Za.meta,children:[a.jsx("span",{className:Za.sender,title:o.senderId,children:o.senderId.slice(0,12)}),a.jsx("span",{className:Za.time,children:qz(o.timestamp)})]}),a.jsx("div",{className:Za.content,children:o.content})]},o.seq))})}const Fz="_panel_i6ltf_1",Kz="_header_i6ltf_24",Zz="_title_i6ltf_33",Yz="_closeButton_i6ltf_43",Jz="_body_i6ltf_57",Wz="_section_i6ltf_63",Xz="_sectionLabel_i6ltf_67",Qz="_metaRow_i6ltf_76",e$="_metaKey_i6ltf_84",t$="_metaValue_i6ltf_90",n$="_subscriberCard_i6ltf_99",s$="_subscriberHeader_i6ltf_107",a$="_sessionLink_i6ltf_114",i$="_badges_i6ltf_132",o$="_badgeRw_i6ltf_150 _badge_i6ltf_132",r$="_badgeR_i6ltf_150 _badge_i6ltf_132",l$="_badgeW_i6ltf_162 _badge_i6ltf_132",c$="_badgeAsync_i6ltf_168 _badge_i6ltf_132",d$="_badgeSync_i6ltf_174 _badge_i6ltf_132",u$="_badgeDetach_i6ltf_178 _badge_i6ltf_132",f$="_spawnTag_i6ltf_184 _badge_i6ltf_132",p$="_fdNumber_i6ltf_189",m$="_emptySubscribers_i6ltf_195",h$="_metaValueMono_i6ltf_201 _metaValue_i6ltf_90",g$="_advanced_i6ltf_216",v$="_advancedSummary_i6ltf_220",He={panel:Fz,header:Kz,title:Zz,closeButton:Yz,body:Jz,section:Wz,sectionLabel:Xz,metaRow:Qz,metaKey:e$,metaValue:t$,subscriberCard:n$,subscriberHeader:s$,sessionLink:a$,badges:i$,badgeRw:o$,badgeR:r$,badgeW:l$,badgeAsync:c$,badgeSync:d$,badgeDetach:u$,spawnTag:f$,fdNumber:p$,emptySubscribers:m$,metaValueMono:h$,advanced:g$,advancedSummary:v$},y$={chatroom:"Chatroom",pipe:"Pipe",channel:"Channel"};function b$({permission:t}){const s=t==="rw"?He.badgeRw:t==="r"?He.badgeR:He.badgeW;return a.jsx("span",{className:s,children:t})}function _$({mode:t}){const s=t==="async"?He.badgeAsync:t==="detach"?He.badgeDetach:He.badgeSync;return a.jsx("span",{className:s,children:t})}function x$({stream:t,messages:s,transcriptLoading:o,onClose:r}){const c=kt();return y.useEffect(()=>{const d=u=>{u.key==="Escape"&&r()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r]),a.jsxs("div",{className:He.panel,"data-testid":"stream-detail-panel",children:[a.jsxs("div",{className:He.header,children:[a.jsx("h3",{className:He.title,children:t.name}),a.jsx("button",{type:"button",className:He.closeButton,onClick:r,"aria-label":"Close stream details",children:"×"})]}),a.jsxs("div",{className:He.body,children:[a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Overview"}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Kind"}),a.jsx("span",{className:He.metaValue,children:y$[xh(t)]})]}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Participants"}),a.jsx("span",{className:He.metaValue,children:t.subscriberCount})]}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Buffered"}),a.jsxs("span",{className:He.metaValue,children:[t.messageBufferDepth," msgs"]})]})]}),a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Participants"}),t.subscribers.length===0?a.jsx("div",{className:He.emptySubscribers,children:"No active subscribers"}):t.subscribers.map(d=>a.jsxs("div",{className:He.subscriberCard,"data-testid":`subscriber-card-${d.subscriptionId}`,children:[a.jsxs("button",{type:"button",className:He.sessionLink,onClick:()=>{c(yl(d.sessionId))},title:d.sessionId,children:[d.sessionId.slice(0,12),"…"]}),d.createdBySpawn&&a.jsx("span",{className:He.spawnTag,children:"spawn"})]},d.subscriptionId))]}),a.jsxs("div",{className:He.section,children:[a.jsx("div",{className:He.sectionLabel,children:"Conversation"}),a.jsx(Gz,{messages:s??[],loading:o??!1})]}),a.jsxs("details",{className:He.advanced,"data-testid":"stream-advanced",children:[a.jsx("summary",{className:He.advancedSummary,children:"Advanced"}),a.jsxs("div",{className:He.metaRow,children:[a.jsx("span",{className:He.metaKey,children:"Stream ID"}),a.jsx("span",{className:He.metaValueMono,children:t.id})]}),t.subscribers.map(d=>a.jsxs("div",{className:He.subscriberCard,children:[a.jsxs("div",{className:He.subscriberHeader,children:[a.jsxs("span",{className:He.fdNumber,children:["fd ",d.fd]}),a.jsxs("span",{className:He.metaValueMono,title:d.subscriptionId,children:[d.subscriptionId.slice(0,12),"…"]})]}),a.jsxs("div",{className:He.badges,children:[a.jsx(b$,{permission:d.permission}),a.jsx(_$,{mode:d.deliveryMode})]})]},d.subscriptionId))]})]})]})}const bk="session",kh="stream",m_="messageDot";function Wc(t){return`session:${t}`}function h_(t){return`stream:${t}`}function k$(t){return{id:t,environmentId:"",runtime:"external",status:"external",prompt:"",startedAt:""}}function S$(t,s){return t==="detach"?{stroke:s,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6}:{stroke:s,strokeWidth:1.5}}function j$(t,s){const o=t.permission.includes("w"),r=s.permission.includes("w"),c=t.permission.includes("r"),d=s.permission.includes("r");if(o&&!r&&d)return{source:t,target:s,bidirectional:!1};if(r&&!o&&c)return{source:s,target:t,bidirectional:!1};const u=[t,s].sort((f,m)=>f.sessionId.localeCompare(m.sessionId));return{source:u[0],target:u[1],bidirectional:!0}}function T$(t,s){if(t.length===0)return{nodes:[],edges:[]};const o=new Map(s.map(m=>[m.id,m])),r=new Map,c=new Map,d=[],u=m=>{let h=r.get(m);if(!h){const v=o.get(m);h={kind:"session",session:v??k$(m),streamCount:0,external:v===void 0},r.set(m,h)}return h};for(const m of t){const h=xh(m);if(h==="pipe"&&m.subscribers.length===2&&m.subscribers[0].sessionId!==m.subscribers[1].sessionId){const[v,b]=m.subscribers;u(v.sessionId).streamCount+=1,u(b.sessionId).streamCount+=1;const{source:_,target:x,bidirectional:S}=j$(v,b);d.push({id:`edge-pipe-${m.id}`,source:Wc(_.sessionId),target:Wc(x.sessionId),type:m_,data:{edgeKind:"pipe",streamId:m.id,permission:S?"rw":_.permission,deliveryMode:_.deliveryMode},style:{stroke:"var(--accent-yellow)",strokeWidth:1.5,strokeDasharray:"6 3"},markerEnd:{type:Lc.ArrowClosed},markerStart:S?{type:Lc.ArrowClosed}:void 0,animated:!1});continue}c.set(m.id,{kind:"stream",stream:m,streamKind:h,ownership:yk(m,o)});for(const v of m.subscribers){u(v.sessionId).streamCount+=1;const b=h_(m.id),_=Wc(v.sessionId),x=v.permission.includes("w"),S=v.permission.includes("r");let j,T,N=!1;x&&S?(j=_,T=b,N=!0):S?(j=b,T=_):(j=_,T=b),d.push({id:`edge-part-${m.id}-${v.subscriptionId}`,source:j,target:T,type:m_,data:{edgeKind:"participation",streamId:m.id,permission:v.permission,deliveryMode:v.deliveryMode},style:S$(v.deliveryMode,"var(--text-tertiary)"),markerEnd:{type:Lc.ArrowClosed},markerStart:N?{type:Lc.ArrowClosed}:void 0,animated:!1})}}const f=[];for(const[m,h]of r)f.push({id:Wc(m),type:bk,position:{x:0,y:0},data:h});for(const[m,h]of c)f.push({id:h_(m),type:kh,position:{x:0,y:0},data:h});return{nodes:f,edges:d}}const N$=200,w$=64,C$=180,E$=56,A$=40,D$=70;function g_(t){return t===kh?{width:C$,height:E$}:{width:N$,height:w$}}function M$(t){if(t.nodes.length===0)return t;const s=new fd.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"LR",nodesep:A$,ranksep:D$});for(const r of t.nodes){const{width:c,height:d}=g_(r.type);s.setNode(r.id,{width:c,height:d})}for(const r of t.edges)s.setEdge(r.source,r.target,{},r.id);return fd.layout(s),{nodes:t.nodes.map(r=>{const c=s.node(r.id),{width:d,height:u}=g_(r.type);return{...r,position:{x:c.x-d/2,y:c.y-u/2}}}),edges:t.edges}}function R$(t,s){return y.useMemo(()=>M$(T$(t,s)),[t,s])}const I$="_graphContainer_1uzcp_1",O$="_empty_1uzcp_18",L$="_nodeContent_1uzcp_28",B$="_nodeHeader_1uzcp_38",z$="_nodeTitle_1uzcp_50",$$="_nodeMeta_1uzcp_58",H$="_nodeSubtle_1uzcp_64",P$="_countBadge_1uzcp_69",U$="_sessionNode_1uzcp_81",V$="_sessionAccent_1uzcp_103",q$="_external_1uzcp_109",G$="_streamNode_1uzcp_114",F$="_chatroom_1uzcp_134",K$="_channel_1uzcp_139",Z$="_pipe_1uzcp_143",Y$="_haloless_1uzcp_147",J$="_selected_1uzcp_153",W$="_kindBadge_1uzcp_158",X$="_handle_1uzcp_172",Q$="_messageDot_1uzcp_179",yt={graphContainer:I$,empty:O$,nodeContent:L$,nodeHeader:B$,nodeTitle:z$,nodeMeta:$$,nodeSubtle:H$,countBadge:P$,sessionNode:U$,sessionAccent:V$,external:q$,streamNode:G$,chatroom:F$,channel:K$,pipe:Z$,haloless:Y$,selected:J$,kindBadge:W$,handle:X$,messageDot:Q$};function e9({data:t}){const{session:s,streamCount:o,external:r}=t,c=ok(s.status,r),d=`var(${c.varName})`,u=r?`${yt.sessionNode} ${yt.external}`:yt.sessionNode;return a.jsxs("div",{className:u,"data-testid":`coordination-node-session-${s.id}`,children:[a.jsx(zo,{type:"target",position:$o.Left,isConnectable:!1,className:yt.handle}),a.jsx("div",{className:yt.sessionAccent,style:{backgroundColor:d}}),a.jsxs("div",{className:yt.nodeContent,children:[a.jsx("div",{className:yt.nodeHeader,children:a.jsx("span",{className:yt.nodeTitle,children:r?s.id:s.runtime})}),a.jsxs("div",{className:yt.nodeMeta,children:[a.jsx("span",{className:yt.nodeSubtle,style:{color:d},children:c.label}),o>0&&a.jsx("span",{className:yt.countBadge,children:o})]})]}),a.jsx(zo,{type:"source",position:$o.Right,isConnectable:!1,className:yt.handle})]})}function t9({data:t,selected:s}){const{stream:o,streamKind:r,ownership:c}=t,d=r==="chatroom"?yt.chatroom:r==="pipe"?yt.pipe:yt.channel,u=[yt.streamNode,d];return c.kind!=="task"&&u.push(yt.haloless),s&&u.push(yt.selected),a.jsxs("div",{className:u.join(" "),"data-testid":`coordination-node-stream-${o.id}`,children:[a.jsx(zo,{type:"target",position:$o.Left,isConnectable:!1,className:yt.handle}),a.jsxs("div",{className:yt.nodeContent,children:[a.jsx("div",{className:yt.nodeHeader,children:a.jsx("span",{className:yt.kindBadge,children:r})}),a.jsx("span",{className:yt.nodeTitle,children:o.name}),a.jsxs("span",{className:yt.nodeSubtle,children:[o.subscriberCount," ",o.subscriberCount===1?"subscriber":"subscribers"]})]}),a.jsx(zo,{type:"source",position:$o.Right,isConnectable:!1,className:yt.handle})]})}const v_="0.7s",n9=3;function s9(t){const{sourceX:s,sourceY:o,targetX:r,targetY:c,sourcePosition:d,targetPosition:u,markerStart:f,markerEnd:m,style:h,data:v}=t,[b]=W2({sourceX:s,sourceY:o,targetX:r,targetY:c,sourcePosition:d,targetPosition:u}),_=v==null?void 0:v.pulseSeq;return a.jsxs(a.Fragment,{children:[a.jsx(X2,{path:b,markerStart:f,markerEnd:m,style:h}),_!==void 0&&a.jsxs("circle",{r:n9,opacity:0,className:yt.messageDot,"data-testid":"coordination-message-dot",children:[a.jsx("animateMotion",{dur:v_,repeatCount:"1",path:b}),a.jsx("animate",{attributeName:"opacity",dur:v_,repeatCount:"1",values:"0;1;1;0",keyTimes:"0;0.1;0.85;1"})]},_)]})}const Op="#6b7a8d",a9={[bk]:e9,[kh]:t9},i9={messageDot:s9};function o9({streams:t,sessions:s,selectedStreamId:o,onSelectStream:r,recentMessages:c,resolvedThemeId:d}){const u=R$(t,s),f=y.useMemo(()=>u.edges.map(_=>{var S,j;if(!_.data)return _;const x=(j=(S=c==null?void 0:c[_.data.streamId])==null?void 0:S.at(-1))==null?void 0:j.seq;return x===void 0?_:{..._,data:{..._.data,pulseSeq:x}}}),[u.edges,c]),m=y.useMemo(()=>u.nodes.map(_=>{const x=_.data;return x.kind==="stream"&&x.stream.id===o?{..._,selected:!0}:_}),[u.nodes,o]),h=y.useMemo(()=>{const _=getComputedStyle(document.documentElement),x={};for(const S of i5)x[S]=_.getPropertyValue(S).trim()||Op;return x},[d]),v=y.useCallback((_,x)=>{const S=x.data;S.kind==="stream"&&r(S.stream.id)},[r]),b=y.useCallback(_=>{const x=_.data;return x.kind==="session"?h[ok(x.session.status,x.external).varName]??Op:Op},[h]);return u.nodes.length===0?a.jsx("div",{className:yt.empty,"data-testid":"coordination-graph-empty",children:"No active streams to visualize"}):a.jsx("div",{className:yt.graphContainer,"data-testid":"coordination-graph",children:a.jsxs(U_,{nodes:m,edges:f,nodeTypes:a9,edgeTypes:i9,onNodeClick:v,nodesConnectable:!1,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[a.jsx(V_,{variant:q_.Dots,gap:24,size:1,color:"var(--text-disabled)"}),a.jsx(G_,{showInteractive:!1}),a.jsx(F_,{nodeColor:b,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}function r9({tasks:t,taskStatusById:s,sessionStatusByTaskId:o}){const r=new Map;for(const d of t)if(d.parentTaskId){const u=r.get(d.parentTaskId);u?u.push(d):r.set(d.parentTaskId,[d])}const c=new Map(Cy.map(d=>[d,[]]));for(const d of t){const u=ml(d.status),f=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),m=r.get(d.id)??[],h=m.length,v=m.filter(S=>S.status==="complete").length;let b;if(u==="paused"&&o){const S=o.get(d.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:f,childCount:h,doneChildCount:v,pausedSubBadge:b},x=c.get(u);x?x.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,f)=>u.task.sortOrder-f.task.sortOrder);return Cy.map(d=>{const u=Qa(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const l9="_boardContainer_1c4y1_1",c9="_column_1c4y1_17",d9="_columnHeader_1c4y1_34",u9="_columnIcon_1c4y1_47",f9="_columnLabel_1c4y1_52",p9="_columnCount_1c4y1_57",m9="_cardList_1c4y1_67",h9="_emptyPlaceholder_1c4y1_76",g9="_card_1c4y1_67",v9="_cardHeader_1c4y1_107",y9="_cardStatusIcon_1c4y1_113",b9="_cardTitle_1c4y1_119",_9="_cardBadges_1c4y1_127",x9="_badge_1c4y1_134",k9="_blockedBadge_1c4y1_146",S9="_childBadge_1c4y1_151",j9="_depBadge_1c4y1_155",T9="_parentBadge_1c4y1_159",N9="_pausedSubBadge_1c4y1_166",w9="_personaBadge_1c4y1_170",C9="_envBadge_1c4y1_174",E9="_emptyCta_1c4y1_178",A9="_ctaButton_1c4y1_188",D9="_ctaDescription_1c4y1_204",dt={boardContainer:l9,column:c9,columnHeader:d9,columnIcon:u9,columnLabel:f9,columnCount:p9,cardList:m9,emptyPlaceholder:h9,card:g9,cardHeader:v9,cardStatusIcon:y9,cardTitle:b9,cardBadges:_9,badge:x9,blockedBadge:k9,childBadge:S9,depBadge:j9,parentBadge:T9,pausedSubBadge:N9,personaBadge:w9,envBadge:C9,emptyCta:E9,ctaButton:A9,ctaDescription:D9};function M9({workspaceId:t,environmentId:s,tasks:o,sessions:r,personas:c,environments:d}){const u=kt(),f=y.useMemo(()=>o.filter(_=>_.workspaceId===t),[o,t]),m=y.useMemo(()=>new Map(o.map(_=>[_.id,_.status])),[o]),h=y.useMemo(()=>new Map(f.map(_=>[_.id,_])),[f]),v=y.useMemo(()=>{const _=new Map(r.map(C=>[C.id,C])),x=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),j=new Map,T=new Map,N=new Map;for(const C of f)if(C.latestSessionId){const D=_.get(C.latestSessionId);if(D){if(j.set(C.id,D.endReason||D.status),D.personaId){const A=x.get(D.personaId);A&&T.set(C.id,A.name)}if(D.environmentId){const A=S.get(D.environmentId);A&&N.set(C.id,A.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:T,environmentNameByTaskId:N}},[f,r,c,d]),b=y.useMemo(()=>r9({tasks:f,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[f,m,v]);return f.length===0?a.jsxs("div",{className:dt.emptyCta,"data-testid":"board-empty-cta",children:[a.jsx("button",{className:dt.ctaButton,onClick:()=>u(Oi(t,void 0,s)),children:"Create Task"}),a.jsx("div",{className:dt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):a.jsx("div",{className:dt.boardContainer,"data-testid":"board-container",children:b.map(_=>a.jsxs("section",{className:dt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[a.jsxs("div",{className:dt.columnHeader,children:[a.jsx("span",{className:dt.columnIcon,style:{color:_.style.color},children:_.style.icon}),a.jsx("span",{className:dt.columnLabel,children:_.label}),a.jsx("span",{className:dt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),a.jsx("div",{className:dt.cardList,children:_.tasks.length===0?a.jsx("div",{className:dt.emptyPlaceholder,children:"No tasks"}):a.jsx(rs,{mode:"popLayout",children:_.tasks.map(x=>a.jsx(Ut.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:a.jsx(R9,{boardTask:x,tasksById:h,personaName:v.personaNameByTaskId.get(x.task.id),envName:v.environmentNameByTaskId.get(x.task.id),onClick:()=>u(cs(x.task.id,void 0,t,s))})},x.task.id))})})]},_.status))})}function R9({boardTask:t,tasksById:s,personaName:o,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:f,doneChildCount:m,pausedSubBadge:h}=t,v=Qa(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return a.jsxs("div",{className:dt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[a.jsxs("div",{className:dt.cardHeader,children:[a.jsx("span",{className:dt.cardStatusIcon,style:{color:v.color},children:v.icon}),a.jsx("span",{className:dt.cardTitle,children:d.title})]}),a.jsxs("div",{className:dt.cardBadges,children:[b&&a.jsx("span",{className:`${dt.badge} ${dt.parentBadge}`,title:b.title,children:b.title}),f>0&&a.jsxs("span",{className:`${dt.badge} ${dt.childBadge}`,children:[m,"/",f]}),u&&a.jsx("span",{className:`${dt.badge} ${dt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&a.jsx("span",{className:`${dt.badge} ${dt.depBadge}`,children:"dep"}),h&&a.jsx("span",{className:`${dt.badge} ${dt.pausedSubBadge}`,children:h}),o&&a.jsx("span",{className:`${dt.badge} ${dt.personaBadge}`,children:o}),r&&a.jsx("span",{className:`${dt.badge} ${dt.envBadge}`,children:r})]})]})}const I9="_formContent_ymnez_1",O9="_section_ymnez_13",L9="_label_ymnez_19",B9="_titleInput_ymnez_26",z9="_descriptionTextarea_ymnez_58",$9="_selectField_ymnez_94",H9="_checkboxRow_ymnez_128",P9="_checkboxLabel_ymnez_141",U9="_fieldError_ymnez_146",Tt={formContent:I9,section:O9,label:L9,titleInput:B9,descriptionTextarea:z9,selectField:$9,checkboxRow:H9,checkboxLabel:P9,fieldError:U9};function V9(t,s){return{name:(t==null?void 0:t.name)??"",description:(t==null?void 0:t.description)??"",repoUrl:(t==null?void 0:t.repoUrl)??"",environmentId:(t==null?void 0:t.linkedEnvironmentIds[0])??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const q9=100;function G9({values:t,onChange:s,environments:o,personas:r,errors:c,disabled:d,autoFocusName:u}){const f=(m,h)=>{s({...t,[m]:h})};return a.jsxs("div",{className:Tt.formContent,children:[a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-name",children:"Name"}),a.jsx("input",{id:"ws-name",className:Tt.titleInput,type:"text",value:t.name,onChange:m=>f("name",m.target.value),placeholder:"Workspace name",maxLength:q9,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&a.jsx("span",{className:Tt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-description",children:"Description"}),a.jsx("textarea",{id:"ws-description",className:Tt.descriptionTextarea,value:t.description,onChange:m=>f("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-repo",children:"Repository URL"}),a.jsx("input",{id:"ws-repo",className:Tt.titleInput,type:"text",value:t.repoUrl,onChange:m=>f("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&a.jsx("span",{className:Tt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-environment",children:"Environment"}),a.jsxs("select",{id:"ws-environment",className:Tt.selectField,value:t.environmentId,onChange:m=>f("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[a.jsx("option",{value:"",children:"Select environment…"}),o.map(m=>a.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&a.jsx("span",{className:Tt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-persona",children:"Default Persona"}),a.jsxs("select",{id:"ws-persona",className:Tt.selectField,value:t.defaultPersonaId,onChange:m=>f("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[a.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>a.jsx("option",{value:m.id,children:m.name},m.id))]})]}),a.jsx("div",{className:Tt.section,children:a.jsxs("label",{className:Tt.checkboxRow,children:[a.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>f("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),a.jsx("span",{className:Tt.checkboxLabel,children:"Enable worktree isolation"})]})}),a.jsxs("div",{className:Tt.section,children:[a.jsx("label",{className:Tt.label,htmlFor:"ws-workdir",children:"Working Directory"}),a.jsx("input",{id:"ws-workdir",className:Tt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>f("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const _k=y.createContext(void 0),F9=4e3;function K9({children:t}){const[s,o]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{o(f=>f.filter(m=>m.id!==u))},[]),d=y.useCallback((u,f="info",m=F9)=>{const h=`toast-${++r.current}`;o(v=>[...v,{id:h,message:u,variant:f,duration:m}])},[]);return a.jsx(_k.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function mn(){const t=y.useContext(_k);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const bm="grackle-theme",xk="grackle-prefer-system",kk="(prefers-color-scheme: dark)";let Xr=[],ud;function Lp(){ud=void 0;for(const t of Xr)t()}function _m(){return typeof window>"u"?!1:window.matchMedia(kk).matches}function sl(){if(typeof localStorage>"u")return u_;try{const t=localStorage.getItem(bm);if(t!==null&&hk.has(t))return t}catch{}return u_}function jd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(xk)==="true"}catch{return!1}}function xm(t){return $d.find(s=>s.variantLightId===t||s.variantDarkId===t)}function Sk(t,s){const o=ym(t);if(o!=null&&o.variantDarkId)return s&&o.variantLightId?_m()?o.variantDarkId:o.variantLightId:o.variantDarkId;if(o!=null&&o.hidden&&s){const r=xm(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return _m()?r.variantDarkId:r.variantLightId}return t}function Do(t,s,o=!1){o&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=Sk(t,s),o&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&Do(sl(),jd());function Z9(){return ud===void 0&&(ud={themeId:sl(),systemDark:_m(),preferSystem:jd()}),ud}function Y9(t){return Xr=[...Xr,t],()=>{Xr=Xr.filter(s=>s!==t)}}function J9(){const t=y.useSyncExternalStore(Y9,Z9),{themeId:s,preferSystem:o}=t,r=Sk(s,o),c=y.useCallback(u=>{if(hk.has(u)){try{localStorage.setItem(bm,u)}catch{}Do(u,jd(),!0),Lp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(xk,u?"true":"false")}catch{}if(u){const f=sl(),m=ym(f);if(m!=null&&m.hidden){const h=xm(f);if(h)try{localStorage.setItem(bm,h.id)}catch{}}}Do(sl(),u,!0),Lp()},[]);return y.useEffect(()=>{Do(s,o)},[s,o]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(kk),f=()=>{const m=sl(),h=jd();if(h){const v=ym(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&Do(m,h),v!=null&&v.hidden){const b=xm(m);b!=null&&b.variantDarkId&&b.variantLightId&&Do(m,h)}}Lp()};return u.addEventListener("change",f),()=>{u.removeEventListener("change",f)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:o,setPreferSystem:d}}const jk=y.createContext(void 0);function W9({children:t}){const s=J9();return a.jsx(jk.Provider,{value:s,children:t})}function Sh(){const t=y.useContext(jk);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const Tk=y.createContext(void 0),Nk=y.createContext(void 0);function X9({children:t}){const[s,o]=y.useState(void 0),r=y.useCallback(c=>{o(c)},[]);return a.jsx(Nk.Provider,{value:r,children:a.jsx(Tk.Provider,{value:s,children:t})})}function Q9(){return y.useContext(Tk)}function eH(){const t=y.useContext(Nk);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const jh=y.createContext(void 0);function mt(){const t=y.useContext(jh);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function wk(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ck(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function tH(t){return wk(t)&&typeof t.sessionId=="string"&&typeof t.eventType=="string"&&typeof t.timestamp=="string"&&typeof t.content=="string"&&(t.raw===void 0||typeof t.raw=="string")&&(t.toolCallId===void 0||typeof t.toolCallId=="string")&&(t.turnId===void 0||typeof t.turnId=="string")&&(t.serverSeq===void 0||typeof t.serverSeq=="string")}const nH=new Set(["off","subscription","api_key"]),Xc=new Set(["off","on"]);function sH(t){return wk(t)&&nH.has(t.claude)&&Xc.has(t.github)&&Xc.has(t.copilot)&&Xc.has(t.codex)&&Xc.has(t.goose)}function Ek(t){switch(t){case"waiting_input":return"idle";case"completed":return"stopped";case"killed":return"stopped";case"failed":return"stopped";case"interrupted":return"stopped";case"terminated":return"stopped";default:return t}}function Ak(t){switch(t){case"completed":return"completed";case"killed":return"killed";case"failed":return"interrupted";case"interrupted":return"interrupted";case"terminated":return"terminated";default:return}}const Eo=5e3;function aH(t,s){const o=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);o.unshift(d),r=d.parentTaskId||void 0}return o}const ga={label:"Home",url:Zo};function iH(t){return t?[ga,{label:"Settings",url:Bo},{label:t,url:void 0}]:[ga,{label:"Settings",url:void 0}]}const Dk={label:"Environments",url:Ho},oH={label:"Personas",url:rl};function rH(){return[ga,{label:"Personas",url:void 0}]}function lH(t){return[ga,oH,{label:t,url:void 0}]}function cH(){return[ga,{label:"Environments",url:void 0}]}function dH(){return[ga,{label:"New Chat",url:void 0}]}function uH(t){return[ga,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function fH(t,s,o,r){const c=o.find(u=>u.id===t),d=r.find(u=>u.id===s);return[ga,Dk,{label:(d==null?void 0:d.displayName)??"Environment",url:Po(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function pH(t,s,o,r,c){const d=aH(t,c),u=c.get(t),f=u==null?void 0:u.workspaceId,m=f?o.find(x=>x.id===f):void 0,h=s??(m==null?void 0:m.linkedEnvironmentIds[0]),v=h?r.find(x=>x.id===h):void 0,b=[ga];v&&h&&(b.push(Dk),b.push({label:v.displayName,url:Po(h)})),m&&h&&b.push({label:m.name,url:Di(m.id,h)});for(let x=0;x<d.length-1;x++)b.push({label:d[x].title,url:cs(d[x].id,void 0,f,h)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}function Th(t){const s=[];for(const o of t){const r=s[s.length-1];o.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+o.content}:s.push(o)}return s}function y_(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function mH(t){if(typeof t.tool_use_id=="string")return t.tool_use_id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const o=t.item;if(o&&typeof o.id=="string")return o.id}function Bp(t,s,o){return t.toolCallId?t.toolCallId:s?o(s):void 0}function Nh(t){const s=new Map;for(const u of t)if(u.raw)try{s.set(u,JSON.parse(u.raw))}catch{}const o=new Map;for(const u of t){if(u.eventType!=="tool_use")continue;const f=Bp(u,s.get(u),y_);if(f)try{const m=JSON.parse(u.content);o.set(f,{tool:m.tool,args:m.args})}catch{}}const r=new Set,d=t.map(u=>{if(u.eventType!=="tool_result")return u;const f=Bp(u,s.get(u),mH);if(!f)return u;const m=o.get(f);if(!m)return u;r.add(f);let h;const v=u.content.trim();if(v.startsWith("{"))try{const b=JSON.parse(v);typeof b.detailedContent=="string"&&(h=b.detailedContent)}catch{}return{...u,toolUseCtx:{...m,detailedResult:h}}}).filter(u=>{if(u.eventType!=="tool_use")return!0;const f=Bp(u,s.get(u),y_);return!(f&&r.has(f))});for(let u=0;u<d.length;u++){if(d[u].eventType!=="tool_use")continue;let f=!1;for(let m=u+1;m<d.length;m++)if(d[m].eventType!=="tool_use"){f=!0;break}f&&(d[u]={...d[u],settled:!0})}return d}function hH(t,s,o){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=Mk(s),d=s.filter(m=>km(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||km(m,c)).length,f=o.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:f}}function Mk(t){const s=new Map;for(const o of t)s.set(o.id,o.status);return s}function km(t,s){return t.dependsOn.some(o=>s.get(o)!=="complete")}function gH(t,s){var u;const o=new Map;for(const f of s)o.set(f.id,f);const r=Mk(t),c=[];for(const f of t){const m=f.workspaceId?((u=o.get(f.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";f.status==="failed"?c.push({task:f,reason:"failed",workspaceName:m}):km(f,r)?c.push({task:f,reason:"blocked",workspaceName:m}):f.status==="paused"&&c.push({task:f,reason:"paused",workspaceName:m})}const d={failed:0,blocked:1,paused:2};return c.sort((f,m)=>(d[f.reason]??3)-(d[m.reason]??3)),c}function vH(t,s){const o=new Map;for(const r of s)o.set(r.id,r);return t.filter(r=>r.status==="running"||r.status==="idle"||r.status==="waiting").map(r=>{var c;return{session:r,environmentName:((c=o.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function yH(t,s,o){const r=new Map;for(const c of s){if(!c.workspaceId)continue;let d=r.get(c.workspaceId);d||(d={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},r.set(c.workspaceId,d)),d.totalTasks+=1,c.status==="complete"?d.completedTasks+=1:c.status==="working"?d.workingTasks+=1:c.status==="failed"&&(d.failedTasks+=1)}return t.map(c=>{const d=r.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:d.totalTasks,completedTasks:d.completedTasks,workingTasks:d.workingTasks,failedTasks:d.failedTasks}})}const Ms=[{id:"kn-auth-flow",label:"Authentication Flow",kind:"knowledge",category:"concept",content:"The application uses JWT Bearer tokens for stateless authentication. Access tokens expire after 24h. Refresh tokens are stored in the database and rotated on use. The auth middleware verifies tokens and attaches the decoded payload to req.user.",tags:["auth","jwt","security"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:30:00Z",updatedAt:"2026-02-27T08:15:00Z",val:5},{id:"kn-db-schema",label:"Database Schema",kind:"knowledge",category:"concept",content:"PostgreSQL database with tables: users, sessions, refresh_tokens, audit_log. Uses UUID primary keys, TIMESTAMPTZ for all timestamps, and JSONB for flexible metadata columns. Connection pooling via pg-pool with per-tenant isolation.",tags:["database","postgres","schema"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:00:00Z",updatedAt:"2026-02-26T22:45:00Z",val:4},{id:"kn-error-handling",label:"Error Response Pattern",kind:"knowledge",category:"concept",content:"All API errors follow the shape { error: string, code: string, details?: unknown }. HTTP status codes map to: 400 (validation), 401 (unauthenticated), 403 (forbidden), 404 (not found), 409 (conflict), 429 (rate limited), 500 (internal).",tags:["api","errors","patterns"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:17:00Z",updatedAt:"2026-02-27T08:17:00Z",val:3},{id:"kn-rate-limiting",label:"Rate Limiting Strategy",kind:"knowledge",category:"concept",content:"Token-bucket algorithm with in-memory state per client IP. Default rate: 100 requests/minute, burst: 20. Returns 429 with Retry-After header. Redis adapter available for multi-instance deployments.",tags:["api","rate-limiting","infrastructure"],workspaceId:"proj-alpha",createdAt:"2026-02-27T09:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:2},{id:"kn-etl-pipeline",label:"ETL Pipeline Architecture",kind:"knowledge",category:"concept",content:"Data pipelines follow an Extract-Transform-Load pattern with pluggable stages. Each stage reads from a source (Postgres, S3, API), transforms via configurable mappers, and loads into a target (Parquet, BigQuery, S3). Incremental loads use high-watermark tracking.",tags:["etl","pipeline","architecture"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:05:00Z",val:4},{id:"kn-parquet-format",label:"Parquet Output Format",kind:"knowledge",category:"concept",content:"Parquet files are written with row-group buffering (configurable batch size, default 10000 rows). Supports Snappy, ZSTD, and GZIP compression. Schema is derived from the internal column type system using Arrow type mapping.",tags:["parquet","data-format","compression"],workspaceId:"proj-beta",createdAt:"2026-02-26T08:05:00Z",updatedAt:"2026-02-26T08:15:00Z",val:3},{id:"kn-jwt-over-session",label:"JWT over Session Auth",kind:"knowledge",category:"decision",content:"Chose JWT tokens over server-side sessions for stateless auth. Rationale: (1) no session store needed, (2) works across microservices without shared state, (3) supports mobile clients natively. Trade-off: tokens can't be revoked instantly (mitigated by short expiry + refresh rotation).",tags:["auth","decision","jwt"],workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-25T10:00:00Z",val:3},{id:"kn-pg-pool-decision",label:"pg-pool over Knex",kind:"knowledge",category:"decision",content:"Chose pg-pool over Knex for connection pooling. pg-pool gives direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool and adds query-building overhead we don't need since we write raw SQL with parameterized queries.",tags:["database","decision","postgres"],workspaceId:"proj-alpha",createdAt:"2026-02-23T11:30:00Z",updatedAt:"2026-02-23T11:30:00Z",val:2},{id:"kn-watermark-decision",label:"Local Watermark Storage",kind:"knowledge",category:"decision",content:"Currently using local SQLite for watermark storage. This works for single-worker pipelines but needs to move to a shared store (Redis or Postgres) for production multi-worker scenarios. Tracked as a follow-up task.",tags:["pipeline","decision","watermarks"],workspaceId:"proj-beta",createdAt:"2026-02-27T09:05:00Z",updatedAt:"2026-02-27T09:05:00Z",val:2},{id:"kn-jwt-middleware",label:"JWT Verify Middleware",kind:"knowledge",category:"snippet",content:`\`\`\`typescript
351
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
352
+ const header = req.headers.authorization;
353
+ if (!header?.startsWith("Bearer ")) {
354
+ res.status(401).json({ error: "Missing token" });
355
+ return;
356
+ }
357
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
358
+ req.user = decoded;
359
+ next();
360
+ }
361
+ \`\`\``,tags:["auth","jwt","middleware","typescript"],workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:14Z",updatedAt:"2026-02-27T08:15:14Z",val:2},{id:"kn-audit-schema",label:"Audit Log Schema",kind:"knowledge",category:"snippet",content:`\`\`\`sql
362
+ CREATE TABLE audit_log (
363
+ id BIGSERIAL PRIMARY KEY,
364
+ user_id UUID REFERENCES users(id),
365
+ action TEXT NOT NULL,
366
+ entity_type TEXT NOT NULL,
367
+ entity_id TEXT NOT NULL,
368
+ old_value JSONB,
369
+ new_value JSONB,
370
+ ip_address INET,
371
+ created_at TIMESTAMPTZ DEFAULT now()
372
+ );
373
+ \`\`\``,tags:["database","audit","schema","sql"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:45:15Z",updatedAt:"2026-02-26T22:45:15Z",val:2},{id:"kn-n1-query",label:"N+1 Query in User List",kind:"knowledge",category:"insight",content:"GET /api/users performs a separate query for each user's role metadata, resulting in N+1 queries. For 500 users this adds ~2 seconds of latency. Solution: use a JOIN or batch lookup to fetch all role data in a single query.",tags:["performance","database","n+1"],workspaceId:"proj-alpha",createdAt:"2026-02-22T09:30:00Z",updatedAt:"2026-02-22T09:30:00Z",val:2},{id:"kn-session-race",label:"Session Cleanup Race Condition",kind:"knowledge",category:"insight",content:"When two concurrent requests hit /api/logout, the second call throws a 500 because the session row has already been deleted. Fix: use DELETE ... RETURNING or add IF EXISTS guard to make the operation idempotent.",tags:["bug","concurrency","sessions"],workspaceId:"proj-alpha",createdAt:"2026-02-26T22:50:00Z",updatedAt:"2026-02-26T22:50:00Z",val:2},{id:"kn-ref-task-001",label:"JWT Auth Task",kind:"reference",sourceType:"task",sourceId:"task-001",content:"Implement JWT authentication across all protected routes, replacing session-based auth.",workspaceId:"proj-alpha",createdAt:"2026-02-25T10:00:00Z",updatedAt:"2026-02-27T08:15:00Z",val:3},{id:"kn-ref-task-006",label:"Parquet Export Task",kind:"reference",sourceType:"task",sourceId:"task-006",content:"Add Parquet export support for pipeline outputs, enabling downstream Spark consumption.",workspaceId:"proj-beta",createdAt:"2026-02-26T08:00:00Z",updatedAt:"2026-02-27T09:00:00Z",val:3},{id:"kn-ref-sess-001",label:"Auth Middleware Session",kind:"reference",sourceType:"session",sourceId:"sess-001",content:"Active session implementing JWT auth middleware, rewrote auth.ts, login.ts, and test suite.",workspaceId:"proj-alpha",createdAt:"2026-02-27T08:15:00Z",updatedAt:"2026-02-27T08:15:42Z",val:2}],Ya=[{source:"kn-auth-flow",target:"kn-jwt-over-session",type:"decided_by"},{source:"kn-auth-flow",target:"kn-jwt-middleware",type:"implemented_by"},{source:"kn-auth-flow",target:"kn-ref-task-001",type:"tracked_in"},{source:"kn-auth-flow",target:"kn-error-handling",type:"relates_to"},{source:"kn-jwt-over-session",target:"kn-ref-task-001",type:"motivated_by"},{source:"kn-db-schema",target:"kn-pg-pool-decision",type:"decided_by"},{source:"kn-db-schema",target:"kn-audit-schema",type:"contains"},{source:"kn-db-schema",target:"kn-n1-query",type:"affected_by"},{source:"kn-db-schema",target:"kn-session-race",type:"affected_by"},{source:"kn-rate-limiting",target:"kn-error-handling",type:"relates_to"},{source:"kn-rate-limiting",target:"kn-auth-flow",type:"depends_on"},{source:"kn-etl-pipeline",target:"kn-parquet-format",type:"outputs_to"},{source:"kn-etl-pipeline",target:"kn-watermark-decision",type:"decided_by"},{source:"kn-etl-pipeline",target:"kn-ref-task-006",type:"tracked_in"},{source:"kn-parquet-format",target:"kn-ref-task-006",type:"tracked_in"},{source:"kn-watermark-decision",target:"kn-etl-pipeline",type:"relates_to"},{source:"kn-ref-task-001",target:"kn-ref-sess-001",type:"has_session"},{source:"kn-jwt-middleware",target:"kn-ref-sess-001",type:"created_in"},{source:"kn-audit-schema",target:"kn-db-schema",type:"part_of"}],bH=new Map(Ms.map(t=>[t.id,t]));function zp(t){const s=bH.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const b_={"kn-auth-flow":{node:zp("kn-auth-flow"),edges:[{fromId:"kn-auth-flow",toId:"kn-jwt-over-session",type:"decided_by"},{fromId:"kn-auth-flow",toId:"kn-jwt-middleware",type:"implemented_by"},{fromId:"kn-auth-flow",toId:"kn-ref-task-001",type:"tracked_in"},{fromId:"kn-auth-flow",toId:"kn-error-handling",type:"relates_to"},{fromId:"kn-rate-limiting",toId:"kn-auth-flow",type:"depends_on"}]},"kn-db-schema":{node:zp("kn-db-schema"),edges:[{fromId:"kn-db-schema",toId:"kn-pg-pool-decision",type:"decided_by"},{fromId:"kn-db-schema",toId:"kn-audit-schema",type:"contains"},{fromId:"kn-db-schema",toId:"kn-n1-query",type:"affected_by"},{fromId:"kn-db-schema",toId:"kn-session-race",type:"affected_by"},{fromId:"kn-audit-schema",toId:"kn-db-schema",type:"part_of"}]},"kn-etl-pipeline":{node:zp("kn-etl-pipeline"),edges:[{fromId:"kn-etl-pipeline",toId:"kn-parquet-format",type:"outputs_to"},{fromId:"kn-etl-pipeline",toId:"kn-watermark-decision",type:"decided_by"},{fromId:"kn-etl-pipeline",toId:"kn-ref-task-006",type:"tracked_in"},{fromId:"kn-watermark-decision",toId:"kn-etl-pipeline",type:"relates_to"}]}},__=[{id:"stream-planning",name:"jwt-planning-room",selfEcho:!0,subscriberCount:2,messageBufferDepth:3,subscribers:[{subscriptionId:"sub-p1",sessionId:"sess-001",fd:3,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-p2",sessionId:"sess-002",fd:4,permission:"r",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-metrics",name:"rate-limit-metrics",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-m1",sessionId:"sess-004",fd:3,permission:"r",deliveryMode:"sync",createdBySpawn:!1}]},{id:"stream-cli",name:"cli-inspector",selfEcho:!1,subscriberCount:1,messageBufferDepth:1,subscribers:[{subscriptionId:"sub-c1",sessionId:"external-cli-session",fd:5,permission:"rw",deliveryMode:"async",createdBySpawn:!1}]},{id:"stream-lifecycle",name:"lifecycle:sess-001-7f3a",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-l1",sessionId:"sess-001",fd:6,permission:"rw",deliveryMode:"detach",createdBySpawn:!0}]},{id:"stream-pipe",name:"pipe:sess-001-sess-004",selfEcho:!1,subscriberCount:2,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-pp1",sessionId:"sess-001",fd:7,permission:"rw",deliveryMode:"async",createdBySpawn:!1},{subscriptionId:"sub-pp2",sessionId:"sess-004",fd:8,permission:"rw",deliveryMode:"async",createdBySpawn:!0}]},{id:"stream-stdin",name:"stdin:sess-002-9c2e",selfEcho:!1,subscriberCount:1,messageBufferDepth:0,subscribers:[{subscriptionId:"sub-s1",sessionId:"sess-002",fd:9,permission:"w",deliveryMode:"detach",createdBySpawn:!0}]}],_H={"stream-planning":[{streamId:"stream-planning",seq:"01J0000000000000000000MSG1",senderId:"sess-001",content:"Proposing JWT with RS256 + 15-min access tokens.",timestamp:"2026-05-24T18:00:01.000Z"},{streamId:"stream-planning",seq:"01J0000000000000000000MSG2",senderId:"sess-002",content:"Agreed. Refresh tokens rotate on use; store the jti denylist in Redis.",timestamp:"2026-05-24T18:00:07.000Z"},{streamId:"stream-planning",seq:"01J0000000000000000000MSG3",senderId:"sess-001",content:"Ship it. I'll wire the middleware; you take the refresh endpoint.",timestamp:"2026-05-24T18:00:14.000Z"}]},xH=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0,githubAccountId:""},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1,githubAccountId:""},{id:"error-env",displayName:"Error Test",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0,githubAccountId:""}],kH=[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z",endedAt:"2026-02-26T15:12:00Z",error:"Context window exceeded before completing implementation",inputTokens:84200,outputTokens:12750,costMillicents:41e3},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Refactor the authentication middleware to use JWT tokens",startedAt:"2026-02-27T08:15:00Z",taskId:"task-001",inputTokens:42600,outputTokens:8100,costMillicents:22e3},{id:"sess-002",environmentId:"env-docker-01",runtime:"copilot",status:"stopped",endReason:"completed",prompt:"Write unit tests for the user registration endpoint",startedAt:"2026-02-27T07:30:00Z",endedAt:"2026-02-27T07:33:00Z",taskId:"task-003",inputTokens:31400,outputTokens:9800,costMillicents:18e3},{id:"sess-003",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Migrate database schema to add audit_log table",startedAt:"2026-02-26T22:45:00Z",endedAt:"2026-02-26T23:10:00Z",inputTokens:56300,outputTokens:14200,costMillicents:31e3},{id:"sess-004",environmentId:"env-docker-01",runtime:"codex",status:"running",prompt:"Implement rate limiting for the public API",startedAt:"2026-02-27T09:00:00Z",taskId:"task-006c",inputTokens:18900,outputTokens:4500,costMillicents:1e4},{id:"sess-005",environmentId:"env-cs-01",runtime:"claude-code",status:"suspended",prompt:"Refactor database connection pooling for multi-tenant isolation",startedAt:"2026-02-27T06:00:00Z",inputTokens:67800,outputTokens:19300,costMillicents:38e3},{id:"sub_sess-002_toolu_1",environmentId:"env-docker-01",runtime:"subagent",status:"stopped",endReason:"completed",prompt:"Investigate the failing registration test",startedAt:"2026-02-27T07:31:00Z",endedAt:"2026-02-27T07:32:30Z",parentSessionId:"sess-002"}],SH=[{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T14:00:01Z",content:"running"},{sessionId:"sess-001-prev",eventType:"system",timestamp:"2026-02-26T14:00:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
374
+ Project: acme/alpha — Node.js + Express REST API
375
+ Task: Implement auth middleware using JWT tokens`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:05Z",content:"I'll start by reading the current authentication middleware to understand what needs to change."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tu-prev-001",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:07Z",content:`import session from "express-session";
376
+ import type { Request, Response, NextFunction } from "express";
377
+
378
+ export function requireAuth(req: Request, res: Response, next: NextFunction): void {
379
+ if (!req.session?.userId) {
380
+ res.status(401).json({ error: "Not authenticated" });
381
+ return;
382
+ }
383
+ next();
384
+ }`,raw:JSON.stringify({tool_use_id:"tu-prev-001"})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:00:10Z",content:"The current auth uses express-session with server-side session storage. Let me find all files that depend on this pattern."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:00:11Z",content:JSON.stringify({tool:"Grep",args:{pattern:"req\\.session",path:"src/"}}),raw:JSON.stringify({id:"tu-prev-002",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:00:12Z",content:`src/middleware/auth.ts:4: if (!req.session?.userId) {
385
+ src/routes/login.ts:18: req.session.userId = user.id;
386
+ src/routes/login.ts:19: req.session.role = user.role;
387
+ src/routes/protected.ts:7: const userId = req.session.userId;`,raw:JSON.stringify({tool_use_id:"tu-prev-002"})},{sessionId:"sess-001-prev",eventType:"usage",timestamp:"2026-02-26T14:30:00Z",content:JSON.stringify({input_tokens:42100,output_tokens:6350,cost_millicents:21e3})},{sessionId:"sess-001-prev",eventType:"text",timestamp:"2026-02-26T14:30:02Z",content:"Found 3 files using session-based auth. Now let me read the login route and the protected route to understand the full flow before making changes."},{sessionId:"sess-001-prev",eventType:"tool_use",timestamp:"2026-02-26T14:30:03Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/login.ts"}}),raw:JSON.stringify({id:"tu-prev-003",type:"tool_use"})},{sessionId:"sess-001-prev",eventType:"tool_result",timestamp:"2026-02-26T14:30:04Z",content:`import { Router } from "express";
388
+ import bcrypt from "bcrypt";
389
+ import { db } from "../db.js";
390
+
391
+ const router = Router();
392
+
393
+ router.post("/login", async (req, res) => {
394
+ const { email, password } = req.body;
395
+ const user = await db.users.findByEmail(email);
396
+ if (!user || !await bcrypt.compare(password, user.passwordHash)) {
397
+ return res.status(401).json({ error: "Invalid credentials" });
398
+ }
399
+ req.session.userId = user.id;
400
+ req.session.role = user.role;
401
+ res.json({ ok: true });
402
+ });
403
+
404
+ export default router;`,raw:JSON.stringify({tool_use_id:"tu-prev-003"})},{sessionId:"sess-001-prev",eventType:"error",timestamp:"2026-02-26T15:12:00Z",content:"Context window exceeded before completing implementation"},{sessionId:"sess-001-prev",eventType:"status",timestamp:"2026-02-26T15:12:01Z",content:"interrupted"},{sessionId:"sess-001",eventType:"status",timestamp:"2026-02-27T08:15:01Z",content:"running"},{sessionId:"sess-001",eventType:"system",timestamp:"2026-02-27T08:15:02Z",content:`You are a senior backend engineer. Focus on security best practices and thorough testing.
405
+ Project: acme/alpha — Node.js + Express REST API
406
+ Task: Implement auth middleware using JWT tokens
407
+
408
+ Note: A previous session attempted this task but was interrupted. Pick up where it left off.`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-001",eventType:"user_input",timestamp:"2026-02-27T08:15:03Z",content:"Pick up the **JWT auth migration** from the previous session. A few requirements:\n\n- use `jsonwebtoken`, not `jose`\n- access tokens expire in `24h`\n- store refresh tokens in the DB\n\nMake sure the existing tests still pass."},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:04Z",content:"I'll pick up the JWT auth migration. The previous session identified 3 files that need updating. Let me verify the current state and start implementing."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:04.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"pending"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"pending"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:05Z",content:JSON.stringify({tool:"Grep",args:{pattern:"express-session|req\\.session",path:"src/",output_mode:"files_with_matches"}}),raw:JSON.stringify({id:"tu-001-01",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:06Z",content:`src/middleware/auth.ts
409
+ src/routes/login.ts
410
+ src/routes/protected.ts`,raw:JSON.stringify({tool_use_id:"tu-001-01"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:08Z",content:"Good, same 3 files. Let me install the JWT library first, then rewrite the middleware."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:09Z",content:JSON.stringify({tool:"Bash",args:{command:"npm install jsonwebtoken && npm install -D @types/jsonwebtoken"}}),raw:JSON.stringify({id:"tu-001-02",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:11Z",content:`added 12 packages in 3.2s
411
+
412
+ added 1 package in 0.8s`,raw:JSON.stringify({tool_use_id:"tu-001-02"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:11.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Install jsonwebtoken package",activeForm:"Installing jsonwebtoken",status:"completed"},{content:"Rewrite auth middleware for JWT",activeForm:"Rewriting auth middleware",status:"in_progress"},{content:"Update login route to issue tokens",activeForm:"Updating login route",status:"pending"},{content:"Update protected routes",activeForm:"Updating protected routes",status:"pending"},{content:"Fix and update tests",activeForm:"Fixing tests",status:"pending"},{content:"Run full test suite",activeForm:"Running tests",status:"pending"}]}})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:12Z",content:"Now I'll rewrite the auth middleware to use JWT verification instead of session checks."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:13Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/auth.ts",content:`import jwt from "jsonwebtoken";
413
+ import type { Request, Response, NextFunction } from "express";
414
+
415
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
416
+
417
+ export interface JwtPayload {
418
+ userId: string;
419
+ role: string;
420
+ iat: number;
421
+ exp: number;
422
+ }
423
+
424
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
425
+ const header = req.headers.authorization;
426
+ if (!header?.startsWith("Bearer ")) {
427
+ res.status(401).json({ error: "Missing or malformed token" });
428
+ return;
429
+ }
430
+ try {
431
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
432
+ req.user = decoded;
433
+ next();
434
+ } catch (err) {
435
+ if (err instanceof jwt.TokenExpiredError) {
436
+ res.status(401).json({ error: "Token expired" });
437
+ } else {
438
+ res.status(403).json({ error: "Invalid token" });
439
+ }
440
+ }
441
+ }
442
+ `}}),raw:JSON.stringify({id:"tu-001-03",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:14Z",content:"File written: src/middleware/auth.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-03"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:16Z",content:`Now I need to update the login route to issue JWT tokens instead of setting session data.
443
+
444
+ The new login flow will:
445
+ 1. Validate credentials (unchanged)
446
+ 2. Generate a JWT with \`userId\` and \`role\` claims
447
+ 3. Return the token in the response body
448
+ 4. Include a refresh token for long-lived sessions`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:17Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/login.ts",content:`import { Router } from "express";
449
+ import bcrypt from "bcrypt";
450
+ import jwt from "jsonwebtoken";
451
+ import crypto from "node:crypto";
452
+ import { db } from "../db.js";
453
+
454
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
455
+ const ACCESS_TOKEN_EXPIRY = "24h";
456
+ const REFRESH_TOKEN_BYTES = 48;
457
+
458
+ const router = Router();
459
+
460
+ router.post("/login", async (req, res) => {
461
+ const { email, password } = req.body;
462
+ const user = await db.users.findByEmail(email);
463
+ if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
464
+ return res.status(401).json({ error: "Invalid credentials" });
465
+ }
466
+
467
+ const accessToken = jwt.sign(
468
+ { userId: user.id, role: user.role },
469
+ JWT_SECRET,
470
+ { expiresIn: ACCESS_TOKEN_EXPIRY },
471
+ );
472
+
473
+ const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
474
+ await db.refreshTokens.create({ userId: user.id, token: refreshToken });
475
+
476
+ res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
477
+ });
478
+
479
+ export default router;
480
+ `}}),raw:JSON.stringify({id:"tu-001-04",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:18Z",content:"File written: src/routes/login.ts (33 lines)",raw:JSON.stringify({tool_use_id:"tu-001-04"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:20Z",content:"Let me update the protected route to use the new `req.user` shape from the JWT payload."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:21Z",content:JSON.stringify({tool:"Edit",args:{file_path:"src/routes/protected.ts",old_string:"const userId = req.session.userId;",new_string:"const { userId } = req.user as JwtPayload;"}}),raw:JSON.stringify({id:"tu-001-05",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:22Z",content:"Updated src/routes/protected.ts",raw:JSON.stringify({tool_use_id:"tu-001-05"})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:24Z",content:"Now let me run the existing tests to make sure nothing is broken, then I'll add new JWT-specific tests."},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:25Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-06",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:30Z",content:` PASS src/routes/__tests__/login.test.ts
481
+ PASS src/routes/__tests__/protected.test.ts
482
+ FAIL src/middleware/__tests__/auth.test.ts
483
+ x should reject missing session (12ms)
484
+ x should allow valid session (8ms)
485
+
486
+ 2 failed, 12 passed, 14 total
487
+
488
+ Test Suites: 1 failed, 2 passed, 3 total`,raw:JSON.stringify({tool_use_id:"tu-001-06",is_error:!0})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:32Z",content:`Two tests failed because they still test the old session-based auth. I need to rewrite those tests for JWT.
489
+
490
+ Let me update the auth middleware tests:`},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:33Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/__tests__/auth.test.ts",content:`import { describe, it, expect } from "vitest";
491
+ import jwt from "jsonwebtoken";
492
+ import { verifyToken } from "../auth.js";
493
+ import { createMockReqRes } from "../../test-utils/mock-express.js";
494
+
495
+ const SECRET = "test-secret";
496
+ process.env.JWT_SECRET = SECRET;
497
+
498
+ describe("verifyToken", () => {
499
+ it("should reject requests without Authorization header", () => {
500
+ const { req, res, next } = createMockReqRes();
501
+ verifyToken(req, res, next);
502
+ expect(res.status).toHaveBeenCalledWith(401);
503
+ });
504
+
505
+ it("should reject expired tokens", () => {
506
+ const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
507
+ const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
508
+ verifyToken(req, res, next);
509
+ expect(res.status).toHaveBeenCalledWith(401);
510
+ });
511
+
512
+ it("should accept valid tokens and attach user to request", () => {
513
+ const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
514
+ const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
515
+ verifyToken(req, res, next);
516
+ expect(next).toHaveBeenCalled();
517
+ expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
518
+ });
519
+ });
520
+ `}}),raw:JSON.stringify({id:"tu-001-07",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:34Z",content:"File written: src/middleware/__tests__/auth.test.ts (32 lines)",raw:JSON.stringify({tool_use_id:"tu-001-07"})},{sessionId:"sess-001",eventType:"tool_use",timestamp:"2026-02-27T08:15:35Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test"}}),raw:JSON.stringify({id:"tu-001-08",type:"tool_use"})},{sessionId:"sess-001",eventType:"tool_result",timestamp:"2026-02-27T08:15:40Z",content:` PASS src/routes/__tests__/login.test.ts
521
+ PASS src/routes/__tests__/protected.test.ts
522
+ PASS src/middleware/__tests__/auth.test.ts
523
+
524
+ Test Suites: 3 passed, 3 total
525
+ Tests: 14 passed, 14 total`,raw:JSON.stringify({tool_use_id:"tu-001-08"})},{sessionId:"sess-001",eventType:"usage",timestamp:"2026-02-27T08:15:41Z",content:JSON.stringify({input_tokens:42600,output_tokens:8100,cost_millicents:22e3})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
526
+
527
+ ### Changes made
528
+
529
+ | File | Action |
530
+ |------|--------|
531
+ | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
532
+ | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
533
+ | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
534
+ | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
535
+
536
+ ### Key decisions
537
+ - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
538
+ - **Refresh tokens**: 48-byte random hex, stored in DB
539
+ - **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{sessionId:"sess-001",eventType:"user_input",timestamp:"2026-02-27T08:15:50Z",content:"Looks great! Two follow-ups:\n\n1. add a `/refresh` endpoint that swaps a refresh token for a new access token\n2. note the token flow in `README.md`"},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:30:01Z",content:"running"},{sessionId:"sess-002",eventType:"system",timestamp:"2026-02-27T07:30:02Z",content:`You are a QA engineer. Write comprehensive tests covering happy paths, edge cases, error scenarios, and security.
540
+ Project: acme/alpha — Node.js + Express REST API
541
+ Task: Write unit tests for the user registration endpoint`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:04Z",content:"I'll write thorough tests for `POST /api/register`. Let me first read the registration endpoint to understand its behavior."},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:05Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/routes/register.ts"}}),raw:JSON.stringify({id:"tu-002-01",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:06Z",content:`import { Router } from "express";
542
+ import bcrypt from "bcrypt";
543
+ import { db } from "../db.js";
544
+ import { validateEmail, validatePassword } from "../utils/validators.js";
545
+
546
+ const SALT_ROUNDS = 12;
547
+ const router = Router();
548
+
549
+ router.post("/register", async (req, res) => {
550
+ const { name, email, password } = req.body;
551
+
552
+ if (!name || !email || !password) {
553
+ return res.status(400).json({ error: "Missing required fields" });
554
+ }
555
+ if (!validateEmail(email)) {
556
+ return res.status(400).json({ error: "Invalid email format" });
557
+ }
558
+ if (!validatePassword(password)) {
559
+ return res.status(400).json({ error: "Password too weak" });
560
+ }
561
+
562
+ const existing = await db.users.findByEmail(email);
563
+ if (existing) {
564
+ return res.status(409).json({ error: "Email already registered" });
565
+ }
566
+
567
+ const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
568
+ const user = await db.users.create({ name, email, passwordHash });
569
+ res.status(201).json({ id: user.id, name: user.name, email: user.email });
570
+ });
571
+
572
+ export default router;`,raw:JSON.stringify({tool_use_id:"tu-002-01"})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:30:10Z",content:`Good. The endpoint validates input, checks for duplicates, hashes the password, and creates the user. I'll write tests covering:
573
+
574
+ 1. **Happy path** - valid registration
575
+ 2. **Missing fields** - each required field missing
576
+ 3. **Invalid email** - malformed email format
577
+ 4. **Weak password** - password validation failure
578
+ 5. **Duplicate email** - conflict with existing user
579
+ 6. **SQL injection** - malicious email input
580
+ 7. **XSS payload** - HTML in the name field
581
+ 8. **Response shape** - correct status codes and body structure`},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:30:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/routes/__tests__/register.test.ts",content:"// [test content - 8 test cases as described above]"}}),raw:JSON.stringify({id:"tu-002-02",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:30:13Z",content:"File written: src/routes/__tests__/register.test.ts (142 lines)",raw:JSON.stringify({tool_use_id:"tu-002-02"})},{sessionId:"sess-002",eventType:"tool_use",timestamp:"2026-02-27T07:31:00Z",content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=register"}}),raw:JSON.stringify({id:"tu-002-03",type:"tool_use"})},{sessionId:"sess-002",eventType:"tool_result",timestamp:"2026-02-27T07:31:30Z",content:` PASS src/routes/__tests__/register.test.ts
582
+ POST /api/register
583
+ ✓ should register a valid user (28ms)
584
+ ✓ should reject missing name (4ms)
585
+ ✓ should reject missing email (3ms)
586
+ ✓ should reject missing password (3ms)
587
+ ✓ should reject invalid email format (5ms)
588
+ ✓ should reject weak password (4ms)
589
+ ✓ should reject duplicate email (12ms)
590
+ ✓ should sanitize HTML in name field (6ms)
591
+
592
+ Tests: 8 passed, 8 total`,raw:JSON.stringify({tool_use_id:"tu-002-03"})},{sessionId:"sess-002",eventType:"usage",timestamp:"2026-02-27T07:32:00Z",content:JSON.stringify({input_tokens:31400,output_tokens:9800,cost_millicents:18e3})},{sessionId:"sess-002",eventType:"text",timestamp:"2026-02-27T07:32:30Z",content:"All 8 test cases pass. Created `src/routes/__tests__/register.test.ts` with comprehensive coverage for the registration endpoint including input validation, duplicate detection, and security edge cases."},{sessionId:"sess-002",eventType:"status",timestamp:"2026-02-27T07:33:00Z",content:"completed"},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T22:45:01Z",content:"running"},{sessionId:"sess-003",eventType:"system",timestamp:"2026-02-26T22:45:02Z",content:`You are a database engineer. Focus on safe migrations, zero-downtime deployments, and data integrity.
593
+ Project: acme/alpha — Node.js + Express + PostgreSQL
594
+ Task: Add audit_log table and migrate schema`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:05Z",content:"I need to add an `audit_log` table for tracking all write operations. Let me review the current schema first."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"tu-003-01",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:07Z",content:`CREATE TABLE users (
595
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
596
+ name TEXT NOT NULL,
597
+ email TEXT UNIQUE NOT NULL,
598
+ password_hash TEXT NOT NULL,
599
+ role TEXT DEFAULT 'user',
600
+ created_at TIMESTAMPTZ DEFAULT now(),
601
+ updated_at TIMESTAMPTZ DEFAULT now()
602
+ );
603
+
604
+ CREATE TABLE sessions (
605
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
606
+ user_id UUID REFERENCES users(id),
607
+ expires_at TIMESTAMPTZ NOT NULL,
608
+ created_at TIMESTAMPTZ DEFAULT now()
609
+ );`,raw:JSON.stringify({tool_use_id:"tu-003-01"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:45:12Z",content:"I see the schema. I'll create a migration that:\n1. Adds a `last_login_at` column to `users`\n2. Adds an index on `sessions.expires_at` for efficient cleanup queries\n3. Creates the `audit_log` table\n\nLet me write the migration file:"},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:45:14Z",content:JSON.stringify({tool:"Write",args:{file_path:"migrations/002_audit_log.sql",content:`-- Migration: 002_audit_log
610
+ -- Add audit logging and user activity tracking
611
+
612
+ BEGIN;
613
+
614
+ -- 1. Add last_login_at to users
615
+ ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
616
+
617
+ -- 2. Index for session cleanup queries
618
+ CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
619
+
620
+ -- 3. Audit log table
621
+ CREATE TABLE audit_log (
622
+ id BIGSERIAL PRIMARY KEY,
623
+ user_id UUID REFERENCES users(id),
624
+ action TEXT NOT NULL,
625
+ entity_type TEXT NOT NULL,
626
+ entity_id TEXT NOT NULL,
627
+ old_value JSONB,
628
+ new_value JSONB,
629
+ ip_address INET,
630
+ created_at TIMESTAMPTZ DEFAULT now()
631
+ );
632
+
633
+ CREATE INDEX idx_audit_log_user ON audit_log (user_id);
634
+ CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
635
+ CREATE INDEX idx_audit_log_created ON audit_log (created_at);
636
+
637
+ COMMIT;
638
+ `}}),raw:JSON.stringify({id:"tu-003-02",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:45:15Z",content:"File written: migrations/002_audit_log.sql (29 lines)",raw:JSON.stringify({tool_use_id:"tu-003-02"})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:00Z",content:"Now I need to implement the audit middleware that logs write operations. This will intercept POST, PUT, PATCH, and DELETE requests."},{sessionId:"sess-003",eventType:"tool_use",timestamp:"2026-02-26T22:46:02Z",content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate -- --dry-run"}}),raw:JSON.stringify({id:"tu-003-03",type:"tool_use"})},{sessionId:"sess-003",eventType:"tool_result",timestamp:"2026-02-26T22:46:10Z",content:`Dry run: would apply 002_audit_log.sql
639
+ - ALTER TABLE users ADD COLUMN last_login_at
640
+ - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
641
+ - CREATE TABLE audit_log
642
+ - 3 indexes on audit_log
643
+
644
+ WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
645
+ Please split this into a separate migration step.`,raw:JSON.stringify({tool_use_id:"tu-003-03",is_error:!0})},{sessionId:"sess-003",eventType:"text",timestamp:"2026-02-26T22:46:15Z",content:"Good catch from the dry run! `CREATE INDEX CONCURRENTLY` can't run inside a transaction. I need to split the migration into two files: one for the transactional DDL and another for the concurrent index creation."},{sessionId:"sess-003",eventType:"usage",timestamp:"2026-02-26T23:00:00Z",content:JSON.stringify({input_tokens:56300,output_tokens:14200,cost_millicents:31e3})},{sessionId:"sess-003",eventType:"status",timestamp:"2026-02-26T23:10:00Z",content:"interrupted"},{sessionId:"sess-004",eventType:"status",timestamp:"2026-02-27T09:00:01Z",content:"running"},{sessionId:"sess-004",eventType:"system",timestamp:"2026-02-27T09:00:02Z",content:`You are a backend engineer specializing in API infrastructure.
646
+ Project: acme/data-pipeline — ETL pipelines for analytics
647
+ Task: Implement rate limiting for the public API using a token-bucket algorithm`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:05Z",content:"I'll implement rate limiting using a token-bucket algorithm. Let me first survey the existing API infrastructure to find the right integration point."},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:05.5Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"in_progress"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"pending"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:06Z",content:JSON.stringify({tool:"Glob",args:{pattern:"src/middleware/**/*.ts"}}),raw:JSON.stringify({id:"tu-004-01",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:07Z",content:`src/middleware/cors.ts
648
+ src/middleware/error-handler.ts
649
+ src/middleware/logger.ts
650
+ src/middleware/request-id.ts`,raw:JSON.stringify({tool_use_id:"tu-004-01"})},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:09Z",content:JSON.stringify({tool:"TodoWrite",args:{todos:[{content:"Survey middleware structure",activeForm:"Surveying middleware",status:"completed"},{content:"Implement token-bucket algorithm",activeForm:"Implementing token bucket",status:"in_progress"},{content:"Add rate limit middleware to app",activeForm:"Adding middleware",status:"pending"},{content:"Write tests for rate limiting",activeForm:"Writing tests",status:"pending"},{content:"Add Redis adapter for multi-instance",activeForm:"Adding Redis adapter",status:"pending"}]}})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:10Z",content:`Good middleware structure already in place. I'll add a \`rate-limiter.ts\` module that:
651
+
652
+ - Uses an **in-memory token bucket** per client IP
653
+ - Supports configurable rate (requests/second) and burst size
654
+ - Returns \`429 Too Many Requests\` with \`Retry-After\` header
655
+ - Has a Redis adapter option for multi-instance deployments
656
+
657
+ Let me implement it:`},{sessionId:"sess-004",eventType:"tool_use",timestamp:"2026-02-27T09:00:12Z",content:JSON.stringify({tool:"Write",args:{file_path:"src/middleware/rate-limiter.ts",content:"// Token bucket rate limiter implementation"}}),raw:JSON.stringify({id:"tu-004-02",type:"tool_use"})},{sessionId:"sess-004",eventType:"tool_result",timestamp:"2026-02-27T09:00:13Z",content:"File written: src/middleware/rate-limiter.ts (87 lines)",raw:JSON.stringify({tool_use_id:"tu-004-02"})},{sessionId:"sess-004",eventType:"text",timestamp:"2026-02-27T09:00:18Z",content:"Now I need to wire the rate limiter into the Express middleware stack. It should go after the request-ID middleware but before route handlers."},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:00:01Z",content:"running"},{sessionId:"sess-005",eventType:"system",timestamp:"2026-02-27T06:00:02Z",content:`You are a database specialist. Focus on connection management, performance, and multi-tenant isolation.
658
+ Project: acme/alpha — Node.js + Express + PostgreSQL
659
+ Task: Refactor database connection pooling for multi-tenant isolation`,raw:JSON.stringify({systemContext:!0})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:05Z",content:"I'll refactor the DB layer to support per-tenant connection pools. This is needed because the current single-pool design means one slow tenant can exhaust connections for everyone."},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:06Z",content:JSON.stringify({tool:"Read",args:{file_path:"src/db/pool.ts"}}),raw:JSON.stringify({id:"tu-005-01",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:07Z",content:`import pg from "pg";
660
+
661
+ const pool = new pg.Pool({
662
+ connectionString: process.env.DATABASE_URL,
663
+ max: 20,
664
+ idleTimeoutMillis: 30000,
665
+ });
666
+
667
+ export { pool };`,raw:JSON.stringify({tool_use_id:"tu-005-01"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:12Z",content:`The current pool is a single shared instance with \`max: 20\`. For multi-tenant isolation, I need:
668
+
669
+ 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
670
+ 2. **Configurable limits** per tenant (max connections, idle timeout)
671
+ 3. **Health checks** with automatic pool eviction for unhealthy connections
672
+ 4. **Graceful shutdown** that drains all pools`},{sessionId:"sess-005",eventType:"tool_use",timestamp:"2026-02-27T06:00:14Z",content:JSON.stringify({tool:"Grep",args:{pattern:"import.*pool|from.*pool",path:"src/",output_mode:"content"}}),raw:JSON.stringify({id:"tu-005-02",type:"tool_use"})},{sessionId:"sess-005",eventType:"tool_result",timestamp:"2026-02-27T06:00:15Z",content:`src/db/index.ts:1:import { pool } from "./pool.js";
673
+ src/routes/users.ts:2:import { pool } from "../db/pool.js";
674
+ src/routes/register.ts:3:import { pool } from "../db/pool.js";
675
+ src/routes/admin.ts:4:import { pool } from "../db/pool.js";
676
+ src/services/billing.ts:2:import { pool } from "../db/pool.js";
677
+ src/services/analytics.ts:1:import { pool } from "../db/pool.js";`,raw:JSON.stringify({tool_use_id:"tu-005-02"})},{sessionId:"sess-005",eventType:"text",timestamp:"2026-02-27T06:00:20Z",content:`Six files import the pool directly. I'll need to:
678
+ 1. Create a new \`PoolManager\` abstraction
679
+ 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
680
+ 3. Add middleware to extract tenant ID from the request
681
+
682
+ This is a significant refactor. Let me start with the PoolManager class.`},{sessionId:"sess-005",eventType:"usage",timestamp:"2026-02-27T06:30:00Z",content:JSON.stringify({input_tokens:67800,output_tokens:19300,cost_millicents:38e3})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],jH=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",linkedEnvironmentIds:["env-local-01","env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-01-15T10:00:00Z",updatedAt:"2026-01-15T10:00:00Z"},{id:"proj-beta",name:"Data Pipeline",description:"ETL pipelines for analytics and reporting",repoUrl:"https://github.com/acme/data-pipeline",linkedEnvironmentIds:["env-docker-01"],status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2026-02-01T14:30:00Z",updatedAt:"2026-02-01T14:30:00Z"},{id:"proj-gamma",name:"Mobile App",description:"React Native cross-platform mobile application",repoUrl:"",linkedEnvironmentIds:["env-local-01"],status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",tokenBudget:0,costBudgetMillicents:0,createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],TH=[{id:"task-001",workspaceId:"proj-alpha",title:"Implement JWT authentication",description:"Replace session-based auth with JWT tokens across all protected routes",status:"working",branch:"feat/jwt-auth",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-001a","task-001b","task-001c"],canDecompose:!0,injectKnowledge:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Design and implement JWT-based authentication with access/refresh tokens, replacing session-based auth.",extra:{approach:"Replace express-session with JWT Bearer tokens. Access tokens expire in 24h, refresh tokens stored in DB.",files_changed:["src/middleware/auth.ts","src/routes/login.ts","src/routes/protected.ts"],decisions:["Chose jsonwebtoken over jose for consistency with existing codebase","24h access token expiry — long enough for dev sessions, short enough for security","Refresh tokens are 48-byte random hex stored in DB with user association"],blockers:"Need to verify token rotation strategy with security team before merging"}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-001a",workspaceId:"proj-alpha",title:"Design token schema",description:"Define JWT payload structure, expiry, and refresh token strategy",status:"complete",branch:"feat/jwt-auth/design-token-schema",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-25T10:10:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001b",workspaceId:"proj-alpha",title:"Implement auth middleware",description:"Build Express middleware that verifies JWT Bearer tokens",status:"working",branch:"feat/jwt-auth/implement-auth-middleware",latestSessionId:"sess-001",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:15:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-001c",workspaceId:"proj-alpha",title:"Write auth integration tests",description:"End-to-end tests for login flow, token refresh, and protected route access",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-25T10:20:00Z",parentTaskId:"task-001",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-002",workspaceId:"proj-alpha",title:"Add rate limiting",description:"Implement token-bucket rate limiting for public API endpoints",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-001"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-25T10:05:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-003",workspaceId:"proj-alpha",title:"Set up OpenAPI documentation",description:"Generate Swagger docs from route decorators and serve at /api/docs",status:"paused",branch:"feat/openapi-docs",latestSessionId:"sess-002",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-24T16:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-004",workspaceId:"proj-alpha",title:"Database connection pooling",description:"Switch from single connection to a connection pool with health checks",status:"complete",branch:"feat/db-pool",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-23T11:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-005",workspaceId:"proj-alpha",title:"Fix N+1 query in user list",description:"Use a JOIN instead of per-row lookups in GET /api/users",status:"not_started",branch:"fix/user-list-n1",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:5,createdAt:"2026-02-22T09:30:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006",workspaceId:"proj-beta",title:"Add Parquet export support",description:"Allow pipeline outputs to be written as Parquet files for Spark consumption",status:"working",branch:"feat/parquet-export",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:00:00Z",parentTaskId:"",depth:0,childTaskIds:["task-006a","task-006b","task-006c","task-006d"],canDecompose:!0,injectKnowledge:!0,defaultPersonaId:"",workpad:JSON.stringify({status:"in_progress",summary:"Plan for adding Parquet export support, including compression options and performance benchmarks.",extra:{approach:"Use apache-arrow npm package for Parquet write support. Map internal column types to Arrow type system.",compression:{supported:["snappy","zstd","gzip"],default:"snappy"},benchmarks:{"1M rows snappy":"2.3s","1M rows zstd":"3.1s","1M rows gzip":"4.8s"}}}),tokenBudget:0,costBudgetMillicents:0},{id:"task-006a",workspaceId:"proj-beta",title:"Define Parquet schema mapping",description:"Map internal column types to Arrow/Parquet type system",status:"complete",branch:"feat/parquet-export/define-parquet-schema-mapping",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:05:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006b",workspaceId:"proj-beta",title:"Implement row-group writer",description:"Write buffered row groups with configurable batch size",status:"complete",branch:"feat/parquet-export/implement-row-group-writer",latestSessionId:"",dependsOn:["task-006a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:10:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006c",workspaceId:"proj-beta",title:"Add compression options",description:"Support Snappy, ZSTD, and GZIP compression for Parquet output",status:"working",branch:"feat/parquet-export/add-compression-options",latestSessionId:"sess-004",dependsOn:["task-006b"],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T08:15:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-006d",workspaceId:"proj-beta",title:"Write Parquet integration tests",description:"Round-trip tests: write Parquet, read back with pyarrow, verify data integrity",status:"not_started",branch:"",latestSessionId:"",dependsOn:["task-006c"],reviewNotes:void 0,sortOrder:4,createdAt:"2026-02-26T08:20:00Z",parentTaskId:"task-006",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007",workspaceId:"proj-beta",title:"Implement incremental loads",description:"Track watermarks so pipelines only process new/changed rows",status:"working",branch:"feat/incremental",latestSessionId:"sess-004",dependsOn:[],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:30:00Z",parentTaskId:"",depth:0,childTaskIds:["task-007a","task-007b"],canDecompose:!0,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007a",workspaceId:"proj-beta",title:"Design watermark storage",description:"Define schema for per-pipeline high-watermark tracking",status:"complete",branch:"feat/incremental/design-watermark-storage",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:1,createdAt:"2026-02-26T08:35:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-007b",workspaceId:"proj-beta",title:"Implement change detection query",description:"Generate WHERE clauses from watermarks to fetch only changed rows",status:"failed",branch:"feat/incremental/implement-change-detection-query",latestSessionId:"",dependsOn:["task-007a"],reviewNotes:void 0,sortOrder:2,createdAt:"2026-02-26T08:40:00Z",parentTaskId:"task-007",depth:1,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0},{id:"task-008",workspaceId:"proj-beta",title:"Add pipeline monitoring dashboard",description:"Real-time metrics for pipeline throughput, latency, and error rates",status:"paused",branch:"feat/monitoring",latestSessionId:"",dependsOn:[],reviewNotes:void 0,sortOrder:3,createdAt:"2026-02-26T09:00:00Z",parentTaskId:"",depth:0,childTaskIds:[],canDecompose:!1,injectKnowledge:!0,defaultPersonaId:"",workpad:"",tokenBudget:0,costBudgetMillicents:0}],NH=[{name:"anthropic",tokenType:"env_var",envVar:"ANTHROPIC_API_KEY",filePath:"",expiresAt:""},{name:"github",tokenType:"env_var",envVar:"GITHUB_TOKEN",filePath:"",expiresAt:"2026-12-31T23:59:59Z"},{name:"gcp-service-account",tokenType:"file",envVar:"",filePath:"/home/user/.config/gcloud/credentials.json",expiresAt:""}],wH=[{id:"persona-arch",name:"Software Architect",description:"Designs system architecture, defines interfaces, and decomposes large features into implementable tasks.",systemPrompt:"You are a senior software architect. Focus on clean interfaces, separation of concerns, and scalable patterns. When decomposing work, create concrete subtasks with clear acceptance criteria.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:50,mcpServers:"[]",createdAt:"2026-02-20T10:00:00Z",updatedAt:"2026-02-20T10:00:00Z",type:"agent",script:"",allowedMcpTools:["task_create","task_update","task_list","knowledge_search","session_spawn"]},{id:"persona-fe",name:"Frontend Engineer",description:"React specialist — builds UI components, writes CSS, implements routing, and creates Playwright tests.",systemPrompt:"You are a frontend engineer specializing in React, TypeScript, and modern CSS. Follow component composition patterns, use semantic HTML, and write accessible markup.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:100,mcpServers:"[]",createdAt:"2026-02-20T10:05:00Z",updatedAt:"2026-02-20T10:05:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-reviewer",name:"Code Reviewer",description:"Reviews diffs for correctness, security, and style. Reports issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Report anything noteworthy.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:30,mcpServers:"[]",createdAt:"2026-02-20T10:10:00Z",updatedAt:"2026-02-20T10:10:00Z",type:"agent",script:"",allowedMcpTools:["knowledge_search"]},{id:"persona-tester",name:"QA Engineer",description:"Writes comprehensive test suites — unit tests, integration tests, and E2E Playwright specs.",systemPrompt:"You are a QA engineer focused on test coverage. Write tests that cover happy paths, edge cases, error scenarios, and accessibility. Use Playwright for E2E tests.",toolConfig:JSON.stringify({allowedTools:["Read","Grep","Glob","Write","Edit","Bash"]}),runtime:"claude-code",model:"claude-sonnet-4-6",maxTurns:80,mcpServers:"[]",createdAt:"2026-02-20T10:15:00Z",updatedAt:"2026-02-20T10:15:00Z",type:"agent",script:"",allowedMcpTools:[]},{id:"persona-lint",name:"Lint & Format",description:"Scripted persona — runs ESLint and Prettier on changed files, auto-fixes violations, and logs a summary.",systemPrompt:"",toolConfig:"{}",runtime:"genaiscript",model:"",maxTurns:1,mcpServers:"[]",createdAt:"2026-02-21T09:00:00Z",updatedAt:"2026-02-21T09:00:00Z",type:"script",script:'const files = env.files.filter(f => /\\.(ts|tsx|js)$/.test(f.filename));\nfor (const f of files) {\n const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);\n if (eslintResult.exitCode !== 0) {\n console.log(`Lint issues in ${f.filename}: ${eslintResult.stderr}`);\n }\n const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);\n if (prettierResult.exitCode !== 0) {\n console.log(`Prettier issues in ${f.filename}: ${prettierResult.stderr}`);\n }\n}\nconsole.log(`Ran ESLint and Prettier on ${files.length} files`);',allowedMcpTools:[]}],CH={"task-001b":[{id:"sess-001-prev",environmentId:"env-local-01",runtime:"claude-code",status:"stopped",endReason:"interrupted",prompt:"Implement auth middleware",startedAt:"2026-02-26T14:00:00Z"},{id:"sess-001",environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:"Implement auth middleware",startedAt:"2026-02-27T08:15:00Z"}],"task-006c":[{id:"sess-004",environmentId:"env-docker-01",runtime:"claude-code",status:"running",prompt:"Add compression options",startedAt:"2026-02-27T09:00:00Z"}]};function Oe(t){return new Date(Date.now()+t).toISOString()}const x_=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(1200),content:JSON.stringify({tool:"Glob",args:{pattern:"src/routes/**/*.ts"}}),raw:JSON.stringify({id:"stream-a-01",type:"tool_use"})}},{delayMs:1600,event:{eventType:"tool_result",timestamp:Oe(1600),content:`src/routes/users.ts
683
+ src/routes/auth.ts
684
+ src/routes/billing.ts
685
+ src/routes/admin.ts
686
+ src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Oe(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
687
+
688
+ \`\`\`typescript
689
+ const router = Router();
690
+ router.use(authenticate);
691
+ router.use(validateBody);
692
+
693
+ router.get("/", listUsers);
694
+ router.post("/", createUser);
695
+ router.get("/:id", getUser);
696
+ router.put("/:id", updateUser);
697
+ router.delete("/:id", deleteUser);
698
+ \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Oe(3200),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --testPathPattern=routes"}}),raw:JSON.stringify({id:"stream-a-02",type:"tool_use"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Oe(4e3),content:` PASS src/routes/__tests__/users.test.ts
699
+ PASS src/routes/__tests__/auth.test.ts
700
+ PASS src/routes/__tests__/billing.test.ts
701
+
702
+ Test Suites: 3 passed, 3 total
703
+ Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Oe(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_millicents:15e3})}},{delayMs:5e3,event:{eventType:"text",timestamp:Oe(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Oe(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(1200),content:JSON.stringify({tool:"Read",args:{file_path:"migrations/001_initial.sql"}}),raw:JSON.stringify({id:"stream-b-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Oe(1800),content:`CREATE TABLE users (
704
+ id UUID PRIMARY KEY,
705
+ name TEXT NOT NULL,
706
+ email TEXT UNIQUE NOT NULL,
707
+ created_at TIMESTAMPTZ DEFAULT now()
708
+ );
709
+
710
+ CREATE TABLE sessions (
711
+ id UUID PRIMARY KEY,
712
+ user_id UUID REFERENCES users(id),
713
+ expires_at TIMESTAMPTZ NOT NULL
714
+ );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Oe(2600),content:`I found the tables to modify:
715
+ - **users**: add column \`last_login_at\`
716
+ - **sessions**: add index on \`expires_at\`
717
+ - **audit_log**: new table
718
+
719
+ This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
720
+
721
+ Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Oe(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(700),content:JSON.stringify({tool:"Bash",args:{command:"npm run migrate"}}),raw:JSON.stringify({id:"stream-b-02",type:"tool_use"})}},{delayMs:2200,event:{eventType:"tool_result",timestamp:Oe(1700),content:`Applying 002_add_last_login.sql... done
722
+ Applying 003_sessions_index.sql... done
723
+ Applying 004_audit_log.sql... done
724
+
725
+ 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Oe(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Oe(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(1200),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/billing.ts"}}),raw:JSON.stringify({id:"stream-c-01",type:"tool_use"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Oe(1800),content:`import { StripeClient } from "./stripe-client.js";
726
+ import type { Invoice, LineItem } from "../types/billing.js";
727
+
728
+ export class BillingService {
729
+ constructor(private stripe: StripeClient) {}
730
+
731
+ async calculateMonthlyTotal(userId: string): Promise<number> {
732
+ const invoices = await this.stripe.listInvoices(userId);
733
+ return invoices.reduce((sum, inv) => sum + inv.total, 0);
734
+ }
735
+ }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Oe(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Oe(2800),content:JSON.stringify({tool:"Read",args:{file_path:"src/services/stripe-client.ts"}}),raw:JSON.stringify({id:"stream-c-02",type:"tool_use"})}},{delayMs:3200,event:{eventType:"tool_result",timestamp:Oe(3200),content:"Error: ENOENT: no such file or directory, open 'src/services/stripe-client.ts'",raw:JSON.stringify({tool_use_id:"stream-c-02",is_error:!0})}},{delayMs:3600,event:{eventType:"error",timestamp:Oe(3600),content:"Cannot resolve import 'src/services/stripe-client.ts' — module not found. The billing service depends on a Stripe client that doesn't exist in this environment."}},{delayMs:4e3,event:{eventType:"status",timestamp:Oe(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Oe(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Oe(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Oe(1200),content:JSON.stringify({tool:"Read",args:{file_path:"/src/middleware/auth.ts"}}),raw:JSON.stringify({id:"tool-mock-001"})}},{delayMs:1800,event:{eventType:"tool_result",timestamp:Oe(1800),content:`import jwt from "jsonwebtoken";
736
+ import type { Request, Response, NextFunction } from "express";
737
+
738
+ const JWT_SECRET = process.env.JWT_SECRET || "change-me";
739
+
740
+ export function verifyToken(req: Request, res: Response, next: NextFunction): void {
741
+ const header = req.headers.authorization;
742
+ if (!header?.startsWith("Bearer ")) {
743
+ res.status(401).json({ error: "Missing token" });
744
+ return;
745
+ }
746
+ try {
747
+ const decoded = jwt.verify(header.slice(7), JWT_SECRET);
748
+ if (decoded.exp > Date.now() / 1000) {
749
+ res.status(403).json({ error: "Token expired" });
750
+ return;
751
+ }
752
+ req.user = decoded;
753
+ next();
754
+ } catch {
755
+ res.status(403).json({ error: "Invalid token" });
756
+ }
757
+ }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Oe(2600),content:"Found the issue — the token expiry check on line 14 is using `>` instead of `<`. A token is expired when `exp < now`, but the code checks `exp > now` which means it rejects *valid* tokens and accepts *expired* ones. Let me fix it."}},{delayMs:3400,event:{eventType:"tool_use",timestamp:Oe(3400),content:JSON.stringify({tool:"Edit",args:{file_path:"/src/middleware/auth.ts",old_string:" if (decoded.exp > Date.now() / 1000) {",new_string:" if (decoded.exp < Date.now() / 1000) {"}}),raw:JSON.stringify({id:"tool-mock-002"})}},{delayMs:4e3,event:{eventType:"tool_result",timestamp:Oe(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Oe(4600),content:JSON.stringify({tool:"Bash",args:{command:"npm test -- --grep auth"}}),raw:JSON.stringify({id:"tool-mock-003"})}},{delayMs:5800,event:{eventType:"tool_result",timestamp:Oe(5800),content:`[exit 0] > jest --grep auth
758
+
759
+ PASS src/auth.test.ts
760
+ ✓ validates JWT token (12ms)
761
+ ✓ rejects expired token (3ms)
762
+ ✓ handles missing header (1ms)
763
+
764
+ Tests: 3 passed, 3 total
765
+ Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Oe(6400),content:JSON.stringify({tool:"Grep",args:{pattern:"decoded\\.exp",path:"src/"}}),raw:JSON.stringify({id:"tool-mock-004"})}},{delayMs:7e3,event:{eventType:"tool_result",timestamp:Oe(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
766
+ src/utils/token-refresh.ts:28: const remaining = decoded.exp - Date.now() / 1000;`,raw:JSON.stringify({tool_use_id:"tool-mock-004",is_error:!1})}},{delayMs:7800,event:{eventType:"text",timestamp:Oe(7800),content:"Fixed. The token expiry comparison was inverted — `decoded.exp > Date.now()` should have been `<` (a token is expired when its `exp` is in the past). The other occurrence in `token-refresh.ts` uses subtraction (not comparison), so it was already correct. All 3 auth tests pass."}},{delayMs:8400,event:{eventType:"usage",timestamp:Oe(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_millicents:12e3})}},{delayMs:8800,event:{eventType:"status",timestamp:Oe(8800),content:"completed"}}]}],ss={onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1};function k_(t){return t?__:__.filter(s=>!hz.some(o=>s.name.startsWith(o)))}const S_=400;function EH({children:t}){const[s,o]=y.useState(xH),[r,c]=y.useState(kH),[d,u]=y.useState(()=>k_(!1)),[f,m]=y.useState(SH),[h,v]=y.useState(void 0),[b,_]=y.useState(jH),[x,S]=y.useState(""),[j,T]=y.useState(TH),[N,C]=y.useState(NH),[D,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[E,R]=y.useState(wH),[L,M]=y.useState([]),[$]=y.useState(CH),[Y,U]=y.useState(""),[X,te]=y.useState(Ms),[G,ne]=y.useState(Ya),[H,O]=y.useState(void 0),[q,ge]=y.useState(void 0),[se,ce]=y.useState(""),me=y.useRef(void 0),xe=y.useRef(0),De=y.useRef(0),ot=y.useRef(new Set),_t=y.useRef(new Map),lt=y.useRef(j);lt.current=j;const Pe=y.useRef(new Map),ke=y.useRef(new Map),ct=y.useCallback(V=>(xe.current+=1,`mock-${V}-${String(xe.current).padStart(3,"0")}`),[]),ue=y.useCallback(()=>{const V=x_[De.current%x_.length];return De.current+=1,V},[]),Ie=y.useCallback((V,ie,de)=>{const pe=setTimeout(()=>{var ye;ot.current.delete(pe),de&&((ye=_t.current.get(de))==null||ye.delete(pe)),V()},ie);ot.current.add(pe),de&&(_t.current.has(de)||_t.current.set(de,new Set),_t.current.get(de).add(pe))},[]),ee=y.useCallback(V=>{const ie=_t.current.get(V);ie&&(ie.forEach(de=>{clearTimeout(de),ot.current.delete(de)}),_t.current.delete(V))},[]),nt=y.useCallback((V,ie,de)=>{c(pe=>pe.map(ye=>ye.id===V?{...ye,status:ie,...de!==void 0?{endReason:de}:{}}:ye))},[]),le=y.useCallback(V=>{m(ie=>[...ie,V])},[]),ve=y.useCallback((V,ie,de)=>{ie.forEach((pe,ye)=>{Ie(()=>{const tt={sessionId:V,...pe.event,timestamp:new Date().toISOString()};if(le(tt),pe.event.eventType==="status"){const je=Ek(pe.event.content),Be=Ak(pe.event.content);nt(V,je,Be)}ye===ie.length-1&&de&&de()},pe.delayMs,V)})},[Ie,le,nt]),et=y.useCallback(async(V,ie,de,pe)=>{console.log("[MockGrackle] spawn",{environmentId:V,prompt:ie,runtime:pe});const ye=ct("sess"),tt={id:ye,environmentId:V,runtime:pe||"claude-code",status:"running",prompt:ie,startedAt:new Date().toISOString()};c(Be=>[...Be,tt]),v(ye);const je=ue();if(console.log(`[MockGrackle] Playing scenario: ${je.label}`),je.pauseForInput){const Be=je.pauseAfterStep??je.steps.length-1,Ue=je.steps.slice(0,Be+1),Mt=Ue.length>0?Ue[Ue.length-1].delayMs:0;ve(ye,Ue),Ie(()=>{nt(ye,"idle"),le({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Mt+S_,ye),je.resumeSteps&&Pe.current.set(ye,je.resumeSteps)}else ve(ye,je.steps)},[ct,ue,ve,Ie,nt,le]),on=y.useCallback(async V=>{console.log("[MockGrackle] kill",V),ee(V),Pe.current.delete(V),nt(V,"stopped","killed"),le({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),T(ie=>ie.map(de=>de.latestSessionId===V&&de.status==="working"?{...de,status:"not_started"}:de))},[ee,nt,le]),ks=y.useCallback(async V=>{console.log("[MockGrackle] stopGraceful",V),ee(V),Pe.current.delete(V),nt(V,"stopped","terminated"),le({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),T(ie=>ie.map(de=>de.latestSessionId===V&&de.status==="working"?{...de,status:"not_started"}:de))},[ee,nt,le]),us=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Ps=y.useCallback(async V=>{console.log("[MockGrackle] loadSessionEvents",V)},[]),ya=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),m([])},[]),Bi=y.useCallback(async(V,ie,de,pe,ye,tt,je,Be,Ue)=>{console.log("[MockGrackle] createWorkspace",{name:V,description:ie});const Mt={id:ct("proj"),name:V,description:ie||"",repoUrl:de||"",linkedEnvironmentIds:pe?[pe]:[],status:"active",workingDirectory:je||"",useWorktrees:tt??!0,defaultPersonaId:ye||"",tokenBudget:0,costBudgetMillicents:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};_(qe=>[...qe,Mt]),Be&&Be(Mt)},[ct]),Xt=y.useCallback(async V=>{console.log("[MockGrackle] archiveWorkspace",V),_(ie=>ie.map(de=>de.id===V?{...de,status:"archived"}:de))},[]),ai=y.useCallback(async V=>{console.log("[MockGrackle] loadTasks",V)},[]),ii=y.useCallback(async(V,ie,de,pe,ye,tt,je,Be,Ue,Mt)=>{console.log("[MockGrackle] createTask",{workspaceId:V,title:ie,parentTaskId:ye}),T(qe=>{const En=qe.filter(Ts=>Ts.workspaceId===V).reduce((Ts,Ns)=>Math.max(Ts,Ns.sortOrder),0),xt=ye?qe.find(Ts=>Ts.id===ye):void 0;if(ye&&!xt)return console.warn("[MockGrackle] Parent task not found:",ye),qe;if(xt&&!xt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",ye),qe;const js=xt?xt.depth+1:0,Pi={id:ct("task"),workspaceId:V,title:ie,description:de||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:En+1,createdAt:new Date().toISOString(),parentTaskId:ye||"",depth:js,childTaskIds:[],canDecompose:je??!ye,injectKnowledge:Be??!0,defaultPersonaId:tt||"",workpad:"",tokenBudget:0,costBudgetMillicents:0};return[...qe,Pi]}),Ue&&Ue()},[ct]),ba=y.useCallback(async(V,ie,de,pe)=>{var Mt;console.log("[MockGrackle] startTask",{taskId:V});const ye=lt.current.find(qe=>qe.id===V),tt=(ye==null?void 0:ye.title)??"",je=ct("sess"),Be={id:je,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:tt||V,startedAt:new Date().toISOString()};c(qe=>[...qe,Be]),T(qe=>qe.map(rn=>rn.id===V?{...rn,status:"working",latestSessionId:je,branch:`mock/${V.slice(0,8)}`}:rn));const Ue=ue();if(console.log(`[MockGrackle] Playing task scenario: ${Ue.label}`),Ue.pauseForInput){const qe=Ue.pauseAfterStep??Ue.steps.length-1,rn=Ue.steps.slice(0,qe+1),En=rn.length>0?rn[rn.length-1].delayMs:0;if(ve(je,rn),Ie(()=>{nt(je,"idle"),le({sessionId:je,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},En+S_,je),Ue.resumeSteps){const xt=[...Ue.resumeSteps];Pe.current.set(je,xt);const js=xt.reduce((Pi,Ts)=>Math.max(Pi,Ts.delayMs),0);ke.current.set(je,{taskId:V,delayAfterResume:js+200})}}else{const qe=Ue.steps.length>0?Ue.steps[Ue.steps.length-1].delayMs:0;ve(je,Ue.steps);const rn=(Mt=Ue.steps[Ue.steps.length-1])==null?void 0:Mt.event.content;Ie(()=>{rn==="completed"?T(En=>En.map(xt=>xt.id===V&&xt.status==="working"?{...xt,status:"paused"}:xt)):rn==="failed"&&T(En=>En.map(xt=>xt.id===V&&xt.status==="working"?{...xt,status:"failed"}:xt))},qe+100,je)}},[ct,ue,ve,Ie,nt,le]),Us=y.useCallback(async(V,ie)=>{console.log("[MockGrackle] sendInput",{sessionId:V,text:ie}),le({sessionId:V,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ie}`}),nt(V,"running"),le({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const de=Pe.current.get(V);if(de)Pe.current.delete(V),ve(V,de);else{const ye=[{delayMs:500,event:{eventType:"output",timestamp:new Date().toISOString(),content:"I received your input, continuing..."}},{delayMs:1500,event:{eventType:"status",timestamp:new Date().toISOString(),content:"completed"}}];ve(V,ye)}const pe=ke.current.get(V);pe&&(ke.current.delete(V),Ie(()=>{T(ye=>ye.map(tt=>tt.id===pe.taskId&&tt.status==="working"?{...tt,status:"paused"}:tt))},pe.delayAfterResume,V))},[le,nt,ve,Ie]),Ss=y.useCallback(async V=>{console.log("[MockGrackle] completeTask",V),T(ie=>ie.map(de=>de.id===V?{...de,status:"complete"}:de))},[]),_a=y.useCallback(async V=>{console.log("[MockGrackle] resumeTask",V)},[]),Ce=y.useCallback(async(V,ie,de,pe,ye)=>{console.log("[MockGrackle] updateTask",{taskId:V,title:ie}),T(tt=>tt.map(je=>je.id===V?{...je,title:ie.trim()||je.title,description:de,dependsOn:pe,...ye!==void 0?{defaultPersonaId:ye}:{}}:je))},[]),Ve=y.useCallback(async V=>{console.log("[MockGrackle] deleteTask",V),T(ie=>ie.filter(de=>de.id!==V))},[]),Qt=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),Ct=y.useCallback(async(V,ie,de)=>{console.log("[MockGrackle] addEnvironment",{displayName:V,adapterType:ie,adapterConfig:de})},[]),yn=y.useCallback(async(V,ie)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:V,...ie}),o(de=>de.map(pe=>pe.id!==V?pe:{...pe,...ie.displayName!==void 0?{displayName:ie.displayName}:{},...ie.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ie.adapterConfig)}:{}}))},[]),en=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),zi=y.useCallback(async(V,ie,de,pe,ye)=>{console.log("[MockGrackle] setToken",{name:V,tokenType:de}),C(tt=>[...tt.filter(Be=>Be.name!==V),{name:V,tokenType:de,envVar:pe,filePath:ye,expiresAt:""}])},[]),$i=y.useCallback(async V=>{console.log("[MockGrackle] deleteToken",V),C(ie=>ie.filter(de=>de.name!==V))},[]),Hi=y.useCallback(async V=>{console.log("[MockGrackle] updateCredentialProviders",V),A(V)},[]);y.useEffect(()=>()=>{ot.current.forEach(clearTimeout),ot.current.clear()},[]);const xa=y.useMemo(()=>({connectionStatus:"connected",environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:Qt,addEnvironment:Ct,updateEnvironment:yn,provisionEnvironment:async(V,ie)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},domainHook:ss},sessions:{sessions:r,sessionsLoading:!1,events:f,eventsDropped:0,lastSpawnedId:h,taskSessions:$,spawn:et,sendInput:Us,kill:on,stopGraceful:ks,loadSessionEvents:Ps,clearEvents:ya,loadTaskSessions:async V=>{console.log("[MockGrackle] loadTaskSessions",V)},domainHook:ss},workspaces:{workspaces:b,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Bi,archiveWorkspace:Xt,updateWorkspace:async(V,ie)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:V,...ie}),_(de=>de.map(pe=>pe.id!==V?pe:{...pe,...ie.name!==void 0?{name:ie.name}:{},...ie.description!==void 0?{description:ie.description}:{},...ie.repoUrl!==void 0?{repoUrl:ie.repoUrl}:{},...ie.environmentId!==void 0?{environmentId:ie.environmentId}:{},...ie.workingDirectory!==void 0?{workingDirectory:ie.workingDirectory}:{},...ie.useWorktrees!==void 0?{useWorktrees:ie.useWorktrees}:{},...ie.defaultPersonaId!==void 0?{defaultPersonaId:ie.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},linkEnvironment:async(V,ie)=>{if(console.log("[MockGrackle] linkEnvironment",{workspaceId:V,environmentId:ie}),ie==="error-env"){S("Failed to link environment");return}S(""),_(de=>de.map(pe=>pe.id!==V||pe.linkedEnvironmentIds.includes(ie)?pe:{...pe,linkedEnvironmentIds:[...pe.linkedEnvironmentIds,ie]}))},unlinkEnvironment:async(V,ie)=>{if(console.log("[MockGrackle] unlinkEnvironment",{workspaceId:V,environmentId:ie}),ie==="error-env"){S("Failed to unlink environment");return}S(""),_(de=>de.map(pe=>pe.id!==V?pe:{...pe,linkedEnvironmentIds:pe.linkedEnvironmentIds.filter(ye=>ye!==ie)}))},linkOperationError:x,clearLinkOperationError:()=>{S("")},domainHook:ss},tasks:{tasks:j,tasksLoading:!1,taskStartingId:void 0,loadTasks:ai,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:ii,startTask:ba,stopTask:async V=>{console.log("[MockGrackle] stopTask",{taskId:V}),await Ss(V)},completeTask:Ss,resumeTask:_a,updateTask:Ce,deleteTask:Ve,domainHook:ss},tokens:{tokens:N,tokensLoading:!1,loadTokens:en,setToken:zi,deleteToken:$i,domainHook:ss},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:Hi,domainHook:ss},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},domainHook:ss},dockerContainers:{dockerContainers:[],dockerContainersError:"",listDockerContainers:async()=>{},domainHook:ss},personas:{personas:E,personasLoading:!1,createPersona:async(V,ie,de,pe,ye,tt,je,Be,Ue)=>{console.log("[MockGrackle] createPersona",{name:V});const Mt={id:`mock-persona-${Date.now()}`,name:V,description:ie,systemPrompt:de,toolConfig:"{}",runtime:pe??"claude-code",model:ye||"",maxTurns:tt||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:je||"agent",script:Be||"",allowedMcpTools:Ue||[]};return R(qe=>[...qe,Mt]),Mt},updatePersona:async(V,ie,de,pe,ye,tt,je,Be,Ue,Mt)=>{console.log("[MockGrackle] updatePersona",{personaId:V,name:ie});const qe=E.find(xt=>xt.id===V);if(!qe)throw new Error(`Persona not found: ${V}`);const rn=new Date().toISOString(),En={...qe,...ie!==void 0?{name:ie}:{},...de!==void 0?{description:de}:{},...pe!==void 0?{systemPrompt:pe}:{},...ye!==void 0?{runtime:ye}:{},...tt!==void 0?{model:tt}:{},...je!==void 0?{maxTurns:je}:{},...Be!==void 0?{type:Be}:{},...Ue!==void 0?{script:Ue}:{},...Mt!==void 0?{allowedMcpTools:Mt}:{},updatedAt:rn};return R(xt=>xt.map(js=>js.id===V?En:js)),En},deletePersona:async V=>{console.log("[MockGrackle] deletePersona",V),R(ie=>ie.filter(de=>de.id!==V))},domainHook:ss},schedules:{schedules:L,schedulesLoading:!1,createSchedule:async(V,ie,de,pe,ye)=>{console.log("[MockGrackle] createSchedule",{title:V});const tt={id:`mock-schedule-${Date.now()}`,title:V,description:ie,scheduleExpression:de,personaId:pe,workspaceId:ye??"",parentTaskId:"",enabled:!0,lastRunAt:"",nextRunAt:new Date(Date.now()+6e4).toISOString(),runCount:0,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};return M(je=>[...je,tt]),tt},updateSchedule:async(V,ie)=>{console.log("[MockGrackle] updateSchedule",{scheduleId:V,fields:ie});let de;if(M(pe=>pe.map(ye=>ye.id!==V?ye:(de={...ye,...ie,updatedAt:new Date().toISOString()},de))),!de)throw new Error(`Schedule not found: ${V}`);return de},deleteSchedule:async V=>{console.log("[MockGrackle] deleteSchedule",V),M(ie=>ie.filter(de=>de.id!==V))},domainHook:ss},streams:{streams:d,streamsLoading:!1,streamsLoadedOnce:!0,streamsLoadError:!1,loadStreams:async(V=!1)=>{u(k_(V))},liveMessages:_H,loadTranscript:async()=>{},handleStreamMessage:()=>{},domainHook:ss},knowledge:{graphData:{nodes:X,links:G},selectedNode:H,loading:!1,loadError:void 0,selectedId:q,searchQuery:se,search:async V=>{if(console.log("[MockGrackle] knowledge.search",V),!V.trim()){ce(V);return}ce(V);const ie=me.current,de=ie?Ms.filter(je=>!je.workspaceId||je.workspaceId===ie):Ms,pe=V.toLowerCase(),ye=de.filter(je=>{var Be,Ue,Mt;return je.label.toLowerCase().includes(pe)||((Be=je.content)==null?void 0:Be.toLowerCase().includes(pe))||((Ue=je.tags)==null?void 0:Ue.some(qe=>qe.toLowerCase().includes(pe)))||((Mt=je.category)==null?void 0:Mt.toLowerCase().includes(pe))});te(ye);const tt=new Set(ye.map(je=>je.id));ne(Ya.filter(je=>tt.has(je.source)&&tt.has(je.target))),ge(void 0),O(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),ce("");const V=me.current,ie=V?Ms.filter(pe=>!pe.workspaceId||pe.workspaceId===V):Ms;te(ie);const de=new Set(ie.map(pe=>pe.id));ne(Ya.filter(pe=>de.has(pe.source)&&de.has(pe.target)))},selectNode:async V=>{console.log("[MockGrackle] knowledge.selectNode",V),ge(V);const ie=V in b_?b_[V]:void 0;if(ie)O(ie);else{const de=Ms.find(pe=>pe.id===V);if(de){const pe=Ya.filter(ye=>ye.source===V||ye.target===V).map(ye=>({fromId:ye.source,toId:ye.target,type:ye.type}));O({node:de,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ge(void 0),O(void 0)},expandNode:async V=>{console.log("[MockGrackle] knowledge.expandNode",V),te(ie=>{const de=new Set(ie.map(Be=>Be.id)),pe=Ya.filter(Be=>Be.source===V||Be.target===V),ye=new Set;for(const Be of pe)de.has(Be.source)||ye.add(Be.source),de.has(Be.target)||ye.add(Be.target);if(ye.size===0)return ie;const tt=Ms.filter(Be=>ye.has(Be.id)),je=new Set([...de,...ye]);return ne(Be=>{const Ue=new Set(Be.map(qe=>`${qe.source}|${qe.target}|${qe.type}`)),Mt=Ya.filter(qe=>je.has(qe.source)&&je.has(qe.target)&&!Ue.has(`${qe.source}|${qe.target}|${qe.type}`));return Mt.length>0?[...Be,...Mt]:Be}),[...ie,...tt]})},loadRecent:async V=>{if(console.log("[MockGrackle] knowledge.loadRecent",V),me.current=V,V){const ie=Ms.filter(pe=>!pe.workspaceId||pe.workspaceId===V);te(ie);const de=new Set(ie.map(pe=>pe.id));ne(Ya.filter(pe=>de.has(pe.source)&&de.has(pe.target)))}else te(Ms),ne(Ya);ce("")},handleEvent:()=>!1,domainHook:ss},githubAccounts:{githubAccounts:[],githubAccountsLoading:!1,loadGitHubAccounts:async()=>{console.log("[MockGrackle] loadGitHubAccounts")},addGitHubAccount:async(V,ie,de,pe)=>{console.log("[MockGrackle] addGitHubAccount",V)},updateGitHubAccount:async(V,ie)=>{console.log("[MockGrackle] updateGitHubAccount",V,ie)},removeGitHubAccount:async V=>{console.log("[MockGrackle] removeGitHubAccount",V)},importGitHubAccounts:async()=>(console.log("[MockGrackle] importGitHubAccounts"),{imported:0,usernames:[]})},plugins:{plugins:[{name:"core",description:"Core infrastructure",enabled:!0,required:!0,loaded:!0},{name:"orchestration",description:"Task orchestration",enabled:!0,required:!1,loaded:!0},{name:"scheduling",description:"Scheduled triggers",enabled:!0,required:!1,loaded:!0},{name:"knowledge",description:"Knowledge graph",enabled:!1,required:!1,loaded:!1}],pluginsLoading:!1,loadPlugins:async()=>{console.log("[MockGrackle] loadPlugins")},setPluginEnabled:async(V,ie)=>{console.log("[MockGrackle] setPluginEnabled",V,ie)}},appDefaultPersonaId:Y,setAppDefaultPersonaId:async V=>{console.log("[MockGrackle] setAppDefaultPersonaId",V),U(V)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costMillicents:112e3,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costMillicents:48e3,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costMillicents:63e3,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costMillicents:1e4,sessionCount:1}},loadUsage:async(V,ie)=>{console.log(`[MockGrackle] loadUsage(${V}, ${ie})`)},refresh:us}),[s,r,d,f,h,$,b,x,j,N,D,E,L,Y,X,G,H,q,se,et,Us,on,ks,Ps,ya,Bi,Xt,ai,ii,ba,Ss,_a,Ce,Ve,Qt,Ct,yn,en,zi,$i,Hi,us]);return a.jsx(jh.Provider,{value:xa,children:t})}const Rk=3e3,AH=Rk;function DH(t){const[s,o]=y.useState("connecting"),r=y.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=y.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=y.useRef(t.onStreamMessage);d.current=t.onStreamMessage;const u=y.useRef(t.onConnect);u.current=t.onConnect;const f=y.useRef(t.onDisconnect);return f.current=t.onDisconnect,y.useEffect(()=>{let m=!1,h,v;async function b(){var S,j,T;if(m)return;Promise.resolve((S=u.current)==null?void 0:S.call(u)).catch(()=>{});let _=!1;const x=()=>{!_&&!m&&(_=!0,o("connected"))};v=setTimeout(x,AH);try{const N=Le.streamEvents({});for await(const C of N){if(x(),m)break;const D=C.event;if(D.case==="sessionEvent"){const A=D.value;r.current({sessionId:A.sessionId,type:A.type,timestamp:A.timestamp,content:A.content,raw:A.raw,toolCallId:A.toolCallId,turnId:A.turnId,serverSeq:A.serverSeq,toolError:A.toolError})}else if(D.case==="domainEvent"){const A=D.value;c.current({id:A.id,type:A.type,timestamp:A.timestamp,payloadJson:A.payloadJson})}else if(D.case==="streamMessageEvent"){const A=D.value;(j=d.current)==null||j.call(d,{streamId:A.streamId,seq:A.seq,senderId:A.senderId,content:A.content,timestamp:A.timestamp})}}}catch(N){if(clearTimeout(v),N instanceof Bs&&N.code===jm.Unauthenticated){window.location.href=EC;return}}clearTimeout(v),m||(o("connecting"),(T=f.current)==null||T.call(f),h=setTimeout(()=>{b().catch(()=>{})},Rk))}return b().catch(()=>{}),()=>{m=!0,clearTimeout(h),clearTimeout(v)}},[]),{connectionStatus:s}}const Sm=["core","orchestration","scheduling"],Ik=y.createContext({pluginNames:[...Sm],sandboxPort:void 0,sandboxOrigin:void 0,loading:!1,error:void 0});function MH({children:t}){const[s,o]=y.useState([...Sm]),[r,c]=y.useState(void 0),[d,u]=y.useState(void 0),[f,m]=y.useState(!0),[h,v]=y.useState(void 0);return y.useEffect(()=>{let b=!1;return fetch("/api/manifest").then(async _=>{if(!_.ok)throw new Error(`Manifest fetch returned ${_.status}`);return _.json()}).then(_=>{b||(o(_.plugins.map(x=>x.name)),c(_.sandboxPort),u(_.sandboxOrigin),m(!1))}).catch(_=>{b||(o([...Sm]),v(_ instanceof Error?_:new Error(String(_))),m(!1))}),()=>{b=!0}},[]),a.jsx(Ik.Provider,{value:{pluginNames:s,sandboxPort:r,sandboxOrigin:d,loading:f,error:h},children:t})}function Hd(){return y.useContext(Ik)}function wh(){const{sandboxPort:t,sandboxOrigin:s}=Hd();if(typeof window>"u")return;if(s!==void 0&&s!=="")try{return new URL("/sandbox.html",s).toString()}catch{}if(t===void 0)return;const o=new URL(window.location.origin);return o.port=String(t),o.pathname="/sandbox.html",o.toString()}const RH=new Set(["dashboard","chat","environments","sessions","coordination","settings"]),IH=new Set(["tasks","personas"]),OH=new Set(["knowledge"]),Ok={core:{navItems:ld.filter(t=>RH.has(t.view)),domainHookKeys:["environments","sessions","workspaces","tokens","credentials","codespaces","dockerContainers","streams","plugins"]},orchestration:{navItems:ld.filter(t=>IH.has(t.view)),domainHookKeys:["tasks","personas","notifications"]},scheduling:{navItems:[],domainHookKeys:["schedules"]},knowledge:{navItems:ld.filter(t=>OH.has(t.view)),domainHookKeys:["knowledge"]}};function LH(t){return t.flatMap(s=>{var o;return((o=Ok[s])==null?void 0:o.navItems)??[]})}function BH(t){return new Set(t.flatMap(s=>{var o;return((o=Ok[s])==null?void 0:o.domainHookKeys)??[]}))}function zH(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped,githubAccountId:t.githubAccountId||""}}function j_(t){return{id:t.id,environmentId:t.environmentId,runtime:t.runtime,status:t.status,prompt:t.prompt,startedAt:t.startedAt,endedAt:t.endedAt||void 0,error:t.error||void 0,endReason:t.endReason||void 0,personaId:t.personaId||void 0,taskId:t.taskId||void 0,parentSessionId:t.parentSessionId||void 0,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents}}function $H(t){return{sessionId:t.sessionId,eventType:Y_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0,toolCallId:t.toolCallId||void 0,turnId:t.turnId||void 0,serverSeq:t.serverSeq||void 0,toolError:t.toolError||void 0}}function T_(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,linkedEnvironmentIds:[...t.linkedEnvironmentIds],status:pj(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents,createdAt:t.createdAt,updatedAt:t.updatedAt}}function N_(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:mj(t.status),branch:t.branch,latestSessionId:t.latestSessionId,dependsOn:[...t.dependsOn],sortOrder:t.sortOrder,createdAt:t.createdAt,startedAt:t.startedAt||void 0,completedAt:t.completedAt||void 0,parentTaskId:t.parentTaskId,depth:t.depth,childTaskIds:[...t.childTaskIds],canDecompose:t.canDecompose,injectKnowledge:t.injectKnowledge,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad,tokenBudget:t.tokenBudget,costBudgetMillicents:t.costBudgetMillicents}}function HH(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function PH(t){return{claude:hj(t.claude),github:Bc(t.github),copilot:Bc(t.copilot),codex:Bc(t.codex),goose:Bc(t.goose)}}function UH(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function VH(t){return{id:t.id,name:t.name,image:t.image,state:t.state,status:t.status}}function $p(t){return{id:t.id,name:t.name,description:t.description,systemPrompt:t.systemPrompt,toolConfig:t.toolConfig?JSON.stringify({allowedTools:[...t.toolConfig.allowedTools],disallowedTools:[...t.toolConfig.disallowedTools]}):"{}",runtime:t.runtime,model:t.model,maxTurns:t.maxTurns,mcpServers:JSON.stringify(t.mcpServers.map(s=>({name:s.name,command:s.command,args:[...s.args],tools:[...s.tools]}))),createdAt:t.createdAt,updatedAt:t.updatedAt,type:t.type||"agent",script:t.script,allowedMcpTools:[...t.allowedMcpTools]}}function qH(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costMillicents:t.costMillicents,sessionCount:t.sessionCount}}function Hp(t){return{id:t.id,title:t.title,description:t.description,scheduleExpression:t.scheduleExpression,personaId:t.personaId,workspaceId:t.workspaceId,parentTaskId:t.parentTaskId,enabled:t.enabled,lastRunAt:t.lastRunAt,nextRunAt:t.nextRunAt,runCount:t.runCount,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Qc(t,s=0){return{id:t.id,label:t.title||t.label||t.id,kind:t.kind,category:t.category||void 0,sourceType:t.sourceType||void 0,sourceId:t.sourceId||void 0,content:t.content||void 0,tags:t.tags.length>0?[...t.tags]:void 0,workspaceId:t.workspaceId||void 0,createdAt:t.createdAt||void 0,updatedAt:t.updatedAt||void 0,val:s}}function Pp(t){return{source:t.fromId,target:t.toId,type:t.type}}function GH(t){return{subscriptionId:t.subscriptionId,sessionId:t.sessionId,fd:t.fd,permission:t.permission,deliveryMode:t.deliveryMode,createdBySpawn:t.createdBySpawn}}function FH(t){return{id:t.id,name:t.name,subscriberCount:t.subscriberCount,messageBufferDepth:t.messageBufferDepth,subscribers:t.subscribers.map(GH),selfEcho:t.selfEcho}}function xs(){const[t,s]=y.useState(!1),o=y.useRef(0),r=y.useCallback(c=>(o.current++,o.current===1&&s(!0),c.finally(()=>{o.current--,o.current===0&&s(!1)})),[]);return{loading:t,track:r}}const w_=5e3;function Zr(t){return t instanceof Bs?t.message:"Operation failed"}function KH(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState({}),[u,f]=y.useState(""),m=y.useCallback(()=>{f("")},[]),h=y.useCallback(async()=>{try{const C=await r(Le.listEnvironments({}));s(C.environments.map(zH))}catch{}},[r]),v=y.useCallback(C=>{switch(C.type){case"environment.added":return!0;case"environment.removed":{const D=C.payload.environmentId;return D&&(s(A=>A.filter(E=>E.id!==D)),d(A=>{const E={...A};return delete E[D],E})),!0}case"environment.changed":return h().catch(()=>{}),!0;case"environment.provision_progress":{const D=C.payload;if(typeof D.environmentId!="string"||typeof D.stage!="string"||typeof D.message!="string"||typeof D.progress!="number")return Ck("environment.provision_progress","invalid payload"),!0;if(d(A=>({...A,[D.environmentId]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"){const A=D.environmentId;setTimeout(()=>{d(E=>{const R={...E};return delete R[A],R})},w_)}return!0}default:return!1}},[h]),b=y.useCallback(C=>{var D;if(C.type==="environments"){const A=Array.isArray((D=C.payload)==null?void 0:D.environments)?C.payload.environments:[];return s(A),!0}return!1},[]),_=y.useCallback(async(C,D,A,E)=>{f("");try{await Le.addEnvironment({displayName:C,adapterType:D,adapterConfig:JSON.stringify(A??{}),githubAccountId:E??""})}catch(R){f(Zr(R))}},[]),x=y.useCallback(async(C,D)=>{f("");try{await Le.updateEnvironment({id:C,displayName:D.displayName,adapterConfig:D.adapterConfig?JSON.stringify(D.adapterConfig):void 0,githubAccountId:D.githubAccountId})}catch(A){f(Zr(A))}},[]),S=y.useCallback(async(C,D)=>{f("");try{const A=Le.provisionEnvironment({id:C,force:D??!1});for await(const E of A)d(R=>({...R,[C]:{stage:E.stage,message:E.message,progress:E.progress}})),E.stage==="ready"&&setTimeout(()=>{d(R=>{const L={...R};return delete L[C],L})},w_)}catch(A){d(E=>{const R={...E};return delete R[C],R}),f(Zr(A))}},[]),j=y.useCallback(async C=>{f("");try{await Le.stopEnvironment({id:C})}catch(D){f(Zr(D))}},[]),T=y.useCallback(async C=>{f("");try{await Le.removeEnvironment({id:C})}catch(D){f(Zr(D))}},[]);return{environments:t,environmentsLoading:o,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:h,addEnvironment:_,updateEnvironment:x,provisionEnvironment:S,stopEnvironment:j,removeEnvironment:T,handleEvent:v,handleLegacyMessage:b,domainHook:{onConnect:()=>h(),onDisconnect:()=>{},handleEvent:v}}}const Up=new Set(["pending","running","idle"]),ZH=new Set(["completed","failed","interrupted","hibernating","suspended"]),C_=["pending","running","idle"];function YH(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState([]),[u,f]=y.useState(0),[m,h]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const $=(await r(Le.listSessions({}))).sessions.map(j_);s(Y=>{const U=new Map(Y.map(X=>[X.id,X]));return $.map(X=>{const te=U.get(X.id),G=te==null?void 0:te.status;return!G||G===X.status?X:ZH.has(G)&&Up.has(X.status)?{...X,status:G,...te.endReason!==void 0?{endReason:te.endReason}:{}}:Up.has(G)&&Up.has(X.status)&&C_.indexOf(G)>C_.indexOf(X.status)?{...X,status:G}:X})})}catch{}},[r]),x=y.useCallback(M=>{if(M.type!=="session_event")return!1;if(!tH(M.payload))return Ck("session_event","payload is not a valid SessionEvent"),!0;const $=M.payload;let Y=0;if(d(U=>{const X=[...U,$];return X.length>Eo?(Y=X.length-Eo,X.slice(-Eo)):X}),Y>0&&f(U=>U+Y),$.eventType==="usage")try{const U=JSON.parse($.content),X=Number(U.input_tokens)||0,te=Number(U.output_tokens)||0,G=Number(U.cost_millicents)||0;(X>0||te>0||G>0)&&s(ne=>ne.map(H=>H.id===$.sessionId?{...H,inputTokens:(H.inputTokens??0)+X,outputTokens:(H.outputTokens??0)+te,costMillicents:(H.costMillicents??0)+G}:H))}catch{}if($.eventType==="status"){const U=Ek($.content),X=Ak($.content);s(te=>te.some(ne=>ne.id===$.sessionId)?te.map(ne=>ne.id===$.sessionId?{...ne,status:U,...X!==void 0?{endReason:X}:{}}:ne):[...te,{id:$.sessionId,environmentId:"",runtime:"",status:U,prompt:"",startedAt:$.timestamp,...X!==void 0?{endReason:X}:{}}])}return!0},[]),S=y.useCallback(M=>{x({type:"session_event",payload:M})},[x]),j=y.useCallback(M=>{var $,Y,U,X,te;switch(M.type){case"sessions":{const G=Array.isArray(($=M.payload)==null?void 0:$.sessions)?M.payload.sessions:[];return s(G),!0}case"spawned":{const G=(Y=M.payload)==null?void 0:Y.sessionId;return typeof G=="string"&&G&&h(G),_().catch(()=>{}),!0}case"session_events":{const G=Array.isArray((U=M.payload)==null?void 0:U.events)?M.payload.events:[];return G.length>0&&d(G),!0}case"task_sessions":{const G=(X=M.payload)==null?void 0:X.taskId;if(typeof G=="string"&&G){const ne=Array.isArray((te=M.payload)==null?void 0:te.sessions)?M.payload.sessions:[];b(H=>({...H,[G]:ne}))}return!0}default:return!1}},[_]),T=y.useCallback(async(M,$,Y,U,X)=>{try{const te=await Le.spawnAgent({environmentId:M,prompt:$,config:{personaId:Y||"",workingDirectory:U||"",workspaceId:X||""}});h(te.id),await _()}catch{}},[_]),N=y.useCallback(async(M,$)=>{await Le.sendInput({sessionId:M,text:$})},[]),C=y.useCallback(async M=>{try{await Le.killAgent({id:M,graceful:!1})}catch{}},[]),D=y.useCallback(async M=>{try{await Le.killAgent({id:M,graceful:!0})}catch{}},[]),A=y.useCallback(async M=>{try{const Y=(await Le.getSessionEvents({id:M})).events.map($H);if(Y.length>0){let U=0;d(X=>{const te=O=>O.serverSeq?`seq:${O.serverSeq}`:`t:${O.timestamp}|${O.eventType}`,G=new Set;for(const O of X)O.sessionId===M&&G.add(te(O));const ne=Y.filter(O=>!G.has(te(O))),H=[...X,...ne].sort((O,q)=>O.sessionId!==q.sessionId?0:O.serverSeq&&q.serverSeq?O.serverSeq.localeCompare(q.serverSeq):O.timestamp.localeCompare(q.timestamp));return H.length>Eo?(U=H.length-Eo,H.slice(-Eo)):H}),U>0&&f(X=>X+U)}}catch{}},[]),E=y.useCallback(()=>{d([]),f(0)},[]),R=y.useCallback(async M=>{try{const Y=(await Le.getTaskSessions({id:M})).sessions.map(j_);b(U=>({...U,[M]:Y}))}catch{}},[]);return{sessions:t,sessionsLoading:o,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:T,sendInput:N,kill:C,stopGraceful:D,loadSessionEvents:A,clearEvents:E,loadTaskSessions:R,handleMessage:x,handleSessionEvent:S,handleLegacyMessage:j,domainHook:{onConnect:()=>_(),onDisconnect:()=>{E()},handleEvent:()=>!1}}}function E_(t){return t instanceof Bs?t.message:"Operation failed"}function JH(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState(!1),[u,f]=y.useState(""),m=y.useCallback(async()=>{try{const C=await r(Le.listWorkspaces({}));s(C.workspaces.map(T_))}catch{}},[r]),h=y.useCallback(C=>{switch(C.type){case"workspace.created":return d(!1),m().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return m().catch(()=>{}),!0;default:return!1}},[m]),v=y.useCallback(()=>{d(!1)},[]),b=y.useCallback(async(C,D,A,E,R,L,M,$,Y)=>{d(!0);try{const U=await Le.createWorkspace({name:C,description:D||"",repoUrl:A||"",environmentId:E||"",defaultPersonaId:R||void 0,useWorktrees:L??!0,workingDirectory:M||void 0}),X=T_(U);s(te=>te.some(G=>G.id===X.id)?te:[...te,X]),d(!1),$==null||$(X)}catch(U){d(!1);const X=U instanceof Bs?U.message:"Failed to create workspace";Y==null||Y(X)}},[]),_=y.useCallback(async C=>{try{await Le.archiveWorkspace({id:C})}catch{}},[]),x=y.useCallback(async(C,D)=>{try{await Le.updateWorkspace({id:C,...D})}catch{}},[]),S=y.useCallback(()=>{f("")},[]),j=y.useCallback(async(C,D)=>{try{f(""),await Le.linkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){f(E_(A))}},[m]),T=y.useCallback(async(C,D)=>{try{f(""),await Le.unlinkEnvironment({workspaceId:C,environmentId:D}),await m().catch(()=>{})}catch(A){f(E_(A))}},[m]);return{workspaces:t,workspacesLoading:o,workspaceCreating:c,loadWorkspaces:m,createWorkspace:b,archiveWorkspace:_,updateWorkspace:x,linkEnvironment:j,unlinkEnvironment:T,linkOperationError:u,clearLinkOperationError:S,handleEvent:h,onDisconnect:v,domainHook:{onConnect:()=>m(),onDisconnect:v,handleEvent:h}}}function WH(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),[c,d]=y.useState(void 0),u=y.useRef({}),f=y.useCallback(async E=>{try{const L=(await zn.listTasks({workspaceId:E})).tasks.map(N_);s(M=>[...M.filter($=>$.workspaceId!==E),...L])}catch{}},[]),m=y.useCallback(async()=>{try{const R=(await r(zn.listTasks({}))).tasks.map(N_);s(L=>{const M=new Set(R.map($=>$.id));return[...L.filter($=>!M.has($.id)),...R]})}catch{}},[r]),h=y.useCallback((E,R)=>{const L=M=>{clearTimeout(u.current[M]),u.current[M]=setTimeout(()=>{delete u.current[M],f(M).catch(()=>{})},200)};E?L(E):R&&s(M=>{const $=M.find(Y=>Y.id===R);return $!=null&&$.workspaceId?L($.workspaceId):m().catch(()=>{}),M})},[f,m]),v=y.useCallback(E=>{const R=E.payload;switch(E.type){case"task.created":{const L=typeof R.workspaceId=="string"?R.workspaceId:"";return L&&f(L).catch(()=>{}),!0}case"task.started":{const L=typeof R.taskId=="string"?R.taskId:"",M=typeof R.sessionId=="string"?R.sessionId:"",$=typeof R.workspaceId=="string"?R.workspaceId:"";return d(Y=>L&&Y===L?void 0:Y),M&&L&&s(Y=>Y.map(U=>U.id===L?{...U,latestSessionId:M}:U)),h($,L),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const L=typeof R.workspaceId=="string"?R.workspaceId:"",M=typeof R.taskId=="string"?R.taskId:"";return d($=>M&&$===M?void 0:$),h(L,M),!0}default:return!1}},[f,h]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(E=>{var R,L;if(E.type==="tasks"){const M=Array.isArray((R=E.payload)==null?void 0:R.tasks)?E.payload.tasks:[],$=typeof((L=E.payload)==null?void 0:L.workspaceId)=="string"&&E.payload.workspaceId?E.payload.workspaceId:"";return s($?Y=>[...Y.filter(U=>U.workspaceId!==$),...M]:Y=>{const U=new Set(M.map(X=>X.id));return[...Y.filter(X=>!U.has(X.id)),...M]}),!0}return!1},[]),x=y.useCallback(async(E,R,L,M,$,Y,U,X,te,G)=>{try{await zn.createTask({workspaceId:E,title:R,description:L||"",dependsOn:M||[],parentTaskId:$||"",defaultPersonaId:Y||void 0,canDecompose:U??void 0,injectKnowledge:X??void 0}),te==null||te()}catch(ne){const H=ne instanceof Bs?ne.message:"Failed to create task";G==null||G(H)}},[]),S=y.useCallback(async(E,R,L,M)=>{d(E);try{await zn.startTask({taskId:E,personaId:R||"",environmentId:L||"",notes:M||""})}catch($){if($ instanceof Bs&&$.code===jm.ResourceExhausted)return;throw d(void 0),$}},[]),j=y.useCallback(async E=>{try{await zn.stopTask({id:E})}catch{}},[]),T=y.useCallback(async E=>{try{await zn.completeTask({id:E})}catch{}},[]),N=y.useCallback(async E=>{try{await zn.resumeTask({id:E})}catch{}},[]),C=y.useCallback(async(E,R,L,M,$)=>{try{await zn.updateTask({id:E,title:R,description:L,dependsOn:M,...$!==void 0?{defaultPersonaId:$}:{}})}catch{}},[]),D=y.useCallback(async E=>{try{await zn.deleteTask({id:E})}catch{}},[]);return{tasks:t,tasksLoading:o,taskStartingId:c,loadTasks:f,loadAllTasks:m,createTask:x,startTask:S,stopTask:j,completeTask:T,resumeTask:N,updateTask:C,deleteTask:D,handleEvent:v,onDisconnect:b,handleLegacyMessage:_,domainHook:{onConnect:()=>m(),onDisconnect:b,handleEvent:v}}}function XH(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const h=await r(Le.listTokens({}));s(h.tokens.map(HH))}catch{}},[r]),d=y.useCallback(h=>h.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(h,v,b,_,x)=>{try{await Le.setToken({name:h,value:v,type:b,envVar:_,filePath:x})}catch{}},[]),f=y.useCallback(async h=>{try{await Le.deleteToken({name:h})}catch{}},[]);return{tokens:t,tokensLoading:o,loadTokens:c,setToken:u,deleteToken:f,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function QH(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const m=await r(Le.getCredentialProviders({}));s(PH(m))}catch{}},[r]),d=y.useCallback(m=>m.type==="credential.providers_changed"?(sH(m.payload)&&s(m.payload),!0):!1,[]),u=y.useCallback(async m=>{const h=[{provider:"claude",value:m.claude},{provider:"github",value:m.github},{provider:"copilot",value:m.copilot},{provider:"codex",value:m.codex},{provider:"goose",value:m.goose}];await Promise.allSettled(h.map(({provider:v,value:b})=>Le.setCredentialProvider({provider:v,value:b})))},[]);return{credentialProviders:t,credentialsLoading:o,loadCredentials:c,updateCredentialProviders:u,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function eP(){const[t,s]=y.useState([]),[o,r]=y.useState(""),[c,d]=y.useState(""),[u,f]=y.useState(!1),m=y.useCallback(async b=>{try{const _=await Le.listCodespaces({githubAccountId:b??""});s(_.codespaces.map(UH)),d(_.error)}catch{}},[]),h=y.useCallback(async(b,_)=>{f(!0),r("");try{await Le.createCodespace({repo:b,machine:_??""}),f(!1),await m()}catch(x){f(!1);const S=x instanceof Bs?x.message:"Failed to create codespace";r(S)}},[m]);return{codespaces:t,codespaceError:o,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:h,domainHook:{onConnect:()=>m(),onDisconnect:()=>{},handleEvent:()=>!1}}}function tP(){const[t,s]=y.useState([]),[o,r]=y.useState(""),c=y.useCallback(async()=>{try{const u=await Le.listDockerContainers({});s(u.containers.map(VH)),r(u.error)}catch(u){s([]),r(u instanceof Error?u.message:"Failed to list Docker containers")}},[]);return{dockerContainers:t,dockerContainersError:o,listDockerContainers:c,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:()=>!1}}}function nP(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const v=await r(zn.listPersonas({}));s(v.personas.map($p))}catch{}},[r]),d=y.useCallback(v=>{switch(v.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(v,b,_,x,S,j,T,N,C)=>{const D=await zn.createPersona({name:v,description:b,systemPrompt:_,runtime:x||"",model:S||"",maxTurns:j||0,type:T||"agent",script:N||"",allowedMcpTools:C||[]}),A=$p(D);return s(E=>[...E.filter(R=>R.id!==A.id),A]),A},[]),f=y.useCallback(async(v,b,_,x,S,j,T,N,C,D)=>{const A={id:v};b!==void 0&&(A.name=b),_!==void 0&&(A.description=_),x!==void 0&&(A.systemPrompt=x),S!==void 0&&(A.runtime=S),j!==void 0&&(A.model=j),T!==void 0&&(A.maxTurns=T),N!==void 0&&(A.type=N),C!==void 0&&(A.script=C),D!==void 0&&(A.allowedMcpTools={tools:D});const E=await zn.updatePersona(A),R=$p(E);return s(L=>L.map(M=>M.id===R.id?R:M)),R},[]),m=y.useCallback(async v=>{await zn.deletePersona({id:v}),s(b=>b.filter(_=>_.id!==v))},[]);return{personas:t,personasLoading:o,loadPersonas:c,createPersona:u,updatePersona:f,deletePersona:m,handleEvent:d,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function sP(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useRef(void 0),d=y.useCallback(async()=>{try{const b=await r(Hc.listSchedules({}));s(b.schedules.map(Hp))}catch{}},[r]),u=y.useCallback(b=>{switch(b.type){case"schedule.created":case"schedule.updated":case"schedule.deleted":return d().catch(()=>{}),!0;case"schedule.fired":return clearTimeout(c.current),c.current=setTimeout(()=>{d().catch(()=>{})},500),!0;default:return!1}},[d]),f=y.useCallback(async(b,_,x,S,j,T)=>{const N=await Hc.createSchedule({title:b,description:_,scheduleExpression:x,personaId:S,workspaceId:j||"",parentTaskId:T||""}),C=Hp(N);return s(D=>[...D.filter(A=>A.id!==C.id),C]),C},[]),m=y.useCallback(async(b,_)=>{const x={id:b};_.title!==void 0&&(x.title=_.title),_.description!==void 0&&(x.description=_.description),_.scheduleExpression!==void 0&&(x.scheduleExpression=_.scheduleExpression),_.personaId!==void 0&&(x.personaId=_.personaId),_.enabled!==void 0&&(x.enabled=_.enabled);const S=await Hc.updateSchedule(x),j=Hp(S);return s(T=>T.map(N=>N.id===j.id?j:N)),j},[]),h=y.useCallback(async b=>{await Hc.deleteSchedule({id:b}),s(_=>_.filter(x=>x.id!==b))},[]);return{schedules:t,schedulesLoading:o,loadSchedules:d,createSchedule:f,updateSchedule:m,deleteSchedule:h,handleEvent:u,domainHook:{onConnect:()=>d(),onDisconnect:()=>{clearTimeout(c.current)},handleEvent:u}}}function aP(t){if(t)try{return JSON.parse(t)}catch{return}}function A_(t){return Bs.from(t).code===jm.Unavailable?"unavailable":"error"}function iP(){const[t,s]=y.useState(new Map),[o,r]=y.useState([]),[c,d]=y.useState(void 0),[u,f]=y.useState(void 0),[m,h]=y.useState(!1),[v,b]=y.useState(void 0),[_,x]=y.useState(""),S=y.useRef(""),j=y.useCallback(async M=>{const $=M??"";S.current=$,x(""),b(void 0),h(!0);try{const Y=await Pc.listRecentKnowledgeNodes({limit:30,workspaceId:$}),U=new Map,X=[];for(const te of Y.nodes)U.set(te.id,Qc(te));for(const te of Y.edges)X.push(Pp(te));for(const te of X){const G=U.get(te.source);G&&(G.val+=1);const ne=U.get(te.target);ne&&(ne.val+=1)}s(U),r(X)}catch(Y){b(A_(Y))}finally{h(!1)}},[]),T=y.useCallback(async M=>{if(M.trim()){x(M),f(void 0),d(void 0),b(void 0),h(!0);try{const $=await Pc.searchKnowledge({query:M,limit:20,workspaceId:S.current}),Y=new Map,U=[];for(const X of $.results){X.node&&Y.set(X.node.id,Qc(X.node,X.edges.length));for(const te of X.edges)U.push(Pp(te))}s(Y),r(U)}catch($){b(A_($))}finally{h(!1)}}},[]),N=y.useCallback(()=>{j(S.current).catch(()=>{})},[j]),C=y.useCallback(async M=>{f(M);try{const $=await Pc.getKnowledgeNode({id:M});if(!$.node){d(void 0);return}d({node:Qc($.node,$.edges.length),edges:$.edges.map(Y=>({fromId:Y.fromId,toId:Y.toId,type:Y.type,metadata:aP(Y.metadataJson)}))})}catch{d(void 0)}},[]),D=y.useCallback(()=>{f(void 0),d(void 0)},[]),A=y.useCallback(async M=>{try{const $=await Pc.expandKnowledgeNode({id:M,depth:1});s(Y=>{const U=new Map(Y);for(const X of $.nodes)U.has(X.id)||U.set(X.id,Qc(X));return U}),r(Y=>{const U=new Set(Y.map(te=>`${te.source}:${te.target}:${te.type}`)),X=[];for(const te of $.edges){const G=Pp(te),ne=`${G.source}:${G.target}:${G.type}`;U.has(ne)||X.push(G)}return[...Y,...X]})}catch{}},[]),E=y.useCallback(M=>!1,[]),R=y.useMemo(()=>({onConnect:async()=>{},onDisconnect:()=>{},handleEvent:E}),[E]),L=y.useMemo(()=>({nodes:[...t.values()],links:o}),[t,o]);return y.useMemo(()=>({graphData:L,selectedNode:c,selectedId:u,loading:m,loadError:v,searchQuery:_,search:T,clearSearch:N,selectNode:C,clearSelection:D,expandNode:A,loadRecent:j,handleEvent:E,domainHook:R}),[L,c,u,m,v,_,T,N,C,D,A,j,E,R])}function oP(){const t=y.useRef("default");y.useEffect(()=>{typeof Notification>"u"||(t.current=Notification.permission)},[]);function s(r){if(r.type!=="notification.escalated")return!1;if(typeof Notification>"u")return!0;if(t.current==="default")return Notification.requestPermission().then(u=>{t.current=u}).catch(()=>{}),!0;if(t.current!=="granted")return!0;const c=r.payload,d=new Notification(c.title||"Agent needs input",{body:c.message||"An agent is waiting for your input.",tag:c.escalationId,icon:zd("icon-192x192.png")});return d.onclick=()=>{window.focus(),c.taskUrl&&(window.location.href=c.taskUrl),d.close()},!0}return{handleEvent:s,domainHook:{onConnect:async()=>{},onDisconnect:()=>{},handleEvent:s}}}const ed=500;function rP(){const[t,s]=y.useState([]),[o,r]=y.useState({}),[c,d]=y.useState(!1),[u,f]=y.useState(!1),{loading:m,track:h}=xs(),v=y.useRef(0),b=y.useCallback(async(T=!1)=>{const N=v.current;try{const C=await h(Le.listStreams({includeInternal:T}));v.current===N&&(s(C.streams.map(FH)),f(!1))}catch{v.current===N&&f(!0)}finally{v.current===N&&d(!0)}},[h]),_=y.useCallback(async(T,N)=>{let C;try{C=(await Le.getStreamTranscript({streamId:T,beforeSeq:N??"",limit:0})).messages.map(A=>({streamId:A.streamId,seq:A.seq,senderId:A.senderId,content:A.content,timestamp:A.timestamp}))}catch{return}r(D=>{const A=new Map;for(const L of D[T]??[])A.set(L.seq,L);for(const L of C)A.set(L.seq,L);const E=Array.from(A.values()).sort((L,M)=>L.seq.localeCompare(M.seq)),R=E.length>ed?E.slice(E.length-ed):E;return{...D,[T]:R}})},[]),x=y.useCallback(T=>{r(N=>{const C=N[T.streamId]??[];if(C.some(E=>E.seq===T.seq))return N;const D=[...C,T],A=D.length>ed?D.slice(D.length-ed):D;return{...N,[T.streamId]:A}})},[]),S=y.useCallback(T=>!1,[]);return{streams:t,streamsLoading:m,streamsLoadedOnce:c,streamsLoadError:u,loadStreams:b,liveMessages:o,loadTranscript:_,handleStreamMessage:x,handleEvent:S,domainHook:{onConnect:b,onDisconnect:()=>{v.current+=1,s([]),r({}),d(!1),f(!1)},handleEvent:S}}}function lP(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const m=await r(Le.listPlugins({}));s(m.plugins.map(h=>({name:h.name,description:h.description,enabled:h.enabled,required:h.required,loaded:h.loaded})))}catch{}},[r]),d=y.useCallback(m=>m.type==="plugin.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(m,h)=>{try{const v=await Le.setPluginEnabled({name:m,enabled:h});s(b=>b.map(_=>_.name===v.name?{..._,enabled:v.enabled}:_))}catch{}},[]);return{plugins:t,pluginsLoading:o,loadPlugins:c,setPluginEnabled:u,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function cP(){const[t,s]=y.useState([]),{loading:o,track:r}=xs(),c=y.useCallback(async()=>{try{const b=await r(Le.listGitHubAccounts({}));s(b.accounts.map(_=>({id:_.id,label:_.label,username:_.username,isDefault:_.isDefault,createdAt:_.createdAt})))}catch{}},[r]),d=y.useCallback(b=>b.type==="github_account.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(b,_,x,S)=>{const j=await Le.addGitHubAccount({label:b,token:_,username:x,isDefault:S});s(T=>[...j.isDefault?T.map(C=>({...C,isDefault:!1})):T,{id:j.id,label:j.label,username:j.username,isDefault:j.isDefault,createdAt:j.createdAt}])},[]),f=y.useCallback(async(b,_)=>{const x=await Le.updateGitHubAccount({id:b,..._});s(S=>S.map(j=>j.id===x.id?{...j,label:x.label,username:x.username,isDefault:x.isDefault}:_.isDefault?{...j,isDefault:!1}:j))},[]),m=y.useCallback(async b=>{await Le.removeGitHubAccount({id:b}),s(_=>_.filter(x=>x.id!==b))},[]),h=y.useCallback(async()=>{const b=await Le.importGitHubAccounts({});return b.imported>0&&await c(),{imported:b.imported,usernames:b.usernames}},[c]);return{githubAccounts:t,githubAccountsLoading:o,loadGitHubAccounts:c,addGitHubAccount:u,updateGitHubAccount:f,removeGitHubAccount:m,importGitHubAccounts:h,domainHook:{onConnect:()=>c(),onDisconnect:()=>{},handleEvent:d}}}function dP(){const[t,s]=y.useState(""),[o,r]=y.useState(void 0),[c,d]=y.useState({}),{pluginNames:u}=Hd(),f=BH(u),m=KH(),h=YH(),v=JH(),b=WH(),_=XH(),x=QH(),S=eP(),j=tP(),T=nP(),N=sP(),C=iP(),D=oP(),A=rP(),E=lP(),R=cP(),L=[...f.has("environments")?[m.domainHook]:[],...f.has("sessions")?[h.domainHook]:[],...f.has("workspaces")?[v.domainHook]:[],...f.has("tasks")?[b.domainHook]:[],...f.has("tokens")?[_.domainHook]:[],...f.has("credentials")?[x.domainHook]:[],...f.has("codespaces")?[S.domainHook]:[],...f.has("dockerContainers")?[j.domainHook]:[],...f.has("personas")?[T.domainHook]:[],...f.has("schedules")?[N.domainHook]:[],...f.has("knowledge")?[C.domainHook]:[],...f.has("notifications")?[D.domainHook]:[],...f.has("streams")?[A.domainHook]:[],...f.has("plugins")?[E.domainHook]:[],R.domainHook],{connectionStatus:M}=DH({onSessionEvent:q=>{h.handleSessionEvent({sessionId:q.sessionId,eventType:Y_(q.type),timestamp:q.timestamp,content:q.content,raw:q.raw||void 0,toolCallId:q.toolCallId||void 0,turnId:q.turnId||void 0,serverSeq:q.serverSeq||void 0,toolError:q.toolError||void 0})},onDomainEvent:q=>{try{const ge=JSON.parse(q.payloadJson);G({id:q.id,type:q.type,timestamp:q.timestamp,payload:ge})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",q.payloadJson)}},onStreamMessage:q=>{A.handleStreamMessage(q)},onConnect:ne,onDisconnect:H}),$="default_persona_id",Y="onboarding_completed",U=y.useCallback(async q=>{const ge=await Le.setSetting({key:$,value:q});s(ge.value)},[]),X=y.useCallback(async()=>{r(!0);try{await Le.setSetting({key:Y,value:"true"})}catch{}},[]),te=y.useCallback(async(q,ge)=>{try{const se=await Le.getUsage({scope:q,id:ge}),ce=`${q}:${ge}`;d(me=>({...me,[ce]:qH(se)}))}catch{}},[]);function G(q){const ge=q.payload.key,se=q.payload.value;if(q.type==="setting.changed"){ge===$&&s(se??""),ge===Y&&r(se==="true");return}for(const ce of L)if(ce.handleEvent(q))break;(q.type==="environment.removed"||q.type==="task.started")&&h.loadSessions().catch(()=>{}),(q.type==="session.started"||q.type==="session.stopped")&&A.loadStreams().catch(()=>{})}async function ne(){for(const q of L)q.onConnect().catch(()=>{});try{const q=await Le.getSetting({key:$});s(q.value)}catch{}try{const q=await Le.getSetting({key:Y});r(q.value==="true")}catch{}}function H(){L.forEach(q=>q.onDisconnect())}const O=y.useCallback(()=>{m.loadEnvironments().catch(()=>{}),h.loadSessions().catch(()=>{}),v.loadWorkspaces().catch(()=>{}),_.loadTokens().catch(()=>{})},[m.loadEnvironments,h.loadSessions,v.loadWorkspaces,_.loadTokens]);return{connectionStatus:M,environments:{environments:m.environments,environmentsLoading:m.environmentsLoading,provisionStatus:m.provisionStatus,operationError:m.operationError,clearOperationError:m.clearOperationError,loadEnvironments:m.loadEnvironments,addEnvironment:m.addEnvironment,updateEnvironment:m.updateEnvironment,provisionEnvironment:m.provisionEnvironment,stopEnvironment:m.stopEnvironment,removeEnvironment:m.removeEnvironment,domainHook:m.domainHook},sessions:{sessions:h.sessions,sessionsLoading:h.sessionsLoading,events:h.events,eventsDropped:h.eventsDropped,lastSpawnedId:h.lastSpawnedId,taskSessions:h.taskSessions,spawn:h.spawn,sendInput:h.sendInput,kill:h.kill,stopGraceful:h.stopGraceful,loadSessionEvents:h.loadSessionEvents,clearEvents:h.clearEvents,loadTaskSessions:h.loadTaskSessions,domainHook:h.domainHook},workspaces:{workspaces:v.workspaces,workspacesLoading:v.workspacesLoading,workspaceCreating:v.workspaceCreating,loadWorkspaces:v.loadWorkspaces,createWorkspace:v.createWorkspace,archiveWorkspace:v.archiveWorkspace,updateWorkspace:v.updateWorkspace,linkEnvironment:v.linkEnvironment,unlinkEnvironment:v.unlinkEnvironment,linkOperationError:v.linkOperationError,clearLinkOperationError:v.clearLinkOperationError,domainHook:v.domainHook},tasks:{tasks:b.tasks,tasksLoading:b.tasksLoading,taskStartingId:b.taskStartingId,loadTasks:b.loadTasks,loadAllTasks:b.loadAllTasks,createTask:b.createTask,startTask:b.startTask,stopTask:b.stopTask,completeTask:b.completeTask,resumeTask:b.resumeTask,updateTask:b.updateTask,deleteTask:b.deleteTask,domainHook:b.domainHook},tokens:{tokens:_.tokens,tokensLoading:_.tokensLoading,loadTokens:_.loadTokens,setToken:_.setToken,deleteToken:_.deleteToken,domainHook:_.domainHook},credentials:{credentialProviders:x.credentialProviders,credentialsLoading:x.credentialsLoading,updateCredentialProviders:x.updateCredentialProviders,domainHook:x.domainHook},codespaces:{codespaces:S.codespaces,codespaceError:S.codespaceError,codespaceListError:S.codespaceListError,codespaceCreating:S.codespaceCreating,listCodespaces:S.listCodespaces,createCodespace:S.createCodespace,domainHook:S.domainHook},dockerContainers:{dockerContainers:j.dockerContainers,dockerContainersError:j.dockerContainersError,listDockerContainers:j.listDockerContainers,domainHook:j.domainHook},personas:{personas:T.personas,personasLoading:T.personasLoading,createPersona:T.createPersona,updatePersona:T.updatePersona,deletePersona:T.deletePersona,domainHook:T.domainHook},schedules:{schedules:N.schedules,schedulesLoading:N.schedulesLoading,createSchedule:N.createSchedule,updateSchedule:N.updateSchedule,deleteSchedule:N.deleteSchedule,domainHook:N.domainHook},streams:{streams:A.streams,streamsLoading:A.streamsLoading,streamsLoadedOnce:A.streamsLoadedOnce,streamsLoadError:A.streamsLoadError,loadStreams:A.loadStreams,liveMessages:A.liveMessages,loadTranscript:A.loadTranscript,handleStreamMessage:A.handleStreamMessage,domainHook:A.domainHook},knowledge:C,plugins:{plugins:E.plugins,pluginsLoading:E.pluginsLoading,loadPlugins:E.loadPlugins,setPluginEnabled:E.setPluginEnabled},githubAccounts:{githubAccounts:R.githubAccounts,githubAccountsLoading:R.githubAccountsLoading,loadGitHubAccounts:R.loadGitHubAccounts,addGitHubAccount:R.addGitHubAccount,updateGitHubAccount:R.updateGitHubAccount,removeGitHubAccount:R.removeGitHubAccount,importGitHubAccounts:R.importGitHubAccounts},appDefaultPersonaId:t,setAppDefaultPersonaId:U,onboardingCompleted:o,completeOnboarding:X,usageCache:c,loadUsage:te,refresh:O}}function uP({children:t}){const s=dP();return a.jsx(jh.Provider,{value:s,children:t})}function fP(t,s){const o=y.useRef(null);y.useEffect(()=>{const r=o.current;if(o.current=t,r===null)return;const c=new Map;for(const u of r)c.set(u.id,u);const d=new Set;for(const u of t){d.add(u.id);const f=c.get(u.id);f&&f.status!==u.status&&(u.status==="sleeping"||u.status==="connecting"||(u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&f.status==="connected"&&s("Environment disconnected","warning")))}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function pP(t,s,o){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(o(t,"error"),s()),r.current=t},[t,s,o])}const mP={working:{message:"Task is now running",variant:"info"},paused:{message:"Task paused",variant:"warning"},complete:{message:"Task complete",variant:"success"},failed:{message:"Task failed to complete",variant:"error"}};function hP(t){return mP[t]}function gP(t,s){if(t===void 0)return[];const o=[],r=new Map;for(const d of t)r.set(d.id,d);const c=new Set;for(const d of s){c.add(d.id);const u=r.get(d.id);if(!u||u.status===d.status)continue;const f=hP(d.status);f&&o.push(f)}for(const d of t)c.has(d.id)||o.push({message:"Task deleted",variant:"info"});return o}function vP(t,s){const o=y.useRef(void 0);y.useEffect(()=>{const r=o.current;o.current=t;const c=gP(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const yP="_dashboard_16pzm_1",bP="_kpiStrip_16pzm_11",_P="_kpiCard_16pzm_23",xP="_kpiValue_16pzm_68",kP="_kpiLabel_16pzm_76",SP="_bodyGrid_16pzm_84",jP="_section_16pzm_96",TP="_sectionHeader_16pzm_109",NP="_sectionIcon_16pzm_118",wP="_sectionTitle_16pzm_123",CP="_sectionCount_16pzm_131",EP="_sectionBody_16pzm_138",AP="_emptyHint_16pzm_143",DP="_sessionRow_16pzm_150",MP="_sessionPrompt_16pzm_177",RP="_sessionEnv_16pzm_186",IP="_sessionRuntime_16pzm_192",OP="_sessionStatus_16pzm_198",LP="_statusDot_16pzm_207",BP="_attentionRow_16pzm_233",zP="_attentionTitle_16pzm_259",$P="_attentionMeta_16pzm_267",HP="_reasonBadge_16pzm_274",PP="_bottomGrid_16pzm_301",UP="_envRow_16pzm_312",VP="_envName_16pzm_323",qP="_envStatusBadge_16pzm_333",GP="_workspaceRow_16pzm_369",FP="_workspaceTop_16pzm_395",KP="_workspaceName_16pzm_401",ZP="_workspaceCounts_16pzm_407",YP="_progressBar_16pzm_415",JP="_progressFill_16pzm_422",he={dashboard:yP,kpiStrip:bP,kpiCard:_P,kpiValue:xP,kpiLabel:kP,bodyGrid:SP,section:jP,sectionHeader:TP,sectionIcon:NP,sectionTitle:wP,sectionCount:CP,sectionBody:EP,emptyHint:AP,sessionRow:DP,sessionPrompt:MP,sessionEnv:RP,sessionRuntime:IP,sessionStatus:OP,statusDot:LP,attentionRow:BP,attentionTitle:zP,attentionMeta:$P,reasonBadge:HP,bottomGrid:PP,envRow:UP,envName:VP,envStatusBadge:qP,workspaceRow:GP,workspaceTop:FP,workspaceName:KP,workspaceCounts:ZP,progressBar:YP,progressFill:JP};function WP(){return a.jsxs("div",{className:he.dashboard,"aria-hidden":"true",children:[a.jsx("div",{className:he.kpiStrip,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:he.kpiCard,children:[a.jsx(Te,{width:"3rem",height:"2rem"}),a.jsx(Te,{width:"80%",height:"0.75rem"})]},s))}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:3},(t,s)=>a.jsxs("div",{className:he.sessionRow,style:{cursor:"default"},children:[a.jsx(Te,{width:"60%",height:"0.875rem"}),a.jsx(Te,{width:"4rem",height:"0.75rem"}),a.jsx(Te,{width:"3rem",height:"0.75rem"}),a.jsx(Te,{width:"3rem",height:"0.75rem"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.attentionRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx(Te,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"70%",height:"0.875rem"})]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx(Te,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"9rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.envRow,children:[a.jsx(Te,{width:"60%",height:"0.875rem"}),a.jsx(Te,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),a.jsxs("div",{className:he.section,children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx(Te,{width:"1rem",height:"1rem",variant:"circular"}),a.jsx(Te,{width:"6rem",height:"0.75rem"}),a.jsx("span",{className:he.sectionCount,children:a.jsx(Te,{width:"1rem",height:"0.75rem"})})]}),a.jsx("div",{className:he.sectionBody,children:Array.from({length:2},(t,s)=>a.jsxs("div",{className:he.workspaceRow,style:{cursor:"default"},children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx(Te,{width:"50%",height:"0.875rem"}),a.jsx(Te,{width:"2rem",height:"0.75rem"})]}),a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const XP={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},td={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function QP(t,s,o,r){const c=[`${t} of ${s} tasks completed`];return o>0&&c.push(`${o} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function nd({value:t,label:s,accent:o,index:r,testId:c}){return a.jsxs(Ut.div,{className:he.kpiCard,"data-accent":o,"data-testid":c,variants:XP,initial:"hidden",animate:"visible",custom:r,children:[a.jsx("span",{className:he.kpiValue,children:t}),a.jsx("span",{className:he.kpiLabel,children:s})]})}function eU(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:o,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:f,environmentsLoading:m}}=mt(),h=kt(),v=y.useRef(new Set);y.useEffect(()=>{for(const T of t)v.current.has(T.id)||(v.current.add(T.id),c(T.id).catch(()=>{}))},[t,c]);const b=y.useMemo(()=>hH(d,o,f),[d,o,f]),_=y.useMemo(()=>vH(d,f),[d,f]),x=y.useMemo(()=>gH(o,t),[o,t]),S=y.useMemo(()=>yH(t,o),[t,o,f]);return d.length===0&&o.length===0&&f.length===0&&t.length===0&&(u||r||m||s)?a.jsx(WP,{}):a.jsxs("div",{className:he.dashboard,"data-testid":"dashboard",children:[a.jsxs("div",{className:he.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[a.jsx(nd,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),a.jsx(nd,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),a.jsx(nd,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),a.jsx(nd,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),a.jsxs("div",{className:he.bodyGrid,children:[a.jsxs(Ut.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"●"}),a.jsx("span",{className:he.sectionTitle,children:"Active Sessions"}),a.jsx("span",{className:he.sectionCount,children:_.length})]}),a.jsx("div",{className:he.sectionBody,children:_.length===0?a.jsx("div",{className:he.emptyHint,children:"No active sessions"}):_.map(({session:T,environmentName:N})=>a.jsxs("button",{type:"button",className:he.sessionRow,onClick:()=>h(yl(T.id)),"data-testid":"session-row",children:[a.jsx("span",{className:he.sessionPrompt,title:T.prompt,children:T.prompt||"—"}),a.jsx("span",{className:he.sessionEnv,children:N}),a.jsx("span",{className:he.sessionRuntime,children:T.runtime}),a.jsxs("span",{className:he.sessionStatus,children:[a.jsx("span",{className:he.statusDot,"data-status":T.status}),T.status]})]},T.id))})]}),a.jsxs(Ut.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"⚑"}),a.jsx("span",{className:he.sectionTitle,children:"Needs Attention"}),a.jsx("span",{className:he.sectionCount,children:x.length})]}),a.jsx("div",{className:he.sectionBody,children:x.length===0?a.jsx("div",{className:he.emptyHint,children:"All clear"}):x.map(({task:T,reason:N,workspaceName:C})=>a.jsxs("button",{type:"button",className:he.attentionRow,onClick:()=>h(cs(T.id)),"data-testid":"attention-row",children:[a.jsxs("div",{className:he.attentionTitle,children:[a.jsx("span",{className:he.reasonBadge,"data-reason":N,children:N}),T.title]}),a.jsx("div",{className:he.attentionMeta,children:a.jsx("span",{children:C})})]},T.id))})]})]}),a.jsxs("div",{className:he.bottomGrid,children:[a.jsxs(Ut.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"◈"}),a.jsx("span",{className:he.sectionTitle,children:"Environment Health"}),a.jsx("span",{className:he.sectionCount,children:f.length})]}),a.jsx("div",{className:he.sectionBody,children:f.length===0?a.jsx("div",{className:he.emptyHint,children:"No environments configured"}):f.map(T=>a.jsxs("div",{className:he.envRow,"data-testid":"dashboard-env-row",children:[a.jsx("span",{className:he.envName,children:T.displayName}),a.jsx("span",{className:he.envStatusBadge,"data-status":T.status,children:T.status})]},T.id))})]}),a.jsxs(Ut.div,{className:he.section,variants:td,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[a.jsxs("div",{className:he.sectionHeader,children:[a.jsx("span",{className:he.sectionIcon,"aria-hidden":"true",children:"▦"}),a.jsx("span",{className:he.sectionTitle,children:"Workspaces"}),a.jsx("span",{className:he.sectionCount,children:t.length})]}),a.jsx("div",{className:he.sectionBody,children:S.length===0?a.jsx("div",{className:he.emptyHint,children:"No workspaces yet"}):S.map(({workspace:T,totalTasks:N,completedTasks:C,workingTasks:D,failedTasks:A})=>{const E=N>0?Math.round(C/N*100):0;return a.jsxs("button",{type:"button",className:he.workspaceRow,onClick:()=>h(Di(T.id,T.linkedEnvironmentIds[0])),"data-testid":"workspace-row",children:[a.jsxs("div",{className:he.workspaceTop,children:[a.jsx("span",{className:he.workspaceName,children:T.name}),a.jsxs("span",{className:he.workspaceCounts,"aria-label":QP(C,N,D,A),children:[C,"/",N,D>0&&a.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",D]}),A>0&&a.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",A]})]})]}),N>0&&a.jsx("div",{className:he.progressBar,children:a.jsx("div",{className:he.progressFill,style:{width:`${E}%`}})})]},T.id)})})]})]})]})}const tU="_panelContainer_1udy7_1",nU="_emptyState_1udy7_8",sU="_workspaceSummary_1udy7_17",aU="_workspaceSummaryTitle_1udy7_28",iU="_workspaceSummarySubtitle_1udy7_32",oU="_header_1udy7_36",rU="_headerInfo_1udy7_71",lU="_headerTitle_1udy7_106",cU="_taskStatusBadge_1udy7_128",dU="_taskBranch_1udy7_137",uU="_taskBlockedBadge_1udy7_143",fU="_tabBar_1udy7_277",pU="_tab_1udy7_277",mU="_active_1udy7_303",hU="_eventScroll_1udy7_308",gU="_overviewContent_1udy7_325",vU="_overviewDashboard_1udy7_334",yU="_overviewHero_1udy7_340",bU="_overviewSection_1udy7_347",_U="_overviewLabel_1udy7_353",xU="_envRow_1udy7_360",kU="_timeline_1udy7_366",SU="_timelineRow_1udy7_372",jU="_waitingMessage_1udy7_379",TU="_errorMessage_1udy7_383",NU="_emptyCta_1udy7_387",wU="_ctaTitle_1udy7_399",CU="_ctaDescription_1udy7_405",EU="_ctaButton_1udy7_412",AU="_workspaceHeader_1udy7_533",DU="_workspaceName_1udy7_558",MU="_workspaceMeta_1udy7_571",RU="_metaRow_1udy7_579",IU="_metaLabel_1udy7_592",OU="_metaValue_1udy7_607",LU="_archiveButton_1udy7_617",BU="_repoLink_1udy7_647",zU="_metaToggle_1udy7_657",$U="_metaToggleArrow_1udy7_678",HU="_metaToggleArrowOpen_1udy7_683",PU="_progressBarContainer_1udy7_687",UU="_progressBar_1udy7_687",VU="_progressFill_1udy7_703",qU="_progressLabel_1udy7_710",GU="_metaTimestamps_1udy7_717",FU="_metaTimestamp_1udy7_717",KU="_metaPlaceholder_1udy7_739",ZU="_linkedEnvList_1udy7_744",YU="_linkedEnvChip_1udy7_750",JU="_chipDismiss_1udy7_762",WU="_linkError_1udy7_777",XU="_linkEnvSelect_1udy7_782",W={panelContainer:tU,emptyState:nU,workspaceSummary:sU,workspaceSummaryTitle:aU,workspaceSummarySubtitle:iU,header:oU,headerInfo:rU,headerTitle:lU,taskStatusBadge:cU,taskBranch:dU,taskBlockedBadge:uU,tabBar:fU,tab:pU,active:mU,eventScroll:hU,overviewContent:gU,overviewDashboard:vU,overviewHero:yU,overviewSection:bU,overviewLabel:_U,envRow:xU,timeline:kU,timelineRow:SU,waitingMessage:jU,errorMessage:TU,emptyCta:NU,ctaTitle:wU,ctaDescription:CU,ctaButton:EU,workspaceHeader:AU,workspaceName:DU,workspaceMeta:MU,metaRow:RU,metaLabel:IU,metaValue:OU,archiveButton:LU,repoLink:BU,metaToggle:zU,metaToggleArrow:$U,metaToggleArrowOpen:HU,progressBarContainer:PU,progressBar:UU,progressFill:VU,progressLabel:qU,metaTimestamps:GU,metaTimestamp:FU,metaPlaceholder:KU,linkedEnvList:ZU,linkedEnvChip:YU,chipDismiss:JU,linkError:WU,linkEnvSelect:XU};function QU(){return a.jsx("div",{className:W.emptyState,children:"Select a task or click + to create one"})}function eV(){return a.jsx("div",{className:W.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function tV(){const{workspaces:{workspaces:t},environments:{environments:s}}=mt(),o=kt(),r=s.length>0;return t.length>0?a.jsx(eU,{}):a.jsxs("div",{className:W.emptyCta,"data-testid":"welcome-cta",children:[a.jsx("div",{className:W.ctaTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:W.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),a.jsx("button",{className:W.ctaButton,onClick:()=>o(kx),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&a.jsx("div",{className:W.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const nV="_panelContainer_1rih4_1",sV="_chatHeader_1rih4_9",aV="_chatHeaderInfo_1rih4_38",iV="_chatHeaderActions_1rih4_44",oV="_emptyState_1rih4_64",rV="_emptyTitle_1rih4_76",lV="_emptyDescription_1rih4_82",cV="_emptyHint_1rih4_88",ua={panelContainer:nV,chatHeader:sV,chatHeaderInfo:aV,chatHeaderActions:iV,emptyState:oV,emptyTitle:rV,emptyDescription:lV,emptyHint:cV};function D_(){return a.jsx("div",{className:ua.panelContainer,"aria-hidden":"true",children:a.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(Te,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function dV({hasLocalEnvironment:t}){return a.jsxs("div",{className:ua.emptyState,"data-testid":"chat-empty-state",children:[a.jsx("div",{className:ua.emptyTitle,children:"Welcome to Grackle"}),a.jsx("div",{className:ua.emptyDescription,children:t?"Type a message below to start chatting with the System agent. It can help you plan work, create tasks, and coordinate agents.":"Add a local environment in Settings to start chatting."}),!t&&a.jsx("div",{className:ua.emptyHint,children:"Go to Settings → Environments to add one."})]})}function uV(){const t=wh(),{tasks:{tasks:s,tasksLoading:o,startTask:r},sessions:{sessions:c,sessionsLoading:d,events:u,eventsDropped:f,taskSessions:m,loadTaskSessions:h,loadSessionEvents:v,kill:b,stopGraceful:_,sendInput:x,spawn:S},environments:{environments:j,provisionEnvironment:T},personas:{personas:N}}=mt(),{showToast:C}=mn(),D=y.useRef(void 0),[A,E]=y.useState(),R=s.find(te=>te.id===zc),L=R!=null&&R.latestSessionId?c.find(te=>te.id===R.latestSessionId)??(m[zc]??[]).find(te=>te.id===R.latestSessionId):void 0;y.useEffect(()=>{h(zc).catch(()=>{})},[R==null?void 0:R.latestSessionId,h]),y.useEffect(()=>{L&&L.id!==D.current&&(D.current=L.id,v(L.id).catch(()=>{}))},[L==null?void 0:L.id,v]);const M=y.useMemo(()=>{if(!L)return[];const te=u.filter(G=>G.sessionId===L.id);return Nh(Th(te))},[u,L==null?void 0:L.id]),$=j.find(te=>te.adapterType==="local"&&te.status==="connected"),Y=L!==void 0&&L.status!=="stopped"&&L.status!=="suspended",U=(L==null?void 0:L.status)==="idle";y.useEffect(()=>{A&&L&&U&&(x(L.id,A).catch(()=>{C("Failed to send message","error")}),E(void 0))},[A,U,L==null?void 0:L.id,x,C]);const X=y.useCallback((te,G,ne,H)=>{H&&E(H),r(te,G,ne).catch(()=>{})},[r]);return!R&&(d||o)?a.jsx(D_,{}):R!=null&&R.latestSessionId&&!L?a.jsx(D_,{}):a.jsxs("div",{className:ua.panelContainer,"data-testid":"chat-page",children:[Y&&a.jsxs("div",{className:ua.chatHeader,children:[a.jsxs("span",{className:ua.chatHeaderInfo,children:["Session: ",L.id.slice(0,8)," | ",L.runtime," |"," ",L.status]}),a.jsx("div",{className:ua.chatHeaderActions,children:a.jsx(jx,{label:"Stop",onClick:()=>{_(L.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{_(L.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{b(L.id).catch(()=>{})}}]})})]}),a.jsx(bh,{events:M,eventsDropped:f,sandboxProxyUrl:t,emptyState:a.jsx(dV,{hasLocalEnvironment:!!$}),onShowToast:C}),$&&a.jsx(wd,{mode:Y?"send":"start",sessionId:Y?L.id:void 0,taskId:zc,environmentId:Y?L.environmentId:$.id,personas:N,environments:j,onSendInput:(te,G)=>{x(te,G).catch(()=>{C("Failed to send message","error")})},onSpawn:(te,G,ne)=>{S(te,G,ne).catch(()=>{})},onStartTask:X,onProvisionEnvironment:te=>{T(te).catch(()=>{})},onShowToast:C})]})}const fV="_container_h5uod_1",pV="_toolbar_h5uod_9",mV="_viewToggle_h5uod_18",hV="_toolbarControls_h5uod_23",gV="_internalsToggle_h5uod_30",vV="_refreshButton_h5uod_39",yV="_toggleButton_h5uod_53",bV="_toggleActive_h5uod_67",as={container:fV,toolbar:pV,viewToggle:mV,toolbarControls:hV,internalsToggle:gV,refreshButton:vV,toggleButton:yV,toggleActive:bV};function _V(){const{streams:{streams:t,streamsLoading:s,streamsLoadedOnce:o,streamsLoadError:r,loadStreams:c,liveMessages:d,loadTranscript:u},sessions:{sessions:f},tasks:{tasks:m}}=mt(),{resolvedThemeId:h}=Sh(),[v,b]=y.useState("list"),[_,x]=y.useState(!1),[S,j]=y.useState(void 0),[T,N]=y.useState(!1);y.useEffect(()=>{if(S===void 0){N(!1);return}let E=!0;return N(!0),u(S).then(()=>{E&&N(!1)}).catch(()=>{E&&N(!1)}),()=>{E=!1}},[S,u]);const C=y.useRef(!1);y.useEffect(()=>{if(!C.current){C.current=!0;return}c(_).catch(()=>{})},[_,c]);const D=y.useCallback(()=>{c(_).catch(()=>{})},[c,_]),A=S!==void 0?t.find(E=>E.id===S):void 0;return a.jsxs("div",{className:as.container,"data-testid":"coordination-page",children:[a.jsxs("div",{className:as.toolbar,children:[a.jsxs("div",{className:as.viewToggle,role:"group","aria-label":"Coordination view","data-testid":"coordination-view-toggle",children:[a.jsx("button",{type:"button",className:v==="list"?`${as.toggleButton} ${as.toggleActive}`:as.toggleButton,"aria-pressed":v==="list","data-testid":"coordination-view-list",onClick:()=>b("list"),children:"List"}),a.jsx("button",{type:"button",className:v==="graph"?`${as.toggleButton} ${as.toggleActive}`:as.toggleButton,"aria-pressed":v==="graph","data-testid":"coordination-view-graph",onClick:()=>b("graph"),children:"Graph"})]}),a.jsxs("div",{className:as.toolbarControls,children:[a.jsxs("label",{className:as.internalsToggle,children:[a.jsx("input",{type:"checkbox",checked:_,onChange:E=>x(E.target.checked),"data-testid":"coordination-show-internals"}),"Show internals"]}),a.jsx("button",{type:"button",className:as.refreshButton,onClick:D,"aria-label":"Refresh streams","data-testid":"coordination-refresh",children:"Refresh"})]})]}),v==="list"?a.jsx(Lz,{streams:t,sessions:f,tasks:m,loading:s,loadError:r,loadedOnce:o,showInternals:_,onToggleInternals:x,selectedStreamId:S,onSelectStream:j,onRefresh:D,hideHeaderControls:!0}):a.jsx(o9,{streams:t,sessions:f,selectedStreamId:S,onSelectStream:j,recentMessages:d,resolvedThemeId:h}),A&&a.jsx(x$,{stream:A,messages:d[A.id]??[],transcriptLoading:T,onClose:()=>j(void 0)})]})}function xV(){const t=dH(),[s]=Lm(),o=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:f,provisionEnvironment:m}}=mt(),{showToast:h}=mn();return a.jsxs("div",{className:W.panelContainer,children:[a.jsx(Hs,{segments:t}),a.jsx("div",{className:W.emptyState,children:"Enter a prompt below to start a new session"}),a.jsx(wd,{mode:"spawn",environmentId:o,showPersonaSelect:!0,personas:u,environments:f,onSendInput:(v,b)=>{r(v,b).catch(()=>{h("Failed to send message","error")})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:h})]})}function kV(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsxs("div",{className:W.header,children:[a.jsx("span",{children:a.jsx(Te,{width:"10rem",height:"0.875rem"})}),a.jsx("span",{className:W.headerInfo,children:a.jsx(Te,{width:"16rem",height:"0.875rem"})})]}),a.jsx("div",{className:W.eventScroll,children:a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[a.jsx(Te,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function SV({sessionId:t,session:s,isActive:o,onStop:r,onKill:c}){return a.jsxs("div",{className:W.header,children:[a.jsxs("span",{children:[(s==null?void 0:s.parentSessionId)&&a.jsxs(vl,{to:yl(s.parentSessionId),"data-testid":"session-parent-link",title:"Back to parent session",children:["← parent"," | "]}),"Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costMillicents?` | ${Uo((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${Rs(s.costMillicents??0)}`:""]}),a.jsxs("span",{className:W.headerInfo,children:[s&&a.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),o&&a.jsx(jx,{label:"Stop",onClick:r,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:r},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function jV({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),o=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return a.jsx("div",{className:s?W.errorMessage:W.waitingMessage,children:o})}function TV(){const{sessionId:t}=$s(),s=wh(),{sessions:{events:o,eventsDropped:r,sessions:c,sessionsLoading:d,kill:u,stopGraceful:f,loadSessionEvents:m,sendInput:h,spawn:v},tasks:{startTask:b},personas:{personas:_},environments:{environments:x,provisionEnvironment:S}}=mt(),{showToast:j}=mn(),T=y.useRef(void 0),N=uH(t),C=c.find(E=>E.id===t)??void 0,D=y.useMemo(()=>{const E=t?o.filter(R=>R.sessionId===t):[];return Nh(Th(E))},[o,t]);if(y.useEffect(()=>{t&&t!==T.current&&(T.current=t,m(t).catch(()=>{}))},[t,m]),!C&&d)return a.jsx(kV,{});if(!t)return a.jsx("div",{className:W.emptyState,children:"No session selected"});const A=(C==null?void 0:C.status)==="running"||(C==null?void 0:C.status)==="idle";return a.jsxs("div",{className:W.panelContainer,children:[a.jsx(Hs,{segments:N}),a.jsx(SV,{sessionId:t,session:C,isActive:A,onStop:()=>{f(t).catch(()=>{})},onKill:()=>{u(t).catch(()=>{})}}),a.jsx(bh,{events:D,eventsDropped:r,emptyState:a.jsx(jV,{session:C}),onShowToast:j,sandboxProxyUrl:s,sessions:c,currentSessionId:t,environments:x,personas:_,onForward:(E,R)=>h(E,R)}),A&&a.jsx(wd,{mode:"send",sessionId:t,environmentId:C.environmentId,personas:_,environments:x,onSendInput:(E,R)=>{h(E,R).catch(()=>{j("Failed to send message","error")})},onSpawn:(E,R,L)=>{v(E,R,L).catch(()=>{})},onStartTask:(E,R,L)=>{b(E,R,L).catch(()=>{})},onProvisionEnvironment:E=>{S(E).catch(()=>{})},onShowToast:j})]})}function NV(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Xa(t,s){const o=y.useRef(s);o.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:f=!0}=t;y.useEffect(()=>{if(!f)return;const m=h=>{if(u&&NV(document.activeElement??void 0))return;const v=h.ctrlKey||h.metaKey;c===v&&(d&&!h.shiftKey||h.key===r&&o.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,f])}function wV(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:W.workspaceHeader,children:a.jsx("span",{className:W.workspaceName,children:a.jsx(Te,{width:"12rem",height:"1.25rem"})})}),a.jsx("div",{className:W.metaToggle,style:{cursor:"default"},children:a.jsx(Te,{width:"4rem",height:"0.625rem"})}),a.jsxs("div",{className:W.progressBarContainer,children:[a.jsx("div",{className:W.progressBar,children:a.jsx("div",{className:W.progressFill,style:{width:"0%"}})}),a.jsx(Te,{width:"2rem",height:"0.625rem"})]}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("span",{className:`${W.tab} ${W.active}`,children:"Graph"}),a.jsx("span",{className:W.tab,children:"Board"}),a.jsx("span",{className:W.tab,children:"Tasks"})]}),a.jsx("div",{className:W.overviewContent,children:Array.from({length:3},(t,s)=>a.jsx(mm,{lines:2},s))})]})}function M_(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const r=Date.now()-s.getTime();if(r<0)return"just now";const c=Math.floor(r/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const d=Math.floor(c/60);if(d<24)return`${d}h ago`;const u=Math.floor(d/24);return u<30?`${u}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const Vp=100;function CV(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function EV(){const{workspaceId:t,environmentId:s}=$s(),o=kt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:f,updateWorkspace:m,linkEnvironment:h,unlinkEnvironment:v,linkOperationError:b,clearLinkOperationError:_},personas:{personas:x},sessions:{sessions:S},usageCache:j,loadUsage:T}=mt(),{resolvedThemeId:N}=Sh(),[C,D]=y.useState("tasks"),[A,E]=y.useState(!1),[R,L]=y.useState(null),[M,$]=y.useState(!1),Y=y.useRef(void 0),U=d.find(se=>se.id===t),X=s??(U==null?void 0:U.linkedEnvironmentIds[0])??"",te=fH(t,X,d,c);Xa({key:"1"},()=>D("graph")),Xa({key:"2"},()=>D("board")),Xa({key:"3"},()=>D("tasks")),y.useEffect(()=>{const se=Y.current;Y.current=t,!(se===void 0||se===t)&&R!==null&&L(null)},[t,R]);const G=S.reduce((se,ce)=>se+(ce.costMillicents??0),0);y.useEffect(()=>{t&&T("workspace",t).catch(()=>{})},[t,T,G]);const ne=t?j[`workspace:${t}`]:void 0,H=r.filter(se=>se.workspaceId===t),O=H.filter(se=>se.status==="complete").length,q=H.length,ge=q>0?Math.round(O/q*100):0;return!U&&u?a.jsx(wV,{}):a.jsxs("div",{className:W.panelContainer,children:[a.jsx(Hs,{segments:te}),a.jsxs("div",{className:W.workspaceHeader,children:[a.jsx("span",{className:W.workspaceName,"data-testid":"workspace-name",children:a.jsx($t,{value:(U==null?void 0:U.name)||"",onSave:se=>{U&&m(U.id,{name:se}).catch(()=>{})},validate:se=>{const ce=se.trim();if(!ce)return"Name is required";if(ce.length>Vp)return`Max ${Vp} characters`},maxLength:Vp,fieldId:"name",activeFieldId:R,onActivate:L,ariaLabel:"Workspace name",renderDisplay:se=>se||t||void 0,"data-testid":"edit-name"})}),a.jsx("button",{className:W.archiveButton,onClick:()=>E(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),a.jsxs("button",{className:W.metaToggle,onClick:()=>$(!M),"aria-expanded":!M,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[a.jsx("span",{className:`${W.metaToggleArrow} ${M?"":W.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!M&&a.jsxs("div",{className:W.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Description"}),a.jsx("div",{className:W.metaValue,children:a.jsx(vm,{value:(U==null?void 0:U.description)||"",onSave:se=>{U&&m(U.id,{description:se}).catch(()=>{})},fieldId:"description",activeFieldId:R,onActivate:L,renderDisplay:se=>se?a.jsx("span",{className:W.overviewMarkdown,children:a.jsx(Tm,{remarkPlugins:[Nm],children:se})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Repository"}),a.jsx("div",{className:W.metaValue,children:a.jsx($t,{value:(U==null?void 0:U.repoUrl)||"",onSave:se=>{U&&m(U.id,{repoUrl:se}).catch(()=>{})},validate:se=>{const ce=se.trim();if(ce&&!/^https?:\/\/.+/.test(ce))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:R,onActivate:L,renderDisplay:se=>{const ce=CV(se);return ce?a.jsx("a",{className:W.repoLink,href:ce,target:"_blank",rel:"noopener noreferrer",onClick:me=>me.stopPropagation(),children:se}):se?a.jsx("span",{children:se}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Environments"}),a.jsx("div",{className:W.metaValue,"data-testid":"linked-environments",children:U?a.jsxs("span",{className:W.linkedEnvList,children:[(()=>{const se=[...new Set(U.linkedEnvironmentIds)];return se.length===0?a.jsx("span",{className:W.metaPlaceholder,children:"None"}):se.map(ce=>{const me=c.find(xe=>xe.id===ce);return a.jsxs("span",{className:W.linkedEnvChip,"data-testid":`linked-env-${ce}`,children:[(me==null?void 0:me.displayName)||ce,a.jsx("button",{className:W.chipDismiss,onClick:()=>{v(U.id,ce).catch(()=>{})},title:`Unlink ${(me==null?void 0:me.displayName)||ce}`,"aria-label":`Unlink ${(me==null?void 0:me.displayName)||ce}`,"data-testid":`unlink-env-${ce}`,disabled:se.length<=1,children:"x"})]},ce)})})(),(()=>{const se=new Set(U.linkedEnvironmentIds),ce=c.filter(me=>!se.has(me.id));return ce.length===0?null:a.jsxs("select",{className:W.linkEnvSelect,value:"",onChange:me=>{me.target.value&&h(U.id,me.target.value).catch(()=>{})},"aria-label":"Link environment","data-testid":"link-env-select",children:[a.jsx("option",{value:"",children:"+ Link"}),ce.map(me=>a.jsx("option",{value:me.id,children:me.displayName||me.id},me.id))]})})(),b&&a.jsxs("span",{className:W.linkError,"data-testid":"link-operation-error",role:"alert",children:[b,a.jsx("button",{className:W.chipDismiss,onClick:_,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"x"})]})]}):a.jsx("span",{className:W.metaPlaceholder,children:"None"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Persona"}),a.jsx("div",{className:W.metaValue,children:a.jsx(Sd,{value:(U==null?void 0:U.defaultPersonaId)||"",onSave:se=>{U&&m(U.id,{defaultPersonaId:se}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...x.map(se=>({value:se.id,label:se.name}))],fieldId:"defaultPersonaId",activeFieldId:R,onActivate:L,renderDisplay:se=>{const ce=x.find(me=>me.id===se);if(ce)return a.jsx("span",{children:ce.name})},placeholder:(U==null?void 0:U.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Worktrees"}),a.jsx("div",{className:W.metaValue,children:a.jsx(y5,{checked:(U==null?void 0:U.useWorktrees)??!0,onChange:se=>{U&&m(U.id,{useWorktrees:se}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),a.jsxs("div",{className:W.metaRow,children:[a.jsx("span",{className:W.metaLabel,children:"Working Dir"}),a.jsx("div",{className:W.metaValue,children:a.jsx($t,{value:(U==null?void 0:U.workingDirectory)||"",onSave:se=>{U&&m(U.id,{workingDirectory:se}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:R,onActivate:L,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),U&&a.jsxs("div",{className:W.metaTimestamps,children:[a.jsxs("span",{className:W.metaTimestamp,children:["Created ",M_(U.createdAt)]}),U.updatedAt&&U.updatedAt!==U.createdAt&&a.jsxs("span",{className:W.metaTimestamp,children:["· Updated ",M_(U.updatedAt)]})]})]}),q>0&&a.jsxs("div",{className:W.progressBarContainer,"data-testid":"progress-bar",children:[a.jsx("div",{className:W.progressBar,children:a.jsx("div",{className:W.progressFill,style:{width:`${ge}%`}})}),a.jsxs("span",{className:W.progressLabel,children:[O,"/",q]})]}),ne&&ne.costMillicents>0&&a.jsx("div",{className:W.progressBarContainer,children:a.jsxs("span",{className:W.progressLabel,children:["Usage: ",Rs(ne.costMillicents)," (",ne.sessionCount," session",ne.sessionCount!==1?"s":"",")"]})}),U&&(U.tokenBudget>0||U.costBudgetMillicents>0)&&a.jsx("div",{className:W.progressBarContainer,children:a.jsxs("span",{className:W.progressLabel,children:["Budget:"," ",U.tokenBudget>0&&a.jsxs(a.Fragment,{children:["Tokens: ",Uo(((ne==null?void 0:ne.inputTokens)??0)+((ne==null?void 0:ne.outputTokens)??0))," /"," ",Uo(U.tokenBudget)]}),U.tokenBudget>0&&U.costBudgetMillicents>0&&" | ",U.costBudgetMillicents>0&&a.jsxs(a.Fragment,{children:["Cost: ",Rs((ne==null?void 0:ne.costMillicents)??0)," /"," ",Rs(U.costBudgetMillicents)]})]})}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Workspace view",children:[a.jsx("button",{role:"tab","aria-selected":C==="graph",className:`${W.tab} ${C==="graph"?W.active:""}`,onClick:()=>D("graph"),children:"Graph"}),a.jsx("button",{role:"tab","aria-selected":C==="board",className:`${W.tab} ${C==="board"?W.active:""}`,onClick:()=>D("board"),"data-testid":"board-tab",children:"Board"}),a.jsx("button",{role:"tab","aria-selected":C==="tasks",className:`${W.tab} ${C==="tasks"?W.active:""}`,onClick:()=>D("tasks"),children:"Tasks"})]}),C==="tasks"&&q>0&&a.jsxs("div",{className:W.workspaceSummary,children:[a.jsx("span",{className:W.workspaceSummaryTitle,children:`${O}/${q} tasks complete`}),a.jsx("span",{className:W.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),C==="tasks"&&q===0&&a.jsxs("div",{className:W.emptyCta,children:[a.jsx("button",{className:W.ctaButton,onClick:()=>o(Oi(t,void 0,X)),children:"Create Task"}),a.jsx("div",{className:W.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),C==="board"&&a.jsx(M9,{workspaceId:t,environmentId:X,tasks:r,sessions:S,personas:x,environments:c}),C==="graph"&&a.jsx(IC,{workspaceId:t,environmentId:X,tasks:r,resolvedThemeId:N}),a.jsx(_s,{isOpen:A,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{U&&(f(U.id).catch(()=>{}),o("/",{replace:!0})),E(!1)},onCancel:()=>E(!1)})]})}const AV="_container_3pgew_1",DV="_header_3pgew_8",MV="_headerTitle_3pgew_35",RV="_headerActions_3pgew_44",IV="_body_3pgew_51",OV="_btnPrimary_3pgew_63",LV="_btnGhost_3pgew_94",BV="_error_3pgew_116",Ja={container:AV,header:DV,headerTitle:MV,headerActions:RV,body:IV,btnPrimary:OV,btnGhost:LV,error:BV};function zV(t){const s={};return t.name.trim()||(s.name="Name is required"),t.repoUrl.trim()&&!/^https?:\/\/.+/i.test(t.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),t.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const $V=[{label:"Home",url:Zo},{label:"New Workspace",url:void 0}];function HV(){const[t]=Lm(),s=t.get("environment")??void 0,{environments:{environments:o},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=mt(),{showToast:u}=mn(),f=kt(),[m,h]=y.useState(()=>{var T;return V9(void 0,s||((T=o[0])==null?void 0:T.id))}),[v,b]=y.useState(),[_,x]=y.useState();y.useEffect(()=>{s||m.environmentId||o.length===0||h(T=>{var N;return T.environmentId?T:{...T,environmentId:((N=o[0])==null?void 0:N.id)??""}})},[o,s,m.environmentId]);const S=()=>{const T=zV(m);if(T){b(T),x(void 0);return}b(void 0),x(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,N=>{u("Workspace created","success"),f(Di(N.id,N.linkedEnvironmentIds[0]??m.environmentId),{replace:!0})},N=>{x(N)}).catch(()=>{})},j=()=>{f(s?Po(s):Zo,{replace:!0})};return a.jsxs("div",{className:Ja.container,children:[a.jsxs("div",{className:Ja.header,children:[a.jsx("div",{className:Ja.headerTitle,children:a.jsx(Hs,{segments:$V})}),a.jsxs("div",{className:Ja.headerActions,children:[a.jsx("button",{className:Ja.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),a.jsx("button",{className:Ja.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?a.jsx(tk,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),a.jsxs("div",{className:Ja.body,children:[a.jsx(G9,{values:m,onChange:T=>{h(T),b(void 0),x(void 0)},environments:o,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&a.jsx("div",{className:Ja.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function R_(){const{workspaceId:t,environmentId:s}=$s(),[o]=Lm(),r=t??o.get("workspace")??"",c=o.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:f},workspaces:{workspaces:m},personas:{personas:h}}=mt(),{showToast:v}=mn();return a.jsx(gk,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:h,onCreateTask:(b,_,x,S,j,T,N,C,D,A)=>{u(b,_,x,S,j,T,N,C,D,A).catch(()=>{})},onUpdateTask:(b,_,x,S,j)=>{f(b,_,x,S,j).catch(()=>{})},onShowToast:v})}function PV(){return a.jsxs("div",{className:W.panelContainer,"aria-hidden":"true",children:[a.jsx("div",{className:W.header,children:a.jsxs("span",{className:W.headerTitle,children:[a.jsx(Te,{width:"12rem",height:"1rem"}),a.jsx(Te,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("span",{className:`${W.tab} ${W.active}`,children:"Overview"}),a.jsx("span",{className:W.tab,children:"Stream"})]}),a.jsx("div",{className:W.overviewContent,children:a.jsxs("div",{className:W.overviewDashboard,children:[a.jsx("div",{className:W.overviewHero,children:a.jsx(Te,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Description"}),a.jsx(pm,{lines:2})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Environment"}),a.jsxs("div",{className:W.envRow,children:[a.jsx(Te,{width:"0.5rem",height:"0.5rem",variant:"circular"}),a.jsx(Te,{width:"8rem",height:"0.875rem"})]})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Dependencies"}),a.jsx(pm,{lines:2})]}),a.jsxs("div",{className:W.overviewSection,children:[a.jsx("div",{className:W.overviewLabel,children:"Timeline"}),a.jsx("div",{className:W.timeline,children:Array.from({length:4},(t,s)=>a.jsxs("div",{className:W.timelineRow,children:[a.jsx(Te,{width:"4rem",height:"0.75rem"}),a.jsx(Te,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Ao(){var _a;const{taskId:t,workspaceId:s,environmentId:o}=$s(),r=wh(),c=Wt(),d=kt(),{showToast:u}=mn(),{sessions:{events:f,eventsDropped:m,sessions:h,loadSessionEvents:v,taskSessions:b,loadTaskSessions:_,sendInput:x,spawn:S,kill:j},tasks:{tasks:T,tasksLoading:N,startTask:C,stopTask:D,resumeTask:A,deleteTask:E,createTask:R,updateTask:L},environments:{environments:M,provisionEnvironment:$},workspaces:{workspaces:Y},personas:{personas:U},usageCache:X,loadUsage:te}=mt(),G=y.useRef(void 0),ne=y.useRef(void 0),H=y.useRef(void 0),O=y.useRef(void 0),q=y.useRef(void 0),ge=c.pathname.endsWith("/stream")?"stream":"overview",se=c.pathname.endsWith("/edit"),[ce,me]=y.useState(ge),[xe,De]=y.useState(!1),[ot,_t]=y.useState(void 0),[lt,Pe]=y.useState(""),[ke,ct]=y.useState(se),ue=y.useRef(ge),Ie=y.useRef(se),ee=T.find(Ce=>Ce.id===t),nt=(ee==null?void 0:ee.workspaceId)||void 0,le=Y.find(Ce=>Ce.id===nt);y.useEffect(()=>{ge!==ue.current&&(ue.current=ge,ge!==ce&&me(ge))},[ge,ce]),y.useEffect(()=>{se!==Ie.current&&(Ie.current=se,se!==ke&&ct(se))},[se,ke]),y.useEffect(()=>{if(lt===""){if(le!=null&&le.linkedEnvironmentIds[0])Pe(le.linkedEnvironmentIds[0]);else if(M.length>0){const Ce=M.find(Ve=>Ve.status==="connected");Pe((Ce==null?void 0:Ce.id)??M[0].id)}}},[lt,le==null?void 0:le.linkedEnvironmentIds[0],M]);const ve=ee?b[ee.id]??[]:[];let et;ot&&ve.some(Ce=>Ce.id===ot)?et=ot:et=(ee==null?void 0:ee.latestSessionId)||void 0;const on=()=>{De(!0)},ks=()=>{if(!ee)return;E(ee.id).catch(()=>{}),De(!1);const Ce=o??(le==null?void 0:le.linkedEnvironmentIds[0]);d(ee.workspaceId&&Ce?Di(ee.workspaceId,Ce):"/",{replace:!0})};y.useEffect(()=>{(ee==null?void 0:ee.id)!==ne.current&&(ne.current=ee==null?void 0:ee.id,_t(void 0),Pe(""),ct(se))},[ee==null?void 0:ee.id,se]),y.useEffect(()=>{if(!(ee!=null&&ee.id))return;const Ce=ee.id!==O.current,Ve=ee.latestSessionId!==q.current;(Ce||Ve)&&(O.current=ee.id,q.current=ee.latestSessionId,_(ee.id).catch(()=>{}))},[ee==null?void 0:ee.id,ee==null?void 0:ee.latestSessionId,_]),y.useEffect(()=>{if((ee==null?void 0:ee.status)!==H.current){const Ce=H.current===void 0;H.current=ee==null?void 0:ee.status;const Ve=(ee==null?void 0:ee.status)==="not_started"?"overview":(ee==null?void 0:ee.status)==="working"||(ee==null?void 0:ee.status)==="paused"?"stream":(ee==null?void 0:ee.status)==="complete"?"overview":void 0;Ve&&Ve!==ce&&!(Ce&&ge!=="overview")&&me(Ve)}},[ee==null?void 0:ee.status,ce,ge]);const us=y.useMemo(()=>new Map(T.map(Ce=>[Ce.id,Ce])),[T]),Ps=y.useMemo(()=>{const Ce=et?f.filter(Ve=>Ve.sessionId===et):[];return Nh(Th(Ce))},[f,et]),ya=ee?ee.dependsOn.some(Ce=>{const Ve=us.get(Ce);return Ve!==void 0&&Ve.status!=="complete"}):!1,Bi=y.useMemo(()=>pH(t,o,Y,M,us),[t,o,Y,M,us]);y.useEffect(()=>{et&&et!==G.current&&(G.current=et,v(et).catch(()=>{}))},[et,v]);const Xt=ve.reduce((Ce,Ve)=>Ce+(Ve.costMillicents??0),0);y.useEffect(()=>{ee&&(te("task",ee.id).catch(()=>{}),ee.childTaskIds.length>0&&te("task_tree",ee.id).catch(()=>{}))},[ee==null?void 0:ee.id,ee==null?void 0:ee.childTaskIds.length,te,Xt]);const ai=ee?`task:${ee.id}`:"",ii=ai in X?X[ai]:void 0,ba=ee?`task_tree:${ee.id}`:"",Us=ee&&ee.childTaskIds.length>0&&ba in X?X[ba]:void 0,Ss=Ce=>{me(Ce),d(cs(t,Ce==="overview"?void 0:Ce,s,o))};return Xa({key:"1"},()=>Ss("overview")),Xa({key:"2"},()=>Ss("stream")),!ee&&N?a.jsx(PV,{}):a.jsxs("div",{className:W.panelContainer,children:[a.jsx(Hs,{segments:Bi}),a.jsxs("div",{className:W.header,children:[a.jsxs("span",{className:W.headerTitle,children:[a.jsx("span",{"data-testid":"task-title",children:(ee==null?void 0:ee.title)||t}),ee&&a.jsx("span",{className:W.taskStatusBadge,"data-testid":"task-status",children:ee.status}),(ee==null?void 0:ee.branch)&&a.jsx("span",{className:W.taskBranch,children:ee.branch}),ya&&a.jsx("span",{className:W.taskBlockedBadge,children:"blocked"})]}),ee&&a.jsx(t8,{task:ee,sessionId:et,latestSessionStatus:(_a=h.find(Ce=>Ce.id===ee.latestSessionId))==null?void 0:_a.status,isBlocked:ya,onStart:()=>{C(ee.id,void 0,lt).catch(Ce=>{const Ve=Ce instanceof Bs?Ce.message:"Failed to start task";u(Ve,"error")})},onResume:()=>{A(ee.id).catch(()=>{})},onStop:()=>{D(ee.id).catch(()=>{})},onPause:()=>{et&&j(et).catch(()=>{})},onDelete:on,onEdit:()=>ct(!0)})]}),a.jsxs("div",{className:W.tabBar,role:"tablist","aria-label":"Task view",children:[a.jsx("button",{role:"tab","aria-selected":ce==="overview",className:`${W.tab} ${ce==="overview"?W.active:""}`,onClick:()=>Ss("overview"),children:"Overview"}),a.jsx("button",{role:"tab","aria-selected":ce==="stream",className:`${W.tab} ${ce==="stream"?W.active:""}`,onClick:()=>Ss("stream"),children:"Stream"})]}),a.jsxs(rs,{mode:"wait",children:[ce==="overview"&&a.jsx(Ut.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:W.overviewContent,"data-testid":"task-overview",children:ke&&ee?a.jsx(gk,{mode:"edit",taskId:ee.id,workspaceId:nt,environmentId:o,tasks:T,workspaces:Y,personas:U,onCreateTask:(Ce,Ve,Qt,Ct,yn,en,zi,$i,Hi,xa)=>{R(Ce,Ve,Qt,Ct,yn,en,zi,$i,Hi,xa).catch(()=>{})},onUpdateTask:(Ce,Ve,Qt,Ct,yn)=>{L(Ce,Ve,Qt,Ct,yn).catch(()=>{})},onEditDone:()=>{se?d(cs(ee.id,void 0,s,o),{replace:!0}):ct(!1)},onShowToast:u}):ee?a.jsx(U8,{task:ee,tasksById:us,environments:M,workspaces:Y,taskSessions:ve,selectedEnvId:lt,taskUsage:ii,treeUsage:Us}):a.jsx("div",{className:W.waitingMessage,children:"No additional details"})},"overview"),ce==="stream"&&a.jsxs(Ut.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden"},children:[a.jsx(J6,{taskSessions:ve,selectedSessionId:et,onSelect:Ce=>_t(Ce)}),a.jsx(bh,{events:Ps,eventsDropped:m,sandboxProxyUrl:r,emptyState:!et&&ee?ya?a.jsx("div",{className:W.emptyCta,"data-testid":"stream-blocked-message",children:a.jsx("div",{className:W.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):a.jsxs("div",{className:W.emptyCta,children:[a.jsx("button",{"data-testid":"stream-start-cta",className:W.ctaButton,onClick:()=>{C(ee.id,void 0,lt).catch(Ce=>{const Ve=Ce instanceof Bs?Ce.message:"Failed to start task";u(Ve,"error")})},children:"Start Task"}),a.jsx("div",{className:W.ctaDescription,children:"Click to begin agent execution"})]}):et&&Ps.length===0?a.jsx("div",{className:W.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:u})]},"stream")]}),(()=>{if(!ee||ee.status!=="working"&&ee.status!=="paused")return;const Ce=et?h.find(Ve=>Ve.id===et):void 0;if(!(!Ce||Ce.status==="stopped"))return a.jsx(wd,{mode:"send",sessionId:Ce.id,environmentId:Ce.environmentId,personas:U,environments:M,onSendInput:(Ve,Qt)=>{x(Ve,Qt).catch(()=>{u("Failed to send message","error")})},onSpawn:(Ve,Qt,Ct)=>{S(Ve,Qt,Ct,void 0,nt).catch(()=>{})},onStartTask:(Ve,Qt,Ct)=>{C(Ve,Qt,Ct).catch(()=>{})},onProvisionEnvironment:Ve=>{$(Ve).catch(()=>{})},onShowToast:u})})(),ee&&a.jsx(_s,{isOpen:xe,title:"Delete Task?",description:`"${ee.title}" will be permanently removed.`,onConfirm:ks,onCancel:()=>De(!1)})]})}function UV(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:o},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:f,createCodespace:m},dockerContainers:{dockerContainers:h,dockerContainersError:v,listDockerContainers:b},githubAccounts:{githubAccounts:_}}=mt(),{showToast:x}=mn();return a.jsx(vk,{mode:"new",environments:t,githubAccounts:_,onAddEnvironment:(S,j,T,N)=>{s(S,j,T,N).catch(()=>{})},onUpdateEnvironment:(S,j)=>{o(S,j).catch(()=>{})},onListCodespaces:S=>{f(S).catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(S,j)=>{m(S,j).catch(()=>{})},onListDockerContainers:()=>{b().catch(()=>{})},dockerContainers:h,dockerContainersError:v,onShowToast:x})}function VV(){const{environmentId:t}=$s(),{environments:{environments:s,addEnvironment:o,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:f,listCodespaces:m,createCodespace:h},dockerContainers:{dockerContainers:v,dockerContainersError:b,listDockerContainers:_},githubAccounts:{githubAccounts:x}}=mt(),{showToast:S}=mn();return a.jsx(vk,{mode:"edit",environmentId:t,environments:s,githubAccounts:x,onAddEnvironment:(j,T,N,C)=>{o(j,T,N,C).catch(()=>{})},onUpdateEnvironment:(j,T)=>{r(j,T).catch(()=>{})},onListCodespaces:j=>{m(j).catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:f,onCreateCodespace:(j,T)=>{h(j,T).catch(()=>{})},onListDockerContainers:()=>{_().catch(()=>{})},dockerContainers:v,dockerContainersError:b,onShowToast:S})}const qV="_layout_11u79_1",GV="_content_11u79_8",FV="_tabPanel_11u79_14",al={layout:qV,content:GV,tabPanel:FV};function KV(){const t=cH();return a.jsxs("div",{className:al.layout,children:[a.jsx(Hs,{segments:t}),a.jsx("div",{className:al.content,children:a.jsx(Ii,{})})]})}const ZV="_container_144a4_1",YV="_envHeader_144a4_6",JV="_envTitleRow_144a4_10",WV="_statusDot_144a4_16",XV="_envName_144a4_21",QV="_statusBadge_144a4_27",eq="_envMeta_144a4_33",tq="_metaTag_144a4_39",nq="_actions_144a4_51",sq="_provisionMessage_144a4_59",aq="_errorMessage_144a4_64",iq="_section_144a4_69",oq="_sectionHeader_144a4_73",rq="_cardList_144a4_121",lq="_card_144a4_121",cq="_cardHeader_144a4_138",dq="_cardName_144a4_144",uq="_cardActions_144a4_149",fq="_cardDescription_144a4_154",pq="_cardMeta_144a4_160",mq="_repoLink_144a4_166",hq="_empty_144a4_174",gq="_errorHint_144a4_180",vq="_btnPrimary_144a4_186",yq="_btnOutline_144a4_220",bq="_btnSmall_144a4_247",_q="_btnDanger_144a4_273",Re={container:ZV,envHeader:YV,envTitleRow:JV,statusDot:WV,envName:XV,statusBadge:QV,envMeta:eq,metaTag:tq,actions:nq,provisionMessage:sq,errorMessage:aq,section:iq,sectionHeader:oq,cardList:rq,card:lq,cardHeader:cq,cardName:dq,cardActions:uq,cardDescription:fq,cardMeta:pq,repoLink:mq,empty:hq,errorHint:gq,btnPrimary:vq,btnOutline:yq,btnSmall:bq,btnDanger:_q};function xq(){return a.jsxs("div",{className:Re.container,"aria-hidden":"true",children:[a.jsxs("div",{className:Re.envHeader,children:[a.jsxs("div",{className:Re.envTitleRow,children:[a.jsx(Te,{width:"0.875rem",height:"0.875rem",variant:"circular"}),a.jsx(Te,{width:"12rem",height:"1.5rem"}),a.jsx(Te,{width:"4rem",height:"0.875rem"})]}),a.jsxs("div",{className:Re.envMeta,children:[a.jsx(Te,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),a.jsxs("div",{className:Re.actions,children:[a.jsx(Te,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),a.jsx(Te,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),a.jsxs("div",{className:Re.section,children:[a.jsx("div",{className:Re.sectionHeader,children:a.jsx("h3",{style:{margin:0},children:"Workspaces"})}),a.jsxs("div",{className:Re.cardList,children:[a.jsx(mm,{lines:2}),a.jsx(mm,{lines:2})]})]})]})}const kq={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function Sq(){const{environmentId:t}=$s(),s=kt(),{environments:{environments:o,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:f},workspaces:{workspaces:m,archiveWorkspace:h,linkEnvironment:v,unlinkEnvironment:b,linkOperationError:_,clearLinkOperationError:x},sessions:{sessions:S}}=mt(),[j,T]=y.useState(!1),[N,C]=y.useState(!1),[D,A]=y.useState(void 0),E=o.find(O=>O.id===t);if(!E&&r)return a.jsx(xq,{});if(!t||!E)return a.jsx(gn,{to:Ho,replace:!0});const R=m.filter(O=>O.linkedEnvironmentIds.includes(E.id)),L=S.filter(O=>O.environmentId===E.id),M=L.reduce((O,q)=>O+(q.costMillicents??0),0),$=kq[E.status]||"var(--text-tertiary)",Y=E.status==="connected",U=E.status==="connecting",X=E.status==="disconnected"||E.status==="error"||E.status==="sleeping",te=E.id in c?c[E.id]:void 0,G=()=>{f(E.id).catch(()=>{}),T(!1),s(Ho,{replace:!0})},ne=()=>{C(!1),d(E.id,!0).catch(()=>{})},H=O=>{h(O).catch(()=>{}),A(void 0)};return a.jsxs("div",{className:Re.container,children:[a.jsx(_s,{isOpen:j,title:"Delete Environment?",description:`"${E.displayName||E.id}" will be permanently removed along with all its data.`,onConfirm:G,onCancel:()=>T(!1)}),a.jsx(_s,{isOpen:N,title:"Reprovision Environment?",description:"This will kill any active session and force a fresh provision cycle. The environment will be temporarily disconnected.",confirmLabel:"Reprovision",onConfirm:ne,onCancel:()=>C(!1)}),a.jsxs("div",{className:Re.envHeader,children:[a.jsxs("div",{className:Re.envTitleRow,children:[a.jsx("span",{className:Re.statusDot,style:{color:$},children:"●"}),a.jsx("h2",{className:Re.envName,children:E.displayName||E.id}),a.jsx("span",{className:Re.statusBadge,style:{color:$},children:E.status})]}),a.jsxs("div",{className:Re.envMeta,children:[a.jsxs("span",{className:Re.metaTag,children:["Adapter: ",E.adapterType]}),L.length>0&&a.jsxs("span",{className:Re.metaTag,children:[L.length," session",L.length!==1?"s":""]}),M>0&&a.jsxs("span",{className:Re.metaTag,children:["Cost: ",Rs(M)]})]})]}),a.jsxs("div",{className:Re.actions,children:[Y&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Re.btnPrimary,onClick:()=>s(yx(E.id)),children:"New Chat"}),a.jsx("button",{className:Re.btnOutline,onClick:()=>{u(E.id).catch(()=>{})},children:"Stop"}),a.jsx("button",{className:Re.btnOutline,onClick:()=>C(!0),disabled:te!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),X&&a.jsx("button",{className:Re.btnPrimary,onClick:()=>{d(E.id).catch(()=>{})},children:E.status==="error"?"Retry":E.status==="sleeping"?"Wake":"Connect"}),U&&te!==void 0&&a.jsx("span",{className:Re.provisionMessage,children:te.message}),E.status==="error"&&(te==null?void 0:te.stage)==="error"&&a.jsx("span",{className:Re.errorMessage,children:te.message}),a.jsx("button",{className:Re.btnOutline,onClick:()=>s(jC(E.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),a.jsx("button",{className:Re.btnDanger,onClick:()=>T(!0),children:"Delete"})]}),a.jsxs("div",{className:Re.section,children:[a.jsxs("div",{className:Re.sectionHeader,children:[a.jsx("h3",{children:"Workspaces"}),a.jsx("button",{className:Re.btnPrimary,onClick:()=>s(`${kx}?environment=${encodeURIComponent(E.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"}),(()=>{const O=m.filter(q=>!q.linkedEnvironmentIds.includes(E.id)&&q.status==="active");return O.length===0?null:a.jsxs("select",{className:Re.btnPrimary,value:"",onChange:q=>{q.target.value&&v(q.target.value,E.id).catch(()=>{})},"aria-label":"Link a workspace","data-testid":"link-workspace-select",children:[a.jsx("option",{value:"",children:"+ Link Workspace"}),O.map(q=>a.jsx("option",{value:q.id,children:q.name},q.id))]})})()]}),_&&a.jsxs("p",{className:Re.errorHint,"data-testid":"link-operation-error",role:"alert",children:[_,a.jsx("button",{className:Re.btnSmall,onClick:x,"aria-label":"Dismiss error","data-testid":"dismiss-link-error",children:"Dismiss"})]}),R.length===0&&a.jsx("p",{className:Re.empty,"data-testid":"linked-workspaces-empty",children:"No workspaces yet. Create one to get started."}),a.jsx("div",{className:Re.cardList,"data-testid":"linked-workspaces-list",children:R.map(O=>a.jsx(jq,{workspace:O,confirmArchiveId:D,onOpen:()=>s(Di(O.id,E.id)),onArchive:()=>A(O.id),onConfirmArchive:()=>H(O.id),onCancelArchive:()=>A(void 0),onUnlink:()=>{b(O.id,E.id).catch(()=>{})}},O.id))})]})]})}function jq({workspace:t,confirmArchiveId:s,onOpen:o,onArchive:r,onConfirmArchive:c,onCancelArchive:d,onUnlink:u}){const f=s===t.id,m=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return a.jsxs("div",{className:Re.card,"data-testid":"workspace-card","data-workspace-id":t.id,children:[a.jsxs("div",{className:Re.cardHeader,children:[a.jsx("strong",{className:Re.cardName,children:t.name}),a.jsxs("div",{className:Re.cardActions,children:[a.jsx("button",{className:Re.btnSmall,onClick:o,children:"Open"}),a.jsx("button",{className:Re.btnSmall,onClick:u,disabled:t.linkedEnvironmentIds.length<=1,"data-testid":`unlink-workspace-${t.id}`,children:"Unlink"}),f?a.jsxs(a.Fragment,{children:[a.jsx("button",{className:Re.btnDanger,onClick:c,children:"Confirm"}),a.jsx("button",{className:Re.btnSmall,onClick:d,children:"Cancel"})]}):a.jsx("button",{className:Re.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&a.jsx("p",{className:Re.cardDescription,children:t.description}),t.repoUrl&&a.jsx("div",{className:Re.cardMeta,children:m?a.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Re.repoLink,children:t.repoUrl}):a.jsx("span",{children:t.repoUrl})})]})}const Tq={credentials:"Credentials","github-accounts":"GitHub Accounts",schedules:"Schedules",appearance:"Appearance",about:"About",shortcuts:"Shortcuts",plugins:"Plugins"};function Nq(){const s=Wt().pathname.replace(/^\/settings\/?/,"").split("/")[0],o=Tq[s],r=iH(o);return a.jsxs("div",{className:al.layout,children:[a.jsx(Hs,{segments:r}),a.jsx("div",{className:al.content,children:a.jsx("div",{className:al.tabPanel,children:a.jsx(Ii,{})},s)})]})}function wq(){const{tokens:{tokens:t,setToken:s,deleteToken:o},credentials:{credentialProviders:r,updateCredentialProviders:c}}=mt(),{showToast:d}=mn();return a.jsxs(a.Fragment,{children:[a.jsx(x7,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),a.jsx(jB,{tokens:t,onSetToken:(u,f,m,h,v)=>{s(u,f,m,h,v).catch(()=>{})},onDeleteToken:u=>{o(u).catch(()=>{})},onShowToast:d})]})}function Cq(){const{githubAccounts:{githubAccounts:t,githubAccountsLoading:s,addGitHubAccount:o,updateGitHubAccount:r,removeGitHubAccount:c,importGitHubAccounts:d}}=mt(),{showToast:u}=mn();return a.jsx(q8,{githubAccounts:t,githubAccountsLoading:s,onAddGitHubAccount:o,onUpdateGitHubAccount:r,onRemoveGitHubAccount:c,onImportGitHubAccounts:d,onShowToast:u})}const Eq="_layout_1sbe4_1",Aq="_content_1sbe4_8",I_={layout:Eq,content:Aq};function Dq(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:o,setAppDefaultPersonaId:r}=mt(),{showToast:c}=mn(),d=kt();return a.jsxs("div",{className:I_.layout,children:[a.jsx(Hs,{segments:rH()}),a.jsx("div",{className:I_.content,children:a.jsx(I7,{personas:t,appDefaultPersonaId:o,onDeletePersona:async u=>{try{await s(u)}catch(f){throw console.error("Failed to delete persona",{personaId:u,error:f}),c("Failed to delete persona","error"),f}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(f){console.error("Failed to set app default persona ID",{personaId:u,error:f}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(NC),onNavigateToPersona:u=>d(Bm(u))})})]})}const Mq="_container_1ooin_1",Rq="_form_1ooin_7",Iq="_formActions_1ooin_75",Oq="_editableSection_1ooin_82",Lq="_defaultBadge_1ooin_93",Bq="_typeToggle_1ooin_107",zq="_scriptEditor_1ooin_121",$q="_optional_1ooin_128",vs={container:Mq,form:Rq,formActions:Iq,editableSection:Oq,defaultBadge:Lq,typeToggle:Bq,scriptEditor:zq,optional:$q},O_=[{value:"claude-code",label:"claude-code"},{value:"codex",label:"codex"},{value:"copilot",label:"copilot"},{value:"goose",label:"goose"},{value:"stub",label:"stub"},{value:"claude-code-acp",label:"claude-code-acp (experimental)"},{value:"codex-acp",label:"codex-acp (experimental)"},{value:"copilot-acp",label:"copilot-acp (experimental)"}],L_=[{value:"genaiscript",label:"genaiscript"}],Hq="0";function B_(){const{personaId:t}=$s(),s=kt(),{showToast:o}=mn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:f,setAppDefaultPersonaId:m}=mt(),h=t===void 0,v=h?void 0:r.find(_=>_.id===t);if(!h&&r.length>0&&!v)return a.jsx(gn,{to:rl,replace:!0});const b=lH(h?"New Persona":(v==null?void 0:v.name)??"Persona");return a.jsxs("div",{className:vs.container,children:[a.jsx(Hs,{segments:b}),a.jsx(Pq,{existing:v,isNew:h,appDefaultPersonaId:f,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(rl)},showToast:o})]})}function Pq({existing:t,isNew:s,appDefaultPersonaId:o,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:f,showToast:m}){const h=kt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,x]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[T,N]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,D]=y.useState((t==null?void 0:t.model)??"sonnet"),[A,E]=y.useState((t==null?void 0:t.maxTurns)??0),[R,L]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[M,$]=y.useState((t==null?void 0:t.script)??""),[Y,U]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[X,te]=y.useState(!1),[G,ne]=y.useState(null),[H,O]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!H){O(!0),b(t.name),x(t.description),j(t.systemPrompt);const ue=t.type==="script"?"script":"agent";N(ue==="script"?t.runtime||"genaiscript":t.runtime),D(t.model),E(t.maxTurns),L(ue),$(t.script||""),U(t.allowedMcpTools)}},[s,t,H]);const q=ue=>{L(ue),ue==="script"?N("genaiscript"):T==="genaiscript"&&N("claude-code")},ge=!s&&t===void 0,se=v.trim().length>0&&!ge&&S.trim().length>0&&(R==="script"?M.trim().length>0:!!T&&!!C),ce=s&&se,me=!s&&o===(t==null?void 0:t.id),xe=!s&&t&&!me&&R==="agent"&&!!T&&!!C,De=(ue,Ie)=>{if(!ue.trim())return`${Ie} is required`},ot=ue=>{if(ue.preventDefault(),!(ge||!se)){if(t){c(t.id,v,_,S,T,C,A,R,M).then(()=>{m("Persona updated","success"),f()},()=>{m("Failed to save persona","error")});return}r(v,_,S,T,C,A,R,M,Y).then(Ie=>{m("Persona created","success"),h(Bm(Ie.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},_t=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),f()},()=>{m("Failed to delete persona","error")})},lt=async(ue,Ie,ee,nt)=>ue().then(()=>{Ie(),m(ee,"success")},()=>{m(nt,"error")}),Pe=(ue,Ie)=>{if(!t)return;const ee=ue==="type"?String(Ie):R,nt=ue==="runtime"?String(Ie):ue==="type"?String(Ie)==="script"?"genaiscript":T==="genaiscript"?"claude-code":T:T,le=ue==="model"?String(Ie):C,ve=ue==="maxTurns"?Number(Ie):A,et=ue==="systemPrompt"?String(Ie):S,on=ue==="script"?String(Ie):M;lt(()=>c(t.id,ue==="name"?String(Ie):v,ue==="description"?String(Ie):_,et,nt,le,ve,ee,on),()=>{if(ue==="type"){const ks=String(Ie)==="script"?"script":"agent";L(ks),N(nt)}ue==="runtime"&&N(String(Ie)),ue==="name"&&b(String(Ie)),ue==="description"&&x(String(Ie)),ue==="systemPrompt"&&j(String(Ie)),ue==="model"&&D(String(Ie)),ue==="maxTurns"&&E(Number(Ie)),ue==="script"&&$(String(Ie))},"Persona updated","Failed to update persona").catch(()=>{})},ke=ue=>{ot(ue)},ct=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return a.jsxs(a.Fragment,{children:[ge?a.jsxs("div",{className:vs.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsx("p",{children:"Loading persona..."})]}):s?a.jsxs("form",{onSubmit:ke,className:vs.form,children:[a.jsx("h3",{children:"Create Persona"}),a.jsxs("div",{className:vs.typeToggle,"data-testid":"persona-type-toggle",children:[a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:R==="agent",onChange:()=>q("agent")}),"Agent"]}),a.jsxs("label",{children:[a.jsx("input",{type:"radio",name:"personaType",value:"script",checked:R==="script",onChange:()=>q("script")}),"Script"]})]}),a.jsxs("label",{children:["Name",a.jsx("input",{type:"text",value:v,onChange:ue=>b(ue.target.value),placeholder:R==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),a.jsxs("label",{children:["Description",a.jsx("input",{type:"text",value:_,onChange:ue=>x(ue.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Runtime",a.jsx("select",{value:T,onChange:ue=>N(ue.target.value),"data-testid":"persona-runtime-select",children:(R==="script"?L_:O_).map(ue=>a.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),R==="agent"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model",a.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["Max Turns",a.jsx("input",{type:"number",value:A,onChange:ue=>E(parseInt(ue.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),R==="script"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Model ",a.jsx("span",{className:vs.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:C,onChange:ue=>D(ue.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["System Prompt",a.jsx("textarea",{value:S,onChange:ue=>j(ue.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),a.jsxs("label",{children:["Script",a.jsx("textarea",{value:M,onChange:ue=>$(ue.target.value),placeholder:`script({ model: "openai:gpt-4o" });
767
+
768
+ const grackle = await host.mcpServer({
769
+ id: "grackle",
770
+ url: env.vars.GRACKLE_MCP_URL,
771
+ });
772
+
773
+ $\`Summarize the current tasks.\`;`,rows:20,className:vs.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),R==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(p_,{selectedTools:Y,onChange:U})]}),a.jsxs("div",{className:vs.formActions,children:[a.jsx(an,{type:"submit",variant:"primary",size:"md",disabled:!ce,"data-testid":"persona-detail-save",children:"Create"}),a.jsx(an,{type:"button",variant:"outline",size:"md",onClick:f,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:vs.form,children:[a.jsx("h3",{children:"Edit Persona"}),a.jsxs("div",{className:vs.formActions,children:[a.jsx(an,{type:"button",variant:"outline",size:"md",onClick:f,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),xe&&a.jsx(an,{type:"button",variant:"ghost",size:"md",onClick:ct,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),me&&a.jsx("span",{className:vs.defaultBadge,children:"App Default"}),a.jsx(an,{type:"button",variant:"danger",size:"md",onClick:()=>te(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:vs.editableSection,children:[a.jsxs("label",{children:["Name",a.jsx($t,{value:v,onSave:ue=>{Pe("name",ue)},validate:ue=>De(ue,"Name"),fieldId:"persona-name",activeFieldId:G,onActivate:ne,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),a.jsxs("label",{children:["Description",a.jsx($t,{value:_,onSave:ue=>{Pe("description",ue)},fieldId:"persona-description",activeFieldId:G,onActivate:ne,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),a.jsxs("label",{children:["Type",a.jsx(Sd,{value:R,onSave:ue=>{Pe("type",ue)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:G,onActivate:ne,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),a.jsxs("label",{children:["Runtime",a.jsx(Sd,{value:T,onSave:ue=>{Pe("runtime",ue)},options:R==="script"?L_:O_,fieldId:"persona-runtime",activeFieldId:G,onActivate:ne,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),a.jsxs("label",{children:["Model",R==="script"?" (optional)":"",a.jsx($t,{value:C,onSave:ue=>{Pe("model",ue)},validate:R==="agent"?ue=>De(ue,"Model"):void 0,fieldId:"persona-model",activeFieldId:G,onActivate:ne,placeholder:R==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),a.jsxs("label",{children:["Max Turns",a.jsx($t,{value:String(A),onSave:ue=>{Pe("maxTurns",parseInt(ue,10)||0)},validate:ue=>/^\d+$/.test(ue.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:G,onActivate:ne,placeholder:Hq,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),a.jsxs("label",{children:["System Prompt",a.jsx(vm,{value:S,onSave:ue=>{Pe("systemPrompt",ue)},validate:ue=>De(ue,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:G,onActivate:ne,placeholder:R==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),R==="script"&&a.jsxs("label",{children:["Script",a.jsx(vm,{value:M,onSave:ue=>{Pe("script",ue)},validate:ue=>De(ue,"Script"),fieldId:"persona-script",activeFieldId:G,onActivate:ne,placeholder:`script({ model: "openai:gpt-4o" });
774
+
775
+ const grackle = await host.mcpServer({
776
+ id: "grackle",
777
+ url: env.vars.GRACKLE_MCP_URL,
778
+ });
779
+
780
+ $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),R==="agent"&&a.jsxs("div",{children:[a.jsx("label",{children:"Allowed MCP Tools"}),a.jsx(p_,{selectedTools:Y,onChange:ue=>{U(ue),lt(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ue),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!xe&&!me&&a.jsx("p",{style:{fontSize:"var(--font-size-xs)",color:"var(--text-tertiary)",marginTop:"var(--space-xs)"},children:"Only agent personas with a runtime and model can be set as app default."})]}):null,a.jsx(_s,{isOpen:X,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:_t,onCancel:()=>te(!1)})]})}function Uq(){const{schedules:{schedules:t,deleteSchedule:s,updateSchedule:o},personas:{personas:r}}=mt(),{showToast:c}=mn(),d=kt();return a.jsx(cz,{schedules:t,personas:r,onDeleteSchedule:async u=>{try{await s(u)}catch(f){throw console.error("Failed to delete schedule",{scheduleId:u,error:f}),c("Failed to delete schedule","error"),f}},onToggleEnabled:async(u,f)=>{try{return await o(u,f)}catch(m){throw console.error("Failed to update schedule",{scheduleId:u,error:m}),c("Failed to update schedule","error"),m}},onNavigateToNew:()=>d(wC),onNavigateToSchedule:u=>d(bx(u))})}const Vq="_container_1g4qh_1",qq="_form_1g4qh_7",Gq="_formActions_1g4qh_66",Fq="_editableSection_1g4qh_73",Kq="_helperText_1g4qh_84",Zq="_metaSection_1g4qh_90",Yq="_optional_1g4qh_108",Jq="_readonlyValue_1g4qh_113",Bn={container:Vq,form:qq,formActions:Gq,editableSection:Fq,helperText:Kq,metaSection:Zq,optional:Yq,readonlyValue:Jq};function z_(){const{scheduleId:t}=$s(),s=kt(),{showToast:o}=mn(),{schedules:{schedules:r,schedulesLoading:c,createSchedule:d,updateSchedule:u,deleteSchedule:f},personas:{personas:m},workspaces:{workspaces:h}}=mt(),v=t===void 0,b=v?void 0:r.find(x=>x.id===t);if(!v&&!c&&r.length>0&&!b)return a.jsx(gn,{to:ip,replace:!0});const _=[{label:"Settings",url:Bo},{label:"Schedules",url:ip},{label:v?"New Schedule":(b==null?void 0:b.title)??"Schedule",url:void 0}];return a.jsxs("div",{className:Bn.container,children:[a.jsx(Hs,{segments:_}),a.jsx(Wq,{existing:b,isNew:v,personas:m,workspaces:h,onCreateSchedule:d,onUpdateSchedule:u,onDeleteSchedule:f,onDone:()=>{s(ip)},showToast:o})]})}function Wq({existing:t,isNew:s,personas:o,workspaces:r,onCreateSchedule:c,onUpdateSchedule:d,onDeleteSchedule:u,onDone:f,showToast:m}){var H;const h=kt(),[v,b]=y.useState((t==null?void 0:t.title)??""),[_,x]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.scheduleExpression)??""),[T,N]=y.useState((t==null?void 0:t.personaId)??""),[C,D]=y.useState((t==null?void 0:t.workspaceId)??""),[A,E]=y.useState(!1),[R,L]=y.useState(null);y.useEffect(()=>{s||t&&R===null&&(b(t.title),x(t.description),j(t.scheduleExpression),N(t.personaId),D(t.workspaceId))},[s,t,R]);const M=!s&&t===void 0,$=s&&v.trim().length>0&&S.trim().length>0&&T.length>0,Y=o.map(O=>({value:O.id,label:O.name})),U=[{value:"",label:"System-level (no workspace)"},...r.map(O=>({value:O.id,label:O.name}))],X=O=>{O.preventDefault(),$&&c(v,_,S,T,C||void 0).then(q=>{m("Schedule created","success"),h(bx(q.id),{replace:!0})},()=>{m("Failed to create schedule","error")})},te=(O,q)=>{t&&d(t.id,{[O]:q}).then(()=>{m("Schedule updated","success"),O==="title"&&b(String(q)),O==="description"&&x(String(q)),O==="scheduleExpression"&&j(String(q)),O==="personaId"&&N(String(q))},()=>{m("Failed to update schedule","error")})},G=()=>{if(!t)return;const O=!t.enabled;d(t.id,{enabled:O}).then(()=>{m(O?"Schedule enabled":"Schedule disabled","success")},()=>{m("Failed to update schedule","error")})},ne=()=>{t&&u(t.id).then(()=>{m("Schedule deleted","success"),f()},()=>{m("Failed to delete schedule","error")})};return a.jsxs(a.Fragment,{children:[M?a.jsxs("div",{className:Bn.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsx("p",{children:"Loading schedule..."})]}):s?a.jsxs("form",{onSubmit:X,className:Bn.form,children:[a.jsx("h3",{children:"Create Schedule"}),a.jsxs("label",{children:["Title",a.jsx("input",{type:"text",value:v,onChange:O=>b(O.target.value),placeholder:"e.g. Nightly Review",required:!0,"data-testid":"schedule-detail-title"})]}),a.jsxs("label",{children:["Description ",a.jsx("span",{className:Bn.optional,children:"(optional)"}),a.jsx("input",{type:"text",value:_,onChange:O=>x(O.target.value),placeholder:"Brief description...","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.jsx("input",{type:"text",value:S,onChange:O=>j(O.target.value),placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",required:!0,"data-testid":"schedule-detail-expression"}),a.jsxs("p",{className:Bn.helperText,children:["Interval: ",a.jsx("code",{children:"30s"}),", ",a.jsx("code",{children:"5m"}),", ",a.jsx("code",{children:"1h"}),", ",a.jsx("code",{children:"1d"})," (min 10s)  |  Cron: ",a.jsx("code",{children:"0 9 * * MON"})," (standard 5-field cron syntax)"]})]}),a.jsxs("label",{children:["Persona",a.jsxs("select",{value:T,onChange:O=>N(O.target.value),required:!0,"data-testid":"schedule-detail-persona",children:[a.jsx("option",{value:"",children:"Select a persona..."}),Y.map(O=>a.jsx("option",{value:O.value,children:O.label},O.value))]})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:Bn.optional,children:"(optional)"}),a.jsx("select",{value:C,onChange:O=>D(O.target.value),"data-testid":"schedule-detail-workspace",children:U.map(O=>a.jsx("option",{value:O.value,children:O.label},O.value))})]}),a.jsxs("div",{className:Bn.formActions,children:[a.jsx(an,{type:"submit",variant:"primary",size:"md",disabled:!$,"data-testid":"schedule-detail-save",children:"Create"}),a.jsx(an,{type:"button",variant:"outline",size:"md",onClick:f,"data-testid":"schedule-detail-cancel",children:"Cancel"})]})]}):t?a.jsxs("div",{className:Bn.form,children:[a.jsx("h3",{children:"Edit Schedule"}),a.jsxs("div",{className:Bn.formActions,children:[a.jsx(an,{type:"button",variant:"outline",size:"md",onClick:f,"data-testid":"schedule-detail-cancel",children:"Back to Schedules"}),a.jsx(an,{type:"button",variant:t.enabled?"ghost":"primary",size:"md",onClick:G,"data-testid":"schedule-detail-toggle",children:t.enabled?"Disable":"Enable"}),a.jsx(an,{type:"button",variant:"danger",size:"md",onClick:()=>E(!0),"data-testid":"schedule-detail-delete",children:"Delete"})]}),a.jsxs("div",{className:Bn.editableSection,children:[a.jsxs("label",{children:["Title",a.jsx($t,{value:v,onSave:O=>{te("title",O)},validate:O=>O.trim()?void 0:"Title is required",fieldId:"schedule-title",activeFieldId:R,onActivate:L,ariaLabel:"Schedule title","data-testid":"schedule-detail-title"})]}),a.jsxs("label",{children:["Description",a.jsx($t,{value:_,onSave:O=>{te("description",O)},fieldId:"schedule-description",activeFieldId:R,onActivate:L,placeholder:"Brief description...",ariaLabel:"Schedule description","data-testid":"schedule-detail-description"})]}),a.jsxs("label",{children:["Schedule Expression",a.jsx($t,{value:S,onSave:O=>{te("scheduleExpression",O)},validate:O=>O.trim()?void 0:"Schedule expression is required",fieldId:"schedule-expression",activeFieldId:R,onActivate:L,placeholder:"e.g. 30s, 5m, 1h, or 0 9 * * MON",ariaLabel:"Schedule expression","data-testid":"schedule-detail-expression"})]}),a.jsxs("label",{children:["Persona",a.jsx(Sd,{value:T,onSave:O=>{te("personaId",O)},options:Y,fieldId:"schedule-persona",activeFieldId:R,onActivate:L,ariaLabel:"Schedule persona","data-testid":"schedule-detail-persona"})]}),a.jsxs("label",{children:["Workspace ",a.jsx("span",{className:Bn.optional,children:"(optional — set at creation)"}),a.jsx("span",{className:Bn.readonlyValue,"data-testid":"schedule-detail-workspace",children:((H=r.find(O=>O.id===t.workspaceId))==null?void 0:H.name)??"System-level (no workspace)"})]})]}),a.jsxs("div",{className:Bn.metaSection,children:[t.lastRunAt?a.jsxs("span",{children:["Last run: ",gm(t.lastRunAt)]}):a.jsx("span",{children:"Last run: Never"}),t.enabled&&t.nextRunAt?a.jsxs("span",{children:["Next run: ",ik(t.nextRunAt)]}):null,t.runCount>0&&a.jsxs("span",{children:["Total runs: ",t.runCount]}),a.jsxs("span",{children:["Created: ",gm(t.createdAt)]})]})]}):null,a.jsx(_s,{isOpen:A,title:"Delete Schedule?",description:`"${t==null?void 0:t.title}" will be permanently removed. Tasks already created by this schedule will not be affected.`,confirmLabel:"Delete",onConfirm:ne,onCancel:()=>E(!1)})]})}function Xq(){const{themeId:t,resolvedThemeId:s,setTheme:o,preferSystem:r,setPreferSystem:c}=Sh();return a.jsx(TB,{themeId:t,resolvedThemeId:s,onSetTheme:o,preferSystem:r,onSetPreferSystem:c})}function Qq(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let o=!1;return(async()=>{try{const c=await Le.getVersionStatus({});o||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{o=!0}},[]),t}function eG(){const{connectionStatus:t,environments:{environments:s},sessions:{sessions:o}}=mt(),r=Qq();return a.jsxs(a.Fragment,{children:[r&&a.jsx(LL,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),a.jsx(CB,{connectionStatus:t,environments:s,sessions:o})]})}function tG(){return a.jsx(b7,{})}function nG(){const{plugins:{plugins:t,pluginsLoading:s,setPluginEnabled:o}}=mt();return a.jsx(V8,{plugins:t,loading:s,onSetPluginEnabled:(r,c)=>{o(r,c).catch(()=>{})}})}const $_=Oi();function sG(){const t=kt();return Xa({key:"?"},()=>{t(CC)}),Xa({key:"n"},()=>{t($_)}),Xa({key:"N"},()=>{t($_)}),a.jsx(a.Fragment,{})}function Pd(t){const s=eH();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function aG(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=mt(),o=y.useMemo(()=>a.jsx(fL,{workspaces:t,tasks:s}),[t,s]);return Pd(o),a.jsx(Ii,{})}function iG(){const{environments:{environments:t}}=mt(),s=y.useMemo(()=>a.jsx(RO,{environments:t}),[t]);return Pd(s),a.jsx(Ii,{})}function oG(){const t=y.useMemo(()=>a.jsx(mz,{}),[]);return Pd(t),a.jsx(Ii,{})}function rG(){const{knowledge:t,workspaces:{workspaces:s}}=mt(),o=y.useCallback(f=>{t.search(f).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(f=>{t.selectNode(f).catch(()=>{})},[t]),d=y.useCallback(f=>{t.loadRecent(f||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>a.jsx(D5,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:o,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,o,r,c,d]);return Pd(u),a.jsx(Ii,{})}const lG="_wizard_1260s_1",cG="_container_1260s_10",dG="_stepContent_1260s_19",uG="_logoArea_1260s_28",fG="_logoImage_1260s_32",pG="_heading_1260s_41",mG="_tagline_1260s_49",hG="_subtitle_1260s_56",gG="_featureList_1260s_64",vG="_runtimeGrid_1260s_89",yG="_runtimeCard_1260s_101",bG="_runtimeName_1260s_133",_G="_runtimeDescription_1260s_139",xG="_buttonRow_1260s_144",kG="_primaryButton_1260s_151",SG="_ghostButton_1260s_185",jG="_dots_1260s_213",TG="_dot_1260s_213",Xe={wizard:lG,container:cG,stepContent:dG,logoArea:uG,logoImage:fG,heading:pG,tagline:mG,subtitle:hG,featureList:gG,runtimeGrid:vG,runtimeCard:yG,runtimeName:bG,runtimeDescription:_G,buttonRow:xG,primaryButton:kG,ghostButton:SG,dots:jG,dot:TG};function NG({onNext:t}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-welcome",children:[a.jsx("div",{className:Xe.logoArea,children:a.jsx("img",{src:zd("grackle-logo.png"),alt:"Grackle",className:Xe.logoImage})}),a.jsx("h1",{className:Xe.heading,children:"Welcome to Grackle"}),a.jsx("p",{className:Xe.tagline,children:"Multi-agent orchestration for software teams"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function wG({onNext:t,onBack:s}){return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-about",children:[a.jsx("h2",{className:Xe.heading,children:"What is Grackle?"}),a.jsxs("ul",{className:Xe.featureList,children:[a.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),a.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),a.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),a.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),a.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const CG=[{id:"claude-code",name:"Claude Code",description:"Anthropic's agentic coding tool"},{id:"copilot",name:"Copilot Coding Agent",description:"GitHub's AI pair programmer"},{id:"codex",name:"Codex CLI",description:"OpenAI's coding agent"},{id:"goose",name:"Goose",description:"Block's open-source AI coding agent"}];function EG({currentRuntime:t,onFinish:s,onBack:o,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-runtime",children:[a.jsx("h2",{className:Xe.heading,children:"Choose Your Runtime"}),a.jsx("p",{className:Xe.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),a.jsx("div",{className:Xe.runtimeGrid,children:CG.map(u=>a.jsxs("button",{type:"button",className:Xe.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[a.jsx("span",{className:Xe.runtimeName,children:u.name}),a.jsx("span",{className:Xe.runtimeDescription,children:u.description})]},u.id))}),a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:o,children:"Back"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-runtime-next",children:"Next"})]})]})}function AG(){return typeof Notification<"u"}function DG({onFinish:t,onBack:s,finishDisabled:o}){const r=AG(),c=r&&Notification.permission!=="default";function d(){r&&Notification.requestPermission().catch(()=>{}),t()}return a.jsxs("div",{className:Xe.stepContent,"data-testid":"setup-notifications",children:[a.jsx("h2",{className:Xe.heading,children:"Stay in the Loop"}),a.jsx("p",{className:Xe.subtitle,children:"Grackle can send you a browser notification when an agent needs your input, so you never miss an important moment."}),c?a.jsx("p",{className:Xe.subtitle,children:Notification.permission==="granted"?"Notifications are already enabled.":"Notifications have been blocked. You can change this in your browser settings."}):null,a.jsxs("div",{className:Xe.buttonRow,children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:s,disabled:o,children:"Back"}),!c&&r?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:Xe.ghostButton,onClick:t,disabled:o,"data-testid":"setup-notifications-skip",children:"Skip"}),a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:d,disabled:o,"data-testid":"setup-notifications-enable",children:"Enable Notifications"})]}):a.jsx("button",{type:"button",className:Xe.primaryButton,onClick:t,disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const MG=4,H_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function RG(){const{personas:{personas:t,updatePersona:s},completeOnboarding:o,onboardingCompleted:r}=mt(),{showToast:c}=mn(),d=kt(),[u,f]=y.useState(0),[m,h]=y.useState("claude-code"),[v,b]=y.useState(!1),_=t.find(j=>j.id==="claude-code"),x=y.useCallback(j=>{h(j),f(3)},[]),S=y.useCallback(()=>{const j=m;b(!0);const T=[];if(_&&j!==_.runtime){const C=H_[j]??"sonnet";T.push(s(_.id,void 0,void 0,void 0,j,C))}const N=t.find(C=>C.id===yy);if(N&&j!==N.runtime){const C=H_[j]??"sonnet";T.push(s(yy,void 0,void 0,void 0,j,C))}Promise.all(T).then(()=>o()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),b(!1)})},[m,_,t,s,o,d,c]);return r===!0?a.jsx(gn,{to:"/",replace:!0}):a.jsx("div",{className:Xe.wizard,"data-testid":"setup-wizard",children:a.jsxs("div",{className:Xe.container,children:[a.jsx(rs,{mode:"wait",children:a.jsxs(Ut.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&a.jsx(NG,{onNext:()=>f(1)}),u===1&&a.jsx(wG,{onNext:()=>f(2),onBack:()=>f(0)}),u===2&&a.jsx(EG,{currentRuntime:m,onFinish:x,onBack:()=>f(1),finishDisabled:!_}),u===3&&a.jsx(DG,{onFinish:S,onBack:()=>f(2),finishDisabled:v})]},u)}),a.jsx("div",{className:Xe.dots,children:Array.from({length:MG},(j,T)=>a.jsx("span",{className:Xe.dot,"data-active":T===u},T))})]})})}const IG="_root_4itox_1",OG="_shell_4itox_7",LG="_contextPane_4itox_14",BG="_body_4itox_22",zG="_main_4itox_34",$G="_sidebarWrapper_4itox_41",HG="_contextNavWrapper_4itox_66",PG="_overlay_4itox_91",da={root:IG,shell:OG,contextPane:LG,body:BG,main:zG,sidebarWrapper:$G,contextNavWrapper:HG,overlay:PG},UG=y.lazy(()=>wm(()=>import("./KnowledgePage-BiRwaek_.js"),__vite__mapDeps([3,1,2,4,5])).then(t=>({default:t.KnowledgePage}))),VG=y.lazy(()=>wm(()=>import("./SessionsListPage-FmlKSLrz.js"),__vite__mapDeps([6,1,2,4,7])).then(t=>({default:t.SessionsListPage}))),P_=768,Lk=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function qG({tabs:t}){const{connectionStatus:s,environments:{environments:o},sessions:{sessions:r},tasks:{tasks:c}}=mt(),{toasts:d,dismissToast:u}=mn(),f=Wt(),m=Q9(),h=m!==void 0,[v,b]=y.useState(!1),_=y.useCallback(()=>b(R=>!R),[]),[x,S]=y.useState(!1),[j,T]=y.useState(!1),N=y.useCallback(()=>S(R=>!R),[]),C=y.useCallback(()=>T(R=>!R),[]),[D,A]=y.useState(()=>window.matchMedia(`(max-width: ${P_}px)`).matches);y.useEffect(()=>{const R=window.matchMedia(`(max-width: ${P_}px)`),L=M=>{A(M.matches)};return R.addEventListener("change",L),()=>{R.removeEventListener("change",L)}},[]);const E=y.useCallback(()=>S(!1),[]);return y.useEffect(()=>{b(!1),S(!1)},[f.pathname]),y.useEffect(()=>{if(!v&&!x)return;const R=L=>{L.key==="Escape"&&(b(!1),S(!1))};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R)}},[v,x]),a.jsxs(a.Fragment,{children:[a.jsx(G5,{connectionStatus:s,environments:o,sessions:r,onToggleSidebar:h?_:void 0,sidebarOpen:v,onToggleContextNav:N,contextNavOpen:x}),a.jsxs("div",{className:da.shell,children:[a.jsx("div",{className:da.contextNavWrapper,"data-context-nav-open":x,children:a.jsx(cO,{contexts:lO,activeContextId:rk,onSelectContext:E,collapsed:D?!1:j,onToggleCollapsed:D?void 0:C})}),x&&a.jsx("div",{className:da.overlay,"data-testid":"context-nav-overlay",onClick:()=>S(!1)}),a.jsxs("div",{className:da.contextPane,children:[a.jsx(Q5,{tabs:t}),a.jsxs("div",{className:da.body,children:[h&&a.jsx("div",{className:da.sidebarWrapper,"data-sidebar-open":v,children:a.jsx(hO,{content:m})}),h&&v&&a.jsx("div",{className:da.overlay,"data-testid":"drawer-overlay",onClick:()=>b(!1)}),a.jsxs("div",{className:da.main,children:[a.jsx(Ii,{}),a.jsx(SO,{sessions:r,tasks:c,environments:o})]})]})]})]}),a.jsx(TL,{toasts:d,onDismiss:u}),a.jsx(sG,{})]})}function GG(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:o,clearOperationError:r},tasks:{tasks:c},connectionStatus:d,onboardingCompleted:u}=mt(),{pluginNames:f}=Hd(),{showToast:m}=mn();fP(s,m),vP(c,m),pP(o,r,m);const h=kt(),v=Wt(),b=y.useRef(void 0);if(y.useEffect(()=>{t&&t!==b.current&&!v.pathname.includes("/tasks/")&&(b.current=t,h(yl(t),{replace:!0}))},[t,h,v.pathname]),d==="connected"&&u===!1)return a.jsx(gn,{to:"/setup",replace:!0});const _=LH(f);return a.jsx(X9,{children:a.jsxs("div",{className:da.root,children:[Lk&&a.jsx(sE,{}),a.jsx(qG,{tabs:_})]})})}function qp(){const{workspaceId:t}=$s(),{workspaces:{workspaces:s}}=mt(),o=Wt(),r=s.find(h=>h.id===t),c=r!=null&&r.linkedEnvironmentIds?[...r.linkedEnvironmentIds].sort()[0]:void 0;if(!c)return s.length===0?void 0:a.jsx(gn,{to:"/environments",replace:!0});const d=encodeURIComponent(t),u=`/workspaces/${d}`,f=o.pathname.startsWith(u)?o.pathname.slice(u.length):"",m=`/environments/${encodeURIComponent(c)}/workspaces/${d}${f}${o.search}${o.hash}`;return a.jsx(gn,{to:m,replace:!0})}function FG(){const{personaId:t}=$s();return a.jsx(gn,{to:Bm(t??""),replace:!0})}function KG(){const{pluginNames:t}=Hd(),s=t.includes("orchestration"),o=t.includes("knowledge");return a.jsxs(Uw,{children:[a.jsx(we,{path:"setup",element:a.jsx(RG,{})}),a.jsxs(we,{element:a.jsx(GG,{}),children:[a.jsx(we,{index:!0,element:a.jsx(tV,{})}),a.jsx(we,{path:"sessions/new",element:a.jsx(xV,{})}),a.jsx(we,{path:"chat",element:a.jsx(uV,{})}),a.jsx(we,{path:"chat/:streamId",element:a.jsx(gn,{to:"/coordination",replace:!0})}),a.jsx(we,{path:"coordination",element:a.jsx(_V,{})}),a.jsx(we,{path:"sessions",element:a.jsx(y.Suspense,{fallback:a.jsx(hm,{}),children:a.jsx(VG,{})})}),a.jsx(we,{path:"sessions/:sessionId",element:a.jsx(TV,{})}),o&&a.jsx(we,{element:a.jsx(rG,{}),children:a.jsx(we,{path:"knowledge",element:a.jsx(y.Suspense,{fallback:a.jsx(hm,{}),children:a.jsx(UG,{})})})}),s&&a.jsxs(a.Fragment,{children:[a.jsxs(we,{element:a.jsx(aG,{}),children:[a.jsx(we,{path:"tasks",element:a.jsx(QU,{})}),a.jsx(we,{path:"tasks/new",element:a.jsx(R_,{})}),a.jsx(we,{path:"tasks/:taskId",element:a.jsx(Ao,{})}),a.jsx(we,{path:"tasks/:taskId/edit",element:a.jsx(Ao,{})}),a.jsx(we,{path:"tasks/:taskId/stream",element:a.jsx(Ao,{})})]}),a.jsx(we,{path:"personas",element:a.jsx(Dq,{})}),a.jsx(we,{path:"personas/new",element:a.jsx(B_,{})}),a.jsx(we,{path:"personas/:personaId",element:a.jsx(B_,{})})]}),a.jsxs(we,{element:a.jsx(iG,{}),children:[a.jsx(we,{path:"workspaces",element:a.jsx(gn,{to:"/environments",replace:!0})}),a.jsx(we,{path:"workspaces/new",element:a.jsx(HV,{})}),a.jsx(we,{path:"workspaces/:workspaceId",element:a.jsx(qp,{})}),a.jsx(we,{path:"workspaces/:workspaceId/tasks/:taskId",element:a.jsx(qp,{})}),a.jsx(we,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:a.jsx(qp,{})}),a.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId",element:a.jsx(EV,{})}),a.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:a.jsx(R_,{})}),a.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:a.jsx(Ao,{})}),a.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:a.jsx(Ao,{})}),a.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:a.jsx(Ao,{})}),a.jsxs(we,{path:"environments",element:a.jsx(KV,{}),children:[a.jsx(we,{index:!0,element:a.jsx(eV,{})}),a.jsx(we,{path:"new",element:a.jsx(UV,{})}),a.jsx(we,{path:":environmentId",element:a.jsx(Sq,{})}),a.jsx(we,{path:":environmentId/edit",element:a.jsx(VV,{})})]})]}),a.jsx(we,{element:a.jsx(oG,{}),children:a.jsxs(we,{path:"settings",element:a.jsx(Nq,{}),children:[a.jsx(we,{index:!0,element:a.jsx(gn,{to:"credentials",replace:!0})}),a.jsx(we,{path:"environments",element:a.jsx(gn,{to:"/environments",replace:!0})}),a.jsx(we,{path:"credentials",element:a.jsx(wq,{})}),a.jsx(we,{path:"github-accounts",element:a.jsx(Cq,{})}),a.jsx(we,{path:"tokens",element:a.jsx(gn,{to:"../credentials",replace:!0})}),a.jsx(we,{path:"schedules",element:a.jsx(Uq,{})}),a.jsx(we,{path:"schedules/new",element:a.jsx(z_,{})}),a.jsx(we,{path:"schedules/:scheduleId",element:a.jsx(z_,{})}),a.jsx(we,{path:"appearance",element:a.jsx(Xq,{})}),a.jsx(we,{path:"shortcuts",element:a.jsx(tG,{})}),a.jsx(we,{path:"plugins",element:a.jsx(nG,{})}),a.jsx(we,{path:"about",element:a.jsx(eG,{})})]})}),a.jsx(we,{path:"settings/personas",element:a.jsx(gn,{to:"/personas",replace:!0})}),a.jsx(we,{path:"settings/personas/new",element:a.jsx(gn,{to:"/personas/new",replace:!0})}),a.jsx(we,{path:"settings/personas/:personaId",element:a.jsx(FG,{})}),a.jsx(we,{path:"*",element:a.jsx(gn,{to:"/",replace:!0})})]})]})}const ZG=1e4;function YG(){const{onboardingCompleted:t}=mt(),[s,o]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>o(!0),ZG);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return a.jsx(rs,{mode:"wait",children:r?a.jsx(Ut.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:a.jsx(hm,{})},"splash"):a.jsx(Ut.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:a.jsx(pC,{basename:"/".replace(/\/$/,""),children:a.jsx(KG,{})})},"app")})}function JG(){const t=Lk?EH:uP;return a.jsx(MH,{children:a.jsx(W9,{children:a.jsx(K9,{children:a.jsx(t,{children:a.jsx(YG,{})})})})})}jj.createRoot(document.getElementById("root")).render(a.jsx(y.StrictMode,{children:a.jsx(JG,{})}));export{rs as A,Hs as B,va as C,Ye as I,Sx as K,YT as M,Gp as S,mt as a,Dp as b,Me as c,W_ as d,Uo as e,gm as f,Rs as g,rT as h,Ut as m,yl as s,cs as t,kt as u};
781
+ //# sourceMappingURL=index-B3TTNeHW.js.map