@grackle-ai/web 0.91.2 → 0.91.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,715 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-BCqkL9CZ.js","assets/dagview-tHPW3Rz3.js","assets/grpc-CbbuZL-C.js","assets/markdown-Yr3vTPLR.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as YS,a as JS,b as y,j as o,d as H0,H as q0,P as G0,i as WS,B as XS,c as QS,C as eT,M as tT,e as nT}from"./dagview-tHPW3Rz3.js";import{c as sT,a as aT,G as iT,f as oT,M as rT,A as n_,D as s_,W as lT,O as cT,b as dT,C as Qr,d as uT,e as a_,w as fT,t as pT,p as Sc,g as mT,R as Tr,S as F0}from"./grpc-CbbuZL-C.js";import{v as hT,r as gT,t as Tc,i as vT,f as yT,M as cd,a as dd}from"./markdown-Yr3vTPLR.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 i(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=i(c);fetch(c.href,d)}})();var Mf={exports:{}},wr={},If={exports:{}},Of={};/**
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 Z0;function bT(){return Z0||(Z0=1,(function(t){function s(O,Z){var se=O.length;O.push(Z);e:for(;0<se;){var ue=se-1>>>1,de=O[ue];if(0<c(de,Z))O[ue]=Z,O[se]=de,se=ue;else break e}}function i(O){return O.length===0?null:O[0]}function r(O){if(O.length===0)return null;var Z=O[0],se=O.pop();if(se!==Z){O[0]=se;e:for(var ue=0,de=O.length,Ge=de>>>1;ue<Ge;){var De=2*(ue+1)-1,Ne=O[De],Oe=De+1,fe=O[Oe];if(0>c(Ne,se))Oe<de&&0>c(fe,Ne)?(O[ue]=fe,O[Oe]=se,ue=Oe):(O[ue]=Ne,O[De]=se,ue=De);else if(Oe<de&&0>c(fe,se))O[ue]=fe,O[Oe]=se,ue=Oe;else break e}}return Z}function c(O,Z){var se=O.sortIndex-Z.sortIndex;return se!==0?se:O.id-Z.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,p=u.now();t.unstable_now=function(){return u.now()-p}}var m=[],g=[],v=1,b=null,_=3,k=!1,S=!1,j=!1,N=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function D(O){for(var Z=i(g);Z!==null;){if(Z.callback===null)r(g);else if(Z.startTime<=O)r(g),Z.sortIndex=Z.expirationTime,s(m,Z);else break;Z=i(g)}}function R(O){if(j=!1,D(O),!S)if(i(m)!==null)S=!0,L||(L=!0,X());else{var Z=i(g);Z!==null&&re(R,Z.startTime-O)}}var L=!1,A=-1,U=5,F=-1;function ee(){return N?!0:!(t.unstable_now()-F<U)}function q(){if(N=!1,L){var O=t.unstable_now();F=O;var Z=!0;try{e:{S=!1,j&&(j=!1,C(A),A=-1),k=!0;var se=_;try{t:{for(D(O),b=i(m);b!==null&&!(b.expirationTime>O&&ee());){var ue=b.callback;if(typeof ue=="function"){b.callback=null,_=b.priorityLevel;var de=ue(b.expirationTime<=O);if(O=t.unstable_now(),typeof de=="function"){b.callback=de,D(O),Z=!0;break t}b===i(m)&&r(m),D(O)}else r(m);b=i(m)}if(b!==null)Z=!0;else{var Ge=i(g);Ge!==null&&re(R,Ge.startTime-O),Z=!1}}break e}finally{b=null,_=se,k=!1}Z=void 0}}finally{Z?X():L=!1}}}var X;if(typeof E=="function")X=function(){E(q)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,Q=ae.port2;ae.port1.onmessage=q,X=function(){Q.postMessage(null)}}else X=function(){T(q,0)};function re(O,Z){A=T(function(){O(t.unstable_now())},Z)}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(O){O.callback=null},t.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<O?Math.floor(1e3/O):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(O){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var se=_;_=Z;try{return O()}finally{_=se}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(O,Z){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var se=_;_=O;try{return Z()}finally{_=se}},t.unstable_scheduleCallback=function(O,Z,se){var ue=t.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ue+se:ue):se=ue,O){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=se+de,O={id:v++,callback:Z,priorityLevel:O,startTime:se,expirationTime:de,sortIndex:-1},se>ue?(O.sortIndex=se,s(g,O),i(m)===null&&O===i(g)&&(j?(C(A),A=-1):j=!0,re(R,se-ue))):(O.sortIndex=de,s(m,O),S||k||(S=!0,L||(L=!0,X()))),O},t.unstable_shouldYield=ee,t.unstable_wrapCallback=function(O){var Z=_;return function(){var se=_;_=Z;try{return O.apply(this,arguments)}finally{_=se}}}})(Of)),Of}var K0;function _T(){return K0||(K0=1,If.exports=bT()),If.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 Y0;function xT(){if(Y0)return wr;Y0=1;var t=_T(),s=YS(),i=JS();function r(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)n+="&args[]="+encodeURIComponent(arguments[a])}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,a=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(a=n.return),e=n.return;while(e)}return n.tag===3?a: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 p(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 g(e){var n=e.alternate;if(!n){if(n=d(e),n===null)throw Error(r(188));return n!==e?null:e}for(var a=e,l=n;;){var f=a.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===a)return m(f),e;if(h===l)return m(f),n;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=h;else{for(var x=!1,w=f.child;w;){if(w===a){x=!0,a=f,l=h;break}if(w===l){x=!0,l=f,a=h;break}w=w.sibling}if(!x){for(w=h.child;w;){if(w===a){x=!0,a=h,l=f;break}if(w===l){x=!0,l=h,a=f;break}w=w.sibling}if(!x)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?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"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),F=Symbol.for("react.activity"),ee=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function X(e){return e===null||typeof e!="object"?null:(e=q&&e[q]||e["@@iterator"],typeof e=="function"?e:null)}var ae=Symbol.for("react.client.reference");function Q(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case R:return"Suspense";case L:return"SuspenseList";case F:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case S:return"Portal";case E:return e.displayName||"Context";case C:return(e._context.displayName||"Context")+".Consumer";case D:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return n=e.displayName||null,n!==null?n:Q(e.type)||"Memo";case U:n=e._payload,e=e._init;try{return Q(e(n))}catch{}}return null}var re=Array.isArray,O=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ue=[],de=-1;function Ge(e){return{current:e}}function De(e){0>de||(e.current=ue[de],ue[de]=null,de--)}function Ne(e,n){de++,ue[de]=e.current,e.current=n}var Oe=Ge(null),fe=Ge(null),ye=Ge(null),me=Ge(null);function Ue(e,n){switch(Ne(ye,n),Ne(fe,e),Ne(Oe,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?f0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=f0(n),e=p0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}De(Oe),Ne(Oe,e)}function pt(){De(Oe),De(fe),De(ye)}function bn(e){e.memoizedState!==null&&Ne(me,e);var n=Oe.current,a=p0(n,e.type);n!==a&&(Ne(fe,e),Ne(Oe,a))}function ie(e){fe.current===e&&(De(Oe),De(fe)),me.current===e&&(De(me),_r._currentValue=se)}var W,ct;function Le(e){if(W===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);W=n&&n[1]||"",ct=-1<a.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+W+e+ct}var $t=!1;function dt(e,n){if(!e||$t)return"";$t=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(K){var G=K}Reflect.construct(e,[],te)}else{try{te.call()}catch(K){G=K}e.call(te.prototype)}}else{try{throw Error()}catch(K){G=K}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),x=h[0],w=h[1];if(x&&w){var M=x.split(`
21
- `),H=w.split(`
22
- `);for(f=l=0;l<M.length&&!M[l].includes("DetermineComponentFrameRoot");)l++;for(;f<H.length&&!H[f].includes("DetermineComponentFrameRoot");)f++;if(l===M.length||f===H.length)for(l=M.length-1,f=H.length-1;1<=l&&0<=f&&M[l]!==H[f];)f--;for(;1<=l&&0<=f;l--,f--)if(M[l]!==H[f]){if(l!==1||f!==1)do if(l--,f--,0>f||M[l]!==H[f]){var Y=`
23
- `+M[l].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=l&&0<=f);break}}}finally{$t=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Le(a):""}function ta(e,n){switch(e.tag){case 26:case 27:case 5:return Le(e.type);case 16:return Le("Lazy");case 13:return e.child!==n&&n!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return dt(e.type,!1);case 11:return dt(e.type.render,!1);case 1:return dt(e.type,!0);case 31:return Le("Activity");default:return""}}function ks(e){try{var n="",a=null;do n+=ta(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var _n=Object.prototype.hasOwnProperty,Ss=t.unstable_scheduleCallback,us=t.unstable_cancelCallback,wi=t.unstable_shouldYield,Wn=t.unstable_requestPaint,_e=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,on=t.unstable_ImmediatePriority,xn=t.unstable_UserBlockingPriority,In=t.unstable_NormalPriority,ji=t.unstable_LowPriority,Pa=t.unstable_IdlePriority,Ni=t.log,Ci=t.unstable_setDisableYieldValue,na=null,tn=null;function Xn(e){if(typeof Ni=="function"&&Ci(e),tn&&typeof tn.setStrictMode=="function")try{tn.setStrictMode(na,e)}catch{}}var nn=Math.clz32?Math.clz32:dl,ll=Math.log,cl=Math.LN2;function dl(e){return e>>>=0,e===0?32:31-(ll(e)/cl|0)|0}var Va=256,Ha=262144,qa=4194304;function Ts(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 P(e,n,a){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,x=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~h,l!==0?f=Ts(l):(x&=w,x!==0?f=Ts(x):a||(a=w&~e,a!==0&&(f=Ts(a))))):(w=l&~h,w!==0?f=Ts(w):x!==0?f=Ts(x):a||(a=l&~e,a!==0&&(f=Ts(a)))),f===0?0:n!==0&&n!==f&&(n&h)===0&&(h=f&-f,a=n&-n,h>=a||h===32&&(a&4194048)!==0)?n:f}function ne(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function le(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 pe(){var e=qa;return qa<<=1,(qa&62914560)===0&&(qa=4194304),e}function he(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function $e(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ke(e,n,a,l,f,h){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,M=e.expirationTimes,H=e.hiddenUpdates;for(a=x&~a;0<a;){var Y=31-nn(a),te=1<<Y;w[Y]=0,M[Y]=-1;var G=H[Y];if(G!==null)for(H[Y]=null,Y=0;Y<G.length;Y++){var K=G[Y];K!==null&&(K.lane&=-536870913)}a&=~te}l!==0&&Re(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(x&~n))}function Re(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-nn(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Ze(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-nn(a),f=1<<l;f&n|e[l]&n&&(e[l]|=n),a&=~f}}function ut(e,n){var a=n&-n;return a=(a&42)!==0?1:Ke(a),(a&(e.suspendedLanes|n))!==0?0:a}function Ke(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 Pt(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Kt(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:L0(e.type))}function At(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var rn=Math.random().toString(36).slice(2),ht="__reactFiber$"+rn,qt="__reactProps$"+rn,Ei="__reactContainer$"+rn,Sd="__reactEvents$"+rn,z1="__reactListeners$"+rn,U1="__reactHandles$"+rn,Qm="__reactResources$"+rn,Oo="__reactMarker$"+rn;function Td(e){delete e[ht],delete e[qt],delete e[Sd],delete e[z1],delete e[U1]}function Ai(e){var n=e[ht];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ei]||a[ht]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=_0(e);e!==null;){if(a=e[ht])return a;e=_0(e)}return n}e=a,a=e.parentNode}return null}function Di(e){if(e=e[ht]||e[Ei]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Lo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(r(33))}function Ri(e){var n=e[Qm];return n||(n=e[Qm]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Gt(e){e[Oo]=!0}var eh=new Set,th={};function Ga(e,n){Mi(e,n),Mi(e+"Capture",n)}function Mi(e,n){for(th[e]=n,e=0;e<n.length;e++)eh.add(n[e])}var $1=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]*$"),nh={},sh={};function P1(e){return _n.call(sh,e)?!0:_n.call(nh,e)?!1:$1.test(e)?sh[e]=!0:(nh[e]=!0,!1)}function ul(e,n,a){if(P1(n))if(a===null)e.removeAttribute(n);else{switch(typeof a){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,""+a)}}function fl(e,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+a)}}function ws(e,n,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(n,a,""+l)}}function On(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ah(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function V1(e,n,a){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(x){a=""+x,h.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function wd(e){if(!e._valueTracker){var n=ah(e)?"checked":"value";e._valueTracker=V1(e,n,""+e[n])}}function ih(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=ah(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function pl(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 H1=/[\n"\\]/g;function Ln(e){return e.replace(H1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function jd(e,n,a,l,f,h,x,w){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+On(n)):e.value!==""+On(n)&&(e.value=""+On(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?Nd(e,x,On(n)):a!=null?Nd(e,x,On(a)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+On(w):e.removeAttribute("name")}function oh(e,n,a,l,f,h,x,w){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),n!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||n!=null)){wd(e);return}a=a!=null?""+On(a):"",n=n!=null?""+On(n):a,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),wd(e)}function Nd(e,n,a){n==="number"&&pl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ii(e,n,a,l){if(e=e.options,n){n={};for(var f=0;f<a.length;f++)n["$"+a[f]]=!0;for(a=0;a<e.length;a++)f=n.hasOwnProperty("$"+e[a].value),e[a].selected!==f&&(e[a].selected=f),f&&l&&(e[a].defaultSelected=!0)}else{for(a=""+On(a),n=null,f=0;f<e.length;f++){if(e[f].value===a){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}n!==null||e[f].disabled||(n=e[f])}n!==null&&(n.selected=!0)}}function rh(e,n,a){if(n!=null&&(n=""+On(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+On(a):""}function lh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(r(92));if(re(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=On(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),wd(e)}function Oi(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var q1=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 ch(e,n,a){var l=n.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":l?e.setProperty(n,a):typeof a!="number"||a===0||q1.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function dh(e,n,a){if(n!=null&&typeof n!="object")throw Error(r(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||n!=null&&n.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in n)l=n[f],n.hasOwnProperty(f)&&a[f]!==l&&ch(e,f,l)}else for(var h in n)n.hasOwnProperty(h)&&ch(e,h,n[h])}function Cd(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 G1=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"]]),F1=/^[\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 ml(e){return F1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function js(){}var Ed=null;function Ad(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Li=null,Bi=null;function uh(e){var n=Di(e);if(n&&(e=n.stateNode)){var a=e[qt]||null;e:switch(e=n.stateNode,n.type){case"input":if(jd(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),n=a.name,a.type==="radio"&&n!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ln(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[qt]||null;if(!f)throw Error(r(90));jd(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(n=0;n<a.length;n++)l=a[n],l.form===e.form&&ih(l)}break e;case"textarea":rh(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ii(e,!!a.multiple,n,!1)}}}var Dd=!1;function fh(e,n,a){if(Dd)return e(n,a);Dd=!0;try{var l=e(n);return l}finally{if(Dd=!1,(Li!==null||Bi!==null)&&(tc(),Li&&(n=Li,e=Bi,Bi=Li=null,uh(n),e)))for(n=0;n<e.length;n++)uh(e[n])}}function Bo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[qt]||null;if(l===null)return null;a=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(a&&typeof a!="function")throw Error(r(231,n,typeof a));return a}var Ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rd=!1;if(Ns)try{var zo={};Object.defineProperty(zo,"passive",{get:function(){Rd=!0}}),window.addEventListener("test",zo,zo),window.removeEventListener("test",zo,zo)}catch{Rd=!1}var sa=null,Md=null,hl=null;function ph(){if(hl)return hl;var e,n=Md,a=n.length,l,f="value"in sa?sa.value:sa.textContent,h=f.length;for(e=0;e<a&&n[e]===f[e];e++);var x=a-e;for(l=1;l<=x&&n[a-l]===f[h-l];l++);return hl=f.slice(e,1<l?1-l:void 0)}function gl(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 vl(){return!0}function mh(){return!1}function fn(e){function n(a,l,f,h,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=x,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(h):h[w]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?vl:mh,this.isPropagationStopped=mh,this}return b(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=vl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=vl)},persist:function(){},isPersistent:vl}),n}var Fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yl=fn(Fa),Uo=b({},Fa,{view:0,detail:0}),Z1=fn(Uo),Id,Od,$o,bl=b({},Uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bd,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!==$o&&($o&&e.type==="mousemove"?(Id=e.screenX-$o.screenX,Od=e.screenY-$o.screenY):Od=Id=0,$o=e),Id)},movementY:function(e){return"movementY"in e?e.movementY:Od}}),hh=fn(bl),K1=b({},bl,{dataTransfer:0}),Y1=fn(K1),J1=b({},Uo,{relatedTarget:0}),Ld=fn(J1),W1=b({},Fa,{animationName:0,elapsedTime:0,pseudoElement:0}),X1=fn(W1),Q1=b({},Fa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ek=fn(Q1),tk=b({},Fa,{data:0}),gh=fn(tk),nk={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sk={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"},ak={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ik(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=ak[e])?!!n[e]:!1}function Bd(){return ik}var ok=b({},Uo,{key:function(e){if(e.key){var n=nk[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bd,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),rk=fn(ok),lk=b({},bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vh=fn(lk),ck=b({},Uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bd}),dk=fn(ck),uk=b({},Fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),fk=fn(uk),pk=b({},bl,{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}),mk=fn(pk),hk=b({},Fa,{newState:0,oldState:0}),gk=fn(hk),vk=[9,13,27,32],zd=Ns&&"CompositionEvent"in window,Po=null;Ns&&"documentMode"in document&&(Po=document.documentMode);var yk=Ns&&"TextEvent"in window&&!Po,yh=Ns&&(!zd||Po&&8<Po&&11>=Po),bh=" ",_h=!1;function xh(e,n){switch(e){case"keyup":return vk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zi=!1;function bk(e,n){switch(e){case"compositionend":return kh(n);case"keypress":return n.which!==32?null:(_h=!0,bh);case"textInput":return e=n.data,e===bh&&_h?null:e;default:return null}}function _k(e,n){if(zi)return e==="compositionend"||!zd&&xh(e,n)?(e=ph(),hl=Md=sa=null,zi=!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 yh&&n.locale!=="ko"?null:n.data;default:return null}}var xk={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 Sh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!xk[e.type]:n==="textarea"}function Th(e,n,a,l){Li?Bi?Bi.push(l):Bi=[l]:Li=l,n=lc(n,"onChange"),0<n.length&&(a=new yl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Vo=null,Ho=null;function kk(e){o0(e,0)}function _l(e){var n=Lo(e);if(ih(n))return e}function wh(e,n){if(e==="change")return n}var jh=!1;if(Ns){var Ud;if(Ns){var $d="oninput"in document;if(!$d){var Nh=document.createElement("div");Nh.setAttribute("oninput","return;"),$d=typeof Nh.oninput=="function"}Ud=$d}else Ud=!1;jh=Ud&&(!document.documentMode||9<document.documentMode)}function Ch(){Vo&&(Vo.detachEvent("onpropertychange",Eh),Ho=Vo=null)}function Eh(e){if(e.propertyName==="value"&&_l(Ho)){var n=[];Th(n,Ho,e,Ad(e)),fh(kk,n)}}function Sk(e,n,a){e==="focusin"?(Ch(),Vo=n,Ho=a,Vo.attachEvent("onpropertychange",Eh)):e==="focusout"&&Ch()}function Tk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return _l(Ho)}function wk(e,n){if(e==="click")return _l(n)}function jk(e,n){if(e==="input"||e==="change")return _l(n)}function Nk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var kn=typeof Object.is=="function"?Object.is:Nk;function qo(e,n){if(kn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var a=Object.keys(e),l=Object.keys(n);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!_n.call(n,f)||!kn(e[f],n[f]))return!1}return!0}function Ah(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dh(e,n){var a=Ah(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=n&&l>=n)return{node:a,offset:n-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Ah(a)}}function Rh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Rh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Mh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=pl(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=pl(e.document)}return n}function Pd(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 Ck=Ns&&"documentMode"in document&&11>=document.documentMode,Ui=null,Vd=null,Go=null,Hd=!1;function Ih(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Hd||Ui==null||Ui!==pl(l)||(l=Ui,"selectionStart"in l&&Pd(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}),Go&&qo(Go,l)||(Go=l,l=lc(Vd,"onSelect"),0<l.length&&(n=new yl("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Ui)))}function Za(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var $i={animationend:Za("Animation","AnimationEnd"),animationiteration:Za("Animation","AnimationIteration"),animationstart:Za("Animation","AnimationStart"),transitionrun:Za("Transition","TransitionRun"),transitionstart:Za("Transition","TransitionStart"),transitioncancel:Za("Transition","TransitionCancel"),transitionend:Za("Transition","TransitionEnd")},qd={},Oh={};Ns&&(Oh=document.createElement("div").style,"AnimationEvent"in window||(delete $i.animationend.animation,delete $i.animationiteration.animation,delete $i.animationstart.animation),"TransitionEvent"in window||delete $i.transitionend.transition);function Ka(e){if(qd[e])return qd[e];if(!$i[e])return e;var n=$i[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Oh)return qd[e]=n[a];return e}var Lh=Ka("animationend"),Bh=Ka("animationiteration"),zh=Ka("animationstart"),Ek=Ka("transitionrun"),Ak=Ka("transitionstart"),Dk=Ka("transitioncancel"),Uh=Ka("transitionend"),$h=new Map,Gd="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(" ");Gd.push("scrollEnd");function Qn(e,n){$h.set(e,n),Ga(n,[e])}var xl=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)},Bn=[],Pi=0,Fd=0;function kl(){for(var e=Pi,n=Fd=Pi=0;n<e;){var a=Bn[n];Bn[n++]=null;var l=Bn[n];Bn[n++]=null;var f=Bn[n];Bn[n++]=null;var h=Bn[n];if(Bn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}h!==0&&Ph(a,f,h)}}function Sl(e,n,a,l){Bn[Pi++]=e,Bn[Pi++]=n,Bn[Pi++]=a,Bn[Pi++]=l,Fd|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Zd(e,n,a,l){return Sl(e,n,a,l),Tl(e)}function Ya(e,n){return Sl(e,null,null,n),Tl(e)}function Ph(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,h=e.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&n!==null&&(f=31-nn(a),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),h):null}function Tl(e){if(50<pr)throw pr=0,nf=null,Error(r(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Vi={};function Rk(e,n,a,l){this.tag=e,this.key=a,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 Sn(e,n,a,l){return new Rk(e,n,a,l)}function Kd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Cs(e,n){var a=e.alternate;return a===null?(a=Sn(e.tag,n,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=n,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,n=e.dependencies,a.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Vh(e,n){e.flags&=65011714;var a=e.alternate;return a===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=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,n=a.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function wl(e,n,a,l,f,h){var x=0;if(l=e,typeof e=="function")Kd(e)&&(x=1);else if(typeof e=="string")x=BS(e,a,Oe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case F:return e=Sn(31,a,n,f),e.elementType=F,e.lanes=h,e;case j:return Ja(a.children,f,h,n);case N:x=8,f|=24;break;case T:return e=Sn(12,a,n,f|2),e.elementType=T,e.lanes=h,e;case R:return e=Sn(13,a,n,f),e.elementType=R,e.lanes=h,e;case L:return e=Sn(19,a,n,f),e.elementType=L,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:x=10;break e;case C:x=9;break e;case D:x=11;break e;case A:x=14;break e;case U:x=16,l=null;break e}x=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Sn(x,a,n,f),n.elementType=e,n.type=l,n.lanes=h,n}function Ja(e,n,a,l){return e=Sn(7,e,l,n),e.lanes=a,e}function Yd(e,n,a){return e=Sn(6,e,null,n),e.lanes=a,e}function Hh(e){var n=Sn(18,null,null,0);return n.stateNode=e,n}function Jd(e,n,a){return n=Sn(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var qh=new WeakMap;function zn(e,n){if(typeof e=="object"&&e!==null){var a=qh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:ks(n)},qh.set(e,n),n)}return{value:e,source:n,stack:ks(n)}}var Hi=[],qi=0,jl=null,Fo=0,Un=[],$n=0,aa=null,fs=1,ps="";function Es(e,n){Hi[qi++]=Fo,Hi[qi++]=jl,jl=e,Fo=n}function Gh(e,n,a){Un[$n++]=fs,Un[$n++]=ps,Un[$n++]=aa,aa=e;var l=fs;e=ps;var f=32-nn(l)-1;l&=~(1<<f),a+=1;var h=32-nn(n)+f;if(30<h){var x=f-f%5;h=(l&(1<<x)-1).toString(32),l>>=x,f-=x,fs=1<<32-nn(n)+f|a<<f|l,ps=h+e}else fs=1<<h|a<<f|l,ps=e}function Wd(e){e.return!==null&&(Es(e,1),Gh(e,1,0))}function Xd(e){for(;e===jl;)jl=Hi[--qi],Hi[qi]=null,Fo=Hi[--qi],Hi[qi]=null;for(;e===aa;)aa=Un[--$n],Un[$n]=null,ps=Un[--$n],Un[$n]=null,fs=Un[--$n],Un[$n]=null}function Fh(e,n){Un[$n++]=fs,Un[$n++]=ps,Un[$n++]=aa,fs=n.id,ps=n.overflow,aa=e}var Yt=null,gt=null,He=!1,ia=null,Pn=!1,Qd=Error(r(519));function oa(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zo(zn(n,e)),Qd}function Zh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[ht]=e,n[qt]=l,a){case"dialog":ze("cancel",n),ze("close",n);break;case"iframe":case"object":case"embed":ze("load",n);break;case"video":case"audio":for(a=0;a<hr.length;a++)ze(hr[a],n);break;case"source":ze("error",n);break;case"img":case"image":case"link":ze("error",n),ze("load",n);break;case"details":ze("toggle",n);break;case"input":ze("invalid",n),oh(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":ze("invalid",n);break;case"textarea":ze("invalid",n),lh(n,l.value,l.defaultValue,l.children)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||n.textContent===""+a||l.suppressHydrationWarning===!0||d0(n.textContent,a)?(l.popover!=null&&(ze("beforetoggle",n),ze("toggle",n)),l.onScroll!=null&&ze("scroll",n),l.onScrollEnd!=null&&ze("scrollend",n),l.onClick!=null&&(n.onclick=js),n=!0):n=!1,n||oa(e,!0)}function Kh(e){for(Yt=e.return;Yt;)switch(Yt.tag){case 5:case 31:case 13:Pn=!1;return;case 27:case 3:Pn=!0;return;default:Yt=Yt.return}}function Gi(e){if(e!==Yt)return!1;if(!He)return Kh(e),He=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||yf(e.type,e.memoizedProps)),a=!a),a&&gt&&oa(e),Kh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=b0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=b0(e)}else n===27?(n=gt,_a(e.type)?(e=Sf,Sf=null,gt=e):gt=n):gt=Yt?Hn(e.stateNode.nextSibling):null;return!0}function Wa(){gt=Yt=null,He=!1}function eu(){var e=ia;return e!==null&&(gn===null?gn=e:gn.push.apply(gn,e),ia=null),e}function Zo(e){ia===null?ia=[e]:ia.push(e)}var tu=Ge(null),Xa=null,As=null;function ra(e,n,a){Ne(tu,n._currentValue),n._currentValue=a}function Ds(e){e._currentValue=tu.current,De(tu)}function nu(e,n,a){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===a)break;e=e.return}}function su(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var x=f.child;h=h.firstContext;e:for(;h!==null;){var w=h;h=f;for(var M=0;M<n.length;M++)if(w.context===n[M]){h.lanes|=a,w=h.alternate,w!==null&&(w.lanes|=a),nu(h.return,a,e),l||(x=null);break e}h=w.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(r(341));x.lanes|=a,h=x.alternate,h!==null&&(h.lanes|=a),nu(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Fi(e,n,a,l){e=null;for(var f=n,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var x=f.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var w=f.type;kn(f.pendingProps.value,x.value)||(e!==null?e.push(w):e=[w])}}else if(f===me.current){if(x=f.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(_r):e=[_r])}f=f.return}e!==null&&su(n,e,a,l),n.flags|=262144}function Nl(e){for(e=e.firstContext;e!==null;){if(!kn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Qa(e){Xa=e,As=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Jt(e){return Yh(Xa,e)}function Cl(e,n){return Xa===null&&Qa(e),Yh(e,n)}function Yh(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},As===null){if(e===null)throw Error(r(308));As=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else As=As.next=n;return a}var Mk=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){n.aborted=!0,e.forEach(function(a){return a()})}},Ik=t.unstable_scheduleCallback,Ok=t.unstable_NormalPriority,Lt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function au(){return{controller:new Mk,data:new Map,refCount:0}}function Ko(e){e.refCount--,e.refCount===0&&Ik(Ok,function(){e.controller.abort()})}var Yo=null,iu=0,Zi=0,Ki=null;function Lk(e,n){if(Yo===null){var a=Yo=[];iu=0,Zi=cf(),Ki={status:"pending",value:void 0,then:function(l){a.push(l)}}}return iu++,n.then(Jh,Jh),n}function Jh(){if(--iu===0&&Yo!==null){Ki!==null&&(Ki.status="fulfilled");var e=Yo;Yo=null,Zi=0,Ki=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Bk(e,n){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return e.then(function(){l.status="fulfilled",l.value=n;for(var f=0;f<a.length;f++)(0,a[f])(n)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var Wh=O.S;O.S=function(e,n){Iv=_e(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Lk(e,n),Wh!==null&&Wh(e,n)};var ei=Ge(null);function ou(){var e=ei.current;return e!==null?e:ft.pooledCache}function El(e,n){n===null?Ne(ei,ei.current):Ne(ei,n.pool)}function Xh(){var e=ou();return e===null?null:{parent:Lt._currentValue,pool:e}}var Yi=Error(r(460)),ru=Error(r(474)),Al=Error(r(542)),Dl={then:function(){}};function Qh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function eg(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(js,js),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ng(e),e;default:if(typeof n.status=="string")n.then(js,js);else{if(e=ft,e!==null&&100<e.shellSuspendCounter)throw Error(r(482));e=n,e.status="pending",e.then(function(l){if(n.status==="pending"){var f=n;f.status="fulfilled",f.value=l}},function(l){if(n.status==="pending"){var f=n;f.status="rejected",f.reason=l}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,ng(e),e}throw ni=n,Yi}}function ti(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ni=a,Yi):a}}var ni=null;function tg(){if(ni===null)throw Error(r(459));var e=ni;return ni=null,e}function ng(e){if(e===Yi||e===Al)throw Error(r(483))}var Ji=null,Jo=0;function Rl(e){var n=Jo;return Jo+=1,Ji===null&&(Ji=[]),eg(Ji,e,n)}function Wo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Ml(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 sg(e){function n($,z){if(e){var V=$.deletions;V===null?($.deletions=[z],$.flags|=16):V.push(z)}}function a($,z){if(!e)return null;for(;z!==null;)n($,z),z=z.sibling;return null}function l($){for(var z=new Map;$!==null;)$.key!==null?z.set($.key,$):z.set($.index,$),$=$.sibling;return z}function f($,z){return $=Cs($,z),$.index=0,$.sibling=null,$}function h($,z,V){return $.index=V,e?(V=$.alternate,V!==null?(V=V.index,V<z?($.flags|=67108866,z):V):($.flags|=67108866,z)):($.flags|=1048576,z)}function x($){return e&&$.alternate===null&&($.flags|=67108866),$}function w($,z,V,J){return z===null||z.tag!==6?(z=Yd(V,$.mode,J),z.return=$,z):(z=f(z,V),z.return=$,z)}function M($,z,V,J){var Se=V.type;return Se===j?Y($,z,V.props.children,J,V.key):z!==null&&(z.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===U&&ti(Se)===z.type)?(z=f(z,V.props),Wo(z,V),z.return=$,z):(z=wl(V.type,V.key,V.props,null,$.mode,J),Wo(z,V),z.return=$,z)}function H($,z,V,J){return z===null||z.tag!==4||z.stateNode.containerInfo!==V.containerInfo||z.stateNode.implementation!==V.implementation?(z=Jd(V,$.mode,J),z.return=$,z):(z=f(z,V.children||[]),z.return=$,z)}function Y($,z,V,J,Se){return z===null||z.tag!==7?(z=Ja(V,$.mode,J,Se),z.return=$,z):(z=f(z,V),z.return=$,z)}function te($,z,V){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=Yd(""+z,$.mode,V),z.return=$,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return V=wl(z.type,z.key,z.props,null,$.mode,V),Wo(V,z),V.return=$,V;case S:return z=Jd(z,$.mode,V),z.return=$,z;case U:return z=ti(z),te($,z,V)}if(re(z)||X(z))return z=Ja(z,$.mode,V,null),z.return=$,z;if(typeof z.then=="function")return te($,Rl(z),V);if(z.$$typeof===E)return te($,Cl($,z),V);Ml($,z)}return null}function G($,z,V,J){var Se=z!==null?z.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Se!==null?null:w($,z,""+V,J);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case k:return V.key===Se?M($,z,V,J):null;case S:return V.key===Se?H($,z,V,J):null;case U:return V=ti(V),G($,z,V,J)}if(re(V)||X(V))return Se!==null?null:Y($,z,V,J,null);if(typeof V.then=="function")return G($,z,Rl(V),J);if(V.$$typeof===E)return G($,z,Cl($,V),J);Ml($,V)}return null}function K($,z,V,J,Se){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $=$.get(V)||null,w(z,$,""+J,Se);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case k:return $=$.get(J.key===null?V:J.key)||null,M(z,$,J,Se);case S:return $=$.get(J.key===null?V:J.key)||null,H(z,$,J,Se);case U:return J=ti(J),K($,z,V,J,Se)}if(re(J)||X(J))return $=$.get(V)||null,Y(z,$,J,Se,null);if(typeof J.then=="function")return K($,z,V,Rl(J),Se);if(J.$$typeof===E)return K($,z,V,Cl(z,J),Se);Ml(z,J)}return null}function ve($,z,V,J){for(var Se=null,Ye=null,be=z,Ie=z=0,Ve=null;be!==null&&Ie<V.length;Ie++){be.index>Ie?(Ve=be,be=null):Ve=be.sibling;var Je=G($,be,V[Ie],J);if(Je===null){be===null&&(be=Ve);break}e&&be&&Je.alternate===null&&n($,be),z=h(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je,be=Ve}if(Ie===V.length)return a($,be),He&&Es($,Ie),Se;if(be===null){for(;Ie<V.length;Ie++)be=te($,V[Ie],J),be!==null&&(z=h(be,z,Ie),Ye===null?Se=be:Ye.sibling=be,Ye=be);return He&&Es($,Ie),Se}for(be=l(be);Ie<V.length;Ie++)Ve=K(be,$,Ie,V[Ie],J),Ve!==null&&(e&&Ve.alternate!==null&&be.delete(Ve.key===null?Ie:Ve.key),z=h(Ve,z,Ie),Ye===null?Se=Ve:Ye.sibling=Ve,Ye=Ve);return e&&be.forEach(function(wa){return n($,wa)}),He&&Es($,Ie),Se}function we($,z,V,J){if(V==null)throw Error(r(151));for(var Se=null,Ye=null,be=z,Ie=z=0,Ve=null,Je=V.next();be!==null&&!Je.done;Ie++,Je=V.next()){be.index>Ie?(Ve=be,be=null):Ve=be.sibling;var wa=G($,be,Je.value,J);if(wa===null){be===null&&(be=Ve);break}e&&be&&wa.alternate===null&&n($,be),z=h(wa,z,Ie),Ye===null?Se=wa:Ye.sibling=wa,Ye=wa,be=Ve}if(Je.done)return a($,be),He&&Es($,Ie),Se;if(be===null){for(;!Je.done;Ie++,Je=V.next())Je=te($,Je.value,J),Je!==null&&(z=h(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je);return He&&Es($,Ie),Se}for(be=l(be);!Je.done;Ie++,Je=V.next())Je=K(be,$,Ie,Je.value,J),Je!==null&&(e&&Je.alternate!==null&&be.delete(Je.key===null?Ie:Je.key),z=h(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je);return e&&be.forEach(function(KS){return n($,KS)}),He&&Es($,Ie),Se}function rt($,z,V,J){if(typeof V=="object"&&V!==null&&V.type===j&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case k:e:{for(var Se=V.key;z!==null;){if(z.key===Se){if(Se=V.type,Se===j){if(z.tag===7){a($,z.sibling),J=f(z,V.props.children),J.return=$,$=J;break e}}else if(z.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===U&&ti(Se)===z.type){a($,z.sibling),J=f(z,V.props),Wo(J,V),J.return=$,$=J;break e}a($,z);break}else n($,z);z=z.sibling}V.type===j?(J=Ja(V.props.children,$.mode,J,V.key),J.return=$,$=J):(J=wl(V.type,V.key,V.props,null,$.mode,J),Wo(J,V),J.return=$,$=J)}return x($);case S:e:{for(Se=V.key;z!==null;){if(z.key===Se)if(z.tag===4&&z.stateNode.containerInfo===V.containerInfo&&z.stateNode.implementation===V.implementation){a($,z.sibling),J=f(z,V.children||[]),J.return=$,$=J;break e}else{a($,z);break}else n($,z);z=z.sibling}J=Jd(V,$.mode,J),J.return=$,$=J}return x($);case U:return V=ti(V),rt($,z,V,J)}if(re(V))return ve($,z,V,J);if(X(V)){if(Se=X(V),typeof Se!="function")throw Error(r(150));return V=Se.call(V),we($,z,V,J)}if(typeof V.then=="function")return rt($,z,Rl(V),J);if(V.$$typeof===E)return rt($,z,Cl($,V),J);Ml($,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,z!==null&&z.tag===6?(a($,z.sibling),J=f(z,V),J.return=$,$=J):(a($,z),J=Yd(V,$.mode,J),J.return=$,$=J),x($)):a($,z)}return function($,z,V,J){try{Jo=0;var Se=rt($,z,V,J);return Ji=null,Se}catch(be){if(be===Yi||be===Al)throw be;var Ye=Sn(29,be,null,$.mode);return Ye.lanes=J,Ye.return=$,Ye}finally{}}}var si=sg(!0),ag=sg(!1),la=!1;function lu(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 da(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(et&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=Tl(e),Ph(e,null,a),n}return Sl(e,l,n,a),Tl(e)}function Xo(e,n,a){if(n=n.updateQueue,n!==null&&(n=n.shared,(a&4194048)!==0)){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ze(e,a)}}function du(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?f=h=x:h=h.next=x,a=a.next}while(a!==null);h===null?f=h=n:h=h.next=n}else f=h=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=n:e.next=n,a.lastBaseUpdate=n}var uu=!1;function Qo(){if(uu){var e=Ki;if(e!==null)throw e}}function er(e,n,a,l){uu=!1;var f=e.updateQueue;la=!1;var h=f.firstBaseUpdate,x=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var M=w,H=M.next;M.next=null,x===null?h=H:x.next=H,x=M;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,w=Y.lastBaseUpdate,w!==x&&(w===null?Y.firstBaseUpdate=H:w.next=H,Y.lastBaseUpdate=M))}if(h!==null){var te=f.baseState;x=0,Y=H=M=null,w=h;do{var G=w.lane&-536870913,K=G!==w.lane;if(K?(Pe&G)===G:(l&G)===G){G!==0&&G===Zi&&(uu=!0),Y!==null&&(Y=Y.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ve=e,we=w;G=n;var rt=a;switch(we.tag){case 1:if(ve=we.payload,typeof ve=="function"){te=ve.call(rt,te,G);break e}te=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=we.payload,G=typeof ve=="function"?ve.call(rt,te,G):ve,G==null)break e;te=b({},te,G);break e;case 2:la=!0}}G=w.callback,G!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[G]:K.push(G))}else K={lane:G,tag:w.tag,payload:w.payload,callback:w.callback,next:null},Y===null?(H=Y=K,M=te):Y=Y.next=K,x|=G;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;K=w,w=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);Y===null&&(M=te),f.baseState=M,f.firstBaseUpdate=H,f.lastBaseUpdate=Y,h===null&&(f.shared.lanes=0),ha|=x,e.lanes=x,e.memoizedState=te}}function ig(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function og(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)ig(a[e],n)}var Wi=Ge(null),Il=Ge(0);function rg(e,n){e=$s,Ne(Il,e),Ne(Wi,n),$s=e|n.baseLanes}function fu(){Ne(Il,$s),Ne(Wi,Wi.current)}function pu(){$s=Il.current,De(Wi),De(Il)}var Tn=Ge(null),Vn=null;function ua(e){var n=e.alternate;Ne(Dt,Dt.current&1),Ne(Tn,e),Vn===null&&(n===null||Wi.current!==null||n.memoizedState!==null)&&(Vn=e)}function mu(e){Ne(Dt,Dt.current),Ne(Tn,e),Vn===null&&(Vn=e)}function lg(e){e.tag===22?(Ne(Dt,Dt.current),Ne(Tn,e),Vn===null&&(Vn=e)):fa()}function fa(){Ne(Dt,Dt.current),Ne(Tn,Tn.current)}function wn(e){De(Tn),Vn===e&&(Vn=null),De(Dt)}var Dt=Ge(0);function Ol(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||xf(a)||kf(a)))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 Rs=0,Me=null,it=null,Bt=null,Ll=!1,Xi=!1,ai=!1,Bl=0,tr=0,Qi=null,zk=0;function wt(){throw Error(r(321))}function hu(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!kn(e[a],n[a]))return!1;return!0}function gu(e,n,a,l,f,h){return Rs=h,Me=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,O.H=e===null||e.memoizedState===null?Gg:Du,ai=!1,h=a(l,f),ai=!1,Xi&&(h=dg(n,a,l,f)),cg(e),h}function cg(e){O.H=ar;var n=it!==null&&it.next!==null;if(Rs=0,Bt=it=Me=null,Ll=!1,tr=0,Qi=null,n)throw Error(r(300));e===null||zt||(e=e.dependencies,e!==null&&Nl(e)&&(zt=!0))}function dg(e,n,a,l){Me=e;var f=0;do{if(Xi&&(Qi=null),tr=0,Xi=!1,25<=f)throw Error(r(301));if(f+=1,Bt=it=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}O.H=Fg,h=n(a,l)}while(Xi);return h}function Uk(){var e=O.H,n=e.useState()[0];return n=typeof n.then=="function"?nr(n):n,e=e.useState()[0],(it!==null?it.memoizedState:null)!==e&&(Me.flags|=1024),n}function vu(){var e=Bl!==0;return Bl=0,e}function yu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function bu(e){if(Ll){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ll=!1}Rs=0,Bt=it=Me=null,Xi=!1,tr=Bl=0,Qi=null}function ln(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Me.memoizedState=Bt=e:Bt=Bt.next=e,Bt}function Rt(){if(it===null){var e=Me.alternate;e=e!==null?e.memoizedState:null}else e=it.next;var n=Bt===null?Me.memoizedState:Bt.next;if(n!==null)Bt=n,it=e;else{if(e===null)throw Me.alternate===null?Error(r(467)):Error(r(310));it=e,e={memoizedState:it.memoizedState,baseState:it.baseState,baseQueue:it.baseQueue,queue:it.queue,next:null},Bt===null?Me.memoizedState=Bt=e:Bt=Bt.next=e}return Bt}function zl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function nr(e){var n=tr;return tr+=1,Qi===null&&(Qi=[]),e=eg(Qi,e,n),n=Me,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,O.H=n===null||n.memoizedState===null?Gg:Du),e}function Ul(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return nr(e);if(e.$$typeof===E)return Jt(e)}throw Error(r(438,String(e)))}function _u(e){var n=null,a=Me.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=Me.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(n={data:l.data.map(function(f){return f.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),a===null&&(a=zl(),Me.updateQueue=a),a.memoCache=n,a=n.data[n.index],a===void 0)for(a=n.data[n.index]=Array(e),l=0;l<e;l++)a[l]=ee;return n.index++,a}function Ms(e,n){return typeof n=="function"?n(e):n}function $l(e){var n=Rt();return xu(n,it,e)}function xu(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var x=f.next;f.next=h.next,h.next=x}n.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{n=f.next;var w=x=null,M=null,H=n,Y=!1;do{var te=H.lane&-536870913;if(te!==H.lane?(Pe&te)===te:(Rs&te)===te){var G=H.revertLane;if(G===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),te===Zi&&(Y=!0);else if((Rs&G)===G){H=H.next,G===Zi&&(Y=!0);continue}else te={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(w=M=te,x=h):M=M.next=te,Me.lanes|=G,ha|=G;te=H.action,ai&&a(h,te),h=H.hasEagerState?H.eagerState:a(h,te)}else G={lane:te,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(w=M=G,x=h):M=M.next=G,Me.lanes|=te,ha|=te;H=H.next}while(H!==null&&H!==n);if(M===null?x=h:M.next=w,!kn(h,e.memoizedState)&&(zt=!0,Y&&(a=Ki,a!==null)))throw a;e.memoizedState=h,e.baseState=x,e.baseQueue=M,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function ku(e){var n=Rt(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,h=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do h=e(h,x.action),x=x.next;while(x!==f);kn(h,n.memoizedState)||(zt=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),a.lastRenderedState=h}return[h,l]}function ug(e,n,a){var l=Me,f=Rt(),h=He;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=n();var x=!kn((it||f).memoizedState,a);if(x&&(f.memoizedState=a,zt=!0),f=f.queue,wu(mg.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Bt!==null&&Bt.memoizedState.tag&1){if(l.flags|=2048,eo(9,{destroy:void 0},pg.bind(null,l,f,a,n),null),ft===null)throw Error(r(349));h||(Rs&127)!==0||fg(l,n,a)}return a}function fg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Me.updateQueue,n===null?(n=zl(),Me.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function pg(e,n,a,l){n.value=a,n.getSnapshot=l,hg(n)&&gg(e)}function mg(e,n,a){return a(function(){hg(n)&&gg(e)})}function hg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!kn(e,a)}catch{return!0}}function gg(e){var n=Ya(e,2);n!==null&&vn(n,e,2)}function Su(e){var n=ln();if(typeof e=="function"){var a=e;if(e=a(),ai){Xn(!0);try{a()}finally{Xn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:e},n}function vg(e,n,a,l){return e.baseState=a,xu(e,it,typeof l=="function"?l:Ms)}function $k(e,n,a,l,f){if(Hl(e))throw Error(r(485));if(e=n.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){h.listeners.push(x)}};O.T!==null?a(!0):h.isTransition=!1,l(h),a=n.pending,a===null?(h.next=n.pending=h,yg(n,h)):(h.next=a.next,n.pending=a.next=h)}}function yg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var h=O.T,x={};O.T=x;try{var w=a(f,l),M=O.S;M!==null&&M(x,w),bg(e,n,w)}catch(H){Tu(e,n,H)}finally{h!==null&&x.types!==null&&(h.types=x.types),O.T=h}}else try{h=a(f,l),bg(e,n,h)}catch(H){Tu(e,n,H)}}function bg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){_g(e,n,l)},function(l){return Tu(e,n,l)}):_g(e,n,a)}function _g(e,n,a){n.status="fulfilled",n.value=a,xg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,yg(e,a)))}function Tu(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,xg(n),n=n.next;while(n!==l)}e.action=null}function xg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function kg(e,n){return n}function Sg(e,n){if(He){var a=ft.formState;if(a!==null){e:{var l=Me;if(He){if(gt){t:{for(var f=gt,h=Pn;f.nodeType!==8;){if(!h){f=null;break t}if(f=Hn(f.nextSibling),f===null){f=null;break t}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){gt=Hn(f.nextSibling),l=f.data==="F!";break e}}oa(l)}l=!1}l&&(n=a[0])}}return a=ln(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kg,lastRenderedState:n},a.queue=l,a=Vg.bind(null,Me,l),l.dispatch=a,l=Su(!1),h=Au.bind(null,Me,!1,l.queue),l=ln(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=$k.bind(null,Me,f,h,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function Tg(e){var n=Rt();return wg(n,it,e)}function wg(e,n,a){if(n=xu(e,n,kg)[0],e=$l(Ms)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=nr(n)}catch(x){throw x===Yi?Al:x}else l=n;n=Rt();var f=n.queue,h=f.dispatch;return a!==n.memoizedState&&(Me.flags|=2048,eo(9,{destroy:void 0},Pk.bind(null,f,a),null)),[l,h,e]}function Pk(e,n){e.action=n}function jg(e){var n=Rt(),a=it;if(a!==null)return wg(n,a,e);Rt(),n=n.memoizedState,a=Rt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function eo(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=Me.updateQueue,n===null&&(n=zl(),Me.updateQueue=n),a=n.lastEffect,a===null?n.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,n.lastEffect=e),e}function Ng(){return Rt().memoizedState}function Pl(e,n,a,l){var f=ln();Me.flags|=e,f.memoizedState=eo(1|n,{destroy:void 0},a,l===void 0?null:l)}function Vl(e,n,a,l){var f=Rt();l=l===void 0?null:l;var h=f.memoizedState.inst;it!==null&&l!==null&&hu(l,it.memoizedState.deps)?f.memoizedState=eo(n,h,a,l):(Me.flags|=e,f.memoizedState=eo(1|n,h,a,l))}function Cg(e,n){Pl(8390656,8,e,n)}function wu(e,n){Vl(2048,8,e,n)}function Vk(e){Me.flags|=4;var n=Me.updateQueue;if(n===null)n=zl(),Me.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function Eg(e){var n=Rt().memoizedState;return Vk({ref:n,nextImpl:e}),function(){if((et&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Ag(e,n){return Vl(4,2,e,n)}function Dg(e,n){return Vl(4,4,e,n)}function Rg(e,n){if(typeof n=="function"){e=e();var a=n(e);return function(){typeof a=="function"?a():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Mg(e,n,a){a=a!=null?a.concat([e]):null,Vl(4,4,Rg.bind(null,n,e),a)}function ju(){}function Ig(e,n){var a=Rt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&hu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Og(e,n){var a=Rt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&hu(n,l[1]))return l[0];if(l=e(),ai){Xn(!0);try{e()}finally{Xn(!1)}}return a.memoizedState=[l,n],l}function Nu(e,n,a){return a===void 0||(Rs&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Lv(),Me.lanes|=e,ha|=e,a)}function Lg(e,n,a,l){return kn(a,n)?a:Wi.current!==null?(e=Nu(e,a,l),kn(e,n)||(zt=!0),e):(Rs&42)===0||(Rs&1073741824)!==0&&(Pe&261930)===0?(zt=!0,e.memoizedState=a):(e=Lv(),Me.lanes|=e,ha|=e,n)}function Bg(e,n,a,l,f){var h=Z.p;Z.p=h!==0&&8>h?h:8;var x=O.T,w={};O.T=w,Au(e,!1,n,a);try{var M=f(),H=O.S;if(H!==null&&H(w,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var Y=Bk(M,l);sr(e,n,Y,Cn(e))}else sr(e,n,l,Cn(e))}catch(te){sr(e,n,{then:function(){},status:"rejected",reason:te},Cn())}finally{Z.p=h,x!==null&&w.types!==null&&(x.types=w.types),O.T=x}}function Hk(){}function Cu(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=zg(e).queue;Bg(e,f,n,se,a===null?Hk:function(){return Ug(e),a(l)})}function zg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:se},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Ug(e){var n=zg(e);n.next===null&&(n=e.alternate.memoizedState),sr(e,n.next.queue,{},Cn())}function Eu(){return Jt(_r)}function $g(){return Rt().memoizedState}function Pg(){return Rt().memoizedState}function qk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=Cn();e=ca(a);var l=da(n,e,a);l!==null&&(vn(l,n,a),Xo(l,n,a)),n={cache:au()},e.payload=n;return}n=n.return}}function Gk(e,n,a){var l=Cn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Hl(e)?Hg(n,a):(a=Zd(e,n,a,l),a!==null&&(vn(a,e,l),qg(a,n,l)))}function Vg(e,n,a){var l=Cn();sr(e,n,a,l)}function sr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Hl(e))Hg(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var x=n.lastRenderedState,w=h(x,a);if(f.hasEagerState=!0,f.eagerState=w,kn(w,x))return Sl(e,n,f,0),ft===null&&kl(),!1}catch{}finally{}if(a=Zd(e,n,f,l),a!==null)return vn(a,e,l),qg(a,n,l),!0}return!1}function Au(e,n,a,l){if(l={lane:2,revertLane:cf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Hl(e)){if(n)throw Error(r(479))}else n=Zd(e,a,l,2),n!==null&&vn(n,e,2)}function Hl(e){var n=e.alternate;return e===Me||n!==null&&n===Me}function Hg(e,n){Xi=Ll=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function qg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ze(e,a)}}var ar={readContext:Jt,use:Ul,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};ar.useEffectEvent=wt;var Gg={readContext:Jt,use:Ul,useCallback:function(e,n){return ln().memoizedState=[e,n===void 0?null:n],e},useContext:Jt,useEffect:Cg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Pl(4194308,4,Rg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Pl(4194308,4,e,n)},useInsertionEffect:function(e,n){Pl(4,2,e,n)},useMemo:function(e,n){var a=ln();n=n===void 0?null:n;var l=e();if(ai){Xn(!0);try{e()}finally{Xn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=ln();if(a!==void 0){var f=a(n);if(ai){Xn(!0);try{a(n)}finally{Xn(!1)}}}else f=n;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=Gk.bind(null,Me,e),[l.memoizedState,e]},useRef:function(e){var n=ln();return e={current:e},n.memoizedState=e},useState:function(e){e=Su(e);var n=e.queue,a=Vg.bind(null,Me,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:ju,useDeferredValue:function(e,n){var a=ln();return Nu(a,e,n)},useTransition:function(){var e=Su(!1);return e=Bg.bind(null,Me,e.queue,!0,!1),ln().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=Me,f=ln();if(He){if(a===void 0)throw Error(r(407));a=a()}else{if(a=n(),ft===null)throw Error(r(349));(Pe&127)!==0||fg(l,n,a)}f.memoizedState=a;var h={value:a,getSnapshot:n};return f.queue=h,Cg(mg.bind(null,l,h,e),[e]),l.flags|=2048,eo(9,{destroy:void 0},pg.bind(null,l,h,a,n),null),a},useId:function(){var e=ln(),n=ft.identifierPrefix;if(He){var a=ps,l=fs;a=(l&~(1<<32-nn(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Bl++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=zk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:Eu,useFormState:Sg,useActionState:Sg,useOptimistic:function(e){var n=ln();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=Au.bind(null,Me,!0,a),a.dispatch=n,[e,n]},useMemoCache:_u,useCacheRefresh:function(){return ln().memoizedState=qk.bind(null,Me)},useEffectEvent:function(e){var n=ln(),a={impl:e};return n.memoizedState=a,function(){if((et&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}},Du={readContext:Jt,use:Ul,useCallback:Ig,useContext:Jt,useEffect:wu,useImperativeHandle:Mg,useInsertionEffect:Ag,useLayoutEffect:Dg,useMemo:Og,useReducer:$l,useRef:Ng,useState:function(){return $l(Ms)},useDebugValue:ju,useDeferredValue:function(e,n){var a=Rt();return Lg(a,it.memoizedState,e,n)},useTransition:function(){var e=$l(Ms)[0],n=Rt().memoizedState;return[typeof e=="boolean"?e:nr(e),n]},useSyncExternalStore:ug,useId:$g,useHostTransitionStatus:Eu,useFormState:Tg,useActionState:Tg,useOptimistic:function(e,n){var a=Rt();return vg(a,it,e,n)},useMemoCache:_u,useCacheRefresh:Pg};Du.useEffectEvent=Eg;var Fg={readContext:Jt,use:Ul,useCallback:Ig,useContext:Jt,useEffect:wu,useImperativeHandle:Mg,useInsertionEffect:Ag,useLayoutEffect:Dg,useMemo:Og,useReducer:ku,useRef:Ng,useState:function(){return ku(Ms)},useDebugValue:ju,useDeferredValue:function(e,n){var a=Rt();return it===null?Nu(a,e,n):Lg(a,it.memoizedState,e,n)},useTransition:function(){var e=ku(Ms)[0],n=Rt().memoizedState;return[typeof e=="boolean"?e:nr(e),n]},useSyncExternalStore:ug,useId:$g,useHostTransitionStatus:Eu,useFormState:jg,useActionState:jg,useOptimistic:function(e,n){var a=Rt();return it!==null?vg(a,it,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:_u,useCacheRefresh:Pg};Fg.useEffectEvent=Eg;function Ru(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:b({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Mu={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=Cn(),f=ca(l);f.payload=n,a!=null&&(f.callback=a),n=da(e,f,l),n!==null&&(vn(n,e,l),Xo(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=Cn(),f=ca(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=da(e,f,l),n!==null&&(vn(n,e,l),Xo(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=Cn(),l=ca(a);l.tag=2,n!=null&&(l.callback=n),n=da(e,l,a),n!==null&&(vn(n,e,a),Xo(n,e,a))}};function Zg(e,n,a,l,f,h,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,x):n.prototype&&n.prototype.isPureReactComponent?!qo(a,l)||!qo(f,h):!0}function Kg(e,n,a,l){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(a,l),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(a,l),n.state!==e&&Mu.enqueueReplaceState(n,n.state,null)}function ii(e,n){var a=n;if("ref"in n){a={};for(var l in n)l!=="ref"&&(a[l]=n[l])}if(e=e.defaultProps){a===n&&(a=b({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Yg(e){xl(e)}function Jg(e){console.error(e)}function Wg(e){xl(e)}function ql(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Xg(e,n,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Iu(e,n,a){return a=ca(a),a.tag=3,a.payload={element:null},a.callback=function(){ql(e,n)},a}function Qg(e){return e=ca(e),e.tag=3,e}function ev(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){Xg(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Xg(n,a,l),typeof f!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function Fk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&Fi(n,a,f,!0),a=Tn.current,a!==null){switch(a.tag){case 31:case 13:return Vn===null?nc():a.alternate===null&&jt===0&&(jt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Dl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),of(e,l,f)),!1;case 22:return a.flags|=65536,l===Dl?a.flags|=16384:(n=a.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=n):(a=n.retryQueue,a===null?n.retryQueue=new Set([l]):a.add(l)),of(e,l,f)),!1}throw Error(r(435,a.tag))}return of(e,l,f),nc(),!1}if(He)return n=Tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Qd&&(e=Error(r(422),{cause:l}),Zo(zn(e,a)))):(l!==Qd&&(n=Error(r(423),{cause:l}),Zo(zn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=zn(l,a),f=Iu(e.stateNode,l,f),du(e,f),jt!==4&&(jt=2)),!1;var h=Error(r(520),{cause:l});if(h=zn(h,a),fr===null?fr=[h]:fr.push(h),jt!==4&&(jt=2),n===null)return!0;l=zn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Iu(a.stateNode,l,e),du(a,e),!1;case 1:if(n=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(ga===null||!ga.has(h))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Qg(f),ev(f,e,a,l),du(a,f),!1}a=a.return}while(a!==null);return!1}var Ou=Error(r(461)),zt=!1;function Wt(e,n,a,l){n.child=e===null?ag(n,null,a,l):si(n,e.child,a,l)}function tv(e,n,a,l,f){a=a.render;var h=n.ref;if("ref"in l){var x={};for(var w in l)w!=="ref"&&(x[w]=l[w])}else x=l;return Qa(n),l=gu(e,n,a,x,h,f),w=vu(),e!==null&&!zt?(yu(e,n,f),Is(e,n,f)):(He&&w&&Wd(n),n.flags|=1,Wt(e,n,l,f),n.child)}function nv(e,n,a,l,f){if(e===null){var h=a.type;return typeof h=="function"&&!Kd(h)&&h.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=h,sv(e,n,h,l,f)):(e=wl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,!Hu(e,f)){var x=h.memoizedProps;if(a=a.compare,a=a!==null?a:qo,a(x,l)&&e.ref===n.ref)return Is(e,n,f)}return n.flags|=1,e=Cs(h,l),e.ref=n.ref,e.return=n,n.child=e}function sv(e,n,a,l,f){if(e!==null){var h=e.memoizedProps;if(qo(h,l)&&e.ref===n.ref)if(zt=!1,n.pendingProps=l=h,Hu(e,f))(e.flags&131072)!==0&&(zt=!0);else return n.lanes=e.lanes,Is(e,n,f)}return Lu(e,n,a,l,f)}function av(e,n,a,l){var f=l.children,h=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(h=h!==null?h.baseLanes|a:a,e!==null){for(l=n.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,n.child=null;return iv(e,n,h,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&El(n,h!==null?h.cachePool:null),h!==null?rg(n,h):fu(),lg(n);else return l=n.lanes=536870912,iv(e,n,h!==null?h.baseLanes|a:a,a,l)}else h!==null?(El(n,h.cachePool),rg(n,h),fa(),n.memoizedState=null):(e!==null&&El(n,null),fu(),fa());return Wt(e,n,f,a),n.child}function ir(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,a,l,f){var h=ou();return h=h===null?null:{parent:Lt._currentValue,pool:h},n.memoizedState={baseLanes:a,cachePool:h},e!==null&&El(n,null),fu(),lg(n),e!==null&&Fi(e,n,l,!0),n.childLanes=f,null}function Gl(e,n){return n=Zl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function ov(e,n,a){return si(n,e.child,null,a),e=Gl(n,n.pendingProps),e.flags|=2,wn(n),n.memoizedState=null,e}function Zk(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(He){if(l.mode==="hidden")return e=Gl(n,l),n.lanes=536870912,ir(null,e);if(mu(n),(e=gt)?(e=y0(e,Pn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:aa!==null?{id:fs,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},a=Hh(e),a.return=n,n.child=a,Yt=n,gt=null)):e=null,e===null)throw oa(n);return n.lanes=536870912,null}return Gl(n,l)}var h=e.memoizedState;if(h!==null){var x=h.dehydrated;if(mu(n),f)if(n.flags&256)n.flags&=-257,n=ov(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(r(558));else if(zt||Fi(e,n,a,!1),f=(a&e.childLanes)!==0,zt||f){if(l=ft,l!==null&&(x=ut(l,a),x!==0&&x!==h.retryLane))throw h.retryLane=x,Ya(e,x),vn(l,e,x),Ou;nc(),n=ov(e,n,a)}else e=h.treeContext,gt=Hn(x.nextSibling),Yt=n,He=!0,ia=null,Pn=!1,e!==null&&Fh(n,e),n=Gl(n,l),n.flags|=4096;return n}return e=Cs(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Fl(e,n){var a=n.ref;if(a===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Lu(e,n,a,l,f){return Qa(n),a=gu(e,n,a,l,void 0,f),l=vu(),e!==null&&!zt?(yu(e,n,f),Is(e,n,f)):(He&&l&&Wd(n),n.flags|=1,Wt(e,n,a,f),n.child)}function rv(e,n,a,l,f,h){return Qa(n),n.updateQueue=null,a=dg(n,l,a,f),cg(e),l=vu(),e!==null&&!zt?(yu(e,n,h),Is(e,n,h)):(He&&l&&Wd(n),n.flags|=1,Wt(e,n,a,h),n.child)}function lv(e,n,a,l,f){if(Qa(n),n.stateNode===null){var h=Vi,x=a.contextType;typeof x=="object"&&x!==null&&(h=Jt(x)),h=new a(l,h),n.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Mu,n.stateNode=h,h._reactInternals=n,h=n.stateNode,h.props=l,h.state=n.memoizedState,h.refs={},lu(n),x=a.contextType,h.context=typeof x=="object"&&x!==null?Jt(x):Vi,h.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Ru(n,a,x,l),h.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(x=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),x!==h.state&&Mu.enqueueReplaceState(h,h.state,null),er(n,l,h,f),Qo(),h.state=n.memoizedState),typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){h=n.stateNode;var w=n.memoizedProps,M=ii(a,w);h.props=M;var H=h.context,Y=a.contextType;x=Vi,typeof Y=="object"&&Y!==null&&(x=Jt(Y));var te=a.getDerivedStateFromProps;Y=typeof te=="function"||typeof h.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,Y||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(w||H!==x)&&Kg(n,h,l,x),la=!1;var G=n.memoizedState;h.state=G,er(n,l,h,f),Qo(),H=n.memoizedState,w||G!==H||la?(typeof te=="function"&&(Ru(n,a,te,l),H=n.memoizedState),(M=la||Zg(n,a,M,l,G,H,x))?(Y||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(n.flags|=4194308)):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=H),h.props=l,h.state=H,h.context=x,l=M):(typeof h.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{h=n.stateNode,cu(e,n),x=n.memoizedProps,Y=ii(a,x),h.props=Y,te=n.pendingProps,G=h.context,H=a.contextType,M=Vi,typeof H=="object"&&H!==null&&(M=Jt(H)),w=a.getDerivedStateFromProps,(H=typeof w=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(x!==te||G!==M)&&Kg(n,h,l,M),la=!1,G=n.memoizedState,h.state=G,er(n,l,h,f),Qo();var K=n.memoizedState;x!==te||G!==K||la||e!==null&&e.dependencies!==null&&Nl(e.dependencies)?(typeof w=="function"&&(Ru(n,a,w,l),K=n.memoizedState),(Y=la||Zg(n,a,Y,l,G,K,M)||e!==null&&e.dependencies!==null&&Nl(e.dependencies))?(H||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,K,M),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,K,M)),typeof h.componentDidUpdate=="function"&&(n.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),h.props=l,h.state=K,h.context=M,l=Y):(typeof h.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),l=!1)}return h=l,Fl(e,n),l=(n.flags&128)!==0,h||l?(h=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:h.render(),n.flags|=1,e!==null&&l?(n.child=si(n,e.child,null,f),n.child=si(n,null,a,f)):Wt(e,n,a,f),n.memoizedState=h.state,e=n.child):e=Is(e,n,f),e}function cv(e,n,a,l){return Wa(),n.flags|=256,Wt(e,n,a,l),n.child}var Bu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function zu(e){return{baseLanes:e,cachePool:Xh()}}function Uu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Nn),e}function dv(e,n,a){var l=n.pendingProps,f=!1,h=(n.flags&128)!==0,x;if((x=h)||(x=e!==null&&e.memoizedState===null?!1:(Dt.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(He){if(f?ua(n):fa(),(e=gt)?(e=y0(e,Pn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:aa!==null?{id:fs,overflow:ps}:null,retryLane:536870912,hydrationErrors:null},a=Hh(e),a.return=n,n.child=a,Yt=n,gt=null)):e=null,e===null)throw oa(n);return kf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(fa(),f=n.mode,w=Zl({mode:"hidden",children:w},f),l=Ja(l,f,a,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=zu(a),l.childLanes=Uu(e,x,a),n.memoizedState=Bu,ir(null,l)):(ua(n),$u(n,w))}var M=e.memoizedState;if(M!==null&&(w=M.dehydrated,w!==null)){if(h)n.flags&256?(ua(n),n.flags&=-257,n=Pu(e,n,a)):n.memoizedState!==null?(fa(),n.child=e.child,n.flags|=128,n=null):(fa(),w=l.fallback,f=n.mode,l=Zl({mode:"visible",children:l.children},f),w=Ja(w,f,a,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,si(n,e.child,null,a),l=n.child,l.memoizedState=zu(a),l.childLanes=Uu(e,x,a),n.memoizedState=Bu,n=ir(null,l));else if(ua(n),kf(w)){if(x=w.nextSibling&&w.nextSibling.dataset,x)var H=x.dgst;x=H,l=Error(r(419)),l.stack="",l.digest=x,Zo({value:l,source:null,stack:null}),n=Pu(e,n,a)}else if(zt||Fi(e,n,a,!1),x=(a&e.childLanes)!==0,zt||x){if(x=ft,x!==null&&(l=ut(x,a),l!==0&&l!==M.retryLane))throw M.retryLane=l,Ya(e,l),vn(x,e,l),Ou;xf(w)||nc(),n=Pu(e,n,a)}else xf(w)?(n.flags|=192,n.child=e.child,n=null):(e=M.treeContext,gt=Hn(w.nextSibling),Yt=n,He=!0,ia=null,Pn=!1,e!==null&&Fh(n,e),n=$u(n,l.children),n.flags|=4096);return n}return f?(fa(),w=l.fallback,f=n.mode,M=e.child,H=M.sibling,l=Cs(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,H!==null?w=Cs(H,w):(w=Ja(w,f,a,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,ir(null,l),l=n.child,w=e.child.memoizedState,w===null?w=zu(a):(f=w.cachePool,f!==null?(M=Lt._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=Xh(),w={baseLanes:w.baseLanes|a,cachePool:f}),l.memoizedState=w,l.childLanes=Uu(e,x,a),n.memoizedState=Bu,ir(e.child,l)):(ua(n),a=e.child,e=a.sibling,a=Cs(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function $u(e,n){return n=Zl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Zl(e,n){return e=Sn(22,e,null,n),e.lanes=0,e}function Pu(e,n,a){return si(n,e.child,null,a),e=$u(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function uv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),nu(e.return,n,a)}function Vu(e,n,a,l,f,h){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:h}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=h)}function fv(e,n,a){var l=n.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var x=Dt.current,w=(x&2)!==0;if(w?(x=x&1|2,n.flags|=128):x&=1,Ne(Dt,x),Wt(e,n,l,a),l=He?Fo:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&uv(e,a,n);else if(e.tag===19)uv(e,a,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(f){case"forwards":for(a=n.child,f=null;a!==null;)e=a.alternate,e!==null&&Ol(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Vu(n,!1,f,a,h,l);break;case"backwards":case"unstable_legacy-backwards":for(a=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Ol(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Vu(n,!0,a,null,h,l);break;case"together":Vu(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Is(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ha|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Fi(e,n,a,!1),(a&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,a=Cs(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=Cs(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Hu(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Nl(e)))}function Kk(e,n,a){switch(n.tag){case 3:Ue(n,n.stateNode.containerInfo),ra(n,Lt,e.memoizedState.cache),Wa();break;case 27:case 5:bn(n);break;case 4:Ue(n,n.stateNode.containerInfo);break;case 10:ra(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,mu(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(ua(n),n.flags|=128,null):(a&n.child.childLanes)!==0?dv(e,n,a):(ua(n),e=Is(e,n,a),e!==null?e.sibling:null);ua(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(Fi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return fv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Ne(Dt,Dt.current),l)break;return null;case 22:return n.lanes=0,av(e,n,a,n.pendingProps);case 24:ra(n,Lt,e.memoizedState.cache)}return Is(e,n,a)}function pv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)zt=!0;else{if(!Hu(e,a)&&(n.flags&128)===0)return zt=!1,Kk(e,n,a);zt=(e.flags&131072)!==0}else zt=!1,He&&(n.flags&1048576)!==0&&Gh(n,Fo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=ti(n.elementType),n.type=e,typeof e=="function")Kd(e)?(l=ii(e,l),n.tag=1,n=lv(null,n,e,l,a)):(n.tag=0,n=Lu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===D){n.tag=11,n=tv(null,n,e,l,a);break e}else if(f===A){n.tag=14,n=nv(null,n,e,l,a);break e}}throw n=Q(e)||e,Error(r(306,n,""))}}return n;case 0:return Lu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=ii(l,n.pendingProps),lv(e,n,l,f,a);case 3:e:{if(Ue(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var h=n.memoizedState;f=h.element,cu(e,n),er(n,l,null,a);var x=n.memoizedState;if(l=x.cache,ra(n,Lt,l),l!==h.cache&&su(n,[Lt],a,!0),Qo(),l=x.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){n=cv(e,n,l,a);break e}else if(l!==f){f=zn(Error(r(424)),n),Zo(f),n=cv(e,n,l,a);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(gt=Hn(e.firstChild),Yt=n,He=!0,ia=null,Pn=!0,a=ag(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Wa(),l===f){n=Is(e,n,a);break e}Wt(e,n,l,a)}n=n.child}return n;case 26:return Fl(e,n),e===null?(a=T0(n.type,null,n.pendingProps,null))?n.memoizedState=a:He||(a=n.type,e=n.pendingProps,l=cc(ye.current).createElement(a),l[ht]=n,l[qt]=e,Xt(l,a,e),Gt(l),n.stateNode=l):n.memoizedState=T0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return bn(n),e===null&&He&&(l=n.stateNode=x0(n.type,n.pendingProps,ye.current),Yt=n,Pn=!0,f=gt,_a(n.type)?(Sf=f,gt=Hn(l.firstChild)):gt=f),Wt(e,n,n.pendingProps.children,a),Fl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&He&&((f=l=gt)&&(l=TS(l,n.type,n.pendingProps,Pn),l!==null?(n.stateNode=l,Yt=n,gt=Hn(l.firstChild),Pn=!1,f=!0):f=!1),f||oa(n)),bn(n),f=n.type,h=n.pendingProps,x=e!==null?e.memoizedProps:null,l=h.children,yf(f,h)?l=null:x!==null&&yf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=gu(e,n,Uk,null,null,a),_r._currentValue=f),Fl(e,n),Wt(e,n,l,a),n.child;case 6:return e===null&&He&&((e=a=gt)&&(a=wS(a,n.pendingProps,Pn),a!==null?(n.stateNode=a,Yt=n,gt=null,e=!0):e=!1),e||oa(n)),null;case 13:return dv(e,n,a);case 4:return Ue(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=si(n,null,l,a):Wt(e,n,l,a),n.child;case 11:return tv(e,n,n.type,n.pendingProps,a);case 7:return Wt(e,n,n.pendingProps,a),n.child;case 8:return Wt(e,n,n.pendingProps.children,a),n.child;case 12:return Wt(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,ra(n,n.type,l.value),Wt(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,Qa(n),f=Jt(f),l=l(f),n.flags|=1,Wt(e,n,l,a),n.child;case 14:return nv(e,n,n.type,n.pendingProps,a);case 15:return sv(e,n,n.type,n.pendingProps,a);case 19:return fv(e,n,a);case 31:return Zk(e,n,a);case 22:return av(e,n,a,n.pendingProps);case 24:return Qa(n),l=Jt(Lt),e===null?(f=ou(),f===null&&(f=ft,h=au(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=a),f=h),n.memoizedState={parent:l,cache:f},lu(n),ra(n,Lt,f)):((e.lanes&a)!==0&&(cu(e,n),er(n,null,null,a),Qo()),f=e.memoizedState,h=n.memoizedState,f.parent!==l?(f={parent:l,cache:l},n.memoizedState=f,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=f),ra(n,Lt,l)):(l=h.cache,ra(n,Lt,l),l!==f.cache&&su(n,[Lt],a,!0))),Wt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(r(156,n.tag))}function Os(e){e.flags|=4}function qu(e,n,a,l,f){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if($v())e.flags|=8192;else throw ni=Dl,ru}else e.flags&=-16777217}function mv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!E0(n))if($v())e.flags|=8192;else throw ni=Dl,ru}function Kl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?pe():536870912,e.lanes|=n,ao|=n)}function or(e,n){if(!He)switch(e.tailMode){case"hidden":n=e.tail;for(var a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function vt(e){var n=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(n)for(var f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=a,n}function Yk(e,n,a){var l=n.pendingProps;switch(Xd(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(n),null;case 1:return vt(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),Ds(Lt),pt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Gi(n)?Os(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,eu())),vt(n),null;case 26:var f=n.type,h=n.memoizedState;return e===null?(Os(n),h!==null?(vt(n),mv(n,h)):(vt(n),qu(n,f,null,l,a))):h?h!==e.memoizedState?(Os(n),vt(n),mv(n,h)):(vt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Os(n),vt(n),qu(n,f,e,l,a)),null;case 27:if(ie(n),a=ye.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Os(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return vt(n),null}e=Oe.current,Gi(n)?Zh(n):(e=x0(f,l,a),n.stateNode=e,Os(n))}return vt(n),null;case 5:if(ie(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Os(n);else{if(!l){if(n.stateNode===null)throw Error(r(166));return vt(n),null}if(h=Oe.current,Gi(n))Zh(n);else{var x=cc(ye.current);switch(h){case 1:h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=x.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}h[ht]=n,h[qt]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)h.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=h;e:switch(Xt(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&Os(n)}}return vt(n),qu(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Os(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(r(166));if(e=ye.current,Gi(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=Yt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[ht]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||d0(e.nodeValue,a)),e||oa(n,!0)}else e=cc(e).createTextNode(l),e[ht]=n,n.stateNode=e}return vt(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=Gi(n),a!==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[ht]=n}else Wa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;vt(n),e=!1}else a=eu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(wn(n),n):(wn(n),null);if((n.flags&128)!==0)throw Error(r(558))}return vt(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Gi(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(r(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[ht]=n}else Wa(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;vt(n),f=!1}else f=eu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(wn(n),n):(wn(n),null)}return wn(n),(n.flags&128)!==0?(n.lanes=a,n):(a=l!==null,e=e!==null&&e.memoizedState!==null,a&&(l=n.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Kl(n,n.updateQueue),vt(n),null);case 4:return pt(),e===null&&pf(n.stateNode.containerInfo),vt(n),null;case 10:return Ds(n.type),vt(n),null;case 19:if(De(Dt),l=n.memoizedState,l===null)return vt(n),null;if(f=(n.flags&128)!==0,h=l.rendering,h===null)if(f)or(l,!1);else{if(jt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(h=Ol(e),h!==null){for(n.flags|=128,or(l,!1),e=h.updateQueue,n.updateQueue=e,Kl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Vh(a,e),a=a.sibling;return Ne(Dt,Dt.current&1|2),He&&Es(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&_e()>Ql&&(n.flags|=128,f=!0,or(l,!1),n.lanes=4194304)}else{if(!f)if(e=Ol(h),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Kl(n,e),or(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!He)return vt(n),null}else 2*_e()-l.renderingStartTime>Ql&&a!==536870912&&(n.flags|=128,f=!0,or(l,!1),n.lanes=4194304);l.isBackwards?(h.sibling=n.child,n.child=h):(e=l.last,e!==null?e.sibling=h:n.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=_e(),e.sibling=null,a=Dt.current,Ne(Dt,f?a&1|2:a&1),He&&Es(n,l.treeForkCount),e):(vt(n),null);case 22:case 23:return wn(n),pu(),l=n.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(n.flags|=8192):l&&(n.flags|=8192),l?(a&536870912)!==0&&(n.flags&128)===0&&(vt(n),n.subtreeFlags&6&&(n.flags|=8192)):vt(n),a=n.updateQueue,a!==null&&Kl(n,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),l!==a&&(n.flags|=2048),e!==null&&De(ei),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),Ds(Lt),vt(n),null;case 25:return null;case 30:return null}throw Error(r(156,n.tag))}function Jk(e,n){switch(Xd(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return Ds(Lt),pt(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return ie(n),null;case 31:if(n.memoizedState!==null){if(wn(n),n.alternate===null)throw Error(r(340));Wa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(wn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Wa()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return De(Dt),null;case 4:return pt(),null;case 10:return Ds(n.type),null;case 22:case 23:return wn(n),pu(),e!==null&&De(ei),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return Ds(Lt),null;case 25:return null;default:return null}}function hv(e,n){switch(Xd(n),n.tag){case 3:Ds(Lt),pt();break;case 26:case 27:case 5:ie(n);break;case 4:pt();break;case 31:n.memoizedState!==null&&wn(n);break;case 13:wn(n);break;case 19:De(Dt);break;case 10:Ds(n.type);break;case 22:case 23:wn(n),pu(),e!==null&&De(ei);break;case 24:Ds(Lt)}}function rr(e,n){try{var a=n.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&e)===e){l=void 0;var h=a.create,x=a.inst;l=h(),x.destroy=l}a=a.next}while(a!==f)}}catch(w){st(n,n.return,w)}}function pa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var x=l.inst,w=x.destroy;if(w!==void 0){x.destroy=void 0,f=n;var M=a,H=w;try{H()}catch(Y){st(f,M,Y)}}}l=l.next}while(l!==h)}}catch(Y){st(n,n.return,Y)}}function gv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{og(n,a)}catch(l){st(e,e.return,l)}}}function vv(e,n,a){a.props=ii(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){st(e,n,l)}}function lr(e,n){try{var a=e.ref;if(a!==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 a=="function"?e.refCleanup=a(l):a.current=l}}catch(f){st(e,n,f)}}function ms(e,n){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){st(e,n,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){st(e,n,f)}else a.current=null}function yv(e){var n=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){st(e,e.return,f)}}function Gu(e,n,a){try{var l=e.stateNode;yS(l,e.type,a,n),l[qt]=n}catch(f){st(e,e.return,f)}}function bv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_a(e.type)||e.tag===4}function Fu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bv(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 Zu(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,n):(n=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,n.appendChild(e),a=a._reactRootContainer,a!=null||n.onclick!==null||(n.onclick=js));else if(l!==4&&(l===27&&_a(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Zu(e,n,a),e=e.sibling;e!==null;)Zu(e,n,a),e=e.sibling}function Yl(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&_a(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Yl(e,n,a),e=e.sibling;e!==null;)Yl(e,n,a),e=e.sibling}function _v(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Xt(n,l,a),n[ht]=e,n[qt]=a}catch(h){st(e,e.return,h)}}var Ls=!1,Ut=!1,Ku=!1,xv=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Wk(e,n){if(e=e.containerInfo,gf=gc,e=Mh(e),Pd(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var x=0,w=-1,M=-1,H=0,Y=0,te=e,G=null;t:for(;;){for(var K;te!==a||f!==0&&te.nodeType!==3||(w=x+f),te!==h||l!==0&&te.nodeType!==3||(M=x+l),te.nodeType===3&&(x+=te.nodeValue.length),(K=te.firstChild)!==null;)G=te,te=K;for(;;){if(te===e)break t;if(G===a&&++H===f&&(w=x),G===h&&++Y===l&&(M=x),(K=te.nextSibling)!==null)break;te=G,G=te.parentNode}te=K}a=w===-1||M===-1?null:{start:w,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(vf={focusedElem:e,selectionRange:a},gc=!1,Ft=n;Ft!==null;)if(n=Ft,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Ft=e;else for(;Ft!==null;){switch(n=Ft,h=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(a=0;a<e.length;a++)f=e[a],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,a=n,f=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var ve=ii(a.type,f);e=l.getSnapshotBeforeUpdate(ve,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(we){st(a,a.return,we)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)_f(e);else if(a===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,Ft=e;break}Ft=n.return}}function kv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:zs(e,a),l&4&&rr(5,a);break;case 1:if(zs(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){st(a,a.return,x)}else{var f=ii(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){st(a,a.return,x)}}l&64&&gv(a),l&512&&lr(a,a.return);break;case 3:if(zs(e,a),l&64&&(e=a.updateQueue,e!==null)){if(n=null,a.child!==null)switch(a.child.tag){case 27:case 5:n=a.child.stateNode;break;case 1:n=a.child.stateNode}try{og(e,n)}catch(x){st(a,a.return,x)}}break;case 27:n===null&&l&4&&_v(a);case 26:case 5:zs(e,a),n===null&&l&4&&yv(a),l&512&&lr(a,a.return);break;case 12:zs(e,a);break;case 31:zs(e,a),l&4&&wv(e,a);break;case 13:zs(e,a),l&4&&jv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=oS.bind(null,a),jS(e,a))));break;case 22:if(l=a.memoizedState!==null||Ls,!l){n=n!==null&&n.memoizedState!==null||Ut,f=Ls;var h=Ut;Ls=l,(Ut=n)&&!h?Us(e,a,(a.subtreeFlags&8772)!==0):zs(e,a),Ls=f,Ut=h}break;case 30:break;default:zs(e,a)}}function Sv(e){var n=e.alternate;n!==null&&(e.alternate=null,Sv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&Td(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 kt=null,pn=!1;function Bs(e,n,a){for(a=a.child;a!==null;)Tv(e,n,a),a=a.sibling}function Tv(e,n,a){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(na,a)}catch{}switch(a.tag){case 26:Ut||ms(a,n),Bs(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ut||ms(a,n);var l=kt,f=pn;_a(a.type)&&(kt=a.stateNode,pn=!1),Bs(e,n,a),vr(a.stateNode),kt=l,pn=f;break;case 5:Ut||ms(a,n);case 6:if(l=kt,f=pn,kt=null,Bs(e,n,a),kt=l,pn=f,kt!==null)if(pn)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(a.stateNode)}catch(h){st(a,n,h)}else try{kt.removeChild(a.stateNode)}catch(h){st(a,n,h)}break;case 18:kt!==null&&(pn?(e=kt,g0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),po(e)):g0(kt,a.stateNode));break;case 4:l=kt,f=pn,kt=a.stateNode.containerInfo,pn=!0,Bs(e,n,a),kt=l,pn=f;break;case 0:case 11:case 14:case 15:pa(2,a,n),Ut||pa(4,a,n),Bs(e,n,a);break;case 1:Ut||(ms(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&vv(a,n,l)),Bs(e,n,a);break;case 21:Bs(e,n,a);break;case 22:Ut=(l=Ut)||a.memoizedState!==null,Bs(e,n,a),Ut=l;break;default:Bs(e,n,a)}}function wv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{po(e)}catch(a){st(n,n.return,a)}}}function jv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{po(e)}catch(a){st(n,n.return,a)}}function Xk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new xv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new xv),n;default:throw Error(r(435,e.tag))}}function Jl(e,n){var a=Xk(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=rS.bind(null,e,l);l.then(f,f)}})}function mn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],h=e,x=n,w=x;e:for(;w!==null;){switch(w.tag){case 27:if(_a(w.type)){kt=w.stateNode,pn=!1;break e}break;case 5:kt=w.stateNode,pn=!1;break e;case 3:case 4:kt=w.stateNode.containerInfo,pn=!0;break e}w=w.return}if(kt===null)throw Error(r(160));Tv(h,x,f),kt=null,pn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Nv(n,e),n=n.sibling}var es=null;function Nv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:mn(n,e),hn(e),l&4&&(pa(3,e,e.return),rr(3,e),pa(5,e,e.return));break;case 1:mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),l&64&&Ls&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=es;if(mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),l&4){var h=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[Oo]||h[ht]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),Xt(h,l,a),h[ht]=e,Gt(h),l=h;break e;case"link":var x=N0("link","href",f).get(l+(a.href||""));if(x){for(var w=0;w<x.length;w++)if(h=x[w],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){x.splice(w,1);break t}}h=f.createElement(l),Xt(h,l,a),f.head.appendChild(h);break;case"meta":if(x=N0("meta","content",f).get(l+(a.content||""))){for(w=0;w<x.length;w++)if(h=x[w],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){x.splice(w,1);break t}}h=f.createElement(l),Xt(h,l,a),f.head.appendChild(h);break;default:throw Error(r(468,l))}h[ht]=e,Gt(h),l=h}e.stateNode=l}else C0(f,e.type,e.stateNode);else e.stateNode=j0(f,l,e.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?C0(f,e.type,e.stateNode):j0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Gu(e,e.memoizedProps,a.memoizedProps)}break;case 27:mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),a!==null&&l&4&&Gu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),e.flags&32){f=e.stateNode;try{Oi(f,"")}catch(ve){st(e,e.return,ve)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Gu(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Ku=!0);break;case 6:if(mn(n,e),hn(e),l&4){if(e.stateNode===null)throw Error(r(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ve){st(e,e.return,ve)}}break;case 3:if(fc=null,f=es,es=dc(n.containerInfo),mn(n,e),es=f,hn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{po(n.containerInfo)}catch(ve){st(e,e.return,ve)}Ku&&(Ku=!1,Cv(e));break;case 4:l=es,es=dc(e.stateNode.containerInfo),mn(n,e),hn(e),es=l;break;case 12:mn(n,e),hn(e);break;case 31:mn(n,e),hn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Jl(e,l)));break;case 13:mn(n,e),hn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Xl=_e()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Jl(e,l)));break;case 22:f=e.memoizedState!==null;var M=a!==null&&a.memoizedState!==null,H=Ls,Y=Ut;if(Ls=H||f,Ut=Y||M,mn(n,e),Ut=Y,Ls=H,hn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||M||Ls||Ut||oi(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){M=a=n;try{if(h=M.stateNode,f)x=h.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{w=M.stateNode;var te=M.memoizedProps.style,G=te!=null&&te.hasOwnProperty("display")?te.display:null;w.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(ve){st(M,M.return,ve)}}}else if(n.tag===6){if(a===null){M=n;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(ve){st(M,M.return,ve)}}}else if(n.tag===18){if(a===null){M=n;try{var K=M.stateNode;f?v0(K,!0):v0(M.stateNode,!1)}catch(ve){st(M,M.return,ve)}}}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;a===n&&(a=null),n=n.return}a===n&&(a=null),n.sibling.return=n.return,n=n.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Jl(e,a))));break;case 19:mn(n,e),hn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Jl(e,l)));break;case 30:break;case 21:break;default:mn(n,e),hn(e)}}function hn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(bv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,h=Fu(e);Yl(e,h,f);break;case 5:var x=a.stateNode;a.flags&32&&(Oi(x,""),a.flags&=-33);var w=Fu(e);Yl(e,w,x);break;case 3:case 4:var M=a.stateNode.containerInfo,H=Fu(e);Zu(e,H,M);break;default:throw Error(r(161))}}catch(Y){st(e,e.return,Y)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Cv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Cv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function zs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)kv(e,n.alternate,n),n=n.sibling}function oi(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:pa(4,n,n.return),oi(n);break;case 1:ms(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&vv(n,n.return,a),oi(n);break;case 27:vr(n.stateNode);case 26:case 5:ms(n,n.return),oi(n);break;case 22:n.memoizedState===null&&oi(n);break;case 30:oi(n);break;default:oi(n)}e=e.sibling}}function Us(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,h=n,x=h.flags;switch(h.tag){case 0:case 11:case 15:Us(f,h,a),rr(4,h);break;case 1:if(Us(f,h,a),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(H){st(l,l.return,H)}if(l=h,f=l.updateQueue,f!==null){var w=l.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)ig(M[f],w)}catch(H){st(l,l.return,H)}}a&&x&64&&gv(h),lr(h,h.return);break;case 27:_v(h);case 26:case 5:Us(f,h,a),a&&l===null&&x&4&&yv(h),lr(h,h.return);break;case 12:Us(f,h,a);break;case 31:Us(f,h,a),a&&x&4&&wv(f,h);break;case 13:Us(f,h,a),a&&x&4&&jv(f,h);break;case 22:h.memoizedState===null&&Us(f,h,a),lr(h,h.return);break;case 30:break;default:Us(f,h,a)}n=n.sibling}}function Yu(e,n){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ko(a))}function Ju(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ko(e))}function ts(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Ev(e,n,a,l),n=n.sibling}function Ev(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:ts(e,n,a,l),f&2048&&rr(9,n);break;case 1:ts(e,n,a,l);break;case 3:ts(e,n,a,l),f&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Ko(e)));break;case 12:if(f&2048){ts(e,n,a,l),e=n.stateNode;try{var h=n.memoizedProps,x=h.id,w=h.onPostCommit;typeof w=="function"&&w(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){st(n,n.return,M)}}else ts(e,n,a,l);break;case 31:ts(e,n,a,l);break;case 13:ts(e,n,a,l);break;case 23:break;case 22:h=n.stateNode,x=n.alternate,n.memoizedState!==null?h._visibility&2?ts(e,n,a,l):cr(e,n):h._visibility&2?ts(e,n,a,l):(h._visibility|=2,to(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Yu(x,n);break;case 24:ts(e,n,a,l),f&2048&&Ju(n.alternate,n);break;default:ts(e,n,a,l)}}function to(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var h=e,x=n,w=a,M=l,H=x.flags;switch(x.tag){case 0:case 11:case 15:to(h,x,w,M,f),rr(8,x);break;case 23:break;case 22:var Y=x.stateNode;x.memoizedState!==null?Y._visibility&2?to(h,x,w,M,f):cr(h,x):(Y._visibility|=2,to(h,x,w,M,f)),f&&H&2048&&Yu(x.alternate,x);break;case 24:to(h,x,w,M,f),f&&H&2048&&Ju(x.alternate,x);break;default:to(h,x,w,M,f)}n=n.sibling}}function cr(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var a=e,l=n,f=l.flags;switch(l.tag){case 22:cr(a,l),f&2048&&Yu(l.alternate,l);break;case 24:cr(a,l),f&2048&&Ju(l.alternate,l);break;default:cr(a,l)}n=n.sibling}}var dr=8192;function no(e,n,a){if(e.subtreeFlags&dr)for(e=e.child;e!==null;)Av(e,n,a),e=e.sibling}function Av(e,n,a){switch(e.tag){case 26:no(e,n,a),e.flags&dr&&e.memoizedState!==null&&zS(a,es,e.memoizedState,e.memoizedProps);break;case 5:no(e,n,a);break;case 3:case 4:var l=es;es=dc(e.stateNode.containerInfo),no(e,n,a),es=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=dr,dr=16777216,no(e,n,a),dr=l):no(e,n,a));break;default:no(e,n,a)}}function Dv(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 ur(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];Ft=l,Mv(l,e)}Dv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rv(e),e=e.sibling}function Rv(e){switch(e.tag){case 0:case 11:case 15:ur(e),e.flags&2048&&pa(9,e,e.return);break;case 3:ur(e);break;case 12:ur(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Wl(e)):ur(e);break;default:ur(e)}}function Wl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var a=0;a<n.length;a++){var l=n[a];Ft=l,Mv(l,e)}Dv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:pa(8,n,n.return),Wl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Wl(n));break;default:Wl(n)}e=e.sibling}}function Mv(e,n){for(;Ft!==null;){var a=Ft;switch(a.tag){case 0:case 11:case 15:pa(8,a,n);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ko(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Ft=l;else e:for(a=e;Ft!==null;){l=Ft;var f=l.sibling,h=l.return;if(Sv(l),l===a){Ft=null;break e}if(f!==null){f.return=h,Ft=f;break e}Ft=h}}}var Qk={getCacheForType:function(e){var n=Jt(Lt),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Jt(Lt).controller.signal}},eS=typeof WeakMap=="function"?WeakMap:Map,et=0,ft=null,Be=null,Pe=0,nt=0,jn=null,ma=!1,so=!1,Wu=!1,$s=0,jt=0,ha=0,ri=0,Xu=0,Nn=0,ao=0,fr=null,gn=null,Qu=!1,Xl=0,Iv=0,Ql=1/0,ec=null,ga=null,Vt=0,va=null,io=null,Ps=0,ef=0,tf=null,Ov=null,pr=0,nf=null;function Cn(){return(et&2)!==0&&Pe!==0?Pe&-Pe:O.T!==null?cf():Kt()}function Lv(){if(Nn===0)if((Pe&536870912)===0||He){var e=Ha;Ha<<=1,(Ha&3932160)===0&&(Ha=262144),Nn=e}else Nn=536870912;return e=Tn.current,e!==null&&(e.flags|=32),Nn}function vn(e,n,a){(e===ft&&(nt===2||nt===9)||e.cancelPendingCommit!==null)&&(oo(e,0),ya(e,Pe,Nn,!1)),$e(e,a),((et&2)===0||e!==ft)&&(e===ft&&((et&2)===0&&(ri|=a),jt===4&&ya(e,Pe,Nn,!1)),hs(e))}function Bv(e,n,a){if((et&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ne(e,n),f=l?sS(e,n):af(e,n,!0),h=l;do{if(f===0){so&&!l&&ya(e,n,0,!1);break}else{if(a=e.current.alternate,h&&!tS(a)){f=af(e,n,!1),h=!1;continue}if(f===2){if(h=n,e.errorRecoveryDisabledLanes&h)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var w=e;f=fr;var M=w.current.memoizedState.isDehydrated;if(M&&(oo(w,x).flags|=256),x=af(w,x,!1),x!==2){if(Wu&&!M){w.errorRecoveryDisabledLanes|=h,ri|=h,f=4;break e}h=gn,gn=f,h!==null&&(gn===null?gn=h:gn.push.apply(gn,h))}f=x}if(h=!1,f!==2)continue}}if(f===1){oo(e,0),ya(e,n,0,!0);break}e:{switch(l=e,h=f,h){case 0:case 1:throw Error(r(345));case 4:if((n&4194048)!==n)break;case 6:ya(l,n,Nn,!ma);break e;case 2:gn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((n&62914560)===n&&(f=Xl+300-_e(),10<f)){if(ya(l,n,Nn,!ma),P(l,0,!0)!==0)break e;Ps=n,l.timeoutHandle=m0(zv.bind(null,l,a,gn,ec,Qu,n,Nn,ri,ao,ma,h,"Throttled",-0,0),f);break e}zv(l,a,gn,ec,Qu,n,Nn,ri,ao,ma,h,null,-0,0)}}break}while(!0);hs(e)}function zv(e,n,a,l,f,h,x,w,M,H,Y,te,G,K){if(e.timeoutHandle=-1,te=n.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:js},Av(n,h,te);var ve=(h&62914560)===h?Xl-_e():(h&4194048)===h?Iv-_e():0;if(ve=US(te,ve),ve!==null){Ps=h,e.cancelPendingCommit=ve(Fv.bind(null,e,n,h,a,l,f,x,w,M,Y,te,null,G,K)),ya(e,h,x,!H);return}}Fv(e,n,h,a,l,f,x,w,M)}function tS(e){for(var n=e;;){var a=n.tag;if((a===0||a===11||a===15)&&n.flags&16384&&(a=n.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],h=f.getSnapshot;f=f.value;try{if(!kn(h(),f))return!1}catch{return!1}}if(a=n.child,n.subtreeFlags&16384&&a!==null)a.return=n,n=a;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 ya(e,n,a,l){n&=~Xu,n&=~ri,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var h=31-nn(f),x=1<<h;l[h]=-1,f&=~x}a!==0&&Re(e,a,n)}function tc(){return(et&6)===0?(mr(0),!1):!0}function sf(){if(Be!==null){if(nt===0)var e=Be.return;else e=Be,As=Xa=null,bu(e),Ji=null,Jo=0,e=Be;for(;e!==null;)hv(e.alternate,e),e=e.return;Be=null}}function oo(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,xS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ps=0,sf(),ft=e,Be=a=Cs(e.current,null),Pe=n,nt=0,jn=null,ma=!1,so=ne(e,n),Wu=!1,ao=Nn=Xu=ri=ha=jt=0,gn=fr=null,Qu=!1,(n&8)!==0&&(n|=n&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=n;0<l;){var f=31-nn(l),h=1<<f;n|=e[f],l&=~h}return $s=n,kl(),a}function Uv(e,n){Me=null,O.H=ar,n===Yi||n===Al?(n=tg(),nt=3):n===ru?(n=tg(),nt=4):nt=n===Ou?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,jn=n,Be===null&&(jt=1,ql(e,zn(n,e.current)))}function $v(){var e=Tn.current;return e===null?!0:(Pe&4194048)===Pe?Vn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Vn:!1}function Pv(){var e=O.H;return O.H=ar,e===null?ar:e}function Vv(){var e=O.A;return O.A=Qk,e}function nc(){jt=4,ma||(Pe&4194048)!==Pe&&Tn.current!==null||(so=!0),(ha&134217727)===0&&(ri&134217727)===0||ft===null||ya(ft,Pe,Nn,!1)}function af(e,n,a){var l=et;et|=2;var f=Pv(),h=Vv();(ft!==e||Pe!==n)&&(ec=null,oo(e,n)),n=!1;var x=jt;e:do try{if(nt!==0&&Be!==null){var w=Be,M=jn;switch(nt){case 8:sf(),x=6;break e;case 3:case 2:case 9:case 6:Tn.current===null&&(n=!0);var H=nt;if(nt=0,jn=null,ro(e,w,M,H),a&&so){x=0;break e}break;default:H=nt,nt=0,jn=null,ro(e,w,M,H)}}nS(),x=jt;break}catch(Y){Uv(e,Y)}while(!0);return n&&e.shellSuspendCounter++,As=Xa=null,et=l,O.H=f,O.A=h,Be===null&&(ft=null,Pe=0,kl()),x}function nS(){for(;Be!==null;)Hv(Be)}function sS(e,n){var a=et;et|=2;var l=Pv(),f=Vv();ft!==e||Pe!==n?(ec=null,Ql=_e()+500,oo(e,n)):so=ne(e,n);e:do try{if(nt!==0&&Be!==null){n=Be;var h=jn;t:switch(nt){case 1:nt=0,jn=null,ro(e,n,h,1);break;case 2:case 9:if(Qh(h)){nt=0,jn=null,qv(n);break}n=function(){nt!==2&&nt!==9||ft!==e||(nt=7),hs(e)},h.then(n,n);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:Qh(h)?(nt=0,jn=null,qv(n)):(nt=0,jn=null,ro(e,n,h,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var w=Be;if(x?E0(x):w.stateNode.complete){nt=0,jn=null;var M=w.sibling;if(M!==null)Be=M;else{var H=w.return;H!==null?(Be=H,sc(H)):Be=null}break t}}nt=0,jn=null,ro(e,n,h,5);break;case 6:nt=0,jn=null,ro(e,n,h,6);break;case 8:sf(),jt=6;break e;default:throw Error(r(462))}}aS();break}catch(Y){Uv(e,Y)}while(!0);return As=Xa=null,O.H=l,O.A=f,et=a,Be!==null?0:(ft=null,Pe=0,kl(),jt)}function aS(){for(;Be!==null&&!wi();)Hv(Be)}function Hv(e){var n=pv(e.alternate,e,$s);e.memoizedProps=e.pendingProps,n===null?sc(e):Be=n}function qv(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=rv(a,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=rv(a,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:bu(n);default:hv(a,n),n=Be=Vh(n,$s),n=pv(a,n,$s)}e.memoizedProps=e.pendingProps,n===null?sc(e):Be=n}function ro(e,n,a,l){As=Xa=null,bu(n),Ji=null,Jo=0;var f=n.return;try{if(Fk(e,f,n,a,Pe)){jt=1,ql(e,zn(a,e.current)),Be=null;return}}catch(h){if(f!==null)throw Be=f,h;jt=1,ql(e,zn(a,e.current)),Be=null;return}n.flags&32768?(He||l===1?e=!0:so||(Pe&536870912)!==0?e=!1:(ma=e=!0,(l===2||l===9||l===3||l===6)&&(l=Tn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Gv(n,e)):sc(n)}function sc(e){var n=e;do{if((n.flags&32768)!==0){Gv(n,ma);return}e=n.return;var a=Yk(n.alternate,n,$s);if(a!==null){Be=a;return}if(n=n.sibling,n!==null){Be=n;return}Be=n=e}while(n!==null);jt===0&&(jt=5)}function Gv(e,n){do{var a=Jk(e.alternate,e);if(a!==null){a.flags&=32767,Be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Be=e;return}Be=e=a}while(e!==null);jt=6,Be=null}function Fv(e,n,a,l,f,h,x,w,M){e.cancelPendingCommit=null;do ac();while(Vt!==0);if((et&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(h=n.lanes|n.childLanes,h|=Fd,ke(e,a,h,x,w,M),e===ft&&(Be=ft=null,Pe=0),io=n,va=e,Ps=a,ef=h,tf=f,Ov=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,lS(In,function(){return Wv(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=O.T,O.T=null,f=Z.p,Z.p=2,x=et,et|=4;try{Wk(e,n,a)}finally{et=x,Z.p=f,O.T=l}}Vt=1,Zv(),Kv(),Yv()}}function Zv(){if(Vt===1){Vt=0;var e=va,n=io,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=O.T,O.T=null;var l=Z.p;Z.p=2;var f=et;et|=4;try{Nv(n,e);var h=vf,x=Mh(e.containerInfo),w=h.focusedElem,M=h.selectionRange;if(x!==w&&w&&w.ownerDocument&&Rh(w.ownerDocument.documentElement,w)){if(M!==null&&Pd(w)){var H=M.start,Y=M.end;if(Y===void 0&&(Y=H),"selectionStart"in w)w.selectionStart=H,w.selectionEnd=Math.min(Y,w.value.length);else{var te=w.ownerDocument||document,G=te&&te.defaultView||window;if(G.getSelection){var K=G.getSelection(),ve=w.textContent.length,we=Math.min(M.start,ve),rt=M.end===void 0?we:Math.min(M.end,ve);!K.extend&&we>rt&&(x=rt,rt=we,we=x);var $=Dh(w,we),z=Dh(w,rt);if($&&z&&(K.rangeCount!==1||K.anchorNode!==$.node||K.anchorOffset!==$.offset||K.focusNode!==z.node||K.focusOffset!==z.offset)){var V=te.createRange();V.setStart($.node,$.offset),K.removeAllRanges(),we>rt?(K.addRange(V),K.extend(z.node,z.offset)):(V.setEnd(z.node,z.offset),K.addRange(V))}}}}for(te=[],K=w;K=K.parentNode;)K.nodeType===1&&te.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<te.length;w++){var J=te[w];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}gc=!!gf,vf=gf=null}finally{et=f,Z.p=l,O.T=a}}e.current=n,Vt=2}}function Kv(){if(Vt===2){Vt=0;var e=va,n=io,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=O.T,O.T=null;var l=Z.p;Z.p=2;var f=et;et|=4;try{kv(e,n.alternate,n)}finally{et=f,Z.p=l,O.T=a}}Vt=3}}function Yv(){if(Vt===4||Vt===3){Vt=0,Wn();var e=va,n=io,a=Ps,l=Ov;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Vt=5:(Vt=0,io=va=null,Jv(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(ga=null),Pt(a),n=n.stateNode,tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(na,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=O.T,f=Z.p,Z.p=2,O.T=null;try{for(var h=e.onRecoverableError,x=0;x<l.length;x++){var w=l[x];h(w.value,{componentStack:w.stack})}}finally{O.T=n,Z.p=f}}(Ps&3)!==0&&ac(),hs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===nf?pr++:(pr=0,nf=e):pr=0,mr(0)}}function Jv(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Ko(n)))}function ac(){return Zv(),Kv(),Yv(),Wv()}function Wv(){if(Vt!==5)return!1;var e=va,n=ef;ef=0;var a=Pt(Ps),l=O.T,f=Z.p;try{Z.p=32>a?32:a,O.T=null,a=tf,tf=null;var h=va,x=Ps;if(Vt=0,io=va=null,Ps=0,(et&6)!==0)throw Error(r(331));var w=et;if(et|=4,Rv(h.current),Ev(h,h.current,x,a),et=w,mr(0,!1),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(na,h)}catch{}return!0}finally{Z.p=f,O.T=l,Jv(e,n)}}function Xv(e,n,a){n=zn(a,n),n=Iu(e.stateNode,n,2),e=da(e,n,2),e!==null&&($e(e,2),hs(e))}function st(e,n,a){if(e.tag===3)Xv(e,e,a);else for(;n!==null;){if(n.tag===3){Xv(n,e,a);break}else if(n.tag===1){var l=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(ga===null||!ga.has(l))){e=zn(a,e),a=Qg(2),l=da(n,a,2),l!==null&&(ev(a,l,n,e),$e(l,2),hs(l));break}}n=n.return}}function of(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new eS;var f=new Set;l.set(n,f)}else f=l.get(n),f===void 0&&(f=new Set,l.set(n,f));f.has(a)||(Wu=!0,f.add(a),e=iS.bind(null,e,n,a),n.then(e,e))}function iS(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,ft===e&&(Pe&a)===a&&(jt===4||jt===3&&(Pe&62914560)===Pe&&300>_e()-Xl?(et&2)===0&&oo(e,0):Xu|=a,ao===Pe&&(ao=0)),hs(e)}function Qv(e,n){n===0&&(n=pe()),e=Ya(e,n),e!==null&&($e(e,n),hs(e))}function oS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Qv(e,a)}function rS(e,n){var a=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(a=f.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),Qv(e,a)}function lS(e,n){return Ss(e,n)}var ic=null,lo=null,rf=!1,oc=!1,lf=!1,ba=0;function hs(e){e!==lo&&e.next===null&&(lo===null?ic=lo=e:lo=lo.next=e),oc=!0,rf||(rf=!0,dS())}function mr(e,n){if(!lf&&oc){lf=!0;do for(var a=!1,l=ic;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var x=l.suspendedLanes,w=l.pingedLanes;h=(1<<31-nn(42|e)+1)-1,h&=f&~(x&~w),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,s0(l,h))}else h=Pe,h=P(l,l===ft?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||ne(l,h)||(a=!0,s0(l,h));l=l.next}while(a);lf=!1}}function cS(){e0()}function e0(){oc=rf=!1;var e=0;ba!==0&&_S()&&(e=ba);for(var n=_e(),a=null,l=ic;l!==null;){var f=l.next,h=t0(l,n);h===0?(l.next=null,a===null?ic=f:a.next=f,f===null&&(lo=a)):(a=l,(e!==0||(h&3)!==0)&&(oc=!0)),l=f}Vt!==0&&Vt!==5||mr(e),ba!==0&&(ba=0)}function t0(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var x=31-nn(h),w=1<<x,M=f[x];M===-1?((w&a)===0||(w&l)!==0)&&(f[x]=le(w,n)):M<=n&&(e.expiredLanes|=w),h&=~w}if(n=ft,a=Pe,a=P(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(nt===2||nt===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&us(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||ne(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&us(l),Pt(a)){case 2:case 8:a=xn;break;case 32:a=In;break;case 268435456:a=Pa;break;default:a=In}return l=n0.bind(null,e),a=Ss(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&us(l),e.callbackPriority=2,e.callbackNode=null,2}function n0(e,n){if(Vt!==0&&Vt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ac()&&e.callbackNode!==a)return null;var l=Pe;return l=P(e,e===ft?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Bv(e,l,n),t0(e,_e()),e.callbackNode!=null&&e.callbackNode===a?n0.bind(null,e):null)}function s0(e,n){if(ac())return null;Bv(e,n,!0)}function dS(){kS(function(){(et&6)!==0?Ss(on,cS):e0()})}function cf(){if(ba===0){var e=Zi;e===0&&(e=Va,Va<<=1,(Va&261888)===0&&(Va=256)),ba=e}return ba}function a0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ml(""+e)}function i0(e,n){var a=n.ownerDocument.createElement("input");return a.name=n.name,a.value=n.value,e.id&&a.setAttribute("form",e.id),n.parentNode.insertBefore(a,n),e=new FormData(e),a.parentNode.removeChild(a),e}function uS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var h=a0((f[qt]||null).action),x=l.submitter;x&&(n=(n=x[qt]||null)?a0(n.formAction):x.getAttribute("formAction"),n!==null&&(h=n,x=null));var w=new yl("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ba!==0){var M=x?i0(f,x):new FormData(f);Cu(a,{pending:!0,data:M,method:f.method,action:h},null,M)}}else typeof h=="function"&&(w.preventDefault(),M=x?i0(f,x):new FormData(f),Cu(a,{pending:!0,data:M,method:f.method,action:h},h,M))},currentTarget:f}]})}}for(var df=0;df<Gd.length;df++){var uf=Gd[df],fS=uf.toLowerCase(),pS=uf[0].toUpperCase()+uf.slice(1);Qn(fS,"on"+pS)}Qn(Lh,"onAnimationEnd"),Qn(Bh,"onAnimationIteration"),Qn(zh,"onAnimationStart"),Qn("dblclick","onDoubleClick"),Qn("focusin","onFocus"),Qn("focusout","onBlur"),Qn(Ek,"onTransitionRun"),Qn(Ak,"onTransitionStart"),Qn(Dk,"onTransitionCancel"),Qn(Uh,"onTransitionEnd"),Mi("onMouseEnter",["mouseout","mouseover"]),Mi("onMouseLeave",["mouseout","mouseover"]),Mi("onPointerEnter",["pointerout","pointerover"]),Mi("onPointerLeave",["pointerout","pointerover"]),Ga("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ga("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ga("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ga("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ga("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ga("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hr="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(" "),mS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hr));function o0(e,n){n=(n&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],f=l.event;l=l.listeners;e:{var h=void 0;if(n)for(var x=l.length-1;0<=x;x--){var w=l[x],M=w.instance,H=w.currentTarget;if(w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=H;try{h(f)}catch(Y){xl(Y)}f.currentTarget=null,h=M}else for(x=0;x<l.length;x++){if(w=l[x],M=w.instance,H=w.currentTarget,w=w.listener,M!==h&&f.isPropagationStopped())break e;h=w,f.currentTarget=H;try{h(f)}catch(Y){xl(Y)}f.currentTarget=null,h=M}}}}function ze(e,n){var a=n[Sd];a===void 0&&(a=n[Sd]=new Set);var l=e+"__bubble";a.has(l)||(r0(n,e,2,!1),a.add(l))}function ff(e,n,a){var l=0;n&&(l|=4),r0(a,e,l,n)}var rc="_reactListening"+Math.random().toString(36).slice(2);function pf(e){if(!e[rc]){e[rc]=!0,eh.forEach(function(a){a!=="selectionchange"&&(mS.has(a)||ff(a,!1,e),ff(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[rc]||(n[rc]=!0,ff("selectionchange",!1,n))}}function r0(e,n,a,l){switch(L0(n)){case 2:var f=VS;break;case 8:f=HS;break;default:f=Cf}a=f.bind(null,n,a,e),f=void 0,!Rd||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(n,a,{capture:!0,passive:f}):e.addEventListener(n,a,!0):f!==void 0?e.addEventListener(n,a,{passive:f}):e.addEventListener(n,a,!1)}function mf(e,n,a,l,f){var h=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var w=l.stateNode.containerInfo;if(w===f)break;if(x===4)for(x=l.return;x!==null;){var M=x.tag;if((M===3||M===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;w!==null;){if(x=Ai(w),x===null)return;if(M=x.tag,M===5||M===6||M===26||M===27){l=h=x;continue e}w=w.parentNode}}l=l.return}fh(function(){var H=h,Y=Ad(a),te=[];e:{var G=$h.get(e);if(G!==void 0){var K=yl,ve=e;switch(e){case"keypress":if(gl(a)===0)break e;case"keydown":case"keyup":K=rk;break;case"focusin":ve="focus",K=Ld;break;case"focusout":ve="blur",K=Ld;break;case"beforeblur":case"afterblur":K=Ld;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=hh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Y1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=dk;break;case Lh:case Bh:case zh:K=X1;break;case Uh:K=fk;break;case"scroll":case"scrollend":K=Z1;break;case"wheel":K=mk;break;case"copy":case"cut":case"paste":K=ek;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=vh;break;case"toggle":case"beforetoggle":K=gk}var we=(n&4)!==0,rt=!we&&(e==="scroll"||e==="scrollend"),$=we?G!==null?G+"Capture":null:G;we=[];for(var z=H,V;z!==null;){var J=z;if(V=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||V===null||$===null||(J=Bo(z,$),J!=null&&we.push(gr(z,J,V))),rt)break;z=z.return}0<we.length&&(G=new K(G,ve,null,a,Y),te.push({event:G,listeners:we}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",G&&a!==Ed&&(ve=a.relatedTarget||a.fromElement)&&(Ai(ve)||ve[Ei]))break e;if((K||G)&&(G=Y.window===Y?Y:(G=Y.ownerDocument)?G.defaultView||G.parentWindow:window,K?(ve=a.relatedTarget||a.toElement,K=H,ve=ve?Ai(ve):null,ve!==null&&(rt=d(ve),we=ve.tag,ve!==rt||we!==5&&we!==27&&we!==6)&&(ve=null)):(K=null,ve=H),K!==ve)){if(we=hh,J="onMouseLeave",$="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(we=vh,J="onPointerLeave",$="onPointerEnter",z="pointer"),rt=K==null?G:Lo(K),V=ve==null?G:Lo(ve),G=new we(J,z+"leave",K,a,Y),G.target=rt,G.relatedTarget=V,J=null,Ai(Y)===H&&(we=new we($,z+"enter",ve,a,Y),we.target=V,we.relatedTarget=rt,J=we),rt=J,K&&ve)t:{for(we=hS,$=K,z=ve,V=0,J=$;J;J=we(J))V++;J=0;for(var Se=z;Se;Se=we(Se))J++;for(;0<V-J;)$=we($),V--;for(;0<J-V;)z=we(z),J--;for(;V--;){if($===z||z!==null&&$===z.alternate){we=$;break t}$=we($),z=we(z)}we=null}else we=null;K!==null&&l0(te,G,K,we,!1),ve!==null&&rt!==null&&l0(te,rt,ve,we,!0)}}e:{if(G=H?Lo(H):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var Ye=wh;else if(Sh(G))if(jh)Ye=jk;else{Ye=Tk;var be=Sk}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?H&&Cd(H.elementType)&&(Ye=wh):Ye=wk;if(Ye&&(Ye=Ye(e,H))){Th(te,Ye,a,Y);break e}be&&be(e,G,H),e==="focusout"&&H&&G.type==="number"&&H.memoizedProps.value!=null&&Nd(G,"number",G.value)}switch(be=H?Lo(H):window,e){case"focusin":(Sh(be)||be.contentEditable==="true")&&(Ui=be,Vd=H,Go=null);break;case"focusout":Go=Vd=Ui=null;break;case"mousedown":Hd=!0;break;case"contextmenu":case"mouseup":case"dragend":Hd=!1,Ih(te,a,Y);break;case"selectionchange":if(Ck)break;case"keydown":case"keyup":Ih(te,a,Y)}var Ie;if(zd)e:{switch(e){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else zi?xh(e,a)&&(Ve="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ve="onCompositionStart");Ve&&(yh&&a.locale!=="ko"&&(zi||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&zi&&(Ie=ph()):(sa=Y,Md="value"in sa?sa.value:sa.textContent,zi=!0)),be=lc(H,Ve),0<be.length&&(Ve=new gh(Ve,e,null,a,Y),te.push({event:Ve,listeners:be}),Ie?Ve.data=Ie:(Ie=kh(a),Ie!==null&&(Ve.data=Ie)))),(Ie=yk?bk(e,a):_k(e,a))&&(Ve=lc(H,"onBeforeInput"),0<Ve.length&&(be=new gh("onBeforeInput","beforeinput",null,a,Y),te.push({event:be,listeners:Ve}),be.data=Ie)),uS(te,e,H,a,Y)}o0(te,n)})}function gr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function lc(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Bo(e,a),f!=null&&l.unshift(gr(e,f,h)),f=Bo(e,n),f!=null&&l.push(gr(e,f,h))),e.tag===3)return l;e=e.return}return[]}function hS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function l0(e,n,a,l,f){for(var h=n._reactName,x=[];a!==null&&a!==l;){var w=a,M=w.alternate,H=w.stateNode;if(w=w.tag,M!==null&&M===l)break;w!==5&&w!==26&&w!==27||H===null||(M=H,f?(H=Bo(a,h),H!=null&&x.unshift(gr(a,H,M))):f||(H=Bo(a,h),H!=null&&x.push(gr(a,H,M)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var gS=/\r\n?/g,vS=/\u0000|\uFFFD/g;function c0(e){return(typeof e=="string"?e:""+e).replace(gS,`
26
- `).replace(vS,"")}function d0(e,n){return n=c0(n),c0(e)===n}function ot(e,n,a,l,f,h){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Oi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Oi(e,""+l);break;case"className":fl(e,"class",l);break;case"tabIndex":fl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":fl(e,a,l);break;case"style":dh(e,l,h);break;case"data":if(n!=="object"){fl(e,"data",l);break}case"src":case"href":if(l===""&&(n!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ml(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"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 h=="function"&&(a==="formAction"?(n!=="input"&&ot(e,n,"name",f.name,f,null),ot(e,n,"formEncType",f.formEncType,f,null),ot(e,n,"formMethod",f.formMethod,f,null),ot(e,n,"formTarget",f.formTarget,f,null)):(ot(e,n,"encType",f.encType,f,null),ot(e,n,"method",f.method,f,null),ot(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ml(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=js);break;case"onScroll":l!=null&&ze("scroll",e);break;case"onScrollEnd":l!=null&&ze("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}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}a=ml(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+l):e.removeAttribute(a);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(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":ze("beforetoggle",e),ze("toggle",e),ul(e,"popover",l);break;case"xlinkActuate":ws(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":ws(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":ws(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":ws(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":ws(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":ws(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":ws(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":ws(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":ws(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":ul(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=G1.get(a)||a,ul(e,a,l))}}function hf(e,n,a,l,f,h){switch(a){case"style":dh(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Oi(e,l):(typeof l=="number"||typeof l=="bigint")&&Oi(e,""+l);break;case"onScroll":l!=null&&ze("scroll",e);break;case"onScrollEnd":l!=null&&ze("scrollend",e);break;case"onClick":l!=null&&(e.onclick=js);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!th.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),h=e[qt]||null,h=h!=null?h[a]:null,typeof h=="function"&&e.removeEventListener(n,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(n,l,f);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):ul(e,a,l)}}}function Xt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ze("error",e),ze("load",e);var l=!1,f=!1,h;for(h in a)if(a.hasOwnProperty(h)){var x=a[h];if(x!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ot(e,n,h,x,a,null)}}f&&ot(e,n,"srcSet",a.srcSet,a,null),l&&ot(e,n,"src",a.src,a,null);return;case"input":ze("invalid",e);var w=h=x=f=null,M=null,H=null;for(l in a)if(a.hasOwnProperty(l)){var Y=a[l];if(Y!=null)switch(l){case"name":f=Y;break;case"type":x=Y;break;case"checked":M=Y;break;case"defaultChecked":H=Y;break;case"value":h=Y;break;case"defaultValue":w=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,n));break;default:ot(e,n,l,Y,a,null)}}oh(e,h,w,M,H,x,f,!1);return;case"select":ze("invalid",e),l=x=h=null;for(f in a)if(a.hasOwnProperty(f)&&(w=a[f],w!=null))switch(f){case"value":h=w;break;case"defaultValue":x=w;break;case"multiple":l=w;default:ot(e,n,f,w,a,null)}n=h,a=x,e.multiple=!!l,n!=null?Ii(e,!!l,n,!1):a!=null&&Ii(e,!!l,a,!0);return;case"textarea":ze("invalid",e),h=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(w=a[x],w!=null))switch(x){case"value":l=w;break;case"defaultValue":f=w;break;case"children":h=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:ot(e,n,x,w,a,null)}lh(e,l,f,h);return;case"option":for(M in a)if(a.hasOwnProperty(M)&&(l=a[M],l!=null))switch(M){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ot(e,n,M,l,a,null)}return;case"dialog":ze("beforetoggle",e),ze("toggle",e),ze("cancel",e),ze("close",e);break;case"iframe":case"object":ze("load",e);break;case"video":case"audio":for(l=0;l<hr.length;l++)ze(hr[l],e);break;case"image":ze("error",e),ze("load",e);break;case"details":ze("toggle",e);break;case"embed":case"source":case"link":ze("error",e),ze("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(H in a)if(a.hasOwnProperty(H)&&(l=a[H],l!=null))switch(H){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ot(e,n,H,l,a,null)}return;default:if(Cd(n)){for(Y in a)a.hasOwnProperty(Y)&&(l=a[Y],l!==void 0&&hf(e,n,Y,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&ot(e,n,w,l,a,null))}function yS(e,n,a,l){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,x=null,w=null,M=null,H=null,Y=null;for(K in a){var te=a[K];if(a.hasOwnProperty(K)&&te!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":M=te;default:l.hasOwnProperty(K)||ot(e,n,K,null,l,te)}}for(var G in l){var K=l[G];if(te=a[G],l.hasOwnProperty(G)&&(K!=null||te!=null))switch(G){case"type":h=K;break;case"name":f=K;break;case"checked":H=K;break;case"defaultChecked":Y=K;break;case"value":x=K;break;case"defaultValue":w=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,n));break;default:K!==te&&ot(e,n,G,K,l,te)}}jd(e,x,w,M,H,Y,h,f);return;case"select":K=x=w=G=null;for(h in a)if(M=a[h],a.hasOwnProperty(h)&&M!=null)switch(h){case"value":break;case"multiple":K=M;default:l.hasOwnProperty(h)||ot(e,n,h,null,l,M)}for(f in l)if(h=l[f],M=a[f],l.hasOwnProperty(f)&&(h!=null||M!=null))switch(f){case"value":G=h;break;case"defaultValue":w=h;break;case"multiple":x=h;default:h!==M&&ot(e,n,f,h,l,M)}n=w,a=x,l=K,G!=null?Ii(e,!!a,G,!1):!!l!=!!a&&(n!=null?Ii(e,!!a,n,!0):Ii(e,!!a,a?[]:"",!1));return;case"textarea":K=G=null;for(w in a)if(f=a[w],a.hasOwnProperty(w)&&f!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ot(e,n,w,null,l,f)}for(x in l)if(f=l[x],h=a[x],l.hasOwnProperty(x)&&(f!=null||h!=null))switch(x){case"value":G=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==h&&ot(e,n,x,f,l,h)}rh(e,G,K);return;case"option":for(var ve in a)if(G=a[ve],a.hasOwnProperty(ve)&&G!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":e.selected=!1;break;default:ot(e,n,ve,null,l,G)}for(M in l)if(G=l[M],K=a[M],l.hasOwnProperty(M)&&G!==K&&(G!=null||K!=null))switch(M){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:ot(e,n,M,G,l,K)}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 we in a)G=a[we],a.hasOwnProperty(we)&&G!=null&&!l.hasOwnProperty(we)&&ot(e,n,we,null,l,G);for(H in l)if(G=l[H],K=a[H],l.hasOwnProperty(H)&&G!==K&&(G!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(r(137,n));break;default:ot(e,n,H,G,l,K)}return;default:if(Cd(n)){for(var rt in a)G=a[rt],a.hasOwnProperty(rt)&&G!==void 0&&!l.hasOwnProperty(rt)&&hf(e,n,rt,void 0,l,G);for(Y in l)G=l[Y],K=a[Y],!l.hasOwnProperty(Y)||G===K||G===void 0&&K===void 0||hf(e,n,Y,G,l,K);return}}for(var $ in a)G=a[$],a.hasOwnProperty($)&&G!=null&&!l.hasOwnProperty($)&&ot(e,n,$,null,l,G);for(te in l)G=l[te],K=a[te],!l.hasOwnProperty(te)||G===K||G==null&&K==null||ot(e,n,te,G,l,K)}function u0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bS(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,a=performance.getEntriesByType("resource"),l=0;l<a.length;l++){var f=a[l],h=f.transferSize,x=f.initiatorType,w=f.duration;if(h&&w&&u0(x)){for(x=0,w=f.responseEnd,l+=1;l<a.length;l++){var M=a[l],H=M.startTime;if(H>w)break;var Y=M.transferSize,te=M.initiatorType;Y&&u0(te)&&(M=M.responseEnd,x+=Y*(M<w?1:(w-H)/(M-H)))}if(--l,n+=8*(h+x)/(f.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 gf=null,vf=null;function cc(e){return e.nodeType===9?e:e.ownerDocument}function f0(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 p0(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 yf(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 bf=null;function _S(){var e=window.event;return e&&e.type==="popstate"?e===bf?!1:(bf=e,!0):(bf=null,!1)}var m0=typeof setTimeout=="function"?setTimeout:void 0,xS=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,kS=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(e){return h0.resolve(null).then(e).catch(SS)}:m0;function SS(e){setTimeout(function(){throw e})}function _a(e){return e==="head"}function g0(e,n){var a=n,l=0;do{var f=a.nextSibling;if(e.removeChild(a),f&&f.nodeType===8)if(a=f.data,a==="/$"||a==="/&"){if(l===0){e.removeChild(f),po(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")vr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,vr(a);for(var h=a.firstChild;h;){var x=h.nextSibling,w=h.nodeName;h[Oo]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&h.rel.toLowerCase()==="stylesheet"||a.removeChild(h),h=x}}else a==="body"&&vr(e.ownerDocument.body);a=f}while(a);po(n)}function v0(e,n){var a=e;e=0;do{var l=a.nextSibling;if(a.nodeType===1?n?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(n?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),l&&l.nodeType===8)if(a=l.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=l}while(a)}function _f(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var a=n;switch(n=n.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":_f(a),Td(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function TS(e,n,a,l){for(;e.nodeType===1;){var f=a;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Oo])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Hn(e.nextSibling),e===null)break}return null}function wS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Hn(e.nextSibling),e===null))return null;return e}function y0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Hn(e.nextSibling),e===null))return null;return e}function xf(e){return e.data==="$?"||e.data==="$~"}function kf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jS(e,n){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||a.readyState!=="loading")n();else{var l=function(){n(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Hn(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 Sf=null;function b0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Hn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function _0(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(n===0)return e;n--}else a!=="/$"&&a!=="/&"||n++}e=e.previousSibling}return null}function x0(e,n,a){switch(n=cc(a),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 vr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);Td(e)}var qn=new Map,k0=new Set;function dc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Vs=Z.d;Z.d={f:NS,r:CS,D:ES,C:AS,L:DS,m:RS,X:IS,S:MS,M:OS};function NS(){var e=Vs.f(),n=tc();return e||n}function CS(e){var n=Di(e);n!==null&&n.tag===5&&n.type==="form"?Ug(n):Vs.r(e)}var co=typeof document>"u"?null:document;function S0(e,n,a){var l=co;if(l&&typeof n=="string"&&n){var f=Ln(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),k0.has(f)||(k0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),Xt(n,"link",e),Gt(n),l.head.appendChild(n)))}}function ES(e){Vs.D(e),S0("dns-prefetch",e,null)}function AS(e,n){Vs.C(e,n),S0("preconnect",e,n)}function DS(e,n,a){Vs.L(e,n,a);var l=co;if(l&&e&&n){var f='link[rel="preload"][as="'+Ln(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Ln(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Ln(a.imageSizes)+'"]')):f+='[href="'+Ln(e)+'"]';var h=f;switch(n){case"style":h=uo(e);break;case"script":h=fo(e)}qn.has(h)||(e=b({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),qn.set(h,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(yr(h))||n==="script"&&l.querySelector(br(h))||(n=l.createElement("link"),Xt(n,"link",e),Gt(n),l.head.appendChild(n)))}}function RS(e,n){Vs.m(e,n);var a=co;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Ln(l)+'"][href="'+Ln(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=fo(e)}if(!qn.has(h)&&(e=b({rel:"modulepreload",href:e},n),qn.set(h,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(br(h)))return}l=a.createElement("link"),Xt(l,"link",e),Gt(l),a.head.appendChild(l)}}}function MS(e,n,a){Vs.S(e,n,a);var l=co;if(l&&e){var f=Ri(l).hoistableStyles,h=uo(e);n=n||"default";var x=f.get(h);if(!x){var w={loading:0,preload:null};if(x=l.querySelector(yr(h)))w.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":n},a),(a=qn.get(h))&&Tf(e,a);var M=x=l.createElement("link");Gt(M),Xt(M,"link",e),M._p=new Promise(function(H,Y){M.onload=H,M.onerror=Y}),M.addEventListener("load",function(){w.loading|=1}),M.addEventListener("error",function(){w.loading|=2}),w.loading|=4,uc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:w},f.set(h,x)}}}function IS(e,n){Vs.X(e,n);var a=co;if(a&&e){var l=Ri(a).hoistableScripts,f=fo(e),h=l.get(f);h||(h=a.querySelector(br(f)),h||(e=b({src:e,async:!0},n),(n=qn.get(f))&&wf(e,n),h=a.createElement("script"),Gt(h),Xt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function OS(e,n){Vs.M(e,n);var a=co;if(a&&e){var l=Ri(a).hoistableScripts,f=fo(e),h=l.get(f);h||(h=a.querySelector(br(f)),h||(e=b({src:e,async:!0,type:"module"},n),(n=qn.get(f))&&wf(e,n),h=a.createElement("script"),Gt(h),Xt(h,"link",e),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function T0(e,n,a,l){var f=(f=ye.current)?dc(f):null;if(!f)throw Error(r(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=uo(a.href),a=Ri(f).hoistableStyles,l=a.get(n),l||(l={type:"style",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=uo(a.href);var h=Ri(f).hoistableStyles,x=h.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,x),(h=f.querySelector(yr(e)))&&!h._p&&(x.instance=h,x.state.loading=5),qn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},qn.set(e,a),h||LS(f,e,a,x.state))),n&&l===null)throw Error(r(528,""));return x}if(n&&l!==null)throw Error(r(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=fo(a),a=Ri(f).hoistableScripts,l=a.get(n),l||(l={type:"script",instance:null,count:0,state:null},a.set(n,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,e))}}function uo(e){return'href="'+Ln(e)+'"'}function yr(e){return'link[rel="stylesheet"]['+e+"]"}function w0(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function LS(e,n,a,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}),Xt(n,"link",a),Gt(n),e.head.appendChild(n))}function fo(e){return'[src="'+Ln(e)+'"]'}function br(e){return"script[async]"+e}function j0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Ln(a.href)+'"]');if(l)return n.instance=l,Gt(l),l;var f=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Gt(l),Xt(l,"style",f),uc(l,a.precedence,e),n.instance=l;case"stylesheet":f=uo(a.href);var h=e.querySelector(yr(f));if(h)return n.state.loading|=4,n.instance=h,Gt(h),h;l=w0(a),(f=qn.get(f))&&Tf(l,f),h=(e.ownerDocument||e).createElement("link"),Gt(h);var x=h;return x._p=new Promise(function(w,M){x.onload=w,x.onerror=M}),Xt(h,"link",l),n.state.loading|=4,uc(h,a.precedence,e),n.instance=h;case"script":return h=fo(a.src),(f=e.querySelector(br(h)))?(n.instance=f,Gt(f),f):(l=a,(f=qn.get(h))&&(l=b({},a),wf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Gt(f),Xt(f,"link",l),e.head.appendChild(f),n.instance=f);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,uc(l,a.precedence,e));return n.instance}function uc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,x=0;x<l.length;x++){var w=l[x];if(w.dataset.precedence===n)h=w;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function Tf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function wf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var fc=null;function N0(e,n,a){if(fc===null){var l=new Map,f=fc=new Map;f.set(a,l)}else f=fc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),f=0;f<a.length;f++){var h=a[f];if(!(h[Oo]||h[ht]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var x=h.getAttribute(n)||"";x=e+x;var w=l.get(x);w?w.push(h):l.set(x,[h])}}return l}function C0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function BS(e,n,a){if(a===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 E0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function zS(e,n,a,l){if(a.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var f=uo(l.href),h=n.querySelector(yr(f));if(h){n=h._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=pc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=h,Gt(h);return}h=n.ownerDocument||n,l=w0(l),(f=qn.get(f))&&Tf(l,f),h=h.createElement("link"),Gt(h);var x=h;x._p=new Promise(function(w,M){x.onload=w,x.onerror=M}),Xt(h,"link",l),a.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=pc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var jf=0;function US(e,n){return e.stylesheets&&e.count===0&&hc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&hc(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+n);0<e.imgBytes&&jf===0&&(jf=62500*bS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&hc(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>jf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function pc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var mc=null;function hc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,mc=new Map,n.forEach($S,e),mc=null,pc.call(e))}function $S(e,n){if(!(n.state.loading&4)){var a=mc.get(e);if(a)var l=a.get(null);else{a=new Map,mc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var x=f[h];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),h=a.get(x)||l,h===l&&a.set(null,f),a.set(x,f),this.count++,l=pc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var _r={$$typeof:E,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function PS(e,n,a,l,f,h,x,w,M){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=he(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=he(0),this.hiddenUpdates=he(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function A0(e,n,a,l,f,h,x,w,M,H,Y,te){return e=new PS(e,n,a,x,M,H,Y,te,w),n=1,h===!0&&(n|=24),h=Sn(3,null,null,n),e.current=h,h.stateNode=e,n=au(),n.refCount++,e.pooledCache=n,n.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:n},lu(h),e}function D0(e){return e?(e=Vi,e):Vi}function R0(e,n,a,l,f,h){f=D0(f),l.context===null?l.context=f:l.pendingContext=f,l=ca(n),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=da(e,l,n),a!==null&&(vn(a,e,n),Xo(a,e,n))}function M0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Nf(e,n){M0(e,n),(e=e.alternate)&&M0(e,n)}function I0(e){if(e.tag===13||e.tag===31){var n=Ya(e,67108864);n!==null&&vn(n,e,67108864),Nf(e,67108864)}}function O0(e){if(e.tag===13||e.tag===31){var n=Cn();n=Ke(n);var a=Ya(e,n);a!==null&&vn(a,e,n),Nf(e,n)}}var gc=!0;function VS(e,n,a,l){var f=O.T;O.T=null;var h=Z.p;try{Z.p=2,Cf(e,n,a,l)}finally{Z.p=h,O.T=f}}function HS(e,n,a,l){var f=O.T;O.T=null;var h=Z.p;try{Z.p=8,Cf(e,n,a,l)}finally{Z.p=h,O.T=f}}function Cf(e,n,a,l){if(gc){var f=Ef(l);if(f===null)mf(e,n,l,vc,a),B0(e,l);else if(GS(f,e,n,a,l))l.stopPropagation();else if(B0(e,l),n&4&&-1<qS.indexOf(e)){for(;f!==null;){var h=Di(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var x=Ts(h.pendingLanes);if(x!==0){var w=h;for(w.pendingLanes|=2,w.entangledLanes|=2;x;){var M=1<<31-nn(x);w.entanglements[1]|=M,x&=~M}hs(h),(et&6)===0&&(Ql=_e()+500,mr(0))}}break;case 31:case 13:w=Ya(h,2),w!==null&&vn(w,h,2),tc(),Nf(h,2)}if(h=Ef(l),h===null&&mf(e,n,l,vc,a),h===f)break;f=h}f!==null&&l.stopPropagation()}else mf(e,n,l,null,a)}}function Ef(e){return e=Ad(e),Af(e)}var vc=null;function Af(e){if(vc=null,e=Ai(e),e!==null){var n=d(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=u(n),e!==null)return e;e=null}else if(a===31){if(e=p(n),e!==null)return e;e=null}else if(a===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return vc=e,null}function L0(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(Qe()){case on:return 2;case xn:return 8;case In:case ji:return 32;case Pa:return 268435456;default:return 32}default:return 32}}var Df=!1,xa=null,ka=null,Sa=null,xr=new Map,kr=new Map,Ta=[],qS="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 B0(e,n){switch(e){case"focusin":case"focusout":xa=null;break;case"dragenter":case"dragleave":ka=null;break;case"mouseover":case"mouseout":Sa=null;break;case"pointerover":case"pointerout":xr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":kr.delete(n.pointerId)}}function Sr(e,n,a,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},n!==null&&(n=Di(n),n!==null&&I0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function GS(e,n,a,l,f){switch(n){case"focusin":return xa=Sr(xa,e,n,a,l,f),!0;case"dragenter":return ka=Sr(ka,e,n,a,l,f),!0;case"mouseover":return Sa=Sr(Sa,e,n,a,l,f),!0;case"pointerover":var h=f.pointerId;return xr.set(h,Sr(xr.get(h)||null,e,n,a,l,f)),!0;case"gotpointercapture":return h=f.pointerId,kr.set(h,Sr(kr.get(h)||null,e,n,a,l,f)),!0}return!1}function z0(e){var n=Ai(e.target);if(n!==null){var a=d(n);if(a!==null){if(n=a.tag,n===13){if(n=u(a),n!==null){e.blockedOn=n,At(e.priority,function(){O0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,At(e.priority,function(){O0(a)});return}}else if(n===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function yc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=Ef(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);Ed=l,a.target.dispatchEvent(l),Ed=null}else return n=Di(a),n!==null&&I0(n),e.blockedOn=a,!1;n.shift()}return!0}function U0(e,n,a){yc(e)&&a.delete(n)}function FS(){Df=!1,xa!==null&&yc(xa)&&(xa=null),ka!==null&&yc(ka)&&(ka=null),Sa!==null&&yc(Sa)&&(Sa=null),xr.forEach(U0),kr.forEach(U0)}function bc(e,n){e.blockedOn===n&&(e.blockedOn=null,Df||(Df=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,FS)))}var _c=null;function $0(e){_c!==e&&(_c=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){_c===e&&(_c=null);for(var n=0;n<e.length;n+=3){var a=e[n],l=e[n+1],f=e[n+2];if(typeof l!="function"){if(Af(l||a)===null)continue;break}var h=Di(a);h!==null&&(e.splice(n,3),n-=3,Cu(h,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function po(e){function n(M){return bc(M,e)}xa!==null&&bc(xa,e),ka!==null&&bc(ka,e),Sa!==null&&bc(Sa,e),xr.forEach(n),kr.forEach(n);for(var a=0;a<Ta.length;a++){var l=Ta[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ta.length&&(a=Ta[0],a.blockedOn===null);)z0(a),a.blockedOn===null&&Ta.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],h=a[l+1],x=f[qt]||null;if(typeof h=="function")x||$0(a);else if(x){var w=null;if(h&&h.hasAttribute("formAction")){if(f=h,x=h[qt]||null)w=x.formAction;else if(Af(f)!==null)continue}else w=x.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),$0(a)}}}function P0(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(a,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),f!==null&&(f(),f=null)}}}function Rf(e){this._internalRoot=e}xc.prototype.render=Rf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Cn();R0(a,l,e,n,null,null)},xc.prototype.unmount=Rf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;R0(e.current,2,null,e,null,null),tc(),n[Ei]=null}};function xc(e){this._internalRoot=e}xc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Kt();e={blockedOn:null,target:e,priority:n};for(var a=0;a<Ta.length&&n!==0&&n<Ta[a].priority;a++);Ta.splice(a,0,e),a===0&&z0(e)}};var V0=s.version;if(V0!=="19.2.4")throw Error(r(527,V0,"19.2.4"));Z.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=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ZS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var kc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!kc.isDisabled&&kc.supportsFiber)try{na=kc.inject(ZS),tn=kc}catch{}}return wr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=Yg,h=Jg,x=Wg;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError)),n=A0(e,1,!1,null,null,a,l,null,f,h,x,P0),e[Ei]=n.current,pf(e),new Rf(n)},wr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",h=Yg,x=Jg,w=Wg,M=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),n=A0(e,1,!0,n,a??null,l,f,M,h,x,w,P0),n.context=D0(null),a=n.current,l=Cn(),l=Ke(l),f=ca(l),f.callback=null,da(a,f,l),a=l,n.current.lanes=a,$e(n,a),hs(n),e[Ei]=n.current,pf(e),new xc(n)},wr.version="19.2.4",wr}var J0;function kT(){if(J0)return Mf.exports;J0=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(),Mf.exports=xT(),Mf.exports}var ST=kT();const TT="modulepreload",wT=function(t){return"/"+t},W0={},jT=function(s,i,r){let c=Promise.resolve();if(i&&i.length>0){let u=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(i.map(g=>{if(g=wT(g),g in W0)return;W0[g]=!0;const v=g.endsWith(".css"),b=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":TT,v||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),v)return new Promise((k,S)=>{_.addEventListener("load",k),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(u){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=u,window.dispatchEvent(p),!p.defaultPrevented)throw u}return c.then(u=>{for(const p of u||[])p.status==="rejected"&&d(p.reason);return s().catch(d)})},NT=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),CT=sT({baseUrl:"/",fetch:NT}),Te=aT(iT,CT),ET="_bar_1xhb4_1",AT="_input_1xhb4_32",DT="_select_1xhb4_67",RT="_btnPrimary_1xhb4_103",MT="_btnGhost_1xhb4_173",IT="_badge_1xhb4_195",OT="_disconnectHint_1xhb4_205",En={bar:ET,input:AT,select:DT,btnPrimary:RT,btnGhost:MT,badge:IT,disconnectHint:OT};function LT(t,s){if(!t)return!1;const i=s.find(r=>r.id===t);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function BT({environmentId:t,onReconnect:s}){return o.jsxs(o.Fragment,{children:[o.jsx("span",{className:En.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),o.jsx("button",{type:"button",onClick:()=>s(t),className:En.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function qr({mode:t,sessionId:s,environmentId:i,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:m,onStartTask:g,onProvisionEnvironment:v,onShowToast:b}){const[_,k]=y.useState(""),[S,j]=y.useState(""),N=LT(i,u),T=C=>{if(C.preventDefault(),!!_.trim())if(t==="send"){if(!s||N)return;p(s,_),k("")}else if(t==="spawn"){if(!i)return;m(i,_,S),b==null||b("Session started","success"),k(""),j("")}else{if(!r)return;g(r,void 0,i,_),k("")}};return t==="spawn"?o.jsxs("form",{onSubmit:T,className:En.bar,children:[o.jsx("span",{className:En.badge,children:"new chat"}),o.jsx("input",{type:"text",value:_,onChange:C=>k(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:En.input,"aria-label":"Enter prompt"}),c&&o.jsxs("select",{value:S,onChange:C=>j(C.target.value),className:En.select,"aria-label":"Select persona",children:[o.jsx("option",{value:"",children:"(Default)"}),d.map(C=>o.jsx("option",{value:C.id,children:C.name},C.id))]}),o.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:En.btnPrimary,children:"Go"})]}):t==="start"?o.jsxs("form",{onSubmit:T,className:En.bar,children:[o.jsx("input",{type:"text",value:_,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:En.input,"aria-label":"Type a message"}),o.jsx("button",{type:"submit",disabled:!_.trim(),className:En.btnPrimary,children:"Send"})]}):o.jsxs("form",{onSubmit:T,className:En.bar,children:[N&&i&&o.jsx(BT,{environmentId:i,onReconnect:v}),o.jsx("input",{type:"text",value:_,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:En.input,"aria-label":"Type a message"}),o.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:o.jsx("button",{type:"submit",disabled:!_.trim()||N,className:En.btnPrimary,children:"Send"})})]})}const X0=220,Q0=70,zT=40,UT=60,$T="hierarchy",PT="dependency";function VT(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new H0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:zT,ranksep:UT});const i=new Map(t.map(u=>[u.id,u])),r=new Map;for(const u of t)if(u.parentTaskId&&i.has(u.parentTaskId)){const p=r.get(u.parentTaskId)||[];p.push(u),r.set(u.parentTaskId,p)}for(const u of t)s.setNode(u.id,{width:X0,height:Q0});const c=[];for(const u of t){if(u.parentTaskId&&i.has(u.parentTaskId)){const p=`hierarchy-${u.parentTaskId}-${u.id}`;s.setEdge(u.parentTaskId,u.id,{},p),c.push({id:p,source:u.parentTaskId,target:u.id,type:"smoothstep",data:{edgeType:$T},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(i.has(p)){const m=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},m),c.push({id:m,source:p,target:u.id,type:"smoothstep",data:{edgeType:PT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return H0.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),m=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-X0/2,y:p.y-Q0/2},data:{task:u,childCount:m.length,doneChildCount:m.filter(g=>g.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 HT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),i_=(...t)=>t.filter((s,i,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===i).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 qT={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 GT=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},m)=>y.createElement("svg",{ref:m,...qT,width:s,height:s,stroke:t,strokeWidth:r?Number(i)*24/Number(s):i,className:i_("lucide",c),...p},[...u.map(([g,v])=>y.createElement(g,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 Fe=(t,s)=>{const i=y.forwardRef(({className:r,...c},d)=>y.createElement(GT,{ref:d,iconNode:s,className:i_(`lucide-${HT(t)}`,r),...c}));return i.displayName=`${t}`,i};/**
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 FT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ey=Fe("ArrowDown",FT);/**
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 ZT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ty=Fe("ArrowUp",ZT);/**
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 KT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],YT=Fe("Ban",KT);/**
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 JT=[["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"}]],WT=Fe("Brain",JT);/**
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 XT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],xi=Fe("Check",XT);/**
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 QT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],o_=Fe("ChevronDown",QT);/**
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 e2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ea=Fe("ChevronRight",e2);/**
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 t2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ma=Fe("Circle",t2);/**
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 n2=[["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"}]],s2=Fe("ClipboardList",n2);/**
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 a2=[["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"}]],r_=Fe("Clipboard",a2);/**
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 i2=[["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"}]],o2=Fe("Cog",i2);/**
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 r2=[["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"}]],l2=Fe("Copy",r2);/**
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 c2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],d2=Fe("CornerDownRight",c2);/**
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 u2=[["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"}]],f2=Fe("FilePen",u2);/**
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 p2=[["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"}]],m2=Fe("FileText",p2);/**
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 h2=[["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"}]],g2=Fe("House",h2);/**
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 v2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Qp=Fe("Info",v2);/**
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 y2=[["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"}]],b2=Fe("Key",y2);/**
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 _2=[["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"}]],x2=Fe("Keyboard",_2);/**
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 k2=[["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"}]],S2=Fe("ListChecks",k2);/**
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 T2=[["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"}]],w2=Fe("List",T2);/**
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 j2=[["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"}]],N2=Fe("Loader",j2);/**
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 C2=[["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"}]],E2=Fe("Menu",C2);/**
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 A2=[["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"}]],D2=Fe("MessageSquare",A2);/**
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 R2=[["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"}]],M2=Fe("Monitor",R2);/**
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 I2=[["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"}]],O2=Fe("Palette",I2);/**
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 L2=[["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"}]],B2=Fe("Pause",L2);/**
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 z2=[["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"}]],U2=Fe("Pencil",z2);/**
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 $2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],l_=Fe("Search",$2);/**
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 P2=[["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"}]],V2=Fe("Settings",P2);/**
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 H2=[["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"}]],q2=Fe("SquareCheckBig",H2);/**
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 G2=[["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=Fe("TriangleAlert",G2);/**
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 F2=[["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"}]],Z2=Fe("User",F2);/**
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 K2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ba=Fe("X",K2),tm=8,at=12,Zt=14,It=16,Tp={not_started:{color:"var(--text-tertiary)",icon:o.jsx(Ma,{size:at}),label:"Not Started"},working:{color:"var(--accent-green)",icon:o.jsx(Ma,{size:at,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:o.jsx(B2,{size:at}),label:"Paused"},complete:{color:"var(--accent-green)",icon:o.jsx(xi,{size:at}),label:"Complete"},failed:{color:"var(--accent-red)",icon:o.jsx(Ba,{size:at}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:o.jsx(YT,{size:at}),label:"Blocked"}};function Ia(t){return t==="blocked"?Tp.blocked:Tp[el(t)]}const Y2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function J2(t){return Y2[el(t)]??"statusPending"}const W2=["working","paused","failed","not_started","blocked","complete"],ny=["not_started","working","paused","complete","failed"],X2={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function el(t){return t in Tp&&t!=="blocked"?t:X2[t]??"not_started"}const Q2={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"},ew="_dagContainer_js4w6_1",tw="_taskNode_js4w6_26",nw="_taskNodeBorder_js4w6_54",sw="_taskNodeContent_js4w6_60",aw="_taskNodeHeader_js4w6_70",iw="_taskNodeIcon_js4w6_77",ow="_taskNodeTitle_js4w6_82",rw="_taskNodeBadges_js4w6_90",lw="_childBadge_js4w6_95",cw="_depBadge_js4w6_107",dw="_handle_js4w6_119",uw="_emptyCta_js4w6_126",fw="_ctaDescription_js4w6_137",pw="_ctaButton_js4w6_144",un={dagContainer:ew,taskNode:tw,taskNodeBorder:nw,taskNodeContent:sw,taskNodeHeader:aw,taskNodeIcon:iw,taskNodeTitle:ow,taskNodeBadges:rw,childBadge:lw,depBadge:cw,handle:dw,emptyCta:uw,ctaDescription:fw,ctaButton:pw};function mw({data:t}){const{task:s,childCount:i,doneChildCount:r,hasDependencies:c}=t,d=Ia(s.status);return o.jsxs("div",{className:un.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[o.jsx(q0,{type:"target",position:G0.Top,className:un.handle}),o.jsx("div",{className:un.taskNodeBorder,style:{backgroundColor:d.color}}),o.jsxs("div",{className:un.taskNodeContent,children:[o.jsxs("div",{className:un.taskNodeHeader,children:[o.jsx("span",{className:un.taskNodeIcon,style:{color:d.color},children:d.icon}),o.jsx("span",{className:un.taskNodeTitle,children:s.title})]}),o.jsxs("div",{className:un.taskNodeBadges,children:[i>0&&o.jsxs("span",{className:un.childBadge,children:[r,"/",i]}),c&&o.jsx("span",{className:un.depBadge,children:"dep"})]})]}),o.jsx(q0,{type:"source",position:G0.Bottom,className:un.handle})]})}/**
217
- * react-router v7.13.2
218
- *
219
- * Copyright (c) Remix Software Inc.
220
- *
221
- * This source code is licensed under the MIT license found in the
222
- * LICENSE.md file in the root directory of this source tree.
223
- *
224
- * @license MIT
225
- */var sy="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 hw(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:p,hash:m}=d||r.location;return wp("",{pathname:u,search:p,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 i(r,c){return typeof c=="string"?c:Gr(c)}return vw(s,i,null,t)}function bt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Yn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function gw(){return Math.random().toString(36).substring(2,10)}function iy(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 wp(t,s,i=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Ao(s):s,state:i,key:s&&s.key||r||gw(),unstable_mask:c}}function Gr({pathname:t="/",search:s="",hash:i=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function Ao(t){let s={};if(t){let i=t.indexOf("#");i>=0&&(s.hash=t.substring(i),t=t.substring(0,i));let r=t.indexOf("?");r>=0&&(s.search=t.substring(r),t=t.substring(0,r)),t&&(s.pathname=t)}return s}function vw(t,s,i,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",m=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function b(){p="POP";let N=v(),T=N==null?null:N-g;g=N,m&&m({action:p,location:j.location,delta:T})}function _(N,T){p="PUSH";let C=ay(N)?N:wp(j.location,N,T);g=v()+1;let E=iy(C,g),D=j.createHref(C.unstable_mask||C);try{u.pushState(E,"",D)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;c.location.assign(D)}d&&m&&m({action:p,location:j.location,delta:1})}function k(N,T){p="REPLACE";let C=ay(N)?N:wp(j.location,N,T);g=v();let E=iy(C,g),D=j.createHref(C.unstable_mask||C);u.replaceState(E,"",D),d&&m&&m({action:p,location:j.location,delta:0})}function S(N){return yw(N)}let j={get action(){return p},get location(){return t(c,u)},listen(N){if(m)throw new Error("A history only accepts one active listener");return c.addEventListener(sy,b),m=N,()=>{c.removeEventListener(sy,b),m=null}},createHref(N){return s(c,N)},createURL:S,encodeLocation(N){let T=S(N);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:_,replace:k,go(N){return u.go(N)}};return j}function yw(t,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),bt(i,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Gr(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function c_(t,s,i="/"){return bw(t,s,i,!1)}function bw(t,s,i,r){let c=typeof s=="string"?Ao(s):s,d=Ws(c.pathname||"/",i);if(d==null)return null;let u=d_(t);_w(u);let p=null;for(let m=0;p==null&&m<u.length;++m){let g=f_(d);p=Ew(u[m],g,r)}return p}function d_(t,s=[],i=[],r="",c=!1){let d=(u,p,m=c,g)=>{let v={relativePath:g===void 0?u.path||"":g,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(r)&&m)return;bt(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=ys([r,v.relativePath]),_=i.concat(v);u.children&&u.children.length>0&&(bt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),d_(u.children,s,_,b,m)),!(u.path==null&&!u.index)&&s.push({path:b,score:Nw(b,u.index),routesMeta:_})};return t.forEach((u,p)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))d(u,p);else for(let g of u_(u.path))d(u,p,!0,g)}),s}function u_(t){let s=t.split("/");if(s.length===0)return[];let[i,...r]=s,c=i.endsWith("?"),d=i.replace(/\?$/,"");if(r.length===0)return c?[d,""]:[d];let u=u_(r.join("/")),p=[];return p.push(...u.map(m=>m===""?d:[d,m].join("/"))),c&&p.push(...u),p.map(m=>t.startsWith("/")&&m===""?"/":m)}function _w(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:Cw(s.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var xw=/^:[\w-]+$/,kw=3,Sw=2,Tw=1,ww=10,jw=-2,oy=t=>t==="*";function Nw(t,s){let i=t.split("/"),r=i.length;return i.some(oy)&&(r+=jw),s&&(r+=Sw),i.filter(c=>!oy(c)).reduce((c,d)=>c+(xw.test(d)?kw:d===""?Tw:ww),r)}function Cw(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 Ew(t,s,i=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let m=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",b=Fr({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},v),_=m.route;if(!b&&g&&i&&!r[r.length-1].route.index&&(b=Fr({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!b)return null;Object.assign(c,b.params),u.push({params:c,pathname:ys([d,b.pathname]),pathnameBase:Iw(ys([d,b.pathnameBase])),route:_}),b.pathnameBase!=="/"&&(d=ys([d,b.pathnameBase]))}return u}function Fr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,r]=Aw(t.path,t.caseSensitive,t.end),c=s.match(i);if(!c)return null;let d=c[0],u=d.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:r.reduce((g,{paramName:v,isOptional:b},_)=>{if(v==="*"){let S=p[_]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[_];return b&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function Aw(t,s=!1,i=!0){Yn(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,p,m,g,v)=>{if(r.push({paramName:p,isOptional:m!=null}),m){let b=v.charAt(g+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),r]}function f_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Yn(!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 Ws(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,r=t.charAt(i);return r&&r!=="/"?null:t.slice(i)||"/"}var Dw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Rw(t,s="/"){let{pathname:i,search:r="",hash:c=""}=typeof t=="string"?Ao(t):t,d;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?d=ry(i.substring(1),"/"):d=ry(i,s)):d=s,{pathname:d,search:Ow(r),hash:Lw(c)}}function ry(t,s){let i=s.replace(/\/+$/,"").split("/");return t.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function Lf(t,s,i,r){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Mw(t){return t.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function nm(t){let s=Mw(t);return s.map((i,r)=>r===s.length-1?i.pathname:i.pathnameBase)}function ud(t,s,i,r=!1){let c;typeof t=="string"?c=Ao(t):(c={...t},bt(!c.pathname||!c.pathname.includes("?"),Lf("?","pathname","search",c)),bt(!c.pathname||!c.pathname.includes("#"),Lf("#","pathname","hash",c)),bt(!c.search||!c.search.includes("#"),Lf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=i;else{let b=s.length-1;if(!r&&u.startsWith("..")){let _=u.split("/");for(;_[0]==="..";)_.shift(),b-=1;c.pathname=_.join("/")}p=b>=0?s[b]:"/"}let m=Rw(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&i.endsWith("/");return!m.pathname.endsWith("/")&&(g||v)&&(m.pathname+="/"),m}var ys=t=>t.join("/").replace(/\/\/+/g,"/"),Iw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Ow=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Lw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Bw=class{constructor(t,s,i,r=!1){this.status=t,this.statusText=s||"",this.internal=r,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function zw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Uw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var p_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function m_(t,s){let i=t;if(typeof i!="string"||!Dw.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let r=i,c=!1;if(p_)try{let d=new URL(window.location.href),u=i.startsWith("//")?new URL(d.protocol+i):new URL(i),p=Ws(u.pathname,s);u.origin===d.origin&&p!=null?i=p+u.search+u.hash:c=!0}catch{Yn(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var h_=["POST","PUT","PATCH","DELETE"];new Set(h_);var $w=["GET",...h_];new Set($w);var Do=y.createContext(null);Do.displayName="DataRouter";var fd=y.createContext(null);fd.displayName="DataRouterState";var Pw=y.createContext(!1),g_=y.createContext({isTransitioning:!1});g_.displayName="ViewTransition";var Vw=y.createContext(new Map);Vw.displayName="Fetchers";var Hw=y.createContext(null);Hw.displayName="Await";var Mn=y.createContext(null);Mn.displayName="Navigation";var tl=y.createContext(null);tl.displayName="Location";var Jn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Jn.displayName="Route";var sm=y.createContext(null);sm.displayName="RouteError";var v_="REACT_ROUTER_ERROR",qw="REDIRECT",Gw="ROUTE_ERROR_RESPONSE";function Fw(t){if(t.startsWith(`${v_}:${qw}:{`))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 Zw(t){if(t.startsWith(`${v_}:${Gw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Bw(s.status,s.statusText,s.data)}catch{}}function Kw(t,{relative:s}={}){bt(ki(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=y.useContext(Mn),{hash:c,pathname:d,search:u}=nl(t,{relative:s}),p=d;return i!=="/"&&(p=d==="/"?i:ys([i,d])),r.createHref({pathname:p,search:u,hash:c})}function ki(){return y.useContext(tl)!=null}function Ht(){return bt(ki(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(tl).location}function Nt(t){bt(ki(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Ht();return y.useMemo(()=>Fr(t,f_(s)),[s,t])}var y_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function b_(t){y.useContext(Mn).static||y.useLayoutEffect(t)}function pd(){let{isDataRoute:t}=y.useContext(Jn);return t?cj():Yw()}function Yw(){bt(ki(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Do),{basename:s,navigator:i}=y.useContext(Mn),{matches:r}=y.useContext(Jn),{pathname:c}=Ht(),d=JSON.stringify(nm(r)),u=y.useRef(!1);return b_(()=>{u.current=!0}),y.useCallback((m,g={})=>{if(Yn(u.current,y_),!u.current)return;if(typeof m=="number"){i.go(m);return}let v=ud(m,JSON.parse(d),c,g.relative==="path");t==null&&s!=="/"&&(v.pathname=v.pathname==="/"?s:ys([s,v.pathname])),(g.replace?i.replace:i.push)(v,g.state,g)},[s,i,d,c,t])}var Jw=y.createContext(null);function Ww(t){let s=y.useContext(Jn).outlet;return y.useMemo(()=>s&&y.createElement(Jw.Provider,{value:t},s),[s,t])}function ds(){let{matches:t}=y.useContext(Jn),s=t[t.length-1];return s?s.params:{}}function nl(t,{relative:s}={}){let{matches:i}=y.useContext(Jn),{pathname:r}=Ht(),c=JSON.stringify(nm(i));return y.useMemo(()=>ud(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Xw(t,s){return __(t,s)}function __(t,s,i){var N;bt(ki(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Mn),{matches:c}=y.useContext(Jn),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let T=g&&g.path||"";k_(p,!g||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${T}">) 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.
226
-
227
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let v=Ht(),b;if(s){let T=typeof s=="string"?Ao(s):s;bt(m==="/"||((N=T.pathname)==null?void 0:N.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 "${T.pathname}" was given in the \`location\` prop.`),b=T}else b=v;let _=b.pathname||"/",k=_;if(m!=="/"){let T=m.replace(/^\//,"").split("/");k="/"+_.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=c_(t,{pathname:k});Yn(g||S!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Yn(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=sj(S&&S.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:ys([m,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:ys([m,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,i);return s&&j?y.createElement(tl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...b},navigationType:"POP"}},j):j}function Qw(){let t=lj(),s=zw(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=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),i?y.createElement("pre",{style:c},i):null,u)}var ej=y.createElement(Qw,null),x_=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 i=Zw(t.digest);i&&(t=i)}let s=t!==void 0?y.createElement(Jn.Provider,{value:this.props.routeContext},y.createElement(sm.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(tj,{error:t},s):s}};x_.contextType=Pw;var Bf=new WeakMap;function tj({children:t,error:s}){let{basename:i}=y.useContext(Mn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Fw(s.digest);if(r){let c=Bf.get(s);if(c)throw c;let d=m_(r.location,i);if(p_&&!Bf.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 Bf.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function nj({routeContext:t,match:s,children:i}){let r=y.useContext(Do);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Jn.Provider,{value:t},i)}function sj(t,s=[],i){let r=i==null?void 0:i.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);bt(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,p=-1;if(i&&r){u=r.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=v),b.route.id){let{loaderData:_,errors:k}=r,S=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||S){i.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let m=i==null?void 0:i.onError,g=r&&m?(v,b)=>{var _,k;m(v,{location:r.location,params:((k=(_=r.matches)==null?void 0:_[0])==null?void 0:k.params)??{},unstable_pattern:Uw(r.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,_)=>{let k,S=!1,j=null,N=null;r&&(k=d&&b.route.id?d[b.route.id]:void 0,j=b.route.errorElement||ej,u&&(p<0&&_===0?(k_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,N=null):p===_&&(S=!0,N=b.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,_+1)),C=()=>{let E;return k?E=j:S?E=N:b.route.Component?E=y.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=v,y.createElement(nj,{match:b,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:E})};return r&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?y.createElement(x_,{location:r.location,revalidation:r.revalidation,component:j,error:k,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function am(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aj(t){let s=y.useContext(Do);return bt(s,am(t)),s}function ij(t){let s=y.useContext(fd);return bt(s,am(t)),s}function oj(t){let s=y.useContext(Jn);return bt(s,am(t)),s}function im(t){let s=oj(t),i=s.matches[s.matches.length-1];return bt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function rj(){return im("useRouteId")}function lj(){var r;let t=y.useContext(sm),s=ij("useRouteError"),i=im("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[i]}function cj(){let{router:t}=aj("useNavigate"),s=im("useNavigate"),i=y.useRef(!1);return b_(()=>{i.current=!0}),y.useCallback(async(c,d={})=>{Yn(i.current,y_),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var ly={};function k_(t,s,i){!s&&!ly[t]&&(ly[t]=!0,Yn(!1,i))}y.memo(dj);function dj({routes:t,future:s,state:i,isStatic:r,onError:c}){return __(t,void 0,{state:i,isStatic:r,onError:c})}function ls({to:t,replace:s,state:i,relative:r}){bt(ki(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=y.useContext(Mn);Yn(!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(Jn),{pathname:u}=Ht(),p=pd(),m=ud(t,nm(d),u,r==="path"),g=JSON.stringify(m);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:r})},[p,g,r,s,i]),null}function za(t){return Ww(t.context)}function je(t){bt(!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 uj({basename:t="/",children:s=null,location:i,navigationType:r="POP",navigator:c,static:d=!1,unstable_useTransitions:u}){bt(!ki(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),m=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof i=="string"&&(i=Ao(i));let{pathname:g="/",search:v="",hash:b="",state:_=null,key:k="default",unstable_mask:S}=i,j=y.useMemo(()=>{let N=Ws(g,p);return N==null?null:{location:{pathname:N,search:v,hash:b,state:_,key:k,unstable_mask:S},navigationType:r}},[p,g,v,b,_,k,r,S]);return Yn(j!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:y.createElement(Mn.Provider,{value:m},y.createElement(tl.Provider,{children:s,value:j}))}function fj({children:t,location:s}){return Xw(jp(t),s)}function jp(t,s=[]){let i=[];return y.Children.forEach(t,(r,c)=>{if(!y.isValidElement(r))return;let d=[...s,c];if(r.type===y.Fragment){i.push.apply(i,jp(r.props.children,d));return}bt(r.type===je,`[${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>`),bt(!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=jp(r.props.children,d)),i.push(u)}),i}var $c="get",Pc="application/x-www-form-urlencoded";function md(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function pj(t){return md(t)&&t.tagName.toLowerCase()==="button"}function mj(t){return md(t)&&t.tagName.toLowerCase()==="form"}function hj(t){return md(t)&&t.tagName.toLowerCase()==="input"}function gj(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function vj(t,s){return t.button===0&&(!s||s==="_self")&&!gj(t)}function Np(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,i)=>{let r=t[i];return s.concat(Array.isArray(r)?r.map(c=>[i,c]):[[i,r]])},[]))}function yj(t,s){let i=Np(t);return s&&s.forEach((r,c)=>{i.has(c)||s.getAll(c).forEach(d=>{i.append(c,d)})}),i}var wc=null;function bj(){if(wc===null)try{new FormData(document.createElement("form"),0),wc=!1}catch{wc=!0}return wc}var _j=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zf(t){return t!=null&&!_j.has(t)?(Yn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Pc}"`),null):t}function xj(t,s){let i,r,c,d,u;if(mj(t)){let p=t.getAttribute("action");r=p?Ws(p,s):null,i=t.getAttribute("method")||$c,c=zf(t.getAttribute("enctype"))||Pc,d=new FormData(t)}else if(pj(t)||hj(t)&&(t.type==="submit"||t.type==="image")){let p=t.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||p.getAttribute("action");if(r=m?Ws(m,s):null,i=t.getAttribute("formmethod")||p.getAttribute("method")||$c,c=zf(t.getAttribute("formenctype"))||zf(p.getAttribute("enctype"))||Pc,d=new FormData(p,t),!bj()){let{name:g,type:v,value:b}=t;if(v==="image"){let _=g?`${g}.`:"";d.append(`${_}x`,"0"),d.append(`${_}y`,"0")}else g&&d.append(g,b)}}else{if(md(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=$c,r=null,c=Pc,u=t}return d&&c==="text/plain"&&(u=d,d=void 0),{action:r,method:i.toLowerCase(),encType:c,formData:d,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function om(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function kj(t,s,i,r){let c=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${r}`:c.pathname=`${c.pathname}.${r}`:c.pathname==="/"?c.pathname=`_root.${r}`:s&&Ws(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${r}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${r}`,c}async function Sj(t,s){if(t.id in s)return s[t.id];try{let i=await import(t.module);return s[t.id]=i,i}catch(i){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Tj(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 wj(t,s,i){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await Sj(d,i);return u.links?u.links():[]}return[]}));return Ej(r.flat(1).filter(Tj).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function cy(t,s,i,r,c,d){let u=(m,g)=>i[g]?m.route.id!==i[g].route.id:!0,p=(m,g)=>{var v;return i[g].pathname!==m.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==m.params["*"]};return d==="assets"?s.filter((m,g)=>u(m,g)||p(m,g)):d==="data"?s.filter((m,g)=>{var b;let v=r.routes[m.route.id];if(!v||!v.hasLoader)return!1;if(u(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let _=m.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((b=i[0])==null?void 0:b.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function jj(t,s,{includeHydrateFallback:i}={}){return Nj(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)),i&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function Nj(t){return[...new Set(t)]}function Cj(t){let s={},i=Object.keys(t).sort();for(let r of i)s[r]=t[r];return s}function Ej(t,s){let i=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Cj(c));return i.has(d)||(i.add(d),r.push({key:d,link:c})),r},[])}function S_(){let t=y.useContext(Do);return om(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function Aj(){let t=y.useContext(fd);return om(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var rm=y.createContext(void 0);rm.displayName="FrameworkContext";function T_(){let t=y.useContext(rm);return om(t,"You must render this element inside a <HydratedRouter> element"),t}function Dj(t,s){let i=y.useContext(rm),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:v,onTouchStart:b}=s,_=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(j,{threshold:.5});return _.current&&N.observe(_.current),()=>{N.disconnect()}}},[t]),y.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let k=()=>{c(!0)},S=()=>{c(!1),u(!1)};return i?t!=="intent"?[d,_,{}]:[d,_,{onFocus:jr(p,k),onBlur:jr(m,S),onMouseEnter:jr(g,k),onMouseLeave:jr(v,S),onTouchStart:jr(b,k)}]:[!1,_,{}]}function jr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function Rj({page:t,...s}){let{router:i}=S_(),r=y.useMemo(()=>c_(i.routes,t,i.basename),[i.routes,t,i.basename]);return r?y.createElement(Ij,{page:t,matches:r,...s}):null}function Mj(t){let{manifest:s,routeModules:i}=T_(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return wj(t,s,i).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,i]),r}function Ij({page:t,matches:s,...i}){let r=Ht(),{future:c,manifest:d,routeModules:u}=T_(),{basename:p}=S_(),{loaderData:m,matches:g}=Aj(),v=y.useMemo(()=>cy(t,s,g,d,r,"data"),[t,s,g,d,r]),b=y.useMemo(()=>cy(t,s,g,d,r,"assets"),[t,s,g,d,r]),_=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let j=new Set,N=!1;if(s.forEach(C=>{var D;let E=d.routes[C.route.id];!E||!E.hasLoader||(!v.some(R=>R.route.id===C.route.id)&&C.route.id in m&&((D=u[C.route.id])!=null&&D.shouldRevalidate)||E.hasClientLoader?N=!0:j.add(C.route.id))}),j.size===0)return[];let T=kj(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return N&&j.size>0&&T.searchParams.set("_routes",s.filter(C=>j.has(C.route.id)).map(C=>C.route.id).join(",")),[T.pathname+T.search]},[p,c.unstable_trailingSlashAwareDataRequests,m,r,d,v,s,t,u]),k=y.useMemo(()=>jj(b,d),[b,d]),S=Mj(b);return y.createElement(y.Fragment,null,_.map(j=>y.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...i})),k.map(j=>y.createElement("link",{key:j,rel:"modulepreload",href:j,...i})),S.map(({key:j,link:N})=>y.createElement("link",{key:j,nonce:i.nonce,...N,crossOrigin:N.crossOrigin??i.crossOrigin})))}function Oj(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var Lj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Lj&&(window.__reactRouterVersion="7.13.2")}catch{}function Bj({basename:t,children:s,unstable_useTransitions:i,window:r}){let c=y.useRef();c.current==null&&(c.current=hw({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),m=y.useCallback(g=>{i===!1?p(g):y.startTransition(()=>p(g))},[i]);return y.useLayoutEffect(()=>d.listen(m),[d,m]),y.createElement(uj,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:i})}var w_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,lm=y.forwardRef(function({onClick:s,discover:i="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:m,target:g,to:v,preventScrollReset:b,viewTransition:_,unstable_defaultShouldRevalidate:k,...S},j){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Mn),E=typeof v=="string"&&w_.test(v),D=m_(v,N);v=D.to;let R=Kw(v,{relative:c}),L=Ht(),A=null;if(p){let re=ud(p,[],L.unstable_mask?L.unstable_mask.pathname:"/",!0);N!=="/"&&(re.pathname=re.pathname==="/"?N:ys([N,re.pathname])),A=T.createHref(re)}let[U,F,ee]=Dj(r,S),q=Pj(v,{replace:u,unstable_mask:p,state:m,target:g,preventScrollReset:b,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function X(re){s&&s(re),re.defaultPrevented||q(re)}let ae=!(D.isExternal||d),Q=y.createElement("a",{...S,...ee,href:(ae?A:void 0)||D.absoluteURL||R,onClick:ae?X:s,ref:Oj(j,F),target:g,"data-discover":!E&&i==="render"?"true":void 0});return U&&!E?y.createElement(y.Fragment,null,Q,y.createElement(Rj,{page:R})):Q});lm.displayName="Link";var zj=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:m,...g},v){let b=nl(u,{relative:g.relative}),_=Ht(),k=y.useContext(fd),{navigator:S,basename:j}=y.useContext(Mn),N=k!=null&&Fj(b)&&p===!0,T=S.encodeLocation?S.encodeLocation(b).pathname:b.pathname,C=_.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;i||(C=C.toLowerCase(),E=E?E.toLowerCase():null,T=T.toLowerCase()),E&&j&&(E=Ws(E,j)||E);const D=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let R=C===T||!c&&C.startsWith(T)&&C.charAt(D)==="/",L=E!=null&&(E===T||!c&&E.startsWith(T)&&E.charAt(T.length)==="/"),A={isActive:R,isPending:L,isTransitioning:N},U=R?s:void 0,F;typeof r=="function"?F=r(A):F=[r,R?"active":null,L?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let ee=typeof d=="function"?d(A):d;return y.createElement(lm,{...g,"aria-current":U,className:F,ref:v,style:ee,to:u,viewTransition:p},typeof m=="function"?m(A):m)});zj.displayName="NavLink";var Uj=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:r,replace:c,state:d,method:u=$c,action:p,onSubmit:m,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_,...k},S)=>{let{unstable_useTransitions:j}=y.useContext(Mn),N=qj(),T=Gj(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&w_.test(p),D=R=>{if(m&&m(R),R.defaultPrevented)return;R.preventDefault();let L=R.nativeEvent.submitter,A=(L==null?void 0:L.getAttribute("formmethod"))||u,U=()=>N(L||R.currentTarget,{fetcherKey:s,method:A,navigate:i,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:b,unstable_defaultShouldRevalidate:_});j&&i!==!1?y.startTransition(()=>U()):U()};return y.createElement("form",{ref:S,method:C,action:T,onSubmit:r?m:D,...k,"data-discover":!E&&t==="render"?"true":void 0})});Uj.displayName="Form";function $j(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function j_(t){let s=y.useContext(Do);return bt(s,$j(t)),s}function Pj(t,{target:s,replace:i,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m,unstable_useTransitions:g}={}){let v=pd(),b=Ht(),_=nl(t,{relative:u});return y.useCallback(k=>{if(vj(k,s)){k.preventDefault();let S=i!==void 0?i:Gr(b)===Gr(_),j=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:m});g?y.startTransition(()=>j()):j()}},[b,v,_,i,r,c,s,t,d,u,p,m,g])}function cm(t){Yn(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(Np(t)),i=y.useRef(!1),r=Ht(),c=y.useMemo(()=>yj(r.search,i.current?null:s.current),[r.search]),d=pd(),u=y.useCallback((p,m)=>{const g=Np(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,d("?"+g,m)},[d,c]);return[c,u]}var Vj=0,Hj=()=>`__${String(++Vj)}__`;function qj(){let{router:t}=j_("useSubmit"),{basename:s}=y.useContext(Mn),i=rj(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:m,encType:g,formData:v,body:b}=xj(d,s);if(u.navigate===!1){let _=u.fetcherKey||Hj();await r(_,i,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:b,formMethod:u.method||m,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:i,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,i])}function Gj(t,{relative:s}={}){let{basename:i}=y.useContext(Mn),r=y.useContext(Jn);bt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...nl(t||".",{relative:s})},u=Ht();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),m=p.getAll("index");if(m.some(v=>v==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let v=p.toString();d.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:ys([i,d.pathname])),Gr(d)}function Fj(t,{relative:s}={}){let i=y.useContext(g_);bt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=j_("useViewTransitionState"),c=nl(t,{relative:s});if(!i.isTransitioning)return!1;let d=Ws(i.currentLocation.pathname,r)||i.currentLocation.pathname,u=Ws(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Fr(c.pathname,u)!=null||Fr(c.pathname,d)!=null}function xt(){const t=pd();return y.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function dm(t){return`/sessions/${encodeURIComponent(t)}`}function vi(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function Dn(t,s,i,r){const c=encodeURIComponent(t);let d;return i&&r?d=`/environments/${encodeURIComponent(r)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?d=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:d=`/tasks/${c}`,s?`${d}/${s}`:d}function Si(t,s,i){const r=new URLSearchParams;t&&r.set("workspace",t),s&&r.set("parent",s);const c=r.toString();if(t&&i){const d=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${d}?parent=${encodeURIComponent(s)}`:d}return c?`/tasks/new?${c}`:"/tasks/new"}function N_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const To="/environments",Zj="/environments/new";function yi(t){return`/environments/${encodeURIComponent(t)}`}function Kj(t){return`/environments/${encodeURIComponent(t)}/edit`}const So="/settings",Yj="/settings/credentials",Uf="/settings/personas",Jj="/settings/personas/new";function C_(t){return`/settings/personas/${encodeURIComponent(t)}`}const Wj="/settings/shortcuts",Xj="/pair",Qj="/chat",bi="/",eN="/tasks",E_="/workspaces/new",A_="/knowledge",hd="/findings";function tN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:hd}function Cp(t,s,i){const r=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const nN=Q2,sN={task:mw};function aN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:r}){const c=xt(),d=y.useMemo(()=>i.filter(b=>b.workspaceId===t),[i,t]),{nodes:u,edges:p}=VT(d),m=y.useMemo(()=>{const b=getComputedStyle(document.documentElement),_={};for(const[k,S]of Object.entries(nN))_[k]=b.getPropertyValue(S).trim()||"#6b7a8d";return _},[r]),g=y.useCallback((b,_)=>{c(Dn(_.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?o.jsxs("div",{className:un.emptyCta,children:[o.jsx("button",{className:un.ctaButton,onClick:()=>c(Si(t,void 0,s)),children:"Create Task"}),o.jsx("div",{className:un.ctaDescription,children:"Create tasks to see the dependency graph"})]}):o.jsx("div",{className:un.dagContainer,children:o.jsxs(WS,{nodes:u,edges:p,nodeTypes:sN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[o.jsx(XS,{variant:QS.Dots,gap:24,size:1,color:"var(--text-disabled)"}),o.jsx(eT,{showInteractive:!1}),o.jsx(tT,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const iN="_breadcrumbs_17or2_1",oN="_list_17or2_11",rN="_item_17or2_21",lN="_separator_17or2_28",cN="_link_17or2_34",dN="_current_17or2_57",mo={breadcrumbs:iN,list:oN,item:rN,separator:lN,link:cN,current:dN};function xs({segments:t}){return o.jsx("nav",{className:mo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:o.jsx("ol",{className:mo.list,children:t.map((s,i)=>{const r=i===t.length-1;return o.jsxs("li",{className:mo.item,children:[i>0&&o.jsx("span",{className:mo.separator,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),s.url&&!r?o.jsx(lm,{className:mo.link,to:s.url,title:s.label,children:s.label}):o.jsx("span",{className:mo.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const uN="_btn_dwk2o_1",fN="_sm_dwk2o_22",pN="_md_dwk2o_28",mN="_lg_dwk2o_34",hN="_primary_dwk2o_40",gN="_danger_dwk2o_55",vN="_outline_dwk2o_70",yN="_ghost_dwk2o_80",$f={btn:uN,sm:fN,md:pN,lg:mN,primary:hN,danger:gN,outline:vN,ghost:yN},Zs=y.forwardRef(function({variant:s="primary",size:i="md",className:r,children:c,...d},u){const p=[$f.btn,$f[s],$f[i],r].filter(Boolean).join(" ");return o.jsx("button",{ref:u,className:p,...d,children:c})}),bN="_copyButton_1bqk0_1",_N={copyButton:bN},xN=2e3;function kN({text:t,className:s,"data-testid":i}){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},xN)}catch{}},[t]);return o.jsx("button",{type:"button",className:`${_N.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:r?o.jsx(xi,{size:Zt,"aria-hidden":"true"}):o.jsx(r_,{size:Zt,"aria-hidden":"true"})})}const SN="_banner_bxqlh_1",TN="_label_bxqlh_15",wN="_text_bxqlh_25",jN="_link_bxqlh_29",jc={banner:SN,label:TN,text:wN,link:jN};function NN(){return o.jsxs("div",{className:jc.banner,"data-testid":"demo-banner",children:[o.jsx("span",{className:jc.label,children:"DEMO"}),o.jsxs("span",{className:jc.text,children:["This is an interactive demo with mock data."," ",o.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:jc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const CN="_container_og0yp_1",EN="_chevronButton_og0yp_6",AN="_mainButton_og0yp_6",DN="_sm_og0yp_34",RN="_md_og0yp_34",MN="_lg_og0yp_34",IN="_primary_og0yp_57",ON="_danger_og0yp_70",LN="_outline_og0yp_83",BN="_ghost_og0yp_92",zN="_dropdown_og0yp_100",UN="_option_og0yp_113",$N="_optionLabel_og0yp_130",PN="_optionDesc_og0yp_135",Hs={container:CN,chevronButton:EN,mainButton:AN,sm:DN,md:RN,lg:MN,primary:IN,danger:ON,outline:LN,ghost:BN,dropdown:zN,option:UN,optionLabel:$N,optionDesc:PN};function D_({label:t,onClick:s,options:i,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),m=y.useRef(null);y.useEffect(()=>{if(!u)return;function _(k){m.current&&k.target instanceof Node&&!m.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[u]),y.useEffect(()=>{if(!u)return;function _(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[u]);const g=Hs[r]||"",v=Hs[c]||"",b=()=>{u&&p(!1),s()};return o.jsxs("div",{ref:m,className:Hs.container,"data-testid":d,children:[o.jsx("button",{type:"button",className:`${Hs.mainButton} ${g} ${v}`,onClick:b,"data-testid":d?`${d}-main`:void 0,children:t}),o.jsx("button",{type:"button",className:`${Hs.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:o.jsx(o_,{size:Zt,"aria-hidden":"true"})}),u&&o.jsx("div",{className:Hs.dropdown,"data-testid":d?`${d}-menu`:void 0,children:i.map((_,k)=>o.jsxs("button",{type:"button",className:Hs.option,onClick:()=>{_.onClick(),p(!1)},children:[o.jsx("span",{className:Hs.optionLabel,children:_.label}),_.description&&o.jsx("span",{className:Hs.optionDesc,children:_.description})]},k))})]})}function Ep(){Ep=function(c,d){return new i(c,void 0,d)};var t=RegExp.prototype,s=new WeakMap;function i(c,d,u){var p=new RegExp(c,d);return s.set(p,u||s.get(c)),Kc(p,i.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,m){var g=u[m];if(typeof g=="number")p[m]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[m]=c[g[v]]}return p},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&&Kc(c,d)})(i,RegExp),i.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},i.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,g){var v=u[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof d=="function"){var p=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,p)),d.apply(this,m)})}return t[Symbol.replace].call(this,c,d)},Ep.apply(this,arguments)}function Kc(t,s){return Kc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},Kc(t,s)}function dy(t,s){(s==null||s>t.length)&&(s=t.length);for(var i=0,r=new Array(s);i<s;i++)r[i]=t[i];return r}function Pf(t,s){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=(function(c,d){if(c){if(typeof c=="string")return dy(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)?dy(c,d):void 0}})(t))||s){i&&(t=i);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.
228
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var VN=(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){hT(r,"element",i)};function i(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var m=(r==null||(u=r.data)==null?void 0:u.meta)||(r==null||(p=r.properties)==null?void 0:p.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 g,v,b=(function(R){for(var L,A=Pf(R.properties.className);!(L=A()).done;){var U=L.value;if(U.slice(0,9)==="language-")return U.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 _,k;k=(_=b)!=null&&_.includes("diff-")?b.split("-")[1]:b,g=t.highlight(Tc(r),k),d.properties.className=(d.properties.className||[]).concat("language-"+k)}catch(R){if(!s.ignoreMissing||!/Unknown language/.test(R.message))throw R;g=r}else g=r;g.children=(v=1,function R(L){return L.reduce(function(A,U){if(U.type==="text"){var F=U.value,ee=(F.match(/\n/g)||"").length;if(ee===0)U.position={start:{line:v,column:1},end:{line:v,column:1}},A.push(U);else for(var q,X=F.split(`
229
- `),ae=Pf(X.entries());!(q=ae()).done;){var Q=q.value,re=Q[0],O=Q[1];A.push({type:"text",value:re===X.length-1?O:O+`
230
- `,position:{start:{line:v+re,column:1},end:{line:v+re,column:1}}})}return v+=ee,A}if(Object.prototype.hasOwnProperty.call(U,"children")){var Z=v;return U.children=R(U.children),A.push(U),U.position={start:{line:Z,column:1},end:{line:v,column:1}},A}return A.push(U),A},[])})(g.children),g.position=g.children.length>0?{start:{line:g.children[0].position.start.line,column:0},end:{line:g.children[g.children.length-1].position.end.line,column:0}}:{start:{line:0,column:0},end:{line:0,column:0}};for(var S,j=(function(R){var L=/{([\d,-]+)}/,A=R.split(",").map(function(ee){return ee.trim()}).join();if(L.test(A)){var U=L.exec(A)[1],F=vT(U);return function(ee){return F.includes(ee+1)}}return function(){return!1}})(m),N=(function(R){var L=Ep(/showLineNumbers=(\d+)/i,{lines:1});if(L.test(R)){var A=L.exec(R);return Number(A.groups.lines)}return 1})(m),T=(function(R){for(var L=new Array(R),A=0;A<R;A++)L[A]={type:"element",tagName:"span",properties:{className:[]},children:[]};return L})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],E=function(){var R,L,A=S.value,U=A[0],F=A[1];F.properties.className=["code-line"];var ee=yT(g,function(q){return q.position.start.line<=U+1&&q.position.end.line>=U+1});F.children=ee.children,(m.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(b))&&!C.some(function(q){return m.toLowerCase().includes(q)})&&(F.properties.line=[(U+N).toString()],F.properties.className.push("line-number")),j(U)&&F.properties.className.push("highlight-line"),(b==="diff"||(R=b)!=null&&R.includes("diff-"))&&Tc(F).substring(0,1)==="-"?F.properties.className.push("deleted"):(b==="diff"||(L=b)!=null&&L.includes("diff-"))&&Tc(F).substring(0,1)==="+"&&F.properties.className.push("inserted")},D=Pf(T.entries());!(S=D()).done;)E();T.length>0&&Tc(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})(gT);function R_(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 wo(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const uy=new Set(["grackle"]);function Ro(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const r=t.slice(5,i);if(uy.has(r))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(uy.has(i))return t.slice(s+1)}return t}const HN={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",finding_post:"finding",finding_list:"finding",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",toolsearch:"tool-search",agent:"agent",task:"agent",read_agent:"agent"};function qN(t){const s=Ro(t);return HN[s.toLowerCase()]??"generic"}const GN="_card_qkm9i_2",FN="_cardBlue_qkm9i_20",ZN="_cardOrange_qkm9i_24",KN="_cardGreen_qkm9i_28",YN="_cardPurple_qkm9i_32",JN="_cardNeutral_qkm9i_36",WN="_cardRed_qkm9i_40",XN="_cardTeal_qkm9i_44",QN="_header_qkm9i_48",eC="_icon_qkm9i_55",tC="_toolName_qkm9i_64",nC="_fileName_qkm9i_71",sC="_badge_qkm9i_80",aC="_spacer_qkm9i_87",iC="_bodyToggle_qkm9i_91",oC="_chevron_qkm9i_109",rC="_chevronExpanded_qkm9i_115",lC="_pre_qkm9i_119",cC="_diffAdd_qkm9i_143",dC="_diffRemove_qkm9i_155",uC="_diffContext_qkm9i_167",fC="_diffHeader_qkm9i_176",pC="_diffLine_qkm9i_182",mC="_exitOk_qkm9i_188",hC="_exitError_qkm9i_194",gC="_exitPending_qkm9i_200",vC="_inProgress_qkm9i_228",yC="_metadata_qkm9i_232",bC="_metadataPrefix_qkm9i_239",I={card:GN,cardBlue:FN,cardOrange:ZN,cardGreen:KN,cardPurple:YN,cardNeutral:JN,cardRed:WN,cardTeal:XN,header:QN,icon:eC,toolName:tC,fileName:nC,badge:sC,spacer:aC,bodyToggle:iC,chevron:oC,chevronExpanded:rC,pre:lC,diffAdd:cC,diffRemove:dC,diffContext:uC,diffHeader:fC,diffLine:pC,exitOk:mC,exitError:hC,exitPending:gC,inProgress:vC,metadata:yC,metadataPrefix:bC};function _C(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 xC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Vf=5;function fy({tool:t,args:s,result:i,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=_C(s),m=xC(p),g=i===void 0,v=r?I.cardRed:c?I.cardGreen:I.cardBlue,b=c?"var(--accent-green)":"var(--accent-blue)",_=c?o.jsx(f2,{size:Zt}):o.jsx(m2,{size:Zt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(i==null?void 0:i.split(`
231
- `))??[],j=S.length>Vf,N=d?S:S.slice(0,Vf);return o.jsxs("div",{className:`${I.card} ${v} ${g?I.inProgress:""}`,"data-testid":k,children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:_}),o.jsx("span",{className:I.toolName,style:{color:b},children:t}),m&&o.jsx("span",{className:I.fileName,title:p,children:m}),!g&&S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,children:[S.length," lines"]})]})]}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>o.jsxs("span",{className:I.diffLine,children:[o.jsx("span",{style:{color:"var(--text-tertiary)",userSelect:"none",marginRight:"var(--space-sm)",display:"inline-block",width:"3ch",textAlign:"right"},children:C+1}),T]},C))}),j&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),d?"collapse":`${S.length-Vf} more lines`]})]})]})}function kC(t){const s=t.split(`
232
- `),i=[];for(const r of s)r.startsWith("diff --git")||r.startsWith("index ")||(r.startsWith("--- ")||r.startsWith("+++ "))&&!r.startsWith("---- ")&&!r.startsWith("++++ ")||(r.startsWith("@@")?i.push({type:"header",content:r}):r.startsWith("+")?i.push({type:"add",content:r.slice(1)}):r.startsWith("-")?i.push({type:"remove",content:r.slice(1)}):r.startsWith(" ")?i.push({type:"context",content:r.slice(1)}):r===""&&i.push({type:"context",content:""}));return i}function SC(t,s){const i=t.split(`
233
- `),r=s.split(`
234
- `),c=[];for(const d of i)c.push({type:"remove",content:d});for(const d of r)c.push({type:"add",content:d});return c}function TC(t){let s=0,i=0;for(const r of t)r.type==="add"&&s++,r.type==="remove"&&i++;return{added:s,removed:i}}function wC(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 jC(t){if(t===void 0||typeof t!="object"||t===null)return;const s=t,i=(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(i!==void 0&&r!==void 0)return{oldStr:i,newStr:r}}function NC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function CC(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=kC(r);if(c.length>0)return c}}const i=jC(t);if(i)return SC(i.oldStr,i.newStr)}const Hf=5;function EC({tool:t,args:s,result:i,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=wC(s),m=NC(p),g=i===void 0,v=CC(s,c),b=v?TC(v):null,_=((v==null?void 0:v.length)??0)>Hf,k=d?v:v==null?void 0:v.slice(0,Hf);return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${g?I.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:o.jsx(U2,{size:Zt})}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow)"},children:t}),m&&o.jsx("span",{className:I.fileName,title:p,children:m}),b&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-diff-stats",children:[o.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",b.added]})," ",o.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",b.removed]})]})]})]}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&k&&k.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-diff",children:k.map((S,j)=>{let N=I.diffContext;return S.type==="add"&&(N=I.diffAdd),S.type==="remove"&&(N=I.diffRemove),S.type==="header"&&(N=I.diffHeader),o.jsx("span",{className:`${I.diffLine} ${N}`,children:S.content},j)})}),_&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":d,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),d?"collapse":`${((v==null?void 0:v.length)??0)-Hf} more lines`]})]}),!r&&!v&&!g&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:i})]})}const AC=/^\[exit (\d+)\]\s*/;function DC(t){const s=AC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function RC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function MC(t){const s=/pwsh(?:\.exe)?["']?\s+-Command\s+'([^']*)'\s*$/i.exec(t);if(s)return s[1];const i=/pwsh(?:\.exe)?["']?\s+-Command\s+"([^"]*)"\s*$/i.exec(t);return i?i[1]:t}const qf=3;function IC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=RC(s),p=MC(u),m=i===void 0,g=i?DC(i):null,v=(g==null?void 0:g.output.split(`
235
- `))??[],b=v.length>qf,_=c?v:v.slice(0,qf),k=g==null?void 0:g.exitCode,S=r||k!==void 0&&k!==0;return o.jsxs("div",{className:`${I.card} ${S?I.cardRed:I.cardNeutral}`,"data-testid":"tool-card-shell",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),o.jsx("span",{className:I.fileName,style:{flex:1,color:"var(--text-primary)"},title:u!==p?u:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&o.jsxs("span",{className:k===0?I.exitOk:I.exitError,"data-testid":"tool-card-exit-code",children:[k===0?o.jsx(xi,{size:at,"aria-hidden":"true"}):o.jsx(Ba,{size:at,"aria-hidden":"true"})," ","exit ",k]}),m&&o.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:o.jsx(N2,{size:at,"aria-hidden":"true"})})]}),!m&&g&&g.output.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-output",children:_.join(`
236
- `)}),b&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),c?"collapse":`${v.length-qf} more lines`]})]})]})}function OC(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,i=typeof s.pattern=="string"?s.pattern:"",r=typeof s.path=="string"?s.path:"";return{pattern:i,path:r}}const Gf=5;function LC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=OC(s),m=i===void 0,g=(i==null?void 0:i.split(`
237
- `).filter(_=>_.length>0))??[],v=g.length>Gf,b=c?g:g.slice(0,Gf);return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-search",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:o.jsx(l_,{size:Zt})}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),u&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-pattern",children:['"',u,'"']}),p&&o.jsxs("span",{className:I.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!m&&!r&&g.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&b.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-results",children:b.join(`
238
- `)}),v&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),c?"collapse":`${g.length-Gf} more matches`]})]})]})}const BC="_progressBar_14f5c_1",zC="_progressFill_14f5c_9",UC="_activeTask_14f5c_16",$C="_activeIcon_14f5c_27",PC="_todoPulse_14f5c_1",VC="_activeText_14f5c_34",HC="_checklist_14f5c_48",qC="_item_14f5c_55",GC="_itemIcon_14f5c_65",FC="_itemText_14f5c_73",ZC="_pending_14f5c_78",KC="_in_progress_14f5c_85",YC="_completed_14f5c_97",JC="_emptyMessage_14f5c_108",ns={progressBar:BC,progressFill:zC,activeTask:UC,activeIcon:$C,todoPulse:PC,activeText:VC,checklist:HC,item:qC,itemIcon:GC,itemText:FC,pending:ZC,in_progress:KC,completed:YC,emptyMessage:JC},WC=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function XC(t){if(t===void 0||typeof t!="object"||t===null)return[];const s=t;return Array.isArray(s.todos)?s.todos.filter(i=>typeof i=="object"&&i!==null&&typeof i.content=="string"&&typeof i.status=="string").map(i=>({content:i.content,activeForm:typeof i.activeForm=="string"?i.activeForm:void 0,status:py(i.status)})):Array.isArray(s.plan)?s.plan.filter(i=>typeof i=="object"&&i!==null&&typeof i.step=="string"&&typeof i.status=="string").map(i=>({content:i.step,status:py(i.status)})):typeof s.content=="string"?QC(s.content):[]}function py(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 QC(t){const s=t.split(`
239
- `),i=[];for(const r of s){const c=WC.exec(r.trim());if(c){const d=c[1],u=c[2].trim();let p="pending";d==="x"||d==="X"?p="completed":(d==="~"||d==="/"||d==="!")&&(p="in_progress"),i.push({content:u,status:p})}}return i}function eE(t){switch(t){case"completed":return o.jsx(xi,{size:at});case"in_progress":return o.jsx(Ma,{size:at,fill:"currentColor"});default:return o.jsx(Ma,{size:at})}}function tE({args:t}){const s=XC(t),i=s.filter(d=>d.status==="completed").length,r=s.find(d=>d.status==="in_progress"),c=s.length===0;return o.jsxs("div",{className:`${I.card} ${I.cardBlue}`,"data-testid":"tool-card-todo",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:o.jsx(S2,{size:Zt})}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&o.jsx("div",{className:ns.progressBar,"data-testid":"tool-card-todo-bar",children:o.jsx("div",{className:ns.progressFill,style:{width:`${i/s.length*100}%`}})}),r&&o.jsxs("div",{className:ns.activeTask,"data-testid":"tool-card-todo-active",children:[o.jsx("span",{className:ns.activeIcon,children:o.jsx(Ma,{size:at,fill:"currentColor"})}),o.jsx("span",{className:ns.activeText,children:r.activeForm||r.content})]}),!c&&o.jsx("div",{className:ns.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>o.jsxs("div",{className:`${ns.item} ${ns[d.status]}`,"data-testid":"tool-card-todo-item",children:[o.jsx("span",{className:ns.itemIcon,children:eE(d.status)}),o.jsx("span",{className:ns.itemText,children:d.content})]},u))}),c&&o.jsx("div",{className:ns.emptyMessage,children:"All items completed and cleared."})]})}function nE(t,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const r of Object.values(i))if(typeof r=="string")return r;return t}function sE({tool:t,args:s}){const i=nE(t,s);return o.jsxs("div",{className:I.metadata,"data-testid":"tool-card-metadata",children:[o.jsx("span",{className:I.metadataPrefix,children:o.jsx(d2,{size:at})}),i]})}function aE(t){if(t==null||typeof t!="object")return{};const s=t;return{title:typeof s.title=="string"?s.title:void 0,category:typeof s.category=="string"?s.category:void 0,tags:Array.isArray(s.tags)?s.tags:void 0}}function iE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null)return{single:s}}catch{}return{}}const Ff=5,Zf=5;function oE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Ro(t),p=aE(s),m=i===void 0,{single:g,list:v}=iE(i),b=(g==null?void 0:g.title)??p.title,_=v?void 0:(g==null?void 0:g.category)??p.category,k=v?void 0:(g==null?void 0:g.tags)??p.tags;return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-finding",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,"aria-hidden":"true",children:"💡"}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),b&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-finding-title",children:['"',b,'"']}),_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsx("span",{className:I.badge,"data-testid":"tool-card-finding-category",children:_})]}),v&&!_&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),k&&k.length>0&&o.jsx("div",{className:I.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:k.map((S,j)=>o.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",S]},j))}),m&&!b&&s!==null&&s!==void 0&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&(g==null?void 0:g.content)&&o.jsx(o.Fragment,{children:(()=>{const S=g.content.split(`
240
- `),j=S.length>Zf,N=c?g.content:S.slice(0,Zf).join(`
241
- `);return o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-content",children:N}),j&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${S.length-Zf} more lines`]})]})})()}),!r&&v&&v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,Ff)).map((S,j)=>`${S.category?`[${S.category}] `:""}${S.title??S.id??`Finding ${j+1}`}`).join(`
242
- `)}),v.length>Ff&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Ff} more findings`]})]})]})}function rE(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 lE(t){if(!t)return{};try{const s=JSON.parse(t);if(Array.isArray(s))return{list:s.filter(i=>i!==null&&typeof i=="object")};if(typeof s=="object"&&s!==null){const i=s;return typeof i.sessionId=="string"?{sessionId:i.sessionId,single:i}:{single:i}}}catch{}return{}}function my(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function cE(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 Kf=5;function dE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Ro(t),p=rE(s),m=i===void 0,{single:g,list:v,sessionId:b}=lE(i),_=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${m?I.inProgress:""}`,"data-testid":"tool-card-task",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📋"}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),_&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,style:{color:cE(k)},"data-testid":"tool-card-task-status",children:[my(k)," ",k]})]}),v&&!k&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),m&&!_&&!p.taskId&&s!==null&&s!==void 0&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&b&&o.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",b]}),!r&&g&&!v&&!b&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-detail",children:[g.id?`id: ${g.id}`:null,g.status?`status: ${g.status}`:null,g.branch?`branch: ${g.branch}`:null,g.latestSessionId?`session: ${g.latestSessionId}`:null].filter(Boolean).join(`
243
- `)}),!r&&v&&v.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,Kf)).map(S=>{const j=my(S.status),N=S.title??S.id??"untitled";return`${j} ${N}`}).join(`
244
- `)}),v.length>Kf&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Kf} more tasks`]})]})]})}function uE(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 fE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s,r=typeof i.workpad=="object"&&i.workpad!==null?i.workpad:i;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 pE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Ro(t),p=uE(s),m=i===void 0,g=fE(i),v=g.status??p.status,b=g.summary??p.summary;return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardGreen} ${m?I.inProgress:""}`,"data-testid":"tool-card-workpad",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📓"}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-green, #4ade80)"},children:u}),v&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsx("span",{className:I.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),b&&o.jsx("pre",{className:I.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:b}),m&&!b&&s!==null&&s!==void 0&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&i&&!b&&!v&&!g.extra&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:i}),!r&&g.extra&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function mE(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 hE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;if(Array.isArray(i.results))return{results:i.results.filter(r=>r!==null&&typeof r=="object")};if(typeof i.node=="object"&&i.node!==null){const r=Array.isArray(i.edges)?i.edges.length:0;return{node:i.node,edgeCount:r}}if(typeof i.id=="string")return{node:i}}catch{}return{}}const Yf=5;function gE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Ro(t),p=mE(s),m=i===void 0,g=hE(i);return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${m?I.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🧠"}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:u}),p.query&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-count",children:[g.results.length," ",g.results.length===1?"result":"results"]})]}),g.node&&g.edgeCount!==void 0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-knowledge-edges",children:[g.edgeCount," ",g.edgeCount===1?"edge":"edges"]})]})]}),m&&s!==null&&s!==void 0&&!p.query&&!p.id&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&g.results&&g.results.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,Yf)).map(v=>{var k,S,j;const b=((k=v.node)==null?void 0:k.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(`
245
- `)}),g.results.length>Yf&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-Yf} more results`]})]}),!r&&g.node&&!g.results&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-node",children:[g.node.id?`id: ${g.node.id}`:null,g.node.title?`title: ${g.node.title}`:null,g.node.category?`category: ${g.node.category}`:null,g.node.kind?`kind: ${g.node.kind}`:null,g.node.content?`content: ${g.node.content.length>100?g.node.content.slice(0,100)+"...":g.node.content}`:null].filter(Boolean).join(`
246
- `)})]})}function vE(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 yE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s;return{sessionId:typeof i.sessionId=="string"?i.sessionId:void 0,fd:typeof i.fd=="number"?i.fd:void 0,fds:Array.isArray(i.fds)?i.fds.filter(r=>r!==null&&typeof r=="object"):void 0,success:typeof i.success=="boolean"?i.success:void 0,output:typeof i.output=="string"?i.output:void 0}}catch{}return{}}function bE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Ro(t),p=vE(s),m=i===void 0,g=yE(i);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const b=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardOrange} ${m?I.inProgress:""}`,"data-testid":"tool-card-ipc",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔀"}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:u}),v&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-ipc-info",children:v}),b&&o.jsx("span",{className:I.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:b}),g.fds&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-ipc-fd-count",children:[g.fds.length," ",g.fds.length===1?"fd":"fds"]})]}),g.success!==void 0&&!g.fds&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsx("span",{className:I.badge,style:{color:g.success?"var(--accent-green, #4ade80)":"var(--accent-red, #f87171)"},"data-testid":"tool-card-ipc-success",children:g.success?"✓ ok":"✗ failed"})]})]}),m&&!b&&!v&&s!==null&&s!==void 0&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&g.sessionId&&o.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-ipc-session",children:["session: ",g.sessionId,g.fd!==void 0&&` | fd: ${g.fd}`]}),!r&&g.output&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!r&&g.fds&&g.fds.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const k=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&k.push(_.streamName),_.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
247
- `)}),g.fds.length>5&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function _E(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const Jf=8;function xE({args:t,result:s,isError:i}){const[r,c]=y.useState(!1),d=_E(t),u=s===void 0,p=(s==null?void 0:s.split(`
248
- `))??[],m=p.length>Jf,g=r?s:p.slice(0,Jf).join(`
249
- `);return o.jsxs("div",{className:`${I.card} ${i?I.cardRed:I.cardNeutral} ${u?I.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔧"}),o.jsx("span",{className:I.toolName,children:"ToolSearch"}),d&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-tool-search-query",children:['"',d,'"']}),!u&&!i&&s&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:I.spacer}),o.jsxs("span",{className:I.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),u&&!d&&t!==null&&t!==void 0&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),i&&s&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:s}),!i&&!u&&s&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-tool-search-result",children:g}),m&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":r,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${r?I.chevronExpanded:""}`,children:"▸"}),r?"collapse":`${p.length-Jf} more lines`]})]})]})}function kE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function SE(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 i=JSON.stringify(t);return i.length>120?`${i.slice(0,120)}…`:i}catch{return""}}const Wf=5;function TE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{display:u}=kE(t),p=SE(s),m=i===void 0,g=(i==null?void 0:i.split(`
250
- `))??[],v=g.length>Wf,b=c?i:g.slice(0,Wf).join(`
251
- `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${m?I.inProgress:""}`,"data-testid":"tool-card-generic",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:o.jsx(o2,{size:Zt,"aria-hidden":"true"})}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:u}),p&&o.jsx("span",{className:I.fileName,children:p})]}),m&&_&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:_}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!m&&i&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:b}),v&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),c?"collapse":`${g.length-Wf} more lines`]})]})]})}const wE="_badgePill_o7eqc_1",jE="_modelBadge_o7eqc_14",NE="_backgroundBadge_o7eqc_26",CE="_backgroundDot_o7eqc_36",EE="_backgroundDotPulsing_o7eqc_41",AE="_description_o7eqc_55",DE="_statusLine_o7eqc_62",RE="_statusCompleted_o7eqc_72",ME="_statusRunning_o7eqc_77",IE="_statusError_o7eqc_83",OE="_promptToggle_o7eqc_88",ss={badgePill:wE,modelBadge:jE,backgroundBadge:NE,backgroundDot:CE,backgroundDotPulsing:EE,description:AE,statusLine:DE,statusCompleted:RE,statusRunning:ME,statusError:IE,promptToggle:OE};function LE(t,s){if(s==null||typeof s!="object")return{};const i=s;return t.toLowerCase()==="read_agent"?{agentId:typeof i.agent_id=="string"?i.agent_id:void 0,isPoll:!0}:typeof i.agent_type=="string"||typeof i.name=="string"?{agentType:typeof i.agent_type=="string"?i.agent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.mode==="background",agentName:typeof i.name=="string"?i.name:void 0}:{agentType:typeof i.subagent_type=="string"?i.subagent_type:void 0,description:typeof i.description=="string"?i.description:void 0,prompt:typeof i.prompt=="string"?i.prompt:void 0,isBackground:i.run_in_background===!0,model:typeof i.model=="string"?i.model:void 0,isResume:typeof i.resume=="string"&&i.resume.length>0}}const BE=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function zE(t){const s=BE.exec(t);if(!s)return;const i=s[4];return{status:s[1].toLowerCase(),agentId:s[2].replace(/,$/,""),metadata:s[3].trim(),content:i?i.trim():void 0}}const Xf=5;function UE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),m=LE(t,s),g=i===void 0,v=m.isPoll&&i?zE(i):void 0,b=(v==null?void 0:v.content)??i,_=(b==null?void 0:b.split(`
252
- `))??[],k=_.length>Xf,S=c?b:_.slice(0,Xf).join(`
253
- `),j=m.isPoll?"Subagent":"Agent";return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardTeal} ${g?I.inProgress:""}`,"data-testid":"tool-card-agent",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:j}),m.agentType&&o.jsx("span",{className:ss.badgePill,"data-testid":"tool-card-agent-type",children:m.agentType}),m.model&&o.jsx("span",{className:ss.modelBadge,"data-testid":"tool-card-agent-model",children:m.model}),m.isBackground&&o.jsxs("span",{className:ss.backgroundBadge,"data-testid":"tool-card-agent-background",children:[o.jsx("span",{className:g?ss.backgroundDotPulsing:ss.backgroundDot,children:"●"}),"BG"]}),m.agentName&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-name",children:m.agentName}),m.agentId&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-id",children:m.agentId}),o.jsx("span",{className:I.spacer}),g&&!m.isBackground&&o.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),m.description&&o.jsx("div",{className:ss.description,"data-testid":"tool-card-agent-description",children:m.isResume?`Resuming: ${m.description}`:m.description}),v&&o.jsxs("div",{className:ss.statusLine,"data-testid":"tool-card-agent-status",children:[o.jsx("span",{className:v.status==="completed"?ss.statusCompleted:v.status==="running"?ss.statusRunning:ss.statusError,children:v.status}),v.metadata&&o.jsx("span",{children:v.metadata})]}),m.prompt&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:ss.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":u,"data-testid":"tool-card-prompt-toggle",children:[o.jsx("span",{className:`${I.chevron} ${u?I.chevronExpanded:""}`,children:"▸"}),"prompt"]}),u&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-prompt",children:m.prompt})]}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&b&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:S}),k&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[o.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-Xf} more lines`]})]})]})}function Qf(t){switch(qN(t.tool)){case"file-read":return o.jsx(fy,{...t});case"file-edit":return o.jsx(EC,{...t});case"file-write":return o.jsx(fy,{...t,writeVariant:!0});case"shell":return o.jsx(IC,{...t});case"search":return o.jsx(LC,{...t});case"todo":return o.jsx(tE,{...t});case"metadata":return o.jsx(sE,{...t});case"finding":return o.jsx(oE,{...t});case"task":return o.jsx(dE,{...t});case"workpad":return o.jsx(pE,{...t});case"knowledge":return o.jsx(gE,{...t});case"ipc":return o.jsx(bE,{...t});case"tool-search":return o.jsx(xE,{...t});case"agent":return o.jsx(UE,{...t});default:return o.jsx(TE,{...t})}}const $E="_systemContextEvent_hmqlm_1",PE="_systemContextHeader_hmqlm_7",VE="_systemContextBadge_hmqlm_28",HE="_systemContextToggle_hmqlm_37",qE="_systemContextPre_hmqlm_43",GE="_systemContextEllipsis_hmqlm_54",FE="_systemEvent_hmqlm_58",ZE="_systemTimestamp_hmqlm_65",KE="_textEvent_hmqlm_69",YE="_codeBlockWrapper_hmqlm_156",JE="_codeBlockCopyButton_hmqlm_159",WE="_errorEvent_hmqlm_163",XE="_statusEvent_hmqlm_171",QE="_userInputEvent_hmqlm_180",eA="_userInputContent_hmqlm_186",tA="_signalEvent_hmqlm_203",nA="_signalBadge_hmqlm_214",sA="_signalContent_hmqlm_223",aA="_usageEvent_hmqlm_228",iA="_usageBadge_hmqlm_235",oA="_defaultEvent_hmqlm_244",Ot={systemContextEvent:$E,systemContextHeader:PE,systemContextBadge:VE,systemContextToggle:HE,systemContextPre:qE,systemContextEllipsis:GE,systemEvent:FE,systemTimestamp:ZE,textEvent:KE,codeBlockWrapper:YE,codeBlockCopyButton:JE,errorEvent:WE,statusEvent:XE,userInputEvent:QE,userInputContent:eA,signalEvent:tA,signalBadge:nA,signalContent:sA,usageEvent:aA,usageBadge:iA,defaultEvent:oA},hy=3;function rA({content:t}){const[s,i]=y.useState(!1),r=t.split(`
254
- `),c=r.length>hy,d=s?t:r.slice(0,hy).join(`
255
- `);return o.jsxs("div",{className:Ot.systemContextEvent,"data-testid":"system-context-event",children:[o.jsxs("button",{type:"button",className:Ot.systemContextHeader,onClick:()=>{i(u=>!u)},"aria-expanded":s,children:[o.jsx("span",{className:Ot.systemContextBadge,children:"SYSTEM PROMPT"}),c&&o.jsx("span",{className:Ot.systemContextToggle,"aria-hidden":"true",children:s?o.jsx(o_,{size:at}):o.jsx(ea,{size:at})})]}),o.jsxs("pre",{className:Ot.systemContextPre,children:[d,!s&&c&&o.jsx("span",{className:Ot.systemContextEllipsis,children:"…"})]})]})}function lA({time:t,content:s}){return o.jsxs("div",{className:Ot.systemEvent,children:[o.jsxs("span",{className:Ot.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Ap(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Ap).join(""):t!=null&&typeof t=="object"&&"props"in t?Ap(t.props.children):""}function cA({children:t,node:s,...i}){const r=Ap(t);return o.jsxs("div",{className:Ot.codeBlockWrapper,children:[o.jsx("pre",{...i,children:t}),o.jsx(kN,{text:r,"data-testid":"copy-code-block",className:Ot.codeBlockCopyButton})]})}const dA={pre:cA};function uA({content:t}){return o.jsx("div",{className:Ot.textEvent,children:o.jsx(cd,{remarkPlugins:[dd],rehypePlugins:[VN],components:dA,children:t})})}function fA({content:t}){return o.jsxs("div",{className:Ot.errorEvent,children:["Error: ",t]})}function pA({content:t}){return o.jsxs("div",{className:Ot.statusEvent,children:["--- ",t," ---"]})}function mA({content:t}){return o.jsx("div",{className:Ot.userInputEvent,children:o.jsx("span",{className:Ot.userInputContent,children:t})})}function hA({content:t}){return o.jsxs("div",{className:Ot.signalEvent,"data-testid":"signal-event",children:[o.jsx("span",{className:Ot.signalBadge,children:"SIGNAL"}),o.jsx("span",{className:Ot.signalContent,children:t})]})}function gA({content:t}){let s=t;try{const i=JSON.parse(t),r=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,d=R_(r+c),u=wo(Number(i.cost_usd)||0);s=`${d} tokens · ${u}`}catch{}return o.jsx("div",{className:Ot.usageEvent,"data-testid":"usage-event",children:o.jsx("span",{className:Ot.usageBadge,children:s})})}function vA({content:t}){return o.jsx("div",{className:Ot.defaultEvent,children:t})}function yA({event:t,toolUseCtx:s,settled:i}){const r=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return o.jsx(rA,{content:t.content})}catch{}return o.jsx(lA,{time:r,content:t.content})}case"text":case"output":return o.jsx(uA,{content:t.content});case"tool_use":{let c="",d={};try{const u=JSON.parse(t.content);c=u.tool||"",d=u.args}catch{}return o.jsx(Qf,{tool:c,args:d,result:i?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let d=t.content;if(t.content.trimStart().startsWith("{"))try{const u=JSON.parse(t.content);typeof u.content=="string"&&(d=u.content)}catch{}return s?o.jsx(Qf,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):o.jsx(Qf,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return o.jsx(fA,{content:t.content});case"status":return o.jsx(pA,{content:t.content});case"user_input":return o.jsx(mA,{content:t.content});case"signal":return o.jsx(hA,{content:t.content});case"usage":return o.jsx(gA,{content:t.content});default:return o.jsx(vA,{content:t.content})}}const um=y.createContext({});function fm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const gd=y.createContext(null),pm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class bA extends y.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=i.offsetHeight||0,r.width=i.offsetWidth||0,r.top=i.offsetTop,r.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function _A({children:t,isPresent:s}){const i=y.useId(),r=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0}),{nonce:d}=y.useContext(pm);return y.useInsertionEffect(()=>{const{width:u,height:p,top:m,left:g}=c.current;if(s||!r.current||!u||!p)return;r.current.dataset.motionPopId=i;const v=document.createElement("style");return d&&(v.nonce=d),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
256
- [data-motion-pop-id="${i}"] {
257
- position: absolute !important;
258
- width: ${u}px !important;
259
- height: ${p}px !important;
260
- top: ${m}px !important;
261
- left: ${g}px !important;
262
- }
263
- `),()=>{document.head.removeChild(v)}},[s]),o.jsx(bA,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const xA=({children:t,initial:s,isPresent:i,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=fm(kA),m=y.useId(),g=y.useCallback(b=>{p.set(b,!0);for(const _ of p.values())if(!_)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:m,initial:s,isPresent:i,custom:c,onExitComplete:g,register:b=>(p.set(b,!1),()=>p.delete(b))}),d?[Math.random(),g]:[i,g]);return y.useMemo(()=>{p.forEach((b,_)=>p.set(_,!1))},[i]),y.useEffect(()=>{!i&&!p.size&&r&&r()},[i]),u==="popLayout"&&(t=o.jsx(_A,{isPresent:i,children:t})),o.jsx(gd.Provider,{value:v,children:t})};function kA(){return new Map}function M_(t=!0){const s=y.useContext(gd);if(s===null)return[!0,null];const{isPresent:i,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!i&&r?[!1,u]:[!0]}const Nc=t=>t.key||"";function gy(t){const s=[];return y.Children.forEach(t,i=>{y.isValidElement(i)&&s.push(i)}),s}const mm=typeof window<"u",I_=mm?y.useLayoutEffect:y.useEffect,cs=({children:t,custom:s,initial:i=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,m]=M_(u),g=y.useMemo(()=>gy(t),[t]),v=u&&!p?[]:g.map(Nc),b=y.useRef(!0),_=y.useRef(g),k=fm(()=>new Map),[S,j]=y.useState(g),[N,T]=y.useState(g);I_(()=>{b.current=!1,_.current=g;for(let D=0;D<N.length;D++){const R=Nc(N[D]);v.includes(R)?k.delete(R):k.get(R)!==!0&&k.set(R,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==S){let D=[...g];for(let R=0;R<N.length;R++){const L=N[R],A=Nc(L);v.includes(A)||(D.splice(R,0,L),C.push(L))}d==="wait"&&C.length&&(D=C),T(gy(D)),j(g);return}const{forceRender:E}=y.useContext(um);return o.jsx(o.Fragment,{children:N.map(D=>{const R=Nc(D),L=u&&!p?!1:g===N||v.includes(R),A=()=>{if(k.has(R))k.set(R,!0);else return;let U=!0;k.forEach(F=>{F||(U=!1)}),U&&(E==null||E(),T(_.current),u&&(m==null||m()),r&&r())};return o.jsx(xA,{isPresent:L,initial:!b.current||i?void 0:!1,custom:L?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:L?void 0:A,children:D},R)})})},An=t=>t;let O_=An;const SA={useManualTiming:!1};function TA(t){let s=new Set,i=new Set,r=!1,c=!1;const d=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function p(g){d.has(g)&&(m.schedule(g),t()),g(u)}const m={schedule:(g,v=!1,b=!1)=>{const k=b&&r?s:i;return v&&d.add(g),k.has(g)||k.add(g),g},cancel:g=>{i.delete(g),d.delete(g)},process:g=>{if(u=g,r){c=!0;return}r=!0,[s,i]=[i,s],s.forEach(p),s.clear(),r=!1,c&&(c=!1,m.process(g))}};return m}const Cc=["read","resolveKeyframes","update","preRender","render","postRender"],wA=40;function L_(t,s){let i=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>i=!0,u=Cc.reduce((T,C)=>(T[C]=TA(d),T),{}),{read:p,resolveKeyframes:m,update:g,preRender:v,render:b,postRender:_}=u,k=()=>{const T=performance.now();i=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,wA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),m.process(c),g.process(c),v.process(c),b.process(c),_.process(c),c.isProcessing=!1,i&&s&&(r=!1,t(k))},S=()=>{i=!0,r=!0,c.isProcessing||t(k)};return{schedule:Cc.reduce((T,C)=>{const E=u[C];return T[C]=(D,R=!1,L=!1)=>(i||S(),E.schedule(D,R,L)),T},{}),cancel:T=>{for(let C=0;C<Cc.length;C++)u[Cc[C]].cancel(T)},state:c,steps:u}}const{schedule:_t,cancel:Oa,state:Qt,steps:ep}=L_(typeof requestAnimationFrame<"u"?requestAnimationFrame:An,!0),B_=y.createContext({strict:!1}),vy={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"]},jo={};for(const t in vy)jo[t]={isEnabled:s=>vy[t].some(i=>!!s[i])};function jA(t){for(const s in t)jo[s]={...jo[s],...t[s]}}const NA=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 Yc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||NA.has(t)}let z_=t=>!Yc(t);function CA(t){t&&(z_=s=>s.startsWith("on")?!Yc(s):t(s))}try{CA(require("@emotion/is-prop-valid").default)}catch{}function EA(t,s,i){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(z_(c)||i===!0&&Yc(c)||!s&&!Yc(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function AA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...r)=>t(...r);return new Proxy(i,{get:(r,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const vd=y.createContext({});function Zr(t){return typeof t=="string"||Array.isArray(t)}function yd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const hm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gm=["initial",...hm];function bd(t){return yd(t.animate)||gm.some(s=>Zr(t[s]))}function U_(t){return!!(bd(t)||t.variants)}function DA(t,s){if(bd(t)){const{initial:i,animate:r}=t;return{initial:i===!1||Zr(i)?i:void 0,animate:Zr(r)?r:void 0}}return t.inherit!==!1?s:{}}function RA(t){const{initial:s,animate:i}=DA(t,y.useContext(vd));return y.useMemo(()=>({initial:s,animate:i}),[yy(s),yy(i)])}function yy(t){return Array.isArray(t)?t.join(" "):t}const MA=Symbol.for("motionComponentSymbol");function vo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function IA(t,s,i){return y.useCallback(r=>{r&&t.onMount&&t.onMount(r),s&&(r?s.mount(r):s.unmount()),i&&(typeof i=="function"?i(r):vo(i)&&(i.current=r))},[s])}const vm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),OA="framerAppearId",$_="data-"+vm(OA),{schedule:ym}=L_(queueMicrotask,!1),P_=y.createContext({});function LA(t,s,i,r,c){var d,u;const{visualElement:p}=y.useContext(vd),m=y.useContext(B_),g=y.useContext(gd),v=y.useContext(pm).reducedMotion,b=y.useRef(null);r=r||m.renderer,!b.current&&r&&(b.current=r(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=b.current,k=y.useContext(P_);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&BA(b.current,i,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{_&&S.current&&_.update(i,g)});const j=i[$_],N=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 I_(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),ym.render(_.render),N.current&&_.animationState&&_.animationState.animateChanges())}),y.useEffect(()=>{_&&(!N.current&&_.animationState&&_.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,j)}),N.current=!1))}),_}function BA(t,s,i,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:m,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:V_(t.parent)),t.projection.setOptions({layoutId:c,layout:d,alwaysMeasureLayout:!!u||p&&vo(p),visualElement:t,animationType:typeof d=="string"?d:"both",initialPromotionConfig:r,layoutScroll:m,layoutRoot:g})}function V_(t){if(t)return t.options.allowProjection!==!1?t.projection:V_(t.parent)}function zA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:r,Component:c}){var d,u;t&&jA(t);function p(g,v){let b;const _={...y.useContext(pm),...g,layoutId:UA(g)},{isStatic:k}=_,S=RA(g),j=r(g,k);if(!k&&mm){$A();const N=PA(_);b=N.MeasureLayout,S.visualElement=LA(c,j,_,s,N.ProjectionNode)}return o.jsxs(vd.Provider,{value:S,children:[b&&S.visualElement?o.jsx(b,{visualElement:S.visualElement,..._}):null,i(c,g,IA(j,S.visualElement,v),j,k,S.visualElement)]})}p.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(p);return m[MA]=c,m}function UA({layoutId:t}){const s=y.useContext(um).id;return s&&t!==void 0?s+"-"+t:t}function $A(t,s){y.useContext(B_).strict}function PA(t){const{drag:s,layout:i}=jo;if(!s&&!i)return{};const r={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const VA=["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 bm(t){return typeof t!="string"||t.includes("-")?!1:!!(VA.indexOf(t)>-1||/[A-Z]/u.test(t))}function by(t){const s=[{},{}];return t==null||t.values.forEach((i,r)=>{s[0][r]=i.get(),s[1][r]=i.getVelocity()}),s}function _m(t,s,i,r){if(typeof s=="function"){const[c,d]=by(r);s=s(i!==void 0?i:t.custom,c,d)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,d]=by(r);s=s(i!==void 0?i:t.custom,c,d)}return s}const Dp=t=>Array.isArray(t),HA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),qA=t=>Dp(t)?t[t.length-1]||0:t,an=t=>!!(t&&t.getVelocity);function Vc(t){const s=an(t)?t.get():t;return HA(s)?s.toValue():s}function GA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},r,c,d){const u={latestValues:FA(r,c,d,t),renderState:s()};return i&&(u.onMount=p=>i({props:r,current:p,...u}),u.onUpdate=p=>i(p)),u}const H_=t=>(s,i)=>{const r=y.useContext(vd),c=y.useContext(gd),d=()=>GA(t,s,r,c);return i?d():fm(d)};function FA(t,s,i,r){const c={},d=r(t,{});for(const _ in d)c[_]=Vc(d[_]);let{initial:u,animate:p}=t;const m=bd(t),g=U_(t);s&&g&&!m&&t.inherit!==!1&&(u===void 0&&(u=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||u===!1;const b=v?p:u;if(b&&typeof b!="boolean"&&!yd(b)){const _=Array.isArray(b)?b:[b];for(let k=0;k<_.length;k++){const S=_m(t,_[k]);if(S){const{transitionEnd:j,transition:N,...T}=S;for(const C in T){let E=T[C];if(Array.isArray(E)){const D=v?E.length-1:0;E=E[D]}E!==null&&(c[C]=E)}for(const C in j)c[C]=j[C]}}}return c}const Mo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ti=new Set(Mo),q_=t=>s=>typeof s=="string"&&s.startsWith(t),G_=q_("--"),ZA=q_("var(--"),xm=t=>ZA(t)?KA.test(t.split("/*")[0].trim()):!1,KA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,F_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Xs=(t,s,i)=>i>s?s:i<t?t:i,Io={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Kr={...Io,transform:t=>Xs(0,1,t)},Ec={...Io,default:1},sl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Da=sl("deg"),bs=sl("%"),Ce=sl("px"),YA=sl("vh"),JA=sl("vw"),_y={...bs,parse:t=>bs.parse(t)/100,transform:t=>bs.transform(t*100)},WA={borderWidth:Ce,borderTopWidth:Ce,borderRightWidth:Ce,borderBottomWidth:Ce,borderLeftWidth:Ce,borderRadius:Ce,radius:Ce,borderTopLeftRadius:Ce,borderTopRightRadius:Ce,borderBottomRightRadius:Ce,borderBottomLeftRadius:Ce,width:Ce,maxWidth:Ce,height:Ce,maxHeight:Ce,top:Ce,right:Ce,bottom:Ce,left:Ce,padding:Ce,paddingTop:Ce,paddingRight:Ce,paddingBottom:Ce,paddingLeft:Ce,margin:Ce,marginTop:Ce,marginRight:Ce,marginBottom:Ce,marginLeft:Ce,backgroundPositionX:Ce,backgroundPositionY:Ce},XA={rotate:Da,rotateX:Da,rotateY:Da,rotateZ:Da,scale:Ec,scaleX:Ec,scaleY:Ec,scaleZ:Ec,skew:Da,skewX:Da,skewY:Da,distance:Ce,translateX:Ce,translateY:Ce,translateZ:Ce,x:Ce,y:Ce,z:Ce,perspective:Ce,transformPerspective:Ce,opacity:Kr,originX:_y,originY:_y,originZ:Ce},xy={...Io,transform:Math.round},km={...WA,...XA,zIndex:xy,size:Ce,fillOpacity:Kr,strokeOpacity:Kr,numOctaves:xy},QA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},eD=Mo.length;function tD(t,s,i){let r="",c=!0;for(let d=0;d<eD;d++){const u=Mo[d],p=t[u];if(p===void 0)continue;let m=!0;if(typeof p=="number"?m=p===(u.startsWith("scale")?1:0):m=parseFloat(p)===0,!m||i){const g=F_(p,km[u]);if(!m){c=!1;const v=QA[u]||u;r+=`${v}(${g}) `}i&&(s[u]=g)}}return r=r.trim(),i?r=i(s,c?"":r):c&&(r="none"),r}function Sm(t,s,i){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const m in s){const g=s[m];if(Ti.has(m)){u=!0;continue}else if(G_(m)){c[m]=g;continue}else{const v=F_(g,km[m]);m.startsWith("origin")?(p=!0,d[m]=v):r[m]=v}}if(s.transform||(u||i?r.transform=tD(s,t.transform,i):r.transform&&(r.transform="none")),p){const{originX:m="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${m} ${g} ${v}`}}const nD={offset:"stroke-dashoffset",array:"stroke-dasharray"},sD={offset:"strokeDashoffset",array:"strokeDasharray"};function aD(t,s,i=1,r=0,c=!0){t.pathLength=1;const d=c?nD:sD;t[d.offset]=Ce.transform(-r);const u=Ce.transform(s),p=Ce.transform(i);t[d.array]=`${u} ${p}`}function ky(t,s,i){return typeof t=="string"?t:Ce.transform(s+i*t)}function iD(t,s,i){const r=ky(s,t.x,t.width),c=ky(i,t.y,t.height);return`${r} ${c}`}function Tm(t,{attrX:s,attrY:i,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:m=0,...g},v,b){if(Sm(t,g,b),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:k,dimensions:S}=t;_.transform&&(S&&(k.transform=_.transform),delete _.transform),S&&(c!==void 0||d!==void 0||k.transform)&&(k.transformOrigin=iD(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),r!==void 0&&(_.scale=r),u!==void 0&&aD(_,u,p,m,!1)}const wm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),Z_=()=>({...wm(),attrs:{}}),jm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function K_(t,{style:s,vars:i},r,c){Object.assign(t.style,s,c&&c.getProjectionStyles(r));for(const d in i)t.style.setProperty(d,i[d])}const Y_=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 J_(t,s,i,r){K_(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Y_.has(c)?c:vm(c),s.attrs[c])}const Jc={};function oD(t){Object.assign(Jc,t)}function W_(t,{layout:s,layoutId:i}){return Ti.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Jc[t]||t==="opacity")}function Nm(t,s,i){var r;const{style:c}=t,d={};for(const u in c)(an(c[u])||s.style&&an(s.style[u])||W_(u,t)||((r=i==null?void 0:i.getValue(u))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(d[u]=c[u]);return d}function X_(t,s,i){const r=Nm(t,s,i);for(const c in t)if(an(t[c])||an(s[c])){const d=Mo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function rD(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 Sy=["x","y","width","height","cx","cy","r"],lD={useVisualState:H_({scrapeMotionValuesFromProps:X_,createRenderState:Z_,onUpdate:({props:t,prevProps:s,current:i,renderState:r,latestValues:c})=>{if(!i)return;let d=!!t.drag;if(!d){for(const p in c)if(Ti.has(p)){d=!0;break}}if(!d)return;let u=!s;if(s)for(let p=0;p<Sy.length;p++){const m=Sy[p];t[m]!==s[m]&&(u=!0)}u&&_t.read(()=>{rD(i,r),_t.render(()=>{Tm(r,c,jm(i.tagName),t.transformTemplate),J_(i,r)})})}})},cD={useVisualState:H_({scrapeMotionValuesFromProps:Nm,createRenderState:wm})};function Q_(t,s,i){for(const r in s)!an(s[r])&&!W_(r,i)&&(t[r]=s[r])}function dD({transformTemplate:t},s){return y.useMemo(()=>{const i=wm();return Sm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function uD(t,s){const i=t.style||{},r={};return Q_(r,i,t),Object.assign(r,dD(t,s)),r}function fD(t,s){const i={},r=uD(t,s);return t.drag&&t.dragListener!==!1&&(i.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)&&(i.tabIndex=0),i.style=r,i}function pD(t,s,i,r){const c=y.useMemo(()=>{const d=Z_();return Tm(d,s,jm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};Q_(d,t.style,t),c.style={...d,...c.style}}return c}function mD(t=!1){return(i,r,c,{latestValues:d},u)=>{const m=(bm(i)?pD:fD)(r,d,u,i),g=EA(r,typeof i=="string",t),v=i!==y.Fragment?{...g,...m,ref:c}:{},{children:b}=r,_=y.useMemo(()=>an(b)?b.get():b,[b]);return y.createElement(i,{...v,children:_})}}function hD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...bm(r)?lD:cD,preloadedFeatures:t,useRender:mD(c),createVisualElement:s,Component:r};return zA(u)}}function ex(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let r=0;r<i;r++)if(s[r]!==t[r])return!1;return!0}function _d(t,s,i){const r=t.getProps();return _m(r,s,i!==void 0?i:r.custom,t)}function Cm(t,s){return t?t[s]||t.default||t:void 0}const tx=new Set(["width","height","top","left","right","bottom",...Mo]);let Hc;function gD(){Hc=void 0}const _s={now:()=>(Hc===void 0&&_s.set(Qt.isProcessing||SA.useManualTiming?Qt.timestamp:performance.now()),Hc),set:t=>{Hc=t,queueMicrotask(gD)}};function Em(t,s){t.indexOf(s)===-1&&t.push(s)}function Am(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class Dm{constructor(){this.subscriptions=[]}add(s){return Em(this.subscriptions,s),()=>Am(this.subscriptions,s)}notify(s,i,r){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,r);else for(let d=0;d<c;d++){const u=this.subscriptions[d];u&&u(s,i,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function nx(t,s){return s?t*(1e3/s):0}const Ty=30,vD=t=>!isNaN(parseFloat(t));class yD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=_s.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=i.owner}setCurrent(s){this.current=s,this.updatedAt=_s.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=vD(this.current))}setPrevFrameValue(s=this.current){this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt}onChange(s){return this.on("change",s)}on(s,i){this.events[s]||(this.events[s]=new Dm);const r=this.events[s].add(i);return s==="change"?()=>{r(),_t.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const s in this.events)this.events[s].clear()}attach(s,i){this.passiveEffect=s,this.stopPassiveEffect=i}set(s,i=!0){!i||!this.passiveEffect?this.updateAndNotify(s,i):this.passiveEffect(s,this.updateAndNotify)}setWithVelocity(s,i,r){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-r}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=_s.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>Ty)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,Ty);return nx(parseFloat(this.current)-parseFloat(this.prevFrameValue),i)}start(s){return this.stop(),new Promise(i=>{this.hasAnimated=!0,this.animation=s(i),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 Yr(t,s){return new yD(t,s)}function bD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Yr(i))}function _D(t,s){const i=_d(t,s);let{transitionEnd:r={},transition:c={},...d}=i||{};d={...d,...r};for(const u in d){const p=qA(d[u]);bD(t,u,p)}}function xD(t){return!!(an(t)&&t.add)}function Rp(t,s){const i=t.getValue("willChange");if(xD(i))return i.add(s)}function sx(t){return t.props[$_]}function Rm(t){let s;return()=>(s===void 0&&(s=t()),s)}const kD=Rm(()=>window.ScrollTimeline!==void 0);class SD{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,i){for(let r=0;r<this.animations.length;r++)this.animations[r][s]=i}attachTimeline(s,i){const r=this.animations.map(c=>{if(kD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(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 i=0;i<this.animations.length;i++)s=Math.max(s,this.animations[i].duration);return s}runAll(s){this.animations.forEach(i=>i[s]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class TD extends SD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ks=t=>t*1e3,Ys=t=>t/1e3;function Mm(t){return typeof t=="function"}function wy(t,s){t.timeline=s,t.onfinish=null}const Im=t=>Array.isArray(t)&&typeof t[0]=="number",wD={linearEasing:void 0};function jD(t,s){const i=Rm(t);return()=>{var r;return(r=wD[s])!==null&&r!==void 0?r:i()}}const Wc=jD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),No=(t,s,i)=>{const r=s-t;return r===0?1:(i-t)/r},ax=(t,s,i=10)=>{let r="";const c=Math.max(Math.round(s/i),2);for(let d=0;d<c;d++)r+=t(No(0,c-1,d))+", ";return`linear(${r.substring(0,r.length-2)})`};function ix(t){return!!(typeof t=="function"&&Wc()||!t||typeof t=="string"&&(t in Mp||Wc())||Im(t)||Array.isArray(t)&&t.every(ix))}const Mr=([t,s,i,r])=>`cubic-bezier(${t}, ${s}, ${i}, ${r})`,Mp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Mr([0,.65,.55,1]),circOut:Mr([.55,0,1,.45]),backIn:Mr([.31,.01,.66,-.59]),backOut:Mr([.33,1.53,.69,.99])};function ox(t,s){if(t)return typeof t=="function"&&Wc()?ax(t,s):Im(t)?Mr(t):Array.isArray(t)?t.map(i=>ox(i,s)||Mp.easeOut):Mp[t]}const rx=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,ND=1e-7,CD=12;function ED(t,s,i,r,c){let d,u,p=0;do u=s+(i-s)/2,d=rx(u,r,c)-t,d>0?i=u:s=u;while(Math.abs(d)>ND&&++p<CD);return u}function al(t,s,i,r){if(t===s&&i===r)return An;const c=d=>ED(d,0,1,t,i);return d=>d===0||d===1?d:rx(c(d),s,r)}const lx=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,cx=t=>s=>1-t(1-s),dx=al(.33,1.53,.69,.99),Om=cx(dx),ux=lx(Om),fx=t=>(t*=2)<1?.5*Om(t):.5*(2-Math.pow(2,-10*(t-1))),Lm=t=>1-Math.sin(Math.acos(t)),px=cx(Lm),mx=lx(Lm),hx=t=>/^0[^.\s]+$/u.test(t);function AD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||hx(t):!0}const zr=t=>Math.round(t*1e5)/1e5,Bm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function DD(t){return t==null}const RD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zm=(t,s)=>i=>!!(typeof i=="string"&&RD.test(i)&&i.startsWith(t)||s&&!DD(i)&&Object.prototype.hasOwnProperty.call(i,s)),gx=(t,s,i)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Bm);return{[t]:parseFloat(c),[s]:parseFloat(d),[i]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},MD=t=>Xs(0,255,t),tp={...Io,transform:t=>Math.round(MD(t))},hi={test:zm("rgb","red"),parse:gx("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:r=1})=>"rgba("+tp.transform(t)+", "+tp.transform(s)+", "+tp.transform(i)+", "+zr(Kr.transform(r))+")"};function ID(t){let s="",i="",r="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),r=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),r=t.substring(3,4),c=t.substring(4,5),s+=s,i+=i,r+=r,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(r,16),alpha:c?parseInt(c,16)/255:1}}const Ip={test:zm("#"),parse:ID,transform:hi.transform},yo={test:zm("hsl","hue"),parse:gx("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:r=1})=>"hsla("+Math.round(t)+", "+bs.transform(zr(s))+", "+bs.transform(zr(i))+", "+zr(Kr.transform(r))+")"},sn={test:t=>hi.test(t)||Ip.test(t)||yo.test(t),parse:t=>hi.test(t)?hi.parse(t):yo.test(t)?yo.parse(t):Ip.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?hi.transform(t):yo.transform(t)},OD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function LD(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Bm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(OD))===null||i===void 0?void 0:i.length)||0)>0}const vx="number",yx="color",BD="var",zD="var(",jy="${}",UD=/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 Jr(t){const s=t.toString(),i=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(UD,m=>(sn.test(m)?(r.color.push(d),c.push(yx),i.push(sn.parse(m))):m.startsWith(zD)?(r.var.push(d),c.push(BD),i.push(m)):(r.number.push(d),c.push(vx),i.push(parseFloat(m))),++d,jy)).split(jy);return{values:i,split:p,indexes:r,types:c}}function bx(t){return Jr(t).values}function _x(t){const{split:s,types:i}=Jr(t),r=s.length;return c=>{let d="";for(let u=0;u<r;u++)if(d+=s[u],c[u]!==void 0){const p=i[u];p===vx?d+=zr(c[u]):p===yx?d+=sn.transform(c[u]):d+=c[u]}return d}}const $D=t=>typeof t=="number"?0:t;function PD(t){const s=bx(t);return _x(t)(s.map($D))}const La={test:LD,parse:bx,createTransformer:_x,getAnimatableNone:PD},VD=new Set(["brightness","contrast","saturate","opacity"]);function HD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=i.match(Bm)||[];if(!r)return t;const c=i.replace(r,"");let d=VD.has(s)?1:0;return r!==i&&(d*=100),s+"("+d+c+")"}const qD=/\b([a-z-]*)\(.*?\)/gu,Op={...La,getAnimatableNone:t=>{const s=t.match(qD);return s?s.map(HD).join(" "):t}},GD={...km,color:sn,backgroundColor:sn,outlineColor:sn,fill:sn,stroke:sn,borderColor:sn,borderTopColor:sn,borderRightColor:sn,borderBottomColor:sn,borderLeftColor:sn,filter:Op,WebkitFilter:Op},Um=t=>GD[t];function xx(t,s){let i=Um(t);return i!==Op&&(i=La),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const FD=new Set(["auto","none","0"]);function ZD(t,s,i){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!FD.has(d)&&Jr(d).values.length&&(c=t[r]),r++}if(c&&i)for(const d of s)t[d]=xx(i,c)}const Ny=t=>t===Io||t===Ce,Cy=(t,s)=>parseFloat(t.split(", ")[s]),Ey=(t,s)=>(i,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return Cy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?Cy(d[1],t):0}},KD=new Set(["x","y","z"]),YD=Mo.filter(t=>!KD.has(t));function JD(t){const s=[];return YD.forEach(i=>{const r=t.getValue(i);r!==void 0&&(s.push([i,r.get()]),r.set(i.startsWith("scale")?1:0))}),s}const Co={width:({x:t},{paddingLeft:s="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),height:({y:t},{paddingTop:s="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(s)-parseFloat(i),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:Ey(4,13),y:Ey(5,14)};Co.translateX=Co.x;Co.translateY=Co.y;const gi=new Set;let Lp=!1,Bp=!1;function kx(){if(Bp){const t=Array.from(gi).filter(r=>r.needsMeasurement),s=new Set(t.map(r=>r.element)),i=new Map;s.forEach(r=>{const c=JD(r);c.length&&(i.set(r,c),r.render())}),t.forEach(r=>r.measureInitialState()),s.forEach(r=>{r.render();const c=i.get(r);c&&c.forEach(([d,u])=>{var p;(p=r.getValue(d))===null||p===void 0||p.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Bp=!1,Lp=!1,gi.forEach(t=>t.complete()),gi.clear()}function Sx(){gi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Bp=!0)})}function WD(){Sx(),kx()}class $m{constructor(s,i,r,c,d,u=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=r,this.motionValue=c,this.element=d,this.isAsync=u}scheduleResolve(){this.isScheduled=!0,this.isAsync?(gi.add(this),Lp||(Lp=!0,_t.read(Sx),_t.resolveKeyframes(kx))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,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(),p=s[s.length-1];if(u!==void 0)s[0]=u;else if(r&&i){const m=r.readValue(i,p);m!=null&&(s[0]=m)}s[0]===void 0&&(s[0]=p),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),gi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,gi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Tx=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),XD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function QD(t){const s=XD.exec(t);if(!s)return[,];const[,i,r,c]=s;return[`--${i??r}`,c]}function wx(t,s,i=1){const[r,c]=QD(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return Tx(u)?parseFloat(u):u}return xm(c)?wx(c,s,i+1):c}const jx=t=>s=>s.test(t),eR={test:t=>t==="auto",parse:t=>t},Nx=[Io,Ce,bs,Da,JA,YA,eR],Ay=t=>Nx.find(jx(t));class Cx extends $m{constructor(s,i,r,c,d){super(s,i,r,c,d,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:r}=this;if(!i||!i.current)return;super.readKeyframes();for(let m=0;m<s.length;m++){let g=s[m];if(typeof g=="string"&&(g=g.trim(),xm(g))){const v=wx(g,i.current);v!==void 0&&(s[m]=v),m===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!tx.has(r)||s.length!==2)return;const[c,d]=s,u=Ay(c),p=Ay(d);if(u!==p)if(Ny(u)&&Ny(p))for(let m=0;m<s.length;m++){const g=s[m];typeof g=="string"&&(s[m]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:i}=this,r=[];for(let c=0;c<s.length;c++)AD(s[c])&&r.push(c);r.length&&ZD(s,r,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:r}=this;if(!s||!s.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Co[r](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(r,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:r,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const d=i.getValue(r);d&&d.jump(this.measuredOrigin,!1);const u=c.length-1,p=c[u];c[u]=Co[r](i.measureViewportBox(),window.getComputedStyle(i.current)),p!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=p),!((s=this.removedTransforms)===null||s===void 0)&&s.length&&this.removedTransforms.forEach(([m,g])=>{i.getValue(m).set(g)}),this.resolveNoneKeyframes()}}const Dy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(La.test(t)||t==="0")&&!t.startsWith("url("));function tR(t){const s=t[0];if(t.length===1)return!0;for(let i=0;i<t.length;i++)if(t[i]!==s)return!0}function nR(t,s,i,r){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const d=t[t.length-1],u=Dy(c,s),p=Dy(d,s);return!u||!p?!1:tR(t)||(i==="spring"||Mm(i))&&r}const sR=t=>t!==null;function xd(t,{repeat:s,repeatType:i="loop"},r){const c=t.filter(sR),d=s&&i!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const aR=40;class Ex{constructor({autoplay:s=!0,delay:i=0,type:r="keyframes",repeat:c=0,repeatDelay:d=0,repeatType:u="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=_s.now(),this.options={autoplay:s,delay:i,type:r,repeat:c,repeatDelay:d,repeatType:u,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>aR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&WD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=_s.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:m,isGenerator:g}=this.options;if(!g&&!nR(s,r,c,d))if(u)this.options.duration=0;else{m&&m(xd(s,this.options,i)),p&&p(),this.resolveFinishedPromise();return}const v=this.initPlayback(s,i);v!==!1&&(this._resolved={keyframes:s,finalKeyframe:i,...v},this.onPostResolved())}onPostResolved(){}then(s,i){return this.currentFinishedPromise.then(s,i)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(s=>{this.resolveFinishedPromise=s})}}const zp=2e4;function Ax(t){let s=0;const i=50;let r=t.next(s);for(;!r.done&&s<zp;)s+=i,r=t.next(s);return s>=zp?1/0:s}const Tt=(t,s,i)=>t+(s-t)*i;function np(t,s,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+(s-t)*6*i:i<1/2?s:i<2/3?t+(s-t)*(2/3-i)*6:t}function iR({hue:t,saturation:s,lightness:i,alpha:r}){t/=360,s/=100,i/=100;let c=0,d=0,u=0;if(!s)c=d=u=i;else{const p=i<.5?i*(1+s):i+s-i*s,m=2*i-p;c=np(m,p,t+1/3),d=np(m,p,t),u=np(m,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function Xc(t,s){return i=>i>0?s:t}const sp=(t,s,i)=>{const r=t*t,c=i*(s*s-r)+r;return c<0?0:Math.sqrt(c)},oR=[Ip,hi,yo],rR=t=>oR.find(s=>s.test(t));function Ry(t){const s=rR(t);if(!s)return!1;let i=s.parse(t);return s===yo&&(i=iR(i)),i}const My=(t,s)=>{const i=Ry(t),r=Ry(s);if(!i||!r)return Xc(t,s);const c={...i};return d=>(c.red=sp(i.red,r.red,d),c.green=sp(i.green,r.green,d),c.blue=sp(i.blue,r.blue,d),c.alpha=Tt(i.alpha,r.alpha,d),hi.transform(c))},lR=(t,s)=>i=>s(t(i)),il=(...t)=>t.reduce(lR),Up=new Set(["none","hidden"]);function cR(t,s){return Up.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function dR(t,s){return i=>Tt(t,s,i)}function Pm(t){return typeof t=="number"?dR:typeof t=="string"?xm(t)?Xc:sn.test(t)?My:pR:Array.isArray(t)?Dx:typeof t=="object"?sn.test(t)?My:uR:Xc}function Dx(t,s){const i=[...t],r=i.length,c=t.map((d,u)=>Pm(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)i[u]=c[u](d);return i}}function uR(t,s){const i={...t,...s},r={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(r[c]=Pm(t[c])(t[c],s[c]));return c=>{for(const d in r)i[d]=r[d](c);return i}}function fR(t,s){var i;const r=[],c={color:0,var:0,number:0};for(let d=0;d<s.values.length;d++){const u=s.types[d],p=t.indexes[u][c[u]],m=(i=t.values[p])!==null&&i!==void 0?i:0;r[d]=m,c[u]++}return r}const pR=(t,s)=>{const i=La.createTransformer(s),r=Jr(t),c=Jr(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?Up.has(t)&&!c.values.length||Up.has(s)&&!r.values.length?cR(t,s):il(Dx(fR(r,c),c.values),i):Xc(t,s)};function Rx(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?Tt(t,s,i):Pm(t)(t,s)}const mR=5;function Mx(t,s,i){const r=Math.max(s-mR,0);return nx(i-t(r),s-r)}const Ct={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},ap=.001;function hR({duration:t=Ct.duration,bounce:s=Ct.bounce,velocity:i=Ct.velocity,mass:r=Ct.mass}){let c,d,u=1-s;u=Xs(Ct.minDamping,Ct.maxDamping,u),t=Xs(Ct.minDuration,Ct.maxDuration,Ys(t)),u<1?(c=g=>{const v=g*u,b=v*t,_=v-i,k=$p(g,u),S=Math.exp(-b);return ap-_/k*S},d=g=>{const b=g*u*t,_=b*i+i,k=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-b),j=$p(Math.pow(g,2),u);return(-c(g)+ap>0?-1:1)*((_-k)*S)/j}):(c=g=>{const v=Math.exp(-g*t),b=(g-i)*t+1;return-ap+v*b},d=g=>{const v=Math.exp(-g*t),b=(i-g)*(t*t);return v*b});const p=5/t,m=vR(c,d,p);if(t=Ks(t),isNaN(m))return{stiffness:Ct.stiffness,damping:Ct.damping,duration:t};{const g=Math.pow(m,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const gR=12;function vR(t,s,i){let r=i;for(let c=1;c<gR;c++)r=r-t(r)/s(r);return r}function $p(t,s){return t*Math.sqrt(1-s*s)}const yR=["duration","bounce"],bR=["stiffness","damping","mass"];function Iy(t,s){return s.some(i=>t[i]!==void 0)}function _R(t){let s={velocity:Ct.velocity,stiffness:Ct.stiffness,damping:Ct.damping,mass:Ct.mass,isResolvedFromDuration:!1,...t};if(!Iy(t,bR)&&Iy(t,yR))if(t.visualDuration){const i=t.visualDuration,r=2*Math.PI/(i*1.2),c=r*r,d=2*Xs(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:Ct.mass,stiffness:c,damping:d}}else{const i=hR(t);s={...s,...i,mass:Ct.mass},s.isResolvedFromDuration=!0}return s}function Ix(t=Ct.visualDuration,s=Ct.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:r,restDelta:c}=i;const d=i.keyframes[0],u=i.keyframes[i.keyframes.length-1],p={done:!1,value:d},{stiffness:m,damping:g,mass:v,duration:b,velocity:_,isResolvedFromDuration:k}=_R({...i,velocity:-Ys(i.velocity||0)}),S=_||0,j=g/(2*Math.sqrt(m*v)),N=u-d,T=Ys(Math.sqrt(m/v)),C=Math.abs(N)<5;r||(r=C?Ct.restSpeed.granular:Ct.restSpeed.default),c||(c=C?Ct.restDelta.granular:Ct.restDelta.default);let E;if(j<1){const R=$p(T,j);E=L=>{const A=Math.exp(-j*T*L);return u-A*((S+j*T*N)/R*Math.sin(R*L)+N*Math.cos(R*L))}}else if(j===1)E=R=>u-Math.exp(-T*R)*(N+(S+T*N)*R);else{const R=T*Math.sqrt(j*j-1);E=L=>{const A=Math.exp(-j*T*L),U=Math.min(R*L,300);return u-A*((S+j*T*N)*Math.sinh(U)+R*N*Math.cosh(U))/R}}const D={calculatedDuration:k&&b||null,next:R=>{const L=E(R);if(k)p.done=R>=b;else{let A=0;j<1&&(A=R===0?Ks(S):Mx(E,R,L));const U=Math.abs(A)<=r,F=Math.abs(u-L)<=c;p.done=U&&F}return p.value=p.done?u:L,p},toString:()=>{const R=Math.min(Ax(D),zp),L=ax(A=>D.next(R*A).value,R,30);return R+"ms "+L}};return D}function Oy({keyframes:t,velocity:s=0,power:i=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:m,restDelta:g=.5,restSpeed:v}){const b=t[0],_={done:!1,value:b},k=U=>p!==void 0&&U<p||m!==void 0&&U>m,S=U=>p===void 0?m:m===void 0||Math.abs(p-U)<Math.abs(m-U)?p:m;let j=i*s;const N=b+j,T=u===void 0?N:u(N);T!==N&&(j=T-b);const C=U=>-j*Math.exp(-U/r),E=U=>T+C(U),D=U=>{const F=C(U),ee=E(U);_.done=Math.abs(F)<=g,_.value=_.done?T:ee};let R,L;const A=U=>{k(_.value)&&(R=U,L=Ix({keyframes:[_.value,S(_.value)],velocity:Mx(E,U,_.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return A(0),{calculatedDuration:null,next:U=>{let F=!1;return!L&&R===void 0&&(F=!0,D(U),A(U)),R!==void 0&&U>=R?L.next(U-R):(!F&&D(U),_)}}}const xR=al(.42,0,1,1),kR=al(0,0,.58,1),Ox=al(.42,0,.58,1),SR=t=>Array.isArray(t)&&typeof t[0]!="number",TR={linear:An,easeIn:xR,easeInOut:Ox,easeOut:kR,circIn:Lm,circInOut:mx,circOut:px,backIn:Om,backInOut:ux,backOut:dx,anticipate:fx},Ly=t=>{if(Im(t)){O_(t.length===4);const[s,i,r,c]=t;return al(s,i,r,c)}else if(typeof t=="string")return TR[t];return t};function wR(t,s,i){const r=[],c=i||Rx,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const m=Array.isArray(s)?s[u]||An:s;p=il(m,p)}r.push(p)}return r}function jR(t,s,{clamp:i=!0,ease:r,mixer:c}={}){const d=t.length;if(O_(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 p=wR(s,r,c),m=p.length,g=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 _=No(t[b],t[b+1],v);return p[b](_)};return i?v=>g(Xs(t[0],t[d-1],v)):g}function NR(t,s){const i=t[t.length-1];for(let r=1;r<=s;r++){const c=No(0,s,r);t.push(Tt(i,1,c))}}function CR(t){const s=[0];return NR(s,t.length-1),s}function ER(t,s){return t.map(i=>i*s)}function AR(t,s){return t.map(()=>s||Ox).splice(0,t.length-1)}function Qc({duration:t=300,keyframes:s,times:i,ease:r="easeInOut"}){const c=SR(r)?r.map(Ly):Ly(r),d={done:!1,value:s[0]},u=ER(i&&i.length===s.length?i:CR(s),t),p=jR(u,s,{ease:Array.isArray(c)?c:AR(s,c)});return{calculatedDuration:t,next:m=>(d.value=p(m),d.done=m>=t,d)}}const DR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>_t.update(s,!0),stop:()=>Oa(s),now:()=>Qt.isProcessing?Qt.timestamp:_s.now()}},RR={decay:Oy,inertia:Oy,tween:Qc,keyframes:Qc,spring:Ix},MR=t=>t/100;class Vm extends Ex{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:i,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||$m,p=(m,g)=>this.onKeyframesResolved(m,g);this.resolver=new u(d,p,i,r,c),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(s){const{type:i="keyframes",repeat:r=0,repeatDelay:c=0,repeatType:d,velocity:u=0}=this.options,p=Mm(i)?i:RR[i]||Qc;let m,g;p!==Qc&&typeof s[0]!="number"&&(m=il(MR,Rx(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});d==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-u})),v.calculatedDuration===null&&(v.calculatedDuration=Ax(v));const{calculatedDuration:b}=v,_=b+c,k=_*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:m,calculatedDuration:b,resolvedDuration:_,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:r}=this;if(!r){const{keyframes:U}=this.options;return{done:!0,value:U[U.length-1]}}const{finalKeyframe:c,generator:d,mirroredGenerator:u,mapPercentToKeyframes:p,keyframes:m,calculatedDuration:g,totalDuration:v,resolvedDuration:b}=r;if(this.startTime===null)return d.next(0);const{delay:_,repeat:k,repeatType:S,repeatDelay:j,onUpdate:N}=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)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-_*(this.speed>=0?1:-1),C=this.speed>=0?T<0:T>v;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let E=this.currentTime,D=d;if(k){const U=Math.min(this.currentTime,v)/b;let F=Math.floor(U),ee=U%1;!ee&&U>=1&&(ee=1),ee===1&&F--,F=Math.min(F,k+1),!!(F%2)&&(S==="reverse"?(ee=1-ee,j&&(ee-=j/b)):S==="mirror"&&(D=u)),E=Xs(0,1,ee)*b}const R=C?{done:!1,value:m[0]}:D.next(E);p&&(R.value=p(R.value));let{done:L}=R;!C&&g!==null&&(L=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&L);return A&&c!==void 0&&(R.value=xd(m,this.options,c)),N&&N(R.value),A&&this.finish(),R}get duration(){const{resolved:s}=this;return s?Ys(s.calculatedDuration):0}get time(){return Ys(this.currentTime)}set time(s){s=Ks(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 i=this.playbackSpeed!==s;this.playbackSpeed=s,i&&(this.time=Ys(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=DR,onPlay:i,startTime:r}=this.options;this.driver||(this.driver=s(d=>this.tick(d))),i&&i();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 IR=new Set(["opacity","clipPath","filter","transform"]);function OR(t,s,i,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:m}={}){const g={[s]:i};m&&(g.offset=m);const v=ox(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:r,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:d+1,direction:u==="reverse"?"alternate":"normal"})}const LR=Rm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ed=10,BR=2e4;function zR(t){return Mm(t.type)||t.type==="spring"||!ix(t.ease)}function UR(t,s){const i=new Vm({...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<BR;)r=i.sample(d),c.push(r.value),d+=ed;return{times:void 0,keyframes:c,duration:d-ed,ease:"linear"}}const Lx={anticipate:fx,backInOut:ux,circInOut:mx};function $R(t){return t in Lx}class By extends Ex{constructor(s){super(s);const{name:i,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new Cx(d,(u,p)=>this.onKeyframesResolved(u,p),i,r,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:r=300,times:c,ease:d,type:u,motionValue:p,name:m,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&Wc()&&$R(d)&&(d=Lx[d]),zR(this.options)){const{onComplete:b,onUpdate:_,motionValue:k,element:S,...j}=this.options,N=UR(s,j);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=OR(p.owner.current,m,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(wy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:b}=this.options;p.set(xd(s,this.options,i)),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:i}=s;return Ys(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Ys(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:r}=i;r.currentTime=Ks(s)}get speed(){const{resolved:s}=this;if(!s)return 1;const{animation:i}=s;return i.playbackRate}set speed(s){const{resolved:i}=this;if(!i)return;const{animation:r}=i;r.playbackRate=s}get state(){const{resolved:s}=this;if(!s)return"idle";const{animation:i}=s;return i.playState}get startTime(){const{resolved:s}=this;if(!s)return null;const{animation:i}=s;return i.startTime}attachTimeline(s){if(!this._resolved)this.pendingTimeline=s;else{const{resolved:i}=this;if(!i)return An;const{animation:r}=i;wy(r,s)}return An}play(){if(this.isStopped)return;const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.playState==="finished"&&this.updateFinishedPromise(),i.play()}pause(){const{resolved:s}=this;if(!s)return;const{animation:i}=s;i.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:i,keyframes:r,duration:c,type:d,ease:u,times:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:b,element:_,...k}=this.options,S=new Vm({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),j=Ks(this.time);g.setWithVelocity(S.sample(j-ed).value,S.sample(j).value,ed)}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:i,name:r,repeatDelay:c,repeatType:d,damping:u,type:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:m,transformTemplate:g}=i.owner.getProps();return LR()&&r&&IR.has(r)&&!m&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const PR={type:"spring",stiffness:500,damping:25,restSpeed:10},VR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),HR={type:"keyframes",duration:.8},qR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},GR=(t,{keyframes:s})=>s.length>2?HR:Ti.has(t)?t.startsWith("scale")?VR(s[1]):PR:qR;function FR({when:t,delay:s,delayChildren:i,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:m,elapsed:g,...v}){return!!Object.keys(v).length}const Hm=(t,s,i,r={},c,d)=>u=>{const p=Cm(r,t)||{},m=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ks(m);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};FR(p)||(v={...v,...GR(t,v)}),v.duration&&(v.duration=Ks(v.duration)),v.repeatDelay&&(v.repeatDelay=Ks(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 _=xd(v.keyframes,p);if(_!==void 0)return _t.update(()=>{v.onUpdate(_),v.onComplete()}),new TD([])}return!d&&By.supports(v)?new By(v):new Vm(v)};function ZR({protectedKeys:t,needsAnimating:s},i){const r=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,r}function Bx(t,s,{delay:i=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...m}=s;r&&(u=r);const g=[],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),k=m[b];if(k===void 0||v&&ZR(v,b))continue;const S={delay:i,...Cm(u||{},b)};let j=!1;if(window.MotionHandoffAnimation){const T=sx(t);if(T){const C=window.MotionHandoffAnimation(T,b,_t);C!==null&&(S.startTime=C,j=!0)}}Rp(t,b),_.start(Hm(b,_,k,t.shouldReduceMotion&&tx.has(b)?{type:!1}:S,t,j));const N=_.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{_t.update(()=>{p&&_D(t,p)})}),g}function Pp(t,s,i={}){var r;const c=_d(t,s,i.type==="exit"?(r=t.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:d=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(d=i.transitionOverride);const u=c?()=>Promise.all(Bx(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:b,staggerDirection:_}=d;return KR(t,s,v+g,b,_,i)}:()=>Promise.resolve(),{when:m}=d;if(m){const[g,v]=m==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(i.delay)])}function KR(t,s,i=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,m=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(YR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(Pp(g,s,{...d,delay:i+m(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function YR(t,s){return t.sortNodePosition(s)}function JR(t,s,i={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>Pp(t,d,i));r=Promise.all(c)}else if(typeof s=="string")r=Pp(t,s,i);else{const c=typeof s=="function"?_d(t,s,i.custom):s;r=Promise.all(Bx(t,c,i))}return r.then(()=>{t.notify("AnimationComplete",s)})}const WR=gm.length;function zx(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?zx(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<WR;i++){const r=gm[i],c=t.props[r];(Zr(c)||c===!1)&&(s[r]=c)}return s}const XR=[...hm].reverse(),QR=hm.length;function e3(t){return s=>Promise.all(s.map(({animation:i,options:r})=>JR(t,i,r)))}function t3(t){let s=e3(t),i=zy(),r=!0;const c=m=>(g,v)=>{var b;const _=_d(t,v,m==="exit"?(b=t.presenceContext)===null||b===void 0?void 0:b.custom:void 0);if(_){const{transition:k,transitionEnd:S,...j}=_;g={...g,...j,...S}}return g};function d(m){s=m(t)}function u(m){const{props:g}=t,v=zx(t.parent)||{},b=[],_=new Set;let k={},S=1/0;for(let N=0;N<QR;N++){const T=XR[N],C=i[T],E=g[T]!==void 0?g[T]:v[T],D=Zr(E),R=T===m?C.isActive:null;R===!1&&(S=N);let L=E===v[T]&&E!==g[T]&&D;if(L&&r&&t.manuallyAnimateOnMount&&(L=!1),C.protectedKeys={...k},!C.isActive&&R===null||!E&&!C.prevProp||yd(E)||typeof E=="boolean")continue;const A=n3(C.prevProp,E);let U=A||T===m&&C.isActive&&!L&&D||N>S&&D,F=!1;const ee=Array.isArray(E)?E:[E];let q=ee.reduce(c(T),{});R===!1&&(q={});const{prevResolvedValues:X={}}=C,ae={...X,...q},Q=Z=>{U=!0,_.has(Z)&&(F=!0,_.delete(Z)),C.needsAnimating[Z]=!0;const se=t.getValue(Z);se&&(se.liveStyle=!1)};for(const Z in ae){const se=q[Z],ue=X[Z];if(k.hasOwnProperty(Z))continue;let de=!1;Dp(se)&&Dp(ue)?de=!ex(se,ue):de=se!==ue,de?se!=null?Q(Z):_.add(Z):se!==void 0&&_.has(Z)?Q(Z):C.protectedKeys[Z]=!0}C.prevProp=E,C.prevResolvedValues=q,C.isActive&&(k={...k,...q}),r&&t.blockInitialAnimation&&(U=!1),U&&(!(L&&A)||F)&&b.push(...ee.map(Z=>({animation:Z,options:{type:T}})))}if(_.size){const N={};_.forEach(T=>{const C=t.getBaseTarget(T),E=t.getValue(T);E&&(E.liveStyle=!0),N[T]=C??null}),b.push({animation:N})}let j=!!b.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(j=!1),r=!1,j?s(b):Promise.resolve()}function p(m,g){var v;if(i[m].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(_=>{var k;return(k=_.animationState)===null||k===void 0?void 0:k.setActive(m,g)}),i[m].isActive=g;const b=u(m);for(const _ in i)i[_].protectedKeys={};return b}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>i,reset:()=>{i=zy(),r=!0}}}function n3(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!ex(s,t):!1}function li(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function zy(){return{animate:li(!0),whileInView:li(),whileHover:li(),whileTap:li(),whileDrag:li(),whileFocus:li(),exit:li()}}class Ua{constructor(s){this.isMounted=!1,this.node=s}update(){}}class s3 extends Ua{constructor(s){super(s),s.animationState||(s.animationState=t3(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();yd(s)&&(this.unmountControls=s.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:s}=this.node.getProps(),{animate:i}=this.node.prevProps||{};s!==i&&this.updateAnimationControlsSubscription()}unmount(){var s;this.node.animationState.reset(),(s=this.unmountControls)===null||s===void 0||s.call(this)}}let a3=0;class i3 extends Ua{constructor(){super(...arguments),this.id=a3++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===r)return;const c=this.node.animationState.setActive("exit",!s);i&&!s&&c.then(()=>i(this.id))}mount(){const{register:s}=this.node.presenceContext||{};s&&(this.unmount=s(this.id))}unmount(){}}const o3={animation:{Feature:s3},exit:{Feature:i3}},rs={x:!1,y:!1};function Ux(){return rs.x||rs.y}function r3(t){return t==="x"||t==="y"?rs[t]?null:(rs[t]=!0,()=>{rs[t]=!1}):rs.x||rs.y?null:(rs.x=rs.y=!0,()=>{rs.x=rs.y=!1})}const qm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Wr(t,s,i,r={passive:!0}){return t.addEventListener(s,i,r),()=>t.removeEventListener(s,i)}function ol(t){return{point:{x:t.pageX,y:t.pageY}}}const l3=t=>s=>qm(s)&&t(s,ol(s));function Ur(t,s,i,r){return Wr(t,s,l3(i),r)}const Uy=(t,s)=>Math.abs(t-s);function c3(t,s){const i=Uy(t.x,s.x),r=Uy(t.y,s.y);return Math.sqrt(i**2+r**2)}class $x{constructor(s,i,{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=op(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,k=c3(b.offset,{x:0,y:0})>=3;if(!_&&!k)return;const{point:S}=b,{timestamp:j}=Qt;this.history.push({...S,timestamp:j});const{onStart:N,onMove:T}=this.handlers;_||(N&&N(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,_)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=ip(_,this.transformPagePoint),_t.update(this.updatePoint,!0)},this.handlePointerUp=(b,_)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:j}=this.handlers;if(this.dragSnapToOrigin&&j&&j(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=op(b.type==="pointercancel"?this.lastMoveEventInfo:ip(_,this.transformPagePoint),this.history);this.startEvent&&k&&k(b,N),S&&S(b,N)},!qm(s))return;this.dragSnapToOrigin=d,this.handlers=i,this.transformPagePoint=r,this.contextWindow=c||window;const u=ol(s),p=ip(u,this.transformPagePoint),{point:m}=p,{timestamp:g}=Qt;this.history=[{...m,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,op(p,this.history)),this.removeListeners=il(Ur(this.contextWindow,"pointermove",this.handlePointerMove),Ur(this.contextWindow,"pointerup",this.handlePointerUp),Ur(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Oa(this.updatePoint)}}function ip(t,s){return s?{point:s(t.point)}:t}function $y(t,s){return{x:t.x-s.x,y:t.y-s.y}}function op({point:t},s){return{point:t,delta:$y(t,Px(s)),offset:$y(t,d3(s)),velocity:u3(s,.1)}}function d3(t){return t[0]}function Px(t){return t[t.length-1]}function u3(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,r=null;const c=Px(t);for(;i>=0&&(r=t[i],!(c.timestamp-r.timestamp>Ks(s)));)i--;if(!r)return{x:0,y:0};const d=Ys(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 Vx=1e-4,f3=1-Vx,p3=1+Vx,Hx=.01,m3=0-Hx,h3=0+Hx;function Rn(t){return t.max-t.min}function g3(t,s,i){return Math.abs(t-s)<=i}function Py(t,s,i,r=.5){t.origin=r,t.originPoint=Tt(s.min,s.max,t.origin),t.scale=Rn(i)/Rn(s),t.translate=Tt(i.min,i.max,t.origin)-t.originPoint,(t.scale>=f3&&t.scale<=p3||isNaN(t.scale))&&(t.scale=1),(t.translate>=m3&&t.translate<=h3||isNaN(t.translate))&&(t.translate=0)}function $r(t,s,i,r){Py(t.x,s.x,i.x,r?r.originX:void 0),Py(t.y,s.y,i.y,r?r.originY:void 0)}function Vy(t,s,i){t.min=i.min+s.min,t.max=t.min+Rn(s)}function v3(t,s,i){Vy(t.x,s.x,i.x),Vy(t.y,s.y,i.y)}function Hy(t,s,i){t.min=s.min-i.min,t.max=t.min+Rn(s)}function Pr(t,s,i){Hy(t.x,s.x,i.x),Hy(t.y,s.y,i.y)}function y3(t,{min:s,max:i},r){return s!==void 0&&t<s?t=r?Tt(s,t,r.min):Math.max(t,s):i!==void 0&&t>i&&(t=r?Tt(i,t,r.max):Math.min(t,i)),t}function qy(t,s,i){return{min:s!==void 0?t.min+s:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function b3(t,{top:s,left:i,bottom:r,right:c}){return{x:qy(t.x,i,c),y:qy(t.y,s,r)}}function Gy(t,s){let i=s.min-t.min,r=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,r]=[r,i]),{min:i,max:r}}function _3(t,s){return{x:Gy(t.x,s.x),y:Gy(t.y,s.y)}}function x3(t,s){let i=.5;const r=Rn(t),c=Rn(s);return c>r?i=No(s.min,s.max-r,t.min):r>c&&(i=No(t.min,t.max-c,s.min)),Xs(0,1,i)}function k3(t,s){const i={};return s.min!==void 0&&(i.min=s.min-t.min),s.max!==void 0&&(i.max=s.max-t.min),i}const Vp=.35;function S3(t=Vp){return t===!1?t=0:t===!0&&(t=Vp),{x:Fy(t,"left","right"),y:Fy(t,"top","bottom")}}function Fy(t,s,i){return{min:Zy(t,s),max:Zy(t,i)}}function Zy(t,s){return typeof t=="number"?t:t[s]||0}const Ky=()=>({translate:0,scale:1,origin:0,originPoint:0}),bo=()=>({x:Ky(),y:Ky()}),Yy=()=>({min:0,max:0}),Mt=()=>({x:Yy(),y:Yy()});function Kn(t){return[t("x"),t("y")]}function qx({top:t,left:s,right:i,bottom:r}){return{x:{min:s,max:i},y:{min:t,max:r}}}function T3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function w3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),r=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:r.y,right:r.x}}function rp(t){return t===void 0||t===1}function Hp({scale:t,scaleX:s,scaleY:i}){return!rp(t)||!rp(s)||!rp(i)}function pi(t){return Hp(t)||Gx(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function Gx(t){return Jy(t.x)||Jy(t.y)}function Jy(t){return t&&t!=="0%"}function td(t,s,i){const r=t-i,c=s*r;return i+c}function Wy(t,s,i,r,c){return c!==void 0&&(t=td(t,c,r)),td(t,i,r)+s}function qp(t,s=0,i=1,r,c){t.min=Wy(t.min,s,i,r,c),t.max=Wy(t.max,s,i,r,c)}function Fx(t,{x:s,y:i}){qp(t.x,s.translate,s.scale,s.originPoint),qp(t.y,i.translate,i.scale,i.originPoint)}const Xy=.999999999999,Qy=1.0000000000001;function j3(t,s,i,r=!1){const c=i.length;if(!c)return;s.x=s.y=1;let d,u;for(let p=0;p<c;p++){d=i[p],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&&xo(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,Fx(t,u)),r&&pi(d.latestValues)&&xo(t,d.latestValues))}s.x<Qy&&s.x>Xy&&(s.x=1),s.y<Qy&&s.y>Xy&&(s.y=1)}function _o(t,s){t.min=t.min+s,t.max=t.max+s}function eb(t,s,i,r,c=.5){const d=Tt(t.min,t.max,c);qp(t,s,i,d,r)}function xo(t,s){eb(t.x,s.x,s.scaleX,s.scale,s.originX),eb(t.y,s.y,s.scaleY,s.scale,s.originY)}function Zx(t,s){return qx(w3(t.getBoundingClientRect(),s))}function N3(t,s,i){const r=Zx(t,i),{scroll:c}=s;return c&&(_o(r.x,c.offset.x),_o(r.y,c.offset.y)),r}const Kx=({current:t})=>t?t.ownerDocument.defaultView:null,C3=new WeakMap;class E3{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=Mt(),this.visualElement=s}start(s,{snapToCursor:i=!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(),i&&this.snapToCursor(ol(v).point)},d=(v,b)=>{const{drag:_,dragPropagation:k,onDragStart:S}=this.getProps();if(_&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=r3(_),!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),Kn(N=>{let T=this.getAxisMotionValue(N).get()||0;if(bs.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const E=C.layout.layoutBox[N];E&&(T=Rn(E)*(parseFloat(T)/100))}}this.originPoint[N]=T}),S&&_t.postRender(()=>S(v,b)),Rp(this.visualElement,"transform");const{animationState:j}=this.visualElement;j&&j.setActive("whileDrag",!0)},u=(v,b)=>{const{dragPropagation:_,dragDirectionLock:k,onDirectionLock:S,onDrag:j}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:N}=b;if(k&&this.currentDirection===null){this.currentDirection=A3(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),j&&j(v,b)},p=(v,b)=>this.stop(v,b),m=()=>Kn(v=>{var b;return this.getAnimationState(v)==="paused"&&((b=this.getAxisMotionValue(v).animation)===null||b===void 0?void 0:b.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new $x(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:Kx(this.visualElement)})}stop(s,i){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:d}=this.getProps();d&&_t.postRender(()=>d(s,i))}cancel(){this.isDragging=!1;const{projection:s,animationState:i}=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),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,r){const{drag:c}=this.getProps();if(!r||!Ac(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=y3(u,this.constraints[s],this.elastic[s])),d.set(u)}resolveConstraints(){var s;const{dragConstraints:i,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;i&&vo(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=b3(c.layoutBox,i):this.constraints=!1,this.elastic=S3(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Kn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=k3(c.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!vo(s))return!1;const r=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const d=N3(r,c.root,this.visualElement.getTransformPagePoint());let u=_3(c.layout.layoutBox,d);if(i){const p=i(T3(u));this.hasMutatedConstraints=!!p,p&&(u=qx(p))}return u}startAnimation(s){const{drag:i,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),m=this.constraints||{},g=Kn(v=>{if(!Ac(v,i,this.currentDirection))return;let b=m&&m[v]||{};u&&(b={min:0,max:0});const _=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:_,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...d,...b};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const r=this.getAxisMotionValue(s);return Rp(this.visualElement,s),r.start(Hm(s,r,0,i,this.visualElement,!1))}stopAnimation(){Kn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Kn(s=>{var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(s){var i;return(i=this.getAxisMotionValue(s).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(s){const i=`_drag${s.toUpperCase()}`,r=this.visualElement.getProps(),c=r[i];return c||this.visualElement.getValue(s,(r.initial?r.initial[s]:void 0)||0)}snapToCursor(s){Kn(i=>{const{drag:r}=this.getProps();if(!Ac(i,r,this.currentDirection))return;const{projection:c}=this.visualElement,d=this.getAxisMotionValue(i);if(c&&c.layout){const{min:u,max:p}=c.layout.layoutBox[i];d.set(s[i]-Tt(u,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:r}=this.visualElement;if(!vo(i)||!r||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};Kn(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const m=p.get();c[u]=x3({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(),Kn(u=>{if(!Ac(u,s,null))return;const p=this.getAxisMotionValue(u),{min:m,max:g}=this.constraints[u];p.set(Tt(m,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;C3.set(this.visualElement,this);const s=this.visualElement.current,i=Ur(s,"pointerdown",m=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(m)}),r=()=>{const{dragConstraints:m}=this.getProps();vo(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()),_t.read(r);const u=Wr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:m,hasLayoutChanged:g})=>{this.isDragging&&g&&(Kn(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(),i(),d(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:r=!1,dragPropagation:c=!1,dragConstraints:d=!1,dragElastic:u=Vp,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Ac(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function A3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class D3 extends Ua{constructor(s){super(s),this.removeGroupControls=An,this.removeListeners=An,this.controls=new E3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||An}unmount(){this.removeGroupControls(),this.removeListeners()}}const tb=t=>(s,i)=>{t&&_t.postRender(()=>t(s,i))};class R3 extends Ua{constructor(){super(...arguments),this.removePointerDownListener=An}onPointerDown(s){this.session=new $x(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Kx(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:tb(s),onStart:tb(i),onMove:r,onEnd:(d,u)=>{delete this.session,c&&_t.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Ur(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 qc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function nb(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Nr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ce.test(t))t=parseFloat(t);else return t;const i=nb(t,s.target.x),r=nb(t,s.target.y);return`${i}% ${r}%`}},M3={correct:(t,{treeScale:s,projectionDelta:i})=>{const r=t,c=La.parse(t);if(c.length>5)return r;const d=La.createTransformer(t),u=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,m=i.y.scale*s.y;c[0+u]/=p,c[1+u]/=m;const g=Tt(p,m,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class I3 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;oD(O3),d&&(i.group&&i.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()})),qc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:r,drag:c,isPresent:d}=this.props,u=r.projection;return u&&(u.isPresent=d,c||s.layoutDependency!==i||i===void 0?u.willUpdate():this.safeToRemove(),s.isPresent!==d&&(d?u.promote():u.relegate()||_t.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),ym.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),r&&r.deregister&&r.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function Yx(t){const[s,i]=M_(),r=y.useContext(um);return o.jsx(I3,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(P_),isPresent:s,safeToRemove:i})}const O3={borderRadius:{...Nr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Nr,borderTopRightRadius:Nr,borderBottomLeftRadius:Nr,borderBottomRightRadius:Nr,boxShadow:M3};function L3(t,s,i){const r=an(t)?t:Yr(t);return r.start(Hm("",r,s,i)),r.animation}function B3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const z3=(t,s)=>t.depth-s.depth;class U3{constructor(){this.children=[],this.isDirty=!1}add(s){Em(this.children,s),this.isDirty=!0}remove(s){Am(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(z3),this.isDirty=!1,this.children.forEach(s)}}function $3(t,s){const i=_s.now(),r=({timestamp:c})=>{const d=c-i;d>=s&&(Oa(r),t(d-s))};return _t.read(r,!0),()=>Oa(r)}const Jx=["TopLeft","TopRight","BottomLeft","BottomRight"],P3=Jx.length,sb=t=>typeof t=="string"?parseFloat(t):t,ab=t=>typeof t=="number"||Ce.test(t);function V3(t,s,i,r,c,d){c?(t.opacity=Tt(0,i.opacity!==void 0?i.opacity:1,H3(r)),t.opacityExit=Tt(s.opacity!==void 0?s.opacity:1,0,q3(r))):d&&(t.opacity=Tt(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,r));for(let u=0;u<P3;u++){const p=`border${Jx[u]}Radius`;let m=ib(s,p),g=ib(i,p);if(m===void 0&&g===void 0)continue;m||(m=0),g||(g=0),m===0||g===0||ab(m)===ab(g)?(t[p]=Math.max(Tt(sb(m),sb(g),r),0),(bs.test(g)||bs.test(m))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=Tt(s.rotate||0,i.rotate||0,r))}function ib(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const H3=Wx(0,.5,px),q3=Wx(.5,.95,An);function Wx(t,s,i){return r=>r<t?0:r>s?1:i(No(t,s,r))}function ob(t,s){t.min=s.min,t.max=s.max}function Gn(t,s){ob(t.x,s.x),ob(t.y,s.y)}function rb(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function lb(t,s,i,r,c){return t-=s,t=td(t,1/i,r),c!==void 0&&(t=td(t,1/c,r)),t}function G3(t,s=0,i=1,r=.5,c,d=t,u=t){if(bs.test(s)&&(s=parseFloat(s),s=Tt(u.min,u.max,s/100)-u.min),typeof s!="number")return;let p=Tt(d.min,d.max,r);t===d&&(p-=s),t.min=lb(t.min,s,i,p,c),t.max=lb(t.max,s,i,p,c)}function cb(t,s,[i,r,c],d,u){G3(t,s[i],s[r],s[c],s.scale,d,u)}const F3=["x","scaleX","originX"],Z3=["y","scaleY","originY"];function db(t,s,i,r){cb(t.x,s,F3,i?i.x:void 0,r?r.x:void 0),cb(t.y,s,Z3,i?i.y:void 0,r?r.y:void 0)}function ub(t){return t.translate===0&&t.scale===1}function Xx(t){return ub(t.x)&&ub(t.y)}function fb(t,s){return t.min===s.min&&t.max===s.max}function K3(t,s){return fb(t.x,s.x)&&fb(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 Qx(t,s){return pb(t.x,s.x)&&pb(t.y,s.y)}function mb(t){return Rn(t.x)/Rn(t.y)}function hb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class Y3{constructor(){this.members=[]}add(s){Em(this.members,s),s.scheduleRender()}remove(s){if(Am(this.members,s),s===this.prevLead&&(this.prevLead=void 0),s===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(s){const i=this.members.findIndex(c=>s===c);if(i===0)return!1;let r;for(let c=i;c>=0;c--){const d=this.members[c];if(d.isPresent!==!1){r=d;break}}return r?(this.promote(r),!0):!1}promote(s,i){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,i&&(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:i,resumingFrom:r}=s;i.onExitComplete&&i.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 J3(t,s,i){let r="";const c=t.x.translate/s.x,d=t.y.translate/s.y,u=(i==null?void 0:i.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}) `),i){const{transformPerspective:g,rotate:v,rotateX:b,rotateY:_,skewX:k,skewY:S}=i;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),b&&(r+=`rotateX(${b}deg) `),_&&(r+=`rotateY(${_}deg) `),k&&(r+=`skewX(${k}deg) `),S&&(r+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,m=t.y.scale*s.y;return(p!==1||m!==1)&&(r+=`scale(${p}, ${m})`),r||"none"}const mi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Ir=typeof window<"u"&&window.MotionDebug!==void 0,lp=["","X","Y","Z"],W3={visibility:"hidden"},gb=1e3;let X3=0;function cp(t,s,i,r){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function e1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=sx(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",_t,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&e1(r)}function t1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=X3++,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,Ir&&(mi.totalNodes=mi.resolvedTargetDeltas=mi.recalculatedProjection=0),this.nodes.forEach(tM),this.nodes.forEach(oM),this.nodes.forEach(rM),this.nodes.forEach(nM),Ir&&window.MotionDebug.record(mi)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=p?p.root||p:this,this.path=p?[...p.path,p]:[],this.parent=p,this.depth=p?p.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,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Dm),this.eventHandlers.get(u).add(p)}notifyListeners(u,...p){const m=this.eventHandlers.get(u);m&&m.notify(...p)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=B3(u),this.instance=u;const{layoutId:m,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||m)&&(this.isLayoutDirty=!0),t){let b;const _=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,b&&b(),b=$3(_,250),qc.hasAnimatedSinceResize&&(qc.hasAnimatedSinceResize=!1,this.nodes.forEach(yb))})}m&&this.root.registerSharedNode(m,this),this.options.animate!==!1&&v&&(m||g)&&this.addEventListener("didUpdate",({delta:b,hasLayoutChanged:_,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||v.getDefaultTransition()||fM,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!Qx(this.targetLayout,S)||k,E=!_&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(b,E);const D={...Cm(j,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(D.delay=0,D.type=!1),this.startAnimation(D)}else _||yb(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,Oa(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(lM),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&&e1(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:p,layout:m}=this.options;if(p===void 0&&!m)return;const g=this.getTransformTemplate();this.prevTransformTemplateValue=g?g(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(vb);return}this.isUpdating||this.nodes.forEach(aM),this.isUpdating=!1,this.nodes.forEach(iM),this.nodes.forEach(Q3),this.nodes.forEach(eM),this.clearAllSnapshots();const p=_s.now();Qt.delta=Xs(0,1e3/60,p-Qt.timestamp),Qt.timestamp=p,Qt.isProcessing=!0,ep.update.process(Qt),ep.preRender.process(Qt),ep.render.process(Qt),Qt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ym.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(sM),this.sharedNodes.forEach(cM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,_t.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){_t.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=Mt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:p}=this.options;p&&p.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(p=!1),p){const m=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!Xx(this.projectionDelta),m=this.getTransformTemplate(),g=m?m(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;u&&(p||pi(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const p=this.measurePageBox();let m=this.removeElementScroll(p);return u&&(m=this.removeTransform(m)),pM(m),{animationId:this.root.animationId,measuredBox:p,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Mt();const m=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(mM))){const{scroll:v}=this.root;v&&(_o(m.x,v.offset.x),_o(m.y,v.offset.y))}return m}removeElementScroll(u){var p;const m=Mt();if(Gn(m,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return m;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:b,options:_}=v;v!==this.root&&b&&_.layoutScroll&&(b.wasRoot&&Gn(m,u),_o(m.x,b.offset.x),_o(m.y,b.offset.y))}return m}applyTransform(u,p=!1){const m=Mt();Gn(m,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&xo(m,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),pi(v.latestValues)&&xo(m,v.latestValues)}return pi(this.latestValues)&&xo(m,this.latestValues),m}removeTransform(u){const p=Mt();Gn(p,u);for(let m=0;m<this.path.length;m++){const g=this.path[m];if(!g.instance||!pi(g.latestValues))continue;Hp(g.latestValues)&&g.updateSnapshot();const v=Mt(),b=g.measurePageBox();Gn(v,b),db(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return pi(this.latestValues)&&db(p,this.latestValues),p}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!==Qt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var p;const m=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=m.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=m.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=m.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==m;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:b,layoutId:_}=this.options;if(!(!this.layout||!(b||_))){if(this.resolvedRelativeTargetAt=Qt.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Mt(),this.relativeTargetOrigin=Mt(),Pr(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Gn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Mt(),this.targetWithTransforms=Mt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),v3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Gn(this.target,this.layout.layoutBox),Fx(this.target,this.targetDelta)):Gn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const k=this.getClosestProjectingParent();k&&!!k.resumingFrom==!!this.resumingFrom&&!k.options.layoutScroll&&k.target&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Mt(),this.relativeTargetOrigin=Mt(),Pr(this.relativeTargetOrigin,this.target,k.target),Gn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Ir&&mi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Hp(this.parent.latestValues)||Gx(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 p=this.getLead(),m=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),m&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Qt.timestamp&&(g=!1),g)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;Gn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,k=this.treeScale.y;j3(this.layoutCorrected,this.treeScale,this.path,m),p.layout&&!p.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(p.target=p.layout.layoutBox,p.targetWithTransforms=Mt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(rb(this.prevProjectionDelta.x,this.projectionDelta.x),rb(this.prevProjectionDelta.y,this.projectionDelta.y)),$r(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==k||!hb(this.projectionDelta.x,this.prevProjectionDelta.x)||!hb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Ir&&mi.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=bo(),this.projectionDelta=bo(),this.projectionDeltaWithTransform=bo()}setAnimationOrigin(u,p=!1){const m=this.snapshot,g=m?m.latestValues:{},v={...this.latestValues},b=bo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Mt(),k=m?m.source:void 0,S=this.layout?this.layout.source:void 0,j=k!==S,N=this.getStack(),T=!N||N.members.length<=1,C=!!(j&&!T&&this.options.crossfade===!0&&!this.path.some(uM));this.animationProgress=0;let E;this.mixTargetDelta=D=>{const R=D/1e3;bb(b.x,u.x,R),bb(b.y,u.y,R),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Pr(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),dM(this.relativeTarget,this.relativeTargetOrigin,_,R),E&&K3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Mt()),Gn(E,this.relativeTarget)),j&&(this.animationValues=v,V3(v,g,this.latestValues,R,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},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&&(Oa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=_t.update(()=>{qc.hasAnimatedSinceResize=!0,this.currentAnimation=L3(0,gb,{...u,onUpdate:p=>{this.mixTargetDelta(p),u.onUpdate&&u.onUpdate(p)},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(gb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:p,target:m,layout:g,latestValues:v}=u;if(!(!p||!m||!g)){if(this!==u&&this.layout&&g&&n1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){m=this.target||Mt();const b=Rn(this.layout.layoutBox.x);m.x.min=u.target.x.min,m.x.max=m.x.min+b;const _=Rn(this.layout.layoutBox.y);m.y.min=u.target.y.min,m.y.max=m.y.min+_}Gn(p,m),xo(p,v),$r(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Y3),this.sharedNodes.get(u).add(p);const g=p.options.initialPromotionConfig;p.promote({transition:g?g.transition:void 0,preserveFollowOpacity:g&&g.shouldPreserveFollowOpacity?g.shouldPreserveFollowOpacity(p):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var u;const{layoutId:p}=this.options;return p?((u=this.getStack())===null||u===void 0?void 0:u.lead)||this:this}getPrevLead(){var u;const{layoutId:p}=this.options;return p?(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:p,preserveFollowOpacity:m}={}){const g=this.getStack();g&&g.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let p=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(p=!0),!p)return;const g={};m.z&&cp("z",u,g,this.animationValues);for(let v=0;v<lp.length;v++)cp(`rotate${lp[v]}`,u,g,this.animationValues),cp(`skew${lp[v]}`,u,g,this.animationValues);u.render();for(const v in g)u.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);u.scheduleRender()}getProjectionStyles(u){var p,m;if(!this.instance||this.isSVG)return;if(!this.isVisible)return W3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Vc(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;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=Vc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!pi(this.latestValues)&&(j.transform=v?v({},""):"none",this.hasProjected=!1),j}const _=b.animationValues||b.latestValues;this.applyTransformsToTarget(),g.transform=J3(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,b.animationValues?g.opacity=b===this?(m=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&m!==void 0?m:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=b===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const j in Jc){if(_[j]===void 0)continue;const{correct:N,applyTo:T}=Jc[j],C=g.transform==="none"?_[j]:N(_[j],b);if(T){const E=T.length;for(let D=0;D<E;D++)g[T[D]]=C}else g[j]=C}return this.options.layoutId&&(g.pointerEvents=b===this?Vc(u==null?void 0:u.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var p;return(p=u.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(vb),this.root.sharedNodes.clear()}}}function Q3(t){t.updateLayout()}function eM(t){var s;const i=((s=t.resumeFrom)===null||s===void 0?void 0:s.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:c}=t.layout,{animationType:d}=t.options,u=i.source!==t.layout.source;d==="size"?Kn(b=>{const _=u?i.measuredBox[b]:i.layoutBox[b],k=Rn(_);_.min=r[b].min,_.max=_.min+k}):n1(d,i.layoutBox,r)&&Kn(b=>{const _=u?i.measuredBox[b]:i.layoutBox[b],k=Rn(r[b]);_.max=_.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[b].max=t.relativeTarget[b].min+k)});const p=bo();$r(p,r,i.layoutBox);const m=bo();u?$r(m,t.applyTransform(c,!0),i.measuredBox):$r(m,r,i.layoutBox);const g=!Xx(p);let v=!1;if(!t.resumeFrom){const b=t.getClosestProjectingParent();if(b&&!b.resumeFrom){const{snapshot:_,layout:k}=b;if(_&&k){const S=Mt();Pr(S,i.layoutBox,_.layoutBox);const j=Mt();Pr(j,r,k.layoutBox),Qx(S,j)||(v=!0),b.options.layoutRoot&&(t.relativeTarget=j,t.relativeTargetOrigin=S,t.relativeParent=b)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:i,delta:m,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function tM(t){Ir&&mi.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 nM(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function sM(t){t.clearSnapshot()}function vb(t){t.clearMeasurements()}function aM(t){t.isLayoutDirty=!1}function iM(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function yb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function oM(t){t.resolveTargetDelta()}function rM(t){t.calcProjection()}function lM(t){t.resetSkewAndRotation()}function cM(t){t.removeLeadSnapshot()}function bb(t,s,i){t.translate=Tt(s.translate,0,i),t.scale=Tt(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function _b(t,s,i,r){t.min=Tt(s.min,i.min,r),t.max=Tt(s.max,i.max,r)}function dM(t,s,i,r){_b(t.x,s.x,i.x,r),_b(t.y,s.y,i.y,r)}function uM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const fM={duration:.45,ease:[.4,0,.1,1]},xb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),kb=xb("applewebkit/")&&!xb("chrome/")?Math.round:An;function Sb(t){t.min=kb(t.min),t.max=kb(t.max)}function pM(t){Sb(t.x),Sb(t.y)}function n1(t,s,i){return t==="position"||t==="preserve-aspect"&&!g3(mb(s),mb(i),.2)}function mM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const hM=t1({attachResizeListener:(t,s)=>Wr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),dp={current:void 0},s1=t1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!dp.current){const t=new hM({});t.mount(window),t.setOptions({layoutScroll:!0}),dp.current=t}return dp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),gM={pan:{Feature:R3},drag:{Feature:D3,ProjectionNode:s1,MeasureLayout:Yx}};function vM(t,s,i){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 a1(t,s){const i=vM(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[i,c,()=>r.abort()]}function Tb(t){return s=>{s.pointerType==="touch"||Ux()||t(s)}}function yM(t,s,i={}){const[r,c,d]=a1(t,i),u=Tb(p=>{const{target:m}=p,g=s(p);if(typeof g!="function"||!m)return;const v=Tb(b=>{g(b),m.removeEventListener("pointerleave",v)});m.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function wb(t,s,i){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,d=r[c];d&&_t.postRender(()=>d(s,ol(s)))}class bM extends Ua{mount(){const{current:s}=this.node;s&&(this.unmount=yM(s,i=>(wb(this.node,i,"Start"),r=>wb(this.node,r,"End"))))}unmount(){}}class _M extends Ua{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=il(Wr(this.node.current,"focus",()=>this.onFocus()),Wr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const i1=(t,s)=>s?t===s?!0:i1(t,s.parentElement):!1,xM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function kM(t){return xM.has(t.tagName)||t.tabIndex!==-1}const Or=new WeakSet;function jb(t){return s=>{s.key==="Enter"&&t(s)}}function up(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const SM=(t,s)=>{const i=t.currentTarget;if(!i)return;const r=jb(()=>{if(Or.has(i))return;up(i,"down");const c=jb(()=>{up(i,"up")}),d=()=>up(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",d,s)});i.addEventListener("keydown",r,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",r),s)};function Nb(t){return qm(t)&&!Ux()}function TM(t,s,i={}){const[r,c,d]=a1(t,i),u=p=>{const m=p.currentTarget;if(!Nb(p)||Or.has(m))return;Or.add(m);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",_),!(!Nb(k)||!Or.has(m))&&(Or.delete(m),typeof g=="function"&&g(k,{success:S}))},b=k=>{v(k,i.useGlobalTarget||i1(m,k.target))},_=k=>{v(k,!1)};window.addEventListener("pointerup",b,c),window.addEventListener("pointercancel",_,c)};return r.forEach(p=>{!kM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>SM(g,c),c)}),d}function Cb(t,s,i){const{props:r}=t;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),d=r[c];d&&_t.postRender(()=>d(s,ol(s)))}class wM extends Ua{mount(){const{current:s}=this.node;s&&(this.unmount=TM(s,i=>(Cb(this.node,i,"Start"),(r,{success:c})=>Cb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Gp=new WeakMap,fp=new WeakMap,jM=t=>{const s=Gp.get(t.target);s&&s(t)},NM=t=>{t.forEach(jM)};function CM({root:t,...s}){const i=t||document;fp.has(i)||fp.set(i,{});const r=fp.get(i),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(NM,{root:t,...s})),r[c]}function EM(t,s,i){const r=CM(s);return Gp.set(t,i),r.observe(t),()=>{Gp.delete(t),r.unobserve(t)}}const AM={some:0,all:1};class DM extends Ua{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:r,amount:c="some",once:d}=s,u={root:i?i.current:void 0,rootMargin:r,threshold:typeof c=="number"?c:AM[c]},p=m=>{const{isIntersecting:g}=m;if(this.isInView===g||(this.isInView=g,d&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:b}=this.node.getProps(),_=g?v:b;_&&_(m)};return EM(this.node.current,u,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(RM(s,i))&&this.startObserver()}unmount(){}}function RM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const MM={inView:{Feature:DM},tap:{Feature:wM},focus:{Feature:_M},hover:{Feature:bM}},IM={layout:{ProjectionNode:s1,MeasureLayout:Yx}},nd={current:null},Gm={current:!1};function o1(){if(Gm.current=!0,!!mm)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>nd.current=t.matches;t.addListener(s),s()}else nd.current=!1}const OM=[...Nx,sn,La],LM=t=>OM.find(jx(t)),Eb=new WeakMap;function BM(t,s,i){for(const r in s){const c=s[r],d=i[r];if(an(c))t.addValue(r,c);else if(an(d))t.addValue(r,Yr(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,Yr(u!==void 0?u:c,{owner:t}))}}for(const r in i)s[r]===void 0&&t.removeValue(r);return s}const Ab=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class zM{scrapeMotionValuesFromProps(s,i,r){return{}}constructor({parent:s,props:i,presenceContext:r,reducedMotionConfig:c,blockInitialAnimation:d,visualState:u},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=$m,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 k=_s.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,_t.render(this.render,!1,!0))};const{latestValues:m,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=m,this.baseTarget={...m},this.initialValues=i.initial?{...m}:{},this.renderState=g,this.parent=s,this.props=i,this.presenceContext=r,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!d,this.isControllingVariants=bd(i),this.isVariantNode=U_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:b,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in _){const S=_[k];m[k]!==void 0&&an(S)&&S.set(m[k],!1)}}mount(s){this.current=s,Eb.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((i,r)=>this.bindToMotionValue(r,i)),Gm.current||o1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:nd.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Eb.delete(this.current),this.projection&&this.projection.unmount(),Oa(this.notifyUpdate),Oa(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 i=this.features[s];i&&(i.unmount(),i.isMounted=!1)}this.current=null}bindToMotionValue(s,i){this.valueSubscriptions.has(s)&&this.valueSubscriptions.get(s)();const r=Ti.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&_t.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),d=i.on("renderRequest",this.scheduleRender);let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),d(),u&&u(),i.owner&&i.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 jo){const i=jo[s];if(!i)continue;const{isEnabled:r,Feature:c}=i;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):Mt()}getStaticValue(s){return this.latestValues[s]}setStaticValue(s,i){this.latestValues[s]=i}update(s,i){(s.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=s,this.prevPresenceContext=this.presenceContext,this.presenceContext=i;for(let r=0;r<Ab.length;r++){const c=Ab[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=BM(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 i=this.getClosestVariantNode();if(i)return i.variantChildren&&i.variantChildren.add(s),()=>i.variantChildren.delete(s)}addValue(s,i){const r=this.values.get(s);i!==r&&(r&&this.removeValue(s),this.bindToMotionValue(s,i),this.values.set(s,i),this.latestValues[s]=i.get())}removeValue(s){this.values.delete(s);const i=this.valueSubscriptions.get(s);i&&(i(),this.valueSubscriptions.delete(s)),delete this.latestValues[s],this.removeValueFromRenderState(s,this.renderState)}hasValue(s){return this.values.has(s)}getValue(s,i){if(this.props.values&&this.props.values[s])return this.props.values[s];let r=this.values.get(s);return r===void 0&&i!==void 0&&(r=Yr(i===null?void 0:i,{owner:this}),this.addValue(s,r)),r}readValue(s,i){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"&&(Tx(c)||hx(c))?c=parseFloat(c):!LM(c)&&La.test(i)&&(c=xx(s,i)),this.setBaseTarget(s,an(c)?c.get():c)),an(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:r}=this.props;let c;if(typeof r=="string"||typeof r=="object"){const u=_m(this.props,r,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);u&&(c=u[s])}if(r&&c!==void 0)return c;const d=this.getBaseTargetFromProps(this.props,s);return d!==void 0&&!an(d)?d:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new Dm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class r1 extends zM{constructor(){super(...arguments),this.KeyframeResolver=Cx}sortInstanceNodePosition(s,i){return s.compareDocumentPosition(i)&2?1:-1}getBaseTargetFromProps(s,i){return s.style?s.style[i]:void 0}removeValueFromRenderState(s,{vars:i,style:r}){delete i[s],delete r[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;an(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function UM(t){return window.getComputedStyle(t)}class $M extends r1{constructor(){super(...arguments),this.type="html",this.renderInstance=K_}readValueFromInstance(s,i){if(Ti.has(i)){const r=Um(i);return r&&r.default||0}else{const r=UM(s),c=(G_(i)?r.getPropertyValue(i):r[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return Zx(s,i)}build(s,i,r){Sm(s,i,r.transformTemplate)}scrapeMotionValuesFromProps(s,i,r){return Nm(s,i,r)}}class PM extends r1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Mt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(Ti.has(i)){const r=Um(i);return r&&r.default||0}return i=Y_.has(i)?i:vm(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,r){return X_(s,i,r)}build(s,i,r){Tm(s,i,this.isSVGTag,r.transformTemplate)}renderInstance(s,i,r,c){J_(s,i,r,c)}mount(s){this.isSVGTag=jm(s.tagName),super.mount(s)}}const VM=(t,s)=>bm(t)?new PM(s):new $M(s,{allowProjection:t!==y.Fragment}),HM=hD({...o3,...MM,...gM,...IM},VM),Et=AA(HM);function qM(){!Gm.current&&o1();const[t]=y.useState(nd.current);return t}const GM="_overlay_cmicx_1",FM="_dialog_cmicx_11",ZM="_title_cmicx_30",KM="_description_cmicx_38",YM="_actions_cmicx_45",JM="_cancelButton_cmicx_52",WM="_confirmButton_cmicx_79",ci={overlay:GM,dialog:FM,title:ZM,description:KM,actions:YM,cancelButton:JM,confirmButton:WM};function _i({isOpen:t,title:s,description:i,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return o.jsx(cs,{children:t&&o.jsx(Et.div,{className:ci.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":i?p:void 0,children:o.jsxs(Et.div,{className:ci.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:[o.jsx("h3",{id:u,className:ci.title,children:s}),i&&o.jsx("p",{id:p,className:ci.description,children:i}),o.jsxs("div",{className:ci.actions,children:[o.jsx("button",{type:"button",className:ci.cancelButton,onClick:d,autoFocus:!0,children:"Cancel"}),o.jsx("button",{type:"button",className:ci.confirmButton,onClick:c,children:r})]})]})})})}const XM="_skeleton_1gqp4_9",QM="_circular_1gqp4_17",e6="_textContainer_1gqp4_26",t6="_card_1gqp4_31",sd={skeleton:XM,circular:QM,textContainer:e6,card:t6};function xe({width:t="100%",height:s="1rem",borderRadius:i,variant:r="rectangular",className:c}){const d=[sd.skeleton,r==="circular"?sd.circular:"",c??""].filter(Boolean).join(" ");return o.jsx("div",{className:d,style:{width:t,height:s,...i&&r!=="circular"?{borderRadius:i}:{}},"aria-hidden":"true","data-testid":"skeleton"})}function Fp({lines:t=3,lastLineWidth:s="60%",lineHeight:i="0.75rem",gap:r="var(--space-sm)",className:c}){return o.jsx("div",{className:`${sd.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>o.jsx(xe,{width:u===t-1&&t>1?s:"100%",height:i},u))})}function ad({lines:t=2,className:s}){return o.jsxs("div",{className:`${sd.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[o.jsx(xe,{width:"40%",height:"1.25rem"}),o.jsx(Fp,{lines:t})]})}const n6="_spinner_1uyt1_1",s6="_spin_1uyt1_1",a6="_sm_1uyt1_14",i6="_md_1uyt1_20",o6="_lg_1uyt1_26",r6="_xl_1uyt1_32",Db={spinner:n6,spin:s6,sm:a6,md:i6,lg:o6,xl:r6};function l1({size:t="md",className:s,label:i="Loading",liveRegion:r=!1}){return o.jsx("span",{className:`${Db.spinner} ${Db[t]} ${s??""}`,role:r?"status":void 0,"aria-label":i,"aria-hidden":r?void 0:!0})}const l6="_splash_1bn1g_1",c6="_logo_1bn1g_11",Rb={splash:l6,logo:c6};function c1(){return o.jsxs("div",{className:Rb.splash,"data-testid":"splash-screen",children:[o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Rb.logo}),o.jsx(l1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const d6="_wrapper_4e5yt_1",u6="_wrapperBlock_4e5yt_6",f6="_tooltip_4e5yt_11",p6="_visible_4e5yt_31",m6="_top_4e5yt_41",h6="_bottom_4e5yt_48",g6="_left_4e5yt_55",v6="_right_4e5yt_62",Cr={wrapper:d6,wrapperBlock:u6,tooltip:f6,visible:p6,top:m6,bottom:h6,left:g6,right:v6},y6=300,Dc=6;function Eo({text:t,placement:s="top",delayMs:i=y6,inline:r=!0,children:c,className:d,"data-testid":u}){const[p,m]=y.useState(!1),[g,v]=y.useState({top:0,left:0}),b=y.useRef(null),_=y.useRef(null),k=y.useRef(void 0),S=y.useId(),j=typeof document<"u",N=y.useCallback(()=>{if(!b.current||!_.current)return;const F=b.current.getBoundingClientRect(),ee=_.current.getBoundingClientRect();let q=0,X=0;switch(s){case"top":q=F.top-ee.height-Dc,X=F.left+F.width/2-ee.width/2;break;case"bottom":q=F.bottom+Dc,X=F.left+F.width/2-ee.width/2;break;case"left":q=F.top+F.height/2-ee.height/2,X=F.left-ee.width-Dc;break;case"right":q=F.top+F.height/2-ee.height/2,X=F.right+Dc;break}v({top:q,left:X})},[s]),T=y.useCallback(F=>{k.current!==void 0&&clearTimeout(k.current),k.current=setTimeout(()=>{N(),m(!0),k.current=void 0},F)},[N]),C=y.useCallback(()=>{T(i)},[i,T]),E=y.useCallback(()=>{T(0)},[T]),D=y.useCallback(()=>{k.current!==void 0&&(clearTimeout(k.current),k.current=void 0),m(!1)},[]);y.useEffect(()=>{if(!p)return;const F=ee=>{ee.key==="Escape"&&D()};return document.addEventListener("keydown",F),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{document.removeEventListener("keydown",F),window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p,D,N]),y.useEffect(()=>()=>{k.current!==void 0&&clearTimeout(k.current)},[]);const R=r?"span":"div",L=[r?Cr.wrapper:Cr.wrapperBlock,d].filter(Boolean).join(" ");let A=c;if(y.isValidElement(c)){const F=c,ee=F.props["aria-describedby"],q=p?ee?`${ee} ${S}`:S:ee;A=y.cloneElement(F,{"aria-describedby":q})}const U=o.jsx("div",{ref:_,id:S,role:"tooltip",className:`${Cr.tooltip} ${Cr[s]} ${p?Cr.visible:""}`,style:{top:g.top,left:g.left},"data-testid":u??"tooltip",children:t});return o.jsxs(R,{ref:b,className:L,onMouseEnter:C,onMouseLeave:D,onFocus:E,onBlur:D,children:[A,j?nT.createPortal(U,document.body):null]})}const b6="_row_ldkru_1",_6="_hoverActions_ldkru_5",x6="_hoverButton_ldkru_31",k6="_selectingRow_ldkru_72",S6="_selected_ldkru_83",T6="_checkboxArea_ldkru_90",w6="_checkbox_ldkru_90",j6="_contentArea_ldkru_106",as={row:b6,hoverActions:_6,hoverButton:x6,selectingRow:k6,selected:S6,checkboxArea:T6,checkbox:w6,contentArea:j6};function N6({copyText:t,isContentBearing:s,isSelecting:i,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:m}){const[g,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),p==null||p(),b.current!==void 0&&clearTimeout(b.current),b.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),k=y.useCallback(S=>{!i||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),u(S.shiftKey))},[i,u]);return s?i?o.jsxs("div",{className:`${as.row} ${as.selectingRow} ${r?as.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[o.jsx("div",{className:as.checkboxArea,children:o.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:as.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),o.jsx("div",{className:as.contentArea,children:m})]}):o.jsxs("div",{className:as.row,"data-testid":"event-hover-row",children:[o.jsxs("div",{className:as.hoverActions,"data-testid":"event-hover-actions",children:[o.jsx("button",{type:"button",className:as.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?o.jsx(xi,{size:at,"aria-hidden":"true"}):o.jsx(r_,{size:at,"aria-hidden":"true"})}),o.jsx("button",{type:"button",className:as.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:o.jsx(q2,{size:at,"aria-hidden":"true"})})]}),m]}):o.jsx("div",{className:as.row,children:m})}const C6="_bar_1vah7_1",E6="_left_1vah7_21",A6="_right_1vah7_27",D6="_count_1vah7_33",R6="_toggleButton_1vah7_40",M6="_copyButton_1vah7_68",I6="_cancelButton_1vah7_108",di={bar:C6,left:E6,right:A6,count:D6,toggleButton:R6,copyButton:M6,cancelButton:I6};function O6({selectedCount:t,totalSelectable:s,onSelectAll:i,onDeselectAll:r,onCopy:c,onCancel:d}){const u=t>0&&t>=s;return o.jsxs(Et.div,{className:di.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:[o.jsxs("div",{className:di.left,children:[o.jsxs("span",{className:di.count,"data-testid":"floating-bar-count",children:[t," selected"]}),o.jsx("button",{type:"button",className:di.toggleButton,onClick:u?r:i,"data-testid":"floating-bar-select-all",children:u?"Deselect all":"Select all"})]}),o.jsxs("div",{className:di.right,children:[o.jsxs("button",{type:"button",className:di.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[o.jsx(l2,{size:at,"aria-hidden":"true"}),"Copy"]}),o.jsx("button",{type:"button",className:di.cancelButton,onClick:d,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:o.jsx(Ba,{size:at,"aria-hidden":"true"})})]})]})}const d1=50;function L6(t,s,i,r,c=d1){return r?t<c:s-t-i<c}function B6(t,s){const i=s-t;return i>0?i:0}function z6({scrollRef:t,contentLength:s,isReversed:i,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=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 k=L6(v.scrollTop,v.scrollHeight,v.clientHeight,i,d1);k!==b&&(b=k,d(k))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),m.current&&(cancelAnimationFrame(m.current),m.current=0)}},[t,i]),y.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,i?v.scrollTop=0:v.scrollTop=v.scrollHeight,d(!0))},[t,i]),y.useLayoutEffect(()=>{const v=t.current;if(v){if(r){u.current=v.scrollHeight;return}if(i&&!c){const b=B6(u.current,v.scrollHeight);b>0&&(v.scrollTop+=b)}c&&(i?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),u.current=v.scrollHeight}},[s,c,i,r,t]);const g=y.useCallback(()=>{const v=t.current;if(!v)return;const b=i?0:v.scrollHeight;v.scrollTo({top:b,behavior:"smooth"}),d(!0)},[t,i]);return{isAtAnchor:c,scrollToAnchor:g}}const U6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function Xr(t){return U6.has(t.eventType)}function $6(t){var s;switch(t.eventType){case"tool_result":{if((s=t.toolUseCtx)!=null&&s.detailedResult)return t.toolUseCtx.detailedResult;let i=t.content;if(t.content.trimStart().startsWith("{"))try{const r=JSON.parse(t.content);typeof r.content=="string"&&(i=r.content)}catch{}return i}case"tool_use":try{const i=JSON.parse(t.content),r=i.tool??"tool",c=i.args!==void 0?JSON.stringify(i.args,void 0,2):"";return`${r}
264
- ${c}`}catch{return t.content}default:return t.content}}function Mb(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 P6(t){var i;const s=[];for(const r of t){if(!Xr(r))continue;const c=new Date(r.timestamp).toLocaleTimeString();switch(r.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
265
- ${r.content}`);break}case"user_input":{s.push(`**User** (${c}):
266
- ${r.content}`);break}case"tool_result":{let d=((i=r.toolUseCtx)==null?void 0:i.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=Mb(r.toolUseCtx.args),p=u?`**Tool: ${r.toolUseCtx.tool}** ${u}`:`**Tool: ${r.toolUseCtx.tool}**`;s.push(`${p} (${c}):
267
- ${d}`)}else s.push(`**Tool output** (${c}):
268
- ${d}`);break}case"tool_use":{let d="tool",u;try{const g=JSON.parse(r.content);d=g.tool??"tool",u=g.args}catch{}const p=Mb(u),m=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${m} (${c}):
269
- \`\`\`json
270
- ${JSON.stringify(u,void 0,2)}
271
- \`\`\``):s.push(`${m} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
272
- ${r.content}`);break}}}return s.join(`
273
-
274
- `)}function V6({events:t,formatForClipboard:s}){const[i,r]=y.useState(!1),[c,d]=y.useState(new Set),u=y.useRef(void 0),p=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)},[]),g=y.useCallback(()=>{r(!1),d(new Set),u.current=void 0},[]),v=y.useCallback((S,j)=>{if(j&&u.current!==void 0){const N=Math.min(u.current,S),T=Math.max(u.current,S);d(C=>{const E=new Set(C);for(let D=N;D<=T;D++)D<t.length&&Xr(t[D])&&E.add(D);return E})}else d(N=>{const T=new Set(N);return T.has(S)?T.delete(S):T.add(S),T.size===0?(r(!1),u.current=void 0):u.current=S,T})},[t]),b=y.useCallback(()=>{const S=new Set;for(let j=0;j<t.length;j++)Xr(t[j])&&S.add(j);d(S)},[t]),_=y.useCallback(()=>{d(new Set)},[]),k=y.useCallback(async()=>{const j=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(j.length===0)return!1;const N=s(j);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:i,selectedIndices:c,selectedCount:p,enterSelectionMode:m,cancelSelection:g,toggleEvent:v,selectAll:b,deselectAll:_,copySelected:k}}const H6="_wrapper_1cdza_1",q6="_scrollContainer_1cdza_9",G6="_selectingPadding_1cdza_16",F6="_toolbar_1cdza_20",Z6="_directionToggle_1cdza_27",K6="_scrollToAnchor_1cdza_65",Y6="_scrollToAnchorBottom_1cdza_89",J6="_scrollToAnchorTop_1cdza_93",W6="_eventOverflowWarning_1cdza_97",Fs={wrapper:H6,scrollContainer:q6,selectingPadding:G6,toolbar:F6,directionToggle:Z6,scrollToAnchor:K6,scrollToAnchorBottom:Y6,scrollToAnchorTop:J6,eventOverflowWarning:W6};function X6(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 u1="grackle-stream-direction";function Q6(){try{return localStorage.getItem(u1)==="reversed"}catch{return!1}}function e4({eventsDropped:t}){return t<=0?o.jsx(o.Fragment,{}):o.jsxs("div",{className:Fs.eventOverflowWarning,role:"alert",children:[o.jsx(em,{size:Zt,"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 Fm({events:t,eventsDropped:s,emptyState:i,onShowToast:r}){const c=y.useRef(null),[d,u]=y.useState(Q6),p=qM(),m=V6({events:t,formatForClipboard:P6}),g=y.useMemo(()=>t.filter(Xr).length,[t]),v=y.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:b,scrollToAnchor:_}=z6({scrollRef:c,contentLength:t.length,isReversed:d,paused:m.isSelecting}),k=()=>{const T=!d;u(T);try{localStorage.setItem(u1,T?"reversed":"default")}catch{}};y.useEffect(()=>{if(!m.isSelecting)return;const T=C=>{C.key==="Escape"&&m.cancelSelection()};return window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}},[m.isSelecting,m.cancelSelection]);const S=y.useCallback(async()=>{await m.copySelected()&&(r==null||r(`Copied ${m.selectedCount} message${m.selectedCount===1?"":"s"} to clipboard`,"success"))},[m,r]),j=p?0:.2,N=d?-8:8;return o.jsxs("div",{className:Fs.wrapper,children:[o.jsx("div",{className:Fs.toolbar,children:o.jsx(Eo,{text:d?"Showing newest first":"Showing oldest first",children:o.jsx("button",{className:Fs.directionToggle,onClick:k,"aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?o.jsx(ey,{size:Zt,"aria-hidden":"true"}):o.jsx(ty,{size:Zt,"aria-hidden":"true"})})})}),o.jsxs("div",{ref:c,className:`${Fs.scrollContainer} ${m.isSelecting?Fs.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&i,o.jsx(e4,{eventsDropped:s}),o.jsx(cs,{initial:!1,children:v.map((T,C)=>{const E=d?t.length-1-C:C;return o.jsx(Et.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:j,ease:"easeOut"},children:o.jsx(N6,{copyText:$6(T),isContentBearing:Xr(T),isSelecting:m.isSelecting,isSelected:m.selectedIndices.has(E),checkboxLabel:X6(T),onSelect:()=>{m.enterSelectionMode(E)},onToggle:D=>{m.toggleEvent(E,D)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:o.jsx(yA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${E}`)})})]}),o.jsx(cs,{children:m.isSelecting&&o.jsx(O6,{selectedCount:m.selectedCount,totalSelectable:g,onSelectAll:m.selectAll,onDeselectAll:m.deselectAll,onCopy:()=>{S().catch(()=>{})},onCancel:m.cancelSelection})}),o.jsx(cs,{children:!b&&o.jsxs(Et.button,{className:`${Fs.scrollToAnchor} ${d?Fs.scrollToAnchorTop:Fs.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:[d?o.jsx(ty,{size:Zt,"aria-hidden":"true"}):o.jsx(ey,{size:Zt,"aria-hidden":"true"})," New events"]})})]})}function Zm(t){const{value:s,onSave:i,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:m=!0}=t,[g,v]=y.useState(""),[b,_]=y.useState(""),k=y.useRef(!1),S=d===c,j=y.useCallback(A=>{v(A),_("")},[]),N=y.useCallback(()=>{_("")},[]),T=y.useCallback(()=>{k.current=!1,u==null||u(null),v(""),_("")},[u]),C=y.useCallback(()=>{const A=m?g.trim():g;if(r){const F=r(g);if(F){_(F);return}}const U=m?s.trim():s;if(A===U){T();return}i(A),T()},[g,s,m,r,i,T]),E=y.useCallback(()=>{k.current=!0,u==null||u(c),v(s),_("")},[c,s,u]),D=y.useCallback(A=>{if(k.current){k.current=!1;return}A.relatedTarget instanceof HTMLElement&&A.relatedTarget.dataset.editAction===c||C()},[c,C]),R=y.useCallback(A=>{A.key==="Escape"?T():A.key==="Enter"&&p&&C()},[T,p,C]),L=(()=>{if(!S)return!1;const A=m?s.trim():s;return(m?g.trim():g)!==A})();return y.useEffect(()=>{!S&&(g!==""||b!=="")&&(v(""),_(""))},[S,g,b]),{isEditing:S,draft:g,error:b,isDirty:L,startEdit:E,cancelEdit:T,save:C,setDraft:j,clearError:N,handleBlur:D,handleKeyDown:R,ignoreInitialBlurRef:k}}const t4="_editFieldWrapper_yuzty_1",n4="_editInput_yuzty_10",s4="_editTextarea_yuzty_42",a4="_editSelect_yuzty_78",i4="_editError_yuzty_111",o4="_editInputInvalid_yuzty_118",r4="_editHint_yuzty_123",l4="_unsavedDot_yuzty_132",c4="_metaValueClickable_yuzty_140",d4="_editButton_yuzty_159",u4="_metaPlaceholder_yuzty_175",f4="_worktreeToggle_yuzty_180",Xe={editFieldWrapper:t4,editInput:n4,editTextarea:s4,editSelect:a4,editError:i4,editInputInvalid:o4,editHint:r4,unsavedDot:l4,metaValueClickable:c4,editButton:d4,metaPlaceholder:u4,worktreeToggle:f4};function en(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,maxLength:b,ariaLabel:_,"data-testid":k}=t,S=y.useRef(null),j=Zm({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(j.isEditing){const T=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[j.isEditing]),c==="create"){const T=E=>{m==null||m(E.target.value)},C=r==null?void 0:r(s);return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("input",{className:`${Xe.editInput} ${C?Xe.editInputInvalid:""}`,value:s,onChange:T,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),C&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:C})]})}if(j.isEditing)return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("input",{ref:S,className:`${Xe.editInput} ${j.error?Xe.editInputInvalid:""}`,value:j.draft,onChange:T=>j.setDraft(T.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,maxLength:b,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),j.isDirty&&o.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),j.error&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:j.error}),o.jsx("span",{className:Xe.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return o.jsxs("span",{role:"button",tabIndex:0,className:Xe.metaValueClickable,onClick:()=>j.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),j.startEdit())},title:"Click to edit","aria-label":_,"data-testid":k?`${k}-button`:void 0,children:[N!==void 0?N:s?o.jsx("span",{children:s}):o.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function Zp(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,k=y.useRef(null),S=Zm({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});if(y.useEffect(()=>{if(S.isEditing){const N=window.setTimeout(()=>{var T;(T=k.current)==null||T.focus()},0);return()=>window.clearTimeout(N)}},[S.isEditing]),c==="create"){const N=C=>{m==null||m(C.target.value)},T=r==null?void 0:r(s);return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("textarea",{className:`${Xe.editTextarea} ${T?Xe.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),T&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:T})]})}if(S.isEditing)return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("textarea",{ref:k,className:`${Xe.editTextarea} ${S.error?Xe.editInputInvalid:""}`,value:S.draft,onChange:N=>S.setDraft(N.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:b,"aria-label":b,"data-testid":_?`${_}-input`:void 0}),S.isDirty&&o.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),S.error&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:S.error}),o.jsx("span",{className:Xe.editHint,children:"Tab to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return o.jsxs("span",{role:"button",tabIndex:0,className:Xe.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[j!==void 0?j:s?o.jsx("span",{children:s}):o.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function id(t){var E;const{value:s,onSave:i,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:m,renderDisplay:g,placeholder:v,ariaLabel:b,"data-testid":_}=t,k=y.useRef(null),S=Zm({value:s,onSave:i,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const D=window.setTimeout(()=>{var R;(R=k.current)==null||R.focus()},0);return()=>window.clearTimeout(D)}},[S.isEditing]);const j=y.useCallback(D=>{const R=D.target.value;S.ignoreInitialBlurRef.current=!1,R!==s&&i(R),S.cancelEdit()},[s,i,S]),N=y.useCallback(D=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}D.relatedTarget instanceof HTMLElement&&D.relatedTarget.dataset.editAction===d||S.cancelEdit()},[d,S]);if(r==="create")return o.jsx("select",{className:Xe.editSelect,value:s,onChange:D=>m==null?void 0:m(D.target.value),"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(D=>o.jsx("option",{value:D.value,children:D.label},D.value))});if(S.isEditing)return o.jsx("select",{ref:k,className:Xe.editSelect,value:S.draft,onChange:j,onBlur:N,title:b,"aria-label":b,"data-testid":_?`${_}-select`:void 0,children:c.map(D=>o.jsx("option",{value:D.value,children:D.label},D.value))});const T=g==null?void 0:g(s),C=(E=c.find(D=>D.value===s))==null?void 0:E.label;return o.jsxs("button",{type:"button",className:Xe.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":b,"data-testid":_?`${_}-button`:void 0,children:[T!==void 0?T:C?o.jsx("span",{children:C}):o.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),o.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function p4(t){const{checked:s,onChange:i,label:r,ariaLabel:c,"data-testid":d}=t;return o.jsxs("label",{className:Xe.worktreeToggle,"data-testid":d,children:[o.jsx("input",{type:"checkbox",checked:s,onChange:u=>i(u.target.checked),"aria-label":c}),o.jsx("span",{children:r})]})}const m4="_envRow_1e1r5_1",h4="_envDot_1e1r5_7",g4="_envDotGreen_1e1r5_14",v4="_envDotYellow_1e1r5_18",y4="_envDotRed_1e1r5_22",b4="_envDotGray_1e1r5_26",ko={envRow:m4,envDot:h4,envDotGreen:g4,envDotYellow:v4,envDotRed:y4,envDotGray:b4};function _4(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?ko.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?ko.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?ko.envDotRed:ko.envDotGray}function x4(t){const{value:s,onSave:i,environments:r,allowNone:c=!1,fieldId:d="environment",activeFieldId:u,onActivate:p,placeholder:m="No environment",ariaLabel:g="Environment","data-testid":v}=t,b=r.find(S=>S.id===s),_=[...c?[{value:"",label:"None"}]:[],...r.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(b)return o.jsxs("span",{className:ko.envRow,children:[o.jsx("span",{className:`${ko.envDot} ${_4(b.status)}`}),b.displayName]})};return o.jsx(id,{value:s,onSave:i,options:_,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:k,placeholder:m,ariaLabel:g,"data-testid":v})}const k4="_nav_1snmp_1",S4="_searchForm_1snmp_8",T4="_searchInput_1snmp_15",w4="_searchButton_1snmp_33",j4="_clearButton_1snmp_68",N4="_workspaceSelect_1snmp_85",C4="_listHeader_1snmp_99",E4="_nodeList_1snmp_108",A4="_nodeItem_1snmp_116",D4="_indicator_1snmp_129",R4="_label_1snmp_136",M4="_badge_1snmp_145",Fn={nav:k4,searchForm:S4,searchInput:T4,searchButton:w4,clearButton:j4,workspaceSelect:N4,listHeader:C4,nodeList:E4,nodeItem:A4,indicator:D4,label:R4,badge:M4};function I4({nodes:t,workspaces:s,loading:i,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[m,g]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),m.trim()&&c(m.trim())},[m,c]),b=y.useCallback(()=>{g(""),d()},[d]),_=y.useCallback(S=>{u(S)},[u]),k=y.useCallback(S=>{g(""),p(S)},[p]);return o.jsxs("div",{className:Fn.nav,"data-testid":"knowledge-nav",children:[o.jsxs("form",{className:Fn.searchForm,onSubmit:v,children:[o.jsx("input",{className:Fn.searchInput,type:"text",placeholder:"Search...",value:m,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input","aria-label":"Search knowledge nodes"}),o.jsx("button",{type:"submit",className:Fn.searchButton,disabled:i,children:"Go"})]}),r&&o.jsx("button",{type:"button",className:Fn.clearButton,onClick:b,children:"Clear search"}),o.jsxs("select",{className:Fn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter","aria-label":"Filter by workspace",children:[o.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>o.jsx("option",{value:S.id,children:S.name},S.id))]}),o.jsxs("div",{className:Fn.listHeader,children:["Nodes (",t.length,")"]}),o.jsx("ul",{className:Fn.nodeList,children:t.map(S=>o.jsxs("li",{className:Fn.nodeItem,onClick:()=>{_(S.id)},onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[o.jsx("span",{className:Fn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),o.jsx("span",{className:Fn.label,children:S.label}),o.jsx("span",{className:Fn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const O4="_container_1mq5u_1",L4="_hamburger_1mq5u_33",B4="_brand_1mq5u_49",z4="_brandLogo_1mq5u_68",U4="_info_1mq5u_75",$4="_connectionLabel_1mq5u_90",P4="_connectionDot_1mq5u_103",V4="_connected_1mq5u_106",H4="_disconnected_1mq5u_110",qs={container:O4,hamburger:L4,brand:B4,brandLogo:z4,info:U4,connectionLabel:$4,connectionDot:P4,connected:V4,disconnected:H4};function q4({connected:t,environments:s,sessions:i,onToggleSidebar:r,sidebarOpen:c}){const d=xt(),u=s.length,p=s.filter(g=>g.status==="connected").length,m=i.filter(g=>["running","idle"].includes(g.status)).length;return o.jsxs("div",{className:qs.container,children:[r&&o.jsx("button",{type:"button",className:qs.hamburger,onClick:r,"aria-label":"Toggle sidebar","aria-expanded":c,children:o.jsx(E2,{size:It,"aria-hidden":"true"})}),o.jsx(Eo,{text:"Home",placement:"bottom",children:o.jsxs("button",{type:"button",className:qs.brand,onClick:()=>d(bi),"data-testid":"statusbar-brand",children:[o.jsx("img",{src:"/icon-192x192.png",alt:"",className:qs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]})}),o.jsxs("div",{className:qs.info,children:[o.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[o.jsx("span",{className:`${qs.connectionDot} ${t?qs.connected:qs.disconnected}`,"aria-hidden":"true",children:o.jsx(Ma,{size:tm,fill:"currentColor"})})," ",o.jsx("span",{className:qs.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),o.jsxs("span",{children:[p,"/",u," env",u!==1?"s":""]}),o.jsxs("span",{children:[m," active"]})]})]})}const G4="_nav_13gkc_1",F4="_tab_13gkc_35",Z4="_tabIcon_13gkc_68",K4="_tabLabel_13gkc_79",Y4="_tabActive_13gkc_84",Er={nav:G4,tab:F4,tabIcon:Z4,tabLabel:K4,tabActive:Y4},ui=[{view:"dashboard",label:"Dashboard",icon:o.jsx(g2,{size:It}),route:bi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:o.jsx(D2,{size:It}),route:Qj,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:o.jsx(s2,{size:It}),route:eN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:o.jsx(M2,{size:It}),route:To,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:o.jsx(WT,{size:It}),route:A_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:o.jsx(l_,{size:It}),route:hd,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:o.jsx(V2,{size:It}),route:Yj,testId:"sidebar-tab-settings"}];function J4(t){return t===bi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(A_)?"knowledge":t.startsWith(hd)?"findings":t.startsWith(So)?"settings":"tasks"}function W4(){const t=Ht(),s=xt(),i=y.useRef(null),r=J4(t.pathname),c=y.useCallback(u=>{s(u.route)},[s]),d=y.useCallback(u=>{var b,_;const p=(b=i.current)==null?void 0:b.querySelectorAll('[role="tab"]');if(!p)return;const m=Array.from(p).findIndex(k=>k===document.activeElement),g=m>=0?m:ui.findIndex(k=>k.view===r);let v=g;if(u.key==="ArrowRight"||u.key==="j"||u.key==="J")u.preventDefault(),v=(g+1)%ui.length;else if(u.key==="ArrowLeft"||u.key==="k"||u.key==="K")u.preventDefault(),v=(g-1+ui.length)%ui.length;else if(u.key==="Home")u.preventDefault(),v=0;else if(u.key==="End")u.preventDefault(),v=ui.length-1;else return;s(ui[v].route),(_=p[v])==null||_.focus()},[r,s]);return o.jsx("nav",{className:Er.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:d,"data-testid":"sidebar-nav",children:ui.map(u=>{const p=u.view===r;return o.jsx(Eo,{text:u.label,placement:"bottom",children:o.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Er.tab} ${p?Er.tabActive:""}`,onClick:()=>c(u),"data-testid":u.testId,"aria-label":u.label,children:[o.jsx("span",{className:Er.tabIcon,"aria-hidden":"true",children:u.icon}),o.jsx("span",{className:Er.tabLabel,children:u.label})]})},u.view)})})}const X4="_container_pi6ii_1",Q4="_content_pi6ii_66",Ib={container:X4,content:Q4},eI=320,f1=220,p1=600,m1="grackle-sidebar-width";function tI(){try{const t=localStorage.getItem(m1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=f1&&s<=p1)return s}}catch{}return eI}function nI(t){try{localStorage.setItem(m1,String(t))}catch{}}function sI({content:t}){const[s]=y.useState(tI),i=y.useRef(null);if(y.useEffect(()=>{const r=i.current;if(!r)return;const c=new ResizeObserver(d=>{for(const u of d){const p=u.borderBoxSize[0];if(p){const m=Math.round(p.inlineSize);m>=f1&&m<=p1&&nI(m)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return o.jsx("div",{className:Ib.container,ref:i,"data-testid":"sidebar",style:{width:s},children:o.jsx("div",{className:Ib.content,children:t})})}const aI="_bar_tnfsh_1",iI="_btnPrimary_tnfsh_32",oI="_statusText_tnfsh_85",rI="_statusCompleted_tnfsh_90",lI="_statusFailed_tnfsh_94",cI="_statusBlocked_tnfsh_98",dI="_hintText_tnfsh_103",St={bar:aI,btnPrimary:iI,statusText:oI,statusCompleted:rI,statusFailed:lI,statusBlocked:cI,hintText:dI};function uI({sessions:t,tasks:s,environments:i}){const r=xt(),c=Ht(),d=Nt("/sessions/:sessionId"),u=Nt("/tasks/:taskId"),p=Nt("/tasks/:taskId/stream"),m=Nt("/tasks/:taskId/findings"),g=Nt("/tasks/:taskId/edit"),v=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),b=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=Nt("/sessions/new"),j=Nt("/environments/:environmentId/workspaces/:workspaceId"),N=Nt("/tasks/new"),T=Nt("/chat"),C=Nt("/"),E=Nt("/settings/*"),D=d==null?void 0:d.params.sessionId,R=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(m==null?void 0:m.params.taskId)??(v==null?void 0:v.params.taskId)??(b==null?void 0:b.params.taskId)??(_==null?void 0:_.params.taskId)??(k==null?void 0:k.params.taskId),L=v??b??_??k,A=(L==null?void 0:L.params.environmentId)??(j==null?void 0:j.params.environmentId),U=c.pathname.startsWith("/environments")&&!j&&!L,F=!!T,ee=!!S,q=!!j&&!v&&!b&&!_&&!k,X=!!N;if(!!C&&!ee&&!q&&!X||!!E||(!!g||!!k)||X||U||ee)return o.jsx(o.Fragment,{});if(F)return i.find(Z=>Z.adapterType==="local"&&Z.status==="connected")?o.jsx(o.Fragment,{}):o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Add a local environment to start chatting"})});if(q)return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Select a task or click + to create one"})});if(R){const O=s.find(ue=>ue.id===R);if(!O)return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Loading..."})});const Z=new Map(s.map(ue=>[ue.id,ue])),se=O.dependsOn.some(ue=>{const de=Z.get(ue);return de!==void 0&&de.status!=="complete"});if(O.status==="not_started"){const ue=se?O.dependsOn.map(de=>Z.get(de)).filter(de=>de&&de.status!=="complete").map(de=>de.title):[];return o.jsx("div",{className:St.bar,children:se?o.jsxs("span",{className:St.statusBlocked,children:["Blocked by: ",ue.join(", ")]}):o.jsx("span",{className:St.hintText,children:"Use the buttons above to start or manage this task"})})}if(O.status==="working"||O.status==="paused"){const ue=O.latestSessionId||void 0,de=ue?t.find(De=>De.id===ue):void 0;return de&&de.status!=="stopped"?o.jsx(o.Fragment,{}):o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Waiting for agent..."})})}if(O.status==="complete")return o.jsxs("div",{className:St.bar,children:[o.jsx("span",{className:`${St.statusText} ${St.statusCompleted}`,children:"Task completed"}),o.jsx("button",{onClick:()=>r(Si(O.workspaceId,void 0,A)),className:St.btnPrimary,children:"+ New Task"})]});if(O.status==="failed")return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:`${St.statusText} ${St.statusFailed}`,children:"Task failed"})})}if(D){const O=t.find(ue=>ue.id===D),Z=(O==null?void 0:O.status)==="stopped";if(O!==void 0&&!Z)return o.jsx(o.Fragment,{});if(Z)return o.jsxs("div",{className:St.bar,children:[o.jsxs("span",{className:`${St.statusText} ${St.hintText}`,children:["Session ",O.endReason||O.status]}),o.jsx("button",{onClick:()=>r(N_(O.environmentId)),className:St.btnPrimary,children:"+ New Chat"})]})}return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Loading..."})})}const fI="_nav_14i94_1",pI="_tab_14i94_24",mI="_tabActive_14i94_62",hI="_tabLabel_14i94_75",gI="_statusDot_14i94_81",vI="_pulse_14i94_87",yI="_addButton_14i94_99",bI="_empty_14i94_132",ja={nav:fI,tab:pI,tabActive:mI,tabLabel:hI,statusDot:gI,pulse:vI,addButton:yI,empty:bI},_I={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function xI({environments:t}){const s=xt(),i=y.useRef(null),r=Nt("/environments/:environmentId"),c=Nt("/environments/:environmentId/edit"),d=Nt("/environments/:environmentId/workspaces/:workspaceId"),u=Nt("/environments/:environmentId/workspaces/:workspaceId/*"),p=(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=p==="new"?void 0:p,g=y.useCallback(_=>{s(yi(_))},[s]),v=y.useCallback(_=>{var T;const k=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===m);let N=j;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(j+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(j-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=k.length-1;else return;N<t.length&&s(yi(t[N].id)),k[N].focus()},[m,t,s]),b=m??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:ja.nav,"data-testid":"environment-nav",children:[o.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const k=_.id===m,S=_.id===b,j=_I[_.status]||"var(--text-tertiary)",N=_.status==="connected";return o.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${ja.tab} ${k?ja.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[o.jsx("span",{className:`${ja.statusDot} ${N?ja.pulse:""}`,style:{color:j},"aria-hidden":"true",children:o.jsx(Ma,{size:tm,fill:"currentColor"})}),o.jsx("span",{className:ja.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),o.jsx("button",{type:"button",className:ja.addButton,onClick:()=>s(Zj),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&o.jsx("div",{className:ja.empty,children:"No environments yet."})]})}function Km(t){const s=new Date(t),i=new Date,r=i.getTime()-s.getTime(),c=Math.floor(r/1e3),d=Math.floor(c/60),u=Math.floor(d/60),p=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(p===1)return"yesterday";if(p<7)return`${p} days ago`;const m=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return m?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Ob={architecture:{text:"var(--accent-blue)",bg:"var(--accent-blue-dim)"},api:{text:"var(--accent-green)",bg:"var(--accent-green-dim)"},bug:{text:"var(--accent-red)",bg:"var(--accent-red-dim)"},decision:{text:"var(--accent-yellow)",bg:"var(--accent-yellow-dim)"},dependency:{text:"var(--accent-purple)",bg:"var(--accent-purple-dim)"},pattern:{text:"var(--accent-cyan)",bg:"var(--accent-cyan-dim)"},general:{text:"var(--text-secondary)",bg:"var(--bg-elevated)"}};function od(t){return Ob[t]||Ob.general}const kI="_nav_dlm8m_1",SI="_categoryPills_dlm8m_24",TI="_categoryPill_dlm8m_24",wI="_tab_dlm8m_42",jI="_tabActive_dlm8m_80",NI="_tabContent_dlm8m_93",CI="_tabLabel_dlm8m_100",EI="_tabMeta_dlm8m_106",AI="_categoryDot_dlm8m_111",DI="_empty_dlm8m_118",gs={nav:kI,categoryPills:SI,categoryPill:TI,tab:wI,tabActive:jI,tabContent:NI,tabLabel:CI,tabMeta:EI,categoryDot:AI,empty:DI};function RI({findings:t,workspaceId:s,environmentId:i}){const r=xt(),c=y.useRef(null),d=Nt("/findings/:findingId"),u=Nt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(d==null?void 0:d.params.findingId)??(u==null?void 0:u.params.findingId),m=y.useMemo(()=>{const _=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(_).sort()},[t]),g=y.useCallback(_=>{r(Cp(_,s,i))},[r,s,i]),v=y.useCallback(_=>{var T;const k=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),j=S>=0?S:t.findIndex(C=>C.id===p);let N=j;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(j+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(j-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=k.length-1;else return;N<t.length&&r(Cp(t[N].id,s,i)),k[N].focus()},[p,t,r,s,i]),b=p??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:gs.nav,"data-testid":"findings-nav",children:[m.length>1&&o.jsx("div",{className:gs.categoryPills,"data-testid":"findings-nav-categories",children:m.map(_=>o.jsx("span",{className:gs.categoryPill,style:{color:od(_).text},children:_},_))}),o.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(_=>{const k=_.id===p,S=_.id===b;return o.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${gs.tab} ${k?gs.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"finding-nav-item",children:[o.jsx("span",{className:gs.categoryDot,style:{color:od(_.category).text},"aria-hidden":"true",children:o.jsx(Ma,{size:tm,fill:"currentColor"})}),o.jsxs("span",{className:gs.tabContent,children:[o.jsx("span",{className:gs.tabLabel,title:_.title,children:_.title}),o.jsx("span",{className:gs.tabMeta,title:_.createdAt,children:Km(_.createdAt)})]})]},_.id)})}),t.length===0&&o.jsx("div",{className:gs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function MI(t){if(t.length===0)return[];const s=[...t].sort((r,c)=>r[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let r=1;r<s.length;r++){const c=i[i.length-1],[d,u]=s[r];d<=c[1]+1?c[1]=Math.max(c[1],u):i.push([d,u])}return i}function h1({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return o.jsx(o.Fragment,{children:t});const r=MI(s),c=[];let d=0;for(const[u,p]of r)u>d&&c.push(o.jsx("span",{children:t.slice(d,u)},`p${d}`)),c.push(o.jsx("mark",{className:i,children:t.slice(u,p+1)},`m${u}`)),d=p+1;return d<t.length&&c.push(o.jsx("span",{children:t.slice(d)},`p${d}`)),o.jsx(o.Fragment,{children:c})}function II(t){const s=new Map(t.map(r=>[r.id,{...r,children:[]}])),i=[];for(const r of s.values())r.parentTaskId&&s.has(r.parentTaskId)?s.get(r.parentTaskId).children.push(r):i.push(r);for(const r of s.values())r.children.sort((c,d)=>c.sortOrder-d.sortOrder);return i.sort((r,c)=>r.sortOrder-c.sortOrder)}function OI(t,s){const i=new Map;for(const d of t){const p=d.dependsOn.length>0&&d.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":d.status,m=i.get(p);m?m.push(d):i.set(p,[d])}const r=[],c=new Set;for(const d of W2){c.add(d);const u=i.get(d);if(u&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ia(d);r.push({status:d,label:p.label,style:p,tasks:u})}}for(const[d,u]of i)if(!c.has(d)&&u.length>0){u.sort((m,g)=>m.sortOrder-g.sortOrder);const p=Ia(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const LI="_container_z4i38_1",BI="_header_z4i38_5",zI="_headerActions_z4i38_17",UI="_searchInput_z4i38_23",$I="_searchHighlight_z4i38_56",PI="_groupToggle_z4i38_62",VI="_groupToggleActive_z4i38_89",HI="_addButton_z4i38_93",qI="_taskRow_z4i38_120",GI="_selected_z4i38_140",FI="_expandArrow_z4i38_150",ZI="_expanded_z4i38_157",KI="_leafSpacer_z4i38_161",YI="_taskStatusIcon_z4i38_166",JI="_taskTitle_z4i38_170",WI="_workspaceBadge_z4i38_177",XI="_childCountBadge_z4i38_195",QI="_dependencyBadge_z4i38_208",e5="_blockedBadge_z4i38_220",t5="_addChildButton_z4i38_225",n5="_emptyState_z4i38_268",s5="_statusGroupHeader_z4i38_275",a5="_statusGroupIcon_z4i38_294",i5="_statusGroupLabel_z4i38_298",o5="_statusGroupCount_z4i38_303",qe={container:LI,header:BI,headerActions:zI,searchInput:UI,searchHighlight:$I,groupToggle:PI,groupToggleActive:VI,addButton:HI,taskRow:qI,selected:GI,expandArrow:FI,expanded:ZI,leafSpacer:KI,taskStatusIcon:YI,taskTitle:JI,workspaceBadge:WI,childCountBadge:XI,dependencyBadge:QI,blockedBadge:e5,addChildButton:t5,emptyState:n5,statusGroupHeader:s5,statusGroupIcon:a5,statusGroupLabel:i5,statusGroupCount:o5},r5=[{name:"title",weight:2},{name:"description",weight:1}],g1=16,l5=16,v1="grackle-task-group-by-status";function Lb(){try{return localStorage.getItem(v1)==="true"}catch{return!1}}function c5(t){try{localStorage.setItem(v1,String(t))}catch{}}function d5({group:t,isExpanded:s,onToggle:i,selectedTaskId:r,navigate:c,titleHighlights:d,workspaceNames:u}){return o.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[o.jsxs("div",{className:qe.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[o.jsx("span",{className:`${qe.expandArrow} ${s?qe.expanded:""}`,"aria-hidden":"true",children:o.jsx(ea,{size:at})}),o.jsx("span",{className:qe.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),o.jsx("span",{className:qe.statusGroupLabel,children:t.label}),o.jsx("span",{className:qe.statusGroupCount,children:t.tasks.length})]}),o.jsx(cs,{children:s&&o.jsx(Et.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(p=>{const m=Ia(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return o.jsxs("div",{onClick:()=>c(Dn(p.id)),role:"button",tabIndex:0,"aria-label":p.title,onKeyDown:b=>{b.currentTarget===b.target&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c(Dn(p.id)))},className:`${qe.taskRow} ${g?qe.selected:""}`,style:{"--task-indent":`${g1}px`},"data-task-id":p.id,children:[o.jsx("span",{className:qe.leafSpacer}),o.jsx("span",{className:qe.taskStatusIcon,style:{color:m.color},"aria-hidden":"true","data-testid":`task-status-${el(p.status)}`,children:m.icon}),o.jsx("span",{className:qe.taskTitle,title:p.title,children:o.jsx(h1,{text:p.title,indices:d.get(p.id),highlightClass:qe.searchHighlight})}),v&&o.jsx("span",{className:qe.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function y1({node:t,depth:s,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m}){const g=Ia(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),b=i.has(t.id),_=t.children.length>0,k=c===t.id,S=g1+s*l5,N=s===0&&!t.parentTaskId&&t.workspaceId?m.get(t.workspaceId):void 0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{onClick:()=>d(Dn(t.id)),role:"button",tabIndex:0,"aria-label":t.title,onKeyDown:T=>{T.currentTarget===T.target&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),d(Dn(t.id)))},className:`${qe.taskRow} ${k?qe.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&o.jsx("span",{className:`${qe.expandArrow} ${b?qe.expanded:""}`,role:"button",tabIndex:0,"aria-label":b?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),r(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),r(t.id))},children:o.jsx(ea,{size:at,"aria-hidden":"true"})}),!_&&o.jsx("span",{className:qe.leafSpacer}),o.jsx("span",{className:qe.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${el(t.status)}`,children:g.icon}),o.jsx("span",{className:qe.taskTitle,title:t.title,children:o.jsx(h1,{text:t.title,indices:p.get(t.id),highlightClass:qe.searchHighlight})}),N&&o.jsx("span",{className:qe.workspaceBadge,title:N,children:N}),_&&o.jsxs("span",{className:qe.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&o.jsx("span",{className:`${qe.dependencyBadge} ${v?qe.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<rT&&o.jsx(Eo,{text:"Add child task",children:o.jsx("button",{onClick:T=>{T.stopPropagation(),d(Si(t.workspaceId,t.id))},"aria-label":"Add child task",className:qe.addChildButton,children:"+"})})]}),o.jsx(cs,{children:_&&b&&o.jsx(Et.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(T=>o.jsx(y1,{node:T,depth:s+1,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:m},T.id))})})]})}function u5({workspaces:t,tasks:s}){const i=xt(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,m]=y.useState(Lb),[g,v]=y.useState(Lb),[b,_]=y.useState(new Map),k=Nt("/tasks/:taskId/*"),S=(k==null?void 0:k.params.taskId)!=="new"?k==null?void 0:k.params.taskId:void 0,j=y.useMemo(()=>new Map(s.map(Q=>[Q.id,Q.status])),[s]),N=y.useMemo(()=>new Map(t.map(Q=>[Q.id,Q.name])),[t]),T=()=>{const Q=!p;c5(Q),m(Q),Q&&(v(!0),_(new Map))},C=Q=>{_(re=>{const O=new Map(re),Z=O.has(Q)?O.get(Q):g;return O.set(Q,!Z),O})},E=Q=>b.has(Q)?b.get(Q):g,D=Q=>{c(re=>{const O=new Set(re);return O.has(Q)?(O.delete(Q),u(Z=>new Set(Z).add(Q))):(O.add(Q),u(Z=>{const se=new Set(Z);return se.delete(Q),se})),O})};y.useEffect(()=>{const Q=new Set(s.filter(re=>re.parentTaskId).map(re=>re.parentTaskId));Q.size>0&&c(re=>{const O=new Set(re);for(const Z of Q)d.has(Z)||O.add(Z);return O})},[s,d]);const[R,L]=y.useState(""),{directMatchTaskIds:A,treeMatchTaskIds:U,titleHighlights:F}=y.useMemo(()=>{if(!R.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const Q=oT(s,R,r5),re=new Set(Q.map(ue=>ue.item.id)),O=new Map;for(const ue of Q){const de=ue.matches.find(Ge=>Ge.key==="title");de&&O.set(ue.item.id,de.indices)}const Z=new Set(re),se=new Map(s.map(ue=>[ue.id,ue]));for(const ue of[...re]){let de=se.get(ue);for(;de!=null&&de.parentTaskId;)Z.add(de.parentTaskId),de=se.get(de.parentTaskId)}return{directMatchTaskIds:re,treeMatchTaskIds:Z,titleHighlights:O}},[R,s]),ee=A!==null,q=ee?p?A:U:null,X=q?s.filter(Q=>q.has(Q.id)):s,ae=p?[]:II(X);return o.jsxs("div",{className:qe.container,children:[o.jsxs("div",{className:qe.header,children:[o.jsx("span",{children:"Tasks"}),o.jsxs("div",{className:qe.headerActions,children:[o.jsx(Eo,{text:p?"Switch to tree view":"Group tasks by status",children:o.jsx("button",{className:`${qe.groupToggle} ${p?qe.groupToggleActive:""}`,onClick:T,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,"data-testid":"task-group-by-status-toggle",children:o.jsx(w2,{size:Zt})})}),o.jsx(Eo,{text:"New task",children:o.jsx("button",{className:qe.addButton,onClick:()=>i(Si()),"aria-label":"New task","data-testid":"new-task-button",children:"+"})})]})]}),s.length>0&&o.jsx("input",{type:"text",value:R,onChange:Q=>L(Q.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:qe.searchInput,"data-testid":"sidebar-search"}),p?OI(X,j).map(Q=>o.jsx(d5,{group:Q,isExpanded:E(Q.status),onToggle:()=>C(Q.status),selectedTaskId:S,navigate:i,titleHighlights:F,workspaceNames:N},Q.status)):ae.map(Q=>o.jsx(y1,{node:Q,depth:0,expandedTasks:r,toggleTask:D,selectedTaskId:S,navigate:i,taskStatusById:j,titleHighlights:F,workspaceNames:N},Q.id)),X.length===0&&!ee&&o.jsx("div",{className:qe.emptyState,children:"No tasks yet. Click + to create one."}),X.length===0&&ee&&o.jsx("div",{className:qe.emptyState,children:"No matching tasks"})]})}const f5="_toast_ed2dk_1",p5="_success_ed2dk_18",m5="_icon_ed2dk_22",h5="_error_ed2dk_25",g5="_warning_ed2dk_32",v5="_info_ed2dk_38",y5="_message_ed2dk_53",b5="_close_ed2dk_60",Ar={toast:f5,success:p5,icon:m5,error:h5,warning:g5,info:v5,message:y5,close:b5},_5={success:o.jsx(xi,{size:It}),error:o.jsx(Ba,{size:It}),warning:o.jsx(em,{size:It}),info:o.jsx(Qp,{size:It})};function x5({toast:t,onDismiss:s}){return y.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),o.jsxs(Et.div,{className:`${Ar.toast} ${Ar[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:[o.jsx("span",{className:Ar.icon,"aria-hidden":"true",children:_5[t.variant]}),o.jsx("span",{className:Ar.message,children:t.message}),o.jsx("button",{type:"button",className:Ar.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:o.jsx(Ba,{size:Zt,"aria-hidden":"true"})})]})}const k5="_container_qqse2_1",S5={container:k5};function T5({toasts:t,onDismiss:s}){return o.jsx("div",{className:S5.container,"data-testid":"toast-container",children:o.jsx(cs,{children:t.map(i=>o.jsx(x5,{toast:i,onDismiss:s},i.id))})})}const w5="_callout_e5awm_1",j5="_success_e5awm_11",N5="_icon_e5awm_15",C5="_error_e5awm_18",E5="_warning_e5awm_25",A5="_info_e5awm_32",D5="_content_e5awm_48",R5="_close_e5awm_53",Dr={callout:w5,success:j5,icon:N5,error:C5,warning:E5,info:A5,content:D5,close:R5},M5={success:o.jsx(xi,{size:It}),error:o.jsx(Ba,{size:It}),warning:o.jsx(em,{size:It}),info:o.jsx(Qp,{size:It})};function I5({variant:t="info",children:s,dismissible:i=!1,className:r}){const[c,d]=y.useState(!1);return o.jsx(o.Fragment,{children:!c&&o.jsxs("div",{className:[Dr.callout,Dr[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[o.jsx("span",{className:Dr.icon,"aria-hidden":"true",children:M5[t]}),o.jsx("span",{className:Dr.content,children:s}),i&&o.jsx("button",{type:"button",className:Dr.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:o.jsx(Ba,{size:Zt,"aria-hidden":"true"})})]})})}function O5({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:r}){if(!i)return o.jsx(o.Fragment,{});const c=r?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return o.jsx("div",{"data-testid":"update-banner",children:o.jsxs(I5,{variant:"info",dismissible:!0,children:[o.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",o.jsx("code",{children:c})]})})}const L5="_container_de44x_1",B5="_emptyState_de44x_8",z5="_card_de44x_14",U5="_cardClickable_de44x_34",$5="_cardHeader_de44x_42",P5="_categoryBadge_de44x_54",V5="_findingTitle_de44x_62",H5="_findingDate_de44x_68",q5="_findingContent_de44x_80",G5="_tags_de44x_86",F5="_tag_de44x_86",is={container:L5,emptyState:B5,card:z5,cardClickable:U5,cardHeader:$5,categoryBadge:P5,findingTitle:V5,findingDate:H5,findingContent:q5,tags:G5,tag:F5};function b1({findings:t,onFindingClick:s}){return t.length===0?o.jsx("div",{className:is.emptyState,children:"No findings yet. Agents will post discoveries here."}):o.jsx("div",{className:is.container,children:t.map((i,r)=>{const c=od(i.category),d=s?Et.button:Et.div;return o.jsxs(d,{type:s?"button":void 0,className:`${is.card} ${s?is.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:r*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[o.jsxs("div",{className:is.cardHeader,children:[o.jsx("span",{className:is.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),o.jsx("span",{className:is.findingTitle,children:i.title}),o.jsx("span",{className:is.findingDate,title:i.createdAt,children:Km(i.createdAt)})]}),o.jsx("div",{className:is.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&o.jsx("div",{className:is.tags,children:i.tags.map(u=>o.jsx("span",{className:is.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},i.id)})})}const Z5="_section_1ingb_14",K5="_sectionTitle_1ingb_26",Y5="_sectionDescription_1ingb_35",J5="_tokenList_1ingb_48",W5="_tokenRow_1ingb_55",X5="_tokenBadge_1ingb_68",Q5="_tokenName_1ingb_83",eO="_tokenTarget_1ingb_90",tO="_deleteButton_1ingb_99",nO="_addForm_1ingb_113",sO="_formRow_1ingb_119",aO="_input_1ingb_125",iO="_select_1ingb_155",oO="_addButton_1ingb_187",rO="_emptyStateInfo_1ingb_221",lO="_themeOptions_1ingb_229",cO="_themeOption_1ingb_229",dO="_themeOptionSelected_1ingb_254",uO="_themeOptionHeader_1ingb_259",fO="_themeOptionLabel_1ingb_266",pO="_themeOptionDesc_1ingb_273",mO="_variantToggle_1ingb_279",hO="_variantButton_1ingb_286",gO="_variantActive_1ingb_305",vO="_themeSwatches_1ingb_311",yO="_themeSwatch_1ingb_311",bO="_systemToggle_1ingb_325",_O="_systemToggleHint_1ingb_341",xO="_themeActive_1ingb_348",kO="_aboutGrid_1ingb_354",SO="_aboutItem_1ingb_360",TO="_aboutLabel_1ingb_373",wO="_aboutValue_1ingb_379",jO="_aboutDot_1ingb_387",NO="_aboutDotConnected_1ingb_394",CO="_aboutDotDisconnected_1ingb_398",ge={section:Z5,sectionTitle:K5,sectionDescription:Y5,tokenList:J5,tokenRow:W5,tokenBadge:X5,tokenName:Q5,tokenTarget:eO,deleteButton:tO,addForm:nO,formRow:sO,input:aO,select:iO,addButton:oO,emptyStateInfo:rO,themeOptions:lO,themeOption:cO,themeOptionSelected:dO,themeOptionHeader:uO,themeOptionLabel:fO,themeOptionDesc:pO,variantToggle:mO,variantButton:hO,variantActive:gO,themeSwatches:vO,themeSwatch:yO,systemToggle:bO,systemToggleHint:_O,themeActive:xO,aboutGrid:kO,aboutItem:SO,aboutLabel:TO,aboutValue:wO,aboutDot:jO,aboutDotConnected:NO,aboutDotDisconnected:CO},EO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function AO({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[m,g]=y.useState("env_var"),[v,b]=y.useState(""),[_,k]=y.useState(null),S=T=>{if(T.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(""),p(""),b("")},j=T=>{k(T)},N=()=>{_&&(i(_),r==null||r("Token deleted","info")),k(null)};return o.jsxs(o.Fragment,{children:[o.jsx(_i,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>k(null)}),o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Tokens"}),o.jsx("p",{className:ge.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?o.jsx("div",{className:ge.emptyStateInfo,children:"Add your first API token to enable service integrations."}):o.jsx("div",{className:ge.tokenList,children:t.map(T=>o.jsxs("div",{className:ge.tokenRow,children:[o.jsx("span",{className:ge.tokenBadge,children:T.tokenType}),o.jsx("span",{className:ge.tokenName,children:T.name}),o.jsx("span",{className:ge.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),o.jsx("button",{className:ge.deleteButton,onClick:()=>j(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:o.jsx(Ba,{size:Zt,"aria-hidden":"true"})})]},T.name))}),o.jsxs("form",{className:ge.addForm,onSubmit:S,children:[o.jsxs("div",{className:ge.formRow,children:[o.jsx("input",{className:ge.input,type:"text",placeholder:"Token name",value:c,onChange:T=>d(T.target.value)}),o.jsx("input",{className:ge.input,type:"password",placeholder:"Value",value:u,onChange:T=>p(T.target.value)})]}),o.jsxs("div",{className:ge.formRow,children:[o.jsx("select",{className:ge.select,value:m,onChange:T=>g(T.target.value),children:EO.map(T=>o.jsx("option",{value:T.value,children:T.label},T.value))}),o.jsx("input",{className:ge.input,type:"text",placeholder:m==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:T=>b(T.target.value)}),o.jsx("button",{className:ge.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const kd=[{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"]}],_1=new Set(kd.map(t=>t.id)),Bb="grackle";function Kp(t){return kd.find(s=>s.id===t)}function DO({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c}){return o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Appearance"}),o.jsx("p",{className:ge.sectionDescription,children:"Choose how Grackle looks across the app."}),o.jsx("div",{className:ge.themeOptions,children:kd.filter(d=>!d.hidden).map(d=>{const u=!!(d.variantLightId&&d.variantDarkId),p=u?t===d.id||t===d.variantLightId||t===d.variantDarkId:t===d.id,m=u&&s===d.variantLightId;return o.jsxs("button",{type:"button",className:`${ge.themeOption} ${p?ge.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(d.id),children:[o.jsxs("span",{className:ge.themeOptionHeader,children:[o.jsxs("span",{children:[o.jsx("span",{className:ge.themeOptionLabel,children:d.label}),o.jsx("span",{className:ge.themeOptionDesc,children:d.description})]}),u&&o.jsxs("span",{className:ge.variantToggle,children:[o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&m?ge.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(d.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(d.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&m,children:"☼"}),o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&!m?ge.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(d.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(d.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!m,children:"☾"})]})]}),d.swatches&&o.jsx("span",{className:ge.themeSwatches,children:d.swatches.map((g,v)=>o.jsx("span",{className:ge.themeSwatch,style:{background:g}},v))})]},d.id)})}),o.jsxs("label",{className:ge.systemToggle,children:[o.jsx("input",{type:"checkbox",checked:r,onChange:d=>c(d.target.checked)}),o.jsx("span",{children:"Match system light/dark preference"})]}),o.jsx("p",{className:ge.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),o.jsxs("p",{className:ge.themeActive,children:["Active theme: ",o.jsx("strong",{children:s})]})]})}function RO({connected:t,environments:s,sessions:i}){const r=s.filter(u=>u.status==="connected").length,c=s.length,d=i.filter(u=>["running","idle"].includes(u.status)).length;return o.jsxs("section",{className:ge.section,"data-testid":"about-panel",children:[o.jsx("h3",{className:ge.sectionTitle,children:"About"}),o.jsx("p",{className:ge.sectionDescription,children:"Connection status and application information."}),o.jsxs("div",{className:ge.aboutGrid,children:[o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Connection"}),o.jsxs("span",{className:ge.aboutValue,children:[o.jsx("span",{className:`${ge.aboutDot} ${t?ge.aboutDotConnected:ge.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Environments"}),o.jsxs("span",{className:ge.aboutValue,children:[r,"/",c," connected"]})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Active Sessions"}),o.jsx("span",{className:ge.aboutValue,children:d})]}),o.jsxs("div",{className:ge.aboutItem,children:[o.jsx("span",{className:ge.aboutLabel,children:"Version"}),o.jsx("span",{className:ge.aboutValue,children:"0.91.1"})]})]})]})}const MO="_container_cddyd_1",IO="_header_cddyd_8",OO="_headerTitle_cddyd_35",LO="_badge_cddyd_44",BO="_headerActions_cddyd_54",zO="_body_cddyd_61",UO="_formContent_cddyd_73",$O="_section_cddyd_85",PO="_label_cddyd_91",VO="_titleInput_cddyd_98",HO="_descriptionTextarea_cddyd_131",qO="_parentContext_cddyd_167",GO="_parentLabel_cddyd_175",FO="_parentName_cddyd_182",ZO="_personaSelect_cddyd_186",KO="_depList_cddyd_220",YO="_depItem_cddyd_226",JO="_depItemSelected_cddyd_248",WO="_noDeps_cddyd_252",XO="_btnPrimary_cddyd_258",QO="_btnGhost_cddyd_289",We={container:MO,header:IO,headerTitle:OO,badge:LO,headerActions:BO,body:zO,formContent:UO,section:$O,label:PO,titleInput:VO,descriptionTextarea:HO,parentContext:qO,parentLabel:GO,parentName:FO,personaSelect:ZO,depList:KO,depItem:YO,depItemSelected:JO,noDeps:WO,btnPrimary:XO,btnGhost:QO};function x1({mode:t,taskId:s,workspaceId:i,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:m,onUpdateTask:g,onEditDone:v,onShowToast:b}){const _=xt(),k=t==="edit",S=k&&s?d.find(me=>me.id===s):void 0,j=k?(S==null?void 0:S.workspaceId)??"":i??"",[N,T]=y.useState(j),C=j||N,E=u.find(me=>me.id===C),D=c??(E==null?void 0:E.environmentId),R=!k&&!i,L=k?(S==null?void 0:S.parentTaskId)??"":r??"",A=L?d.find(me=>me.id===L):void 0,[U,F]=y.useState((S==null?void 0:S.title)??""),[ee,q]=y.useState((S==null?void 0:S.description)??""),[X,ae]=y.useState((S==null?void 0:S.dependsOn)??[]),[Q,re]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[O,Z]=y.useState((S==null?void 0:S.canDecompose)??!1),[se,ue]=y.useState(!1),de=y.useRef(!1);y.useEffect(()=>{k&&S&&!de.current&&(de.current=!0,F(S.title),q(S.description),ae(S.dependsOn),re(S.defaultPersonaId),Z(S.canDecompose))},[k,S]);const Ge=d.filter(me=>me.workspaceId===C&&(!k||me.id!==s)&&me.id!==L),De=U.trim().length>0&&(!k||S!==void 0)&&C.length>0,Ne=me=>{ae(Ue=>Ue.includes(me)?Ue.filter(pt=>pt!==me):[...Ue,me])},Oe=()=>{!De||se||k&&S===void 0||(k&&s?(g(s,U.trim(),ee,X,Q),b==null||b("Task updated","success"),v?v():_(Dn(s,void 0,C,D),{replace:!0})):(ue(!0),m(C,U.trim(),ee,X.length>0?X:void 0,L||void 0,Q,O,()=>{b==null||b("Task created","success"),_(i?vi(i,D):"/tasks",{replace:!0})},me=>{b==null||b(me,"error"),ue(!1)})))},fe=()=>{if(v){v();return}_(k&&s?Dn(s,void 0,C,D):i?vi(i,D):"/tasks")},ye=k?"edit task":L?"child task":"new task";return o.jsxs("div",{className:We.container,children:[o.jsxs("div",{className:We.header,children:[o.jsxs("div",{className:We.headerTitle,children:[o.jsx("span",{className:We.badge,children:ye}),A&&o.jsxs("span",{className:We.parentContext,children:[o.jsx("span",{className:We.parentLabel,children:"Child of"}),o.jsx("span",{className:We.parentName,children:A.title})]})]}),o.jsxs("div",{className:We.headerActions,children:[o.jsx("button",{onClick:Oe,disabled:!De||se,className:We.btnPrimary,"data-testid":"task-edit-save",children:se?"Creating…":k?"Save Changes":"Create"}),o.jsx("button",{onClick:fe,className:We.btnGhost,children:"Cancel"})]})]}),o.jsx("div",{className:We.body,children:o.jsxs("div",{className:We.formContent,children:[R&&o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-workspace",children:"Workspace"}),o.jsxs("select",{id:"task-edit-workspace",value:N,onChange:me=>T(me.target.value),className:We.personaSelect,"data-testid":"task-edit-workspace",children:[o.jsx("option",{value:"",children:"Select a workspace..."}),u.map(me=>o.jsx("option",{value:me.id,children:me.name},me.id))]})]}),o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-title",children:"Title"}),o.jsx("input",{id:"task-edit-title",type:"text",value:U,onChange:me=>F(me.target.value),placeholder:"Task title...",autoFocus:!0,className:We.titleInput,"data-testid":"task-edit-title",onKeyDown:me=>{me.key==="Enter"&&De&&Oe()}})]}),o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-description",children:"Description"}),o.jsx("textarea",{id:"task-edit-description",value:ee,onChange:me=>q(me.target.value),placeholder:"Describe the task... (markdown supported)",className:We.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),o.jsxs("div",{className:We.section,children:[o.jsx("label",{className:We.label,htmlFor:"task-edit-persona",children:"Default Persona"}),o.jsxs("select",{id:"task-edit-persona",value:Q,onChange:me=>re(me.target.value),className:We.personaSelect,"data-testid":"task-edit-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),p.map(me=>o.jsx("option",{value:me.id,children:me.name},me.id))]})]}),!k&&o.jsx("div",{className:We.section,children:o.jsxs("label",{className:We.depItem,"data-testid":"task-edit-can-decompose",children:[o.jsx("input",{type:"checkbox",checked:O,onChange:me=>Z(me.target.checked)}),"Can spawn subtasks"]})}),o.jsxs("div",{className:We.section,children:[o.jsx("div",{className:We.label,children:"Dependencies"}),Ge.length===0?o.jsx("div",{className:We.noDeps,children:"No other tasks in this workspace"}):o.jsx("div",{className:We.depList,children:Ge.map(me=>{const Ue=X.includes(me.id);return o.jsxs("label",{className:`${We.depItem} ${Ue?We.depItemSelected:""}`,"data-testid":`dep-option-${me.id}`,children:[o.jsx("input",{type:"checkbox",checked:Ue,onChange:()=>Ne(me.id)}),me.title,o.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",me.status,")"]})]},me.id)})})]})]})})]})}const eL="_container_legrg_1",tL="_header_legrg_8",nL="_headerTitle_legrg_35",sL="_badge_legrg_44",aL="_headerActions_legrg_54",iL="_body_legrg_61",oL="_formContent_legrg_73",rL="_section_legrg_85",lL="_label_legrg_91",cL="_nameInput_legrg_98",dL="_fieldInput_legrg_131",uL="_adapterSelect_legrg_164",fL="_readOnlyValue_legrg_198",pL="_codespaceSection_legrg_204",mL="_codespaceActions_legrg_210",hL="_creatingHint_legrg_216",gL="_errorHint_legrg_222",vL="_btnPrimary_legrg_235",yL="_btnGhost_legrg_266",oe={container:eL,header:tL,headerTitle:nL,badge:sL,headerActions:aL,body:iL,formContent:oL,section:rL,label:lL,nameInput:cL,fieldInput:dL,adapterSelect:uL,readOnlyValue:fL,codespaceSection:pL,codespaceActions:mL,creatingHint:hL,errorHint:gL,btnPrimary:vL,btnGhost:yL},Gc=1,Fc=65535;function pp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Gc&&s<=Fc}function mp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function bL({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:m}){const[g,v]=y.useState("pick"),[b,_]=y.useState(""),[k,S]=y.useState("");return g==="create"?o.jsxs("div",{className:oe.codespaceSection,children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Repository"}),o.jsx("input",{type:"text",value:b,onChange:j=>_(j.target.value),placeholder:"owner/repo",className:oe.fieldInput,"data-testid":"env-codespace-repo"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Machine Type"}),o.jsx("input",{type:"text",value:k,onChange:j=>S(j.target.value),placeholder:"Machine type (optional)...",className:oe.fieldInput,"data-testid":"env-codespace-machine"})]}),o.jsxs("div",{className:oe.codespaceActions,children:[o.jsx("button",{onClick:()=>{b.trim()&&(m(b.trim(),k.trim()||void 0),v("pick"),_(""),S(""))},disabled:!b.trim(),className:oe.btnPrimary,children:"Create"}),o.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:oe.btnGhost,children:"Cancel"})]})]}):o.jsx("div",{className:oe.codespaceSection,children:o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Codespace"}),!u&&o.jsxs("select",{value:t,onChange:j=>{j.target.value==="__create__"?(v("create"),s("")):(s(j.target.value),j.target.value&&!i.trim()&&r(j.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[o.jsx("option",{value:"",children:"Select a codespace..."}),c.map(j=>o.jsxs("option",{value:j.name,children:[j.name," (",j.repository,") — ",j.state]},j.name)),o.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&o.jsx("span",{className:oe.creatingHint,children:"Creating codespace..."}),u&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:oe.errorHint,children:u}),o.jsx("input",{type:"text",value:t,onChange:j=>s(j.target.value),placeholder:"Or enter codespace name manually...",className:oe.fieldInput,"data-testid":"env-codespace-manual"})]}),d&&!u&&o.jsx("span",{className:oe.errorHint,children:d})]})})}function k1({mode:t,environmentId:s,environments:i,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v,onShowToast:b}){const _=xt(),k=t==="edit",S=k&&s?i.find(fe=>fe.id===s):void 0,[j,N]=y.useState(""),[T,C]=y.useState("local"),[E,D]=y.useState(""),[R,L]=y.useState(""),[A,U]=y.useState(""),[F,ee]=y.useState(""),[q,X]=y.useState(""),[ae,Q]=y.useState(""),[re,O]=y.useState(""),[Z,se]=y.useState(null),ue=y.useCallback(()=>{const fe={};if(T==="local"){if(E.trim()&&(fe.host=E.trim()),R.trim()){const ye=Number(R);Number.isInteger(ye)&&(fe.port=ye)}}else if(T==="ssh"){if(fe.host=E.trim(),A.trim()&&(fe.user=A.trim()),R.trim()){const ye=Number(R);Number.isInteger(ye)&&(fe.sshPort=ye)}F.trim()&&(fe.identityFile=F.trim())}else T==="docker"?(q.trim()&&(fe.image=q.trim()),ae.trim()&&(fe.repo=ae.trim())):T==="codespace"&&(fe.codespaceName=re.trim());return fe},[T,E,R,A,F,q,ae,re]),de=()=>!(!j.trim()||T==="ssh"&&!E.trim()||T==="codespace"&&!re.trim()||(T==="local"||T==="ssh")&&!pp(R)),Ge=()=>{de()&&(r(j.trim(),T,ue()),b==null||b("Environment added successfully","success"),_(To,{replace:!0}))},De=()=>{_(s?yi(s):To)},Ne=y.useCallback((fe,ye)=>{if(!S||!s)return;const me=mp(S.adapterConfig),Ue=ye.trim();Ue?me[fe]=Ue:delete me[fe],c(s,{adapterConfig:me})},[S,s,c]),Oe=y.useCallback((fe,ye)=>{if(!S||!s)return;const me=mp(S.adapterConfig);if(ye.trim()){const Ue=Number(ye);Number.isInteger(Ue)&&Ue>=Gc&&Ue<=Fc&&(me[fe]=Ue)}else delete me[fe];c(s,{adapterConfig:me})},[S,s,c]);if(k){if(!S)return o.jsxs("div",{className:oe.container,children:[o.jsxs("div",{className:oe.header,children:[o.jsx("div",{className:oe.headerTitle,children:o.jsx("span",{className:oe.badge,children:"edit environment"})}),o.jsx("div",{className:oe.headerActions,children:o.jsx("button",{onClick:De,className:oe.btnGhost,children:"Back"})})]}),o.jsx("div",{className:oe.body,children:o.jsx("div",{className:oe.formContent,children:o.jsx("span",{className:oe.readOnlyValue,children:"Environment not found"})})})]});const fe=mp(S.adapterConfig);return o.jsxs("div",{className:oe.container,"data-testid":"env-edit-panel",children:[o.jsxs("div",{className:oe.header,children:[o.jsx("div",{className:oe.headerTitle,children:o.jsx("span",{className:oe.badge,children:"edit environment"})}),o.jsx("div",{className:oe.headerActions,children:o.jsx("button",{onClick:De,className:oe.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),o.jsx("div",{className:oe.body,children:o.jsxs("div",{className:oe.formContent,children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Name"}),o.jsx(en,{value:S.displayName,onSave:ye=>{s&&c(s,{displayName:ye})},validate:ye=>ye.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:Z,onActivate:se,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Adapter Type"}),o.jsx("span",{className:oe.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Host"}),o.jsx(en,{value:String(fe.host??""),onSave:ye=>Ne("host",ye),mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Port"}),o.jsx(en,{value:String(fe.port??""),onSave:ye=>Oe("port",ye),validate:ye=>pp(ye)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Host"}),o.jsx(en,{value:String(fe.host??""),onSave:ye=>Ne("host",ye),validate:ye=>ye.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:se,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"User"}),o.jsx(en,{value:String(fe.user??""),onSave:ye=>Ne("user",ye),mode:"edit",fieldId:"user",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"SSH Port"}),o.jsx(en,{value:String(fe.sshPort??""),onSave:ye=>Oe("sshPort",ye),validate:ye=>pp(ye)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:Z,onActivate:se,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Identity File"}),o.jsx(en,{value:String(fe.identityFile??""),onSave:ye=>Ne("identityFile",ye),mode:"edit",fieldId:"identityFile",activeFieldId:Z,onActivate:se,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),S.adapterType==="docker"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Image"}),o.jsx(en,{value:String(fe.image??""),onSave:ye=>Ne("image",ye),mode:"edit",fieldId:"image",activeFieldId:Z,onActivate:se,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Repo"}),o.jsx(en,{value:String(fe.repo??""),onSave:ye=>Ne("repo",ye),mode:"edit",fieldId:"repo",activeFieldId:Z,onActivate:se,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,children:"Codespace Name"}),o.jsx(en,{value:String(fe.codespaceName??""),onSave:ye=>Ne("codespaceName",ye),validate:ye=>ye.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:Z,onActivate:se,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return o.jsxs("div",{className:oe.container,"data-testid":"env-create-panel",children:[o.jsxs("div",{className:oe.header,children:[o.jsx("div",{className:oe.headerTitle,children:o.jsx("span",{className:oe.badge,children:"new environment"})}),o.jsxs("div",{className:oe.headerActions,children:[o.jsx("button",{onClick:Ge,disabled:!de(),className:oe.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),o.jsx("button",{onClick:De,className:oe.btnGhost,children:"Cancel"})]})]}),o.jsx("div",{className:oe.body,children:o.jsxs("div",{className:oe.formContent,children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-name",children:"Name"}),o.jsx("input",{id:"env-create-name",type:"text",value:j,onChange:fe=>N(fe.target.value),placeholder:"Environment name...",autoFocus:!0,className:oe.nameInput,"data-testid":"env-create-name",onKeyDown:fe=>{fe.key==="Enter"&&de()&&Ge()}})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),o.jsxs("select",{id:"env-create-adapter",value:T,onChange:fe=>{C(fe.target.value),fe.target.value==="codespace"&&d()},className:oe.adapterSelect,"data-testid":"env-create-adapter",children:[o.jsx("option",{value:"local",children:"local"}),o.jsx("option",{value:"ssh",children:"ssh"}),o.jsx("option",{value:"docker",children:"docker"}),o.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),o.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:fe=>D(fe.target.value),placeholder:"Host (optional)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"Port"}),o.jsx("input",{id:"env-create-port",type:"number",min:Gc,max:Fc,value:R,onChange:fe=>L(fe.target.value),placeholder:"Port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-host",children:"Host"}),o.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:fe=>D(fe.target.value),placeholder:"Host (required)...",className:oe.fieldInput,"data-testid":"env-create-host"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-user",children:"User"}),o.jsx("input",{id:"env-create-user",type:"text",value:A,onChange:fe=>U(fe.target.value),placeholder:"User (optional)...",className:oe.fieldInput,"data-testid":"env-create-user"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-port",children:"SSH Port"}),o.jsx("input",{id:"env-create-port",type:"number",min:Gc,max:Fc,value:R,onChange:fe=>L(fe.target.value),placeholder:"SSH port (optional)...",className:oe.fieldInput,"data-testid":"env-create-port"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-identity",children:"Identity File"}),o.jsx("input",{id:"env-create-identity",type:"text",value:F,onChange:fe=>ee(fe.target.value),placeholder:"Identity file (optional)...",className:oe.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-image",children:"Image"}),o.jsx("input",{id:"env-create-image",type:"text",value:q,onChange:fe=>X(fe.target.value),placeholder:"Image (optional)...",className:oe.fieldInput,"data-testid":"env-create-image"})]}),o.jsxs("div",{className:oe.section,children:[o.jsx("label",{className:oe.label,htmlFor:"env-create-repo",children:"Repo"}),o.jsx("input",{id:"env-create-repo",type:"text",value:ae,onChange:fe=>Q(fe.target.value),placeholder:"Repo (optional)...",className:oe.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&o.jsx(bL,{codespaceName:re,onCodespaceNameChange:O,envName:j,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:m,codespaceCreating:g,onCreateCodespace:v})]})})]})}const _L="_group_1iprv_1",xL="_groupTitle_1iprv_8",kL="_shortcutList_1iprv_17",SL="_shortcutRow_1iprv_23",TL="_keys_1iprv_36",wL="_kbd_1iprv_43",jL="_description_1iprv_60",fi={group:_L,groupTitle:xL,shortcutList:kL,shortcutRow:SL,keys:TL,kbd:wL,description:jL},NL=[{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"},{keys:["3"],description:"Switch to Findings 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:"Chat",shortcuts:[{keys:["Enter"],description:"Send message (when input is focused)"}]}];function CL(){return o.jsxs("section",{className:ge.section,"data-testid":"keyboard-shortcuts-panel",children:[o.jsx("h3",{className:ge.sectionTitle,children:"Keyboard Shortcuts"}),o.jsx("p",{className:ge.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),NL.map(t=>o.jsxs("div",{className:fi.group,children:[o.jsx("h4",{className:fi.groupTitle,children:t.title}),o.jsx("div",{className:fi.shortcutList,children:t.shortcuts.map(s=>o.jsxs("div",{className:fi.shortcutRow,children:[o.jsx("span",{className:fi.keys,children:s.keys.map(i=>o.jsx("kbd",{className:fi.kbd,children:i},i))}),o.jsx("span",{className:fi.description,children:s.description})]},s.description))})]},t.title))]})}const EL="_workpadSection_y8nj9_1",AL="_workpadLabel_y8nj9_9",DL="_workpadStatus_y8nj9_17",RL="_workpadSummary_y8nj9_23",ML="_workpadExtra_y8nj9_29",Na={workpadSection:EL,workpadLabel:AL,workpadStatus:DL,workpadSummary:RL,workpadExtra:ML};function IL({workpad:t}){if(!t)return;let s;try{const i=JSON.parse(t);if(i==null||typeof i!="object"||Array.isArray(i))return;s=i}catch{return o.jsxs("div",{className:Na.workpadSection,"data-testid":"workpad-panel",children:[o.jsx("div",{className:Na.workpadLabel,children:"Workpad"}),o.jsx("div",{className:Na.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return o.jsxs("div",{className:Na.workpadSection,"data-testid":"workpad-panel",children:[o.jsx("div",{className:Na.workpadLabel,children:"Workpad"}),s.status&&o.jsx("div",{className:Na.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&o.jsx("div",{className:Na.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&o.jsx("div",{className:Na.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const OL=[{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 LL({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(r,c)=>{const d={...t};r==="claude"?d.claude=c:d[r]=c,s(d)};return o.jsxs("section",{className:ge.section,children:[o.jsx("h3",{className:ge.sectionTitle,children:"Credential Providers"}),o.jsx("p",{className:ge.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),o.jsx("div",{className:ge.tokenList,children:OL.map(r=>o.jsxs("div",{className:ge.tokenRow,children:[o.jsx("span",{className:ge.tokenName,children:r.label}),o.jsx("span",{className:ge.tokenTarget,children:r.description}),o.jsx("select",{className:ge.select,value:t[r.key],onChange:c=>i(r.key,c.target.value),children:r.options.map(c=>o.jsx("option",{value:c.value,children:c.label},c.value))})]},r.key))})]})}const BL="_container_10efq_1",zL="_header_10efq_7",UL="_list_10efq_105",$L="_card_10efq_111",PL="_cardHeader_10efq_125",VL="_cardTitle_10efq_135",HL="_defaultBadge_10efq_141",qL="_cardActions_10efq_155",GL="_description_10efq_160",FL="_meta_10efq_166",ZL="_empty_10efq_212",KL="_typeBadge_10efq_362",Zn={container:BL,header:zL,list:UL,card:$L,cardHeader:PL,cardTitle:VL,defaultBadge:HL,cardActions:qL,description:GL,meta:FL,empty:ZL,typeBadge:KL};function YL({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),m=u?t.find(v=>v.id===u):void 0,g=async v=>{await i(v),p(null)};return o.jsxs("div",{className:Zn.container,children:[o.jsxs("div",{className:Zn.header,children:[o.jsx("h2",{children:"Personas"}),o.jsx(Zs,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?o.jsx("p",{className:Zn.empty,children:"No personas yet. Create one to get started."}):o.jsx("div",{className:Zn.list,children:t.map(v=>{const b=s===v.id,_=v.type==="script";return o.jsxs("div",{className:Zn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>d(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),d(v.id))},children:[o.jsxs("div",{className:Zn.cardHeader,children:[o.jsxs("span",{className:Zn.cardTitle,children:[o.jsx("strong",{children:v.name}),o.jsx("span",{className:Zn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),b&&o.jsx("span",{className:Zn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),o.jsxs("div",{className:Zn.cardActions,onClick:k=>k.stopPropagation(),children:[!b&&o.jsx(Zs,{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"}),o.jsx(Zs,{variant:"ghost",size:"sm",onClick:()=>d(v.id),children:"Edit"}),o.jsx(Zs,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&o.jsx("p",{className:Zn.description,children:v.description}),o.jsxs("div",{className:Zn.meta,children:[v.runtime&&o.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&o.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&o.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),o.jsx(_i,{isOpen:u!==null,title:"Delete Persona?",description:`"${(m==null?void 0:m.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const JL="_container_uy08i_1",WL="_header_uy08i_7",XL="_count_uy08i_13",QL="_presets_uy08i_18",eB="_presetButton_uy08i_24",tB="_filterInput_uy08i_41",nB="_groups_uy08i_53",sB="_group_uy08i_53",aB="_groupHeader_uy08i_68",iB="_groupName_uy08i_77",oB="_groupCount_uy08i_81",rB="_toolList_uy08i_87",lB="_toolItem_uy08i_95",cB="_toolName_uy08i_103",cn={container:JL,header:WL,count:XL,presets:QL,presetButton:eB,filterInput:tB,groups:nB,group:sB,groupHeader:aB,groupName:iB,groupCount:oB,toolList:rB,toolItem:lB,toolName:cB},dB=(()=>{const t=new Map;for(const s of n_){const i=s==="get_version_status"?"version":s.split("_")[0];t.has(i)||t.set(i,[]),t.get(i).push(s)}return[...t.entries()].sort(([s],[i])=>s.localeCompare(i)).map(([s,i])=>({group:s,tools:i.sort()}))})(),uB=[{name:"default",label:"Default",tools:s_},{name:"worker",label:"Worker",tools:lT},{name:"orchestrator",label:"Orchestrator",tools:cT},{name:"admin",label:"Admin",tools:dT}];function zb({selectedTools:t,onChange:s,disabled:i}){const[r,c]=y.useState(""),d=y.useMemo(()=>new Set(t),[t]),u=y.useCallback(v=>{if(i)return;const b=new Set(d);b.has(v)?b.delete(v):b.add(v),s([...b].sort())},[d,s,i]),p=y.useCallback((v,b)=>{if(i)return;const _=new Set(d);for(const k of v)b?_.delete(k):_.add(k);s([..._].sort())},[d,s,i]),m=y.useCallback(v=>{i||s([...v].sort())},[s,i]),g=r.toLowerCase();return o.jsxs("div",{className:cn.container,"data-testid":"mcp-tool-selector",children:[o.jsx("div",{className:cn.header,children:o.jsx("span",{className:cn.count,children:t.length===0?`Using default (${s_.length} tools)`:`${t.length} of ${n_.size} tools selected`})}),o.jsxs("div",{className:cn.presets,"data-testid":"mcp-tool-presets",children:[uB.map(v=>o.jsx("button",{type:"button",className:cn.presetButton,disabled:i,onClick:()=>m(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),o.jsx("button",{type:"button",className:cn.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),o.jsx("input",{type:"text",className:cn.filterInput,placeholder:"Filter tools...",value:r,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),o.jsx("div",{className:cn.groups,children:dB.map(({group:v,tools:b})=>{const _=g?b.filter(S=>S.toLowerCase().includes(g)):b;if(_.length===0)return null;const k=_.every(S=>d.has(S));return o.jsxs("div",{className:cn.group,"data-testid":`tool-group-${v}`,children:[o.jsxs("label",{className:cn.groupHeader,children:[o.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(_,k),disabled:i,"data-testid":`group-toggle-${v}`}),o.jsx("span",{className:cn.groupName,children:v}),o.jsxs("span",{className:cn.groupCount,children:["(",_.filter(S=>d.has(S)).length,"/",_.length,")"]})]}),o.jsx("div",{className:cn.toolList,children:_.map(S=>o.jsxs("label",{className:cn.toolItem,children:[o.jsx("input",{type:"checkbox",checked:d.has(S),onChange:()=>u(S),disabled:i,"data-testid":`tool-${S}`}),o.jsx("span",{className:cn.toolName,children:S})]},S))})]},v)})})]})}const fB="_nav_1bhou_1",pB="_tab_1bhou_24",mB="_tabIcon_1bhou_62",hB="_tabActive_1bhou_68",Rc={nav:fB,tab:pB,tabIcon:mB,tabActive:hB},Gs=[{path:"credentials",label:"Credentials",icon:o.jsx(b2,{size:It})},{path:"personas",label:"Personas",icon:o.jsx(Z2,{size:It})},{path:"appearance",label:"Appearance",icon:o.jsx(O2,{size:It})},{path:"shortcuts",label:"Shortcuts",icon:o.jsx(x2,{size:It})},{path:"about",label:"About",icon:o.jsx(Qp,{size:It})}];function gB(){var u;const t=Ht(),s=xt(),i=y.useRef(null),r=((u=Gs.find(p=>{const m=`${So}/${p.path}`;return t.pathname===m||t.pathname.startsWith(`${m}/`)}))==null?void 0:u.path)??Gs[0].path,c=y.useCallback(p=>{s(`${So}/${p}`)},[s]),d=y.useCallback(p=>{var k,S;const m=(k=i.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!m)return;const g=Array.from(m).findIndex(j=>j===document.activeElement),v=g>=0?g:Gs.findIndex(j=>j.path===r);let b=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),b=(v+1)%Gs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),b=(v-1+Gs.length)%Gs.length;else if(p.key==="Home")p.preventDefault(),b=0;else if(p.key==="End")p.preventDefault(),b=Gs.length-1;else return;const _=Gs[b].path;s(`${So}/${_}`),(S=m[b])==null||S.focus()},[r,s]);return o.jsx("nav",{className:Rc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Gs.map(p=>{const m=p.path===r;return o.jsxs("button",{role:"tab",type:"button","aria-selected":m,tabIndex:m?0:-1,className:`${Rc.tab} ${m?Rc.tabActive:""}`,onClick:()=>c(p.path),children:[o.jsx("span",{className:Rc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function vB({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){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(ny.map(d=>[d,[]]));for(const d of t){const u=el(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),m=r.get(d.id)??[],g=m.length,v=m.filter(S=>S.status==="complete").length;let b;if(u==="paused"&&i){const S=i.get(d.id);S==="idle"?b="Needs input":S==="completed"&&(b="Ready to complete")}const _={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:b},k=c.get(u);k?k.push(_):c.get("not_started").push(_)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return ny.map(d=>{const u=Ia(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const yB="_boardContainer_1c4y1_1",bB="_column_1c4y1_17",_B="_columnHeader_1c4y1_34",xB="_columnIcon_1c4y1_47",kB="_columnLabel_1c4y1_52",SB="_columnCount_1c4y1_57",TB="_cardList_1c4y1_67",wB="_emptyPlaceholder_1c4y1_76",jB="_card_1c4y1_67",NB="_cardHeader_1c4y1_107",CB="_cardStatusIcon_1c4y1_113",EB="_cardTitle_1c4y1_119",AB="_cardBadges_1c4y1_127",DB="_badge_1c4y1_134",RB="_blockedBadge_1c4y1_146",MB="_childBadge_1c4y1_151",IB="_depBadge_1c4y1_155",OB="_parentBadge_1c4y1_159",LB="_pausedSubBadge_1c4y1_166",BB="_personaBadge_1c4y1_170",zB="_envBadge_1c4y1_174",UB="_emptyCta_1c4y1_178",$B="_ctaButton_1c4y1_188",PB="_ctaDescription_1c4y1_204",tt={boardContainer:yB,column:bB,columnHeader:_B,columnIcon:xB,columnLabel:kB,columnCount:SB,cardList:TB,emptyPlaceholder:wB,card:jB,cardHeader:NB,cardStatusIcon:CB,cardTitle:EB,cardBadges:AB,badge:DB,blockedBadge:RB,childBadge:MB,depBadge:IB,parentBadge:OB,pausedSubBadge:LB,personaBadge:BB,envBadge:zB,emptyCta:UB,ctaButton:$B,ctaDescription:PB};function VB({workspaceId:t,environmentId:s,tasks:i,sessions:r,personas:c,environments:d}){const u=xt(),p=y.useMemo(()=>i.filter(_=>_.workspaceId===t),[i,t]),m=y.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=y.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=y.useMemo(()=>{const _=new Map(r.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(d.map(C=>[C.id,C])),j=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const E=_.get(C.latestSessionId);if(E){if(j.set(C.id,E.endReason||E.status),E.personaId){const D=k.get(E.personaId);D&&N.set(C.id,D.name)}if(E.environmentId){const D=S.get(E.environmentId);D&&T.set(C.id,D.displayName)}}}return{sessionStatusByTaskId:j,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),b=y.useMemo(()=>vB({tasks:p,taskStatusById:m,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,m,v]);return p.length===0?o.jsxs("div",{className:tt.emptyCta,"data-testid":"board-empty-cta",children:[o.jsx("button",{className:tt.ctaButton,onClick:()=>u(Si(t,void 0,s)),children:"Create Task"}),o.jsx("div",{className:tt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):o.jsx("div",{className:tt.boardContainer,"data-testid":"board-container",children:b.map(_=>o.jsxs("section",{className:tt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[o.jsxs("div",{className:tt.columnHeader,children:[o.jsx("span",{className:tt.columnIcon,style:{color:_.style.color},children:_.style.icon}),o.jsx("span",{className:tt.columnLabel,children:_.label}),o.jsx("span",{className:tt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),o.jsx("div",{className:tt.cardList,children:_.tasks.length===0?o.jsx("div",{className:tt.emptyPlaceholder,children:"No tasks"}):o.jsx(cs,{mode:"popLayout",children:_.tasks.map(k=>o.jsx(Et.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:o.jsx(HB,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(Dn(k.task.id,void 0,t,s))})},k.task.id))})})]},_.status))})}function HB({boardTask:t,tasksById:s,personaName:i,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:m,pausedSubBadge:g}=t,v=Ia(d.status),b=d.parentTaskId?s.get(d.parentTaskId):void 0;return o.jsxs("div",{className:tt.card,tabIndex:0,role:"button","data-testid":`board-card-${d.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[o.jsxs("div",{className:tt.cardHeader,children:[o.jsx("span",{className:tt.cardStatusIcon,style:{color:v.color},children:v.icon}),o.jsx("span",{className:tt.cardTitle,children:d.title})]}),o.jsxs("div",{className:tt.cardBadges,children:[b&&o.jsx("span",{className:`${tt.badge} ${tt.parentBadge}`,title:b.title,children:b.title}),p>0&&o.jsxs("span",{className:`${tt.badge} ${tt.childBadge}`,children:[m,"/",p]}),u&&o.jsx("span",{className:`${tt.badge} ${tt.blockedBadge}`,children:"blocked"}),d.dependsOn.length>0&&!u&&o.jsx("span",{className:`${tt.badge} ${tt.depBadge}`,children:"dep"}),g&&o.jsx("span",{className:`${tt.badge} ${tt.pausedSubBadge}`,children:g}),i&&o.jsx("span",{className:`${tt.badge} ${tt.personaBadge}`,children:i}),r&&o.jsx("span",{className:`${tt.badge} ${tt.envBadge}`,children:r})]})]})}const qB="_formContent_ymnez_1",GB="_section_ymnez_13",FB="_label_ymnez_19",ZB="_titleInput_ymnez_26",KB="_descriptionTextarea_ymnez_58",YB="_selectField_ymnez_94",JB="_checkboxRow_ymnez_128",WB="_checkboxLabel_ymnez_141",XB="_fieldError_ymnez_146",yt={formContent:qB,section:GB,label:FB,titleInput:ZB,descriptionTextarea:KB,selectField:YB,checkboxRow:JB,checkboxLabel:WB,fieldError:XB};function QB(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.environmentId)??s??"",defaultPersonaId:(t==null?void 0:t.defaultPersonaId)??"",useWorktrees:(t==null?void 0:t.useWorktrees)??!0,workingDirectory:(t==null?void 0:t.workingDirectory)??""}}const e8=100;function t8({values:t,onChange:s,environments:i,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(m,g)=>{s({...t,[m]:g})};return o.jsxs("div",{className:yt.formContent,children:[o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-name",children:"Name"}),o.jsx("input",{id:"ws-name",className:yt.titleInput,type:"text",value:t.name,onChange:m=>p("name",m.target.value),placeholder:"Workspace name",maxLength:e8,autoFocus:u,disabled:d,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-description",children:"Description"}),o.jsx("textarea",{id:"ws-description",className:yt.descriptionTextarea,value:t.description,onChange:m=>p("description",m.target.value),placeholder:"Optional description (Markdown supported)",disabled:d,"data-testid":"workspace-form-description"})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-repo",children:"Repository URL"}),o.jsx("input",{id:"ws-repo",className:yt.titleInput,type:"text",value:t.repoUrl,onChange:m=>p("repoUrl",m.target.value),placeholder:"https://github.com/org/repo",disabled:d,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-environment",children:"Environment"}),o.jsxs("select",{id:"ws-environment",className:yt.selectField,value:t.environmentId,onChange:m=>p("environmentId",m.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[o.jsx("option",{value:"",children:"Select environment…"}),i.map(m=>o.jsx("option",{value:m.id,children:m.displayName||m.id},m.id))]}),(c==null?void 0:c.environmentId)&&o.jsx("span",{className:yt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-persona",children:"Default Persona"}),o.jsxs("select",{id:"ws-persona",className:yt.selectField,value:t.defaultPersonaId,onChange:m=>p("defaultPersonaId",m.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),r.map(m=>o.jsx("option",{value:m.id,children:m.name},m.id))]})]}),o.jsx("div",{className:yt.section,children:o.jsxs("label",{className:yt.checkboxRow,children:[o.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:m=>p("useWorktrees",m.target.checked),disabled:d,"data-testid":"workspace-form-worktrees"}),o.jsx("span",{className:yt.checkboxLabel,children:"Enable worktree isolation"})]})}),o.jsxs("div",{className:yt.section,children:[o.jsx("label",{className:yt.label,htmlFor:"ws-workdir",children:"Working Directory"}),o.jsx("input",{id:"ws-workdir",className:yt.titleInput,type:"text",value:t.workingDirectory,onChange:m=>p("workingDirectory",m.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const S1=y.createContext(void 0),n8=4e3;function s8({children:t}){const[s,i]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{i(p=>p.filter(m=>m.id!==u))},[]),d=y.useCallback((u,p="info",m=n8)=>{const g=`toast-${++r.current}`;i(v=>[...v,{id:g,message:u,variant:p,duration:m}])},[]);return o.jsx(S1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function yn(){const t=y.useContext(S1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Yp="grackle-theme",T1="grackle-prefer-system",w1="(prefers-color-scheme: dark)";let Lr=[],Zc;function hp(){Zc=void 0;for(const t of Lr)t()}function Jp(){return typeof window>"u"?!1:window.matchMedia(w1).matches}function Vr(){if(typeof localStorage>"u")return Bb;try{const t=localStorage.getItem(Yp);if(t!==null&&_1.has(t))return t}catch{}return Bb}function rd(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(T1)==="true"}catch{return!1}}function Wp(t){return kd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function j1(t,s){const i=Kp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?Jp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const r=Wp(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return Jp()?r.variantDarkId:r.variantLightId}return t}function go(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=j1(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&go(Vr(),rd());function a8(){return Zc===void 0&&(Zc={themeId:Vr(),systemDark:Jp(),preferSystem:rd()}),Zc}function i8(t){return Lr=[...Lr,t],()=>{Lr=Lr.filter(s=>s!==t)}}function o8(){const t=y.useSyncExternalStore(i8,a8),{themeId:s,preferSystem:i}=t,r=j1(s,i),c=y.useCallback(u=>{if(_1.has(u)){try{localStorage.setItem(Yp,u)}catch{}go(u,rd(),!0),hp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(T1,u?"true":"false")}catch{}if(u){const p=Vr(),m=Kp(p);if(m!=null&&m.hidden){const g=Wp(p);if(g)try{localStorage.setItem(Yp,g.id)}catch{}}}go(Vr(),u,!0),hp()},[]);return y.useEffect(()=>{go(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(w1),p=()=>{const m=Vr(),g=rd();if(g){const v=Kp(m);if(v!=null&&v.variantDarkId&&v.variantLightId&&go(m,g),v!=null&&v.hidden){const b=Wp(m);b!=null&&b.variantDarkId&&b.variantLightId&&go(m,g)}}hp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:i,setPreferSystem:d}}const N1=y.createContext(void 0);function r8({children:t}){const s=o8();return o.jsx(N1.Provider,{value:s,children:t})}function C1(){const t=y.useContext(N1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const E1=y.createContext(void 0),A1=y.createContext(void 0);function l8({children:t}){const[s,i]=y.useState(void 0),r=y.useCallback(c=>{i(c)},[]);return o.jsx(A1.Provider,{value:r,children:o.jsx(E1.Provider,{value:s,children:t})})}function c8(){return y.useContext(E1)}function d8(){const t=y.useContext(A1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Ym=y.createContext(void 0);function lt(){const t=y.useContext(Ym);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function D1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function R1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function u8(t){return D1(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")}const f8=new Set(["off","subscription","api_key"]),Mc=new Set(["off","on"]);function p8(t){return D1(t)&&f8.has(t.claude)&&Mc.has(t.github)&&Mc.has(t.copilot)&&Mc.has(t.codex)&&Mc.has(t.goose)}function M1(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 I1(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 ho=5e3;function m8(t,s){const i=[];let r=t;const c=new Set;for(;r&&s.has(r)&&!c.has(r);){c.add(r);const d=s.get(r);i.unshift(d),r=d.parentTaskId||void 0}return i}const Qs={label:"Home",url:bi};function h8(t){return t?[Qs,{label:"Settings",url:So},{label:t,url:void 0}]:[Qs,{label:"Settings",url:void 0}]}const Jm={label:"Environments",url:To};function g8(){return[Qs,{label:"Environments",url:void 0}]}function v8(){return[Qs,{label:"New Chat",url:void 0}]}function y8(t){return[Qs,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function b8(t,s,i,r){const c=i.find(u=>u.id===t),d=r.find(u=>u.id===s);return[Qs,Jm,{label:(d==null?void 0:d.displayName)??"Environment",url:yi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function _8(t,s,i,r,c){const d=m8(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,m=p?i.find(k=>k.id===p):void 0,g=s??(m==null?void 0:m.environmentId),v=g?r.find(k=>k.id===g):void 0,b=[Qs];v&&g&&(b.push(Jm),b.push({label:v.displayName,url:yi(g)})),m&&g&&b.push({label:m.name,url:vi(m.id,g)});for(let k=0;k<d.length-1;k++)b.push({label:d[k].title,url:Dn(d[k].id,void 0,p,g)});const _=d[d.length-1];return b.push({label:(_==null?void 0:_.title)??t,url:void 0}),b}const x8={label:"Findings",url:hd};function k8(){return[Qs,{label:"Findings",url:void 0}]}function O1(t,s,i,r,c){const d=[Qs];if(s&&i){const u=r.find(m=>m.id===s),p=c.find(m=>m.id===i);d.push(Jm),p&&d.push({label:p.displayName,url:yi(i)}),u&&d.push({label:u.name,url:vi(s,i)}),d.push({label:"Findings",url:tN(s,i)})}else d.push(x8);return d.push({label:t,url:void 0}),d}function Wm(t){const s=[];for(const i of t){const r=s[s.length-1];i.eventType==="text"&&(r==null?void 0:r.eventType)==="text"?s[s.length-1]={...r,content:r.content+i.content}:s.push(i)}return s}function Ic(t){if(typeof t.id=="string")return t.id;const s=t.data;if(s&&typeof s.toolCallId=="string")return s.toolCallId;const i=t.item;if(i&&typeof i.id=="string")return i.id}function S8(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 i=t.item;if(i&&typeof i.id=="string")return i.id}function Xm(t){const s=new Map;for(const v of t)if(v.raw)try{s.set(v,JSON.parse(v.raw))}catch{}const i=new Map;for(const v of t){if(v.eventType!=="tool_use")continue;const b=s.get(v),_=b?Ic(b):void 0;if(_)try{const k=JSON.parse(v.content);i.set(_,{tool:k.tool,args:k.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,b)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),k=_?S8(_):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;r.add(k),c.add(b);let j;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(j=T.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:j}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const b=s.get(d[v]),_=b?Ic(b):void 0;_&&r.has(_)||u.push(v)}const p=[];for(let v=0;v<d.length;v++)d[v].eventType!=="tool_result"||c.has(v)||p.push(v);let m=0;for(const v of u){for(;m<p.length&&p[m]<v;)m++;if(m>=p.length)break;const b=p[m];if(b!==v+1)continue;const _=d[v],k=d[b];let S;try{const j=JSON.parse(_.content);S={tool:j.tool,args:j.args}}catch{}if(S){let j;const N=k.content.trim();if(N.startsWith("{"))try{const E=JSON.parse(N);typeof E.detailedContent=="string"&&(j=E.detailedContent)}catch{}d[b]={...k,toolUseCtx:{...S,detailedResult:j}},c.add(b);const T=s.get(_),C=T?Ic(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(_,{...T??{},__seqId:`__seq_${v}`})),m++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const b=s.get(v);if(!b)return!0;const _=Ic(b);if(_&&r.has(_))return!1;const k=b.__seqId;return!(k&&r.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let b=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){b=!0;break}b&&(g[v]={...g[v],settled:!0})}return g}function T8(t,s,i){const r=t.filter(m=>m.status==="running"||m.status==="idle"||m.status==="waiting").length,c=L1(s),d=s.filter(m=>Xp(m,c)).length,u=s.filter(m=>m.status==="paused"||m.status==="failed"||Xp(m,c)).length,p=i.filter(m=>m.status==="disconnected"||m.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function L1(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function Xp(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function w8(t,s){var u;const i=new Map;for(const p of s)i.set(p.id,p);const r=L1(t),c=[];for(const p of t){const m=p.workspaceId?((u=i.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:m}):Xp(p,r)?c.push({task:p,reason:"blocked",workspaceName:m}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:m})}const d={failed:0,blocked:1,paused:2};return c.sort((p,m)=>(d[p.reason]??3)-(d[m.reason]??3)),c}function j8(t,s){const i=new Map;for(const r of s)i.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=i.get(r.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function N8(t,s,i){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 vs=[{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
275
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
276
- const header = req.headers.authorization;
277
- if (!header?.startsWith("Bearer ")) {
278
- res.status(401).json({ error: "Missing token" });
279
- return;
280
- }
281
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
282
- req.user = decoded;
283
- next();
284
- }
285
- \`\`\``,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
286
- CREATE TABLE audit_log (
287
- id BIGSERIAL PRIMARY KEY,
288
- user_id UUID REFERENCES users(id),
289
- action TEXT NOT NULL,
290
- entity_type TEXT NOT NULL,
291
- entity_id TEXT NOT NULL,
292
- old_value JSONB,
293
- new_value JSONB,
294
- ip_address INET,
295
- created_at TIMESTAMPTZ DEFAULT now()
296
- );
297
- \`\`\``,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}],Ca=[{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"}],C8=new Map(vs.map(t=>[t.id,t]));function gp(t){const s=C8.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Ub={"kn-auth-flow":{node:gp("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:gp("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:gp("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"}]}},E8=[{id:"env-local-01",displayName:"Local Dev",adapterType:"local",adapterConfig:"{}",status:"connected",bootstrapped:!0},{id:"env-docker-01",displayName:"Docker Sandbox",adapterType:"docker",adapterConfig:'{"image":"node:20"}',status:"connected",bootstrapped:!0},{id:"env-cs-01",displayName:"GitHub Codespace",adapterType:"codespace",adapterConfig:'{"codespaceName":"my-codespace"}',status:"connected",bootstrapped:!0},{id:"env-remote-01",displayName:"Staging (SSH)",adapterType:"ssh",adapterConfig:'{"host":"192.168.1.10","user":"deploy","sshPort":22}',status:"disconnected",bootstrapped:!1}],A8=[{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,costUsd:.41},{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",inputTokens:42600,outputTokens:8100,costUsd:.22},{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",inputTokens:31400,outputTokens:9800,costUsd:.18},{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,costUsd:.31},{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",inputTokens:18900,outputTokens:4500,costUsd:.1},{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,costUsd:.38}],D8=[{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.
298
- Project: acme/alpha — Node.js + Express REST API
299
- 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";
300
- import type { Request, Response, NextFunction } from "express";
301
-
302
- export function requireAuth(req: Request, res: Response, next: NextFunction): void {
303
- if (!req.session?.userId) {
304
- res.status(401).json({ error: "Not authenticated" });
305
- return;
306
- }
307
- next();
308
- }`,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) {
309
- src/routes/login.ts:18: req.session.userId = user.id;
310
- src/routes/login.ts:19: req.session.role = user.role;
311
- 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_usd:.21})},{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";
312
- import bcrypt from "bcrypt";
313
- import { db } from "../db.js";
314
-
315
- const router = Router();
316
-
317
- router.post("/login", async (req, res) => {
318
- const { email, password } = req.body;
319
- const user = await db.users.findByEmail(email);
320
- if (!user || !await bcrypt.compare(password, user.passwordHash)) {
321
- return res.status(401).json({ error: "Invalid credentials" });
322
- }
323
- req.session.userId = user.id;
324
- req.session.role = user.role;
325
- res.json({ ok: true });
326
- });
327
-
328
- 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.
329
- Project: acme/alpha — Node.js + Express REST API
330
- Task: Implement auth middleware using JWT tokens
331
-
332
- 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:"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
333
- src/routes/login.ts
334
- 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
335
-
336
- 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";
337
- import type { Request, Response, NextFunction } from "express";
338
-
339
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
340
-
341
- export interface JwtPayload {
342
- userId: string;
343
- role: string;
344
- iat: number;
345
- exp: number;
346
- }
347
-
348
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
349
- const header = req.headers.authorization;
350
- if (!header?.startsWith("Bearer ")) {
351
- res.status(401).json({ error: "Missing or malformed token" });
352
- return;
353
- }
354
- try {
355
- const decoded = jwt.verify(header.slice(7), JWT_SECRET) as JwtPayload;
356
- req.user = decoded;
357
- next();
358
- } catch (err) {
359
- if (err instanceof jwt.TokenExpiredError) {
360
- res.status(401).json({ error: "Token expired" });
361
- } else {
362
- res.status(403).json({ error: "Invalid token" });
363
- }
364
- }
365
- }
366
- `}}),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.
367
-
368
- The new login flow will:
369
- 1. Validate credentials (unchanged)
370
- 2. Generate a JWT with \`userId\` and \`role\` claims
371
- 3. Return the token in the response body
372
- 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";
373
- import bcrypt from "bcrypt";
374
- import jwt from "jsonwebtoken";
375
- import crypto from "node:crypto";
376
- import { db } from "../db.js";
377
-
378
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
379
- const ACCESS_TOKEN_EXPIRY = "24h";
380
- const REFRESH_TOKEN_BYTES = 48;
381
-
382
- const router = Router();
383
-
384
- router.post("/login", async (req, res) => {
385
- const { email, password } = req.body;
386
- const user = await db.users.findByEmail(email);
387
- if (!user || !(await bcrypt.compare(password, user.passwordHash))) {
388
- return res.status(401).json({ error: "Invalid credentials" });
389
- }
390
-
391
- const accessToken = jwt.sign(
392
- { userId: user.id, role: user.role },
393
- JWT_SECRET,
394
- { expiresIn: ACCESS_TOKEN_EXPIRY },
395
- );
396
-
397
- const refreshToken = crypto.randomBytes(REFRESH_TOKEN_BYTES).toString("hex");
398
- await db.refreshTokens.create({ userId: user.id, token: refreshToken });
399
-
400
- res.json({ accessToken, refreshToken, expiresIn: ACCESS_TOKEN_EXPIRY });
401
- });
402
-
403
- export default router;
404
- `}}),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
405
- PASS src/routes/__tests__/protected.test.ts
406
- FAIL src/middleware/__tests__/auth.test.ts
407
- x should reject missing session (12ms)
408
- x should allow valid session (8ms)
409
-
410
- 2 failed, 12 passed, 14 total
411
-
412
- 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.
413
-
414
- 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";
415
- import jwt from "jsonwebtoken";
416
- import { verifyToken } from "../auth.js";
417
- import { createMockReqRes } from "../../test-utils/mock-express.js";
418
-
419
- const SECRET = "test-secret";
420
- process.env.JWT_SECRET = SECRET;
421
-
422
- describe("verifyToken", () => {
423
- it("should reject requests without Authorization header", () => {
424
- const { req, res, next } = createMockReqRes();
425
- verifyToken(req, res, next);
426
- expect(res.status).toHaveBeenCalledWith(401);
427
- });
428
-
429
- it("should reject expired tokens", () => {
430
- const token = jwt.sign({ userId: "u1", role: "user" }, SECRET, { expiresIn: "-1h" });
431
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
432
- verifyToken(req, res, next);
433
- expect(res.status).toHaveBeenCalledWith(401);
434
- });
435
-
436
- it("should accept valid tokens and attach user to request", () => {
437
- const token = jwt.sign({ userId: "u1", role: "admin" }, SECRET, { expiresIn: "1h" });
438
- const { req, res, next } = createMockReqRes({ authorization: \`Bearer \${token}\` });
439
- verifyToken(req, res, next);
440
- expect(next).toHaveBeenCalled();
441
- expect(req.user).toMatchObject({ userId: "u1", role: "admin" });
442
- });
443
- });
444
- `}}),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
445
- PASS src/routes/__tests__/protected.test.ts
446
- PASS src/middleware/__tests__/auth.test.ts
447
-
448
- Test Suites: 3 passed, 3 total
449
- 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_usd:.22})},{sessionId:"sess-001",eventType:"text",timestamp:"2026-02-27T08:15:42Z",content:`All 14 tests pass. Here's a summary of the changes:
450
-
451
- ### Changes made
452
-
453
- | File | Action |
454
- |------|--------|
455
- | \`src/middleware/auth.ts\` | Rewrote to verify JWT Bearer tokens |
456
- | \`src/routes/login.ts\` | Now issues JWT access + refresh tokens |
457
- | \`src/routes/protected.ts\` | Updated to read \`req.user\` from JWT payload |
458
- | \`src/middleware/__tests__/auth.test.ts\` | Updated tests for JWT verification |
459
-
460
- ### Key decisions
461
- - **Access token expiry**: 24 hours (configurable via \`JWT_SECRET\` env var)
462
- - **Refresh tokens**: 48-byte random hex, stored in DB
463
- - **Error handling**: Distinguishes expired tokens (401) from invalid tokens (403)`},{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.
464
- Project: acme/alpha — Node.js + Express REST API
465
- 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";
466
- import bcrypt from "bcrypt";
467
- import { db } from "../db.js";
468
- import { validateEmail, validatePassword } from "../utils/validators.js";
469
-
470
- const SALT_ROUNDS = 12;
471
- const router = Router();
472
-
473
- router.post("/register", async (req, res) => {
474
- const { name, email, password } = req.body;
475
-
476
- if (!name || !email || !password) {
477
- return res.status(400).json({ error: "Missing required fields" });
478
- }
479
- if (!validateEmail(email)) {
480
- return res.status(400).json({ error: "Invalid email format" });
481
- }
482
- if (!validatePassword(password)) {
483
- return res.status(400).json({ error: "Password too weak" });
484
- }
485
-
486
- const existing = await db.users.findByEmail(email);
487
- if (existing) {
488
- return res.status(409).json({ error: "Email already registered" });
489
- }
490
-
491
- const passwordHash = await bcrypt.hash(password, SALT_ROUNDS);
492
- const user = await db.users.create({ name, email, passwordHash });
493
- res.status(201).json({ id: user.id, name: user.name, email: user.email });
494
- });
495
-
496
- 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:
497
-
498
- 1. **Happy path** - valid registration
499
- 2. **Missing fields** - each required field missing
500
- 3. **Invalid email** - malformed email format
501
- 4. **Weak password** - password validation failure
502
- 5. **Duplicate email** - conflict with existing user
503
- 6. **SQL injection** - malicious email input
504
- 7. **XSS payload** - HTML in the name field
505
- 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
506
- POST /api/register
507
- ✓ should register a valid user (28ms)
508
- ✓ should reject missing name (4ms)
509
- ✓ should reject missing email (3ms)
510
- ✓ should reject missing password (3ms)
511
- ✓ should reject invalid email format (5ms)
512
- ✓ should reject weak password (4ms)
513
- ✓ should reject duplicate email (12ms)
514
- ✓ should sanitize HTML in name field (6ms)
515
-
516
- 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_usd:.18})},{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.
517
- Project: acme/alpha — Node.js + Express + PostgreSQL
518
- 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 (
519
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
520
- name TEXT NOT NULL,
521
- email TEXT UNIQUE NOT NULL,
522
- password_hash TEXT NOT NULL,
523
- role TEXT DEFAULT 'user',
524
- created_at TIMESTAMPTZ DEFAULT now(),
525
- updated_at TIMESTAMPTZ DEFAULT now()
526
- );
527
-
528
- CREATE TABLE sessions (
529
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
530
- user_id UUID REFERENCES users(id),
531
- expires_at TIMESTAMPTZ NOT NULL,
532
- created_at TIMESTAMPTZ DEFAULT now()
533
- );`,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
534
- -- Add audit logging and user activity tracking
535
-
536
- BEGIN;
537
-
538
- -- 1. Add last_login_at to users
539
- ALTER TABLE users ADD COLUMN last_login_at TIMESTAMPTZ;
540
-
541
- -- 2. Index for session cleanup queries
542
- CREATE INDEX CONCURRENTLY idx_sessions_expires_at ON sessions (expires_at);
543
-
544
- -- 3. Audit log table
545
- CREATE TABLE audit_log (
546
- id BIGSERIAL PRIMARY KEY,
547
- user_id UUID REFERENCES users(id),
548
- action TEXT NOT NULL,
549
- entity_type TEXT NOT NULL,
550
- entity_id TEXT NOT NULL,
551
- old_value JSONB,
552
- new_value JSONB,
553
- ip_address INET,
554
- created_at TIMESTAMPTZ DEFAULT now()
555
- );
556
-
557
- CREATE INDEX idx_audit_log_user ON audit_log (user_id);
558
- CREATE INDEX idx_audit_log_entity ON audit_log (entity_type, entity_id);
559
- CREATE INDEX idx_audit_log_created ON audit_log (created_at);
560
-
561
- COMMIT;
562
- `}}),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
563
- - ALTER TABLE users ADD COLUMN last_login_at
564
- - CREATE INDEX CONCURRENTLY idx_sessions_expires_at
565
- - CREATE TABLE audit_log
566
- - 3 indexes on audit_log
567
-
568
- WARNING: CREATE INDEX CONCURRENTLY cannot run inside a transaction block.
569
- 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_usd:.31})},{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.
570
- Project: acme/data-pipeline — ETL pipelines for analytics
571
- 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
572
- src/middleware/error-handler.ts
573
- src/middleware/logger.ts
574
- 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:
575
-
576
- - Uses an **in-memory token bucket** per client IP
577
- - Supports configurable rate (requests/second) and burst size
578
- - Returns \`429 Too Many Requests\` with \`Retry-After\` header
579
- - Has a Redis adapter option for multi-instance deployments
580
-
581
- 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.
582
- Project: acme/alpha — Node.js + Express + PostgreSQL
583
- 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";
584
-
585
- const pool = new pg.Pool({
586
- connectionString: process.env.DATABASE_URL,
587
- max: 20,
588
- idleTimeoutMillis: 30000,
589
- });
590
-
591
- 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:
592
-
593
- 1. **A \`PoolManager\` class** that creates and caches per-tenant pools
594
- 2. **Configurable limits** per tenant (max connections, idle timeout)
595
- 3. **Health checks** with automatic pool eviction for unhealthy connections
596
- 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";
597
- src/routes/users.ts:2:import { pool } from "../db/pool.js";
598
- src/routes/register.ts:3:import { pool } from "../db/pool.js";
599
- src/routes/admin.ts:4:import { pool } from "../db/pool.js";
600
- src/services/billing.ts:2:import { pool } from "../db/pool.js";
601
- 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:
602
- 1. Create a new \`PoolManager\` abstraction
603
- 2. Update all consumers to use \`getPool(tenantId)\` instead of the global pool
604
- 3. Add middleware to extract tenant ID from the request
605
-
606
- 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_usd:.38})},{sessionId:"sess-005",eventType:"status",timestamp:"2026-02-27T06:30:01Z",content:"suspended"}],R8=[{id:"proj-alpha",name:"Workspace Alpha",description:"Core platform API and authentication services",repoUrl:"https://github.com/acme/alpha",environmentId:"env-local-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",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",environmentId:"env-docker-01",status:"active",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",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:"",environmentId:"env-local-01",status:"archived",workingDirectory:"",useWorktrees:!0,defaultPersonaId:"",createdAt:"2025-11-20T09:00:00Z",updatedAt:"2025-11-20T09:00:00Z"}],M8=[{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,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"}})},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,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"}}})},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""},{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,defaultPersonaId:"",workpad:""}],Oc=[{id:"find-001",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"architecture",title:"Auth middleware is tightly coupled to Express",content:"The current auth middleware directly references Express Request/Response types. Consider extracting a framework-agnostic token verification layer so we can reuse it in the WebSocket auth path.",tags:["auth","decoupling","middleware"],createdAt:"2026-02-27T08:16:00Z"},{id:"find-002",workspaceId:"proj-alpha",taskId:"task-003",sessionId:"sess-002",category:"api",title:"Missing pagination on GET /api/users",content:"The users endpoint returns all rows without limit/offset. For datasets over 10k rows this will cause timeouts. Recommend cursor-based pagination with a default page size of 50.",tags:["api","pagination","performance"],createdAt:"2026-02-27T07:31:00Z"},{id:"find-003",workspaceId:"proj-alpha",taskId:"task-005",sessionId:"sess-003",category:"bug",title:"Race condition in session cleanup",content:"When two requests hit /api/logout concurrently, the second call throws a 500 because the session row has already been deleted. Needs an idempotent DELETE or a conditional check.",tags:["bug","concurrency","sessions"],createdAt:"2026-02-26T22:50:00Z"},{id:"find-004",workspaceId:"proj-alpha",taskId:"task-004",sessionId:"",category:"decision",title:"Chose pg-pool over knex connection pool",content:"pg-pool gives us direct control over idle timeout, max connections, and health check queries. Knex wraps pg-pool anyway and adds overhead we don't need since we write raw SQL.",tags:["database","decision","postgres"],createdAt:"2026-02-23T11:30:00Z"},{id:"find-005",workspaceId:"proj-alpha",taskId:"",sessionId:"",category:"dependency",title:"jsonwebtoken has 3 high-severity CVEs",content:"The jsonwebtoken package (v8.x) has known vulnerabilities. Consider migrating to jose which is maintained, supports ESM, and covers the same JWS/JWE surface area with zero dependencies.",tags:["security","dependency","jwt"],createdAt:"2026-02-27T08:20:00Z"},{id:"find-006",workspaceId:"proj-alpha",taskId:"task-001",sessionId:"sess-001",category:"pattern",title:"Consistent error response shape",content:"All error responses should follow the shape `{ error: string, code: string, details?: unknown }`. Currently some routes return `{ message: string }` and others return `{ error: string }`.",tags:["api","consistency","error-handling"],createdAt:"2026-02-27T08:17:00Z"},{id:"find-007",workspaceId:"proj-beta",taskId:"task-007",sessionId:"sess-004",category:"architecture",title:"Watermark storage should be pluggable",content:"The incremental load watermarks are currently stored in a local SQLite file. For production multi-worker scenarios, this needs to be backed by a shared store (Redis or Postgres).",tags:["architecture","pipeline","scalability"],createdAt:"2026-02-27T09:05:00Z"}],I8=[{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:""}],O8=[{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","finding_post","finding_list","knowledge_search","knowledge_create_node","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. Posts findings for issues discovered.",systemPrompt:"You are a meticulous code reviewer. Check for security vulnerabilities, performance issues, and style consistency. Post findings for 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:["finding_post","finding_list","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 posts a findings 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));
607
- for (const f of files) {
608
- const eslintResult = await host.exec("npx", ["eslint", "--fix", f.filename]);
609
- if (eslintResult.exitCode !== 0) {
610
- env.findings.push({ category: "lint", title: \`Lint issues in \${f.filename}\`, content: eslintResult.stderr });
611
- }
612
- const prettierResult = await host.exec("npx", ["prettier", "--write", f.filename]);
613
- if (prettierResult.exitCode !== 0) {
614
- env.findings.push({ category: "format", title: \`Prettier issues in \${f.filename}\`, content: prettierResult.stderr });
615
- }
616
- }
617
- env.findings.push({ category: "summary", title: "Lint & format pass complete", content: \`Ran ESLint and Prettier on \${files.length} files\` });`,allowedMcpTools:[]}],L8={"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 Ee(t){return new Date(Date.now()+t).toISOString()}const $b=[{label:"API Refactor",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll start by finding all API route files that need refactoring."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1600),content:`src/routes/users.ts
618
- src/routes/auth.ts
619
- src/routes/billing.ts
620
- src/routes/admin.ts
621
- src/routes/health.ts`,raw:JSON.stringify({tool_use_id:"stream-a-01"})}},{delayMs:2200,event:{eventType:"text",timestamp:Ee(2200),content:`Found 5 route files. Let me refactor users.ts to use Express Router with a middleware chain.
622
-
623
- \`\`\`typescript
624
- const router = Router();
625
- router.use(authenticate);
626
- router.use(validateBody);
627
-
628
- router.get("/", listUsers);
629
- router.post("/", createUser);
630
- router.get("/:id", getUser);
631
- router.put("/:id", updateUser);
632
- router.delete("/:id", deleteUser);
633
- \`\`\``}},{delayMs:3200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(4e3),content:` PASS src/routes/__tests__/users.test.ts
634
- PASS src/routes/__tests__/auth.test.ts
635
- PASS src/routes/__tests__/billing.test.ts
636
-
637
- Test Suites: 3 passed, 3 total
638
- Tests: 22 passed, 22 total`,raw:JSON.stringify({tool_use_id:"stream-a-02"})}},{delayMs:4500,event:{eventType:"usage",timestamp:Ee(4500),content:JSON.stringify({input_tokens:28400,output_tokens:7200,cost_usd:.15})}},{delayMs:5e3,event:{eventType:"text",timestamp:Ee(5e3),content:"All 22 tests pass. The route refactoring is complete."}},{delayMs:5500,event:{eventType:"status",timestamp:Ee(5500),content:"completed"}}]},{label:"Database Migration",pauseForInput:!0,pauseAfterStep:4,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Scanning the current database schema to plan the migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1800),content:`CREATE TABLE users (
639
- id UUID PRIMARY KEY,
640
- name TEXT NOT NULL,
641
- email TEXT UNIQUE NOT NULL,
642
- created_at TIMESTAMPTZ DEFAULT now()
643
- );
644
-
645
- CREATE TABLE sessions (
646
- id UUID PRIMARY KEY,
647
- user_id UUID REFERENCES users(id),
648
- expires_at TIMESTAMPTZ NOT NULL
649
- );`,raw:JSON.stringify({tool_use_id:"stream-b-01"})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(2600),content:`I found the tables to modify:
650
- - **users**: add column \`last_login_at\`
651
- - **sessions**: add index on \`expires_at\`
652
- - **audit_log**: new table
653
-
654
- This migration will add a NOT NULL column to the \`users\` table. The table has **50,000+ rows** which may lock the table briefly.
655
-
656
- Please confirm to proceed.`}}],resumeSteps:[{delayMs:500,event:{eventType:"text",timestamp:Ee(0),content:"Proceeding with migration."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1700),content:`Applying 002_add_last_login.sql... done
657
- Applying 003_sessions_index.sql... done
658
- Applying 004_audit_log.sql... done
659
-
660
- 3 migrations applied successfully.`,raw:JSON.stringify({tool_use_id:"stream-b-02"})}},{delayMs:2800,event:{eventType:"text",timestamp:Ee(2300),content:"All 3 migrations applied successfully. The `audit_log` table is ready."}},{delayMs:3200,event:{eventType:"status",timestamp:Ee(2700),content:"completed"}}]},{label:"Test Writer",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"I'll generate tests for `src/services/billing.ts`. Let me read the implementation first."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1800),content:`import { StripeClient } from "./stripe-client.js";
661
- import type { Invoice, LineItem } from "../types/billing.js";
662
-
663
- export class BillingService {
664
- constructor(private stripe: StripeClient) {}
665
-
666
- async calculateMonthlyTotal(userId: string): Promise<number> {
667
- const invoices = await this.stripe.listInvoices(userId);
668
- return invoices.reduce((sum, inv) => sum + inv.total, 0);
669
- }
670
- }`,raw:JSON.stringify({tool_use_id:"stream-c-01"})}},{delayMs:2400,event:{eventType:"text",timestamp:Ee(2400),content:"The billing service imports from `./stripe-client.js`. Let me check if that module exists."}},{delayMs:2800,event:{eventType:"tool_use",timestamp:Ee(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:Ee(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:Ee(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:Ee(4e3),content:"failed"}}]},{label:"Fix Auth Bug",pauseForInput:!1,steps:[{delayMs:0,event:{eventType:"status",timestamp:Ee(0),content:"running"}},{delayMs:600,event:{eventType:"text",timestamp:Ee(600),content:"Let me investigate the authentication bug..."}},{delayMs:1200,event:{eventType:"tool_use",timestamp:Ee(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:Ee(1800),content:`import jwt from "jsonwebtoken";
671
- import type { Request, Response, NextFunction } from "express";
672
-
673
- const JWT_SECRET = process.env.JWT_SECRET || "change-me";
674
-
675
- export function verifyToken(req: Request, res: Response, next: NextFunction): void {
676
- const header = req.headers.authorization;
677
- if (!header?.startsWith("Bearer ")) {
678
- res.status(401).json({ error: "Missing token" });
679
- return;
680
- }
681
- try {
682
- const decoded = jwt.verify(header.slice(7), JWT_SECRET);
683
- if (decoded.exp > Date.now() / 1000) {
684
- res.status(403).json({ error: "Token expired" });
685
- return;
686
- }
687
- req.user = decoded;
688
- next();
689
- } catch {
690
- res.status(403).json({ error: "Invalid token" });
691
- }
692
- }`,raw:JSON.stringify({tool_use_id:"tool-mock-001",is_error:!1})}},{delayMs:2600,event:{eventType:"text",timestamp:Ee(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:Ee(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:Ee(4e3),content:"File updated successfully",raw:JSON.stringify({tool_use_id:"tool-mock-002",is_error:!1})}},{delayMs:4600,event:{eventType:"tool_use",timestamp:Ee(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:Ee(5800),content:`[exit 0] > jest --grep auth
693
-
694
- PASS src/auth.test.ts
695
- ✓ validates JWT token (12ms)
696
- ✓ rejects expired token (3ms)
697
- ✓ handles missing header (1ms)
698
-
699
- Tests: 3 passed, 3 total
700
- Time: 1.234s`,raw:JSON.stringify({tool_use_id:"tool-mock-003",is_error:!1})}},{delayMs:6400,event:{eventType:"tool_use",timestamp:Ee(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:Ee(7e3),content:`src/middleware/auth.ts:14: if (decoded.exp < Date.now() / 1000) {
701
- 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:Ee(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:Ee(8400),content:JSON.stringify({input_tokens:42600,output_tokens:1850,cost_usd:.12})}},{delayMs:8800,event:{eventType:"status",timestamp:Ee(8800),content:"completed"}}]}],Pb=400;function B8({children:t}){const[s,i]=y.useState(E8),[r,c]=y.useState(A8),[d,u]=y.useState(D8),[p,m]=y.useState(void 0),[g,v]=y.useState(R8),[b,_]=y.useState(M8),[k,S]=y.useState(Oc),[j,N]=y.useState(void 0),T=!1,[C,E]=y.useState(I8),[D,R]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[L,A]=y.useState(O8),[U]=y.useState(L8),[F,ee]=y.useState(""),[q,X]=y.useState(vs),[ae,Q]=y.useState(Ca),[re,O]=y.useState(void 0),[Z,se]=y.useState(void 0),[ue,de]=y.useState(""),Ge=y.useRef(void 0),De=y.useRef(0),Ne=y.useRef(0),Oe=y.useRef(new Set),fe=y.useRef(new Map),ye=y.useRef(b);ye.current=b;const me=y.useRef(new Map),Ue=y.useRef(new Map),pt=y.useCallback(P=>(De.current+=1,`mock-${P}-${String(De.current).padStart(3,"0")}`),[]),bn=y.useCallback(()=>{const P=$b[Ne.current%$b.length];return Ne.current+=1,P},[]),ie=y.useCallback((P,ne,le)=>{const pe=setTimeout(()=>{var he;Oe.current.delete(pe),le&&((he=fe.current.get(le))==null||he.delete(pe)),P()},ne);Oe.current.add(pe),le&&(fe.current.has(le)||fe.current.set(le,new Set),fe.current.get(le).add(pe))},[]),W=y.useCallback(P=>{const ne=fe.current.get(P);ne&&(ne.forEach(le=>{clearTimeout(le),Oe.current.delete(le)}),fe.current.delete(P))},[]),ct=y.useCallback((P,ne,le)=>{c(pe=>pe.map(he=>he.id===P?{...he,status:ne,...le!==void 0?{endReason:le}:{}}:he))},[]),Le=y.useCallback(P=>{u(ne=>[...ne,P])},[]),$t=y.useCallback((P,ne,le)=>{ne.forEach((pe,he)=>{ie(()=>{const $e={sessionId:P,...pe.event,timestamp:new Date().toISOString()};if(Le($e),pe.event.eventType==="status"){const ke=M1(pe.event.content),Re=I1(pe.event.content);ct(P,ke,Re)}he===ne.length-1&&le&&le()},pe.delayMs,P)})},[ie,Le,ct]),dt=y.useCallback(async(P,ne,le,pe)=>{console.log("[MockGrackle] spawn",{environmentId:P,prompt:ne,runtime:pe});const he=pt("sess"),$e={id:he,environmentId:P,runtime:pe||"claude-code",status:"running",prompt:ne,startedAt:new Date().toISOString()};c(Re=>[...Re,$e]),m(he);const ke=bn();if(console.log(`[MockGrackle] Playing scenario: ${ke.label}`),ke.pauseForInput){const Re=ke.pauseAfterStep??ke.steps.length-1,Ze=ke.steps.slice(0,Re+1),ut=Ze.length>0?Ze[Ze.length-1].delayMs:0;$t(he,Ze),ie(()=>{ct(he,"idle"),Le({sessionId:he,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ut+Pb,he),ke.resumeSteps&&me.current.set(he,ke.resumeSteps)}else $t(he,ke.steps)},[pt,bn,$t,ie,ct,Le]),ta=y.useCallback(async P=>{console.log("[MockGrackle] kill",P),W(P),me.current.delete(P),ct(P,"stopped","killed"),Le({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(ne=>ne.map(le=>le.latestSessionId===P&&le.status==="working"?{...le,status:"not_started"}:le))},[W,ct,Le]),ks=y.useCallback(async P=>{console.log("[MockGrackle] stopGraceful",P),W(P),me.current.delete(P),ct(P,"stopped","terminated"),Le({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(ne=>ne.map(le=>le.latestSessionId===P&&le.status==="working"?{...le,status:"not_started"}:le))},[W,ct,Le]),_n=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Ss=y.useCallback(async P=>{console.log("[MockGrackle] loadSessionEvents",P)},[]),us=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),wi=y.useCallback(async(P,ne,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createWorkspace",{name:P,description:ne});const ut={id:pt("proj"),name:P,description:ne||"",repoUrl:le||"",environmentId:pe||"",status:"active",workingDirectory:ke||"",useWorktrees:$e??!0,defaultPersonaId:he||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Ke=>[...Ke,ut]),Re&&Re()},[pt]),Wn=y.useCallback(async P=>{console.log("[MockGrackle] archiveWorkspace",P),v(ne=>ne.map(le=>le.id===P?{...le,status:"archived"}:le))},[]),_e=y.useCallback(async P=>{console.log("[MockGrackle] loadTasks",P)},[]),Qe=y.useCallback(async(P,ne,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createTask",{workspaceId:P,title:ne,parentTaskId:he}),_(ut=>{const Pt=ut.filter(ht=>ht.workspaceId===P).reduce((ht,qt)=>Math.max(ht,qt.sortOrder),0),Kt=he?ut.find(ht=>ht.id===he):void 0;if(he&&!Kt)return console.warn("[MockGrackle] Parent task not found:",he),ut;if(Kt&&!Kt.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",he),ut;const At=Kt?Kt.depth+1:0,rn={id:pt("task"),workspaceId:P,title:ne,description:le||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:pe||[],reviewNotes:void 0,sortOrder:Pt+1,createdAt:new Date().toISOString(),parentTaskId:he||"",depth:At,childTaskIds:[],canDecompose:ke??!he,defaultPersonaId:$e||"",workpad:""};return[...ut,rn]}),Re&&Re()},[pt]),on=y.useCallback(async(P,ne,le,pe)=>{var ut;console.log("[MockGrackle] startTask",{taskId:P});const he=ye.current.find(Ke=>Ke.id===P),$e=(he==null?void 0:he.title)??"",ke=pt("sess"),Re={id:ke,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:$e||P,startedAt:new Date().toISOString()};c(Ke=>[...Ke,Re]),_(Ke=>Ke.map(Pt=>Pt.id===P?{...Pt,status:"working",latestSessionId:ke,branch:`mock/${P.slice(0,8)}`}:Pt));const Ze=bn();if(console.log(`[MockGrackle] Playing task scenario: ${Ze.label}`),Ze.pauseForInput){const Ke=Ze.pauseAfterStep??Ze.steps.length-1,Pt=Ze.steps.slice(0,Ke+1),Kt=Pt.length>0?Pt[Pt.length-1].delayMs:0;if($t(ke,Pt),ie(()=>{ct(ke,"idle"),Le({sessionId:ke,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Kt+Pb,ke),Ze.resumeSteps){const At=[...Ze.resumeSteps];me.current.set(ke,At);const rn=At.reduce((ht,qt)=>Math.max(ht,qt.delayMs),0);Ue.current.set(ke,{taskId:P,delayAfterResume:rn+200})}}else{const Ke=Ze.steps.length>0?Ze.steps[Ze.steps.length-1].delayMs:0;$t(ke,Ze.steps);const Pt=(ut=Ze.steps[Ze.steps.length-1])==null?void 0:ut.event.content;ie(()=>{Pt==="completed"?_(Kt=>Kt.map(At=>At.id===P&&At.status==="working"?{...At,status:"paused"}:At)):Pt==="failed"&&_(Kt=>Kt.map(At=>At.id===P&&At.status==="working"?{...At,status:"failed"}:At))},Ke+100,ke)}},[pt,bn,$t,ie,ct,Le]),xn=y.useCallback(async(P,ne)=>{console.log("[MockGrackle] sendInput",{sessionId:P,text:ne}),Le({sessionId:P,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ne}`}),ct(P,"running"),Le({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const le=me.current.get(P);if(le)me.current.delete(P),$t(P,le);else{const he=[{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"}}];$t(P,he)}const pe=Ue.current.get(P);pe&&(Ue.current.delete(P),ie(()=>{_(he=>he.map($e=>$e.id===pe.taskId&&$e.status==="working"?{...$e,status:"paused"}:$e))},pe.delayAfterResume,P))},[Le,ct,$t,ie]),In=y.useCallback(async P=>{console.log("[MockGrackle] completeTask",P),_(ne=>ne.map(le=>le.id===P?{...le,status:"complete"}:le))},[]),ji=y.useCallback(async P=>{console.log("[MockGrackle] resumeTask",P)},[]),Pa=y.useCallback(async(P,ne,le,pe,he)=>{console.log("[MockGrackle] updateTask",{taskId:P,title:ne}),_($e=>$e.map(ke=>ke.id===P?{...ke,title:ne.trim()||ke.title,description:le,dependsOn:pe,...he!==void 0?{defaultPersonaId:he}:{}}:ke))},[]),Ni=y.useCallback(async P=>{console.log("[MockGrackle] deleteTask",P),_(ne=>ne.filter(le=>le.id!==P))},[]),Ci=y.useCallback(async P=>{console.log("[MockGrackle] loadFindings",P),S(Oc.filter(ne=>ne.workspaceId===P))},[]),na=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),S([...Oc])},[]),tn=y.useCallback(async P=>{console.log("[MockGrackle] loadFinding",P);const ne=Oc.find(le=>le.id===P);N(ne)},[]),Xn=y.useCallback(async(P,ne,le,pe,he)=>{console.log("[MockGrackle] postFinding",{workspaceId:P,title:ne});const $e={id:pt("find"),workspaceId:P,taskId:"",sessionId:"",category:pe||"general",title:ne,content:le,tags:he||[],createdAt:new Date().toISOString()};S(ke=>[...ke,$e])},[pt]),nn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),ll=y.useCallback(async(P,ne,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:P,adapterType:ne,adapterConfig:le})},[]),cl=y.useCallback(async(P,ne)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:P,...ne}),i(le=>le.map(pe=>pe.id!==P?pe:{...pe,...ne.displayName!==void 0?{displayName:ne.displayName}:{},...ne.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ne.adapterConfig)}:{}}))},[]),dl=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Va=y.useCallback(async(P,ne,le,pe,he)=>{console.log("[MockGrackle] setToken",{name:P,tokenType:le}),E($e=>[...$e.filter(Re=>Re.name!==P),{name:P,tokenType:le,envVar:pe,filePath:he,expiresAt:""}])},[]),Ha=y.useCallback(async P=>{console.log("[MockGrackle] deleteToken",P),E(ne=>ne.filter(le=>le.name!==P))},[]),qa=y.useCallback(async P=>{console.log("[MockGrackle] updateCredentialProviders",P),R(P)},[]);y.useEffect(()=>()=>{Oe.current.forEach(clearTimeout),Oe.current.clear()},[]);const Ts=y.useMemo(()=>({connected:!0,environments:{environments:s,environmentsLoading:!1,provisionStatus:{},operationError:"",clearOperationError:()=>{},loadEnvironments:nn,addEnvironment:ll,updateEnvironment:cl,provisionEnvironment:async(P,ne)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{}},sessions:{sessions:r,sessionsLoading:!1,events:d,eventsDropped:0,lastSpawnedId:p,taskSessions:U,spawn:dt,sendInput:xn,kill:ta,stopGraceful:ks,loadSessionEvents:Ss,clearEvents:us,loadTaskSessions:async P=>{console.log("[MockGrackle] loadTaskSessions",P)}},workspaces:{workspaces:g,workspacesLoading:!1,workspaceCreating:!1,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:wi,archiveWorkspace:Wn,updateWorkspace:async(P,ne)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:P,...ne}),v(le=>le.map(pe=>pe.id!==P?pe:{...pe,...ne.name!==void 0?{name:ne.name}:{},...ne.description!==void 0?{description:ne.description}:{},...ne.repoUrl!==void 0?{repoUrl:ne.repoUrl}:{},...ne.environmentId!==void 0?{environmentId:ne.environmentId}:{},...ne.workingDirectory!==void 0?{workingDirectory:ne.workingDirectory}:{},...ne.useWorktrees!==void 0?{useWorktrees:ne.useWorktrees}:{},...ne.defaultPersonaId!==void 0?{defaultPersonaId:ne.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))}},tasks:{tasks:b,tasksLoading:!1,taskStartingId:void 0,loadTasks:_e,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Qe,startTask:on,stopTask:async P=>{console.log("[MockGrackle] stopTask",{taskId:P}),await In(P)},completeTask:In,resumeTask:ji,updateTask:Pa,deleteTask:Ni},findings:{findings:k,selectedFinding:j,findingLoading:T,findingsLoading:!1,loadFindings:Ci,loadAllFindings:na,loadFinding:tn,postFinding:Xn},tokens:{tokens:C,tokensLoading:!1,loadTokens:dl,setToken:Va,deleteToken:Ha},credentials:{credentialProviders:D,credentialsLoading:!1,updateCredentialProviders:qa},codespaces:{codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{}},personas:{personas:L,personasLoading:!1,createPersona:async(P,ne,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createPersona",{name:P});const ut={id:`mock-persona-${Date.now()}`,name:P,description:ne,systemPrompt:le,toolConfig:"{}",runtime:pe??"claude-code",model:he||"",maxTurns:$e||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ke||"agent",script:Re||"",allowedMcpTools:Ze||[]};return A(Ke=>[...Ke,ut]),ut},updatePersona:async(P,ne,le,pe,he,$e,ke,Re,Ze,ut)=>{console.log("[MockGrackle] updatePersona",{personaId:P,name:ne});const Ke=L.find(At=>At.id===P);if(!Ke)throw new Error(`Persona not found: ${P}`);const Pt=new Date().toISOString(),Kt={...Ke,...ne!==void 0?{name:ne}:{},...le!==void 0?{description:le}:{},...pe!==void 0?{systemPrompt:pe}:{},...he!==void 0?{runtime:he}:{},...$e!==void 0?{model:$e}:{},...ke!==void 0?{maxTurns:ke}:{},...Re!==void 0?{type:Re}:{},...Ze!==void 0?{script:Ze}:{},...ut!==void 0?{allowedMcpTools:ut}:{},updatedAt:Pt};return A(At=>At.map(rn=>rn.id===P?Kt:rn)),Kt},deletePersona:async P=>{console.log("[MockGrackle] deletePersona",P),A(ne=>ne.filter(le=>le.id!==P))}},knowledge:{graphData:{nodes:q,links:ae},selectedNode:re,loading:!1,selectedId:Z,searchQuery:ue,search:async P=>{if(console.log("[MockGrackle] knowledge.search",P),!P.trim()){de(P);return}de(P);const ne=Ge.current,le=ne?vs.filter(ke=>!ke.workspaceId||ke.workspaceId===ne):vs,pe=P.toLowerCase(),he=le.filter(ke=>{var Re,Ze,ut;return ke.label.toLowerCase().includes(pe)||((Re=ke.content)==null?void 0:Re.toLowerCase().includes(pe))||((Ze=ke.tags)==null?void 0:Ze.some(Ke=>Ke.toLowerCase().includes(pe)))||((ut=ke.category)==null?void 0:ut.toLowerCase().includes(pe))});X(he);const $e=new Set(he.map(ke=>ke.id));Q(Ca.filter(ke=>$e.has(ke.source)&&$e.has(ke.target))),se(void 0),O(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),de("");const P=Ge.current,ne=P?vs.filter(pe=>!pe.workspaceId||pe.workspaceId===P):vs;X(ne);const le=new Set(ne.map(pe=>pe.id));Q(Ca.filter(pe=>le.has(pe.source)&&le.has(pe.target)))},selectNode:async P=>{console.log("[MockGrackle] knowledge.selectNode",P),se(P);const ne=P in Ub?Ub[P]:void 0;if(ne)O(ne);else{const le=vs.find(pe=>pe.id===P);if(le){const pe=Ca.filter(he=>he.source===P||he.target===P).map(he=>({fromId:he.source,toId:he.target,type:he.type}));O({node:le,edges:pe})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),se(void 0),O(void 0)},expandNode:async P=>{console.log("[MockGrackle] knowledge.expandNode",P),X(ne=>{const le=new Set(ne.map(Re=>Re.id)),pe=Ca.filter(Re=>Re.source===P||Re.target===P),he=new Set;for(const Re of pe)le.has(Re.source)||he.add(Re.source),le.has(Re.target)||he.add(Re.target);if(he.size===0)return ne;const $e=vs.filter(Re=>he.has(Re.id)),ke=new Set([...le,...he]);return Q(Re=>{const Ze=new Set(Re.map(Ke=>`${Ke.source}|${Ke.target}|${Ke.type}`)),ut=Ca.filter(Ke=>ke.has(Ke.source)&&ke.has(Ke.target)&&!Ze.has(`${Ke.source}|${Ke.target}|${Ke.type}`));return ut.length>0?[...Re,...ut]:Re}),[...ne,...$e]})},loadRecent:async P=>{if(console.log("[MockGrackle] knowledge.loadRecent",P),Ge.current=P,P){const ne=vs.filter(pe=>!pe.workspaceId||pe.workspaceId===P);X(ne);const le=new Set(ne.map(pe=>pe.id));Q(Ca.filter(pe=>le.has(pe.source)&&le.has(pe.target)))}else X(vs),Q(Ca);de("")},handleEvent:()=>!1},appDefaultPersonaId:F,setAppDefaultPersonaId:async P=>{console.log("[MockGrackle] setAppDefaultPersonaId",P),ee(P)},onboardingCompleted:!0,completeOnboarding:async()=>{console.log("[MockGrackle] completeOnboarding")},usageCache:{"workspace:proj-alpha":{inputTokens:214500,outputTokens:44850,costUsd:1.12,sessionCount:4},"workspace:proj-beta":{inputTokens:86700,outputTokens:23800,costUsd:.48,sessionCount:3},"task:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1},"task_tree:task-001":{inputTokens:126800,outputTokens:20850,costUsd:.63,sessionCount:2},"task_tree:task-006":{inputTokens:18900,outputTokens:4500,costUsd:.1,sessionCount:1}},loadUsage:async(P,ne)=>{console.log(`[MockGrackle] loadUsage(${P}, ${ne})`)},refresh:_n}),[s,r,d,p,U,g,b,k,j,C,D,L,F,q,ae,re,Z,ue,dt,xn,ta,ks,Ss,us,wi,Wn,_e,Qe,on,In,ji,Pa,Ni,Ci,na,tn,Xn,nn,ll,cl,dl,Va,Ha,qa,_n]);return o.jsx(Ym.Provider,{value:Ts,children:t})}const z8=3e3;function U8(t){const[s,i]=y.useState(!1),r=y.useRef(t.onSessionEvent);r.current=t.onSessionEvent;const c=y.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const d=y.useRef(t.onConnect);d.current=t.onConnect;const u=y.useRef(t.onDisconnect);return u.current=t.onDisconnect,y.useEffect(()=>{let p=!1,m;async function g(){var v,b;if(!p){try{const _=Te.streamEvents({});i(!0),Promise.resolve((v=d.current)==null?void 0:v.call(d)).catch(()=>{});for await(const k of _){if(p)break;const S=k.event;if(S.case==="sessionEvent"){const j=S.value;r.current({sessionId:j.sessionId,type:j.type,timestamp:j.timestamp,content:j.content,raw:j.raw})}else if(S.case==="domainEvent"){const j=S.value;c.current({id:j.id,type:j.type,timestamp:j.timestamp,payloadJson:j.payloadJson})}}}catch(_){if(_ instanceof Qr&&_.code===uT.Unauthenticated){window.location.href=Xj;return}}p||(i(!1),(b=u.current)==null||b.call(u),m=setTimeout(()=>{g().catch(()=>{})},z8))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(m),i(!1)}},[]),{connected:s}}function $8(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Vb(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,inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd}}function P8(t){return{sessionId:t.sessionId,eventType:a_(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function V8(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:fT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Hb(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:pT(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,defaultPersonaId:t.defaultPersonaId,workpad:t.workpad}}function vp(t){return{id:t.id,workspaceId:t.workspaceId,taskId:t.taskId,sessionId:t.sessionId,category:t.category,title:t.title,content:t.content,tags:[...t.tags],createdAt:t.createdAt}}function H8(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function q8(t){return{claude:mT(t.claude),github:Sc(t.github),copilot:Sc(t.copilot),codex:Sc(t.codex),goose:Sc(t.goose)}}function G8(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function yp(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 F8(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Lc(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 bp(t){return{source:t.fromId,target:t.toId,type:t.type}}function $a(){const[t,s]=y.useState(!1),i=y.useRef(0),r=y.useCallback(c=>(i.current++,i.current===1&&s(!0),c.finally(()=>{i.current--,i.current===0&&s(!1)})),[]);return{loading:t,track:r}}const qb=5e3;function Rr(t){return t instanceof Qr?t.message:"Operation failed"}function Z8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState({}),[u,p]=y.useState(""),m=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const T=await r(Te.listEnvironments({}));s(T.environments.map($8))}catch{}},[r]),v=y.useCallback(T=>{switch(T.type){case"environment.added":return!0;case"environment.removed":{const C=T.payload.environmentId;return C&&(s(E=>E.filter(D=>D.id!==C)),d(E=>{const D={...E};return delete D[C],D})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const C=T.payload;if(typeof C.environmentId!="string"||typeof C.stage!="string"||typeof C.message!="string"||typeof C.progress!="number")return R1("environment.provision_progress","invalid payload"),!0;if(d(E=>({...E,[C.environmentId]:{stage:C.stage,message:C.message,progress:C.progress}})),C.stage==="ready"){const E=C.environmentId;setTimeout(()=>{d(D=>{const R={...D};return delete R[E],R})},qb)}return!0}default:return!1}},[g]),b=y.useCallback(T=>{var C;if(T.type==="environments"){const E=Array.isArray((C=T.payload)==null?void 0:C.environments)?T.payload.environments:[];return s(E),!0}return!1},[]),_=y.useCallback(async(T,C,E)=>{p("");try{await Te.addEnvironment({displayName:T,adapterType:C,adapterConfig:JSON.stringify(E??{})})}catch(D){p(Rr(D))}},[]),k=y.useCallback(async(T,C)=>{p("");try{await Te.updateEnvironment({id:T,displayName:C.displayName,adapterConfig:C.adapterConfig?JSON.stringify(C.adapterConfig):void 0})}catch(E){p(Rr(E))}},[]),S=y.useCallback(async(T,C)=>{p("");try{const E=Te.provisionEnvironment({id:T,force:C??!1});for await(const D of E)d(R=>({...R,[T]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"&&setTimeout(()=>{d(R=>{const L={...R};return delete L[T],L})},qb)}catch(E){d(D=>{const R={...D};return delete R[T],R}),p(Rr(E))}},[]),j=y.useCallback(async T=>{p("");try{await Te.stopEnvironment({id:T})}catch(C){p(Rr(C))}},[]),N=y.useCallback(async T=>{p("");try{await Te.removeEnvironment({id:T})}catch(C){p(Rr(C))}},[]);return{environments:t,environmentsLoading:i,provisionStatus:c,operationError:u,clearOperationError:m,loadEnvironments:g,addEnvironment:_,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:j,removeEnvironment:N,handleEvent:v,handleLegacyMessage:b}}const _p=new Set(["pending","running","idle"]),K8=new Set(["completed","failed","interrupted","hibernating","suspended"]),Gb=["pending","running","idle"];function Y8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState([]),[u,p]=y.useState(0),[m,g]=y.useState(void 0),[v,b]=y.useState({}),_=y.useCallback(async()=>{try{const U=(await r(Te.listSessions({}))).sessions.map(Vb);s(F=>{const ee=new Map(F.map(q=>[q.id,q]));return U.map(q=>{const X=ee.get(q.id),ae=X==null?void 0:X.status;return!ae||ae===q.status?q:K8.has(ae)&&_p.has(q.status)?{...q,status:ae,...X.endReason!==void 0?{endReason:X.endReason}:{}}:_p.has(ae)&&_p.has(q.status)&&Gb.indexOf(ae)>Gb.indexOf(q.status)?{...q,status:ae}:q})})}catch{}},[r]),k=y.useCallback(A=>{if(A.type!=="session_event")return!1;if(!u8(A.payload))return R1("session_event","payload is not a valid SessionEvent"),!0;const U=A.payload;let F=0;if(d(ee=>{const q=[...ee,U];return q.length>ho?(F=q.length-ho,q.slice(-ho)):q}),F>0&&p(ee=>ee+F),U.eventType==="usage")try{const ee=JSON.parse(U.content),q=Number(ee.input_tokens)||0,X=Number(ee.output_tokens)||0,ae=Number(ee.cost_usd)||0;(q>0||X>0||ae>0)&&s(Q=>Q.map(re=>re.id===U.sessionId?{...re,inputTokens:(re.inputTokens??0)+q,outputTokens:(re.outputTokens??0)+X,costUsd:(re.costUsd??0)+ae}:re))}catch{}if(U.eventType==="status"){const ee=M1(U.content),q=I1(U.content);s(X=>X.some(Q=>Q.id===U.sessionId)?X.map(Q=>Q.id===U.sessionId?{...Q,status:ee,...q!==void 0?{endReason:q}:{}}:Q):[...X,{id:U.sessionId,environmentId:"",runtime:"",status:ee,prompt:"",startedAt:U.timestamp,...q!==void 0?{endReason:q}:{}}])}return!0},[]),S=y.useCallback(A=>{k({type:"session_event",payload:A})},[k]),j=y.useCallback(A=>{var U,F,ee,q,X;switch(A.type){case"sessions":{const ae=Array.isArray((U=A.payload)==null?void 0:U.sessions)?A.payload.sessions:[];return s(ae),!0}case"spawned":{const ae=(F=A.payload)==null?void 0:F.sessionId;return typeof ae=="string"&&ae&&g(ae),_().catch(()=>{}),!0}case"session_events":{const ae=Array.isArray((ee=A.payload)==null?void 0:ee.events)?A.payload.events:[];return ae.length>0&&d(ae),!0}case"task_sessions":{const ae=(q=A.payload)==null?void 0:q.taskId;if(typeof ae=="string"&&ae){const Q=Array.isArray((X=A.payload)==null?void 0:X.sessions)?A.payload.sessions:[];b(re=>({...re,[ae]:Q}))}return!0}default:return!1}},[_]),N=y.useCallback(async(A,U,F,ee)=>{try{const q=await Te.spawnAgent({environmentId:A,prompt:U,personaId:F||"",workingDirectory:ee||""});g(q.id),await _()}catch{}},[_]),T=y.useCallback(async(A,U)=>{try{await Te.sendInput({sessionId:A,text:U})}catch{}},[]),C=y.useCallback(async A=>{try{await Te.killAgent({id:A,graceful:!1})}catch{}},[]),E=y.useCallback(async A=>{try{await Te.killAgent({id:A,graceful:!0})}catch{}},[]),D=y.useCallback(async A=>{try{const F=(await Te.getSessionEvents({id:A})).events.map(P8);if(F.length>0){let ee=0;d(q=>{const X=new Set;for(const re of q)re.sessionId===A&&X.add(`${re.timestamp}|${re.eventType}`);const ae=F.filter(re=>!X.has(`${re.timestamp}|${re.eventType}`)),Q=[...q,...ae].sort((re,O)=>re.sessionId!==O.sessionId?0:re.timestamp.localeCompare(O.timestamp));return Q.length>ho?(ee=Q.length-ho,Q.slice(-ho)):Q}),ee>0&&p(q=>q+ee)}}catch{}},[]),R=y.useCallback(()=>{d([]),p(0)},[]),L=y.useCallback(async A=>{try{const F=(await Te.getTaskSessions({id:A})).sessions.map(Vb);b(ee=>({...ee,[A]:F}))}catch{}},[]);return{sessions:t,sessionsLoading:i,events:c,eventsDropped:u,lastSpawnedId:m,taskSessions:v,loadSessions:_,spawn:N,sendInput:T,kill:C,stopGraceful:E,loadSessionEvents:D,clearEvents:R,loadTaskSessions:L,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:j}}function J8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState(!1),u=y.useCallback(async()=>{try{const _=await r(Te.listWorkspaces({}));s(_.workspaces.map(V8))}catch{}},[r]),p=y.useCallback(_=>{switch(_.type){case"workspace.created":return d(!1),u().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return u().catch(()=>{}),!0;default:return!1}},[u]),m=y.useCallback(()=>{d(!1)},[]),g=y.useCallback(async(_,k,S,j,N,T,C,E,D)=>{d(!0);try{await Te.createWorkspace({name:_,description:k||"",repoUrl:S||"",environmentId:j||"",defaultPersonaId:N||void 0,useWorktrees:T??!0,workingDirectory:C||void 0}),d(!1),E==null||E()}catch(R){d(!1);const L=R instanceof Qr?R.message:"Failed to create workspace";D==null||D(L)}},[]),v=y.useCallback(async _=>{try{await Te.archiveWorkspace({id:_})}catch{}},[]),b=y.useCallback(async(_,k)=>{try{await Te.updateWorkspace({id:_,...k})}catch{}},[]);return{workspaces:t,workspacesLoading:i,workspaceCreating:c,loadWorkspaces:u,createWorkspace:g,archiveWorkspace:v,updateWorkspace:b,handleEvent:p,onDisconnect:m}}function W8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState(void 0),u=y.useRef({}),p=y.useCallback(async D=>{try{const L=(await Te.listTasks({workspaceId:D})).tasks.map(Hb);s(A=>[...A.filter(U=>U.workspaceId!==D),...L])}catch{}},[]),m=y.useCallback(async()=>{try{const R=(await r(Te.listTasks({}))).tasks.map(Hb);s(L=>{const A=new Set(R.map(U=>U.id));return[...L.filter(U=>!A.has(U.id)),...R]})}catch{}},[r]),g=y.useCallback((D,R)=>{const L=A=>{clearTimeout(u.current[A]),u.current[A]=setTimeout(()=>{delete u.current[A],p(A).catch(()=>{})},200)};D?L(D):R&&s(A=>{const U=A.find(F=>F.id===R);return U!=null&&U.workspaceId?L(U.workspaceId):m().catch(()=>{}),A})},[p,m]),v=y.useCallback(D=>{const R=D.payload;switch(D.type){case"task.created":{const L=typeof R.workspaceId=="string"?R.workspaceId:"";return L&&p(L).catch(()=>{}),!0}case"task.started":{const L=typeof R.taskId=="string"?R.taskId:"",A=typeof R.sessionId=="string"?R.sessionId:"",U=typeof R.workspaceId=="string"?R.workspaceId:"";return d(F=>L&&F===L?void 0:F),A&&L&&s(F=>F.map(ee=>ee.id===L?{...ee,latestSessionId:A}:ee)),g(U,L),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const L=typeof R.workspaceId=="string"?R.workspaceId:"",A=typeof R.taskId=="string"?R.taskId:"";return g(L,A),!0}default:return!1}},[p,g]),b=y.useCallback(()=>{d(void 0)},[]),_=y.useCallback(D=>{var R,L;if(D.type==="tasks"){const A=Array.isArray((R=D.payload)==null?void 0:R.tasks)?D.payload.tasks:[],U=typeof((L=D.payload)==null?void 0:L.workspaceId)=="string"&&D.payload.workspaceId?D.payload.workspaceId:"";return s(U?F=>[...F.filter(ee=>ee.workspaceId!==U),...A]:F=>{const ee=new Set(A.map(q=>q.id));return[...F.filter(q=>!ee.has(q.id)),...A]}),!0}return!1},[]),k=y.useCallback(async(D,R,L,A,U,F,ee,q,X)=>{try{await Te.createTask({workspaceId:D,title:R,description:L||"",dependsOn:A||[],parentTaskId:U||"",defaultPersonaId:F||void 0,canDecompose:ee??void 0}),q==null||q()}catch(ae){const Q=ae instanceof Qr?ae.message:"Failed to create task";X==null||X(Q)}},[]),S=y.useCallback(async(D,R,L,A)=>{d(D);try{await Te.startTask({taskId:D,personaId:R||"",environmentId:L||"",notes:A||""})}catch{d(void 0)}},[]),j=y.useCallback(async D=>{try{await Te.stopTask({id:D})}catch{}},[]),N=y.useCallback(async D=>{try{await Te.completeTask({id:D})}catch{}},[]),T=y.useCallback(async D=>{try{await Te.resumeTask({id:D})}catch{}},[]),C=y.useCallback(async(D,R,L,A,U)=>{try{await Te.updateTask({id:D,title:R,description:L,dependsOn:A,...U!==void 0?{defaultPersonaId:U}:{}})}catch{}},[]),E=y.useCallback(async D=>{try{await Te.deleteTask({id:D})}catch{}},[]);return{tasks:t,tasksLoading:i,taskStartingId:c,loadTasks:p,loadAllTasks:m,createTask:k,startTask:S,stopTask:j,completeTask:N,resumeTask:T,updateTask:C,deleteTask:E,handleEvent:v,onDisconnect:b,handleLegacyMessage:_}}function X8(){const[t,s]=y.useState([]),[i,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:p}=$a(),m=y.useCallback(async k=>{try{const S=await p(Te.queryFindings({workspaceId:k}));s(S.findings.map(vp))}catch{}},[p]),g=y.useCallback(async()=>{try{const k=await p(Te.queryFindings({workspaceId:""}));s(k.findings.map(vp))}catch{}},[p]),v=y.useCallback(async k=>{r(void 0),d(!0);try{const S=await Te.getFinding({id:k});r(vp(S))}catch{r(void 0)}finally{d(!1)}},[]),b=y.useCallback(k=>{if(k.type==="finding.posted"){const S=typeof k.payload.workspaceId=="string"?k.payload.workspaceId:"";return S&&m(S).catch(()=>{}),!0}return!1},[m]),_=y.useCallback(async(k,S,j,N,T)=>{try{await Te.postFinding({workspaceId:k,title:S,content:j,category:N??"general",tags:T??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,findingsLoading:u,loadFindings:m,loadAllFindings:g,loadFinding:v,postFinding:_,handleEvent:b}}function Q8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),c=y.useCallback(async()=>{try{const m=await r(Te.listTokens({}));s(m.tokens.map(H8))}catch{}},[r]),d=y.useCallback(m=>m.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(m,g,v,b,_)=>{try{await Te.setToken({name:m,value:g,type:v,envVar:b,filePath:_})}catch{}},[]),p=y.useCallback(async m=>{try{await Te.deleteToken({name:m})}catch{}},[]);return{tokens:t,tokensLoading:i,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d}}function ez(){const[t,s]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:i,track:r}=$a(),c=y.useCallback(async()=>{try{const p=await r(Te.getCredentialProviders({}));s(q8(p))}catch{}},[r]),d=y.useCallback(p=>p.type==="credential.providers_changed"?(p8(p.payload)&&s(p.payload),!0):!1,[]),u=y.useCallback(async p=>{const m=[{provider:"claude",value:p.claude},{provider:"github",value:p.github},{provider:"copilot",value:p.copilot},{provider:"codex",value:p.codex},{provider:"goose",value:p.goose}];await Promise.allSettled(m.map(({provider:g,value:v})=>Te.setCredentialProvider({provider:g,value:v})))},[]);return{credentialProviders:t,credentialsLoading:i,loadCredentials:c,updateCredentialProviders:u,handleEvent:d}}function tz(){const[t,s]=y.useState([]),[i,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),m=y.useCallback(async()=>{try{const v=await Te.listCodespaces({});s(v.codespaces.map(G8)),d(v.error)}catch{}},[]),g=y.useCallback(async(v,b)=>{p(!0),r("");try{await Te.createCodespace({repo:v,machine:b??""}),p(!1),await m()}catch(_){p(!1);const k=_ instanceof Qr?_.message:"Failed to create codespace";r(k)}},[m]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:u,listCodespaces:m,createCodespace:g}}function nz(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),c=y.useCallback(async()=>{try{const g=await r(Te.listPersonas({}));s(g.personas.map(yp))}catch{}},[r]),d=y.useCallback(g=>{switch(g.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),u=y.useCallback(async(g,v,b,_,k,S,j,N,T)=>{const C=await Te.createPersona({name:g,description:v,systemPrompt:b,runtime:_||"",model:k||"",maxTurns:S||0,type:j||"agent",script:N||"",allowedMcpTools:T||[]}),E=yp(C);return s(D=>[...D.filter(R=>R.id!==E.id),E]),E},[]),p=y.useCallback(async(g,v,b,_,k,S,j,N,T,C)=>{const E={id:g};v!==void 0&&(E.name=v),b!==void 0&&(E.description=b),_!==void 0&&(E.systemPrompt=_),k!==void 0&&(E.runtime=k),S!==void 0&&(E.model=S),j!==void 0&&(E.maxTurns=j),N!==void 0&&(E.type=N),T!==void 0&&(E.script=T),C!==void 0&&(E.allowedMcpTools={tools:C});const D=await Te.updatePersona(E),R=yp(D);return s(L=>L.map(A=>A.id===R.id?R:A)),R},[]),m=y.useCallback(async g=>{await Te.deletePersona({id:g}),s(v=>v.filter(b=>b.id!==g))},[]);return{personas:t,personasLoading:i,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:m,handleEvent:d}}function sz(t){if(t)try{return JSON.parse(t)}catch{return}}function az(){const[t,s]=y.useState(new Map),[i,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[m,g]=y.useState(!1),[v,b]=y.useState(""),_=y.useRef(""),k=y.useCallback(async D=>{const R=D??"";_.current=R,b(""),g(!0);try{const L=await Te.listRecentKnowledgeNodes({limit:30,workspaceId:R}),A=new Map,U=[];for(const F of L.nodes)A.set(F.id,Lc(F));for(const F of L.edges)U.push(bp(F));for(const F of U){const ee=A.get(F.source);ee&&(ee.val+=1);const q=A.get(F.target);q&&(q.val+=1)}s(A),r(U)}catch{}finally{g(!1)}},[]),S=y.useCallback(async D=>{if(D.trim()){b(D),p(void 0),d(void 0),g(!0);try{const R=await Te.searchKnowledge({query:D,limit:20,workspaceId:_.current}),L=new Map,A=[];for(const U of R.results){U.node&&L.set(U.node.id,Lc(U.node,U.edges.length));for(const F of U.edges)A.push(bp(F))}s(L),r(A)}catch{}finally{g(!1)}}},[]),j=y.useCallback(()=>{k(_.current).catch(()=>{})},[k]),N=y.useCallback(async D=>{p(D);try{const R=await Te.getKnowledgeNode({id:D});if(!R.node){d(void 0);return}d({node:Lc(R.node,R.edges.length),edges:R.edges.map(L=>({fromId:L.fromId,toId:L.toId,type:L.type,metadata:sz(L.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async D=>{try{const R=await Te.expandKnowledgeNode({id:D,depth:1});s(L=>{const A=new Map(L);for(const U of R.nodes)A.has(U.id)||A.set(U.id,Lc(U));return A}),r(L=>{const A=new Set(L.map(F=>`${F.source}:${F.target}:${F.type}`)),U=[];for(const F of R.edges){const ee=bp(F),q=`${ee.source}:${ee.target}:${ee.type}`;A.has(q)||U.push(ee)}return[...L,...U]})}catch{}},[]),E=y.useCallback(D=>!1,[]);return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:u,loading:m,searchQuery:v,search:S,clearSearch:j,selectNode:N,clearSelection:T,expandNode:C,loadRecent:k,handleEvent:E}}function iz(){const t=y.useRef("default");y.useEffect(()=>{typeof Notification>"u"||(t.current=Notification.permission)},[]);function s(i){if(i.type!=="notification.escalated")return!1;if(typeof Notification>"u")return!0;if(t.current==="default")return Notification.requestPermission().then(d=>{t.current=d}).catch(()=>{}),!0;if(t.current!=="granted")return!0;const r=i.payload,c=new Notification(r.title||"Agent needs input",{body:r.message||"An agent is waiting for your input.",tag:r.escalationId,icon:"/icon-192x192.png"});return c.onclick=()=>{window.focus(),r.taskUrl&&(window.location.href=r.taskUrl),c.close()},!0}return{handleEvent:s}}function oz(){const[t,s]=y.useState(""),[i,r]=y.useState(void 0),[c,d]=y.useState({}),u=Z8(),p=Y8(),m=J8(),g=W8(),v=X8(),b=Q8(),_=ez(),k=tz(),S=nz(),j=az(),N=iz(),{connected:T}=U8({onSessionEvent:q=>{p.handleSessionEvent({sessionId:q.sessionId,eventType:a_(q.type),timestamp:q.timestamp,content:q.content,raw:q.raw||void 0})},onDomainEvent:q=>{try{const X=JSON.parse(q.payloadJson);A({id:q.id,type:q.type,timestamp:q.timestamp,payload:X})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",q.payloadJson)}},onConnect:U,onDisconnect:F}),C="default_persona_id",E="onboarding_completed",D=y.useCallback(async q=>{const X=await Te.setSetting({key:C,value:q});s(X.value)},[]),R=y.useCallback(async()=>{r(!0);try{await Te.setSetting({key:E,value:"true"})}catch{}},[]),L=y.useCallback(async(q,X)=>{try{const ae=await Te.getUsage({scope:q,id:X}),Q=`${q}:${X}`;d(re=>({...re,[Q]:F8(ae)}))}catch{}},[]);function A(q){const X=q.payload.key,ae=q.payload.value;if(q.type==="setting.changed"){X===C&&s(ae??""),X===E&&r(ae==="true");return}if(u.handleEvent(q)){(q.type==="environment.removed"||q.type==="environment.changed")&&p.loadSessions().catch(()=>{});return}if(!m.handleEvent(q)){if(g.handleEvent(q)){q.type==="task.started"&&p.loadSessions().catch(()=>{});return}v.handleEvent(q)||b.handleEvent(q)||_.handleEvent(q)||S.handleEvent(q)||j.handleEvent(q)||N.handleEvent(q)}}async function U(){u.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),m.loadWorkspaces().catch(()=>{}),b.loadTokens().catch(()=>{}),_.loadCredentials().catch(()=>{}),S.loadPersonas().catch(()=>{}),g.loadAllTasks().catch(()=>{});try{const q=await Te.getSetting({key:C});s(q.value)}catch{}try{const q=await Te.getSetting({key:E});r(q.value==="true")}catch{}}function F(){m.onDisconnect(),g.onDisconnect()}const ee=y.useCallback(()=>{u.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),m.loadWorkspaces().catch(()=>{}),b.loadTokens().catch(()=>{})},[u.loadEnvironments,p.loadSessions,m.loadWorkspaces,b.loadTokens]);return{connected:T,environments:{environments:u.environments,environmentsLoading:u.environmentsLoading,provisionStatus:u.provisionStatus,operationError:u.operationError,clearOperationError:u.clearOperationError,loadEnvironments:u.loadEnvironments,addEnvironment:u.addEnvironment,updateEnvironment:u.updateEnvironment,provisionEnvironment:u.provisionEnvironment,stopEnvironment:u.stopEnvironment,removeEnvironment:u.removeEnvironment},sessions:{sessions:p.sessions,sessionsLoading:p.sessionsLoading,events:p.events,eventsDropped:p.eventsDropped,lastSpawnedId:p.lastSpawnedId,taskSessions:p.taskSessions,spawn:p.spawn,sendInput:p.sendInput,kill:p.kill,stopGraceful:p.stopGraceful,loadSessionEvents:p.loadSessionEvents,clearEvents:p.clearEvents,loadTaskSessions:p.loadTaskSessions},workspaces:{workspaces:m.workspaces,workspacesLoading:m.workspacesLoading,workspaceCreating:m.workspaceCreating,loadWorkspaces:m.loadWorkspaces,createWorkspace:m.createWorkspace,archiveWorkspace:m.archiveWorkspace,updateWorkspace:m.updateWorkspace},tasks:{tasks:g.tasks,tasksLoading:g.tasksLoading,taskStartingId:g.taskStartingId,loadTasks:g.loadTasks,loadAllTasks:g.loadAllTasks,createTask:g.createTask,startTask:g.startTask,stopTask:g.stopTask,completeTask:g.completeTask,resumeTask:g.resumeTask,updateTask:g.updateTask,deleteTask:g.deleteTask},findings:{findings:v.findings,selectedFinding:v.selectedFinding,findingLoading:v.findingLoading,findingsLoading:v.findingsLoading,loadFindings:v.loadFindings,loadAllFindings:v.loadAllFindings,loadFinding:v.loadFinding,postFinding:v.postFinding},tokens:{tokens:b.tokens,tokensLoading:b.tokensLoading,loadTokens:b.loadTokens,setToken:b.setToken,deleteToken:b.deleteToken},credentials:{credentialProviders:_.credentialProviders,credentialsLoading:_.credentialsLoading,updateCredentialProviders:_.updateCredentialProviders},codespaces:{codespaces:k.codespaces,codespaceError:k.codespaceError,codespaceListError:k.codespaceListError,codespaceCreating:k.codespaceCreating,listCodespaces:k.listCodespaces,createCodespace:k.createCodespace},personas:{personas:S.personas,personasLoading:S.personasLoading,createPersona:S.createPersona,updatePersona:S.updatePersona,deletePersona:S.deletePersona},knowledge:j,appDefaultPersonaId:t,setAppDefaultPersonaId:D,onboardingCompleted:i,completeOnboarding:R,usageCache:c,loadUsage:L,refresh:ee}}function rz({children:t}){const s=oz();return o.jsx(Ym.Provider,{value:s,children:t})}function lz(t,s){const i=y.useRef(null);y.useEffect(()=>{const r=i.current;if(i.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 p=c.get(u.id);if(p&&p.status!==u.status&&u.status!=="sleeping"){if(u.status==="connecting"){s("Provisioning environment…","info");continue}u.status==="connected"?s("Environment connected","success"):u.status==="error"?s("Environment provision failed","error"):u.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const u of r)d.has(u.id)||s("Environment removed","info")},[t,s])}function cz(t,s,i){const r=y.useRef(t);y.useEffect(()=>{t&&t!==r.current&&(i(t,"error"),s()),r.current=t},[t,s,i])}const dz={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 uz(t){return dz[t]}function fz(t,s){if(t===void 0)return[];const i=[],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 p=uz(d.status);p&&i.push(p)}for(const d of t)c.has(d.id)||i.push({message:"Task deleted",variant:"info"});return i}function pz(t,s){const i=y.useRef(void 0);y.useEffect(()=>{const r=i.current;i.current=t;const c=fz(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const mz="_dashboard_16pzm_1",hz="_kpiStrip_16pzm_11",gz="_kpiCard_16pzm_23",vz="_kpiValue_16pzm_68",yz="_kpiLabel_16pzm_76",bz="_bodyGrid_16pzm_84",_z="_section_16pzm_96",xz="_sectionHeader_16pzm_109",kz="_sectionIcon_16pzm_118",Sz="_sectionTitle_16pzm_123",Tz="_sectionCount_16pzm_131",wz="_sectionBody_16pzm_138",jz="_emptyHint_16pzm_143",Nz="_sessionRow_16pzm_150",Cz="_sessionPrompt_16pzm_177",Ez="_sessionEnv_16pzm_186",Az="_sessionRuntime_16pzm_192",Dz="_sessionStatus_16pzm_198",Rz="_statusDot_16pzm_207",Mz="_attentionRow_16pzm_233",Iz="_attentionTitle_16pzm_259",Oz="_attentionMeta_16pzm_267",Lz="_reasonBadge_16pzm_274",Bz="_bottomGrid_16pzm_301",zz="_envRow_16pzm_312",Uz="_envName_16pzm_323",$z="_envStatusBadge_16pzm_333",Pz="_workspaceRow_16pzm_369",Vz="_workspaceTop_16pzm_395",Hz="_workspaceName_16pzm_401",qz="_workspaceCounts_16pzm_407",Gz="_progressBar_16pzm_415",Fz="_progressFill_16pzm_422",ce={dashboard:mz,kpiStrip:hz,kpiCard:gz,kpiValue:vz,kpiLabel:yz,bodyGrid:bz,section:_z,sectionHeader:xz,sectionIcon:kz,sectionTitle:Sz,sectionCount:Tz,sectionBody:wz,emptyHint:jz,sessionRow:Nz,sessionPrompt:Cz,sessionEnv:Ez,sessionRuntime:Az,sessionStatus:Dz,statusDot:Rz,attentionRow:Mz,attentionTitle:Iz,attentionMeta:Oz,reasonBadge:Lz,bottomGrid:Bz,envRow:zz,envName:Uz,envStatusBadge:$z,workspaceRow:Pz,workspaceTop:Vz,workspaceName:Hz,workspaceCounts:qz,progressBar:Gz,progressFill:Fz};function Zz(){return o.jsxs("div",{className:ce.dashboard,"aria-hidden":"true",children:[o.jsx("div",{className:ce.kpiStrip,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:ce.kpiCard,children:[o.jsx(xe,{width:"3rem",height:"2rem"}),o.jsx(xe,{width:"80%",height:"0.75rem"})]},s))}),o.jsxs("div",{className:ce.bodyGrid,children:[o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:3},(t,s)=>o.jsxs("div",{className:ce.sessionRow,style:{cursor:"default"},children:[o.jsx(xe,{width:"60%",height:"0.875rem"}),o.jsx(xe,{width:"4rem",height:"0.75rem"}),o.jsx(xe,{width:"3rem",height:"0.75rem"}),o.jsx(xe,{width:"3rem",height:"0.75rem"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.attentionRow,style:{cursor:"default"},children:[o.jsxs("div",{className:ce.attentionTitle,children:[o.jsx(xe,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"70%",height:"0.875rem"})]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx(xe,{width:"5rem",height:"0.625rem"})})]},s))})]})]}),o.jsxs("div",{className:ce.bottomGrid,children:[o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"9rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.envRow,children:[o.jsx(xe,{width:"60%",height:"0.875rem"}),o.jsx(xe,{width:"4rem",height:"0.875rem",borderRadius:"var(--radius-sm)"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(xe,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(xe,{width:"6rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(xe,{width:"1rem",height:"0.75rem"})})]}),o.jsx("div",{className:ce.sectionBody,children:Array.from({length:2},(t,s)=>o.jsxs("div",{className:ce.workspaceRow,style:{cursor:"default"},children:[o.jsxs("div",{className:ce.workspaceTop,children:[o.jsx(xe,{width:"50%",height:"0.875rem"}),o.jsx(xe,{width:"2rem",height:"0.75rem"})]}),o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const Kz={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Bc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function Yz(t,s,i,r){const c=[`${t} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),r>0&&c.push(`${r} failed`),c.join(", ")}function zc({value:t,label:s,accent:i,index:r,testId:c}){return o.jsxs(Et.div,{className:ce.kpiCard,"data-accent":i,"data-testid":c,variants:Kz,initial:"hidden",animate:"visible",custom:r,children:[o.jsx("span",{className:ce.kpiValue,children:t}),o.jsx("span",{className:ce.kpiLabel,children:s})]})}function Jz(){const{workspaces:{workspaces:t,workspacesLoading:s},tasks:{tasks:i,tasksLoading:r,loadTasks:c},sessions:{sessions:d,sessionsLoading:u},environments:{environments:p,environmentsLoading:m}}=lt(),g=xt(),v=y.useRef(new Set);y.useEffect(()=>{for(const N of t)v.current.has(N.id)||(v.current.add(N.id),c(N.id).catch(()=>{}))},[t,c]);const b=y.useMemo(()=>T8(d,i,p),[d,i,p]),_=y.useMemo(()=>j8(d,p),[d,p]),k=y.useMemo(()=>w8(i,t),[i,t]),S=y.useMemo(()=>N8(t,i),[t,i,p]);return d.length===0&&i.length===0&&p.length===0&&t.length===0&&(u||r||m||s)?o.jsx(Zz,{}):o.jsxs("div",{className:ce.dashboard,"data-testid":"dashboard",children:[o.jsxs("div",{className:ce.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[o.jsx(zc,{value:b.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),o.jsx(zc,{value:b.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),o.jsx(zc,{value:b.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),o.jsx(zc,{value:b.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),o.jsxs("div",{className:ce.bodyGrid,children:[o.jsxs(Et.div,{className:ce.section,variants:Bc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"●"}),o.jsx("span",{className:ce.sectionTitle,children:"Active Sessions"}),o.jsx("span",{className:ce.sectionCount,children:_.length})]}),o.jsx("div",{className:ce.sectionBody,children:_.length===0?o.jsx("div",{className:ce.emptyHint,children:"No active sessions"}):_.map(({session:N,environmentName:T})=>o.jsxs("button",{type:"button",className:ce.sessionRow,onClick:()=>g(dm(N.id)),"data-testid":"session-row",children:[o.jsx("span",{className:ce.sessionPrompt,title:N.prompt,children:N.prompt||"—"}),o.jsx("span",{className:ce.sessionEnv,children:T}),o.jsx("span",{className:ce.sessionRuntime,children:N.runtime}),o.jsxs("span",{className:ce.sessionStatus,children:[o.jsx("span",{className:ce.statusDot,"data-status":N.status}),N.status]})]},N.id))})]}),o.jsxs(Et.div,{className:ce.section,variants:Bc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"⚑"}),o.jsx("span",{className:ce.sectionTitle,children:"Needs Attention"}),o.jsx("span",{className:ce.sectionCount,children:k.length})]}),o.jsx("div",{className:ce.sectionBody,children:k.length===0?o.jsx("div",{className:ce.emptyHint,children:"All clear"}):k.map(({task:N,reason:T,workspaceName:C})=>o.jsxs("button",{type:"button",className:ce.attentionRow,onClick:()=>g(Dn(N.id)),"data-testid":"attention-row",children:[o.jsxs("div",{className:ce.attentionTitle,children:[o.jsx("span",{className:ce.reasonBadge,"data-reason":T,children:T}),N.title]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx("span",{children:C})})]},N.id))})]})]}),o.jsxs("div",{className:ce.bottomGrid,children:[o.jsxs(Et.div,{className:ce.section,variants:Bc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"◈"}),o.jsx("span",{className:ce.sectionTitle,children:"Environment Health"}),o.jsx("span",{className:ce.sectionCount,children:p.length})]}),o.jsx("div",{className:ce.sectionBody,children:p.length===0?o.jsx("div",{className:ce.emptyHint,children:"No environments configured"}):p.map(N=>o.jsxs("div",{className:ce.envRow,"data-testid":"dashboard-env-row",children:[o.jsx("span",{className:ce.envName,children:N.displayName}),o.jsx("span",{className:ce.envStatusBadge,"data-status":N.status,children:N.status})]},N.id))})]}),o.jsxs(Et.div,{className:ce.section,variants:Bc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx("span",{className:ce.sectionIcon,"aria-hidden":"true",children:"▦"}),o.jsx("span",{className:ce.sectionTitle,children:"Workspaces"}),o.jsx("span",{className:ce.sectionCount,children:t.length})]}),o.jsx("div",{className:ce.sectionBody,children:S.length===0?o.jsx("div",{className:ce.emptyHint,children:"No workspaces yet"}):S.map(({workspace:N,totalTasks:T,completedTasks:C,workingTasks:E,failedTasks:D})=>{const R=T>0?Math.round(C/T*100):0;return o.jsxs("button",{type:"button",className:ce.workspaceRow,onClick:()=>g(vi(N.id,N.environmentId)),"data-testid":"workspace-row",children:[o.jsxs("div",{className:ce.workspaceTop,children:[o.jsx("span",{className:ce.workspaceName,children:N.name}),o.jsxs("span",{className:ce.workspaceCounts,"aria-label":Yz(C,T,E,D),children:[C,"/",T,E>0&&o.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",E]}),D>0&&o.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",D]})]})]}),T>0&&o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:`${R}%`}})})]},N.id)})})]})]})]})}const Wz="_panelContainer_101ly_1",Xz="_emptyState_101ly_8",Qz="_fadeIn_101ly_1",e7="_workspaceSummary_101ly_17",t7="_workspaceSummaryTitle_101ly_28",n7="_workspaceSummarySubtitle_101ly_32",s7="_header_101ly_36",a7="_headerInfo_101ly_71",i7="_killButton_101ly_77",o7="_headerTitle_101ly_106",r7="_headerActions_101ly_121",l7="_taskStatusBadge_101ly_128",c7="_taskBranch_101ly_137",d7="_taskBlockedBadge_101ly_143",u7="_btnPrimary_101ly_151",f7="_btnDanger_101ly_182",p7="_btnGhost_101ly_221",m7="_rejectInput_101ly_247",h7="_tabBar_101ly_277",g7="_tab_101ly_277",v7="_active_101ly_303",y7="_eventScroll_101ly_308",b7="_tabContent_101ly_314",_7="_noContext_101ly_319",x7="_overviewContent_101ly_325",k7="_overviewDashboard_101ly_334",S7="_overviewHero_101ly_340",T7="_statusBadge_101ly_347",w7="_statusPending_101ly_359",j7="_statusAssigned_101ly_364",N7="_statusInProgress_101ly_369",C7="_statusReview_101ly_374",E7="_statusDone_101ly_379",A7="_statusFailed_101ly_384",D7="_statusWaitingInput_101ly_389",R7="_overviewBranchPill_101ly_394",M7="_branchLink_101ly_409",I7="_overviewSection_101ly_420",O7="_overviewLabel_101ly_426",L7="_overviewValue_101ly_433",B7="_overviewMuted_101ly_438",z7="_overviewMarkdown_101ly_444",U7="_envRow_101ly_513",$7="_envDot_101ly_519",P7="_envDotGreen_101ly_526",V7="_envDotYellow_101ly_530",H7="_envDotRed_101ly_534",q7="_envDotGray_101ly_538",G7="_depList_101ly_542",F7="_depItem_101ly_548",Z7="_depBlocked_101ly_555",K7="_depDone_101ly_559",Y7="_timeline_101ly_563",J7="_timelineRow_101ly_569",W7="_timelineKey_101ly_576",X7="_timelineValue_101ly_582",Q7="_timelineDelta_101ly_586",eU="_reviewNotes_101ly_597",tU="_overviewDescription_101ly_608",nU="_waitingMessage_101ly_614",sU="_errorMessage_101ly_618",aU="_attemptSelector_101ly_622",iU="_attemptLabel_101ly_638",oU="_attemptButton_101ly_642",rU="_attemptActive_101ly_659",lU="_attemptStatus_101ly_665",cU="_emptyCta_101ly_671",dU="_ctaTitle_101ly_683",uU="_ctaDescription_101ly_689",fU="_ctaButton_101ly_696",pU="_ctaCreateForm_101ly_731",mU="_ctaCreateInput_101ly_737",hU="_ctaCreateOk_101ly_768",gU="_ctaLink_101ly_803",vU="_workspaceHeader_101ly_817",yU="_workspaceName_101ly_842",bU="_workspaceMeta_101ly_855",_U="_metaRow_101ly_863",xU="_metaLabel_101ly_876",kU="_metaValue_101ly_891",SU="_archiveButton_101ly_901",TU="_repoLink_101ly_931",wU="_metaToggle_101ly_941",jU="_metaToggleArrow_101ly_962",NU="_metaToggleArrowOpen_101ly_967",CU="_progressBarContainer_101ly_971",EU="_progressBar_101ly_971",AU="_progressFill_101ly_987",DU="_progressLabel_101ly_994",RU="_metaTimestamps_101ly_1001",MU="_metaTimestamp_101ly_1001",B={panelContainer:Wz,emptyState:Xz,fadeIn:Qz,workspaceSummary:e7,workspaceSummaryTitle:t7,workspaceSummarySubtitle:n7,header:s7,headerInfo:a7,killButton:i7,headerTitle:o7,headerActions:r7,taskStatusBadge:l7,taskBranch:c7,taskBlockedBadge:d7,btnPrimary:u7,btnDanger:f7,btnGhost:p7,rejectInput:m7,tabBar:h7,tab:g7,active:v7,eventScroll:y7,tabContent:b7,noContext:_7,overviewContent:x7,overviewDashboard:k7,overviewHero:S7,statusBadge:T7,statusPending:w7,statusAssigned:j7,statusInProgress:N7,statusReview:C7,statusDone:E7,statusFailed:A7,statusWaitingInput:D7,overviewBranchPill:R7,branchLink:M7,overviewSection:I7,overviewLabel:O7,overviewValue:L7,overviewMuted:B7,overviewMarkdown:z7,envRow:U7,envDot:$7,envDotGreen:P7,envDotYellow:V7,envDotRed:H7,envDotGray:q7,depList:G7,depItem:F7,depBlocked:Z7,depDone:K7,timeline:Y7,timelineRow:J7,timelineKey:W7,timelineValue:X7,timelineDelta:Q7,reviewNotes:eU,overviewDescription:tU,waitingMessage:nU,errorMessage:sU,attemptSelector:aU,attemptLabel:iU,attemptButton:oU,attemptActive:rU,attemptStatus:lU,emptyCta:cU,ctaTitle:dU,ctaDescription:uU,ctaButton:fU,ctaCreateForm:pU,ctaCreateInput:mU,ctaCreateOk:hU,ctaLink:gU,workspaceHeader:vU,workspaceName:yU,workspaceMeta:bU,metaRow:_U,metaLabel:xU,metaValue:kU,archiveButton:SU,repoLink:TU,metaToggle:wU,metaToggleArrow:jU,metaToggleArrowOpen:NU,progressBarContainer:CU,progressBar:EU,progressFill:AU,progressLabel:DU,metaTimestamps:RU,metaTimestamp:MU};function IU(){return o.jsx("div",{className:B.emptyState,children:"Select a task or click + to create one"})}function OU(){return o.jsx("div",{className:B.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function LU(){const{workspaces:{workspaces:t},environments:{environments:s}}=lt(),i=xt(),r=s.length>0;return t.length>0?o.jsx(Jz,{}):o.jsxs("div",{className:B.emptyCta,"data-testid":"welcome-cta",children:[o.jsx("div",{className:B.ctaTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:B.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),o.jsx("button",{className:B.ctaButton,onClick:()=>i(E_),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&o.jsx("div",{className:B.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const BU="_panelContainer_19poq_1",zU="_chatHeader_19poq_8",UU="_chatHeaderInfo_19poq_37",$U="_emptyState_19poq_43",PU="_emptyTitle_19poq_55",VU="_emptyDescription_19poq_61",HU="_emptyHint_19poq_67",Ra={panelContainer:BU,chatHeader:zU,chatHeaderInfo:UU,emptyState:$U,emptyTitle:PU,emptyDescription:VU,emptyHint:HU};function qU(){return o.jsx("div",{className:Ra.panelContainer,"aria-hidden":"true",children:o.jsxs("div",{style:{flex:1,overflow:"hidden",padding:"var(--space-md)",display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(xe,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function GU({hasLocalEnvironment:t}){return o.jsxs("div",{className:Ra.emptyState,"data-testid":"chat-empty-state",children:[o.jsx("div",{className:Ra.emptyTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:Ra.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&&o.jsx("div",{className:Ra.emptyHint,children:"Go to Settings → Environments to add one."})]})}function FU(){const{tasks:{tasks:t,tasksLoading:s,startTask:i},sessions:{sessions:r,sessionsLoading:c,events:d,eventsDropped:u,taskSessions:p,loadTaskSessions:m,loadSessionEvents:g,kill:v,stopGraceful:b,sendInput:_,spawn:k},environments:{environments:S,provisionEnvironment:j},personas:{personas:N}}=lt(),{showToast:T}=yn(),C=y.useRef(void 0),[E,D]=y.useState(),R=t.find(X=>X.id===Tr),L=R!=null&&R.latestSessionId?r.find(X=>X.id===R.latestSessionId)??(p[Tr]??[]).find(X=>X.id===R.latestSessionId):void 0;y.useEffect(()=>{m(Tr).catch(()=>{})},[m]),y.useEffect(()=>{R!=null&&R.latestSessionId&&m(Tr).catch(()=>{})},[R==null?void 0:R.latestSessionId,m]),y.useEffect(()=>{L&&L.id!==C.current&&(C.current=L.id,g(L.id).catch(()=>{}))},[L==null?void 0:L.id,g]);const A=y.useMemo(()=>{if(!L)return[];const X=d.filter(ae=>ae.sessionId===L.id);return Xm(Wm(X))},[d,L==null?void 0:L.id]),U=S.find(X=>X.adapterType==="local"&&X.status==="connected"),F=L!==void 0&&L.status!=="stopped"&&L.status!=="suspended",ee=(L==null?void 0:L.status)==="idle";y.useEffect(()=>{E&&L&&ee&&(_(L.id,E).catch(()=>{}),D(void 0))},[E,ee,L==null?void 0:L.id,_]);const q=y.useCallback((X,ae,Q,re)=>{re&&D(re),i(X,ae,Q).catch(()=>{})},[i]);return!R&&(c||s)?o.jsx(qU,{}):o.jsxs("div",{className:Ra.panelContainer,"data-testid":"chat-page",children:[F&&o.jsxs("div",{className:Ra.chatHeader,children:[o.jsxs("span",{className:Ra.chatHeaderInfo,children:["Session: ",L.id.slice(0,8)," | ",L.runtime," | ",L.status]}),o.jsx(D_,{label:"Stop",onClick:()=>{b(L.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{b(L.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{v(L.id).catch(()=>{})}}]})]}),o.jsx(Fm,{events:A,eventsDropped:u,emptyState:o.jsx(GU,{hasLocalEnvironment:!!U}),onShowToast:T}),U&&F&&o.jsx(qr,{mode:"send",sessionId:L.id,environmentId:L.environmentId,personas:N,environments:S,onSendInput:(X,ae)=>{_(X,ae).catch(()=>{})},onSpawn:(X,ae,Q)=>{k(X,ae,Q).catch(()=>{})},onStartTask:(X,ae,Q)=>{i(X,ae,Q).catch(()=>{})},onProvisionEnvironment:X=>{j(X).catch(()=>{})},onShowToast:T}),U&&!F&&o.jsx(qr,{mode:"start",taskId:Tr,environmentId:U.id,personas:N,environments:S,onSendInput:(X,ae)=>{_(X,ae).catch(()=>{})},onSpawn:(X,ae,Q)=>{k(X,ae,Q).catch(()=>{})},onStartTask:q,onProvisionEnvironment:X=>{j(X).catch(()=>{})},onShowToast:T})]})}function ZU(){const t=v8(),[s]=cm(),i=s.get("env")??"",{sessions:{sendInput:r,spawn:c},tasks:{startTask:d},personas:{personas:u},environments:{environments:p,provisionEnvironment:m}}=lt(),{showToast:g}=yn();return o.jsxs("div",{className:B.panelContainer,children:[o.jsx(xs,{segments:t}),o.jsx("div",{className:B.emptyState,children:"Enter a prompt below to start a new session"}),o.jsx(qr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,b)=>{r(v,b).catch(()=>{})},onSpawn:(v,b,_)=>{c(v,b,_).catch(()=>{})},onStartTask:(v,b,_)=>{d(v,b,_).catch(()=>{})},onProvisionEnvironment:v=>{m(v).catch(()=>{})},onShowToast:g})]})}function KU(){return o.jsxs("div",{className:B.panelContainer,"aria-hidden":"true",children:[o.jsxs("div",{className:B.header,children:[o.jsx("span",{children:o.jsx(xe,{width:"10rem",height:"0.875rem"})}),o.jsx("span",{className:B.headerInfo,children:o.jsx(xe,{width:"16rem",height:"0.875rem"})})]}),o.jsx("div",{className:B.eventScroll,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(xe,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function YU({sessionId:t,session:s,isActive:i,onStop:r,onKill:c}){return o.jsxs("div",{className:B.header,children:[o.jsxs("span",{children:["Session: ",t.slice(0,8),s&&` | ${s.runtime} | ${s.endReason||s.status}`,s!=null&&s.inputTokens||s!=null&&s.outputTokens||s!=null&&s.costUsd?` | ${R_((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${wo(s.costUsd??0)}`:""]}),o.jsxs("span",{className:B.headerInfo,children:[s&&o.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&o.jsx(D_,{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 JU({session:t}){const s=t&&(t.status==="stopped"||t.status==="suspended"),i=s?`Session ${t.endReason||t.status} with no events recorded.`:"Waiting for events...";return o.jsx("div",{className:s?B.errorMessage:B.waitingMessage,children:i})}function WU(){const{sessionId:t}=ds(),{sessions:{events:s,eventsDropped:i,sessions:r,sessionsLoading:c,kill:d,stopGraceful:u,loadSessionEvents:p,sendInput:m,spawn:g},tasks:{startTask:v},personas:{personas:b},environments:{environments:_,provisionEnvironment:k}}=lt(),{showToast:S}=yn(),j=y.useRef(void 0),N=y8(t),T=r.find(D=>D.id===t)??void 0,C=y.useMemo(()=>{const D=t?s.filter(R=>R.sessionId===t):[];return Xm(Wm(D))},[s,t]);if(y.useEffect(()=>{t&&t!==j.current&&(j.current=t,p(t).catch(()=>{}))},[t,p]),!T&&c)return o.jsx(KU,{});if(!t)return o.jsx("div",{className:B.emptyState,children:"No session selected"});const E=(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="idle";return o.jsxs("div",{className:B.panelContainer,children:[o.jsx(xs,{segments:N}),o.jsx(YU,{sessionId:t,session:T,isActive:E,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{d(t).catch(()=>{})}}),o.jsx(Fm,{events:C,eventsDropped:i,emptyState:o.jsx(JU,{session:T}),onShowToast:S}),E&&o.jsx(qr,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:b,environments:_,onSendInput:(D,R)=>{m(D,R).catch(()=>{})},onSpawn:(D,R,L)=>{g(D,R,L).catch(()=>{})},onStartTask:(D,R,L)=>{v(D,R,L).catch(()=>{})},onProvisionEnvironment:D=>{k(D).catch(()=>{})},onShowToast:S})]})}function XU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Js(t,s){const i=y.useRef(s);i.current=s;const{key:r,ctrl:c=!1,shift:d=!1,suppressInInputs:u=!0,enabled:p=!0}=t;y.useEffect(()=>{if(!p)return;const m=g=>{if(u&&XU(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(d&&!g.shiftKey||g.key===r&&i.current())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[r,c,d,u,p])}function QU(){return o.jsxs("div",{className:B.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:B.workspaceHeader,children:o.jsx("span",{className:B.workspaceName,children:o.jsx(xe,{width:"12rem",height:"1.25rem"})})}),o.jsx("div",{className:B.metaToggle,style:{cursor:"default"},children:o.jsx(xe,{width:"4rem",height:"0.625rem"})}),o.jsxs("div",{className:B.progressBarContainer,children:[o.jsx("div",{className:B.progressBar,children:o.jsx("div",{className:B.progressFill,style:{width:"0%"}})}),o.jsx(xe,{width:"2rem",height:"0.625rem"})]}),o.jsxs("div",{className:B.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("span",{className:`${B.tab} ${B.active}`,children:"Graph"}),o.jsx("span",{className:B.tab,children:"Board"}),o.jsx("span",{className:B.tab,children:"Tasks"})]}),o.jsx("div",{className:B.overviewContent,children:Array.from({length:3},(t,s)=>o.jsx(ad,{lines:2},s))})]})}function Fb(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 xp=100;function e$(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function t$(){const{workspaceId:t,environmentId:s}=ds(),i=xt(),{tasks:{tasks:r},environments:{environments:c},workspaces:{workspaces:d,workspacesLoading:u,archiveWorkspace:p,updateWorkspace:m},personas:{personas:g},sessions:{sessions:v},usageCache:b,loadUsage:_}=lt(),{resolvedThemeId:k}=C1(),[S,j]=y.useState("tasks"),[N,T]=y.useState(!1),[C,E]=y.useState(null),[D,R]=y.useState(!1),L=y.useRef(void 0),A=d.find(O=>O.id===t),U=s??(A==null?void 0:A.environmentId)??"",F=b8(t,U,d,c);Js({key:"1"},()=>j("graph")),Js({key:"2"},()=>j("board")),Js({key:"3"},()=>j("tasks")),y.useEffect(()=>{const O=L.current;L.current=t,!(O===void 0||O===t)&&C!==null&&E(null)},[t,C]);const ee=v.reduce((O,Z)=>O+(Z.costUsd??0),0);y.useEffect(()=>{t&&_("workspace",t).catch(()=>{})},[t,_,ee]);const q=t?b[`workspace:${t}`]:void 0,X=r.filter(O=>O.workspaceId===t),ae=X.filter(O=>O.status==="complete").length,Q=X.length,re=Q>0?Math.round(ae/Q*100):0;return!A&&u?o.jsx(QU,{}):o.jsxs("div",{className:B.panelContainer,children:[o.jsx(xs,{segments:F}),o.jsxs("div",{className:B.workspaceHeader,children:[o.jsx("span",{className:B.workspaceName,"data-testid":"workspace-name",children:o.jsx(en,{value:(A==null?void 0:A.name)||"",onSave:O=>{A&&m(A.id,{name:O}).catch(()=>{})},validate:O=>{const Z=O.trim();if(!Z)return"Name is required";if(Z.length>xp)return`Max ${xp} characters`},maxLength:xp,fieldId:"name",activeFieldId:C,onActivate:E,ariaLabel:"Workspace name",renderDisplay:O=>O||t||void 0,"data-testid":"edit-name"})}),o.jsx("button",{className:B.archiveButton,onClick:()=>T(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),o.jsxs("button",{className:B.metaToggle,onClick:()=>R(!D),"aria-expanded":!D,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[o.jsx("span",{className:`${B.metaToggleArrow} ${D?"":B.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!D&&o.jsxs("div",{className:B.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[o.jsxs("div",{className:B.metaRow,children:[o.jsx("span",{className:B.metaLabel,children:"Description"}),o.jsx("div",{className:B.metaValue,children:o.jsx(Zp,{value:(A==null?void 0:A.description)||"",onSave:O=>{A&&m(A.id,{description:O}).catch(()=>{})},fieldId:"description",activeFieldId:C,onActivate:E,renderDisplay:O=>O?o.jsx("span",{className:B.overviewMarkdown,children:o.jsx(cd,{remarkPlugins:[dd],children:O})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),o.jsxs("div",{className:B.metaRow,children:[o.jsx("span",{className:B.metaLabel,children:"Repository"}),o.jsx("div",{className:B.metaValue,children:o.jsx(en,{value:(A==null?void 0:A.repoUrl)||"",onSave:O=>{A&&m(A.id,{repoUrl:O}).catch(()=>{})},validate:O=>{const Z=O.trim();if(Z&&!/^https?:\/\/.+/.test(Z))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:C,onActivate:E,renderDisplay:O=>{const Z=e$(O);return Z?o.jsx("a",{className:B.repoLink,href:Z,target:"_blank",rel:"noopener noreferrer",onClick:se=>se.stopPropagation(),children:O}):O?o.jsx("span",{children:O}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),o.jsxs("div",{className:B.metaRow,children:[o.jsx("span",{className:B.metaLabel,children:"Environment"}),o.jsx("div",{className:B.metaValue,children:o.jsx(x4,{value:(A==null?void 0:A.environmentId)||"",onSave:O=>{A&&O&&m(A.id,{environmentId:O}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:C,onActivate:E,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),o.jsxs("div",{className:B.metaRow,children:[o.jsx("span",{className:B.metaLabel,children:"Persona"}),o.jsx("div",{className:B.metaValue,children:o.jsx(id,{value:(A==null?void 0:A.defaultPersonaId)||"",onSave:O=>{A&&m(A.id,{defaultPersonaId:O}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...g.map(O=>({value:O.id,label:O.name}))],fieldId:"defaultPersonaId",activeFieldId:C,onActivate:E,renderDisplay:O=>{const Z=g.find(se=>se.id===O);if(Z)return o.jsx("span",{children:Z.name})},placeholder:(A==null?void 0:A.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),o.jsxs("div",{className:B.metaRow,children:[o.jsx("span",{className:B.metaLabel,children:"Worktrees"}),o.jsx("div",{className:B.metaValue,children:o.jsx(p4,{checked:(A==null?void 0:A.useWorktrees)??!0,onChange:O=>{A&&m(A.id,{useWorktrees:O}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),o.jsxs("div",{className:B.metaRow,children:[o.jsx("span",{className:B.metaLabel,children:"Working Dir"}),o.jsx("div",{className:B.metaValue,children:o.jsx(en,{value:(A==null?void 0:A.workingDirectory)||"",onSave:O=>{A&&m(A.id,{workingDirectory:O}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:C,onActivate:E,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),A&&o.jsxs("div",{className:B.metaTimestamps,children:[o.jsxs("span",{className:B.metaTimestamp,children:["Created ",Fb(A.createdAt)]}),A.updatedAt&&A.updatedAt!==A.createdAt&&o.jsxs("span",{className:B.metaTimestamp,children:["· Updated ",Fb(A.updatedAt)]})]})]}),Q>0&&o.jsxs("div",{className:B.progressBarContainer,"data-testid":"progress-bar",children:[o.jsx("div",{className:B.progressBar,children:o.jsx("div",{className:B.progressFill,style:{width:`${re}%`}})}),o.jsxs("span",{className:B.progressLabel,children:[ae,"/",Q]})]}),q&&q.costUsd>0&&o.jsx("div",{className:B.progressBarContainer,children:o.jsxs("span",{className:B.progressLabel,children:["Usage: ",wo(q.costUsd)," (",q.sessionCount," session",q.sessionCount!==1?"s":"",")"]})}),o.jsxs("div",{className:B.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("button",{role:"tab","aria-selected":S==="graph",className:`${B.tab} ${S==="graph"?B.active:""}`,onClick:()=>j("graph"),children:"Graph"}),o.jsx("button",{role:"tab","aria-selected":S==="board",className:`${B.tab} ${S==="board"?B.active:""}`,onClick:()=>j("board"),"data-testid":"board-tab",children:"Board"}),o.jsx("button",{role:"tab","aria-selected":S==="tasks",className:`${B.tab} ${S==="tasks"?B.active:""}`,onClick:()=>j("tasks"),children:"Tasks"})]}),S==="tasks"&&Q>0&&o.jsxs("div",{className:B.workspaceSummary,children:[o.jsx("span",{className:B.workspaceSummaryTitle,children:`${ae}/${Q} tasks complete`}),o.jsx("span",{className:B.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),S==="tasks"&&Q===0&&o.jsxs("div",{className:B.emptyCta,children:[o.jsx("button",{className:B.ctaButton,onClick:()=>i(Si(t,void 0,U)),children:"Create Task"}),o.jsx("div",{className:B.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),S==="board"&&o.jsx(VB,{workspaceId:t,environmentId:U,tasks:r,sessions:v,personas:g,environments:c}),S==="graph"&&o.jsx(aN,{workspaceId:t,environmentId:U,tasks:r,resolvedThemeId:k}),o.jsx(_i,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{A&&(p(A.id).catch(()=>{}),i("/",{replace:!0})),T(!1)},onCancel:()=>T(!1)})]})}const n$="_container_3pgew_1",s$="_header_3pgew_8",a$="_headerTitle_3pgew_35",i$="_headerActions_3pgew_44",o$="_body_3pgew_51",r$="_btnPrimary_3pgew_63",l$="_btnGhost_3pgew_94",c$="_error_3pgew_116",Ea={container:n$,header:s$,headerTitle:a$,headerActions:i$,body:o$,btnPrimary:r$,btnGhost:l$,error:c$};function d$(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 u$=[{label:"Home",url:bi},{label:"New Workspace",url:void 0}];function f$(){const[t]=cm(),s=t.get("environment")??void 0,{environments:{environments:i},personas:{personas:r},workspaces:{createWorkspace:c,workspaceCreating:d}}=lt(),{showToast:u}=yn(),p=xt(),[m,g]=y.useState(()=>{var N;return QB(void 0,s||((N=i[0])==null?void 0:N.id))}),[v,b]=y.useState(),[_,k]=y.useState();y.useEffect(()=>{s||m.environmentId||i.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=i[0])==null?void 0:T.id)??""}})},[i,s,m.environmentId]);const S=()=>{const N=d$(m);if(N){b(N),k(void 0);return}b(void 0),k(void 0),c(m.name.trim(),m.description,m.repoUrl.trim(),m.environmentId,m.defaultPersonaId,m.useWorktrees,m.workingDirectory,()=>{u("Workspace created","success"),p(bi,{replace:!0})},T=>{k(T)}).catch(()=>{})},j=()=>{p(s?yi(s):bi,{replace:!0})};return o.jsxs("div",{className:Ea.container,children:[o.jsxs("div",{className:Ea.header,children:[o.jsx("div",{className:Ea.headerTitle,children:o.jsx(xs,{segments:u$})}),o.jsxs("div",{className:Ea.headerActions,children:[o.jsx("button",{className:Ea.btnGhost,onClick:j,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),o.jsx("button",{className:Ea.btnPrimary,onClick:S,disabled:d||!m.name.trim()||!m.environmentId,"data-testid":"workspace-create-save",children:d?o.jsx(l1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),o.jsxs("div",{className:Ea.body,children:[o.jsx(t8,{values:m,onChange:N=>{g(N),b(void 0),k(void 0)},environments:i,personas:r,errors:v,disabled:d,autoFocusName:!0}),_&&o.jsx("div",{className:Ea.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function Zb(){const{workspaceId:t,environmentId:s}=ds(),[i]=cm(),r=t??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:{tasks:d,createTask:u,updateTask:p},workspaces:{workspaces:m},personas:{personas:g}}=lt(),{showToast:v}=yn();return o.jsx(x1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:m,personas:g,onCreateTask:(b,_,k,S,j,N,T,C,E)=>{u(b,_,k,S,j,N,T,C,E).catch(()=>{})},onUpdateTask:(b,_,k,S,j)=>{p(b,_,k,S,j).catch(()=>{})},onShowToast:v})}function p$(){return o.jsxs("div",{className:B.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:B.header,children:o.jsxs("span",{className:B.headerTitle,children:[o.jsx(xe,{width:"12rem",height:"1rem"}),o.jsx(xe,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),o.jsxs("div",{className:B.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("span",{className:`${B.tab} ${B.active}`,children:"Overview"}),o.jsx("span",{className:B.tab,children:"Stream"}),o.jsx("span",{className:B.tab,children:"Findings"})]}),o.jsx("div",{className:B.overviewContent,children:o.jsxs("div",{className:B.overviewDashboard,children:[o.jsx("div",{className:B.overviewHero,children:o.jsx(xe,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Description"}),o.jsx(Fp,{lines:2})]}),o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Environment"}),o.jsxs("div",{className:B.envRow,children:[o.jsx(xe,{width:"0.5rem",height:"0.5rem",variant:"circular"}),o.jsx(xe,{width:"8rem",height:"0.875rem"})]})]}),o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Dependencies"}),o.jsx(Fp,{lines:2})]}),o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Timeline"}),o.jsx("div",{className:B.timeline,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:B.timelineRow,children:[o.jsx(xe,{width:"4rem",height:"0.75rem"}),o.jsx(xe,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Uc(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 kp(t,s){if(!t||!s)return;const i=new Date(s).getTime()-new Date(t).getTime();if(isNaN(i)||i<0)return;const r=Math.floor(i/6e4),c=Math.floor(i%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 Kb(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?B.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?B.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?B.envDotRed:B.envDotGray}function m$({status:t}){const s=Ia(t),i=J2(t);return o.jsx("span",{className:`${B.statusBadge} ${B[i]??B.statusPending}`,children:s.label})}function h$({task:t,tasksById:s,environments:i,workspaces:r,taskSessions:c,selectedEnvId:d}){const{loadUsage:u,usageCache:p}=lt(),m=c.reduce((E,D)=>E+(D.costUsd??0),0);y.useEffect(()=>{u("task",t.id).catch(()=>{}),t.childTaskIds.length>0&&u("task_tree",t.id).catch(()=>{})},[t.id,t.childTaskIds.length,u,m]);const g=`task:${t.id}`,v=g in p?p[g]:void 0,b=`task_tree:${t.id}`,_=t.childTaskIds.length>0&&b in p?p[b]:void 0,k=c.length>0?c[c.length-1]:void 0,S=(k==null?void 0:k.environmentId)??"",j=S?i.find(E=>E.id===S):void 0,N=r.find(E=>E.id===t.workspaceId),T=i.find(E=>E.id===d),C=t.branch&&(N!=null&&N.repoUrl)?`${N.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return o.jsxs("div",{className:B.overviewDashboard,children:[o.jsxs("div",{className:B.overviewHero,children:[o.jsx(m$,{status:t.status}),t.branch&&o.jsx("span",{className:B.overviewBranchPill,children:C?o.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:B.branchLink,children:["🔗"," ",t.branch]}):o.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Description"}),o.jsx("div",{className:B.overviewMarkdown,children:o.jsx(cd,{remarkPlugins:[dd],children:t.description})})]}),t.workpad&&o.jsx(IL,{workpad:t.workpad}),o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Environment"}),S&&j?o.jsxs("div",{className:B.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${B.envDot} ${Kb(j.status)}`,title:j.status,"aria-label":`Status: ${j.status}`,role:"img"}),o.jsx("span",{className:B.overviewValue,children:j.displayName})]}):T?o.jsxs("div",{className:B.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${B.envDot} ${Kb(T.status)}`,title:T.status,"aria-label":`Status: ${T.status}`,role:"img"}),o.jsx("span",{className:B.overviewValue,children:T.displayName}),o.jsx("span",{className:B.overviewMuted,children:"(workspace default)"})]}):o.jsx("div",{className:B.overviewMuted,children:"Set in workspace settings"})]}),o.jsxs("div",{className:B.overviewSection,"data-testid":"task-overview-dependencies",children:[o.jsx("div",{className:B.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?o.jsx("div",{className:B.overviewMuted,children:"None"}):o.jsx("div",{className:B.depList,children:t.dependsOn.map(E=>{const D=s.get(E),R=(D==null?void 0:D.status)==="complete";return o.jsxs("div",{className:`${B.depItem} ${R?B.depDone:B.depBlocked}`,children:[o.jsx("span",{children:R?"✓":"○"}),o.jsx("span",{children:(D==null?void 0:D.title)??E})]},E)})})]}),o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Timeline"}),o.jsxs("div",{className:B.timeline,children:[t.createdAt&&o.jsxs("div",{className:B.timelineRow,children:[o.jsx("span",{className:B.timelineKey,children:"Created"}),o.jsx("span",{className:B.timelineValue,children:Uc(t.createdAt)})]}),t.assignedAt&&(()=>{const E=kp(t.createdAt,t.assignedAt);return o.jsxs("div",{className:B.timelineRow,children:[o.jsx("span",{className:B.timelineKey,children:"Assigned"}),o.jsx("span",{className:B.timelineValue,children:Uc(t.assignedAt)}),E!==void 0&&o.jsx("span",{className:B.timelineDelta,children:E})]})})(),t.startedAt&&(()=>{const E=kp(t.assignedAt??t.createdAt,t.startedAt);return o.jsxs("div",{className:B.timelineRow,children:[o.jsx("span",{className:B.timelineKey,children:"Started"}),o.jsx("span",{className:B.timelineValue,children:Uc(t.startedAt)}),E!==void 0&&o.jsx("span",{className:B.timelineDelta,children:E})]})})(),t.completedAt&&(()=>{const E=kp(t.startedAt,t.completedAt);return o.jsxs("div",{className:B.timelineRow,children:[o.jsx("span",{className:B.timelineKey,children:"Completed"}),o.jsx("span",{className:B.timelineValue,children:Uc(t.completedAt)}),E!==void 0&&o.jsx("span",{className:B.timelineDelta,children:E})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&o.jsx("div",{className:B.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Usage"}),o.jsxs("div",{className:B.timeline,children:[o.jsxs("div",{className:B.timelineRow,children:[o.jsx("span",{className:B.timelineKey,children:"Cost"}),o.jsx("span",{className:B.timelineValue,children:wo(v.costUsd)}),o.jsxs("span",{className:B.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),_&&_.costUsd>v.costUsd&&o.jsxs("div",{className:B.timelineRow,children:[o.jsx("span",{className:B.timelineKey,children:"Total (incl. subtasks)"}),o.jsx("span",{className:B.timelineValue,children:wo(_.costUsd)}),o.jsxs("span",{className:B.timelineDelta,children:[_.sessionCount," session",_.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&o.jsxs("div",{className:B.overviewSection,children:[o.jsx("div",{className:B.overviewLabel,children:"Review Notes"}),o.jsx("div",{className:B.reviewNotes,children:t.reviewNotes})]})]})}function g$({task:t,sessionId:s,isBlocked:i,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:m}){if(t.status==="not_started")return i?o.jsxs("div",{className:B.headerActions,children:[o.jsx("button",{onClick:m,className:B.btnGhost,children:"Edit"}),o.jsx("button",{onClick:p,className:B.btnDanger,children:"Delete"})]}):o.jsxs("div",{className:B.headerActions,children:[o.jsx("button",{"data-testid":"task-header-start",onClick:r,className:B.btnPrimary,children:"Start"}),o.jsx("button",{onClick:m,className:B.btnGhost,children:"Edit"}),o.jsx("button",{onClick:p,className:B.btnDanger,children:"Delete"})]});if(t.status==="working")return o.jsxs("div",{className:B.headerActions,children:[o.jsx("button",{onClick:d,className:B.btnDanger,children:"Stop"}),o.jsx("button",{onClick:u,disabled:!s,className:B.btnGhost,children:"Pause"})]});if(t.status==="paused")return o.jsxs("div",{className:B.headerActions,children:[o.jsx("button",{onClick:d,className:B.btnPrimary,children:"Stop"}),o.jsx("button",{onClick:c,className:B.btnGhost,children:"Resume"}),o.jsx("button",{onClick:p,className:B.btnDanger,children:"Delete"})]});if(t.status==="complete")return o.jsx("div",{className:B.headerActions,children:o.jsx("button",{onClick:p,className:B.btnDanger,children:"Delete"})});if(t.status==="failed")return o.jsxs("div",{className:B.headerActions,children:[o.jsx("button",{onClick:r,className:B.btnPrimary,children:"Retry"}),o.jsx("button",{onClick:p,className:B.btnDanger,children:"Delete"})]})}function v$({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return o.jsxs("div",{className:B.attemptSelector,"data-testid":"attempt-selector",children:[o.jsx("span",{className:B.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 o.jsxs("button",{className:`${B.attemptButton} ${d?B.attemptActive:""}`,onClick:()=>i(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&&o.jsx("span",{className:B.attemptStatus,children:u})]},r.id)})]})}function Aa(){const{taskId:t,workspaceId:s,environmentId:i}=ds(),r=Ht(),c=xt(),{showToast:d}=yn(),{sessions:{events:u,eventsDropped:p,sessions:m,loadSessionEvents:g,taskSessions:v,loadTaskSessions:b,sendInput:_,spawn:k,kill:S},tasks:{tasks:j,tasksLoading:N,startTask:T,stopTask:C,resumeTask:E,deleteTask:D,createTask:R,updateTask:L},environments:{environments:A,provisionEnvironment:U},findings:{findings:F,loadFindings:ee},workspaces:{workspaces:q},personas:{personas:X}}=lt(),ae=y.useRef(void 0),Q=y.useRef(void 0),re=y.useRef(void 0),O=y.useRef(void 0),Z=y.useRef(void 0),se=r.pathname.endsWith("/stream")?"stream":r.pathname.endsWith("/findings")?"findings":"overview",ue=r.pathname.endsWith("/edit"),[de,Ge]=y.useState(se),[De,Ne]=y.useState(!1),[Oe,fe]=y.useState(void 0),[ye,me]=y.useState(""),[Ue,pt]=y.useState(ue),bn=y.useRef(se),ie=y.useRef(ue),W=j.find(_e=>_e.id===t),ct=(W==null?void 0:W.workspaceId)||void 0,Le=q.find(_e=>_e.id===ct);y.useEffect(()=>{se!==bn.current&&(bn.current=se,se!==de&&Ge(se))},[se,de]),y.useEffect(()=>{ue!==ie.current&&(ie.current=ue,ue!==Ue&&pt(ue))},[ue,Ue]),y.useEffect(()=>{if(ye===""){if(Le!=null&&Le.environmentId)me(Le.environmentId);else if(A.length>0){const _e=A.find(Qe=>Qe.status==="connected");me((_e==null?void 0:_e.id)??A[0].id)}}},[ye,Le==null?void 0:Le.environmentId,A]);const $t=W?v[W.id]??[]:[];let dt;Oe&&$t.some(_e=>_e.id===Oe)?dt=Oe:dt=(W==null?void 0:W.latestSessionId)||void 0;const ta=()=>{Ne(!0)},ks=()=>{if(!W)return;D(W.id).catch(()=>{}),Ne(!1);const _e=i??(Le==null?void 0:Le.environmentId);c(W.workspaceId&&_e?vi(W.workspaceId,_e):"/",{replace:!0})};y.useEffect(()=>{(W==null?void 0:W.id)!==Q.current&&(Q.current=W==null?void 0:W.id,fe(void 0),me(""),pt(ue))},[W==null?void 0:W.id,ue]),y.useEffect(()=>{if(!(W!=null&&W.id))return;const _e=W.id!==O.current,Qe=W.latestSessionId!==Z.current;(_e||Qe)&&(O.current=W.id,Z.current=W.latestSessionId,b(W.id).catch(()=>{}))},[W==null?void 0:W.id,W==null?void 0:W.latestSessionId,b]),y.useEffect(()=>{if((W==null?void 0:W.status)!==re.current){const _e=re.current===void 0;re.current=W==null?void 0:W.status;const Qe=(W==null?void 0:W.status)==="not_started"?"overview":(W==null?void 0:W.status)==="working"||(W==null?void 0:W.status)==="paused"?"stream":(W==null?void 0:W.status)==="complete"?"findings":void 0;Qe&&Qe!==de&&!(_e&&se!=="overview")&&Ge(Qe)}},[W==null?void 0:W.status,de,se]);const _n=y.useMemo(()=>new Map(j.map(_e=>[_e.id,_e])),[j]),Ss=y.useMemo(()=>{const _e=dt?u.filter(Qe=>Qe.sessionId===dt):[];return Xm(Wm(_e))},[u,dt]),us=W?W.dependsOn.some(_e=>{const Qe=_n.get(_e);return Qe!==void 0&&Qe.status!=="complete"}):!1,wi=y.useMemo(()=>_8(t,i,q,A,_n),[t,i,q,A,_n]);y.useEffect(()=>{dt&&dt!==ae.current&&(ae.current=dt,g(dt).catch(()=>{}))},[dt,g]),y.useEffect(()=>{de==="findings"&&ct&&ee(ct).catch(()=>{})},[de,ct,ee]);const Wn=_e=>{Ge(_e),c(Dn(t,_e==="overview"?void 0:_e,s,i))};return Js({key:"1"},()=>Wn("overview")),Js({key:"2"},()=>Wn("stream")),Js({key:"3"},()=>Wn("findings")),!W&&N?o.jsx(p$,{}):o.jsxs("div",{className:B.panelContainer,children:[o.jsx(xs,{segments:wi}),o.jsxs("div",{className:B.header,children:[o.jsxs("span",{className:B.headerTitle,children:[o.jsx("span",{"data-testid":"task-title",children:(W==null?void 0:W.title)||t}),W&&o.jsx("span",{className:B.taskStatusBadge,"data-testid":"task-status",children:W.status}),(W==null?void 0:W.branch)&&o.jsx("span",{className:B.taskBranch,children:W.branch}),us&&o.jsx("span",{className:B.taskBlockedBadge,children:"blocked"})]}),W&&o.jsx(g$,{task:W,sessionId:dt,isBlocked:us,onStart:()=>{T(W.id,void 0,ye).catch(()=>{})},onResume:()=>{E(W.id).catch(()=>{})},onStop:()=>{C(W.id).catch(()=>{})},onPause:()=>{dt&&S(dt).catch(()=>{})},onDelete:ta,onEdit:()=>pt(!0)})]}),o.jsxs("div",{className:B.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("button",{role:"tab","aria-selected":de==="overview",className:`${B.tab} ${de==="overview"?B.active:""}`,onClick:()=>Wn("overview"),children:"Overview"}),o.jsx("button",{role:"tab","aria-selected":de==="stream",className:`${B.tab} ${de==="stream"?B.active:""}`,onClick:()=>Wn("stream"),children:"Stream"}),o.jsx("button",{role:"tab","aria-selected":de==="findings",className:`${B.tab} ${de==="findings"?B.active:""}`,onClick:()=>Wn("findings"),children:"Findings"})]}),o.jsxs(cs,{mode:"wait",children:[de==="overview"&&o.jsx(Et.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:B.overviewContent,"data-testid":"task-overview",children:Ue&&W?o.jsx(x1,{mode:"edit",taskId:W.id,workspaceId:ct,environmentId:i,tasks:j,workspaces:q,personas:X,onCreateTask:(_e,Qe,on,xn,In,ji,Pa,Ni,Ci)=>{R(_e,Qe,on,xn,In,ji,Pa,Ni,Ci).catch(()=>{})},onUpdateTask:(_e,Qe,on,xn,In)=>{L(_e,Qe,on,xn,In).catch(()=>{})},onEditDone:()=>{ue?c(Dn(W.id,void 0,s,i),{replace:!0}):pt(!1)},onShowToast:d}):W?o.jsx(h$,{task:W,tasksById:_n,environments:A,workspaces:q,taskSessions:$t,selectedEnvId:ye}):o.jsx("div",{className:B.waitingMessage,children:"No additional details"})},"overview"),de==="stream"&&o.jsxs(Et.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:[o.jsx(v$,{taskSessions:$t,selectedSessionId:dt,onSelect:_e=>fe(_e)}),o.jsx(Fm,{events:Ss,eventsDropped:p,emptyState:!dt&&W?us?o.jsx("div",{className:B.emptyCta,"data-testid":"stream-blocked-message",children:o.jsx("div",{className:B.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):o.jsxs("div",{className:B.emptyCta,children:[o.jsx("button",{"data-testid":"stream-start-cta",className:B.ctaButton,onClick:()=>{T(W.id,void 0,ye).catch(()=>{})},children:"Start Task"}),o.jsx("div",{className:B.ctaDescription,children:"Click to begin agent execution"})]}):dt&&Ss.length===0?o.jsx("div",{className:B.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:d})]},"stream"),de==="findings"&&o.jsx(Et.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:B.tabContent,children:ct?o.jsx(b1,{findings:F.filter(_e=>_e.workspaceId===ct)}):o.jsx("div",{className:B.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!W||W.status!=="working"&&W.status!=="paused")return;const _e=dt?m.find(Qe=>Qe.id===dt):void 0;if(!(!_e||_e.status==="stopped"))return o.jsx(qr,{mode:"send",sessionId:_e.id,environmentId:_e.environmentId,personas:X,environments:A,onSendInput:(Qe,on)=>{_(Qe,on).catch(()=>{})},onSpawn:(Qe,on,xn)=>{k(Qe,on,xn).catch(()=>{})},onStartTask:(Qe,on,xn)=>{T(Qe,on,xn).catch(()=>{})},onProvisionEnvironment:Qe=>{U(Qe).catch(()=>{})},onShowToast:d})})(),W&&o.jsx(_i,{isOpen:De,title:"Delete Task?",description:`"${W.title}" will be permanently removed.`,onConfirm:ks,onCancel:()=>Ne(!1)})]})}function y$(){const{environments:{environments:t,addEnvironment:s,updateEnvironment:i},codespaces:{codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,listCodespaces:p,createCodespace:m}}=lt(),{showToast:g}=yn();return o.jsx(k1,{mode:"new",environments:t,onAddEnvironment:(v,b,_)=>{s(v,b,_).catch(()=>{})},onUpdateEnvironment:(v,b)=>{i(v,b).catch(()=>{})},onListCodespaces:()=>{p().catch(()=>{})},codespaces:r,codespaceError:c,codespaceListError:d,codespaceCreating:u,onCreateCodespace:(v,b)=>{m(v,b).catch(()=>{})},onShowToast:g})}function b$(){const{environmentId:t}=ds(),{environments:{environments:s,addEnvironment:i,updateEnvironment:r},codespaces:{codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,listCodespaces:m,createCodespace:g}}=lt(),{showToast:v}=yn();return o.jsx(k1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(b,_,k)=>{i(b,_,k).catch(()=>{})},onUpdateEnvironment:(b,_)=>{r(b,_).catch(()=>{})},onListCodespaces:()=>{m().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(b,_)=>{g(b,_).catch(()=>{})},onShowToast:v})}const _$="_layout_11u79_1",x$="_content_11u79_8",k$="_tabPanel_11u79_14",Hr={layout:_$,content:x$,tabPanel:k$};function S$(){const t=g8();return o.jsxs("div",{className:Hr.layout,children:[o.jsx(xs,{segments:t}),o.jsx("div",{className:Hr.content,children:o.jsx(za,{})})]})}const T$="_container_13sb6_1",w$="_envHeader_13sb6_6",j$="_envTitleRow_13sb6_10",N$="_statusDot_13sb6_16",C$="_envName_13sb6_21",E$="_statusBadge_13sb6_27",A$="_envMeta_13sb6_33",D$="_metaTag_13sb6_39",R$="_actions_13sb6_51",M$="_provisionMessage_13sb6_59",I$="_errorMessage_13sb6_64",O$="_section_13sb6_69",L$="_sectionHeader_13sb6_73",B$="_cardList_13sb6_121",z$="_card_13sb6_121",U$="_cardHeader_13sb6_138",$$="_cardName_13sb6_144",P$="_cardActions_13sb6_149",V$="_cardDescription_13sb6_154",H$="_cardMeta_13sb6_160",q$="_repoLink_13sb6_166",G$="_empty_13sb6_174",F$="_btnPrimary_13sb6_180",Z$="_btnOutline_13sb6_214",K$="_btnSmall_13sb6_241",Y$="_btnDanger_13sb6_267",Ae={container:T$,envHeader:w$,envTitleRow:j$,statusDot:N$,envName:C$,statusBadge:E$,envMeta:A$,metaTag:D$,actions:R$,provisionMessage:M$,errorMessage:I$,section:O$,sectionHeader:L$,cardList:B$,card:z$,cardHeader:U$,cardName:$$,cardActions:P$,cardDescription:V$,cardMeta:H$,repoLink:q$,empty:G$,btnPrimary:F$,btnOutline:Z$,btnSmall:K$,btnDanger:Y$};function J$(){return o.jsxs("div",{className:Ae.container,"aria-hidden":"true",children:[o.jsxs("div",{className:Ae.envHeader,children:[o.jsxs("div",{className:Ae.envTitleRow,children:[o.jsx(xe,{width:"0.875rem",height:"0.875rem",variant:"circular"}),o.jsx(xe,{width:"12rem",height:"1.5rem"}),o.jsx(xe,{width:"4rem",height:"0.875rem"})]}),o.jsxs("div",{className:Ae.envMeta,children:[o.jsx(xe,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),o.jsxs("div",{className:Ae.actions,children:[o.jsx(xe,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(xe,{width:"4rem",height:"2rem",borderRadius:"var(--radius-sm)"})]}),o.jsxs("div",{className:Ae.section,children:[o.jsx("div",{className:Ae.sectionHeader,children:o.jsx("h3",{style:{margin:0},children:"Workspaces"})}),o.jsxs("div",{className:Ae.cardList,children:[o.jsx(ad,{lines:2}),o.jsx(ad,{lines:2})]})]})]})}const W$={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function X$(){const{environmentId:t}=ds(),s=xt(),{environments:{environments:i,environmentsLoading:r,provisionStatus:c,provisionEnvironment:d,stopEnvironment:u,removeEnvironment:p},workspaces:{workspaces:m,archiveWorkspace:g},sessions:{sessions:v}}=lt(),[b,_]=y.useState(!1),[k,S]=y.useState(!1),[j,N]=y.useState(void 0),T=i.find(ae=>ae.id===t);if(!T&&r)return o.jsx(J$,{});if(!t||!T)return o.jsx(ls,{to:To,replace:!0});const C=m.filter(ae=>ae.environmentId===T.id),E=v.filter(ae=>ae.environmentId===T.id),D=E.reduce((ae,Q)=>ae+(Q.costUsd??0),0),R=W$[T.status]||"var(--text-tertiary)",L=T.status==="connected",A=T.status==="connecting",U=T.status==="disconnected"||T.status==="error"||T.status==="sleeping",F=T.id in c?c[T.id]:void 0,ee=()=>{p(T.id).catch(()=>{}),_(!1),s(To,{replace:!0})},q=()=>{S(!1),d(T.id,!0).catch(()=>{})},X=ae=>{g(ae).catch(()=>{}),N(void 0)};return o.jsxs("div",{className:Ae.container,children:[o.jsx(_i,{isOpen:b,title:"Delete Environment?",description:`"${T.displayName||T.id}" will be permanently removed along with all its data.`,onConfirm:ee,onCancel:()=>_(!1)}),o.jsx(_i,{isOpen:k,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:q,onCancel:()=>S(!1)}),o.jsxs("div",{className:Ae.envHeader,children:[o.jsxs("div",{className:Ae.envTitleRow,children:[o.jsx("span",{className:Ae.statusDot,style:{color:R},children:"●"}),o.jsx("h2",{className:Ae.envName,children:T.displayName||T.id}),o.jsx("span",{className:Ae.statusBadge,style:{color:R},children:T.status})]}),o.jsxs("div",{className:Ae.envMeta,children:[o.jsxs("span",{className:Ae.metaTag,children:["Adapter: ",T.adapterType]}),E.length>0&&o.jsxs("span",{className:Ae.metaTag,children:[E.length," session",E.length!==1?"s":""]}),D>0&&o.jsxs("span",{className:Ae.metaTag,children:["Cost: ",wo(D)]})]})]}),o.jsxs("div",{className:Ae.actions,children:[L&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Ae.btnPrimary,onClick:()=>s(N_(T.id)),children:"New Chat"}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>{u(T.id).catch(()=>{})},children:"Stop"}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>S(!0),disabled:F!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),U&&o.jsx("button",{className:Ae.btnPrimary,onClick:()=>{d(T.id).catch(()=>{})},children:T.status==="error"?"Retry":T.status==="sleeping"?"Wake":"Connect"}),A&&F!==void 0&&o.jsx("span",{className:Ae.provisionMessage,children:F.message}),T.status==="error"&&(F==null?void 0:F.stage)==="error"&&o.jsx("span",{className:Ae.errorMessage,children:F.message}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>s(Kj(T.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),o.jsx("button",{className:Ae.btnDanger,onClick:()=>_(!0),children:"Delete"})]}),o.jsxs("div",{className:Ae.section,children:[o.jsxs("div",{className:Ae.sectionHeader,children:[o.jsx("h3",{children:"Workspaces"}),o.jsx("button",{className:Ae.btnPrimary,onClick:()=>s(`${E_}?environment=${encodeURIComponent(T.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),C.length===0&&o.jsx("p",{className:Ae.empty,children:"No workspaces yet. Create one to get started."}),o.jsx("div",{className:Ae.cardList,children:C.map(ae=>o.jsx(Q$,{workspace:ae,confirmArchiveId:j,onOpen:()=>s(vi(ae.id,T.id)),onArchive:()=>N(ae.id),onConfirmArchive:()=>X(ae.id),onCancelArchive:()=>N(void 0)},ae.id))})]})]})}function Q$({workspace:t,confirmArchiveId:s,onOpen:i,onArchive:r,onConfirmArchive:c,onCancelArchive:d}){const u=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return o.jsxs("div",{className:Ae.card,"data-testid":"workspace-card",children:[o.jsxs("div",{className:Ae.cardHeader,children:[o.jsx("strong",{className:Ae.cardName,children:t.name}),o.jsxs("div",{className:Ae.cardActions,children:[o.jsx("button",{className:Ae.btnSmall,onClick:i,children:"Open"}),u?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Ae.btnDanger,onClick:c,children:"Confirm"}),o.jsx("button",{className:Ae.btnSmall,onClick:d,children:"Cancel"})]}):o.jsx("button",{className:Ae.btnSmall,onClick:r,children:"Archive"})]})]}),t.description&&o.jsx("p",{className:Ae.cardDescription,children:t.description}),t.repoUrl&&o.jsx("div",{className:Ae.cardMeta,children:p?o.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Ae.repoLink,children:t.repoUrl}):o.jsx("span",{children:t.repoUrl})})]})}const e9={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function t9(){const s=Ht().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=e9[s],r=h8(i);return o.jsxs("div",{className:Hr.layout,children:[o.jsx(xs,{segments:r}),o.jsx("div",{className:Hr.content,children:o.jsx("div",{className:Hr.tabPanel,children:o.jsx(za,{})},s)})]})}function n9(){const{tokens:{tokens:t,setToken:s,deleteToken:i},credentials:{credentialProviders:r,updateCredentialProviders:c}}=lt(),{showToast:d}=yn();return o.jsxs(o.Fragment,{children:[o.jsx(LL,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),o.jsx(AO,{tokens:t,onSetToken:(u,p,m,g,v)=>{s(u,p,m,g,v).catch(()=>{})},onDeleteToken:u=>{i(u).catch(()=>{})},onShowToast:d})]})}function s9(){const{personas:{personas:t,deletePersona:s},appDefaultPersonaId:i,setAppDefaultPersonaId:r}=lt(),{showToast:c}=yn(),d=xt();return o.jsx(YL,{personas:t,appDefaultPersonaId:i,onDeletePersona:async u=>{try{await s(u)}catch(p){throw console.error("Failed to delete persona",{personaId:u,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async u=>{try{await r(u)}catch(p){console.error("Failed to set app default persona ID",{personaId:u,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>d(Jj),onNavigateToPersona:u=>d(C_(u))})}const a9="_container_1ooin_1",i9="_form_1ooin_7",o9="_formActions_1ooin_75",r9="_editableSection_1ooin_82",l9="_defaultBadge_1ooin_93",c9="_typeToggle_1ooin_107",d9="_scriptEditor_1ooin_121",u9="_optional_1ooin_128",os={container:a9,form:i9,formActions:o9,editableSection:r9,defaultBadge:l9,typeToggle:c9,scriptEditor:d9,optional:u9},Yb=[{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)"}],Jb=[{value:"genaiscript",label:"genaiscript"}],f9="0";function Wb(){const{personaId:t}=ds(),s=xt(),{showToast:i}=yn(),{personas:{personas:r,createPersona:c,updatePersona:d,deletePersona:u},appDefaultPersonaId:p,setAppDefaultPersonaId:m}=lt(),g=t===void 0,v=g?void 0:r.find(_=>_.id===t);if(!g&&r.length>0&&!v)return o.jsx(ls,{to:Uf,replace:!0});const b=[{label:"Settings",url:So},{label:"Personas",url:Uf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return o.jsxs("div",{className:os.container,children:[o.jsx(xs,{segments:b}),o.jsx(p9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:m,onDone:()=>{s(Uf)},showToast:i})]})}function p9({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:m}){const g=xt(),[v,b]=y.useState((t==null?void 0:t.name)??""),[_,k]=y.useState((t==null?void 0:t.description)??""),[S,j]=y.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=y.useState((t==null?void 0:t.runtime)??"claude-code"),[C,E]=y.useState((t==null?void 0:t.model)??"sonnet"),[D,R]=y.useState((t==null?void 0:t.maxTurns)??0),[L,A]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[U,F]=y.useState((t==null?void 0:t.script)??""),[ee,q]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[X,ae]=y.useState(!1),[Q,re]=y.useState(null),[O,Z]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!O){Z(!0),b(t.name),k(t.description),j(t.systemPrompt);const ie=t.type==="script"?"script":"agent";T(ie==="script"?t.runtime||"genaiscript":t.runtime),E(t.model),R(t.maxTurns),A(ie),F(t.script||""),q(t.allowedMcpTools)}},[s,t,O]);const se=ie=>{A(ie),ie==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},ue=!s&&t===void 0,de=v.trim().length>0&&!ue&&S.trim().length>0&&(L==="script"?U.trim().length>0:!!N&&!!C),Ge=s&&de,De=!s&&i===(t==null?void 0:t.id),Ne=!s&&t&&!De&&L==="agent"&&!!N&&!!C,Oe=(ie,W)=>{if(!ie.trim())return`${W} is required`},fe=ie=>{if(ie.preventDefault(),!(ue||!de)){if(t){c(t.id,v,_,S,N,C,D,L,U).then(()=>{m("Persona updated","success"),p()},()=>{m("Failed to save persona","error")});return}r(v,_,S,N,C,D,L,U,ee).then(W=>{m("Persona created","success"),g(C_(W.id),{replace:!0})},()=>{m("Failed to save persona","error")})}},ye=()=>{t&&d(t.id).then(()=>{m("Persona deleted","success"),p()},()=>{m("Failed to delete persona","error")})},me=async(ie,W,ct,Le)=>ie().then(()=>{W(),m(ct,"success")},()=>{m(Le,"error")}),Ue=(ie,W)=>{if(!t)return;const ct=ie==="type"?String(W):L,Le=ie==="runtime"?String(W):ie==="type"?String(W)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,$t=ie==="model"?String(W):C,dt=ie==="maxTurns"?Number(W):D,ta=ie==="systemPrompt"?String(W):S,ks=ie==="script"?String(W):U;me(()=>c(t.id,ie==="name"?String(W):v,ie==="description"?String(W):_,ta,Le,$t,dt,ct,ks),()=>{if(ie==="type"){const _n=String(W)==="script"?"script":"agent";A(_n),T(Le)}ie==="runtime"&&T(String(W)),ie==="name"&&b(String(W)),ie==="description"&&k(String(W)),ie==="systemPrompt"&&j(String(W)),ie==="model"&&E(String(W)),ie==="maxTurns"&&R(Number(W)),ie==="script"&&F(String(W))},"Persona updated","Failed to update persona").catch(()=>{})},pt=ie=>{fe(ie)},bn=()=>{t&&u(t.id).then(()=>{m("Set as app default","success")},()=>{m("Failed to set app default","error")})};return o.jsxs(o.Fragment,{children:[ue?o.jsxs("div",{className:os.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsx("p",{children:"Loading persona..."})]}):s?o.jsxs("form",{onSubmit:pt,className:os.form,children:[o.jsx("h3",{children:"Create Persona"}),o.jsxs("div",{className:os.typeToggle,"data-testid":"persona-type-toggle",children:[o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:L==="agent",onChange:()=>se("agent")}),"Agent"]}),o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"script",checked:L==="script",onChange:()=>se("script")}),"Script"]})]}),o.jsxs("label",{children:["Name",o.jsx("input",{type:"text",value:v,onChange:ie=>b(ie.target.value),placeholder:L==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx("input",{type:"text",value:_,onChange:ie=>k(ie.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Runtime",o.jsx("select",{value:N,onChange:ie=>T(ie.target.value),"data-testid":"persona-runtime-select",children:(L==="script"?Jb:Yb).map(ie=>o.jsx("option",{value:ie.value,children:ie.label},ie.value))})]}),L==="agent"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model",o.jsx("input",{type:"text",value:C,onChange:ie=>E(ie.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["Max Turns",o.jsx("input",{type:"number",value:D,onChange:ie=>R(parseInt(ie.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx("textarea",{value:S,onChange:ie=>j(ie.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),L==="script"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model ",o.jsx("span",{className:os.optional,children:"(optional)"}),o.jsx("input",{type:"text",value:C,onChange:ie=>E(ie.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["System Prompt",o.jsx("textarea",{value:S,onChange:ie=>j(ie.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),o.jsxs("label",{children:["Script",o.jsx("textarea",{value:U,onChange:ie=>F(ie.target.value),placeholder:`script({ model: "openai:gpt-4o" });
702
-
703
- const grackle = await host.mcpServer({
704
- id: "grackle",
705
- url: env.vars.GRACKLE_MCP_URL,
706
- });
707
-
708
- $\`Summarize the current tasks.\`;`,rows:20,className:os.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),L==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(zb,{selectedTools:ee,onChange:q})]}),o.jsxs("div",{className:os.formActions,children:[o.jsx(Zs,{type:"submit",variant:"primary",size:"md",disabled:!Ge,"data-testid":"persona-detail-save",children:"Create"}),o.jsx(Zs,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?o.jsxs("div",{className:os.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsxs("div",{className:os.formActions,children:[o.jsx(Zs,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Ne&&o.jsx(Zs,{type:"button",variant:"ghost",size:"md",onClick:bn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),De&&o.jsx("span",{className:os.defaultBadge,children:"App Default"}),o.jsx(Zs,{type:"button",variant:"danger",size:"md",onClick:()=>ae(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),o.jsxs("div",{className:os.editableSection,children:[o.jsxs("label",{children:["Name",o.jsx(en,{value:v,onSave:ie=>{Ue("name",ie)},validate:ie=>Oe(ie,"Name"),fieldId:"persona-name",activeFieldId:Q,onActivate:re,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx(en,{value:_,onSave:ie=>{Ue("description",ie)},fieldId:"persona-description",activeFieldId:Q,onActivate:re,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Type",o.jsx(id,{value:L,onSave:ie=>{Ue("type",ie)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:Q,onActivate:re,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),o.jsxs("label",{children:["Runtime",o.jsx(id,{value:N,onSave:ie=>{Ue("runtime",ie)},options:L==="script"?Jb:Yb,fieldId:"persona-runtime",activeFieldId:Q,onActivate:re,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),o.jsxs("label",{children:["Model",L==="script"?" (optional)":"",o.jsx(en,{value:C,onSave:ie=>{Ue("model",ie)},validate:L==="agent"?ie=>Oe(ie,"Model"):void 0,fieldId:"persona-model",activeFieldId:Q,onActivate:re,placeholder:L==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),o.jsxs("label",{children:["Max Turns",o.jsx(en,{value:String(D),onSave:ie=>{Ue("maxTurns",parseInt(ie,10)||0)},validate:ie=>/^\d+$/.test(ie.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:Q,onActivate:re,placeholder:f9,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx(Zp,{value:S,onSave:ie=>{Ue("systemPrompt",ie)},validate:ie=>Oe(ie,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:Q,onActivate:re,placeholder:L==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),L==="script"&&o.jsxs("label",{children:["Script",o.jsx(Zp,{value:U,onSave:ie=>{Ue("script",ie)},validate:ie=>Oe(ie,"Script"),fieldId:"persona-script",activeFieldId:Q,onActivate:re,placeholder:`script({ model: "openai:gpt-4o" });
709
-
710
- const grackle = await host.mcpServer({
711
- id: "grackle",
712
- url: env.vars.GRACKLE_MCP_URL,
713
- });
714
-
715
- $\`Summarize the current tasks.\`;`,ariaLabel:"Persona script","data-testid":"persona-script-editor"})]}),L==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(zb,{selectedTools:ee,onChange:ie=>{q(ie),me(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,ie),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Ne&&!De&&o.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,o.jsx(_i,{isOpen:X,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ye,onCancel:()=>ae(!1)})]})}function m9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:r,setPreferSystem:c}=C1();return o.jsx(DO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c})}function h9(){const[t,s]=y.useState(void 0);return y.useEffect(()=>{let i=!1;return(async()=>{try{const c=await Te.getVersionStatus({});i||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{i=!0}},[]),t}function g9(){const{connected:t,environments:{environments:s},sessions:{sessions:i}}=lt(),r=h9();return o.jsxs(o.Fragment,{children:[r&&o.jsx(O5,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),o.jsx(RO,{connected:t,environments:s,sessions:i})]})}function v9(){return o.jsx(CL,{})}const Xb=Si();function y9(){const t=xt();return Js({key:"?"},()=>{t(Wj)}),Js({key:"n"},()=>{t(Xb)}),Js({key:"N"},()=>{t(Xb)}),o.jsx(o.Fragment,{})}function rl(t){const s=d8();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function b9(){const{workspaces:{workspaces:t},tasks:{tasks:s}}=lt(),i=y.useMemo(()=>o.jsx(u5,{workspaces:t,tasks:s}),[t,s]);return rl(i),o.jsx(za,{})}function _9(){const{environments:{environments:t}}=lt(),s=y.useMemo(()=>o.jsx(xI,{environments:t}),[t]);return rl(s),o.jsx(za,{})}function x9(){const t=y.useMemo(()=>o.jsx(gB,{}),[]);return rl(t),o.jsx(za,{})}function k9(){const{findings:{findings:t,loadFindings:s,loadAllFindings:i}}=lt(),{workspaceId:r,environmentId:c}=ds();y.useEffect(()=>{r?s(r).catch(()=>{}):i().catch(()=>{})},[r,s,i]);const d=y.useMemo(()=>o.jsx(RI,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return rl(d),o.jsx(za,{})}function S9(){const{knowledge:t,workspaces:{workspaces:s}}=lt(),i=y.useCallback(p=>{t.search(p).catch(()=>{})},[t]),r=y.useCallback(()=>{t.clearSearch()},[t]),c=y.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),d=y.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),u=y.useMemo(()=>o.jsx(I4,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:r,onSelectNode:c,onWorkspaceChange:d}),[t,s,i,r,c,d]);return rl(u),o.jsx(za,{})}const T9="_container_ce571_1",w9="_title_ce571_6",ld={container:T9,title:w9};function j9(){return o.jsxs("div",{className:ld.container,"aria-hidden":"true",children:[o.jsx("h1",{className:ld.title,children:"Findings"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>o.jsx(ad,{lines:3},s))})]})}function Qb(){const{environmentId:t,workspaceId:s}=ds(),{findings:{findings:i,findingsLoading:r,loadFindings:c},workspaces:{workspaces:d},environments:{environments:u}}=lt(),p=xt();y.useEffect(()=>{s&&c(s).catch(()=>{})},[s,c]);const m=y.useCallback(v=>{p(Cp(v,s,t))},[p,s,t]);if(r)return o.jsx(j9,{});const g=s&&t?O1("Findings",s,t,d,u).slice(0,-1):k8();return o.jsxs("div",{className:ld.container,"data-testid":"findings-list-page",children:[o.jsx(xs,{segments:g}),o.jsx("h1",{className:ld.title,children:"Findings"}),o.jsx(b1,{findings:i,onFindingClick:m})]})}const N9="_container_1wwpb_1",C9="_notFound_1wwpb_6",E9="_header_1wwpb_12",A9="_categoryBadge_1wwpb_19",D9="_title_1wwpb_28",R9="_content_1wwpb_35",M9="_tags_1wwpb_77",I9="_tag_1wwpb_77",O9="_meta_1wwpb_92",L9="_metaTimestamp_1wwpb_100",B9="_metaLink_1wwpb_105",dn={container:N9,notFound:C9,header:E9,categoryBadge:A9,title:D9,content:R9,tags:M9,tag:I9,meta:O9,metaTimestamp:L9,metaLink:B9};function e_(){const{findingId:t,environmentId:s,workspaceId:i}=ds(),{findings:{selectedFinding:r,findingLoading:c,loadFinding:d},workspaces:{workspaces:u},environments:{environments:p}}=lt(),m=xt();if(y.useEffect(()=>{t&&d(t).catch(()=>{})},[t,d]),c)return o.jsx("div",{className:dn.container,"data-testid":"finding-detail-page",children:o.jsx("div",{className:dn.notFound,children:"Loading..."})});if(!r)return o.jsx("div",{className:dn.container,"data-testid":"finding-detail-page",children:o.jsx("div",{className:dn.notFound,children:"Finding not found."})});const g=O1(r.title,i,s,u,p),v=od(r.category);return o.jsxs("div",{className:dn.container,"data-testid":"finding-detail-page",children:[o.jsx(xs,{segments:g}),o.jsxs("div",{className:dn.header,children:[o.jsx("span",{className:dn.categoryBadge,style:{background:v.bg,color:v.text},children:r.category}),o.jsx("h1",{className:dn.title,children:r.title})]}),r.content&&o.jsx("div",{className:dn.content,children:o.jsx(cd,{remarkPlugins:[dd],children:r.content})}),r.tags.length>0&&o.jsx("div",{className:dn.tags,children:r.tags.map(b=>o.jsx("span",{className:dn.tag,children:b},b))}),o.jsxs("div",{className:dn.meta,children:[o.jsx("span",{className:dn.metaTimestamp,title:r.createdAt,children:Km(r.createdAt)}),r.taskId&&o.jsx("button",{type:"button",className:dn.metaLink,onClick:()=>{m(Dn(r.taskId))},children:"View Task"}),r.sessionId&&o.jsx("button",{type:"button",className:dn.metaLink,onClick:()=>{m(dm(r.sessionId))},children:"View Session"})]})]})}const z9="_wizard_1260s_1",U9="_container_1260s_10",$9="_stepContent_1260s_19",P9="_logoArea_1260s_28",V9="_logoImage_1260s_32",H9="_heading_1260s_41",q9="_tagline_1260s_49",G9="_subtitle_1260s_56",F9="_featureList_1260s_64",Z9="_runtimeGrid_1260s_89",K9="_runtimeCard_1260s_101",Y9="_runtimeName_1260s_133",J9="_runtimeDescription_1260s_139",W9="_buttonRow_1260s_144",X9="_primaryButton_1260s_151",Q9="_ghostButton_1260s_185",eP="_dots_1260s_213",tP="_dot_1260s_213",mt={wizard:z9,container:U9,stepContent:$9,logoArea:P9,logoImage:V9,heading:H9,tagline:q9,subtitle:G9,featureList:F9,runtimeGrid:Z9,runtimeCard:K9,runtimeName:Y9,runtimeDescription:J9,buttonRow:W9,primaryButton:X9,ghostButton:Q9,dots:eP,dot:tP};function nP({onNext:t}){return o.jsxs("div",{className:mt.stepContent,"data-testid":"setup-welcome",children:[o.jsx("div",{className:mt.logoArea,children:o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:mt.logoImage})}),o.jsx("h1",{className:mt.heading,children:"Welcome to Grackle"}),o.jsx("p",{className:mt.tagline,children:"Multi-agent orchestration for software teams"}),o.jsx("button",{type:"button",className:mt.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function sP({onNext:t,onBack:s}){return o.jsxs("div",{className:mt.stepContent,"data-testid":"setup-about",children:[o.jsx("h2",{className:mt.heading,children:"What is Grackle?"}),o.jsxs("ul",{className:mt.featureList,children:[o.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),o.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),o.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),o.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),o.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),o.jsxs("div",{className:mt.buttonRow,children:[o.jsx("button",{type:"button",className:mt.ghostButton,onClick:s,children:"Back"}),o.jsx("button",{type:"button",className:mt.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const aP=[{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 iP({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:r}){const[c,d]=y.useState(t||"claude-code");return y.useEffect(()=>{t&&d(t)},[t]),o.jsxs("div",{className:mt.stepContent,"data-testid":"setup-runtime",children:[o.jsx("h2",{className:mt.heading,children:"Choose Your Runtime"}),o.jsx("p",{className:mt.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),o.jsx("div",{className:mt.runtimeGrid,children:aP.map(u=>o.jsxs("button",{type:"button",className:mt.runtimeCard,"data-selected":c===u.id,"aria-pressed":c===u.id,"data-testid":`runtime-card-${u.id}`,onClick:()=>d(u.id),children:[o.jsx("span",{className:mt.runtimeName,children:u.name}),o.jsx("span",{className:mt.runtimeDescription,children:u.description})]},u.id))}),o.jsxs("div",{className:mt.buttonRow,children:[o.jsx("button",{type:"button",className:mt.ghostButton,onClick:i,children:"Back"}),o.jsx("button",{type:"button",className:mt.primaryButton,onClick:()=>{s(c)},disabled:r,"data-testid":"setup-finish",children:"Finish"})]})]})}const oP=3,t_={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function rP(){const{personas:{personas:t,updatePersona:s},completeOnboarding:i,onboardingCompleted:r}=lt(),{showToast:c}=yn(),d=xt(),[u,p]=y.useState(0),[m,g]=y.useState(!1),v=t.find(_=>_.id==="claude-code"),b=y.useCallback(_=>{g(!0);const k=[];if(v&&_!==v.runtime){const j=t_[_]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,_,j))}const S=t.find(j=>j.id===F0);if(S&&_!==S.runtime){const j=t_[_]??"sonnet";k.push(s(F0,void 0,void 0,void 0,_,j))}Promise.all(k).then(()=>i()).then(()=>{d("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,d,c]);return r===!0?o.jsx(ls,{to:"/",replace:!0}):o.jsx("div",{className:mt.wizard,"data-testid":"setup-wizard",children:o.jsxs("div",{className:mt.container,children:[o.jsx(cs,{mode:"wait",children:o.jsxs(Et.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[u===0&&o.jsx(nP,{onNext:()=>p(1)}),u===1&&o.jsx(sP,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&o.jsx(iP,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:b,onBack:()=>p(1),finishDisabled:!v||m})]},u)}),o.jsx("div",{className:mt.dots,children:Array.from({length:oP},(_,k)=>o.jsx("span",{className:mt.dot,"data-active":k===u},k))})]})})}const lP="_root_zndgp_1",cP="_body_zndgp_7",dP="_main_zndgp_19",uP="_sidebarWrapper_zndgp_26",fP="_overlay_zndgp_51",Br={root:lP,body:cP,main:dP,sidebarWrapper:uP,overlay:fP},pP=y.lazy(()=>jT(()=>import("./KnowledgePage-BCqkL9CZ.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),B1=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function mP(){const{connected:t,environments:{environments:s},sessions:{sessions:i},tasks:{tasks:r}}=lt(),{toasts:c,dismissToast:d}=yn(),u=Ht(),p=c8(),m=p!==void 0,[g,v]=y.useState(!1),b=y.useCallback(()=>v(_=>!_),[]);return y.useEffect(()=>{v(!1)},[u.pathname]),y.useEffect(()=>{if(!g)return;const _=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),o.jsxs(o.Fragment,{children:[o.jsx(q4,{connected:t,environments:s,sessions:i,onToggleSidebar:m?b:void 0,sidebarOpen:g}),o.jsx(W4,{}),o.jsxs("div",{className:Br.body,children:[m&&o.jsx("div",{className:Br.sidebarWrapper,"data-sidebar-open":g,children:o.jsx(sI,{content:p})}),m&&g&&o.jsx("div",{className:Br.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),o.jsxs("div",{className:Br.main,children:[o.jsx(za,{}),o.jsx(uI,{sessions:i,tasks:r,environments:s})]})]}),o.jsx(T5,{toasts:c,onDismiss:d}),o.jsx(y9,{})]})}function hP(){const{sessions:{lastSpawnedId:t},environments:{environments:s,operationError:i,clearOperationError:r},tasks:{tasks:c},connected:d,onboardingCompleted:u}=lt(),{showToast:p}=yn();lz(s,p),pz(c,p),cz(i,r,p);const m=xt(),g=Ht();return y.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&m(dm(t),{replace:!0})},[t,m,g.pathname]),d&&u===!1?o.jsx(ls,{to:"/setup",replace:!0}):o.jsx(l8,{children:o.jsxs("div",{className:Br.root,children:[B1&&o.jsx(NN,{}),o.jsx(mP,{})]})})}function Sp(){const{workspaceId:t}=ds(),{workspaces:{workspaces:s}}=lt(),i=Ht(),r=s.find(m=>m.id===t);if(!(r!=null&&r.environmentId))return s.length===0?void 0:o.jsx(ls,{to:"/environments",replace:!0});const c=encodeURIComponent(t),d=`/workspaces/${c}`,u=i.pathname.startsWith(d)?i.pathname.slice(d.length):"",p=`/environments/${encodeURIComponent(r.environmentId)}/workspaces/${c}${u}${i.search}${i.hash}`;return o.jsx(ls,{to:p,replace:!0})}function gP(){return o.jsxs(fj,{children:[o.jsx(je,{path:"setup",element:o.jsx(rP,{})}),o.jsxs(je,{element:o.jsx(hP,{}),children:[o.jsx(je,{index:!0,element:o.jsx(LU,{})}),o.jsx(je,{path:"chat",element:o.jsx(FU,{})}),o.jsx(je,{path:"sessions/new",element:o.jsx(ZU,{})}),o.jsx(je,{path:"sessions/:sessionId",element:o.jsx(WU,{})}),o.jsx(je,{element:o.jsx(S9,{}),children:o.jsx(je,{path:"knowledge",element:o.jsx(y.Suspense,{fallback:o.jsx(c1,{}),children:o.jsx(pP,{})})})}),o.jsxs(je,{element:o.jsx(b9,{}),children:[o.jsx(je,{path:"tasks",element:o.jsx(IU,{})}),o.jsx(je,{path:"tasks/new",element:o.jsx(Zb,{})}),o.jsx(je,{path:"tasks/:taskId",element:o.jsx(Aa,{})}),o.jsx(je,{path:"tasks/:taskId/edit",element:o.jsx(Aa,{})}),o.jsx(je,{path:"tasks/:taskId/stream",element:o.jsx(Aa,{})}),o.jsx(je,{path:"tasks/:taskId/findings",element:o.jsx(Aa,{})})]}),o.jsxs(je,{element:o.jsx(k9,{}),children:[o.jsx(je,{path:"findings",element:o.jsx(Qb,{})}),o.jsx(je,{path:"findings/:findingId",element:o.jsx(e_,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:o.jsx(Qb,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:o.jsx(e_,{})})]}),o.jsxs(je,{element:o.jsx(_9,{}),children:[o.jsx(je,{path:"workspaces",element:o.jsx(ls,{to:"/environments",replace:!0})}),o.jsx(je,{path:"workspaces/new",element:o.jsx(f$,{})}),o.jsx(je,{path:"workspaces/:workspaceId",element:o.jsx(Sp,{})}),o.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Sp,{})}),o.jsx(je,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:o.jsx(Sp,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId",element:o.jsx(t$,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:o.jsx(Zb,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Aa,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:o.jsx(Aa,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:o.jsx(Aa,{})}),o.jsx(je,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:o.jsx(Aa,{})}),o.jsxs(je,{path:"environments",element:o.jsx(S$,{}),children:[o.jsx(je,{index:!0,element:o.jsx(OU,{})}),o.jsx(je,{path:"new",element:o.jsx(y$,{})}),o.jsx(je,{path:":environmentId",element:o.jsx(X$,{})}),o.jsx(je,{path:":environmentId/edit",element:o.jsx(b$,{})})]})]}),o.jsx(je,{element:o.jsx(x9,{}),children:o.jsxs(je,{path:"settings",element:o.jsx(t9,{}),children:[o.jsx(je,{index:!0,element:o.jsx(ls,{to:"credentials",replace:!0})}),o.jsx(je,{path:"environments",element:o.jsx(ls,{to:"/environments",replace:!0})}),o.jsx(je,{path:"credentials",element:o.jsx(n9,{})}),o.jsx(je,{path:"tokens",element:o.jsx(ls,{to:"../credentials",replace:!0})}),o.jsx(je,{path:"personas",element:o.jsx(s9,{})}),o.jsx(je,{path:"personas/new",element:o.jsx(Wb,{})}),o.jsx(je,{path:"personas/:personaId",element:o.jsx(Wb,{})}),o.jsx(je,{path:"appearance",element:o.jsx(m9,{})}),o.jsx(je,{path:"shortcuts",element:o.jsx(v9,{})}),o.jsx(je,{path:"about",element:o.jsx(g9,{})})]})}),o.jsx(je,{path:"*",element:o.jsx(ls,{to:"/",replace:!0})})]})]})}const vP=1e4;function yP(){const{onboardingCompleted:t}=lt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),vP);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return o.jsx(cs,{mode:"wait",children:r?o.jsx(Et.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:o.jsx(c1,{})},"splash"):o.jsx(Et.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:o.jsx(Bj,{basename:"/".replace(/\/$/,""),children:o.jsx(gP,{})})},"app")})}function bP(){const t=B1?B8:rz;return o.jsx(r8,{children:o.jsx(s8,{children:o.jsx(t,{children:o.jsx(yP,{})})})})}ST.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(bP,{})}));export{xs as B,A_ as K,lt as a,Cp as f,dm as s,Dn as t,xt as u};