@grackle-ai/web 0.90.0 → 0.91.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,715 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-BG3nhSS6.js","assets/dagview-Dv4uDOZ5.js","assets/grpc-CbbuZL-C.js","assets/markdown-Bpil_wz-.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
+ import{r as FS,a as ZS,b as y,j as o,d as $0,H as P0,P as V0,i as KS,B as YS,c as JS,C as WS,M as XS}from"./dagview-Dv4uDOZ5.js";import{c as QS,a as eT,G as tT,f as nT,M as sT,A as Qb,D as ex,W as aT,O as iT,b as oT,C as Wr,d as rT,e as tx,w as lT,t as cT,p as _c,g as dT,R as Sr,S as H0}from"./grpc-CbbuZL-C.js";import{v as uT,r as fT,t as kc,i as pT,f as mT,M as od,a as rd}from"./markdown-Bpil_wz-.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 Af={exports:{}},Tr={},Df={exports:{}},Rf={};/**
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 q0;function hT(){return q0||(q0=1,(function(t){function s(O,G){var se=O.length;O.push(G);e:for(;0<se;){var ue=se-1>>>1,de=O[ue];if(0<c(de,G))O[ue]=G,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 G=O[0],se=O.pop();if(se!==G){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 G}function c(O,G){var se=O.sortIndex-G.sortIndex;return se!==0?se:O.id-G.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 h=[],g=[],v=1,x=null,b=3,k=!1,S=!1,w=!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 G=i(g);G!==null;){if(G.callback===null)r(g);else if(G.startTime<=O)r(g),G.sortIndex=G.expirationTime,s(h,G);else break;G=i(g)}}function A(O){if(w=!1,D(O),!S)if(i(h)!==null)S=!0,B||(B=!0,ee());else{var G=i(g);G!==null&&re(A,G.startTime-O)}}var B=!1,R=-1,U=5,K=-1;function ne(){return N?!0:!(t.unstable_now()-K<U)}function F(){if(N=!1,B){var O=t.unstable_now();K=O;var G=!0;try{e:{S=!1,w&&(w=!1,C(R),R=-1),k=!0;var se=b;try{t:{for(D(O),x=i(h);x!==null&&!(x.expirationTime>O&&ne());){var ue=x.callback;if(typeof ue=="function"){x.callback=null,b=x.priorityLevel;var de=ue(x.expirationTime<=O);if(O=t.unstable_now(),typeof de=="function"){x.callback=de,D(O),G=!0;break t}x===i(h)&&r(h),D(O)}else r(h);x=i(h)}if(x!==null)G=!0;else{var Ge=i(g);Ge!==null&&re(A,Ge.startTime-O),G=!1}}break e}finally{x=null,b=se,k=!1}G=void 0}}finally{G?ee():B=!1}}}var ee;if(typeof E=="function")ee=function(){E(F)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,X=ae.port2;ae.port1.onmessage=F,ee=function(){X.postMessage(null)}}else ee=function(){T(F,0)};function re(O,G){R=T(function(){O(t.unstable_now())},G)}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 b},t.unstable_next=function(O){switch(b){case 1:case 2:case 3:var G=3;break;default:G=b}var se=b;b=G;try{return O()}finally{b=se}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(O,G){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var se=b;b=O;try{return G()}finally{b=se}},t.unstable_scheduleCallback=function(O,G,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:G,priorityLevel:O,startTime:se,expirationTime:de,sortIndex:-1},se>ue?(O.sortIndex=se,s(g,O),i(h)===null&&O===i(g)&&(w?(C(R),R=-1):w=!0,re(A,se-ue))):(O.sortIndex=de,s(h,O),S||k||(S=!0,B||(B=!0,ee()))),O},t.unstable_shouldYield=ne,t.unstable_wrapCallback=function(O){var G=b;return function(){var se=b;b=G;try{return O.apply(this,arguments)}finally{b=se}}}})(Rf)),Rf}var G0;function gT(){return G0||(G0=1,Df.exports=hT()),Df.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 F0;function vT(){if(F0)return Tr;F0=1;var t=gT(),s=FS(),i=ZS();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 h(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 m=f.alternate;if(m===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return h(f),e;if(m===l)return h(f),n;m=m.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=m;else{for(var _=!1,j=f.child;j;){if(j===a){_=!0,a=f,l=m;break}if(j===l){_=!0,l=f,a=m;break}j=j.sibling}if(!_){for(j=m.child;j;){if(j===a){_=!0,a=m,l=f;break}if(j===l){_=!0,l=m,a=f;break}j=j.sibling}if(!_)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 x=Object.assign,b=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=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"),A=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function ee(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var ae=Symbol.for("react.client.reference");function X(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 w:return"Fragment";case T:return"Profiler";case N:return"StrictMode";case A:return"Suspense";case B:return"SuspenseList";case K: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 R:return n=e.displayName||null,n!==null?n:X(e.type)||"Memo";case U:n=e._payload,e=e._init;try{return X(e(n))}catch{}}return null}var re=Array.isArray,O=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=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)?c0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=c0(n),e=d0(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=d0(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),br._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 Q=function(){throw Error()};if(Object.defineProperty(Q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Q,[])}catch(Z){var q=Z}Reflect.construct(e,[],Q)}else{try{Q.call()}catch(Z){q=Z}e.call(Q.prototype)}}else{try{throw Error()}catch(Z){q=Z}(Q=e())&&typeof Q.catch=="function"&&Q.catch(function(){})}}catch(Z){if(Z&&q&&typeof Z.stack=="string")return[Z.stack,q.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 m=l.DetermineComponentFrameRoot(),_=m[0],j=m[1];if(_&&j){var M=_.split(`
21
+ `),H=j.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 xn=Object.prototype.hasOwnProperty,Ss=t.unstable_scheduleCallback,us=t.unstable_cancelCallback,ji=t.unstable_shouldYield,Jn=t.unstable_requestPaint,xe=t.unstable_now,Qe=t.unstable_getCurrentPriorityLevel,on=t.unstable_ImmediatePriority,_n=t.unstable_UserBlockingPriority,Mn=t.unstable_NormalPriority,wi=t.unstable_LowPriority,Pa=t.unstable_IdlePriority,Ni=t.log,Ci=t.unstable_setDisableYieldValue,na=null,tn=null;function Wn(e){if(typeof Ni=="function"&&Ci(e),tn&&typeof tn.setStrictMode=="function")try{tn.setStrictMode(na,e)}catch{}}var nn=Math.clz32?Math.clz32:ll,ol=Math.log,rl=Math.LN2;function ll(e){return e>>>=0,e===0?32:31-(ol(e)/rl|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,m=e.suspendedLanes,_=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~m,l!==0?f=Ts(l):(_&=j,_!==0?f=Ts(_):a||(a=j&~e,a!==0&&(f=Ts(a))))):(j=l&~m,j!==0?f=Ts(j):_!==0?f=Ts(_):a||(a=l&~e,a!==0&&(f=Ts(a)))),f===0?0:n!==0&&n!==f&&(n&m)===0&&(m=f&-f,a=n&-n,m>=a||m===32&&(a&4194048)!==0)?n:f}function te(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,m){var _=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 j=e.entanglements,M=e.expirationTimes,H=e.hiddenUpdates;for(a=_&~a;0<a;){var Y=31-nn(a),Q=1<<Y;j[Y]=0,M[Y]=-1;var q=H[Y];if(q!==null)for(H[Y]=null,Y=0;Y<q.length;Y++){var Z=q[Y];Z!==null&&(Z.lane&=-536870913)}a&=~Q}l!==0&&Re(e,l,0),m!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=m&~(_&~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=G.p;return e!==0?e:(e=window.event,e===void 0?32:M0(e.type))}function At(e,n){var a=G.p;try{return G.p=e,n()}finally{G.p=a}}var rn=Math.random().toString(36).slice(2),ht="__reactFiber$"+rn,qt="__reactProps$"+rn,Ei="__reactContainer$"+rn,xd="__reactEvents$"+rn,O1="__reactListeners$"+rn,L1="__reactHandles$"+rn,Jm="__reactResources$"+rn,Io="__reactMarker$"+rn;function _d(e){delete e[ht],delete e[qt],delete e[xd],delete e[O1],delete e[L1]}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=v0(e);e!==null;){if(a=e[ht])return a;e=v0(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 Oo(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[Jm];return n||(n=e[Jm]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Gt(e){e[Io]=!0}var Wm=new Set,Xm={};function Ga(e,n){Mi(e,n),Mi(e+"Capture",n)}function Mi(e,n){for(Xm[e]=n,e=0;e<n.length;e++)Wm.add(n[e])}var B1=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]*$"),Qm={},eh={};function z1(e){return xn.call(eh,e)?!0:xn.call(Qm,e)?!1:B1.test(e)?eh[e]=!0:(Qm[e]=!0,!1)}function cl(e,n,a){if(z1(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 dl(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 js(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 In(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function th(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function U1(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,m=l.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(_){a=""+_,m.call(this,_)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(_){a=""+_},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function kd(e){if(!e._valueTracker){var n=th(e)?"checked":"value";e._valueTracker=U1(e,n,""+e[n])}}function nh(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=th(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function ul(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 $1=/[\n"\\]/g;function On(e){return e.replace($1,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function Sd(e,n,a,l,f,m,_,j){e.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?e.type=_:e.removeAttribute("type"),n!=null?_==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+In(n)):e.value!==""+In(n)&&(e.value=""+In(n)):_!=="submit"&&_!=="reset"||e.removeAttribute("value"),n!=null?Td(e,_,In(n)):a!=null?Td(e,_,In(a)):l!=null&&e.removeAttribute("value"),f==null&&m!=null&&(e.defaultChecked=!!m),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.name=""+In(j):e.removeAttribute("name")}function sh(e,n,a,l,f,m,_,j){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),n!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){kd(e);return}a=a!=null?""+In(a):"",n=n!=null?""+In(n):a,j||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=j?e.checked:!!l,e.defaultChecked=!!l,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(e.name=_),kd(e)}function Td(e,n,a){n==="number"&&ul(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=""+In(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 ah(e,n,a){if(n!=null&&(n=""+In(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+In(a):""}function ih(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=In(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),kd(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 P1=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 oh(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||P1.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function rh(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&&oh(e,f,l)}else for(var m in n)n.hasOwnProperty(m)&&oh(e,m,n[m])}function jd(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 V1=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"]]),H1=/^[\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 fl(e){return H1.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ws(){}var wd=null;function Nd(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 lh(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(Sd(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="'+On(""+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));Sd(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&&nh(l)}break e;case"textarea":ah(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ii(e,!!a.multiple,n,!1)}}}var Cd=!1;function ch(e,n,a){if(Cd)return e(n,a);Cd=!0;try{var l=e(n);return l}finally{if(Cd=!1,(Li!==null||Bi!==null)&&(Ql(),Li&&(n=Li,e=Bi,Bi=Li=null,lh(n),e)))for(n=0;n<e.length;n++)lh(e[n])}}function Lo(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"),Ed=!1;if(Ns)try{var Bo={};Object.defineProperty(Bo,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",Bo,Bo),window.removeEventListener("test",Bo,Bo)}catch{Ed=!1}var sa=null,Ad=null,pl=null;function dh(){if(pl)return pl;var e,n=Ad,a=n.length,l,f="value"in sa?sa.value:sa.textContent,m=f.length;for(e=0;e<a&&n[e]===f[e];e++);var _=a-e;for(l=1;l<=_&&n[a-l]===f[m-l];l++);return pl=f.slice(e,1<l?1-l:void 0)}function ml(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 hl(){return!0}function uh(){return!1}function fn(e){function n(a,l,f,m,_){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=_,this.currentTarget=null;for(var j in e)e.hasOwnProperty(j)&&(a=e[j],this[j]=a?a(m):m[j]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?hl:uh,this.isPropagationStopped=uh,this}return x(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=hl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=hl)},persist:function(){},isPersistent:hl}),n}var Fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gl=fn(Fa),zo=x({},Fa,{view:0,detail:0}),q1=fn(zo),Dd,Rd,Uo,vl=x({},zo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Id,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!==Uo&&(Uo&&e.type==="mousemove"?(Dd=e.screenX-Uo.screenX,Rd=e.screenY-Uo.screenY):Rd=Dd=0,Uo=e),Dd)},movementY:function(e){return"movementY"in e?e.movementY:Rd}}),fh=fn(vl),G1=x({},vl,{dataTransfer:0}),F1=fn(G1),Z1=x({},zo,{relatedTarget:0}),Md=fn(Z1),K1=x({},Fa,{animationName:0,elapsedTime:0,pseudoElement:0}),Y1=fn(K1),J1=x({},Fa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),W1=fn(J1),X1=x({},Fa,{data:0}),ph=fn(X1),Q1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ek={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"},tk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function nk(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=tk[e])?!!n[e]:!1}function Id(){return nk}var sk=x({},zo,{key:function(e){if(e.key){var n=Q1[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=ml(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ek[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Id,charCode:function(e){return e.type==="keypress"?ml(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ml(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ak=fn(sk),ik=x({},vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mh=fn(ik),ok=x({},zo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Id}),rk=fn(ok),lk=x({},Fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),ck=fn(lk),dk=x({},vl,{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}),uk=fn(dk),fk=x({},Fa,{newState:0,oldState:0}),pk=fn(fk),mk=[9,13,27,32],Od=Ns&&"CompositionEvent"in window,$o=null;Ns&&"documentMode"in document&&($o=document.documentMode);var hk=Ns&&"TextEvent"in window&&!$o,hh=Ns&&(!Od||$o&&8<$o&&11>=$o),gh=" ",vh=!1;function yh(e,n){switch(e){case"keyup":return mk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var zi=!1;function gk(e,n){switch(e){case"compositionend":return bh(n);case"keypress":return n.which!==32?null:(vh=!0,gh);case"textInput":return e=n.data,e===gh&&vh?null:e;default:return null}}function vk(e,n){if(zi)return e==="compositionend"||!Od&&yh(e,n)?(e=dh(),pl=Ad=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 hh&&n.locale!=="ko"?null:n.data;default:return null}}var yk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function xh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!yk[e.type]:n==="textarea"}function _h(e,n,a,l){Li?Bi?Bi.push(l):Bi=[l]:Li=l,n=oc(n,"onChange"),0<n.length&&(a=new gl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Po=null,Vo=null;function bk(e){s0(e,0)}function yl(e){var n=Oo(e);if(nh(n))return e}function kh(e,n){if(e==="change")return n}var Sh=!1;if(Ns){var Ld;if(Ns){var Bd="oninput"in document;if(!Bd){var Th=document.createElement("div");Th.setAttribute("oninput","return;"),Bd=typeof Th.oninput=="function"}Ld=Bd}else Ld=!1;Sh=Ld&&(!document.documentMode||9<document.documentMode)}function jh(){Po&&(Po.detachEvent("onpropertychange",wh),Vo=Po=null)}function wh(e){if(e.propertyName==="value"&&yl(Vo)){var n=[];_h(n,Vo,e,Nd(e)),ch(bk,n)}}function xk(e,n,a){e==="focusin"?(jh(),Po=n,Vo=a,Po.attachEvent("onpropertychange",wh)):e==="focusout"&&jh()}function _k(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return yl(Vo)}function kk(e,n){if(e==="click")return yl(n)}function Sk(e,n){if(e==="input"||e==="change")return yl(n)}function Tk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var kn=typeof Object.is=="function"?Object.is:Tk;function Ho(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(!xn.call(n,f)||!kn(e[f],n[f]))return!1}return!0}function Nh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ch(e,n){var a=Nh(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=Nh(a)}}function Eh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Eh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Ah(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ul(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=ul(e.document)}return n}function zd(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 jk=Ns&&"documentMode"in document&&11>=document.documentMode,Ui=null,Ud=null,qo=null,$d=!1;function Dh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;$d||Ui==null||Ui!==ul(l)||(l=Ui,"selectionStart"in l&&zd(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}),qo&&Ho(qo,l)||(qo=l,l=oc(Ud,"onSelect"),0<l.length&&(n=new gl("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")},Pd={},Rh={};Ns&&(Rh=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(Pd[e])return Pd[e];if(!$i[e])return e;var n=$i[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Rh)return Pd[e]=n[a];return e}var Mh=Ka("animationend"),Ih=Ka("animationiteration"),Oh=Ka("animationstart"),wk=Ka("transitionrun"),Nk=Ka("transitionstart"),Ck=Ka("transitioncancel"),Lh=Ka("transitionend"),Bh=new Map,Vd="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(" ");Vd.push("scrollEnd");function Xn(e,n){Bh.set(e,n),Ga(n,[e])}var bl=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)},Ln=[],Pi=0,Hd=0;function xl(){for(var e=Pi,n=Hd=Pi=0;n<e;){var a=Ln[n];Ln[n++]=null;var l=Ln[n];Ln[n++]=null;var f=Ln[n];Ln[n++]=null;var m=Ln[n];if(Ln[n++]=null,l!==null&&f!==null){var _=l.pending;_===null?f.next=f:(f.next=_.next,_.next=f),l.pending=f}m!==0&&zh(a,f,m)}}function _l(e,n,a,l){Ln[Pi++]=e,Ln[Pi++]=n,Ln[Pi++]=a,Ln[Pi++]=l,Hd|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function qd(e,n,a,l){return _l(e,n,a,l),kl(e)}function Ya(e,n){return _l(e,null,null,n),kl(e)}function zh(e,n,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var f=!1,m=e.return;m!==null;)m.childLanes|=a,l=m.alternate,l!==null&&(l.childLanes|=a),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(f=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,f&&n!==null&&(f=31-nn(a),e=m.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),m):null}function kl(e){if(50<fr)throw fr=0,Qu=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 Ek(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 Ek(e,n,a,l)}function Gd(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 Uh(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 Sl(e,n,a,l,f,m){var _=0;if(l=e,typeof e=="function")Gd(e)&&(_=1);else if(typeof e=="string")_=IS(e,a,Oe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case K:return e=Sn(31,a,n,f),e.elementType=K,e.lanes=m,e;case w:return Ja(a.children,f,m,n);case N:_=8,f|=24;break;case T:return e=Sn(12,a,n,f|2),e.elementType=T,e.lanes=m,e;case A:return e=Sn(13,a,n,f),e.elementType=A,e.lanes=m,e;case B:return e=Sn(19,a,n,f),e.elementType=B,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:_=10;break e;case C:_=9;break e;case D:_=11;break e;case R:_=14;break e;case U:_=16,l=null;break e}_=29,a=Error(r(130,e===null?"null":typeof e,"")),l=null}return n=Sn(_,a,n,f),n.elementType=e,n.type=l,n.lanes=m,n}function Ja(e,n,a,l){return e=Sn(7,e,l,n),e.lanes=a,e}function Fd(e,n,a){return e=Sn(6,e,null,n),e.lanes=a,e}function $h(e){var n=Sn(18,null,null,0);return n.stateNode=e,n}function Zd(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 Ph=new WeakMap;function Bn(e,n){if(typeof e=="object"&&e!==null){var a=Ph.get(e);return a!==void 0?a:(n={value:e,source:n,stack:ks(n)},Ph.set(e,n),n)}return{value:e,source:n,stack:ks(n)}}var Hi=[],qi=0,Tl=null,Go=0,zn=[],Un=0,aa=null,fs=1,ps="";function Es(e,n){Hi[qi++]=Go,Hi[qi++]=Tl,Tl=e,Go=n}function Vh(e,n,a){zn[Un++]=fs,zn[Un++]=ps,zn[Un++]=aa,aa=e;var l=fs;e=ps;var f=32-nn(l)-1;l&=~(1<<f),a+=1;var m=32-nn(n)+f;if(30<m){var _=f-f%5;m=(l&(1<<_)-1).toString(32),l>>=_,f-=_,fs=1<<32-nn(n)+f|a<<f|l,ps=m+e}else fs=1<<m|a<<f|l,ps=e}function Kd(e){e.return!==null&&(Es(e,1),Vh(e,1,0))}function Yd(e){for(;e===Tl;)Tl=Hi[--qi],Hi[qi]=null,Go=Hi[--qi],Hi[qi]=null;for(;e===aa;)aa=zn[--Un],zn[Un]=null,ps=zn[--Un],zn[Un]=null,fs=zn[--Un],zn[Un]=null}function Hh(e,n){zn[Un++]=fs,zn[Un++]=ps,zn[Un++]=aa,fs=n.id,ps=n.overflow,aa=e}var Yt=null,gt=null,He=!1,ia=null,$n=!1,Jd=Error(r(519));function oa(e){var n=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Fo(Bn(n,e)),Jd}function qh(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<mr.length;a++)ze(mr[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),sh(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),ih(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||r0(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=ws),n=!0):n=!1,n||oa(e,!0)}function Gh(e){for(Yt=e.return;Yt;)switch(Yt.tag){case 5:case 31:case 13:$n=!1;return;case 27:case 3:$n=!0;return;default:Yt=Yt.return}}function Gi(e){if(e!==Yt)return!1;if(!He)return Gh(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")||hf(e.type,e.memoizedProps)),a=!a),a&&gt&&oa(e),Gh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=g0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));gt=g0(e)}else n===27?(n=gt,xa(e.type)?(e=xf,xf=null,gt=e):gt=n):gt=Yt?Vn(e.stateNode.nextSibling):null;return!0}function Wa(){gt=Yt=null,He=!1}function Wd(){var e=ia;return e!==null&&(gn===null?gn=e:gn.push.apply(gn,e),ia=null),e}function Fo(e){ia===null?ia=[e]:ia.push(e)}var Xd=Ge(null),Xa=null,As=null;function ra(e,n,a){Ne(Xd,n._currentValue),n._currentValue=a}function Ds(e){e._currentValue=Xd.current,De(Xd)}function Qd(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 eu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var m=f.dependencies;if(m!==null){var _=f.child;m=m.firstContext;e:for(;m!==null;){var j=m;m=f;for(var M=0;M<n.length;M++)if(j.context===n[M]){m.lanes|=a,j=m.alternate,j!==null&&(j.lanes|=a),Qd(m.return,a,e),l||(_=null);break e}m=j.next}}else if(f.tag===18){if(_=f.return,_===null)throw Error(r(341));_.lanes|=a,m=_.alternate,m!==null&&(m.lanes|=a),Qd(_,a,e),_=null}else _=f.child;if(_!==null)_.return=f;else for(_=f;_!==null;){if(_===e){_=null;break}if(f=_.sibling,f!==null){f.return=_.return,_=f;break}_=_.return}f=_}}function Fi(e,n,a,l){e=null;for(var f=n,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var _=f.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var j=f.type;kn(f.pendingProps.value,_.value)||(e!==null?e.push(j):e=[j])}}else if(f===me.current){if(_=f.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(br):e=[br])}f=f.return}e!==null&&eu(n,e,a,l),n.flags|=262144}function jl(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 Fh(Xa,e)}function wl(e,n){return Xa===null&&Qa(e),Fh(e,n)}function Fh(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 Ak=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()})}},Dk=t.unstable_scheduleCallback,Rk=t.unstable_NormalPriority,Lt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tu(){return{controller:new Ak,data:new Map,refCount:0}}function Zo(e){e.refCount--,e.refCount===0&&Dk(Rk,function(){e.controller.abort()})}var Ko=null,nu=0,Zi=0,Ki=null;function Mk(e,n){if(Ko===null){var a=Ko=[];nu=0,Zi=of(),Ki={status:"pending",value:void 0,then:function(l){a.push(l)}}}return nu++,n.then(Zh,Zh),n}function Zh(){if(--nu===0&&Ko!==null){Ki!==null&&(Ki.status="fulfilled");var e=Ko;Ko=null,Zi=0,Ki=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Ik(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 Kh=O.S;O.S=function(e,n){Dv=xe(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Mk(e,n),Kh!==null&&Kh(e,n)};var ei=Ge(null);function su(){var e=ei.current;return e!==null?e:ft.pooledCache}function Nl(e,n){n===null?Ne(ei,ei.current):Ne(ei,n.pool)}function Yh(){var e=su();return e===null?null:{parent:Lt._currentValue,pool:e}}var Yi=Error(r(460)),au=Error(r(474)),Cl=Error(r(542)),El={then:function(){}};function Jh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Wh(e,n,a){switch(a=e[a],a===void 0?e.push(n):a!==n&&(n.then(ws,ws),n=a),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,Qh(e),e;default:if(typeof n.status=="string")n.then(ws,ws);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,Qh(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 Xh(){if(ni===null)throw Error(r(459));var e=ni;return ni=null,e}function Qh(e){if(e===Yi||e===Cl)throw Error(r(483))}var Ji=null,Yo=0;function Al(e){var n=Yo;return Yo+=1,Ji===null&&(Ji=[]),Wh(Ji,e,n)}function Jo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Dl(e,n){throw n.$$typeof===b?Error(r(525)):(e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function eg(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 m($,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 _($){return e&&$.alternate===null&&($.flags|=67108866),$}function j($,z,V,J){return z===null||z.tag!==6?(z=Fd(V,$.mode,J),z.return=$,z):(z=f(z,V),z.return=$,z)}function M($,z,V,J){var Se=V.type;return Se===w?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),Jo(z,V),z.return=$,z):(z=Sl(V.type,V.key,V.props,null,$.mode,J),Jo(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=Zd(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 Q($,z,V){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=Fd(""+z,$.mode,V),z.return=$,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case k:return V=Sl(z.type,z.key,z.props,null,$.mode,V),Jo(V,z),V.return=$,V;case S:return z=Zd(z,$.mode,V),z.return=$,z;case U:return z=ti(z),Q($,z,V)}if(re(z)||ee(z))return z=Ja(z,$.mode,V,null),z.return=$,z;if(typeof z.then=="function")return Q($,Al(z),V);if(z.$$typeof===E)return Q($,wl($,z),V);Dl($,z)}return null}function q($,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:j($,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),q($,z,V,J)}if(re(V)||ee(V))return Se!==null?null:Y($,z,V,J,null);if(typeof V.then=="function")return q($,z,Al(V),J);if(V.$$typeof===E)return q($,z,wl($,V),J);Dl($,V)}return null}function Z($,z,V,J,Se){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return $=$.get(V)||null,j(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),Z($,z,V,J,Se)}if(re(J)||ee(J))return $=$.get(V)||null,Y(z,$,J,Se,null);if(typeof J.then=="function")return Z($,z,V,Al(J),Se);if(J.$$typeof===E)return Z($,z,V,wl(z,J),Se);Dl(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=q($,be,V[Ie],J);if(Je===null){be===null&&(be=Ve);break}e&&be&&Je.alternate===null&&n($,be),z=m(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=Q($,V[Ie],J),be!==null&&(z=m(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=Z(be,$,Ie,V[Ie],J),Ve!==null&&(e&&Ve.alternate!==null&&be.delete(Ve.key===null?Ie:Ve.key),z=m(Ve,z,Ie),Ye===null?Se=Ve:Ye.sibling=Ve,Ye=Ve);return e&&be.forEach(function(ja){return n($,ja)}),He&&Es($,Ie),Se}function je($,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 ja=q($,be,Je.value,J);if(ja===null){be===null&&(be=Ve);break}e&&be&&ja.alternate===null&&n($,be),z=m(ja,z,Ie),Ye===null?Se=ja:Ye.sibling=ja,Ye=ja,be=Ve}if(Je.done)return a($,be),He&&Es($,Ie),Se;if(be===null){for(;!Je.done;Ie++,Je=V.next())Je=Q($,Je.value,J),Je!==null&&(z=m(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=Z(be,$,Ie,Je.value,J),Je!==null&&(e&&Je.alternate!==null&&be.delete(Je.key===null?Ie:Je.key),z=m(Je,z,Ie),Ye===null?Se=Je:Ye.sibling=Je,Ye=Je);return e&&be.forEach(function(GS){return n($,GS)}),He&&Es($,Ie),Se}function rt($,z,V,J){if(typeof V=="object"&&V!==null&&V.type===w&&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===w){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),Jo(J,V),J.return=$,$=J;break e}a($,z);break}else n($,z);z=z.sibling}V.type===w?(J=Ja(V.props.children,$.mode,J,V.key),J.return=$,$=J):(J=Sl(V.type,V.key,V.props,null,$.mode,J),Jo(J,V),J.return=$,$=J)}return _($);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=Zd(V,$.mode,J),J.return=$,$=J}return _($);case U:return V=ti(V),rt($,z,V,J)}if(re(V))return ve($,z,V,J);if(ee(V)){if(Se=ee(V),typeof Se!="function")throw Error(r(150));return V=Se.call(V),je($,z,V,J)}if(typeof V.then=="function")return rt($,z,Al(V),J);if(V.$$typeof===E)return rt($,z,wl($,V),J);Dl($,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=Fd(V,$.mode,J),J.return=$,$=J),_($)):a($,z)}return function($,z,V,J){try{Yo=0;var Se=rt($,z,V,J);return Ji=null,Se}catch(be){if(be===Yi||be===Cl)throw be;var Ye=Sn(29,be,null,$.mode);return Ye.lanes=J,Ye.return=$,Ye}finally{}}}var si=eg(!0),tg=eg(!1),la=!1;function iu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ou(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=kl(e),zh(e,null,a),n}return _l(e,l,n,a),kl(e)}function Wo(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 ru(e,n){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var _={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=_:m=m.next=_,a=a.next}while(a!==null);m===null?f=m=n:m=m.next=n}else f=m=n;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,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 lu=!1;function Xo(){if(lu){var e=Ki;if(e!==null)throw e}}function Qo(e,n,a,l){lu=!1;var f=e.updateQueue;la=!1;var m=f.firstBaseUpdate,_=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var M=j,H=M.next;M.next=null,_===null?m=H:_.next=H,_=M;var Y=e.alternate;Y!==null&&(Y=Y.updateQueue,j=Y.lastBaseUpdate,j!==_&&(j===null?Y.firstBaseUpdate=H:j.next=H,Y.lastBaseUpdate=M))}if(m!==null){var Q=f.baseState;_=0,Y=H=M=null,j=m;do{var q=j.lane&-536870913,Z=q!==j.lane;if(Z?(Pe&q)===q:(l&q)===q){q!==0&&q===Zi&&(lu=!0),Y!==null&&(Y=Y.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var ve=e,je=j;q=n;var rt=a;switch(je.tag){case 1:if(ve=je.payload,typeof ve=="function"){Q=ve.call(rt,Q,q);break e}Q=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=je.payload,q=typeof ve=="function"?ve.call(rt,Q,q):ve,q==null)break e;Q=x({},Q,q);break e;case 2:la=!0}}q=j.callback,q!==null&&(e.flags|=64,Z&&(e.flags|=8192),Z=f.callbacks,Z===null?f.callbacks=[q]:Z.push(q))}else Z={lane:q,tag:j.tag,payload:j.payload,callback:j.callback,next:null},Y===null?(H=Y=Z,M=Q):Y=Y.next=Z,_|=q;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;Z=j,j=Z.next,Z.next=null,f.lastBaseUpdate=Z,f.shared.pending=null}}while(!0);Y===null&&(M=Q),f.baseState=M,f.firstBaseUpdate=H,f.lastBaseUpdate=Y,m===null&&(f.shared.lanes=0),ha|=_,e.lanes=_,e.memoizedState=Q}}function ng(e,n){if(typeof e!="function")throw Error(r(191,e));e.call(n)}function sg(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)ng(a[e],n)}var Wi=Ge(null),Rl=Ge(0);function ag(e,n){e=$s,Ne(Rl,e),Ne(Wi,n),$s=e|n.baseLanes}function cu(){Ne(Rl,$s),Ne(Wi,Wi.current)}function du(){$s=Rl.current,De(Wi),De(Rl)}var Tn=Ge(null),Pn=null;function ua(e){var n=e.alternate;Ne(Dt,Dt.current&1),Ne(Tn,e),Pn===null&&(n===null||Wi.current!==null||n.memoizedState!==null)&&(Pn=e)}function uu(e){Ne(Dt,Dt.current),Ne(Tn,e),Pn===null&&(Pn=e)}function ig(e){e.tag===22?(Ne(Dt,Dt.current),Ne(Tn,e),Pn===null&&(Pn=e)):fa()}function fa(){Ne(Dt,Dt.current),Ne(Tn,Tn.current)}function jn(e){De(Tn),Pn===e&&(Pn=null),De(Dt)}var Dt=Ge(0);function Ml(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||yf(a)||bf(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,Il=!1,Xi=!1,ai=!1,Ol=0,er=0,Qi=null,Ok=0;function jt(){throw Error(r(321))}function fu(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 pu(e,n,a,l,f,m){return Rs=m,Me=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,O.H=e===null||e.memoizedState===null?Vg:Cu,ai=!1,m=a(l,f),ai=!1,Xi&&(m=rg(n,a,l,f)),og(e),m}function og(e){O.H=sr;var n=it!==null&&it.next!==null;if(Rs=0,Bt=it=Me=null,Il=!1,er=0,Qi=null,n)throw Error(r(300));e===null||zt||(e=e.dependencies,e!==null&&jl(e)&&(zt=!0))}function rg(e,n,a,l){Me=e;var f=0;do{if(Xi&&(Qi=null),er=0,Xi=!1,25<=f)throw Error(r(301));if(f+=1,Bt=it=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}O.H=Hg,m=n(a,l)}while(Xi);return m}function Lk(){var e=O.H,n=e.useState()[0];return n=typeof n.then=="function"?tr(n):n,e=e.useState()[0],(it!==null?it.memoizedState:null)!==e&&(Me.flags|=1024),n}function mu(){var e=Ol!==0;return Ol=0,e}function hu(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function gu(e){if(Il){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Il=!1}Rs=0,Bt=it=Me=null,Xi=!1,er=Ol=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 Ll(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function tr(e){var n=er;return er+=1,Qi===null&&(Qi=[]),e=Wh(Qi,e,n),n=Me,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,O.H=n===null||n.memoizedState===null?Vg:Cu),e}function Bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return tr(e);if(e.$$typeof===E)return Jt(e)}throw Error(r(438,String(e)))}function vu(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=Ll(),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]=ne;return n.index++,a}function Ms(e,n){return typeof n=="function"?n(e):n}function zl(e){var n=Rt();return yu(n,it,e)}function yu(e,n,a){var l=e.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=e.baseQueue,m=l.pending;if(m!==null){if(f!==null){var _=f.next;f.next=m.next,m.next=_}n.baseQueue=f=m,l.pending=null}if(m=e.baseState,f===null)e.memoizedState=m;else{n=f.next;var j=_=null,M=null,H=n,Y=!1;do{var Q=H.lane&-536870913;if(Q!==H.lane?(Pe&Q)===Q:(Rs&Q)===Q){var q=H.revertLane;if(q===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),Q===Zi&&(Y=!0);else if((Rs&q)===q){H=H.next,q===Zi&&(Y=!0);continue}else Q={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(j=M=Q,_=m):M=M.next=Q,Me.lanes|=q,ha|=q;Q=H.action,ai&&a(m,Q),m=H.hasEagerState?H.eagerState:a(m,Q)}else q={lane:Q,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(j=M=q,_=m):M=M.next=q,Me.lanes|=Q,ha|=Q;H=H.next}while(H!==null&&H!==n);if(M===null?_=m:M.next=j,!kn(m,e.memoizedState)&&(zt=!0,Y&&(a=Ki,a!==null)))throw a;e.memoizedState=m,e.baseState=_,e.baseQueue=M,l.lastRenderedState=m}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function bu(e){var n=Rt(),a=n.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var _=f=f.next;do m=e(m,_.action),_=_.next;while(_!==f);kn(m,n.memoizedState)||(zt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,l]}function lg(e,n,a){var l=Me,f=Rt(),m=He;if(m){if(a===void 0)throw Error(r(407));a=a()}else a=n();var _=!kn((it||f).memoizedState,a);if(_&&(f.memoizedState=a,zt=!0),f=f.queue,ku(ug.bind(null,l,f,e),[e]),f.getSnapshot!==n||_||Bt!==null&&Bt.memoizedState.tag&1){if(l.flags|=2048,eo(9,{destroy:void 0},dg.bind(null,l,f,a,n),null),ft===null)throw Error(r(349));m||(Rs&127)!==0||cg(l,n,a)}return a}function cg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=Me.updateQueue,n===null?(n=Ll(),Me.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function dg(e,n,a,l){n.value=a,n.getSnapshot=l,fg(n)&&pg(e)}function ug(e,n,a){return a(function(){fg(n)&&pg(e)})}function fg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!kn(e,a)}catch{return!0}}function pg(e){var n=Ya(e,2);n!==null&&vn(n,e,2)}function xu(e){var n=ln();if(typeof e=="function"){var a=e;if(e=a(),ai){Wn(!0);try{a()}finally{Wn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:e},n}function mg(e,n,a,l){return e.baseState=a,yu(e,it,typeof l=="function"?l:Ms)}function Bk(e,n,a,l,f){if(Pl(e))throw Error(r(485));if(e=n.action,e!==null){var m={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){m.listeners.push(_)}};O.T!==null?a(!0):m.isTransition=!1,l(m),a=n.pending,a===null?(m.next=n.pending=m,hg(n,m)):(m.next=a.next,n.pending=a.next=m)}}function hg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var m=O.T,_={};O.T=_;try{var j=a(f,l),M=O.S;M!==null&&M(_,j),gg(e,n,j)}catch(H){_u(e,n,H)}finally{m!==null&&_.types!==null&&(m.types=_.types),O.T=m}}else try{m=a(f,l),gg(e,n,m)}catch(H){_u(e,n,H)}}function gg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){vg(e,n,l)},function(l){return _u(e,n,l)}):vg(e,n,a)}function vg(e,n,a){n.status="fulfilled",n.value=a,yg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,hg(e,a)))}function _u(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,yg(n),n=n.next;while(n!==l)}e.action=null}function yg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function bg(e,n){return n}function xg(e,n){if(He){var a=ft.formState;if(a!==null){e:{var l=Me;if(He){if(gt){t:{for(var f=gt,m=$n;f.nodeType!==8;){if(!m){f=null;break t}if(f=Vn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){gt=Vn(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:bg,lastRenderedState:n},a.queue=l,a=Ug.bind(null,Me,l),l.dispatch=a,l=xu(!1),m=Nu.bind(null,Me,!1,l.queue),l=ln(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=Bk.bind(null,Me,f,m,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function _g(e){var n=Rt();return kg(n,it,e)}function kg(e,n,a){if(n=yu(e,n,bg)[0],e=zl(Ms)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=tr(n)}catch(_){throw _===Yi?Cl:_}else l=n;n=Rt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(Me.flags|=2048,eo(9,{destroy:void 0},zk.bind(null,f,a),null)),[l,m,e]}function zk(e,n){e.action=n}function Sg(e){var n=Rt(),a=it;if(a!==null)return kg(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=Ll(),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 Tg(){return Rt().memoizedState}function Ul(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 $l(e,n,a,l){var f=Rt();l=l===void 0?null:l;var m=f.memoizedState.inst;it!==null&&l!==null&&fu(l,it.memoizedState.deps)?f.memoizedState=eo(n,m,a,l):(Me.flags|=e,f.memoizedState=eo(1|n,m,a,l))}function jg(e,n){Ul(8390656,8,e,n)}function ku(e,n){$l(2048,8,e,n)}function Uk(e){Me.flags|=4;var n=Me.updateQueue;if(n===null)n=Ll(),Me.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function wg(e){var n=Rt().memoizedState;return Uk({ref:n,nextImpl:e}),function(){if((et&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}function Ng(e,n){return $l(4,2,e,n)}function Cg(e,n){return $l(4,4,e,n)}function Eg(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 Ag(e,n,a){a=a!=null?a.concat([e]):null,$l(4,4,Eg.bind(null,n,e),a)}function Su(){}function Dg(e,n){var a=Rt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&fu(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Rg(e,n){var a=Rt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&fu(n,l[1]))return l[0];if(l=e(),ai){Wn(!0);try{e()}finally{Wn(!1)}}return a.memoizedState=[l,n],l}function Tu(e,n,a){return a===void 0||(Rs&1073741824)!==0&&(Pe&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Mv(),Me.lanes|=e,ha|=e,a)}function Mg(e,n,a,l){return kn(a,n)?a:Wi.current!==null?(e=Tu(e,a,l),kn(e,n)||(zt=!0),e):(Rs&42)===0||(Rs&1073741824)!==0&&(Pe&261930)===0?(zt=!0,e.memoizedState=a):(e=Mv(),Me.lanes|=e,ha|=e,n)}function Ig(e,n,a,l,f){var m=G.p;G.p=m!==0&&8>m?m:8;var _=O.T,j={};O.T=j,Nu(e,!1,n,a);try{var M=f(),H=O.S;if(H!==null&&H(j,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var Y=Ik(M,l);nr(e,n,Y,Cn(e))}else nr(e,n,l,Cn(e))}catch(Q){nr(e,n,{then:function(){},status:"rejected",reason:Q},Cn())}finally{G.p=m,_!==null&&j.types!==null&&(_.types=j.types),O.T=_}}function $k(){}function ju(e,n,a,l){if(e.tag!==5)throw Error(r(476));var f=Og(e).queue;Ig(e,f,n,se,a===null?$k:function(){return Lg(e),a(l)})}function Og(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 Lg(e){var n=Og(e);n.next===null&&(n=e.alternate.memoizedState),nr(e,n.next.queue,{},Cn())}function wu(){return Jt(br)}function Bg(){return Rt().memoizedState}function zg(){return Rt().memoizedState}function Pk(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),Wo(l,n,a)),n={cache:tu()},e.payload=n;return}n=n.return}}function Vk(e,n,a){var l=Cn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Pl(e)?$g(n,a):(a=qd(e,n,a,l),a!==null&&(vn(a,e,l),Pg(a,n,l)))}function Ug(e,n,a){var l=Cn();nr(e,n,a,l)}function nr(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Pl(e))$g(n,f);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var _=n.lastRenderedState,j=m(_,a);if(f.hasEagerState=!0,f.eagerState=j,kn(j,_))return _l(e,n,f,0),ft===null&&xl(),!1}catch{}finally{}if(a=qd(e,n,f,l),a!==null)return vn(a,e,l),Pg(a,n,l),!0}return!1}function Nu(e,n,a,l){if(l={lane:2,revertLane:of(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Pl(e)){if(n)throw Error(r(479))}else n=qd(e,a,l,2),n!==null&&vn(n,e,2)}function Pl(e){var n=e.alternate;return e===Me||n!==null&&n===Me}function $g(e,n){Xi=Il=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Pg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Ze(e,a)}}var sr={readContext:Jt,use:Bl,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};sr.useEffectEvent=jt;var Vg={readContext:Jt,use:Bl,useCallback:function(e,n){return ln().memoizedState=[e,n===void 0?null:n],e},useContext:Jt,useEffect:jg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ul(4194308,4,Eg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ul(4194308,4,e,n)},useInsertionEffect:function(e,n){Ul(4,2,e,n)},useMemo:function(e,n){var a=ln();n=n===void 0?null:n;var l=e();if(ai){Wn(!0);try{e()}finally{Wn(!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){Wn(!0);try{a(n)}finally{Wn(!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=Vk.bind(null,Me,e),[l.memoizedState,e]},useRef:function(e){var n=ln();return e={current:e},n.memoizedState=e},useState:function(e){e=xu(e);var n=e.queue,a=Ug.bind(null,Me,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:Su,useDeferredValue:function(e,n){var a=ln();return Tu(a,e,n)},useTransition:function(){var e=xu(!1);return e=Ig.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||cg(l,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,jg(ug.bind(null,l,m,e),[e]),l.flags|=2048,eo(9,{destroy:void 0},dg.bind(null,l,m,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=Ol++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Ok++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:wu,useFormState:xg,useActionState:xg,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=Nu.bind(null,Me,!0,a),a.dispatch=n,[e,n]},useMemoCache:vu,useCacheRefresh:function(){return ln().memoizedState=Pk.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)}}},Cu={readContext:Jt,use:Bl,useCallback:Dg,useContext:Jt,useEffect:ku,useImperativeHandle:Ag,useInsertionEffect:Ng,useLayoutEffect:Cg,useMemo:Rg,useReducer:zl,useRef:Tg,useState:function(){return zl(Ms)},useDebugValue:Su,useDeferredValue:function(e,n){var a=Rt();return Mg(a,it.memoizedState,e,n)},useTransition:function(){var e=zl(Ms)[0],n=Rt().memoizedState;return[typeof e=="boolean"?e:tr(e),n]},useSyncExternalStore:lg,useId:Bg,useHostTransitionStatus:wu,useFormState:_g,useActionState:_g,useOptimistic:function(e,n){var a=Rt();return mg(a,it,e,n)},useMemoCache:vu,useCacheRefresh:zg};Cu.useEffectEvent=wg;var Hg={readContext:Jt,use:Bl,useCallback:Dg,useContext:Jt,useEffect:ku,useImperativeHandle:Ag,useInsertionEffect:Ng,useLayoutEffect:Cg,useMemo:Rg,useReducer:bu,useRef:Tg,useState:function(){return bu(Ms)},useDebugValue:Su,useDeferredValue:function(e,n){var a=Rt();return it===null?Tu(a,e,n):Mg(a,it.memoizedState,e,n)},useTransition:function(){var e=bu(Ms)[0],n=Rt().memoizedState;return[typeof e=="boolean"?e:tr(e),n]},useSyncExternalStore:lg,useId:Bg,useHostTransitionStatus:wu,useFormState:Sg,useActionState:Sg,useOptimistic:function(e,n){var a=Rt();return it!==null?mg(a,it,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:vu,useCacheRefresh:zg};Hg.useEffectEvent=wg;function Eu(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:x({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Au={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),Wo(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),Wo(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),Wo(n,e,a))}};function qg(e,n,a,l,f,m,_){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,m,_):n.prototype&&n.prototype.isPureReactComponent?!Ho(a,l)||!Ho(f,m):!0}function Gg(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&&Au.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=x({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function Fg(e){bl(e)}function Zg(e){console.error(e)}function Kg(e){bl(e)}function Vl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Yg(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 Du(e,n,a){return a=ca(a),a.tag=3,a.payload={element:null},a.callback=function(){Vl(e,n)},a}function Jg(e){return e=ca(e),e.tag=3,e}function Wg(e,n,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;e.payload=function(){return f(m)},e.callback=function(){Yg(n,a,l)}}var _=a.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(e.callback=function(){Yg(n,a,l),typeof f!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var j=l.stack;this.componentDidCatch(l.value,{componentStack:j!==null?j:""})})}function Hk(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 Pn===null?ec():a.alternate===null&&wt===0&&(wt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===El?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),nf(e,l,f)),!1;case 22:return a.flags|=65536,l===El?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)),nf(e,l,f)),!1}throw Error(r(435,a.tag))}return nf(e,l,f),ec(),!1}if(He)return n=Tn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Jd&&(e=Error(r(422),{cause:l}),Fo(Bn(e,a)))):(l!==Jd&&(n=Error(r(423),{cause:l}),Fo(Bn(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=Bn(l,a),f=Du(e.stateNode,l,f),ru(e,f),wt!==4&&(wt=2)),!1;var m=Error(r(520),{cause:l});if(m=Bn(m,a),ur===null?ur=[m]:ur.push(m),wt!==4&&(wt=2),n===null)return!0;l=Bn(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Du(a.stateNode,l,e),ru(a,e),!1;case 1:if(n=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(ga===null||!ga.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Jg(f),Wg(f,e,a,l),ru(a,f),!1}a=a.return}while(a!==null);return!1}var Ru=Error(r(461)),zt=!1;function Wt(e,n,a,l){n.child=e===null?tg(n,null,a,l):si(n,e.child,a,l)}function Xg(e,n,a,l,f){a=a.render;var m=n.ref;if("ref"in l){var _={};for(var j in l)j!=="ref"&&(_[j]=l[j])}else _=l;return Qa(n),l=pu(e,n,a,_,m,f),j=mu(),e!==null&&!zt?(hu(e,n,f),Is(e,n,f)):(He&&j&&Kd(n),n.flags|=1,Wt(e,n,l,f),n.child)}function Qg(e,n,a,l,f){if(e===null){var m=a.type;return typeof m=="function"&&!Gd(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,ev(e,n,m,l,f)):(e=Sl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!$u(e,f)){var _=m.memoizedProps;if(a=a.compare,a=a!==null?a:Ho,a(_,l)&&e.ref===n.ref)return Is(e,n,f)}return n.flags|=1,e=Cs(m,l),e.ref=n.ref,e.return=n,n.child=e}function ev(e,n,a,l,f){if(e!==null){var m=e.memoizedProps;if(Ho(m,l)&&e.ref===n.ref)if(zt=!1,n.pendingProps=l=m,$u(e,f))(e.flags&131072)!==0&&(zt=!0);else return n.lanes=e.lanes,Is(e,n,f)}return Mu(e,n,a,l,f)}function tv(e,n,a,l){var f=l.children,m=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(m=m!==null?m.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&~m}else l=0,n.child=null;return nv(e,n,m,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(n,m!==null?m.cachePool:null),m!==null?ag(n,m):cu(),ig(n);else return l=n.lanes=536870912,nv(e,n,m!==null?m.baseLanes|a:a,a,l)}else m!==null?(Nl(n,m.cachePool),ag(n,m),fa(),n.memoizedState=null):(e!==null&&Nl(n,null),cu(),fa());return Wt(e,n,f,a),n.child}function ar(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function nv(e,n,a,l,f){var m=su();return m=m===null?null:{parent:Lt._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&Nl(n,null),cu(),ig(n),e!==null&&Fi(e,n,l,!0),n.childLanes=f,null}function Hl(e,n){return n=Gl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function sv(e,n,a){return si(n,e.child,null,a),e=Hl(n,n.pendingProps),e.flags|=2,jn(n),n.memoizedState=null,e}function qk(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=Hl(n,l),n.lanes=536870912,ar(null,e);if(uu(n),(e=gt)?(e=h0(e,$n),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=$h(e),a.return=n,n.child=a,Yt=n,gt=null)):e=null,e===null)throw oa(n);return n.lanes=536870912,null}return Hl(n,l)}var m=e.memoizedState;if(m!==null){var _=m.dehydrated;if(uu(n),f)if(n.flags&256)n.flags&=-257,n=sv(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&&(_=ut(l,a),_!==0&&_!==m.retryLane))throw m.retryLane=_,Ya(e,_),vn(l,e,_),Ru;ec(),n=sv(e,n,a)}else e=m.treeContext,gt=Vn(_.nextSibling),Yt=n,He=!0,ia=null,$n=!1,e!==null&&Hh(n,e),n=Hl(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 ql(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 Mu(e,n,a,l,f){return Qa(n),a=pu(e,n,a,l,void 0,f),l=mu(),e!==null&&!zt?(hu(e,n,f),Is(e,n,f)):(He&&l&&Kd(n),n.flags|=1,Wt(e,n,a,f),n.child)}function av(e,n,a,l,f,m){return Qa(n),n.updateQueue=null,a=rg(n,l,a,f),og(e),l=mu(),e!==null&&!zt?(hu(e,n,m),Is(e,n,m)):(He&&l&&Kd(n),n.flags|=1,Wt(e,n,a,m),n.child)}function iv(e,n,a,l,f){if(Qa(n),n.stateNode===null){var m=Vi,_=a.contextType;typeof _=="object"&&_!==null&&(m=Jt(_)),m=new a(l,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Au,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},iu(n),_=a.contextType,m.context=typeof _=="object"&&_!==null?Jt(_):Vi,m.state=n.memoizedState,_=a.getDerivedStateFromProps,typeof _=="function"&&(Eu(n,a,_,l),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(_=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),_!==m.state&&Au.enqueueReplaceState(m,m.state,null),Qo(n,l,m,f),Xo(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){m=n.stateNode;var j=n.memoizedProps,M=ii(a,j);m.props=M;var H=m.context,Y=a.contextType;_=Vi,typeof Y=="object"&&Y!==null&&(_=Jt(Y));var Q=a.getDerivedStateFromProps;Y=typeof Q=="function"||typeof m.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,Y||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(j||H!==_)&&Gg(n,m,l,_),la=!1;var q=n.memoizedState;m.state=q,Qo(n,l,m,f),Xo(),H=n.memoizedState,j||q!==H||la?(typeof Q=="function"&&(Eu(n,a,Q,l),H=n.memoizedState),(M=la||qg(n,a,M,l,q,H,_))?(Y||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=l,n.memoizedState=H),m.props=l,m.state=H,m.context=_,l=M):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{m=n.stateNode,ou(e,n),_=n.memoizedProps,Y=ii(a,_),m.props=Y,Q=n.pendingProps,q=m.context,H=a.contextType,M=Vi,typeof H=="object"&&H!==null&&(M=Jt(H)),j=a.getDerivedStateFromProps,(H=typeof j=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(_!==Q||q!==M)&&Gg(n,m,l,M),la=!1,q=n.memoizedState,m.state=q,Qo(n,l,m,f),Xo();var Z=n.memoizedState;_!==Q||q!==Z||la||e!==null&&e.dependencies!==null&&jl(e.dependencies)?(typeof j=="function"&&(Eu(n,a,j,l),Z=n.memoizedState),(Y=la||qg(n,a,Y,l,q,Z,M)||e!==null&&e.dependencies!==null&&jl(e.dependencies))?(H||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,Z,M),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,Z,M)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||_===e.memoizedProps&&q===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&q===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=Z),m.props=l,m.state=Z,m.context=M,l=Y):(typeof m.componentDidUpdate!="function"||_===e.memoizedProps&&q===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||_===e.memoizedProps&&q===e.memoizedState||(n.flags|=1024),l=!1)}return m=l,ql(e,n),l=(n.flags&128)!==0,m||l?(m=n.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:m.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=m.state,e=n.child):e=Is(e,n,f),e}function ov(e,n,a,l){return Wa(),n.flags|=256,Wt(e,n,a,l),n.child}var Iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ou(e){return{baseLanes:e,cachePool:Yh()}}function Lu(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Nn),e}function rv(e,n,a){var l=n.pendingProps,f=!1,m=(n.flags&128)!==0,_;if((_=m)||(_=e!==null&&e.memoizedState===null?!1:(Dt.current&2)!==0),_&&(f=!0,n.flags&=-129),_=(n.flags&32)!==0,n.flags&=-33,e===null){if(He){if(f?ua(n):fa(),(e=gt)?(e=h0(e,$n),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=$h(e),a.return=n,n.child=a,Yt=n,gt=null)):e=null,e===null)throw oa(n);return bf(e)?n.lanes=32:n.lanes=536870912,null}var j=l.children;return l=l.fallback,f?(fa(),f=n.mode,j=Gl({mode:"hidden",children:j},f),l=Ja(l,f,a,null),j.return=n,l.return=n,j.sibling=l,n.child=j,l=n.child,l.memoizedState=Ou(a),l.childLanes=Lu(e,_,a),n.memoizedState=Iu,ar(null,l)):(ua(n),Bu(n,j))}var M=e.memoizedState;if(M!==null&&(j=M.dehydrated,j!==null)){if(m)n.flags&256?(ua(n),n.flags&=-257,n=zu(e,n,a)):n.memoizedState!==null?(fa(),n.child=e.child,n.flags|=128,n=null):(fa(),j=l.fallback,f=n.mode,l=Gl({mode:"visible",children:l.children},f),j=Ja(j,f,a,null),j.flags|=2,l.return=n,j.return=n,l.sibling=j,n.child=l,si(n,e.child,null,a),l=n.child,l.memoizedState=Ou(a),l.childLanes=Lu(e,_,a),n.memoizedState=Iu,n=ar(null,l));else if(ua(n),bf(j)){if(_=j.nextSibling&&j.nextSibling.dataset,_)var H=_.dgst;_=H,l=Error(r(419)),l.stack="",l.digest=_,Fo({value:l,source:null,stack:null}),n=zu(e,n,a)}else if(zt||Fi(e,n,a,!1),_=(a&e.childLanes)!==0,zt||_){if(_=ft,_!==null&&(l=ut(_,a),l!==0&&l!==M.retryLane))throw M.retryLane=l,Ya(e,l),vn(_,e,l),Ru;yf(j)||ec(),n=zu(e,n,a)}else yf(j)?(n.flags|=192,n.child=e.child,n=null):(e=M.treeContext,gt=Vn(j.nextSibling),Yt=n,He=!0,ia=null,$n=!1,e!==null&&Hh(n,e),n=Bu(n,l.children),n.flags|=4096);return n}return f?(fa(),j=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?j=Cs(H,j):(j=Ja(j,f,a,null),j.flags|=2),j.return=n,l.return=n,l.sibling=j,n.child=l,ar(null,l),l=n.child,j=e.child.memoizedState,j===null?j=Ou(a):(f=j.cachePool,f!==null?(M=Lt._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=Yh(),j={baseLanes:j.baseLanes|a,cachePool:f}),l.memoizedState=j,l.childLanes=Lu(e,_,a),n.memoizedState=Iu,ar(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&&(_=n.deletions,_===null?(n.deletions=[e],n.flags|=16):_.push(e)),n.child=a,n.memoizedState=null,a)}function Bu(e,n){return n=Gl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Gl(e,n){return e=Sn(22,e,null,n),e.lanes=0,e}function zu(e,n,a){return si(n,e.child,null,a),e=Bu(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function lv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Qd(e.return,n,a)}function Uu(e,n,a,l,f,m){var _=e.memoizedState;_===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:m}:(_.isBackwards=n,_.rendering=null,_.renderingStartTime=0,_.last=l,_.tail=a,_.tailMode=f,_.treeForkCount=m)}function cv(e,n,a){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var _=Dt.current,j=(_&2)!==0;if(j?(_=_&1|2,n.flags|=128):_&=1,Ne(Dt,_),Wt(e,n,l,a),l=He?Go:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lv(e,a,n);else if(e.tag===19)lv(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&&Ml(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Uu(n,!1,f,a,m,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&&Ml(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Uu(n,!0,a,null,m,l);break;case"together":Uu(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 $u(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&jl(e)))}function Gk(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,uu(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?rv(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 cv(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,tv(e,n,a,n.pendingProps);case 24:ra(n,Lt,e.memoizedState.cache)}return Is(e,n,a)}function dv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)zt=!0;else{if(!$u(e,a)&&(n.flags&128)===0)return zt=!1,Gk(e,n,a);zt=(e.flags&131072)!==0}else zt=!1,He&&(n.flags&1048576)!==0&&Vh(n,Go,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")Gd(e)?(l=ii(e,l),n.tag=1,n=iv(null,n,e,l,a)):(n.tag=0,n=Mu(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===D){n.tag=11,n=Xg(null,n,e,l,a);break e}else if(f===R){n.tag=14,n=Qg(null,n,e,l,a);break e}}throw n=X(e)||e,Error(r(306,n,""))}}return n;case 0:return Mu(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=ii(l,n.pendingProps),iv(e,n,l,f,a);case 3:e:{if(Ue(n,n.stateNode.containerInfo),e===null)throw Error(r(387));l=n.pendingProps;var m=n.memoizedState;f=m.element,ou(e,n),Qo(n,l,null,a);var _=n.memoizedState;if(l=_.cache,ra(n,Lt,l),l!==m.cache&&eu(n,[Lt],a,!0),Xo(),l=_.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:_.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=ov(e,n,l,a);break e}else if(l!==f){f=Bn(Error(r(424)),n),Fo(f),n=ov(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=Vn(e.firstChild),Yt=n,He=!0,ia=null,$n=!0,a=tg(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 ql(e,n),e===null?(a=_0(n.type,null,n.pendingProps,null))?n.memoizedState=a:He||(a=n.type,e=n.pendingProps,l=rc(ye.current).createElement(a),l[ht]=n,l[qt]=e,Xt(l,a,e),Gt(l),n.stateNode=l):n.memoizedState=_0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return bn(n),e===null&&He&&(l=n.stateNode=y0(n.type,n.pendingProps,ye.current),Yt=n,$n=!0,f=gt,xa(n.type)?(xf=f,gt=Vn(l.firstChild)):gt=f),Wt(e,n,n.pendingProps.children,a),ql(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&He&&((f=l=gt)&&(l=_S(l,n.type,n.pendingProps,$n),l!==null?(n.stateNode=l,Yt=n,gt=Vn(l.firstChild),$n=!1,f=!0):f=!1),f||oa(n)),bn(n),f=n.type,m=n.pendingProps,_=e!==null?e.memoizedProps:null,l=m.children,hf(f,m)?l=null:_!==null&&hf(f,_)&&(n.flags|=32),n.memoizedState!==null&&(f=pu(e,n,Lk,null,null,a),br._currentValue=f),ql(e,n),Wt(e,n,l,a),n.child;case 6:return e===null&&He&&((e=a=gt)&&(a=kS(a,n.pendingProps,$n),a!==null?(n.stateNode=a,Yt=n,gt=null,e=!0):e=!1),e||oa(n)),null;case 13:return rv(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 Xg(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 Qg(e,n,n.type,n.pendingProps,a);case 15:return ev(e,n,n.type,n.pendingProps,a);case 19:return cv(e,n,a);case 31:return qk(e,n,a);case 22:return tv(e,n,a,n.pendingProps);case 24:return Qa(n),l=Jt(Lt),e===null?(f=su(),f===null&&(f=ft,m=tu(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:l,cache:f},iu(n),ra(n,Lt,f)):((e.lanes&a)!==0&&(ou(e,n),Qo(n,null,null,a),Xo()),f=e.memoizedState,m=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=m.cache,ra(n,Lt,l),l!==f.cache&&eu(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 Pu(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(Bv())e.flags|=8192;else throw ni=El,au}else e.flags&=-16777217}function uv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!w0(n))if(Bv())e.flags|=8192;else throw ni=El,au}function Fl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?pe():536870912,e.lanes|=n,ao|=n)}function ir(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 Fk(e,n,a){var l=n.pendingProps;switch(Yd(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,Wd())),vt(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(Os(n),m!==null?(vt(n),uv(n,m)):(vt(n),Pu(n,f,null,l,a))):m?m!==e.memoizedState?(Os(n),vt(n),uv(n,m)):(vt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Os(n),vt(n),Pu(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)?qh(n):(e=y0(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(m=Oe.current,Gi(n))qh(n);else{var _=rc(ye.current);switch(m){case 1:m=_.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=_.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=_.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=_.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof l.is=="string"?_.createElement("select",{is:l.is}):_.createElement("select"),l.multiple?m.multiple=!0:l.size&&(m.size=l.size);break;default:m=typeof l.is=="string"?_.createElement(f,{is:l.is}):_.createElement(f)}}m[ht]=n,m[qt]=l;e:for(_=n.child;_!==null;){if(_.tag===5||_.tag===6)m.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===n)break e;for(;_.sibling===null;){if(_.return===null||_.return===n)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}n.stateNode=m;e:switch(Xt(m,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),Pu(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||r0(e.nodeValue,a)),e||oa(n,!0)}else e=rc(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=Wd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(jn(n),n):(jn(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=Wd(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(jn(n),n):(jn(n),null)}return jn(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),m=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)),a!==e&&a&&(n.child.flags|=8192),Fl(n,n.updateQueue),vt(n),null);case 4:return pt(),e===null&&df(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,m=l.rendering,m===null)if(f)ir(l,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=Ml(e),m!==null){for(n.flags|=128,ir(l,!1),e=m.updateQueue,n.updateQueue=e,Fl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Uh(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&&xe()>Wl&&(n.flags|=128,f=!0,ir(l,!1),n.lanes=4194304)}else{if(!f)if(e=Ml(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Fl(n,e),ir(l,!0),l.tail===null&&l.tailMode==="hidden"&&!m.alternate&&!He)return vt(n),null}else 2*xe()-l.renderingStartTime>Wl&&a!==536870912&&(n.flags|=128,f=!0,ir(l,!1),n.lanes=4194304);l.isBackwards?(m.sibling=n.child,n.child=m):(e=l.last,e!==null?e.sibling=m:n.child=m,l.last=m)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=xe(),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 jn(n),du(),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&&Fl(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 Zk(e,n){switch(Yd(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(jn(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(jn(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 jn(n),du(),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 fv(e,n){switch(Yd(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&&jn(n);break;case 13:jn(n);break;case 19:De(Dt);break;case 10:Ds(n.type);break;case 22:case 23:jn(n),du(),e!==null&&De(ei);break;case 24:Ds(Lt)}}function or(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 m=a.create,_=a.inst;l=m(),_.destroy=l}a=a.next}while(a!==f)}}catch(j){st(n,n.return,j)}}function pa(e,n,a){try{var l=n.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&e)===e){var _=l.inst,j=_.destroy;if(j!==void 0){_.destroy=void 0,f=n;var M=a,H=j;try{H()}catch(Y){st(f,M,Y)}}}l=l.next}while(l!==m)}}catch(Y){st(n,n.return,Y)}}function pv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{sg(n,a)}catch(l){st(e,e.return,l)}}}function mv(e,n,a){a.props=ii(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){st(e,n,l)}}function rr(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 hv(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 Vu(e,n,a){try{var l=e.stateNode;hS(l,e.type,a,n),l[qt]=n}catch(f){st(e,e.return,f)}}function gv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&xa(e.type)||e.tag===4}function Hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gv(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&&xa(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 qu(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=ws));else if(l!==4&&(l===27&&xa(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(qu(e,n,a),e=e.sibling;e!==null;)qu(e,n,a),e=e.sibling}function Zl(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&&xa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Zl(e,n,a),e=e.sibling;e!==null;)Zl(e,n,a),e=e.sibling}function vv(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(m){st(e,e.return,m)}}var Ls=!1,Ut=!1,Gu=!1,yv=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function Kk(e,n){if(e=e.containerInfo,pf=mc,e=Ah(e),zd(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,m=l.focusNode;l=l.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var _=0,j=-1,M=-1,H=0,Y=0,Q=e,q=null;t:for(;;){for(var Z;Q!==a||f!==0&&Q.nodeType!==3||(j=_+f),Q!==m||l!==0&&Q.nodeType!==3||(M=_+l),Q.nodeType===3&&(_+=Q.nodeValue.length),(Z=Q.firstChild)!==null;)q=Q,Q=Z;for(;;){if(Q===e)break t;if(q===a&&++H===f&&(j=_),q===m&&++Y===l&&(M=_),(Z=Q.nextSibling)!==null)break;Q=q,q=Q.parentNode}Q=Z}a=j===-1||M===-1?null:{start:j,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(mf={focusedElem:e,selectionRange:a},mc=!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,m=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&&m!==null){e=void 0,a=n,f=m.memoizedProps,m=m.memoizedState,l=a.stateNode;try{var ve=ii(a.type,f);e=l.getSnapshotBeforeUpdate(ve,m),l.__reactInternalSnapshotBeforeUpdate=e}catch(je){st(a,a.return,je)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)vf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":vf(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 bv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:zs(e,a),l&4&&or(5,a);break;case 1:if(zs(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(_){st(a,a.return,_)}else{var f=ii(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(_){st(a,a.return,_)}}l&64&&pv(a),l&512&&rr(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{sg(e,n)}catch(_){st(a,a.return,_)}}break;case 27:n===null&&l&4&&vv(a);case 26:case 5:zs(e,a),n===null&&l&4&&hv(a),l&512&&rr(a,a.return);break;case 12:zs(e,a);break;case 31:zs(e,a),l&4&&kv(e,a);break;case 13:zs(e,a),l&4&&Sv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=sS.bind(null,a),SS(e,a))));break;case 22:if(l=a.memoizedState!==null||Ls,!l){n=n!==null&&n.memoizedState!==null||Ut,f=Ls;var m=Ut;Ls=l,(Ut=n)&&!m?Us(e,a,(a.subtreeFlags&8772)!==0):zs(e,a),Ls=f,Ut=m}break;case 30:break;default:zs(e,a)}}function xv(e){var n=e.alternate;n!==null&&(e.alternate=null,xv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&_d(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;)_v(e,n,a),a=a.sibling}function _v(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;xa(a.type)&&(kt=a.stateNode,pn=!1),Bs(e,n,a),gr(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(m){st(a,n,m)}else try{kt.removeChild(a.stateNode)}catch(m){st(a,n,m)}break;case 18:kt!==null&&(pn?(e=kt,p0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),po(e)):p0(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"&&mv(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 kv(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 Sv(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 Yk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new yv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new yv),n;default:throw Error(r(435,e.tag))}}function Kl(e,n){var a=Yk(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=aS.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],m=e,_=n,j=_;e:for(;j!==null;){switch(j.tag){case 27:if(xa(j.type)){kt=j.stateNode,pn=!1;break e}break;case 5:kt=j.stateNode,pn=!1;break e;case 3:case 4:kt=j.stateNode.containerInfo,pn=!0;break e}j=j.return}if(kt===null)throw Error(r(160));_v(m,_,f),kt=null,pn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Tv(n,e),n=n.sibling}var Qn=null;function Tv(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),or(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=Qn;if(mn(n,e),hn(e),l&512&&(Ut||a===null||ms(a,a.return)),l&4){var m=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":m=f.getElementsByTagName("title")[0],(!m||m[Io]||m[ht]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),Xt(m,l,a),m[ht]=e,Gt(m),l=m;break e;case"link":var _=T0("link","href",f).get(l+(a.href||""));if(_){for(var j=0;j<_.length;j++)if(m=_[j],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){_.splice(j,1);break t}}m=f.createElement(l),Xt(m,l,a),f.head.appendChild(m);break;case"meta":if(_=T0("meta","content",f).get(l+(a.content||""))){for(j=0;j<_.length;j++)if(m=_[j],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){_.splice(j,1);break t}}m=f.createElement(l),Xt(m,l,a),f.head.appendChild(m);break;default:throw Error(r(468,l))}m[ht]=e,Gt(m),l=m}e.stateNode=l}else j0(f,e.type,e.stateNode);else e.stateNode=S0(f,l,e.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?j0(f,e.type,e.stateNode):S0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Vu(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&&Vu(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,Vu(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Gu=!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(dc=null,f=Qn,Qn=lc(n.containerInfo),mn(n,e),Qn=f,hn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{po(n.containerInfo)}catch(ve){st(e,e.return,ve)}Gu&&(Gu=!1,jv(e));break;case 4:l=Qn,Qn=lc(e.stateNode.containerInfo),mn(n,e),hn(e),Qn=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,Kl(e,l)));break;case 13:mn(n,e),hn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Jl=xe()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Kl(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(m=M.stateNode,f)_=m.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{j=M.stateNode;var Q=M.memoizedProps.style,q=Q!=null&&Q.hasOwnProperty("display")?Q.display:null;j.style.display=q==null||typeof q=="boolean"?"":(""+q).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 Z=M.stateNode;f?m0(Z,!0):m0(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,Kl(e,a))));break;case 19:mn(n,e),hn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Kl(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(gv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,m=Hu(e);Zl(e,m,f);break;case 5:var _=a.stateNode;a.flags&32&&(Oi(_,""),a.flags&=-33);var j=Hu(e);Zl(e,j,_);break;case 3:case 4:var M=a.stateNode.containerInfo,H=Hu(e);qu(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 jv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;jv(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;)bv(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"&&mv(n,n.return,a),oi(n);break;case 27:gr(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,m=n,_=m.flags;switch(m.tag){case 0:case 11:case 15:Us(f,m,a),or(4,m);break;case 1:if(Us(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(H){st(l,l.return,H)}if(l=m,f=l.updateQueue,f!==null){var j=l.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)ng(M[f],j)}catch(H){st(l,l.return,H)}}a&&_&64&&pv(m),rr(m,m.return);break;case 27:vv(m);case 26:case 5:Us(f,m,a),a&&l===null&&_&4&&hv(m),rr(m,m.return);break;case 12:Us(f,m,a);break;case 31:Us(f,m,a),a&&_&4&&kv(f,m);break;case 13:Us(f,m,a),a&&_&4&&Sv(f,m);break;case 22:m.memoizedState===null&&Us(f,m,a),rr(m,m.return);break;case 30:break;default:Us(f,m,a)}n=n.sibling}}function Fu(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&&Zo(a))}function Zu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Zo(e))}function es(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)wv(e,n,a,l),n=n.sibling}function wv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:es(e,n,a,l),f&2048&&or(9,n);break;case 1:es(e,n,a,l);break;case 3:es(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&&Zo(e)));break;case 12:if(f&2048){es(e,n,a,l),e=n.stateNode;try{var m=n.memoizedProps,_=m.id,j=m.onPostCommit;typeof j=="function"&&j(_,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){st(n,n.return,M)}}else es(e,n,a,l);break;case 31:es(e,n,a,l);break;case 13:es(e,n,a,l);break;case 23:break;case 22:m=n.stateNode,_=n.alternate,n.memoizedState!==null?m._visibility&2?es(e,n,a,l):lr(e,n):m._visibility&2?es(e,n,a,l):(m._visibility|=2,to(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Fu(_,n);break;case 24:es(e,n,a,l),f&2048&&Zu(n.alternate,n);break;default:es(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 m=e,_=n,j=a,M=l,H=_.flags;switch(_.tag){case 0:case 11:case 15:to(m,_,j,M,f),or(8,_);break;case 23:break;case 22:var Y=_.stateNode;_.memoizedState!==null?Y._visibility&2?to(m,_,j,M,f):lr(m,_):(Y._visibility|=2,to(m,_,j,M,f)),f&&H&2048&&Fu(_.alternate,_);break;case 24:to(m,_,j,M,f),f&&H&2048&&Zu(_.alternate,_);break;default:to(m,_,j,M,f)}n=n.sibling}}function lr(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:lr(a,l),f&2048&&Fu(l.alternate,l);break;case 24:lr(a,l),f&2048&&Zu(l.alternate,l);break;default:lr(a,l)}n=n.sibling}}var cr=8192;function no(e,n,a){if(e.subtreeFlags&cr)for(e=e.child;e!==null;)Nv(e,n,a),e=e.sibling}function Nv(e,n,a){switch(e.tag){case 26:no(e,n,a),e.flags&cr&&e.memoizedState!==null&&OS(a,Qn,e.memoizedState,e.memoizedProps);break;case 5:no(e,n,a);break;case 3:case 4:var l=Qn;Qn=lc(e.stateNode.containerInfo),no(e,n,a),Qn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=cr,cr=16777216,no(e,n,a),cr=l):no(e,n,a));break;default:no(e,n,a)}}function Cv(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 dr(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,Av(l,e)}Cv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ev(e),e=e.sibling}function Ev(e){switch(e.tag){case 0:case 11:case 15:dr(e),e.flags&2048&&pa(9,e,e.return);break;case 3:dr(e);break;case 12:dr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Yl(e)):dr(e);break;default:dr(e)}}function Yl(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,Av(l,e)}Cv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:pa(8,n,n.return),Yl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Yl(n));break;default:Yl(n)}e=e.sibling}}function Av(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:Zo(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,m=l.return;if(xv(l),l===a){Ft=null;break e}if(f!==null){f.return=m,Ft=f;break e}Ft=m}}}var Jk={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}},Wk=typeof WeakMap=="function"?WeakMap:Map,et=0,ft=null,Be=null,Pe=0,nt=0,wn=null,ma=!1,so=!1,Ku=!1,$s=0,wt=0,ha=0,ri=0,Yu=0,Nn=0,ao=0,ur=null,gn=null,Ju=!1,Jl=0,Dv=0,Wl=1/0,Xl=null,ga=null,Vt=0,va=null,io=null,Ps=0,Wu=0,Xu=null,Rv=null,fr=0,Qu=null;function Cn(){return(et&2)!==0&&Pe!==0?Pe&-Pe:O.T!==null?of():Kt()}function Mv(){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),wt===4&&ya(e,Pe,Nn,!1)),hs(e))}function Iv(e,n,a){if((et&6)!==0)throw Error(r(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||te(e,n),f=l?eS(e,n):tf(e,n,!0),m=l;do{if(f===0){so&&!l&&ya(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!Xk(a)){f=tf(e,n,!1),m=!1;continue}if(f===2){if(m=n,e.errorRecoveryDisabledLanes&m)var _=0;else _=e.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){n=_;e:{var j=e;f=ur;var M=j.current.memoizedState.isDehydrated;if(M&&(oo(j,_).flags|=256),_=tf(j,_,!1),_!==2){if(Ku&&!M){j.errorRecoveryDisabledLanes|=m,ri|=m,f=4;break e}m=gn,gn=f,m!==null&&(gn===null?gn=m:gn.push.apply(gn,m))}f=_}if(m=!1,f!==2)continue}}if(f===1){oo(e,0),ya(e,n,0,!0);break}e:{switch(l=e,m=f,m){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=Jl+300-xe(),10<f)){if(ya(l,n,Nn,!ma),P(l,0,!0)!==0)break e;Ps=n,l.timeoutHandle=u0(Ov.bind(null,l,a,gn,Xl,Ju,n,Nn,ri,ao,ma,m,"Throttled",-0,0),f);break e}Ov(l,a,gn,Xl,Ju,n,Nn,ri,ao,ma,m,null,-0,0)}}break}while(!0);hs(e)}function Ov(e,n,a,l,f,m,_,j,M,H,Y,Q,q,Z){if(e.timeoutHandle=-1,Q=n.subtreeFlags,Q&8192||(Q&16785408)===16785408){Q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ws},Nv(n,m,Q);var ve=(m&62914560)===m?Jl-xe():(m&4194048)===m?Dv-xe():0;if(ve=LS(Q,ve),ve!==null){Ps=m,e.cancelPendingCommit=ve(Hv.bind(null,e,n,m,a,l,f,_,j,M,Y,Q,null,q,Z)),ya(e,m,_,!H);return}}Hv(e,n,m,a,l,f,_,j,M)}function Xk(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],m=f.getSnapshot;f=f.value;try{if(!kn(m(),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&=~Yu,n&=~ri,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var m=31-nn(f),_=1<<m;l[m]=-1,f&=~_}a!==0&&Re(e,a,n)}function Ql(){return(et&6)===0?(pr(0),!1):!0}function ef(){if(Be!==null){if(nt===0)var e=Be.return;else e=Be,As=Xa=null,gu(e),Ji=null,Yo=0,e=Be;for(;e!==null;)fv(e.alternate,e),e=e.return;Be=null}}function oo(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,yS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Ps=0,ef(),ft=e,Be=a=Cs(e.current,null),Pe=n,nt=0,wn=null,ma=!1,so=te(e,n),Ku=!1,ao=Nn=Yu=ri=ha=wt=0,gn=ur=null,Ju=!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),m=1<<f;n|=e[f],l&=~m}return $s=n,xl(),a}function Lv(e,n){Me=null,O.H=sr,n===Yi||n===Cl?(n=Xh(),nt=3):n===au?(n=Xh(),nt=4):nt=n===Ru?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,wn=n,Be===null&&(wt=1,Vl(e,Bn(n,e.current)))}function Bv(){var e=Tn.current;return e===null?!0:(Pe&4194048)===Pe?Pn===null:(Pe&62914560)===Pe||(Pe&536870912)!==0?e===Pn:!1}function zv(){var e=O.H;return O.H=sr,e===null?sr:e}function Uv(){var e=O.A;return O.A=Jk,e}function ec(){wt=4,ma||(Pe&4194048)!==Pe&&Tn.current!==null||(so=!0),(ha&134217727)===0&&(ri&134217727)===0||ft===null||ya(ft,Pe,Nn,!1)}function tf(e,n,a){var l=et;et|=2;var f=zv(),m=Uv();(ft!==e||Pe!==n)&&(Xl=null,oo(e,n)),n=!1;var _=wt;e:do try{if(nt!==0&&Be!==null){var j=Be,M=wn;switch(nt){case 8:ef(),_=6;break e;case 3:case 2:case 9:case 6:Tn.current===null&&(n=!0);var H=nt;if(nt=0,wn=null,ro(e,j,M,H),a&&so){_=0;break e}break;default:H=nt,nt=0,wn=null,ro(e,j,M,H)}}Qk(),_=wt;break}catch(Y){Lv(e,Y)}while(!0);return n&&e.shellSuspendCounter++,As=Xa=null,et=l,O.H=f,O.A=m,Be===null&&(ft=null,Pe=0,xl()),_}function Qk(){for(;Be!==null;)$v(Be)}function eS(e,n){var a=et;et|=2;var l=zv(),f=Uv();ft!==e||Pe!==n?(Xl=null,Wl=xe()+500,oo(e,n)):so=te(e,n);e:do try{if(nt!==0&&Be!==null){n=Be;var m=wn;t:switch(nt){case 1:nt=0,wn=null,ro(e,n,m,1);break;case 2:case 9:if(Jh(m)){nt=0,wn=null,Pv(n);break}n=function(){nt!==2&&nt!==9||ft!==e||(nt=7),hs(e)},m.then(n,n);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:Jh(m)?(nt=0,wn=null,Pv(n)):(nt=0,wn=null,ro(e,n,m,7));break;case 5:var _=null;switch(Be.tag){case 26:_=Be.memoizedState;case 5:case 27:var j=Be;if(_?w0(_):j.stateNode.complete){nt=0,wn=null;var M=j.sibling;if(M!==null)Be=M;else{var H=j.return;H!==null?(Be=H,tc(H)):Be=null}break t}}nt=0,wn=null,ro(e,n,m,5);break;case 6:nt=0,wn=null,ro(e,n,m,6);break;case 8:ef(),wt=6;break e;default:throw Error(r(462))}}tS();break}catch(Y){Lv(e,Y)}while(!0);return As=Xa=null,O.H=l,O.A=f,et=a,Be!==null?0:(ft=null,Pe=0,xl(),wt)}function tS(){for(;Be!==null&&!ji();)$v(Be)}function $v(e){var n=dv(e.alternate,e,$s);e.memoizedProps=e.pendingProps,n===null?tc(e):Be=n}function Pv(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=av(a,n,n.pendingProps,n.type,void 0,Pe);break;case 11:n=av(a,n,n.pendingProps,n.type.render,n.ref,Pe);break;case 5:gu(n);default:fv(a,n),n=Be=Uh(n,$s),n=dv(a,n,$s)}e.memoizedProps=e.pendingProps,n===null?tc(e):Be=n}function ro(e,n,a,l){As=Xa=null,gu(n),Ji=null,Yo=0;var f=n.return;try{if(Hk(e,f,n,a,Pe)){wt=1,Vl(e,Bn(a,e.current)),Be=null;return}}catch(m){if(f!==null)throw Be=f,m;wt=1,Vl(e,Bn(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))),Vv(n,e)):tc(n)}function tc(e){var n=e;do{if((n.flags&32768)!==0){Vv(n,ma);return}e=n.return;var a=Fk(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);wt===0&&(wt=5)}function Vv(e,n){do{var a=Zk(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);wt=6,Be=null}function Hv(e,n,a,l,f,m,_,j,M){e.cancelPendingCommit=null;do nc();while(Vt!==0);if((et&6)!==0)throw Error(r(327));if(n!==null){if(n===e.current)throw Error(r(177));if(m=n.lanes|n.childLanes,m|=Hd,ke(e,a,m,_,j,M),e===ft&&(Be=ft=null,Pe=0),io=n,va=e,Ps=a,Wu=m,Xu=f,Rv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,iS(Mn,function(){return Kv(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=O.T,O.T=null,f=G.p,G.p=2,_=et,et|=4;try{Kk(e,n,a)}finally{et=_,G.p=f,O.T=l}}Vt=1,qv(),Gv(),Fv()}}function qv(){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=G.p;G.p=2;var f=et;et|=4;try{Tv(n,e);var m=mf,_=Ah(e.containerInfo),j=m.focusedElem,M=m.selectionRange;if(_!==j&&j&&j.ownerDocument&&Eh(j.ownerDocument.documentElement,j)){if(M!==null&&zd(j)){var H=M.start,Y=M.end;if(Y===void 0&&(Y=H),"selectionStart"in j)j.selectionStart=H,j.selectionEnd=Math.min(Y,j.value.length);else{var Q=j.ownerDocument||document,q=Q&&Q.defaultView||window;if(q.getSelection){var Z=q.getSelection(),ve=j.textContent.length,je=Math.min(M.start,ve),rt=M.end===void 0?je:Math.min(M.end,ve);!Z.extend&&je>rt&&(_=rt,rt=je,je=_);var $=Ch(j,je),z=Ch(j,rt);if($&&z&&(Z.rangeCount!==1||Z.anchorNode!==$.node||Z.anchorOffset!==$.offset||Z.focusNode!==z.node||Z.focusOffset!==z.offset)){var V=Q.createRange();V.setStart($.node,$.offset),Z.removeAllRanges(),je>rt?(Z.addRange(V),Z.extend(z.node,z.offset)):(V.setEnd(z.node,z.offset),Z.addRange(V))}}}}for(Q=[],Z=j;Z=Z.parentNode;)Z.nodeType===1&&Q.push({element:Z,left:Z.scrollLeft,top:Z.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<Q.length;j++){var J=Q[j];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}mc=!!pf,mf=pf=null}finally{et=f,G.p=l,O.T=a}}e.current=n,Vt=2}}function Gv(){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=G.p;G.p=2;var f=et;et|=4;try{bv(e,n.alternate,n)}finally{et=f,G.p=l,O.T=a}}Vt=3}}function Fv(){if(Vt===4||Vt===3){Vt=0,Jn();var e=va,n=io,a=Ps,l=Rv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Vt=5:(Vt=0,io=va=null,Zv(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=G.p,G.p=2,O.T=null;try{for(var m=e.onRecoverableError,_=0;_<l.length;_++){var j=l[_];m(j.value,{componentStack:j.stack})}}finally{O.T=n,G.p=f}}(Ps&3)!==0&&nc(),hs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Qu?fr++:(fr=0,Qu=e):fr=0,pr(0)}}function Zv(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Zo(n)))}function nc(){return qv(),Gv(),Fv(),Kv()}function Kv(){if(Vt!==5)return!1;var e=va,n=Wu;Wu=0;var a=Pt(Ps),l=O.T,f=G.p;try{G.p=32>a?32:a,O.T=null,a=Xu,Xu=null;var m=va,_=Ps;if(Vt=0,io=va=null,Ps=0,(et&6)!==0)throw Error(r(331));var j=et;if(et|=4,Ev(m.current),wv(m,m.current,_,a),et=j,pr(0,!1),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(na,m)}catch{}return!0}finally{G.p=f,O.T=l,Zv(e,n)}}function Yv(e,n,a){n=Bn(a,n),n=Du(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)Yv(e,e,a);else for(;n!==null;){if(n.tag===3){Yv(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=Bn(a,e),a=Jg(2),l=da(n,a,2),l!==null&&(Wg(a,l,n,e),$e(l,2),hs(l));break}}n=n.return}}function nf(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Wk;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)||(Ku=!0,f.add(a),e=nS.bind(null,e,n,a),n.then(e,e))}function nS(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&&(wt===4||wt===3&&(Pe&62914560)===Pe&&300>xe()-Jl?(et&2)===0&&oo(e,0):Yu|=a,ao===Pe&&(ao=0)),hs(e)}function Jv(e,n){n===0&&(n=pe()),e=Ya(e,n),e!==null&&($e(e,n),hs(e))}function sS(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Jv(e,a)}function aS(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),Jv(e,a)}function iS(e,n){return Ss(e,n)}var sc=null,lo=null,sf=!1,ac=!1,af=!1,ba=0;function hs(e){e!==lo&&e.next===null&&(lo===null?sc=lo=e:lo=lo.next=e),ac=!0,sf||(sf=!0,rS())}function pr(e,n){if(!af&&ac){af=!0;do for(var a=!1,l=sc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var _=l.suspendedLanes,j=l.pingedLanes;m=(1<<31-nn(42|e)+1)-1,m&=f&~(_&~j),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,e0(l,m))}else m=Pe,m=P(l,l===ft?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||te(l,m)||(a=!0,e0(l,m));l=l.next}while(a);af=!1}}function oS(){Wv()}function Wv(){ac=sf=!1;var e=0;ba!==0&&vS()&&(e=ba);for(var n=xe(),a=null,l=sc;l!==null;){var f=l.next,m=Xv(l,n);m===0?(l.next=null,a===null?sc=f:a.next=f,f===null&&(lo=a)):(a=l,(e!==0||(m&3)!==0)&&(ac=!0)),l=f}Vt!==0&&Vt!==5||pr(e),ba!==0&&(ba=0)}function Xv(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var _=31-nn(m),j=1<<_,M=f[_];M===-1?((j&a)===0||(j&l)!==0)&&(f[_]=le(j,n)):M<=n&&(e.expiredLanes|=j),m&=~j}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||te(e,a)){if(n=a&-a,n===e.callbackPriority)return n;switch(l!==null&&us(l),Pt(a)){case 2:case 8:a=_n;break;case 32:a=Mn;break;case 268435456:a=Pa;break;default:a=Mn}return l=Qv.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 Qv(e,n){if(Vt!==0&&Vt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(nc()&&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:(Iv(e,l,n),Xv(e,xe()),e.callbackNode!=null&&e.callbackNode===a?Qv.bind(null,e):null)}function e0(e,n){if(nc())return null;Iv(e,n,!0)}function rS(){bS(function(){(et&6)!==0?Ss(on,oS):Wv()})}function of(){if(ba===0){var e=Zi;e===0&&(e=Va,Va<<=1,(Va&261888)===0&&(Va=256)),ba=e}return ba}function t0(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:fl(""+e)}function n0(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 lS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var m=t0((f[qt]||null).action),_=l.submitter;_&&(n=(n=_[qt]||null)?t0(n.formAction):_.getAttribute("formAction"),n!==null&&(m=n,_=null));var j=new gl("action","action",null,l,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ba!==0){var M=_?n0(f,_):new FormData(f);ju(a,{pending:!0,data:M,method:f.method,action:m},null,M)}}else typeof m=="function"&&(j.preventDefault(),M=_?n0(f,_):new FormData(f),ju(a,{pending:!0,data:M,method:f.method,action:m},m,M))},currentTarget:f}]})}}for(var rf=0;rf<Vd.length;rf++){var lf=Vd[rf],cS=lf.toLowerCase(),dS=lf[0].toUpperCase()+lf.slice(1);Xn(cS,"on"+dS)}Xn(Mh,"onAnimationEnd"),Xn(Ih,"onAnimationIteration"),Xn(Oh,"onAnimationStart"),Xn("dblclick","onDoubleClick"),Xn("focusin","onFocus"),Xn("focusout","onBlur"),Xn(wk,"onTransitionRun"),Xn(Nk,"onTransitionStart"),Xn(Ck,"onTransitionCancel"),Xn(Lh,"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 mr="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(" "),uS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(mr));function s0(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 m=void 0;if(n)for(var _=l.length-1;0<=_;_--){var j=l[_],M=j.instance,H=j.currentTarget;if(j=j.listener,M!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=H;try{m(f)}catch(Y){bl(Y)}f.currentTarget=null,m=M}else for(_=0;_<l.length;_++){if(j=l[_],M=j.instance,H=j.currentTarget,j=j.listener,M!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=H;try{m(f)}catch(Y){bl(Y)}f.currentTarget=null,m=M}}}}function ze(e,n){var a=n[xd];a===void 0&&(a=n[xd]=new Set);var l=e+"__bubble";a.has(l)||(a0(n,e,2,!1),a.add(l))}function cf(e,n,a){var l=0;n&&(l|=4),a0(a,e,l,n)}var ic="_reactListening"+Math.random().toString(36).slice(2);function df(e){if(!e[ic]){e[ic]=!0,Wm.forEach(function(a){a!=="selectionchange"&&(uS.has(a)||cf(a,!1,e),cf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ic]||(n[ic]=!0,cf("selectionchange",!1,n))}}function a0(e,n,a,l){switch(M0(n)){case 2:var f=US;break;case 8:f=$S;break;default:f=jf}a=f.bind(null,n,a,e),f=void 0,!Ed||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 uf(e,n,a,l,f){var m=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var _=l.tag;if(_===3||_===4){var j=l.stateNode.containerInfo;if(j===f)break;if(_===4)for(_=l.return;_!==null;){var M=_.tag;if((M===3||M===4)&&_.stateNode.containerInfo===f)return;_=_.return}for(;j!==null;){if(_=Ai(j),_===null)return;if(M=_.tag,M===5||M===6||M===26||M===27){l=m=_;continue e}j=j.parentNode}}l=l.return}ch(function(){var H=m,Y=Nd(a),Q=[];e:{var q=Bh.get(e);if(q!==void 0){var Z=gl,ve=e;switch(e){case"keypress":if(ml(a)===0)break e;case"keydown":case"keyup":Z=ak;break;case"focusin":ve="focus",Z=Md;break;case"focusout":ve="blur",Z=Md;break;case"beforeblur":case"afterblur":Z=Md;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":Z=fh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=F1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=rk;break;case Mh:case Ih:case Oh:Z=Y1;break;case Lh:Z=ck;break;case"scroll":case"scrollend":Z=q1;break;case"wheel":Z=uk;break;case"copy":case"cut":case"paste":Z=W1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=mh;break;case"toggle":case"beforetoggle":Z=pk}var je=(n&4)!==0,rt=!je&&(e==="scroll"||e==="scrollend"),$=je?q!==null?q+"Capture":null:q;je=[];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=Lo(z,$),J!=null&&je.push(hr(z,J,V))),rt)break;z=z.return}0<je.length&&(q=new Z(q,ve,null,a,Y),Q.push({event:q,listeners:je}))}}if((n&7)===0){e:{if(q=e==="mouseover"||e==="pointerover",Z=e==="mouseout"||e==="pointerout",q&&a!==wd&&(ve=a.relatedTarget||a.fromElement)&&(Ai(ve)||ve[Ei]))break e;if((Z||q)&&(q=Y.window===Y?Y:(q=Y.ownerDocument)?q.defaultView||q.parentWindow:window,Z?(ve=a.relatedTarget||a.toElement,Z=H,ve=ve?Ai(ve):null,ve!==null&&(rt=d(ve),je=ve.tag,ve!==rt||je!==5&&je!==27&&je!==6)&&(ve=null)):(Z=null,ve=H),Z!==ve)){if(je=fh,J="onMouseLeave",$="onMouseEnter",z="mouse",(e==="pointerout"||e==="pointerover")&&(je=mh,J="onPointerLeave",$="onPointerEnter",z="pointer"),rt=Z==null?q:Oo(Z),V=ve==null?q:Oo(ve),q=new je(J,z+"leave",Z,a,Y),q.target=rt,q.relatedTarget=V,J=null,Ai(Y)===H&&(je=new je($,z+"enter",ve,a,Y),je.target=V,je.relatedTarget=rt,J=je),rt=J,Z&&ve)t:{for(je=fS,$=Z,z=ve,V=0,J=$;J;J=je(J))V++;J=0;for(var Se=z;Se;Se=je(Se))J++;for(;0<V-J;)$=je($),V--;for(;0<J-V;)z=je(z),J--;for(;V--;){if($===z||z!==null&&$===z.alternate){je=$;break t}$=je($),z=je(z)}je=null}else je=null;Z!==null&&i0(Q,q,Z,je,!1),ve!==null&&rt!==null&&i0(Q,rt,ve,je,!0)}}e:{if(q=H?Oo(H):window,Z=q.nodeName&&q.nodeName.toLowerCase(),Z==="select"||Z==="input"&&q.type==="file")var Ye=kh;else if(xh(q))if(Sh)Ye=Sk;else{Ye=_k;var be=xk}else Z=q.nodeName,!Z||Z.toLowerCase()!=="input"||q.type!=="checkbox"&&q.type!=="radio"?H&&jd(H.elementType)&&(Ye=kh):Ye=kk;if(Ye&&(Ye=Ye(e,H))){_h(Q,Ye,a,Y);break e}be&&be(e,q,H),e==="focusout"&&H&&q.type==="number"&&H.memoizedProps.value!=null&&Td(q,"number",q.value)}switch(be=H?Oo(H):window,e){case"focusin":(xh(be)||be.contentEditable==="true")&&(Ui=be,Ud=H,qo=null);break;case"focusout":qo=Ud=Ui=null;break;case"mousedown":$d=!0;break;case"contextmenu":case"mouseup":case"dragend":$d=!1,Dh(Q,a,Y);break;case"selectionchange":if(jk)break;case"keydown":case"keyup":Dh(Q,a,Y)}var Ie;if(Od)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?yh(e,a)&&(Ve="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ve="onCompositionStart");Ve&&(hh&&a.locale!=="ko"&&(zi||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&zi&&(Ie=dh()):(sa=Y,Ad="value"in sa?sa.value:sa.textContent,zi=!0)),be=oc(H,Ve),0<be.length&&(Ve=new ph(Ve,e,null,a,Y),Q.push({event:Ve,listeners:be}),Ie?Ve.data=Ie:(Ie=bh(a),Ie!==null&&(Ve.data=Ie)))),(Ie=hk?gk(e,a):vk(e,a))&&(Ve=oc(H,"onBeforeInput"),0<Ve.length&&(be=new ph("onBeforeInput","beforeinput",null,a,Y),Q.push({event:be,listeners:Ve}),be.data=Ie)),lS(Q,e,H,a,Y)}s0(Q,n)})}function hr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function oc(e,n){for(var a=n+"Capture",l=[];e!==null;){var f=e,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=Lo(e,a),f!=null&&l.unshift(hr(e,f,m)),f=Lo(e,n),f!=null&&l.push(hr(e,f,m))),e.tag===3)return l;e=e.return}return[]}function fS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function i0(e,n,a,l,f){for(var m=n._reactName,_=[];a!==null&&a!==l;){var j=a,M=j.alternate,H=j.stateNode;if(j=j.tag,M!==null&&M===l)break;j!==5&&j!==26&&j!==27||H===null||(M=H,f?(H=Lo(a,m),H!=null&&_.unshift(hr(a,H,M))):f||(H=Lo(a,m),H!=null&&_.push(hr(a,H,M)))),a=a.return}_.length!==0&&e.push({event:n,listeners:_})}var pS=/\r\n?/g,mS=/\u0000|\uFFFD/g;function o0(e){return(typeof e=="string"?e:""+e).replace(pS,`
26
+ `).replace(mS,"")}function r0(e,n){return n=o0(n),o0(e)===n}function ot(e,n,a,l,f,m){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":dl(e,"class",l);break;case"tabIndex":dl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":dl(e,a,l);break;case"style":rh(e,l,m);break;case"data":if(n!=="object"){dl(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=fl(""+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 m=="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=fl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=ws);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=fl(""+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),cl(e,"popover",l);break;case"xlinkActuate":js(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":js(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":js(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":js(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":js(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":js(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":js(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":js(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":js(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":cl(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=V1.get(a)||a,cl(e,a,l))}}function ff(e,n,a,l,f,m){switch(a){case"style":rh(e,l,m);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=ws);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xm.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),n=a.slice(2,f?a.length-7:void 0),m=e[qt]||null,m=m!=null?m[a]:null,typeof m=="function"&&e.removeEventListener(n,m,f),typeof l=="function")){typeof m!="function"&&m!==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,""):cl(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,m;for(m in a)if(a.hasOwnProperty(m)){var _=a[m];if(_!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,n));default:ot(e,n,m,_,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 j=m=_=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":_=Y;break;case"checked":M=Y;break;case"defaultChecked":H=Y;break;case"value":m=Y;break;case"defaultValue":j=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,n));break;default:ot(e,n,l,Y,a,null)}}sh(e,m,j,M,H,_,f,!1);return;case"select":ze("invalid",e),l=_=m=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":m=j;break;case"defaultValue":_=j;break;case"multiple":l=j;default:ot(e,n,f,j,a,null)}n=m,a=_,e.multiple=!!l,n!=null?Ii(e,!!l,n,!1):a!=null&&Ii(e,!!l,a,!0);return;case"textarea":ze("invalid",e),m=f=l=null;for(_ in a)if(a.hasOwnProperty(_)&&(j=a[_],j!=null))switch(_){case"value":l=j;break;case"defaultValue":f=j;break;case"children":m=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(r(91));break;default:ot(e,n,_,j,a,null)}ih(e,l,f,m);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<mr.length;l++)ze(mr[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(jd(n)){for(Y in a)a.hasOwnProperty(Y)&&(l=a[Y],l!==void 0&&ff(e,n,Y,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&ot(e,n,j,l,a,null))}function hS(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,m=null,_=null,j=null,M=null,H=null,Y=null;for(Z in a){var Q=a[Z];if(a.hasOwnProperty(Z)&&Q!=null)switch(Z){case"checked":break;case"value":break;case"defaultValue":M=Q;default:l.hasOwnProperty(Z)||ot(e,n,Z,null,l,Q)}}for(var q in l){var Z=l[q];if(Q=a[q],l.hasOwnProperty(q)&&(Z!=null||Q!=null))switch(q){case"type":m=Z;break;case"name":f=Z;break;case"checked":H=Z;break;case"defaultChecked":Y=Z;break;case"value":_=Z;break;case"defaultValue":j=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(r(137,n));break;default:Z!==Q&&ot(e,n,q,Z,l,Q)}}Sd(e,_,j,M,H,Y,m,f);return;case"select":Z=_=j=q=null;for(m in a)if(M=a[m],a.hasOwnProperty(m)&&M!=null)switch(m){case"value":break;case"multiple":Z=M;default:l.hasOwnProperty(m)||ot(e,n,m,null,l,M)}for(f in l)if(m=l[f],M=a[f],l.hasOwnProperty(f)&&(m!=null||M!=null))switch(f){case"value":q=m;break;case"defaultValue":j=m;break;case"multiple":_=m;default:m!==M&&ot(e,n,f,m,l,M)}n=j,a=_,l=Z,q!=null?Ii(e,!!a,q,!1):!!l!=!!a&&(n!=null?Ii(e,!!a,n,!0):Ii(e,!!a,a?[]:"",!1));return;case"textarea":Z=q=null;for(j in a)if(f=a[j],a.hasOwnProperty(j)&&f!=null&&!l.hasOwnProperty(j))switch(j){case"value":break;case"children":break;default:ot(e,n,j,null,l,f)}for(_ in l)if(f=l[_],m=a[_],l.hasOwnProperty(_)&&(f!=null||m!=null))switch(_){case"value":q=f;break;case"defaultValue":Z=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==m&&ot(e,n,_,f,l,m)}ah(e,q,Z);return;case"option":for(var ve in a)if(q=a[ve],a.hasOwnProperty(ve)&&q!=null&&!l.hasOwnProperty(ve))switch(ve){case"selected":e.selected=!1;break;default:ot(e,n,ve,null,l,q)}for(M in l)if(q=l[M],Z=a[M],l.hasOwnProperty(M)&&q!==Z&&(q!=null||Z!=null))switch(M){case"selected":e.selected=q&&typeof q!="function"&&typeof q!="symbol";break;default:ot(e,n,M,q,l,Z)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var je in a)q=a[je],a.hasOwnProperty(je)&&q!=null&&!l.hasOwnProperty(je)&&ot(e,n,je,null,l,q);for(H in l)if(q=l[H],Z=a[H],l.hasOwnProperty(H)&&q!==Z&&(q!=null||Z!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(r(137,n));break;default:ot(e,n,H,q,l,Z)}return;default:if(jd(n)){for(var rt in a)q=a[rt],a.hasOwnProperty(rt)&&q!==void 0&&!l.hasOwnProperty(rt)&&ff(e,n,rt,void 0,l,q);for(Y in l)q=l[Y],Z=a[Y],!l.hasOwnProperty(Y)||q===Z||q===void 0&&Z===void 0||ff(e,n,Y,q,l,Z);return}}for(var $ in a)q=a[$],a.hasOwnProperty($)&&q!=null&&!l.hasOwnProperty($)&&ot(e,n,$,null,l,q);for(Q in l)q=l[Q],Z=a[Q],!l.hasOwnProperty(Q)||q===Z||q==null&&Z==null||ot(e,n,Q,q,l,Z)}function l0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gS(){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],m=f.transferSize,_=f.initiatorType,j=f.duration;if(m&&j&&l0(_)){for(_=0,j=f.responseEnd,l+=1;l<a.length;l++){var M=a[l],H=M.startTime;if(H>j)break;var Y=M.transferSize,Q=M.initiatorType;Y&&l0(Q)&&(M=M.responseEnd,_+=Y*(M<j?1:(j-H)/(M-H)))}if(--l,n+=8*(m+_)/(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 pf=null,mf=null;function rc(e){return e.nodeType===9?e:e.ownerDocument}function c0(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 d0(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 hf(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 gf=null;function vS(){var e=window.event;return e&&e.type==="popstate"?e===gf?!1:(gf=e,!0):(gf=null,!1)}var u0=typeof setTimeout=="function"?setTimeout:void 0,yS=typeof clearTimeout=="function"?clearTimeout:void 0,f0=typeof Promise=="function"?Promise:void 0,bS=typeof queueMicrotask=="function"?queueMicrotask:typeof f0<"u"?function(e){return f0.resolve(null).then(e).catch(xS)}:u0;function xS(e){setTimeout(function(){throw e})}function xa(e){return e==="head"}function p0(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")gr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,gr(a);for(var m=a.firstChild;m;){var _=m.nextSibling,j=m.nodeName;m[Io]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=_}}else a==="body"&&gr(e.ownerDocument.body);a=f}while(a);po(n)}function m0(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 vf(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":vf(a),_d(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function _S(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[Io])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==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(m=e.getAttribute("src"),(m!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=Vn(e.nextSibling),e===null)break}return null}function kS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Vn(e.nextSibling),e===null))return null;return e}function h0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Vn(e.nextSibling),e===null))return null;return e}function yf(e){return e.data==="$?"||e.data==="$~"}function bf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function SS(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 Vn(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 xf=null;function g0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Vn(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function v0(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 y0(e,n,a){switch(n=rc(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 gr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);_d(e)}var Hn=new Map,b0=new Set;function lc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Vs=G.d;G.d={f:TS,r:jS,D:wS,C:NS,L:CS,m:ES,X:DS,S:AS,M:RS};function TS(){var e=Vs.f(),n=Ql();return e||n}function jS(e){var n=Di(e);n!==null&&n.tag===5&&n.type==="form"?Lg(n):Vs.r(e)}var co=typeof document>"u"?null:document;function x0(e,n,a){var l=co;if(l&&typeof n=="string"&&n){var f=On(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),b0.has(f)||(b0.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 wS(e){Vs.D(e),x0("dns-prefetch",e,null)}function NS(e,n){Vs.C(e,n),x0("preconnect",e,n)}function CS(e,n,a){Vs.L(e,n,a);var l=co;if(l&&e&&n){var f='link[rel="preload"][as="'+On(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+On(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+On(a.imageSizes)+'"]')):f+='[href="'+On(e)+'"]';var m=f;switch(n){case"style":m=uo(e);break;case"script":m=fo(e)}Hn.has(m)||(e=x({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),Hn.set(m,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(vr(m))||n==="script"&&l.querySelector(yr(m))||(n=l.createElement("link"),Xt(n,"link",e),Gt(n),l.head.appendChild(n)))}}function ES(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="'+On(l)+'"][href="'+On(e)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=fo(e)}if(!Hn.has(m)&&(e=x({rel:"modulepreload",href:e},n),Hn.set(m,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(yr(m)))return}l=a.createElement("link"),Xt(l,"link",e),Gt(l),a.head.appendChild(l)}}}function AS(e,n,a){Vs.S(e,n,a);var l=co;if(l&&e){var f=Ri(l).hoistableStyles,m=uo(e);n=n||"default";var _=f.get(m);if(!_){var j={loading:0,preload:null};if(_=l.querySelector(vr(m)))j.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":n},a),(a=Hn.get(m))&&_f(e,a);var M=_=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(){j.loading|=1}),M.addEventListener("error",function(){j.loading|=2}),j.loading|=4,cc(_,n,l)}_={type:"stylesheet",instance:_,count:1,state:j},f.set(m,_)}}}function DS(e,n){Vs.X(e,n);var a=co;if(a&&e){var l=Ri(a).hoistableScripts,f=fo(e),m=l.get(f);m||(m=a.querySelector(yr(f)),m||(e=x({src:e,async:!0},n),(n=Hn.get(f))&&kf(e,n),m=a.createElement("script"),Gt(m),Xt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function RS(e,n){Vs.M(e,n);var a=co;if(a&&e){var l=Ri(a).hoistableScripts,f=fo(e),m=l.get(f);m||(m=a.querySelector(yr(f)),m||(e=x({src:e,async:!0,type:"module"},n),(n=Hn.get(f))&&kf(e,n),m=a.createElement("script"),Gt(m),Xt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function _0(e,n,a,l){var f=(f=ye.current)?lc(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 m=Ri(f).hoistableStyles,_=m.get(e);if(_||(f=f.ownerDocument||f,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,_),(m=f.querySelector(vr(e)))&&!m._p&&(_.instance=m,_.state.loading=5),Hn.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},Hn.set(e,a),m||MS(f,e,a,_.state))),n&&l===null)throw Error(r(528,""));return _}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="'+On(e)+'"'}function vr(e){return'link[rel="stylesheet"]['+e+"]"}function k0(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function MS(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="'+On(e)+'"]'}function yr(e){return"script[async]"+e}function S0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+On(a.href)+'"]');if(l)return n.instance=l,Gt(l),l;var f=x({},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),cc(l,a.precedence,e),n.instance=l;case"stylesheet":f=uo(a.href);var m=e.querySelector(vr(f));if(m)return n.state.loading|=4,n.instance=m,Gt(m),m;l=k0(a),(f=Hn.get(f))&&_f(l,f),m=(e.ownerDocument||e).createElement("link"),Gt(m);var _=m;return _._p=new Promise(function(j,M){_.onload=j,_.onerror=M}),Xt(m,"link",l),n.state.loading|=4,cc(m,a.precedence,e),n.instance=m;case"script":return m=fo(a.src),(f=e.querySelector(yr(m)))?(n.instance=f,Gt(f),f):(l=a,(f=Hn.get(m))&&(l=x({},a),kf(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,cc(l,a.precedence,e));return n.instance}function cc(e,n,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,_=0;_<l.length;_++){var j=l[_];if(j.dataset.precedence===n)m=j;else if(m!==f)break}m?m.parentNode.insertBefore(e,m.nextSibling):(n=a.nodeType===9?a.head:a,n.insertBefore(e,n.firstChild))}function _f(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function kf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var dc=null;function T0(e,n,a){if(dc===null){var l=new Map,f=dc=new Map;f.set(a,l)}else f=dc,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 m=a[f];if(!(m[Io]||m[ht]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var _=m.getAttribute(n)||"";_=e+_;var j=l.get(_);j?j.push(m):l.set(_,[m])}}return l}function j0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function IS(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 w0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function OS(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),m=n.querySelector(vr(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=uc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,Gt(m);return}m=n.ownerDocument||n,l=k0(l),(f=Hn.get(f))&&_f(l,f),m=m.createElement("link"),Gt(m);var _=m;_._p=new Promise(function(j,M){_.onload=j,_.onerror=M}),Xt(m,"link",l),a.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,n),(n=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=uc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var Sf=0;function LS(e,n){return e.stylesheets&&e.count===0&&pc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&pc(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&Sf===0&&(Sf=62500*gS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&pc(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>Sf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function uc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)pc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var fc=null;function pc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,fc=new Map,n.forEach(BS,e),fc=null,uc.call(e))}function BS(e,n){if(!(n.state.loading&4)){var a=fc.get(e);if(a)var l=a.get(null);else{a=new Map,fc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var _=f[m];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(a.set(_.dataset.precedence,_),l=_)}l&&a.set(null,l)}f=n.instance,_=f.getAttribute("data-precedence"),m=a.get(_)||l,m===l&&a.set(null,f),a.set(_,f),this.count++,l=uc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var br={$$typeof:E,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function zS(e,n,a,l,f,m,_,j,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=m,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function N0(e,n,a,l,f,m,_,j,M,H,Y,Q){return e=new zS(e,n,a,_,M,H,Y,Q,j),n=1,m===!0&&(n|=24),m=Sn(3,null,null,n),e.current=m,m.stateNode=e,n=tu(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:n},iu(m),e}function C0(e){return e?(e=Vi,e):Vi}function E0(e,n,a,l,f,m){f=C0(f),l.context===null?l.context=f:l.pendingContext=f,l=ca(n),l.payload={element:a},m=m===void 0?null:m,m!==null&&(l.callback=m),a=da(e,l,n),a!==null&&(vn(a,e,n),Wo(a,e,n))}function A0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function Tf(e,n){A0(e,n),(e=e.alternate)&&A0(e,n)}function D0(e){if(e.tag===13||e.tag===31){var n=Ya(e,67108864);n!==null&&vn(n,e,67108864),Tf(e,67108864)}}function R0(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),Tf(e,n)}}var mc=!0;function US(e,n,a,l){var f=O.T;O.T=null;var m=G.p;try{G.p=2,jf(e,n,a,l)}finally{G.p=m,O.T=f}}function $S(e,n,a,l){var f=O.T;O.T=null;var m=G.p;try{G.p=8,jf(e,n,a,l)}finally{G.p=m,O.T=f}}function jf(e,n,a,l){if(mc){var f=wf(l);if(f===null)uf(e,n,l,hc,a),I0(e,l);else if(VS(f,e,n,a,l))l.stopPropagation();else if(I0(e,l),n&4&&-1<PS.indexOf(e)){for(;f!==null;){var m=Di(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var _=Ts(m.pendingLanes);if(_!==0){var j=m;for(j.pendingLanes|=2,j.entangledLanes|=2;_;){var M=1<<31-nn(_);j.entanglements[1]|=M,_&=~M}hs(m),(et&6)===0&&(Wl=xe()+500,pr(0))}}break;case 31:case 13:j=Ya(m,2),j!==null&&vn(j,m,2),Ql(),Tf(m,2)}if(m=wf(l),m===null&&uf(e,n,l,hc,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else uf(e,n,l,null,a)}}function wf(e){return e=Nd(e),Nf(e)}var hc=null;function Nf(e){if(hc=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 hc=e,null}function M0(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 _n:return 8;case Mn:case wi:return 32;case Pa:return 268435456;default:return 32}default:return 32}}var Cf=!1,_a=null,ka=null,Sa=null,xr=new Map,_r=new Map,Ta=[],PS="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 I0(e,n){switch(e){case"focusin":case"focusout":_a=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":_r.delete(n.pointerId)}}function kr(e,n,a,l,f,m){return e===null||e.nativeEvent!==m?(e={blockedOn:n,domEventName:a,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},n!==null&&(n=Di(n),n!==null&&D0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function VS(e,n,a,l,f){switch(n){case"focusin":return _a=kr(_a,e,n,a,l,f),!0;case"dragenter":return ka=kr(ka,e,n,a,l,f),!0;case"mouseover":return Sa=kr(Sa,e,n,a,l,f),!0;case"pointerover":var m=f.pointerId;return xr.set(m,kr(xr.get(m)||null,e,n,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,_r.set(m,kr(_r.get(m)||null,e,n,a,l,f)),!0}return!1}function O0(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(){R0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,At(e.priority,function(){R0(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 gc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=wf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);wd=l,a.target.dispatchEvent(l),wd=null}else return n=Di(a),n!==null&&D0(n),e.blockedOn=a,!1;n.shift()}return!0}function L0(e,n,a){gc(e)&&a.delete(n)}function HS(){Cf=!1,_a!==null&&gc(_a)&&(_a=null),ka!==null&&gc(ka)&&(ka=null),Sa!==null&&gc(Sa)&&(Sa=null),xr.forEach(L0),_r.forEach(L0)}function vc(e,n){e.blockedOn===n&&(e.blockedOn=null,Cf||(Cf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,HS)))}var yc=null;function B0(e){yc!==e&&(yc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){yc===e&&(yc=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(Nf(l||a)===null)continue;break}var m=Di(a);m!==null&&(e.splice(n,3),n-=3,ju(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function po(e){function n(M){return vc(M,e)}_a!==null&&vc(_a,e),ka!==null&&vc(ka,e),Sa!==null&&vc(Sa,e),xr.forEach(n),_r.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);)O0(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],m=a[l+1],_=f[qt]||null;if(typeof m=="function")_||B0(a);else if(_){var j=null;if(m&&m.hasAttribute("formAction")){if(f=m,_=m[qt]||null)j=_.formAction;else if(Nf(f)!==null)continue}else j=_.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),B0(a)}}}function z0(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(_){return f=_})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var 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 Ef(e){this._internalRoot=e}bc.prototype.render=Ef.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));var a=n.current,l=Cn();E0(a,l,e,n,null,null)},bc.prototype.unmount=Ef.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;E0(e.current,2,null,e,null,null),Ql(),n[Ei]=null}};function bc(e){this._internalRoot=e}bc.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&&O0(e)}};var U0=s.version;if(U0!=="19.2.4")throw Error(r(527,U0,"19.2.4"));G.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 qS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xc.isDisabled&&xc.supportsFiber)try{na=xc.inject(qS),tn=xc}catch{}}return Tr.createRoot=function(e,n){if(!c(e))throw Error(r(299));var a=!1,l="",f=Fg,m=Zg,_=Kg;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&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(_=n.onRecoverableError)),n=N0(e,1,!1,null,null,a,l,null,f,m,_,z0),e[Ei]=n.current,df(e),new Ef(n)},Tr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(r(299));var l=!1,f="",m=Fg,_=Zg,j=Kg,M=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(_=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),n=N0(e,1,!0,n,a??null,l,f,M,m,_,j,z0),n.context=C0(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,df(e),new bc(n)},Tr.version="19.2.4",Tr}var Z0;function yT(){if(Z0)return Af.exports;Z0=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(),Af.exports=vT(),Af.exports}var bT=yT();const xT="modulepreload",_T=function(t){return"/"+t},K0={},kT=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(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),h=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));c=u(i.map(g=>{if(g=_T(g),g in K0)return;K0[g]=!0;const v=g.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${x}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":xT,v||(b.as="script"),b.crossOrigin="",b.href=g,h&&b.setAttribute("nonce",h),document.head.appendChild(b),v)return new Promise((k,S)=>{b.addEventListener("load",k),b.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)})},ST=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),TT=QS({baseUrl:"/",fetch:ST}),Te=eT(tT,TT),jT="_bar_1xhb4_1",wT="_input_1xhb4_32",NT="_select_1xhb4_67",CT="_btnPrimary_1xhb4_103",ET="_btnGhost_1xhb4_173",AT="_badge_1xhb4_195",DT="_disconnectHint_1xhb4_205",En={bar:jT,input:wT,select:NT,btnPrimary:CT,btnGhost:ET,badge:AT,disconnectHint:DT};function RT(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 MT({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 Vr({mode:t,sessionId:s,environmentId:i,taskId:r,showPersonaSelect:c,personas:d,environments:u,onSendInput:p,onSpawn:h,onStartTask:g,onProvisionEnvironment:v,onShowToast:x}){const[b,k]=y.useState(""),[S,w]=y.useState(""),N=RT(i,u),T=C=>{if(C.preventDefault(),!!b.trim())if(t==="send"){if(!s||N)return;p(s,b),k("")}else if(t==="spawn"){if(!i)return;h(i,b,S),x==null||x("Session started","success"),k(""),w("")}else{if(!r)return;g(r,void 0,i,b),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:b,onChange:C=>k(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:En.input}),c&&o.jsxs("select",{value:S,onChange:C=>w(C.target.value),className:En.select,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:!b.trim()||!i,className:En.btnPrimary,children:"Go"})]}):t==="start"?o.jsxs("form",{onSubmit:T,className:En.bar,children:[o.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:En.input}),o.jsx("button",{type:"submit",disabled:!b.trim(),className:En.btnPrimary,children:"Send"})]}):o.jsxs("form",{onSubmit:T,className:En.bar,children:[N&&i&&o.jsx(MT,{environmentId:i,onReconnect:v}),o.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:En.input}),o.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:o.jsx("button",{type:"submit",disabled:!b.trim()||N,className:En.btnPrimary,children:"Send"})})]})}const Y0=220,J0=70,IT=40,OT=60,LT="hierarchy",BT="dependency";function zT(t){return y.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new $0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:IT,ranksep:OT});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:Y0,height:J0});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:LT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of u.dependsOn)if(i.has(p)){const h=`dependency-${p}-${u.id}`;s.setEdge(p,u.id,{},h),c.push({id:h,source:p,target:u.id,type:"smoothstep",data:{edgeType:BT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return $0.layout(s),{nodes:t.map(u=>{const p=s.node(u.id),h=r.get(u.id)||[];return{id:u.id,type:"task",position:{x:p.x-Y0/2,y:p.y-J0/2},data:{task:u,childCount:h.length,doneChildCount:h.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 UT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nx=(...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 $T={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 PT=y.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:c="",children:d,iconNode:u,...p},h)=>y.createElement("svg",{ref:h,...$T,width:s,height:s,stroke:t,strokeWidth:r?Number(i)*24/Number(s):i,className:nx("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(PT,{ref:d,iconNode:s,className:nx(`lucide-${UT(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 VT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],W0=Fe("ArrowDown",VT);/**
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 HT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],X0=Fe("ArrowUp",HT);/**
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 qT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],GT=Fe("Ban",qT);/**
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 FT=[["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"}]],ZT=Fe("Brain",FT);/**
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 KT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_i=Fe("Check",KT);/**
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 YT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],sx=Fe("ChevronDown",YT);/**
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 JT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ea=Fe("ChevronRight",JT);/**
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 WT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ma=Fe("Circle",WT);/**
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 XT=[["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"}]],QT=Fe("ClipboardList",XT);/**
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 e2=[["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"}]],ax=Fe("Clipboard",e2);/**
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 t2=[["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"}]],n2=Fe("Cog",t2);/**
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 s2=[["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"}]],a2=Fe("Copy",s2);/**
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 i2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],o2=Fe("CornerDownRight",i2);/**
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 r2=[["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"}]],l2=Fe("FilePen",r2);/**
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 c2=[["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"}]],d2=Fe("FileText",c2);/**
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 u2=[["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"}]],f2=Fe("House",u2);/**
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 p2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jp=Fe("Info",p2);/**
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 m2=[["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"}]],h2=Fe("Key",m2);/**
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 g2=[["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"}]],v2=Fe("Keyboard",g2);/**
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 y2=[["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"}]],b2=Fe("ListChecks",y2);/**
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 x2=[["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"}]],_2=Fe("List",x2);/**
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 k2=[["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"}]],S2=Fe("Loader",k2);/**
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 T2=[["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"}]],j2=Fe("Menu",T2);/**
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 w2=[["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"}]],N2=Fe("MessageSquare",w2);/**
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 C2=[["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"}]],E2=Fe("Monitor",C2);/**
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 A2=[["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"}]],D2=Fe("Palette",A2);/**
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 R2=[["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"}]],M2=Fe("Pause",R2);/**
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 I2=[["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"}]],O2=Fe("Pencil",I2);/**
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 L2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],ix=Fe("Search",L2);/**
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 B2=[["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"}]],z2=Fe("Settings",B2);/**
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 U2=[["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"}]],$2=Fe("SquareCheckBig",U2);/**
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 P2=[["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"}]],Wp=Fe("TriangleAlert",P2);/**
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 V2=[["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"}]],H2=Fe("User",V2);/**
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 q2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ba=Fe("X",q2),Xp=8,at=12,Zt=14,It=16,_p={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(M2,{size:at}),label:"Paused"},complete:{color:"var(--accent-green)",icon:o.jsx(_i,{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(GT,{size:at}),label:"Blocked"}};function Ia(t){return t==="blocked"?_p.blocked:_p[Xr(t)]}const G2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function F2(t){return G2[Xr(t)]??"statusPending"}const Z2=["working","paused","failed","not_started","blocked","complete"],Q0=["not_started","working","paused","complete","failed"],K2={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function Xr(t){return t in _p&&t!=="blocked"?t:K2[t]??"not_started"}const Y2={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"},J2="_dagContainer_js4w6_1",W2="_taskNode_js4w6_26",X2="_taskNodeBorder_js4w6_54",Q2="_taskNodeContent_js4w6_60",ej="_taskNodeHeader_js4w6_70",tj="_taskNodeIcon_js4w6_77",nj="_taskNodeTitle_js4w6_82",sj="_taskNodeBadges_js4w6_90",aj="_childBadge_js4w6_95",ij="_depBadge_js4w6_107",oj="_handle_js4w6_119",rj="_emptyCta_js4w6_126",lj="_ctaDescription_js4w6_137",cj="_ctaButton_js4w6_144",un={dagContainer:J2,taskNode:W2,taskNodeBorder:X2,taskNodeContent:Q2,taskNodeHeader:ej,taskNodeIcon:tj,taskNodeTitle:nj,taskNodeBadges:sj,childBadge:aj,depBadge:ij,handle:oj,emptyCta:rj,ctaDescription:lj,ctaButton:cj};function dj({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(P0,{type:"target",position:V0.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(P0,{type:"source",position:V0.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 ey="popstate";function ty(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function uj(t={}){function s(r,c){var g;let d=(g=c.state)==null?void 0:g.masked,{pathname:u,search:p,hash:h}=d||r.location;return kp("",{pathname:u,search:p,hash:h},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:Hr(c)}return pj(s,i,null,t)}function bt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Kn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function fj(){return Math.random().toString(36).substring(2,10)}function ny(t,s){return{usr:t.state,key:t.key,idx:s,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function kp(t,s,i=null,r,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?Eo(s):s,state:i,key:s&&s.key||r||fj(),unstable_mask:c}}function Hr({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 Eo(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 pj(t,s,i,r={}){let{window:c=document.defaultView,v5Compat:d=!1}=r,u=c.history,p="POP",h=null,g=v();g==null&&(g=0,u.replaceState({...u.state,idx:g},""));function v(){return(u.state||{idx:null}).idx}function x(){p="POP";let N=v(),T=N==null?null:N-g;g=N,h&&h({action:p,location:w.location,delta:T})}function b(N,T){p="PUSH";let C=ty(N)?N:kp(w.location,N,T);g=v()+1;let E=ny(C,g),D=w.createHref(C.unstable_mask||C);try{u.pushState(E,"",D)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;c.location.assign(D)}d&&h&&h({action:p,location:w.location,delta:1})}function k(N,T){p="REPLACE";let C=ty(N)?N:kp(w.location,N,T);g=v();let E=ny(C,g),D=w.createHref(C.unstable_mask||C);u.replaceState(E,"",D),d&&h&&h({action:p,location:w.location,delta:0})}function S(N){return mj(N)}let w={get action(){return p},get location(){return t(c,u)},listen(N){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(ey,x),h=N,()=>{c.removeEventListener(ey,x),h=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:b,replace:k,go(N){return u.go(N)}};return w}function mj(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:Hr(t);return r=r.replace(/ $/,"%20"),!s&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function ox(t,s,i="/"){return hj(t,s,i,!1)}function hj(t,s,i,r){let c=typeof s=="string"?Eo(s):s,d=Ws(c.pathname||"/",i);if(d==null)return null;let u=rx(t);gj(u);let p=null;for(let h=0;p==null&&h<u.length;++h){let g=cx(d);p=jj(u[h],g,r)}return p}function rx(t,s=[],i=[],r="",c=!1){let d=(u,p,h=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)&&h)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 x=ys([r,v.relativePath]),b=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 "${x}".`),rx(u.children,s,b,x,h)),!(u.path==null&&!u.index)&&s.push({path:x,score:Sj(x,u.index),routesMeta:b})};return t.forEach((u,p)=>{var h;if(u.path===""||!((h=u.path)!=null&&h.includes("?")))d(u,p);else for(let g of lx(u.path))d(u,p,!0,g)}),s}function lx(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=lx(r.join("/")),p=[];return p.push(...u.map(h=>h===""?d:[d,h].join("/"))),c&&p.push(...u),p.map(h=>t.startsWith("/")&&h===""?"/":h)}function gj(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:Tj(s.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var vj=/^:[\w-]+$/,yj=3,bj=2,xj=1,_j=10,kj=-2,sy=t=>t==="*";function Sj(t,s){let i=t.split("/"),r=i.length;return i.some(sy)&&(r+=kj),s&&(r+=bj),i.filter(c=>!sy(c)).reduce((c,d)=>c+(vj.test(d)?yj:d===""?xj:_j),r)}function Tj(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 jj(t,s,i=!1){let{routesMeta:r}=t,c={},d="/",u=[];for(let p=0;p<r.length;++p){let h=r[p],g=p===r.length-1,v=d==="/"?s:s.slice(d.length)||"/",x=qr({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),b=h.route;if(!x&&g&&i&&!r[r.length-1].route.index&&(x=qr({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!x)return null;Object.assign(c,x.params),u.push({params:c,pathname:ys([d,x.pathname]),pathnameBase:Aj(ys([d,x.pathnameBase])),route:b}),x.pathnameBase!=="/"&&(d=ys([d,x.pathnameBase]))}return u}function qr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,r]=wj(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:x},b)=>{if(v==="*"){let S=p[b]||"";u=d.slice(0,d.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[b];return x&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:d,pathnameBase:u,pattern:t}}function wj(t,s=!1,i=!0){Kn(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,h,g,v)=>{if(r.push({paramName:p,isOptional:h!=null}),h){let x=v.charAt(g+u.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}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 cx(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Kn(!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 Nj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Cj(t,s="/"){let{pathname:i,search:r="",hash:c=""}=typeof t=="string"?Eo(t):t,d;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?d=ay(i.substring(1),"/"):d=ay(i,s)):d=s,{pathname:d,search:Dj(r),hash:Rj(c)}}function ay(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 Mf(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 Ej(t){return t.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function Qp(t){let s=Ej(t);return s.map((i,r)=>r===s.length-1?i.pathname:i.pathnameBase)}function ld(t,s,i,r=!1){let c;typeof t=="string"?c=Eo(t):(c={...t},bt(!c.pathname||!c.pathname.includes("?"),Mf("?","pathname","search",c)),bt(!c.pathname||!c.pathname.includes("#"),Mf("#","pathname","hash",c)),bt(!c.search||!c.search.includes("#"),Mf("#","search","hash",c)));let d=t===""||c.pathname==="",u=d?"/":c.pathname,p;if(u==null)p=i;else{let x=s.length-1;if(!r&&u.startsWith("..")){let b=u.split("/");for(;b[0]==="..";)b.shift(),x-=1;c.pathname=b.join("/")}p=x>=0?s[x]:"/"}let h=Cj(c,p),g=u&&u!=="/"&&u.endsWith("/"),v=(d||u===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var ys=t=>t.join("/").replace(/\/\/+/g,"/"),Aj=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Dj=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Rj=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Mj=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 Ij(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Oj(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var dx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ux(t,s){let i=t;if(typeof i!="string"||!Nj.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let r=i,c=!1;if(dx)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{Kn(!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 fx=["POST","PUT","PATCH","DELETE"];new Set(fx);var Lj=["GET",...fx];new Set(Lj);var Ao=y.createContext(null);Ao.displayName="DataRouter";var cd=y.createContext(null);cd.displayName="DataRouterState";var Bj=y.createContext(!1),px=y.createContext({isTransitioning:!1});px.displayName="ViewTransition";var zj=y.createContext(new Map);zj.displayName="Fetchers";var Uj=y.createContext(null);Uj.displayName="Await";var Rn=y.createContext(null);Rn.displayName="Navigation";var Qr=y.createContext(null);Qr.displayName="Location";var Yn=y.createContext({outlet:null,matches:[],isDataRoute:!1});Yn.displayName="Route";var em=y.createContext(null);em.displayName="RouteError";var mx="REACT_ROUTER_ERROR",$j="REDIRECT",Pj="ROUTE_ERROR_RESPONSE";function Vj(t){if(t.startsWith(`${mx}:${$j}:{`))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 Hj(t){if(t.startsWith(`${mx}:${Pj}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Mj(s.status,s.statusText,s.data)}catch{}}function qj(t,{relative:s}={}){bt(ki(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=y.useContext(Rn),{hash:c,pathname:d,search:u}=el(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(Qr)!=null}function Ht(){return bt(ki(),"useLocation() may be used only in the context of a <Router> component."),y.useContext(Qr).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(()=>qr(t,cx(s)),[s,t])}var hx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function gx(t){y.useContext(Rn).static||y.useLayoutEffect(t)}function dd(){let{isDataRoute:t}=y.useContext(Yn);return t?iw():Gj()}function Gj(){bt(ki(),"useNavigate() may be used only in the context of a <Router> component.");let t=y.useContext(Ao),{basename:s,navigator:i}=y.useContext(Rn),{matches:r}=y.useContext(Yn),{pathname:c}=Ht(),d=JSON.stringify(Qp(r)),u=y.useRef(!1);return gx(()=>{u.current=!0}),y.useCallback((h,g={})=>{if(Kn(u.current,hx),!u.current)return;if(typeof h=="number"){i.go(h);return}let v=ld(h,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 Fj=y.createContext(null);function Zj(t){let s=y.useContext(Yn).outlet;return y.useMemo(()=>s&&y.createElement(Fj.Provider,{value:t},s),[s,t])}function ds(){let{matches:t}=y.useContext(Yn),s=t[t.length-1];return s?s.params:{}}function el(t,{relative:s}={}){let{matches:i}=y.useContext(Yn),{pathname:r}=Ht(),c=JSON.stringify(Qp(i));return y.useMemo(()=>ld(t,JSON.parse(c),r,s==="path"),[t,c,r,s])}function Kj(t,s){return vx(t,s)}function vx(t,s,i){var N;bt(ki(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=y.useContext(Rn),{matches:c}=y.useContext(Yn),d=c[c.length-1],u=d?d.params:{},p=d?d.pathname:"/",h=d?d.pathnameBase:"/",g=d&&d.route;{let T=g&&g.path||"";bx(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(),x;if(s){let T=typeof s=="string"?Eo(s):s;bt(h==="/"||((N=T.pathname)==null?void 0:N.startsWith(h)),`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 "${h}" but pathname "${T.pathname}" was given in the \`location\` prop.`),x=T}else x=v;let b=x.pathname||"/",k=b;if(h!=="/"){let T=h.replace(/^\//,"").split("/");k="/"+b.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=ox(t,{pathname:k});Kn(g||S!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Kn(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 "${x.pathname}${x.search}${x.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 w=Qj(S&&S.map(T=>Object.assign({},T,{params:Object.assign({},u,T.params),pathname:ys([h,r.encodeLocation?r.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?h:ys([h,r.encodeLocation?r.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,i);return s&&w?y.createElement(Qr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...x},navigationType:"POP"}},w):w}function Yj(){let t=aw(),s=Ij(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 Jj=y.createElement(Yj,null),yx=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=Hj(t.digest);i&&(t=i)}let s=t!==void 0?y.createElement(Yn.Provider,{value:this.props.routeContext},y.createElement(em.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?y.createElement(Wj,{error:t},s):s}};yx.contextType=Bj;var If=new WeakMap;function Wj({children:t,error:s}){let{basename:i}=y.useContext(Rn);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let r=Vj(s.digest);if(r){let c=If.get(s);if(c)throw c;let d=ux(r.location,i);if(dx&&!If.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 If.set(s,u),u}return y.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return t}function Xj({routeContext:t,match:s,children:i}){let r=y.useContext(Ao);return r&&r.static&&r.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=s.route.id),y.createElement(Yn.Provider,{value:t},i)}function Qj(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(x=>x.route.id&&(d==null?void 0:d[x.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 x=c[v];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(p=v),x.route.id){let{loaderData:b,errors:k}=r,S=x.route.loader&&!b.hasOwnProperty(x.route.id)&&(!k||k[x.route.id]===void 0);if(x.route.lazy||S){i.isStatic&&(u=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let h=i==null?void 0:i.onError,g=r&&h?(v,x)=>{var b,k;h(v,{location:r.location,params:((k=(b=r.matches)==null?void 0:b[0])==null?void 0:k.params)??{},unstable_pattern:Oj(r.matches),errorInfo:x})}:void 0;return c.reduceRight((v,x,b)=>{let k,S=!1,w=null,N=null;r&&(k=d&&x.route.id?d[x.route.id]:void 0,w=x.route.errorElement||Jj,u&&(p<0&&b===0?(bx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,N=null):p===b&&(S=!0,N=x.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,b+1)),C=()=>{let E;return k?E=w:S?E=N:x.route.Component?E=y.createElement(x.route.Component,null):x.route.element?E=x.route.element:E=v,y.createElement(Xj,{match:x,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:E})};return r&&(x.route.ErrorBoundary||x.route.errorElement||b===0)?y.createElement(yx,{location:r.location,revalidation:r.revalidation,component:w,error:k,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function tm(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ew(t){let s=y.useContext(Ao);return bt(s,tm(t)),s}function tw(t){let s=y.useContext(cd);return bt(s,tm(t)),s}function nw(t){let s=y.useContext(Yn);return bt(s,tm(t)),s}function nm(t){let s=nw(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 sw(){return nm("useRouteId")}function aw(){var r;let t=y.useContext(em),s=tw("useRouteError"),i=nm("useRouteError");return t!==void 0?t:(r=s.errors)==null?void 0:r[i]}function iw(){let{router:t}=ew("useNavigate"),s=nm("useNavigate"),i=y.useRef(!1);return gx(()=>{i.current=!0}),y.useCallback(async(c,d={})=>{Kn(i.current,hx),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...d}))},[t,s])}var iy={};function bx(t,s,i){!s&&!iy[t]&&(iy[t]=!0,Kn(!1,i))}y.memo(ow);function ow({routes:t,future:s,state:i,isStatic:r,onError:c}){return vx(t,void 0,{state:i,isStatic:r,onError:c})}function rs({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(Rn);Kn(!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(Yn),{pathname:u}=Ht(),p=dd(),h=ld(t,Qp(d),u,r==="path"),g=JSON.stringify(h);return y.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:r})},[p,g,r,s,i]),null}function za(t){return Zj(t.context)}function we(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 rw({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(/^\/*/,"/"),h=y.useMemo(()=>({basename:p,navigator:c,static:d,unstable_useTransitions:u,future:{}}),[p,c,d,u]);typeof i=="string"&&(i=Eo(i));let{pathname:g="/",search:v="",hash:x="",state:b=null,key:k="default",unstable_mask:S}=i,w=y.useMemo(()=>{let N=Ws(g,p);return N==null?null:{location:{pathname:N,search:v,hash:x,state:b,key:k,unstable_mask:S},navigationType:r}},[p,g,v,x,b,k,r,S]);return Kn(w!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${x}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:y.createElement(Rn.Provider,{value:h},y.createElement(Qr.Provider,{children:s,value:w}))}function lw({children:t,location:s}){return Kj(Sp(t),s)}function Sp(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,Sp(r.props.children,d));return}bt(r.type===we,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),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=Sp(r.props.children,d)),i.push(u)}),i}var Bc="get",zc="application/x-www-form-urlencoded";function ud(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function cw(t){return ud(t)&&t.tagName.toLowerCase()==="button"}function dw(t){return ud(t)&&t.tagName.toLowerCase()==="form"}function uw(t){return ud(t)&&t.tagName.toLowerCase()==="input"}function fw(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function pw(t,s){return t.button===0&&(!s||s==="_self")&&!fw(t)}function Tp(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 mw(t,s){let i=Tp(t);return s&&s.forEach((r,c)=>{i.has(c)||s.getAll(c).forEach(d=>{i.append(c,d)})}),i}var Sc=null;function hw(){if(Sc===null)try{new FormData(document.createElement("form"),0),Sc=!1}catch{Sc=!0}return Sc}var gw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Of(t){return t!=null&&!gw.has(t)?(Kn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zc}"`),null):t}function vw(t,s){let i,r,c,d,u;if(dw(t)){let p=t.getAttribute("action");r=p?Ws(p,s):null,i=t.getAttribute("method")||Bc,c=Of(t.getAttribute("enctype"))||zc,d=new FormData(t)}else if(cw(t)||uw(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 h=t.getAttribute("formaction")||p.getAttribute("action");if(r=h?Ws(h,s):null,i=t.getAttribute("formmethod")||p.getAttribute("method")||Bc,c=Of(t.getAttribute("formenctype"))||Of(p.getAttribute("enctype"))||zc,d=new FormData(p,t),!hw()){let{name:g,type:v,value:x}=t;if(v==="image"){let b=g?`${g}.`:"";d.append(`${b}x`,"0"),d.append(`${b}y`,"0")}else g&&d.append(g,x)}}else{if(ud(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Bc,r=null,c=zc,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 sm(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function yw(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 bw(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 xw(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 _w(t,s,i){let r=await Promise.all(t.map(async c=>{let d=s.routes[c.route.id];if(d){let u=await bw(d,i);return u.links?u.links():[]}return[]}));return jw(r.flat(1).filter(xw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function oy(t,s,i,r,c,d){let u=(h,g)=>i[g]?h.route.id!==i[g].route.id:!0,p=(h,g)=>{var v;return i[g].pathname!==h.pathname||((v=i[g].route.path)==null?void 0:v.endsWith("*"))&&i[g].params["*"]!==h.params["*"]};return d==="assets"?s.filter((h,g)=>u(h,g)||p(h,g)):d==="data"?s.filter((h,g)=>{var x;let v=r.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(u(h,g)||p(h,g))return!0;if(h.route.shouldRevalidate){let b=h.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((x=i[0])==null?void 0:x.params)||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function kw(t,s,{includeHydrateFallback:i}={}){return Sw(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 Sw(t){return[...new Set(t)]}function Tw(t){let s={},i=Object.keys(t).sort();for(let r of i)s[r]=t[r];return s}function jw(t,s){let i=new Set;return new Set(s),t.reduce((r,c)=>{let d=JSON.stringify(Tw(c));return i.has(d)||(i.add(d),r.push({key:d,link:c})),r},[])}function xx(){let t=y.useContext(Ao);return sm(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function ww(){let t=y.useContext(cd);return sm(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var am=y.createContext(void 0);am.displayName="FrameworkContext";function _x(){let t=y.useContext(am);return sm(t,"You must render this element inside a <HydratedRouter> element"),t}function Nw(t,s){let i=y.useContext(am),[r,c]=y.useState(!1),[d,u]=y.useState(!1),{onFocus:p,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:x}=s,b=y.useRef(null);y.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let w=T=>{T.forEach(C=>{u(C.isIntersecting)})},N=new IntersectionObserver(w,{threshold:.5});return b.current&&N.observe(b.current),()=>{N.disconnect()}}},[t]),y.useEffect(()=>{if(r){let w=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(w)}}},[r]);let k=()=>{c(!0)},S=()=>{c(!1),u(!1)};return i?t!=="intent"?[d,b,{}]:[d,b,{onFocus:jr(p,k),onBlur:jr(h,S),onMouseEnter:jr(g,k),onMouseLeave:jr(v,S),onTouchStart:jr(x,k)}]:[!1,b,{}]}function jr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function Cw({page:t,...s}){let{router:i}=xx(),r=y.useMemo(()=>ox(i.routes,t,i.basename),[i.routes,t,i.basename]);return r?y.createElement(Aw,{page:t,matches:r,...s}):null}function Ew(t){let{manifest:s,routeModules:i}=_x(),[r,c]=y.useState([]);return y.useEffect(()=>{let d=!1;return _w(t,s,i).then(u=>{d||c(u)}),()=>{d=!0}},[t,s,i]),r}function Aw({page:t,matches:s,...i}){let r=Ht(),{future:c,manifest:d,routeModules:u}=_x(),{basename:p}=xx(),{loaderData:h,matches:g}=ww(),v=y.useMemo(()=>oy(t,s,g,d,r,"data"),[t,s,g,d,r]),x=y.useMemo(()=>oy(t,s,g,d,r,"assets"),[t,s,g,d,r]),b=y.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let w=new Set,N=!1;if(s.forEach(C=>{var D;let E=d.routes[C.route.id];!E||!E.hasLoader||(!v.some(A=>A.route.id===C.route.id)&&C.route.id in h&&((D=u[C.route.id])!=null&&D.shouldRevalidate)||E.hasClientLoader?N=!0:w.add(C.route.id))}),w.size===0)return[];let T=yw(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return N&&w.size>0&&T.searchParams.set("_routes",s.filter(C=>w.has(C.route.id)).map(C=>C.route.id).join(",")),[T.pathname+T.search]},[p,c.unstable_trailingSlashAwareDataRequests,h,r,d,v,s,t,u]),k=y.useMemo(()=>kw(x,d),[x,d]),S=Ew(x);return y.createElement(y.Fragment,null,b.map(w=>y.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),k.map(w=>y.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),S.map(({key:w,link:N})=>y.createElement("link",{key:w,nonce:i.nonce,...N,crossOrigin:N.crossOrigin??i.crossOrigin})))}function Dw(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var Rw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Rw&&(window.__reactRouterVersion="7.13.2")}catch{}function Mw({basename:t,children:s,unstable_useTransitions:i,window:r}){let c=y.useRef();c.current==null&&(c.current=uj({window:r,v5Compat:!0}));let d=c.current,[u,p]=y.useState({action:d.action,location:d.location}),h=y.useCallback(g=>{i===!1?p(g):y.startTransition(()=>p(g))},[i]);return y.useLayoutEffect(()=>d.listen(h),[d,h]),y.createElement(rw,{basename:t,children:s,location:u.location,navigationType:u.action,navigator:d,unstable_useTransitions:i})}var kx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,im=y.forwardRef(function({onClick:s,discover:i="render",prefetch:r="none",relative:c,reloadDocument:d,replace:u,unstable_mask:p,state:h,target:g,to:v,preventScrollReset:x,viewTransition:b,unstable_defaultShouldRevalidate:k,...S},w){let{basename:N,navigator:T,unstable_useTransitions:C}=y.useContext(Rn),E=typeof v=="string"&&kx.test(v),D=ux(v,N);v=D.to;let A=qj(v,{relative:c}),B=Ht(),R=null;if(p){let re=ld(p,[],B.unstable_mask?B.unstable_mask.pathname:"/",!0);N!=="/"&&(re.pathname=re.pathname==="/"?N:ys([N,re.pathname])),R=T.createHref(re)}let[U,K,ne]=Nw(r,S),F=Bw(v,{replace:u,unstable_mask:p,state:h,target:g,preventScrollReset:x,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function ee(re){s&&s(re),re.defaultPrevented||F(re)}let ae=!(D.isExternal||d),X=y.createElement("a",{...S,...ne,href:(ae?R:void 0)||D.absoluteURL||A,onClick:ae?ee:s,ref:Dw(w,K),target:g,"data-discover":!E&&i==="render"?"true":void 0});return U&&!E?y.createElement(y.Fragment,null,X,y.createElement(Cw,{page:A})):X});im.displayName="Link";var Iw=y.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:r="",end:c=!1,style:d,to:u,viewTransition:p,children:h,...g},v){let x=el(u,{relative:g.relative}),b=Ht(),k=y.useContext(cd),{navigator:S,basename:w}=y.useContext(Rn),N=k!=null&&Vw(x)&&p===!0,T=S.encodeLocation?S.encodeLocation(x).pathname:x.pathname,C=b.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&&w&&(E=Ws(E,w)||E);const D=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let A=C===T||!c&&C.startsWith(T)&&C.charAt(D)==="/",B=E!=null&&(E===T||!c&&E.startsWith(T)&&E.charAt(T.length)==="/"),R={isActive:A,isPending:B,isTransitioning:N},U=A?s:void 0,K;typeof r=="function"?K=r(R):K=[r,A?"active":null,B?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let ne=typeof d=="function"?d(R):d;return y.createElement(im,{...g,"aria-current":U,className:K,ref:v,style:ne,to:u,viewTransition:p},typeof h=="function"?h(R):h)});Iw.displayName="NavLink";var Ow=y.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:r,replace:c,state:d,method:u=Bc,action:p,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:x,unstable_defaultShouldRevalidate:b,...k},S)=>{let{unstable_useTransitions:w}=y.useContext(Rn),N=$w(),T=Pw(p,{relative:g}),C=u.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&kx.test(p),D=A=>{if(h&&h(A),A.defaultPrevented)return;A.preventDefault();let B=A.nativeEvent.submitter,R=(B==null?void 0:B.getAttribute("formmethod"))||u,U=()=>N(B||A.currentTarget,{fetcherKey:s,method:R,navigate:i,replace:c,state:d,relative:g,preventScrollReset:v,viewTransition:x,unstable_defaultShouldRevalidate:b});w&&i!==!1?y.startTransition(()=>U()):U()};return y.createElement("form",{ref:S,method:C,action:T,onSubmit:r?h:D,...k,"data-discover":!E&&t==="render"?"true":void 0})});Ow.displayName="Form";function Lw(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Sx(t){let s=y.useContext(Ao);return bt(s,Lw(t)),s}function Bw(t,{target:s,replace:i,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=dd(),x=Ht(),b=el(t,{relative:u});return y.useCallback(k=>{if(pw(k,s)){k.preventDefault();let S=i!==void 0?i:Hr(x)===Hr(b),w=()=>v(t,{replace:S,unstable_mask:r,state:c,preventScrollReset:d,relative:u,viewTransition:p,unstable_defaultShouldRevalidate:h});g?y.startTransition(()=>w()):w()}},[x,v,b,i,r,c,s,t,d,u,p,h,g])}function om(t){Kn(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(Tp(t)),i=y.useRef(!1),r=Ht(),c=y.useMemo(()=>mw(r.search,i.current?null:s.current),[r.search]),d=dd(),u=y.useCallback((p,h)=>{const g=Tp(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,d("?"+g,h)},[d,c]);return[c,u]}var zw=0,Uw=()=>`__${String(++zw)}__`;function $w(){let{router:t}=Sx("useSubmit"),{basename:s}=y.useContext(Rn),i=sw(),r=t.fetch,c=t.navigate;return y.useCallback(async(d,u={})=>{let{action:p,method:h,encType:g,formData:v,body:x}=vw(d,s);if(u.navigate===!1){let b=u.fetcherKey||Uw();await r(b,i,u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:x,formMethod:u.method||h,formEncType:u.encType||g,flushSync:u.flushSync})}else await c(u.action||p,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:v,body:x,formMethod:u.method||h,formEncType:u.encType||g,replace:u.replace,state:u.state,fromRouteId:i,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,c,s,i])}function Pw(t,{relative:s}={}){let{basename:i}=y.useContext(Rn),r=y.useContext(Yn);bt(r,"useFormAction must be used inside a RouteContext");let[c]=r.matches.slice(-1),d={...el(t||".",{relative:s})},u=Ht();if(t==null){d.search=u.search;let p=new URLSearchParams(d.search),h=p.getAll("index");if(h.some(v=>v==="")){p.delete("index"),h.filter(x=>x).forEach(x=>p.append("index",x));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])),Hr(d)}function Vw(t,{relative:s}={}){let i=y.useContext(px);bt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Sx("useViewTransitionState"),c=el(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 qr(c.pathname,u)!=null||qr(c.pathname,d)!=null}function _t(){const t=dd();return y.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function rm(t){return`/sessions/${encodeURIComponent(t)}`}function vi(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function cs(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 Tx(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const To="/environments",Hw="/environments/new";function yi(t){return`/environments/${encodeURIComponent(t)}`}function qw(t){return`/environments/${encodeURIComponent(t)}/edit`}const So="/settings",Gw="/settings/credentials",Lf="/settings/personas",Fw="/settings/personas/new";function jx(t){return`/settings/personas/${encodeURIComponent(t)}`}const Zw="/settings/shortcuts",Kw="/pair",Yw="/chat",bi="/",Jw="/tasks",wx="/workspaces/new",Nx="/knowledge",fd="/findings";function Ww(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:fd}function jp(t,s,i){const r=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${r}`:`/findings/${r}`}const Xw=Y2,Qw={task:dj};function eN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:r}){const c=_t(),d=y.useMemo(()=>i.filter(x=>x.workspaceId===t),[i,t]),{nodes:u,edges:p}=zT(d),h=y.useMemo(()=>{const x=getComputedStyle(document.documentElement),b={};for(const[k,S]of Object.entries(Xw))b[k]=x.getPropertyValue(S).trim()||"#6b7a8d";return b},[r]),g=y.useCallback((x,b)=>{c(cs(b.id,void 0,t,s))},[c,t,s]),v=y.useCallback(x=>{const b=x.data;return h[b.task.status]||h.pending},[h]);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(KS,{nodes:u,edges:p,nodeTypes:Qw,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[o.jsx(YS,{variant:JS.Dots,gap:24,size:1,color:"var(--text-disabled)"}),o.jsx(WS,{showInteractive:!1}),o.jsx(XS,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const tN="_breadcrumbs_17or2_1",nN="_list_17or2_11",sN="_item_17or2_21",aN="_separator_17or2_28",iN="_link_17or2_34",oN="_current_17or2_57",mo={breadcrumbs:tN,list:nN,item:sN,separator:aN,link:iN,current:oN};function _s({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(im,{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 rN="_btn_dwk2o_1",lN="_sm_dwk2o_22",cN="_md_dwk2o_28",dN="_lg_dwk2o_34",uN="_primary_dwk2o_40",fN="_danger_dwk2o_55",pN="_outline_dwk2o_70",mN="_ghost_dwk2o_80",Bf={btn:rN,sm:lN,md:cN,lg:dN,primary:uN,danger:fN,outline:pN,ghost:mN},Zs=y.forwardRef(function({variant:s="primary",size:i="md",className:r,children:c,...d},u){const p=[Bf.btn,Bf[s],Bf[i],r].filter(Boolean).join(" ");return o.jsx("button",{ref:u,className:p,...d,children:c})}),hN="_copyButton_1bqk0_1",gN={copyButton:hN},vN=2e3;function yN({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},vN)}catch{}},[t]);return o.jsx("button",{type:"button",className:`${gN.copyButton} ${s??""}`,onClick:()=>{u().catch(()=>{})},"aria-label":r?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:r?o.jsx(_i,{size:Zt,"aria-hidden":"true"}):o.jsx(ax,{size:Zt,"aria-hidden":"true"})})}const bN="_banner_bxqlh_1",xN="_label_bxqlh_15",_N="_text_bxqlh_25",kN="_link_bxqlh_29",Tc={banner:bN,label:xN,text:_N,link:kN};function SN(){return o.jsxs("div",{className:Tc.banner,"data-testid":"demo-banner",children:[o.jsx("span",{className:Tc.label,children:"DEMO"}),o.jsxs("span",{className:Tc.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:Tc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const TN="_container_og0yp_1",jN="_chevronButton_og0yp_6",wN="_mainButton_og0yp_6",NN="_sm_og0yp_34",CN="_md_og0yp_34",EN="_lg_og0yp_34",AN="_primary_og0yp_57",DN="_danger_og0yp_70",RN="_outline_og0yp_83",MN="_ghost_og0yp_92",IN="_dropdown_og0yp_100",ON="_option_og0yp_113",LN="_optionLabel_og0yp_130",BN="_optionDesc_og0yp_135",Hs={container:TN,chevronButton:jN,mainButton:wN,sm:NN,md:CN,lg:EN,primary:AN,danger:DN,outline:RN,ghost:MN,dropdown:IN,option:ON,optionLabel:LN,optionDesc:BN};function Cx({label:t,onClick:s,options:i,variant:r="primary",size:c="md","data-testid":d}){const[u,p]=y.useState(!1),h=y.useRef(null);y.useEffect(()=>{if(!u)return;function b(k){h.current&&k.target instanceof Node&&!h.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[u]),y.useEffect(()=>{if(!u)return;function b(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[u]);const g=Hs[r]||"",v=Hs[c]||"",x=()=>{u&&p(!1),s()};return o.jsxs("div",{ref:h,className:Hs.container,"data-testid":d,children:[o.jsx("button",{type:"button",className:`${Hs.mainButton} ${g} ${v}`,onClick:x,"data-testid":d?`${d}-main`:void 0,children:t}),o.jsx("button",{type:"button",className:`${Hs.chevronButton} ${g} ${v}`,onClick:()=>p(b=>!b),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":u,"data-testid":d?`${d}-chevron`:void 0,children:o.jsx(sx,{size:Zt,"aria-hidden":"true"})}),u&&o.jsx("div",{className:Hs.dropdown,"data-testid":d?`${d}-menu`:void 0,children:i.map((b,k)=>o.jsxs("button",{type:"button",className:Hs.option,onClick:()=>{b.onClick(),p(!1)},children:[o.jsx("span",{className:Hs.optionLabel,children:b.label}),b.description&&o.jsx("span",{className:Hs.optionDesc,children:b.description})]},k))})]})}function wp(){wp=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)),Gc(p,i.prototype)}function r(c,d){var u=s.get(d);return Object.keys(u).reduce(function(p,h){var g=u[h];if(typeof g=="number")p[h]=c[g];else{for(var v=0;c[g[v]]===void 0&&v+1<g.length;)v++;p[h]=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&&Gc(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(h,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 h=arguments;return typeof h[h.length-1]!="object"&&(h=[].slice.call(h)).push(r(h,p)),d.apply(this,h)})}return t[Symbol.replace].call(this,c,d)},wp.apply(this,arguments)}function Gc(t,s){return Gc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,r){return i.__proto__=r,i},Gc(t,s)}function ry(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 zf(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 ry(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)?ry(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 zN=(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){uT(r,"element",i)};function i(r,c,d){var u,p;if(d&&d.tagName==="pre"&&r.tagName==="code"){var h=(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,x=(function(A){for(var B,R=zf(A.properties.className);!(B=R()).done;){var U=B.value;if(U.slice(0,9)==="language-")return U.slice(9).toLowerCase()}return null})(r);if(!x&&s.defaultLanguage&&r.properties.className.push("language-"+(x=s.defaultLanguage)),r.properties.className.push("code-highlight"),x)try{var b,k;k=(b=x)!=null&&b.includes("diff-")?x.split("-")[1]:x,g=t.highlight(kc(r),k),d.properties.className=(d.properties.className||[]).concat("language-"+k)}catch(A){if(!s.ignoreMissing||!/Unknown language/.test(A.message))throw A;g=r}else g=r;g.children=(v=1,function A(B){return B.reduce(function(R,U){if(U.type==="text"){var K=U.value,ne=(K.match(/\n/g)||"").length;if(ne===0)U.position={start:{line:v,column:1},end:{line:v,column:1}},R.push(U);else for(var F,ee=K.split(`
229
+ `),ae=zf(ee.entries());!(F=ae()).done;){var X=F.value,re=X[0],O=X[1];R.push({type:"text",value:re===ee.length-1?O:O+`
230
+ `,position:{start:{line:v+re,column:1},end:{line:v+re,column:1}}})}return v+=ne,R}if(Object.prototype.hasOwnProperty.call(U,"children")){var G=v;return U.children=A(U.children),R.push(U),U.position={start:{line:G,column:1},end:{line:v,column:1}},R}return R.push(U),R},[])})(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,w=(function(A){var B=/{([\d,-]+)}/,R=A.split(",").map(function(ne){return ne.trim()}).join();if(B.test(R)){var U=B.exec(R)[1],K=pT(U);return function(ne){return K.includes(ne+1)}}return function(){return!1}})(h),N=(function(A){var B=wp(/showLineNumbers=(\d+)/i,{lines:1});if(B.test(A)){var R=B.exec(A);return Number(R.groups.lines)}return 1})(h),T=(function(A){for(var B=new Array(A),R=0;R<A;R++)B[R]={type:"element",tagName:"span",properties:{className:[]},children:[]};return B})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],E=function(){var A,B,R=S.value,U=R[0],K=R[1];K.properties.className=["code-line"];var ne=mT(g,function(F){return F.position.start.line<=U+1&&F.position.end.line>=U+1});K.children=ne.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(x))&&!C.some(function(F){return h.toLowerCase().includes(F)})&&(K.properties.line=[(U+N).toString()],K.properties.className.push("line-number")),w(U)&&K.properties.className.push("highlight-line"),(x==="diff"||(A=x)!=null&&A.includes("diff-"))&&kc(K).substring(0,1)==="-"?K.properties.className.push("deleted"):(x==="diff"||(B=x)!=null&&B.includes("diff-"))&&kc(K).substring(0,1)==="+"&&K.properties.className.push("inserted")},D=zf(T.entries());!(S=D()).done;)E();T.length>0&&kc(T[T.length-1]).trim()===""&&T.pop(),r.children=T}}}})(fT);function Ex(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 jo(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const ly=new Set(["grackle"]);function Do(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const r=t.slice(5,i);if(ly.has(r))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(ly.has(i))return t.slice(s+1)}return t}const UN={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 $N(t){const s=Do(t);return UN[s.toLowerCase()]??"generic"}const PN="_card_qkm9i_2",VN="_cardBlue_qkm9i_20",HN="_cardOrange_qkm9i_24",qN="_cardGreen_qkm9i_28",GN="_cardPurple_qkm9i_32",FN="_cardNeutral_qkm9i_36",ZN="_cardRed_qkm9i_40",KN="_cardTeal_qkm9i_44",YN="_header_qkm9i_48",JN="_icon_qkm9i_55",WN="_toolName_qkm9i_64",XN="_fileName_qkm9i_71",QN="_badge_qkm9i_80",eC="_spacer_qkm9i_87",tC="_bodyToggle_qkm9i_91",nC="_chevron_qkm9i_109",sC="_chevronExpanded_qkm9i_115",aC="_pre_qkm9i_119",iC="_diffAdd_qkm9i_143",oC="_diffRemove_qkm9i_155",rC="_diffContext_qkm9i_167",lC="_diffHeader_qkm9i_176",cC="_diffLine_qkm9i_182",dC="_exitOk_qkm9i_188",uC="_exitError_qkm9i_194",fC="_exitPending_qkm9i_200",pC="_inProgress_qkm9i_228",mC="_metadata_qkm9i_232",hC="_metadataPrefix_qkm9i_239",I={card:PN,cardBlue:VN,cardOrange:HN,cardGreen:qN,cardPurple:GN,cardNeutral:FN,cardRed:ZN,cardTeal:KN,header:YN,icon:JN,toolName:WN,fileName:XN,badge:QN,spacer:eC,bodyToggle:tC,chevron:nC,chevronExpanded:sC,pre:aC,diffAdd:iC,diffRemove:oC,diffContext:rC,diffHeader:lC,diffLine:cC,exitOk:dC,exitError:uC,exitPending:fC,inProgress:pC,metadata:mC,metadataPrefix:hC};function gC(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 vC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Uf=5;function cy({tool:t,args:s,result:i,isError:r,writeVariant:c}){const[d,u]=y.useState(!1),p=gC(s),h=vC(p),g=i===void 0,v=r?I.cardRed:c?I.cardGreen:I.cardBlue,x=c?"var(--accent-green)":"var(--accent-blue)",b=c?o.jsx(l2,{size:Zt}):o.jsx(d2,{size:Zt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(i==null?void 0:i.split(`
231
+ `))??[],w=S.length>Uf,N=d?S:S.slice(0,Uf);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:b}),o.jsx("span",{className:I.toolName,style:{color:x},children:t}),h&&o.jsx("span",{className:I.fileName,title:p,children:h}),!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))}),w&&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-Uf} more lines`]})]})]})}function yC(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 bC(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 xC(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 _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 kC(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 SC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function TC(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=yC(r);if(c.length>0)return c}}const i=kC(t);if(i)return bC(i.oldStr,i.newStr)}const $f=5;function jC({tool:t,args:s,result:i,isError:r,detailedResult:c}){const[d,u]=y.useState(!1),p=_C(s),h=SC(p),g=i===void 0,v=TC(s,c),x=v?xC(v):null,b=((v==null?void 0:v.length)??0)>$f,k=d?v:v==null?void 0:v.slice(0,$f);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(O2,{size:Zt})}),o.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow)"},children:t}),h&&o.jsx("span",{className:I.fileName,title:p,children:h}),x&&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:["+",x.added]})," ",o.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",x.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,w)=>{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},w)})}),b&&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)-$f} more lines`]})]}),!r&&!v&&!g&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:i})]})}const wC=/^\[exit (\d+)\]\s*/;function NC(t){const s=wC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function CC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function EC(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 Pf=3;function AC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=CC(s),p=EC(u),h=i===void 0,g=i?NC(i):null,v=(g==null?void 0:g.output.split(`
235
+ `))??[],x=v.length>Pf,b=c?v:v.slice(0,Pf),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(_i,{size:at,"aria-hidden":"true"}):o.jsx(Ba,{size:at,"aria-hidden":"true"})," ","exit ",k]}),h&&o.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:o.jsx(S2,{size:at,"aria-hidden":"true"})})]}),!h&&g&&g.output.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-output",children:b.join(`
236
+ `)}),x&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(w=>!w)},"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-Pf} more lines`]})]})]})}function DC(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 Vf=5;function RC({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{pattern:u,path:p}=DC(s),h=i===void 0,g=(i==null?void 0:i.split(`
237
+ `).filter(b=>b.length>0))??[],v=g.length>Vf,x=c?g:g.slice(0,Vf);return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${h?I.inProgress:""}`,"data-testid":"tool-card-search",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:o.jsx(ix,{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]}),!h&&!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&&!h&&x.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-results",children:x.join(`
238
+ `)}),v&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"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-Vf} more matches`]})]})]})}const MC="_progressBar_14f5c_1",IC="_progressFill_14f5c_9",OC="_activeTask_14f5c_16",LC="_activeIcon_14f5c_27",BC="_todoPulse_14f5c_1",zC="_activeText_14f5c_34",UC="_checklist_14f5c_48",$C="_item_14f5c_55",PC="_itemIcon_14f5c_65",VC="_itemText_14f5c_73",HC="_pending_14f5c_78",qC="_in_progress_14f5c_85",GC="_completed_14f5c_97",FC="_emptyMessage_14f5c_108",ts={progressBar:MC,progressFill:IC,activeTask:OC,activeIcon:LC,todoPulse:BC,activeText:zC,checklist:UC,item:$C,itemIcon:PC,itemText:VC,pending:HC,in_progress:qC,completed:GC,emptyMessage:FC},ZC=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function KC(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:dy(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:dy(i.status)})):typeof s.content=="string"?YC(s.content):[]}function dy(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 YC(t){const s=t.split(`
239
+ `),i=[];for(const r of s){const c=ZC.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 JC(t){switch(t){case"completed":return o.jsx(_i,{size:at});case"in_progress":return o.jsx(Ma,{size:at,fill:"currentColor"});default:return o.jsx(Ma,{size:at})}}function WC({args:t}){const s=KC(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(b2,{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:ts.progressBar,"data-testid":"tool-card-todo-bar",children:o.jsx("div",{className:ts.progressFill,style:{width:`${i/s.length*100}%`}})}),r&&o.jsxs("div",{className:ts.activeTask,"data-testid":"tool-card-todo-active",children:[o.jsx("span",{className:ts.activeIcon,children:o.jsx(Ma,{size:at,fill:"currentColor"})}),o.jsx("span",{className:ts.activeText,children:r.activeForm||r.content})]}),!c&&o.jsx("div",{className:ts.checklist,"data-testid":"tool-card-todo-list",children:s.map((d,u)=>o.jsxs("div",{className:`${ts.item} ${ts[d.status]}`,"data-testid":"tool-card-todo-item",children:[o.jsx("span",{className:ts.itemIcon,children:JC(d.status)}),o.jsx("span",{className:ts.itemText,children:d.content})]},u))}),c&&o.jsx("div",{className:ts.emptyMessage,children:"All items completed and cleared."})]})}function XC(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 QC({tool:t,args:s}){const i=XC(t,s);return o.jsxs("div",{className:I.metadata,"data-testid":"tool-card-metadata",children:[o.jsx("span",{className:I.metadataPrefix,children:o.jsx(o2,{size:at})}),i]})}function eE(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 tE(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 Hf=5,qf=5;function nE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Do(t),p=eE(s),h=i===void 0,{single:g,list:v}=tE(i),x=(g==null?void 0:g.title)??p.title,b=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} ${h?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}),x&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-finding-title",children:['"',x,'"']}),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:b})]}),v&&!b&&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,w)=>o.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",S]},w))}),h&&!x&&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
+ `),w=S.length>qf,N=c?g.content:S.slice(0,qf).join(`
241
+ `);return o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-content",children:N}),w&&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-qf} 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,Hf)).map((S,w)=>`${S.category?`[${S.category}] `:""}${S.title??S.id??`Finding ${w+1}`}`).join(`
242
+ `)}),v.length>Hf&&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-Hf} more findings`]})]})]})}function sE(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 aE(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 uy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function iE(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 Gf=5;function oE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Do(t),p=sE(s),h=i===void 0,{single:g,list:v,sessionId:x}=aE(i),b=(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} ${h?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}),b&&o.jsxs("span",{className:I.fileName,"data-testid":"tool-card-task-title",children:['"',b,'"']}),!b&&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:iE(k)},"data-testid":"tool-card-task-status",children:[uy(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"]})]})]}),h&&!b&&!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&&x&&o.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",x]}),!r&&g&&!v&&!x&&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,Gf)).map(S=>{const w=uy(S.status),N=S.title??S.id??"untitled";return`${w} ${N}`}).join(`
244
+ `)}),v.length>Gf&&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-Gf} more tasks`]})]})]})}function rE(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 lE(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 cE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Do(t),p=rE(s),h=i===void 0,g=lE(i),v=g.status??p.status,x=g.summary??p.summary;return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardGreen} ${h?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})]})]}),x&&o.jsx("pre",{className:I.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:x}),h&&!x&&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&&!h&&i&&!x&&!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(b=>!b)},"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 dE(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 uE(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 Ff=5;function fE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Do(t),p=dE(s),h=i===void 0,g=uE(i);return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardPurple} ${h?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"]})]})]}),h&&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,Ff)).map(v=>{var k,S,w;const x=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((w=v.node)==null?void 0:w.id)??"node",b=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${x}${b}`}).join(`
245
+ `)}),g.results.length>Ff&&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-Ff} 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 pE(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 mE(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 hE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),u=Do(t),p=pE(s),h=i===void 0,g=mE(i);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const x=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} ${h?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}),x&&o.jsx("span",{className:I.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:x}),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"})]})]}),h&&!x&&!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(b=>{const k=[`fd:${b.fd??"?"}`,b.permission??"",b.deliveryMode??""];return b.streamName&&k.push(b.streamName),b.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
247
+ `)}),g.fds.length>5&&o.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(b=>!b)},"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 gE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const Zf=8;function vE({args:t,result:s,isError:i}){const[r,c]=y.useState(!1),d=gE(t),u=s===void 0,p=(s==null?void 0:s.split(`
248
+ `))??[],h=p.length>Zf,g=r?s:p.slice(0,Zf).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}),h&&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-Zf} more lines`]})]})]})}function yE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function bE(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 Kf=5;function xE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),{display:u}=yE(t),p=bE(s),h=i===void 0,g=(i==null?void 0:i.split(`
250
+ `))??[],v=g.length>Kf,x=c?i:g.slice(0,Kf).join(`
251
+ `);let b="";if(s!=null)try{b=JSON.stringify(s,null,2)}catch{b=String(s)}return o.jsxs("div",{className:`${I.card} ${r?I.cardRed:I.cardBlue} ${h?I.inProgress:""}`,"data-testid":"tool-card-generic",children:[o.jsxs("div",{className:I.header,children:[o.jsx("span",{className:I.icon,children:o.jsx(n2,{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})]}),h&&b&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:b}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!h&&i&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:x}),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-Kf} more lines`]})]})]})}const _E="_badgePill_o7eqc_1",kE="_modelBadge_o7eqc_14",SE="_backgroundBadge_o7eqc_26",TE="_backgroundDot_o7eqc_36",jE="_backgroundDotPulsing_o7eqc_41",wE="_description_o7eqc_55",NE="_statusLine_o7eqc_62",CE="_statusCompleted_o7eqc_72",EE="_statusRunning_o7eqc_77",AE="_statusError_o7eqc_83",DE="_promptToggle_o7eqc_88",ns={badgePill:_E,modelBadge:kE,backgroundBadge:SE,backgroundDot:TE,backgroundDotPulsing:jE,description:wE,statusLine:NE,statusCompleted:CE,statusRunning:EE,statusError:AE,promptToggle:DE};function RE(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 ME=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function IE(t){const s=ME.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 Yf=5;function OE({tool:t,args:s,result:i,isError:r}){const[c,d]=y.useState(!1),[u,p]=y.useState(!1),h=RE(t,s),g=i===void 0,v=h.isPoll&&i?IE(i):void 0,x=(v==null?void 0:v.content)??i,b=(x==null?void 0:x.split(`
252
+ `))??[],k=b.length>Yf,S=c?x:b.slice(0,Yf).join(`
253
+ `),w=h.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:w}),h.agentType&&o.jsx("span",{className:ns.badgePill,"data-testid":"tool-card-agent-type",children:h.agentType}),h.model&&o.jsx("span",{className:ns.modelBadge,"data-testid":"tool-card-agent-model",children:h.model}),h.isBackground&&o.jsxs("span",{className:ns.backgroundBadge,"data-testid":"tool-card-agent-background",children:[o.jsx("span",{className:g?ns.backgroundDotPulsing:ns.backgroundDot,children:"●"}),"BG"]}),h.agentName&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-name",children:h.agentName}),h.agentId&&o.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-id",children:h.agentId}),o.jsx("span",{className:I.spacer}),g&&!h.isBackground&&o.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),h.description&&o.jsx("div",{className:ns.description,"data-testid":"tool-card-agent-description",children:h.isResume?`Resuming: ${h.description}`:h.description}),v&&o.jsxs("div",{className:ns.statusLine,"data-testid":"tool-card-agent-status",children:[o.jsx("span",{className:v.status==="completed"?ns.statusCompleted:v.status==="running"?ns.statusRunning:ns.statusError,children:v.status}),v.metadata&&o.jsx("span",{children:v.metadata})]}),h.prompt&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:ns.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:h.prompt})]}),r&&i&&o.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!r&&!g&&x&&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":`${b.length-Yf} more lines`]})]})]})}function Jf(t){switch($N(t.tool)){case"file-read":return o.jsx(cy,{...t});case"file-edit":return o.jsx(jC,{...t});case"file-write":return o.jsx(cy,{...t,writeVariant:!0});case"shell":return o.jsx(AC,{...t});case"search":return o.jsx(RC,{...t});case"todo":return o.jsx(WC,{...t});case"metadata":return o.jsx(QC,{...t});case"finding":return o.jsx(nE,{...t});case"task":return o.jsx(oE,{...t});case"workpad":return o.jsx(cE,{...t});case"knowledge":return o.jsx(fE,{...t});case"ipc":return o.jsx(hE,{...t});case"tool-search":return o.jsx(vE,{...t});case"agent":return o.jsx(OE,{...t});default:return o.jsx(xE,{...t})}}const LE="_systemContextEvent_hmqlm_1",BE="_systemContextHeader_hmqlm_7",zE="_systemContextBadge_hmqlm_28",UE="_systemContextToggle_hmqlm_37",$E="_systemContextPre_hmqlm_43",PE="_systemContextEllipsis_hmqlm_54",VE="_systemEvent_hmqlm_58",HE="_systemTimestamp_hmqlm_65",qE="_textEvent_hmqlm_69",GE="_codeBlockWrapper_hmqlm_156",FE="_codeBlockCopyButton_hmqlm_159",ZE="_errorEvent_hmqlm_163",KE="_statusEvent_hmqlm_171",YE="_userInputEvent_hmqlm_180",JE="_userInputContent_hmqlm_186",WE="_signalEvent_hmqlm_203",XE="_signalBadge_hmqlm_214",QE="_signalContent_hmqlm_223",eA="_usageEvent_hmqlm_228",tA="_usageBadge_hmqlm_235",nA="_defaultEvent_hmqlm_244",Ot={systemContextEvent:LE,systemContextHeader:BE,systemContextBadge:zE,systemContextToggle:UE,systemContextPre:$E,systemContextEllipsis:PE,systemEvent:VE,systemTimestamp:HE,textEvent:qE,codeBlockWrapper:GE,codeBlockCopyButton:FE,errorEvent:ZE,statusEvent:KE,userInputEvent:YE,userInputContent:JE,signalEvent:WE,signalBadge:XE,signalContent:QE,usageEvent:eA,usageBadge:tA,defaultEvent:nA},fy=3;function sA({content:t}){const[s,i]=y.useState(!1),r=t.split(`
254
+ `),c=r.length>fy,d=s?t:r.slice(0,fy).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(sx,{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 aA({time:t,content:s}){return o.jsxs("div",{className:Ot.systemEvent,children:[o.jsxs("span",{className:Ot.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Np(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Np).join(""):t!=null&&typeof t=="object"&&"props"in t?Np(t.props.children):""}function iA({children:t,node:s,...i}){const r=Np(t);return o.jsxs("div",{className:Ot.codeBlockWrapper,children:[o.jsx("pre",{...i,children:t}),o.jsx(yN,{text:r,"data-testid":"copy-code-block",className:Ot.codeBlockCopyButton})]})}const oA={pre:iA};function rA({content:t}){return o.jsx("div",{className:Ot.textEvent,children:o.jsx(od,{remarkPlugins:[rd],rehypePlugins:[zN],components:oA,children:t})})}function lA({content:t}){return o.jsxs("div",{className:Ot.errorEvent,children:["Error: ",t]})}function cA({content:t}){return o.jsxs("div",{className:Ot.statusEvent,children:["--- ",t," ---"]})}function dA({content:t}){return o.jsx("div",{className:Ot.userInputEvent,children:o.jsx("span",{className:Ot.userInputContent,children:t})})}function uA({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 fA({content:t}){let s=t;try{const i=JSON.parse(t),r=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,d=Ex(r+c),u=jo(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 pA({content:t}){return o.jsx("div",{className:Ot.defaultEvent,children:t})}function mA({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(sA,{content:t.content})}catch{}return o.jsx(aA,{time:r,content:t.content})}case"text":case"output":return o.jsx(rA,{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(Jf,{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(Jf,{tool:s.tool,args:s.args,result:d,isError:c,detailedResult:s.detailedResult}):o.jsx(Jf,{tool:"Tool output",args:void 0,result:d,isError:c})}case"error":return o.jsx(lA,{content:t.content});case"status":return o.jsx(cA,{content:t.content});case"user_input":return o.jsx(dA,{content:t.content});case"signal":return o.jsx(uA,{content:t.content});case"usage":return o.jsx(fA,{content:t.content});default:return o.jsx(pA,{content:t.content})}}const lm=y.createContext({});function cm(t){const s=y.useRef(null);return s.current===null&&(s.current=t()),s.current}const pd=y.createContext(null),dm=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class hA 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 gA({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(dm);return y.useInsertionEffect(()=>{const{width:u,height:p,top:h,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: ${h}px !important;
261
+ left: ${g}px !important;
262
+ }
263
+ `),()=>{document.head.removeChild(v)}},[s]),o.jsx(hA,{isPresent:s,childRef:r,sizeRef:c,children:y.cloneElement(t,{ref:r})})}const vA=({children:t,initial:s,isPresent:i,onExitComplete:r,custom:c,presenceAffectsLayout:d,mode:u})=>{const p=cm(yA),h=y.useId(),g=y.useCallback(x=>{p.set(x,!0);for(const b of p.values())if(!b)return;r&&r()},[p,r]),v=y.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:x=>(p.set(x,!1),()=>p.delete(x))}),d?[Math.random(),g]:[i,g]);return y.useMemo(()=>{p.forEach((x,b)=>p.set(b,!1))},[i]),y.useEffect(()=>{!i&&!p.size&&r&&r()},[i]),u==="popLayout"&&(t=o.jsx(gA,{isPresent:i,children:t})),o.jsx(pd.Provider,{value:v,children:t})};function yA(){return new Map}function Ax(t=!0){const s=y.useContext(pd);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 jc=t=>t.key||"";function py(t){const s=[];return y.Children.forEach(t,i=>{y.isValidElement(i)&&s.push(i)}),s}const um=typeof window<"u",Dx=um?y.useLayoutEffect:y.useEffect,ls=({children:t,custom:s,initial:i=!0,onExitComplete:r,presenceAffectsLayout:c=!0,mode:d="sync",propagate:u=!1})=>{const[p,h]=Ax(u),g=y.useMemo(()=>py(t),[t]),v=u&&!p?[]:g.map(jc),x=y.useRef(!0),b=y.useRef(g),k=cm(()=>new Map),[S,w]=y.useState(g),[N,T]=y.useState(g);Dx(()=>{x.current=!1,b.current=g;for(let D=0;D<N.length;D++){const A=jc(N[D]);v.includes(A)?k.delete(A):k.get(A)!==!0&&k.set(A,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==S){let D=[...g];for(let A=0;A<N.length;A++){const B=N[A],R=jc(B);v.includes(R)||(D.splice(A,0,B),C.push(B))}d==="wait"&&C.length&&(D=C),T(py(D)),w(g);return}const{forceRender:E}=y.useContext(lm);return o.jsx(o.Fragment,{children:N.map(D=>{const A=jc(D),B=u&&!p?!1:g===N||v.includes(A),R=()=>{if(k.has(A))k.set(A,!0);else return;let U=!0;k.forEach(K=>{K||(U=!1)}),U&&(E==null||E(),T(b.current),u&&(h==null||h()),r&&r())};return o.jsx(vA,{isPresent:B,initial:!x.current||i?void 0:!1,custom:B?void 0:s,presenceAffectsLayout:c,mode:d,onExitComplete:B?void 0:R,children:D},A)})})},An=t=>t;let Rx=An;const bA={useManualTiming:!1};function xA(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)&&(h.schedule(g),t()),g(u)}const h={schedule:(g,v=!1,x=!1)=>{const k=x&&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,h.process(g))}};return h}const wc=["read","resolveKeyframes","update","preRender","render","postRender"],_A=40;function Mx(t,s){let i=!1,r=!0;const c={delta:0,timestamp:0,isProcessing:!1},d=()=>i=!0,u=wc.reduce((T,C)=>(T[C]=xA(d),T),{}),{read:p,resolveKeyframes:h,update:g,preRender:v,render:x,postRender:b}=u,k=()=>{const T=performance.now();i=!1,c.delta=r?1e3/60:Math.max(Math.min(T-c.timestamp,_A),1),c.timestamp=T,c.isProcessing=!0,p.process(c),h.process(c),g.process(c),v.process(c),x.process(c),b.process(c),c.isProcessing=!1,i&&s&&(r=!1,t(k))},S=()=>{i=!0,r=!0,c.isProcessing||t(k)};return{schedule:wc.reduce((T,C)=>{const E=u[C];return T[C]=(D,A=!1,B=!1)=>(i||S(),E.schedule(D,A,B)),T},{}),cancel:T=>{for(let C=0;C<wc.length;C++)u[wc[C]].cancel(T)},state:c,steps:u}}const{schedule:xt,cancel:Oa,state:Qt,steps:Wf}=Mx(typeof requestAnimationFrame<"u"?requestAnimationFrame:An,!0),Ix=y.createContext({strict:!1}),my={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"]},wo={};for(const t in my)wo[t]={isEnabled:s=>my[t].some(i=>!!s[i])};function kA(t){for(const s in t)wo[s]={...wo[s],...t[s]}}const SA=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 Fc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||SA.has(t)}let Ox=t=>!Fc(t);function TA(t){t&&(Ox=s=>s.startsWith("on")?!Fc(s):t(s))}try{TA(require("@emotion/is-prop-valid").default)}catch{}function jA(t,s,i){const r={};for(const c in t)c==="values"&&typeof t.values=="object"||(Ox(c)||i===!0&&Fc(c)||!s&&!Fc(c)||t.draggable&&c.startsWith("onDrag"))&&(r[c]=t[c]);return r}function wA(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 md=y.createContext({});function Gr(t){return typeof t=="string"||Array.isArray(t)}function hd(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const fm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],pm=["initial",...fm];function gd(t){return hd(t.animate)||pm.some(s=>Gr(t[s]))}function Lx(t){return!!(gd(t)||t.variants)}function NA(t,s){if(gd(t)){const{initial:i,animate:r}=t;return{initial:i===!1||Gr(i)?i:void 0,animate:Gr(r)?r:void 0}}return t.inherit!==!1?s:{}}function CA(t){const{initial:s,animate:i}=NA(t,y.useContext(md));return y.useMemo(()=>({initial:s,animate:i}),[hy(s),hy(i)])}function hy(t){return Array.isArray(t)?t.join(" "):t}const EA=Symbol.for("motionComponentSymbol");function vo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function AA(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 mm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),DA="framerAppearId",Bx="data-"+mm(DA),{schedule:hm}=Mx(queueMicrotask,!1),zx=y.createContext({});function RA(t,s,i,r,c){var d,u;const{visualElement:p}=y.useContext(md),h=y.useContext(Ix),g=y.useContext(pd),v=y.useContext(dm).reducedMotion,x=y.useRef(null);r=r||h.renderer,!x.current&&r&&(x.current=r(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const b=x.current,k=y.useContext(zx);b&&!b.projection&&c&&(b.type==="html"||b.type==="svg")&&MA(x.current,i,c,k);const S=y.useRef(!1);y.useInsertionEffect(()=>{b&&S.current&&b.update(i,g)});const w=i[Bx],N=y.useRef(!!w&&!(!((d=window.MotionHandoffIsComplete)===null||d===void 0)&&d.call(window,w))&&((u=window.MotionHasOptimisedAnimation)===null||u===void 0?void 0:u.call(window,w)));return Dx(()=>{b&&(S.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),hm.render(b.render),N.current&&b.animationState&&b.animationState.animateChanges())}),y.useEffect(()=>{b&&(!N.current&&b.animationState&&b.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,w)}),N.current=!1))}),b}function MA(t,s,i,r){const{layoutId:c,layout:d,drag:u,dragConstraints:p,layoutScroll:h,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:Ux(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:h,layoutRoot:g})}function Ux(t){if(t)return t.options.allowProjection!==!1?t.projection:Ux(t.parent)}function IA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:r,Component:c}){var d,u;t&&kA(t);function p(g,v){let x;const b={...y.useContext(dm),...g,layoutId:OA(g)},{isStatic:k}=b,S=CA(g),w=r(g,k);if(!k&&um){LA();const N=BA(b);x=N.MeasureLayout,S.visualElement=RA(c,w,b,s,N.ProjectionNode)}return o.jsxs(md.Provider,{value:S,children:[x&&S.visualElement?o.jsx(x,{visualElement:S.visualElement,...b}):null,i(c,g,AA(w,S.visualElement,v),w,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 h=y.forwardRef(p);return h[EA]=c,h}function OA({layoutId:t}){const s=y.useContext(lm).id;return s&&t!==void 0?s+"-"+t:t}function LA(t,s){y.useContext(Ix).strict}function BA(t){const{drag:s,layout:i}=wo;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 zA=["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 gm(t){return typeof t!="string"||t.includes("-")?!1:!!(zA.indexOf(t)>-1||/[A-Z]/u.test(t))}function gy(t){const s=[{},{}];return t==null||t.values.forEach((i,r)=>{s[0][r]=i.get(),s[1][r]=i.getVelocity()}),s}function vm(t,s,i,r){if(typeof s=="function"){const[c,d]=gy(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]=gy(r);s=s(i!==void 0?i:t.custom,c,d)}return s}const Cp=t=>Array.isArray(t),UA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),$A=t=>Cp(t)?t[t.length-1]||0:t,an=t=>!!(t&&t.getVelocity);function Uc(t){const s=an(t)?t.get():t;return UA(s)?s.toValue():s}function PA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},r,c,d){const u={latestValues:VA(r,c,d,t),renderState:s()};return i&&(u.onMount=p=>i({props:r,current:p,...u}),u.onUpdate=p=>i(p)),u}const $x=t=>(s,i)=>{const r=y.useContext(md),c=y.useContext(pd),d=()=>PA(t,s,r,c);return i?d():cm(d)};function VA(t,s,i,r){const c={},d=r(t,{});for(const b in d)c[b]=Uc(d[b]);let{initial:u,animate:p}=t;const h=gd(t),g=Lx(t);s&&g&&!h&&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 x=v?p:u;if(x&&typeof x!="boolean"&&!hd(x)){const b=Array.isArray(x)?x:[x];for(let k=0;k<b.length;k++){const S=vm(t,b[k]);if(S){const{transitionEnd:w,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 w)c[C]=w[C]}}}return c}const Ro=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ti=new Set(Ro),Px=t=>s=>typeof s=="string"&&s.startsWith(t),Vx=Px("--"),HA=Px("var(--"),ym=t=>HA(t)?qA.test(t.split("/*")[0].trim()):!1,qA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Hx=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Xs=(t,s,i)=>i>s?s:i<t?t:i,Mo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Fr={...Mo,transform:t=>Xs(0,1,t)},Nc={...Mo,default:1},tl=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Da=tl("deg"),bs=tl("%"),Ce=tl("px"),GA=tl("vh"),FA=tl("vw"),vy={...bs,parse:t=>bs.parse(t)/100,transform:t=>bs.transform(t*100)},ZA={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},KA={rotate:Da,rotateX:Da,rotateY:Da,rotateZ:Da,scale:Nc,scaleX:Nc,scaleY:Nc,scaleZ:Nc,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:Fr,originX:vy,originY:vy,originZ:Ce},yy={...Mo,transform:Math.round},bm={...ZA,...KA,zIndex:yy,size:Ce,fillOpacity:Fr,strokeOpacity:Fr,numOctaves:yy},YA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},JA=Ro.length;function WA(t,s,i){let r="",c=!0;for(let d=0;d<JA;d++){const u=Ro[d],p=t[u];if(p===void 0)continue;let h=!0;if(typeof p=="number"?h=p===(u.startsWith("scale")?1:0):h=parseFloat(p)===0,!h||i){const g=Hx(p,bm[u]);if(!h){c=!1;const v=YA[u]||u;r+=`${v}(${g}) `}i&&(s[u]=g)}}return r=r.trim(),i?r=i(s,c?"":r):c&&(r="none"),r}function xm(t,s,i){const{style:r,vars:c,transformOrigin:d}=t;let u=!1,p=!1;for(const h in s){const g=s[h];if(Ti.has(h)){u=!0;continue}else if(Vx(h)){c[h]=g;continue}else{const v=Hx(g,bm[h]);h.startsWith("origin")?(p=!0,d[h]=v):r[h]=v}}if(s.transform||(u||i?r.transform=WA(s,t.transform,i):r.transform&&(r.transform="none")),p){const{originX:h="50%",originY:g="50%",originZ:v=0}=d;r.transformOrigin=`${h} ${g} ${v}`}}const XA={offset:"stroke-dashoffset",array:"stroke-dasharray"},QA={offset:"strokeDashoffset",array:"strokeDasharray"};function eD(t,s,i=1,r=0,c=!0){t.pathLength=1;const d=c?XA:QA;t[d.offset]=Ce.transform(-r);const u=Ce.transform(s),p=Ce.transform(i);t[d.array]=`${u} ${p}`}function by(t,s,i){return typeof t=="string"?t:Ce.transform(s+i*t)}function tD(t,s,i){const r=by(s,t.x,t.width),c=by(i,t.y,t.height);return`${r} ${c}`}function _m(t,{attrX:s,attrY:i,attrScale:r,originX:c,originY:d,pathLength:u,pathSpacing:p=1,pathOffset:h=0,...g},v,x){if(xm(t,g,x),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:b,style:k,dimensions:S}=t;b.transform&&(S&&(k.transform=b.transform),delete b.transform),S&&(c!==void 0||d!==void 0||k.transform)&&(k.transformOrigin=tD(S,c!==void 0?c:.5,d!==void 0?d:.5)),s!==void 0&&(b.x=s),i!==void 0&&(b.y=i),r!==void 0&&(b.scale=r),u!==void 0&&eD(b,u,p,h,!1)}const km=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),qx=()=>({...km(),attrs:{}}),Sm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Gx(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 Fx=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 Zx(t,s,i,r){Gx(t,s,void 0,r);for(const c in s.attrs)t.setAttribute(Fx.has(c)?c:mm(c),s.attrs[c])}const Zc={};function nD(t){Object.assign(Zc,t)}function Kx(t,{layout:s,layoutId:i}){return Ti.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Zc[t]||t==="opacity")}function Tm(t,s,i){var r;const{style:c}=t,d={};for(const u in c)(an(c[u])||s.style&&an(s.style[u])||Kx(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 Yx(t,s,i){const r=Tm(t,s,i);for(const c in t)if(an(t[c])||an(s[c])){const d=Ro.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;r[d]=t[c]}return r}function sD(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 xy=["x","y","width","height","cx","cy","r"],aD={useVisualState:$x({scrapeMotionValuesFromProps:Yx,createRenderState:qx,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<xy.length;p++){const h=xy[p];t[h]!==s[h]&&(u=!0)}u&&xt.read(()=>{sD(i,r),xt.render(()=>{_m(r,c,Sm(i.tagName),t.transformTemplate),Zx(i,r)})})}})},iD={useVisualState:$x({scrapeMotionValuesFromProps:Tm,createRenderState:km})};function Jx(t,s,i){for(const r in s)!an(s[r])&&!Kx(r,i)&&(t[r]=s[r])}function oD({transformTemplate:t},s){return y.useMemo(()=>{const i=km();return xm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function rD(t,s){const i=t.style||{},r={};return Jx(r,i,t),Object.assign(r,oD(t,s)),r}function lD(t,s){const i={},r=rD(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 cD(t,s,i,r){const c=y.useMemo(()=>{const d=qx();return _m(d,s,Sm(r),t.transformTemplate),{...d.attrs,style:{...d.style}}},[s]);if(t.style){const d={};Jx(d,t.style,t),c.style={...d,...c.style}}return c}function dD(t=!1){return(i,r,c,{latestValues:d},u)=>{const h=(gm(i)?cD:lD)(r,d,u,i),g=jA(r,typeof i=="string",t),v=i!==y.Fragment?{...g,...h,ref:c}:{},{children:x}=r,b=y.useMemo(()=>an(x)?x.get():x,[x]);return y.createElement(i,{...v,children:b})}}function uD(t,s){return function(r,{forwardMotionProps:c}={forwardMotionProps:!1}){const u={...gm(r)?aD:iD,preloadedFeatures:t,useRender:dD(c),createVisualElement:s,Component:r};return IA(u)}}function Wx(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 vd(t,s,i){const r=t.getProps();return vm(r,s,i!==void 0?i:r.custom,t)}function jm(t,s){return t?t[s]||t.default||t:void 0}const Xx=new Set(["width","height","top","left","right","bottom",...Ro]);let $c;function fD(){$c=void 0}const xs={now:()=>($c===void 0&&xs.set(Qt.isProcessing||bA.useManualTiming?Qt.timestamp:performance.now()),$c),set:t=>{$c=t,queueMicrotask(fD)}};function wm(t,s){t.indexOf(s)===-1&&t.push(s)}function Nm(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class Cm{constructor(){this.subscriptions=[]}add(s){return wm(this.subscriptions,s),()=>Nm(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 Qx(t,s){return s?t*(1e3/s):0}const _y=30,pD=t=>!isNaN(parseFloat(t));class mD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,c=!0)=>{const d=xs.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=xs.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=pD(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 Cm);const r=this.events[s].add(i);return s==="change"?()=>{r(),xt.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=xs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>_y)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,_y);return Qx(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 Zr(t,s){return new mD(t,s)}function hD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Zr(i))}function gD(t,s){const i=vd(t,s);let{transitionEnd:r={},transition:c={},...d}=i||{};d={...d,...r};for(const u in d){const p=$A(d[u]);hD(t,u,p)}}function vD(t){return!!(an(t)&&t.add)}function Ep(t,s){const i=t.getValue("willChange");if(vD(i))return i.add(s)}function e_(t){return t.props[Bx]}function Em(t){let s;return()=>(s===void 0&&(s=t()),s)}const yD=Em(()=>window.ScrollTimeline!==void 0);class bD{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(yD()&&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 xD extends bD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Ks=t=>t*1e3,Ys=t=>t/1e3;function Am(t){return typeof t=="function"}function ky(t,s){t.timeline=s,t.onfinish=null}const Dm=t=>Array.isArray(t)&&typeof t[0]=="number",_D={linearEasing:void 0};function kD(t,s){const i=Em(t);return()=>{var r;return(r=_D[s])!==null&&r!==void 0?r:i()}}const Kc=kD(()=>{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},t_=(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 n_(t){return!!(typeof t=="function"&&Kc()||!t||typeof t=="string"&&(t in Ap||Kc())||Dm(t)||Array.isArray(t)&&t.every(n_))}const Dr=([t,s,i,r])=>`cubic-bezier(${t}, ${s}, ${i}, ${r})`,Ap={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Dr([0,.65,.55,1]),circOut:Dr([.55,0,1,.45]),backIn:Dr([.31,.01,.66,-.59]),backOut:Dr([.33,1.53,.69,.99])};function s_(t,s){if(t)return typeof t=="function"&&Kc()?t_(t,s):Dm(t)?Dr(t):Array.isArray(t)?t.map(i=>s_(i,s)||Ap.easeOut):Ap[t]}const a_=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,SD=1e-7,TD=12;function jD(t,s,i,r,c){let d,u,p=0;do u=s+(i-s)/2,d=a_(u,r,c)-t,d>0?i=u:s=u;while(Math.abs(d)>SD&&++p<TD);return u}function nl(t,s,i,r){if(t===s&&i===r)return An;const c=d=>jD(d,0,1,t,i);return d=>d===0||d===1?d:a_(c(d),s,r)}const i_=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,o_=t=>s=>1-t(1-s),r_=nl(.33,1.53,.69,.99),Rm=o_(r_),l_=i_(Rm),c_=t=>(t*=2)<1?.5*Rm(t):.5*(2-Math.pow(2,-10*(t-1))),Mm=t=>1-Math.sin(Math.acos(t)),d_=o_(Mm),u_=i_(Mm),f_=t=>/^0[^.\s]+$/u.test(t);function wD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||f_(t):!0}const Lr=t=>Math.round(t*1e5)/1e5,Im=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ND(t){return t==null}const CD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Om=(t,s)=>i=>!!(typeof i=="string"&&CD.test(i)&&i.startsWith(t)||s&&!ND(i)&&Object.prototype.hasOwnProperty.call(i,s)),p_=(t,s,i)=>r=>{if(typeof r!="string")return r;const[c,d,u,p]=r.match(Im);return{[t]:parseFloat(c),[s]:parseFloat(d),[i]:parseFloat(u),alpha:p!==void 0?parseFloat(p):1}},ED=t=>Xs(0,255,t),Xf={...Mo,transform:t=>Math.round(ED(t))},hi={test:Om("rgb","red"),parse:p_("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:r=1})=>"rgba("+Xf.transform(t)+", "+Xf.transform(s)+", "+Xf.transform(i)+", "+Lr(Fr.transform(r))+")"};function AD(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 Dp={test:Om("#"),parse:AD,transform:hi.transform},yo={test:Om("hsl","hue"),parse:p_("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:r=1})=>"hsla("+Math.round(t)+", "+bs.transform(Lr(s))+", "+bs.transform(Lr(i))+", "+Lr(Fr.transform(r))+")"},sn={test:t=>hi.test(t)||Dp.test(t)||yo.test(t),parse:t=>hi.test(t)?hi.parse(t):yo.test(t)?yo.parse(t):Dp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?hi.transform(t):yo.transform(t)},DD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function RD(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Im))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(DD))===null||i===void 0?void 0:i.length)||0)>0}const m_="number",h_="color",MD="var",ID="var(",Sy="${}",OD=/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 Kr(t){const s=t.toString(),i=[],r={color:[],number:[],var:[]},c=[];let d=0;const p=s.replace(OD,h=>(sn.test(h)?(r.color.push(d),c.push(h_),i.push(sn.parse(h))):h.startsWith(ID)?(r.var.push(d),c.push(MD),i.push(h)):(r.number.push(d),c.push(m_),i.push(parseFloat(h))),++d,Sy)).split(Sy);return{values:i,split:p,indexes:r,types:c}}function g_(t){return Kr(t).values}function v_(t){const{split:s,types:i}=Kr(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===m_?d+=Lr(c[u]):p===h_?d+=sn.transform(c[u]):d+=c[u]}return d}}const LD=t=>typeof t=="number"?0:t;function BD(t){const s=g_(t);return v_(t)(s.map(LD))}const La={test:RD,parse:g_,createTransformer:v_,getAnimatableNone:BD},zD=new Set(["brightness","contrast","saturate","opacity"]);function UD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[r]=i.match(Im)||[];if(!r)return t;const c=i.replace(r,"");let d=zD.has(s)?1:0;return r!==i&&(d*=100),s+"("+d+c+")"}const $D=/\b([a-z-]*)\(.*?\)/gu,Rp={...La,getAnimatableNone:t=>{const s=t.match($D);return s?s.map(UD).join(" "):t}},PD={...bm,color:sn,backgroundColor:sn,outlineColor:sn,fill:sn,stroke:sn,borderColor:sn,borderTopColor:sn,borderRightColor:sn,borderBottomColor:sn,borderLeftColor:sn,filter:Rp,WebkitFilter:Rp},Lm=t=>PD[t];function y_(t,s){let i=Lm(t);return i!==Rp&&(i=La),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const VD=new Set(["auto","none","0"]);function HD(t,s,i){let r=0,c;for(;r<t.length&&!c;){const d=t[r];typeof d=="string"&&!VD.has(d)&&Kr(d).values.length&&(c=t[r]),r++}if(c&&i)for(const d of s)t[d]=y_(i,c)}const Ty=t=>t===Mo||t===Ce,jy=(t,s)=>parseFloat(t.split(", ")[s]),wy=(t,s)=>(i,{transform:r})=>{if(r==="none"||!r)return 0;const c=r.match(/^matrix3d\((.+)\)$/u);if(c)return jy(c[1],s);{const d=r.match(/^matrix\((.+)\)$/u);return d?jy(d[1],t):0}},qD=new Set(["x","y","z"]),GD=Ro.filter(t=>!qD.has(t));function FD(t){const s=[];return GD.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:wy(4,13),y:wy(5,14)};Co.translateX=Co.x;Co.translateY=Co.y;const gi=new Set;let Mp=!1,Ip=!1;function b_(){if(Ip){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=FD(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)})}Ip=!1,Mp=!1,gi.forEach(t=>t.complete()),gi.clear()}function x_(){gi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ip=!0)})}function ZD(){x_(),b_()}class Bm{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),Mp||(Mp=!0,xt.read(x_),xt.resolveKeyframes(b_))):(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 h=r.readValue(i,p);h!=null&&(s[0]=h)}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 __=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),KD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function YD(t){const s=KD.exec(t);if(!s)return[,];const[,i,r,c]=s;return[`--${i??r}`,c]}function k_(t,s,i=1){const[r,c]=YD(t);if(!r)return;const d=window.getComputedStyle(s).getPropertyValue(r);if(d){const u=d.trim();return __(u)?parseFloat(u):u}return ym(c)?k_(c,s,i+1):c}const S_=t=>s=>s.test(t),JD={test:t=>t==="auto",parse:t=>t},T_=[Mo,Ce,bs,Da,FA,GA,JD],Ny=t=>T_.find(S_(t));class j_ extends Bm{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 h=0;h<s.length;h++){let g=s[h];if(typeof g=="string"&&(g=g.trim(),ym(g))){const v=k_(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!Xx.has(r)||s.length!==2)return;const[c,d]=s,u=Ny(c),p=Ny(d);if(u!==p)if(Ty(u)&&Ty(p))for(let h=0;h<s.length;h++){const g=s[h];typeof g=="string"&&(s[h]=parseFloat(g))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:s,name:i}=this,r=[];for(let c=0;c<s.length;c++)wD(s[c])&&r.push(c);r.length&&HD(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(([h,g])=>{i.getValue(h).set(g)}),this.resolveNoneKeyframes()}}const Cy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(La.test(t)||t==="0")&&!t.startsWith("url("));function WD(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 XD(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=Cy(c,s),p=Cy(d,s);return!u||!p?!1:WD(t)||(i==="spring"||Am(i))&&r}const QD=t=>t!==null;function yd(t,{repeat:s,repeatType:i="loop"},r){const c=t.filter(QD),d=s&&i!=="loop"&&s%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const eR=40;class w_{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=xs.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>eR?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&ZD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=xs.now(),this.hasAttemptedResolve=!0;const{name:r,type:c,velocity:d,delay:u,onComplete:p,onUpdate:h,isGenerator:g}=this.options;if(!g&&!XD(s,r,c,d))if(u)this.options.duration=0;else{h&&h(yd(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 Op=2e4;function N_(t){let s=0;const i=50;let r=t.next(s);for(;!r.done&&s<Op;)s+=i,r=t.next(s);return s>=Op?1/0:s}const Tt=(t,s,i)=>t+(s-t)*i;function Qf(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 tR({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,h=2*i-p;c=Qf(h,p,t+1/3),d=Qf(h,p,t),u=Qf(h,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(d*255),blue:Math.round(u*255),alpha:r}}function Yc(t,s){return i=>i>0?s:t}const ep=(t,s,i)=>{const r=t*t,c=i*(s*s-r)+r;return c<0?0:Math.sqrt(c)},nR=[Dp,hi,yo],sR=t=>nR.find(s=>s.test(t));function Ey(t){const s=sR(t);if(!s)return!1;let i=s.parse(t);return s===yo&&(i=tR(i)),i}const Ay=(t,s)=>{const i=Ey(t),r=Ey(s);if(!i||!r)return Yc(t,s);const c={...i};return d=>(c.red=ep(i.red,r.red,d),c.green=ep(i.green,r.green,d),c.blue=ep(i.blue,r.blue,d),c.alpha=Tt(i.alpha,r.alpha,d),hi.transform(c))},aR=(t,s)=>i=>s(t(i)),sl=(...t)=>t.reduce(aR),Lp=new Set(["none","hidden"]);function iR(t,s){return Lp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function oR(t,s){return i=>Tt(t,s,i)}function zm(t){return typeof t=="number"?oR:typeof t=="string"?ym(t)?Yc:sn.test(t)?Ay:cR:Array.isArray(t)?C_:typeof t=="object"?sn.test(t)?Ay:rR:Yc}function C_(t,s){const i=[...t],r=i.length,c=t.map((d,u)=>zm(d)(d,s[u]));return d=>{for(let u=0;u<r;u++)i[u]=c[u](d);return i}}function rR(t,s){const i={...t,...s},r={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(r[c]=zm(t[c])(t[c],s[c]));return c=>{for(const d in r)i[d]=r[d](c);return i}}function lR(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]],h=(i=t.values[p])!==null&&i!==void 0?i:0;r[d]=h,c[u]++}return r}const cR=(t,s)=>{const i=La.createTransformer(s),r=Kr(t),c=Kr(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?Lp.has(t)&&!c.values.length||Lp.has(s)&&!r.values.length?iR(t,s):sl(C_(lR(r,c),c.values),i):Yc(t,s)};function E_(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?Tt(t,s,i):zm(t)(t,s)}const dR=5;function A_(t,s,i){const r=Math.max(s-dR,0);return Qx(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},tp=.001;function uR({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,x=v*t,b=v-i,k=Bp(g,u),S=Math.exp(-x);return tp-b/k*S},d=g=>{const x=g*u*t,b=x*i+i,k=Math.pow(u,2)*Math.pow(g,2)*t,S=Math.exp(-x),w=Bp(Math.pow(g,2),u);return(-c(g)+tp>0?-1:1)*((b-k)*S)/w}):(c=g=>{const v=Math.exp(-g*t),x=(g-i)*t+1;return-tp+v*x},d=g=>{const v=Math.exp(-g*t),x=(i-g)*(t*t);return v*x});const p=5/t,h=pR(c,d,p);if(t=Ks(t),isNaN(h))return{stiffness:Ct.stiffness,damping:Ct.damping,duration:t};{const g=Math.pow(h,2)*r;return{stiffness:g,damping:u*2*Math.sqrt(r*g),duration:t}}}const fR=12;function pR(t,s,i){let r=i;for(let c=1;c<fR;c++)r=r-t(r)/s(r);return r}function Bp(t,s){return t*Math.sqrt(1-s*s)}const mR=["duration","bounce"],hR=["stiffness","damping","mass"];function Dy(t,s){return s.some(i=>t[i]!==void 0)}function gR(t){let s={velocity:Ct.velocity,stiffness:Ct.stiffness,damping:Ct.damping,mass:Ct.mass,isResolvedFromDuration:!1,...t};if(!Dy(t,hR)&&Dy(t,mR))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=uR(t);s={...s,...i,mass:Ct.mass},s.isResolvedFromDuration=!0}return s}function D_(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:h,damping:g,mass:v,duration:x,velocity:b,isResolvedFromDuration:k}=gR({...i,velocity:-Ys(i.velocity||0)}),S=b||0,w=g/(2*Math.sqrt(h*v)),N=u-d,T=Ys(Math.sqrt(h/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(w<1){const A=Bp(T,w);E=B=>{const R=Math.exp(-w*T*B);return u-R*((S+w*T*N)/A*Math.sin(A*B)+N*Math.cos(A*B))}}else if(w===1)E=A=>u-Math.exp(-T*A)*(N+(S+T*N)*A);else{const A=T*Math.sqrt(w*w-1);E=B=>{const R=Math.exp(-w*T*B),U=Math.min(A*B,300);return u-R*((S+w*T*N)*Math.sinh(U)+A*N*Math.cosh(U))/A}}const D={calculatedDuration:k&&x||null,next:A=>{const B=E(A);if(k)p.done=A>=x;else{let R=0;w<1&&(R=A===0?Ks(S):A_(E,A,B));const U=Math.abs(R)<=r,K=Math.abs(u-B)<=c;p.done=U&&K}return p.value=p.done?u:B,p},toString:()=>{const A=Math.min(N_(D),Op),B=t_(R=>D.next(A*R).value,A,30);return A+"ms "+B}};return D}function Ry({keyframes:t,velocity:s=0,power:i=.8,timeConstant:r=325,bounceDamping:c=10,bounceStiffness:d=500,modifyTarget:u,min:p,max:h,restDelta:g=.5,restSpeed:v}){const x=t[0],b={done:!1,value:x},k=U=>p!==void 0&&U<p||h!==void 0&&U>h,S=U=>p===void 0?h:h===void 0||Math.abs(p-U)<Math.abs(h-U)?p:h;let w=i*s;const N=x+w,T=u===void 0?N:u(N);T!==N&&(w=T-x);const C=U=>-w*Math.exp(-U/r),E=U=>T+C(U),D=U=>{const K=C(U),ne=E(U);b.done=Math.abs(K)<=g,b.value=b.done?T:ne};let A,B;const R=U=>{k(b.value)&&(A=U,B=D_({keyframes:[b.value,S(b.value)],velocity:A_(E,U,b.value),damping:c,stiffness:d,restDelta:g,restSpeed:v}))};return R(0),{calculatedDuration:null,next:U=>{let K=!1;return!B&&A===void 0&&(K=!0,D(U),R(U)),A!==void 0&&U>=A?B.next(U-A):(!K&&D(U),b)}}}const vR=nl(.42,0,1,1),yR=nl(0,0,.58,1),R_=nl(.42,0,.58,1),bR=t=>Array.isArray(t)&&typeof t[0]!="number",xR={linear:An,easeIn:vR,easeInOut:R_,easeOut:yR,circIn:Mm,circInOut:u_,circOut:d_,backIn:Rm,backInOut:l_,backOut:r_,anticipate:c_},My=t=>{if(Dm(t)){Rx(t.length===4);const[s,i,r,c]=t;return nl(s,i,r,c)}else if(typeof t=="string")return xR[t];return t};function _R(t,s,i){const r=[],c=i||E_,d=t.length-1;for(let u=0;u<d;u++){let p=c(t[u],t[u+1]);if(s){const h=Array.isArray(s)?s[u]||An:s;p=sl(h,p)}r.push(p)}return r}function kR(t,s,{clamp:i=!0,ease:r,mixer:c}={}){const d=t.length;if(Rx(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=_R(s,r,c),h=p.length,g=v=>{if(u&&v<t[0])return s[0];let x=0;if(h>1)for(;x<t.length-2&&!(v<t[x+1]);x++);const b=No(t[x],t[x+1],v);return p[x](b)};return i?v=>g(Xs(t[0],t[d-1],v)):g}function SR(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 TR(t){const s=[0];return SR(s,t.length-1),s}function jR(t,s){return t.map(i=>i*s)}function wR(t,s){return t.map(()=>s||R_).splice(0,t.length-1)}function Jc({duration:t=300,keyframes:s,times:i,ease:r="easeInOut"}){const c=bR(r)?r.map(My):My(r),d={done:!1,value:s[0]},u=jR(i&&i.length===s.length?i:TR(s),t),p=kR(u,s,{ease:Array.isArray(c)?c:wR(s,c)});return{calculatedDuration:t,next:h=>(d.value=p(h),d.done=h>=t,d)}}const NR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>xt.update(s,!0),stop:()=>Oa(s),now:()=>Qt.isProcessing?Qt.timestamp:xs.now()}},CR={decay:Ry,inertia:Ry,tween:Jc,keyframes:Jc,spring:D_},ER=t=>t/100;class Um extends w_{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:h}=this.options;h&&h()};const{name:i,motionValue:r,element:c,keyframes:d}=this.options,u=(c==null?void 0:c.KeyframeResolver)||Bm,p=(h,g)=>this.onKeyframesResolved(h,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=Am(i)?i:CR[i]||Jc;let h,g;p!==Jc&&typeof s[0]!="number"&&(h=sl(ER,E_(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=N_(v));const{calculatedDuration:x}=v,b=x+c,k=b*(r+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:x,resolvedDuration:b,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:h,calculatedDuration:g,totalDuration:v,resolvedDuration:x}=r;if(this.startTime===null)return d.next(0);const{delay:b,repeat:k,repeatType:S,repeatDelay:w,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-b*(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)/x;let K=Math.floor(U),ne=U%1;!ne&&U>=1&&(ne=1),ne===1&&K--,K=Math.min(K,k+1),!!(K%2)&&(S==="reverse"?(ne=1-ne,w&&(ne-=w/x)):S==="mirror"&&(D=u)),E=Xs(0,1,ne)*x}const A=C?{done:!1,value:h[0]}:D.next(E);p&&(A.value=p(A.value));let{done:B}=A;!C&&g!==null&&(B=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&B);return R&&c!==void 0&&(A.value=yd(h,this.options,c)),N&&N(A.value),R&&this.finish(),A}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=NR,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 AR=new Set(["opacity","clipPath","filter","transform"]);function DR(t,s,i,{delay:r=0,duration:c=300,repeat:d=0,repeatType:u="loop",ease:p="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=s_(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 RR=Em(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Wc=10,MR=2e4;function IR(t){return Am(t.type)||t.type==="spring"||!n_(t.ease)}function OR(t,s){const i=new Um({...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<MR;)r=i.sample(d),c.push(r.value),d+=Wc;return{times:void 0,keyframes:c,duration:d-Wc,ease:"linear"}}const M_={anticipate:c_,backInOut:l_,circInOut:u_};function LR(t){return t in M_}class Iy extends w_{constructor(s){super(s);const{name:i,motionValue:r,element:c,keyframes:d}=this.options;this.resolver=new j_(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:h,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof d=="string"&&Kc()&&LR(d)&&(d=M_[d]),IR(this.options)){const{onComplete:x,onUpdate:b,motionValue:k,element:S,...w}=this.options,N=OR(s,w);s=N.keyframes,s.length===1&&(s[1]=s[0]),r=N.duration,c=N.times,d=N.ease,u="keyframes"}const v=DR(p.owner.current,h,s,{...this.options,duration:r,times:c,ease:d});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(ky(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:x}=this.options;p.set(yd(s,this.options,i)),x&&x(),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;ky(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:x,element:b,...k}=this.options,S=new Um({...k,keyframes:r,duration:c,type:d,ease:u,times:p,isGenerator:!0}),w=Ks(this.time);g.setWithVelocity(S.sample(w-Wc).value,S.sample(w).value,Wc)}const{onStop:h}=this.options;h&&h(),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:h,transformTemplate:g}=i.owner.getProps();return RR()&&r&&AR.has(r)&&!h&&!g&&!c&&d!=="mirror"&&u!==0&&p!=="inertia"}}const BR={type:"spring",stiffness:500,damping:25,restSpeed:10},zR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),UR={type:"keyframes",duration:.8},$R={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},PR=(t,{keyframes:s})=>s.length>2?UR:Ti.has(t)?t.startsWith("scale")?zR(s[1]):BR:$R;function VR({when:t,delay:s,delayChildren:i,staggerChildren:r,staggerDirection:c,repeat:d,repeatType:u,repeatDelay:p,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const $m=(t,s,i,r={},c,d)=>u=>{const p=jm(r,t)||{},h=p.delay||r.delay||0;let{elapsed:g=0}=r;g=g-Ks(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:b=>{s.set(b),p.onUpdate&&p.onUpdate(b)},onComplete:()=>{u(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:d?void 0:c};VR(p)||(v={...v,...PR(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 x=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(x=!0)),x&&!d&&s.get()!==void 0){const b=yd(v.keyframes,p);if(b!==void 0)return xt.update(()=>{v.onUpdate(b),v.onComplete()}),new xD([])}return!d&&Iy.supports(v)?new Iy(v):new Um(v)};function HR({protectedKeys:t,needsAnimating:s},i){const r=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,r}function I_(t,s,{delay:i=0,transitionOverride:r,type:c}={}){var d;let{transition:u=t.getDefaultTransition(),transitionEnd:p,...h}=s;r&&(u=r);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const x in h){const b=t.getValue(x,(d=t.latestValues[x])!==null&&d!==void 0?d:null),k=h[x];if(k===void 0||v&&HR(v,x))continue;const S={delay:i,...jm(u||{},x)};let w=!1;if(window.MotionHandoffAnimation){const T=e_(t);if(T){const C=window.MotionHandoffAnimation(T,x,xt);C!==null&&(S.startTime=C,w=!0)}}Ep(t,x),b.start($m(x,b,k,t.shouldReduceMotion&&Xx.has(x)?{type:!1}:S,t,w));const N=b.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{xt.update(()=>{p&&gD(t,p)})}),g}function zp(t,s,i={}){var r;const c=vd(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(I_(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:x,staggerDirection:b}=d;return qR(t,s,v+g,x,b,i)}:()=>Promise.resolve(),{when:h}=d;if(h){const[g,v]=h==="beforeChildren"?[u,p]:[p,u];return g().then(()=>v())}else return Promise.all([u(),p(i.delay)])}function qR(t,s,i=0,r=0,c=1,d){const u=[],p=(t.variantChildren.size-1)*r,h=c===1?(g=0)=>g*r:(g=0)=>p-g*r;return Array.from(t.variantChildren).sort(GR).forEach((g,v)=>{g.notify("AnimationStart",s),u.push(zp(g,s,{...d,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(u)}function GR(t,s){return t.sortNodePosition(s)}function FR(t,s,i={}){t.notify("AnimationStart",s);let r;if(Array.isArray(s)){const c=s.map(d=>zp(t,d,i));r=Promise.all(c)}else if(typeof s=="string")r=zp(t,s,i);else{const c=typeof s=="function"?vd(t,s,i.custom):s;r=Promise.all(I_(t,c,i))}return r.then(()=>{t.notify("AnimationComplete",s)})}const ZR=pm.length;function O_(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?O_(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<ZR;i++){const r=pm[i],c=t.props[r];(Gr(c)||c===!1)&&(s[r]=c)}return s}const KR=[...fm].reverse(),YR=fm.length;function JR(t){return s=>Promise.all(s.map(({animation:i,options:r})=>FR(t,i,r)))}function WR(t){let s=JR(t),i=Oy(),r=!0;const c=h=>(g,v)=>{var x;const b=vd(t,v,h==="exit"?(x=t.presenceContext)===null||x===void 0?void 0:x.custom:void 0);if(b){const{transition:k,transitionEnd:S,...w}=b;g={...g,...w,...S}}return g};function d(h){s=h(t)}function u(h){const{props:g}=t,v=O_(t.parent)||{},x=[],b=new Set;let k={},S=1/0;for(let N=0;N<YR;N++){const T=KR[N],C=i[T],E=g[T]!==void 0?g[T]:v[T],D=Gr(E),A=T===h?C.isActive:null;A===!1&&(S=N);let B=E===v[T]&&E!==g[T]&&D;if(B&&r&&t.manuallyAnimateOnMount&&(B=!1),C.protectedKeys={...k},!C.isActive&&A===null||!E&&!C.prevProp||hd(E)||typeof E=="boolean")continue;const R=XR(C.prevProp,E);let U=R||T===h&&C.isActive&&!B&&D||N>S&&D,K=!1;const ne=Array.isArray(E)?E:[E];let F=ne.reduce(c(T),{});A===!1&&(F={});const{prevResolvedValues:ee={}}=C,ae={...ee,...F},X=G=>{U=!0,b.has(G)&&(K=!0,b.delete(G)),C.needsAnimating[G]=!0;const se=t.getValue(G);se&&(se.liveStyle=!1)};for(const G in ae){const se=F[G],ue=ee[G];if(k.hasOwnProperty(G))continue;let de=!1;Cp(se)&&Cp(ue)?de=!Wx(se,ue):de=se!==ue,de?se!=null?X(G):b.add(G):se!==void 0&&b.has(G)?X(G):C.protectedKeys[G]=!0}C.prevProp=E,C.prevResolvedValues=F,C.isActive&&(k={...k,...F}),r&&t.blockInitialAnimation&&(U=!1),U&&(!(B&&R)||K)&&x.push(...ne.map(G=>({animation:G,options:{type:T}})))}if(b.size){const N={};b.forEach(T=>{const C=t.getBaseTarget(T),E=t.getValue(T);E&&(E.liveStyle=!0),N[T]=C??null}),x.push({animation:N})}let w=!!x.length;return r&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(w=!1),r=!1,w?s(x):Promise.resolve()}function p(h,g){var v;if(i[h].isActive===g)return Promise.resolve();(v=t.variantChildren)===null||v===void 0||v.forEach(b=>{var k;return(k=b.animationState)===null||k===void 0?void 0:k.setActive(h,g)}),i[h].isActive=g;const x=u(h);for(const b in i)i[b].protectedKeys={};return x}return{animateChanges:u,setActive:p,setAnimateFunction:d,getState:()=>i,reset:()=>{i=Oy(),r=!0}}}function XR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!Wx(s,t):!1}function li(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Oy(){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 QR extends Ua{constructor(s){super(s),s.animationState||(s.animationState=WR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();hd(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 e3=0;class t3 extends Ua{constructor(){super(...arguments),this.id=e3++}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 n3={animation:{Feature:QR},exit:{Feature:t3}},os={x:!1,y:!1};function L_(){return os.x||os.y}function s3(t){return t==="x"||t==="y"?os[t]?null:(os[t]=!0,()=>{os[t]=!1}):os.x||os.y?null:(os.x=os.y=!0,()=>{os.x=os.y=!1})}const Pm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Yr(t,s,i,r={passive:!0}){return t.addEventListener(s,i,r),()=>t.removeEventListener(s,i)}function al(t){return{point:{x:t.pageX,y:t.pageY}}}const a3=t=>s=>Pm(s)&&t(s,al(s));function Br(t,s,i,r){return Yr(t,s,a3(i),r)}const Ly=(t,s)=>Math.abs(t-s);function i3(t,s){const i=Ly(t.x,s.x),r=Ly(t.y,s.y);return Math.sqrt(i**2+r**2)}class B_{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 x=sp(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,k=i3(x.offset,{x:0,y:0})>=3;if(!b&&!k)return;const{point:S}=x,{timestamp:w}=Qt;this.history.push({...S,timestamp:w});const{onStart:N,onMove:T}=this.handlers;b||(N&&N(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,x)},this.handlePointerMove=(x,b)=>{this.lastMoveEvent=x,this.lastMoveEventInfo=np(b,this.transformPagePoint),xt.update(this.updatePoint,!0)},this.handlePointerUp=(x,b)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=sp(x.type==="pointercancel"?this.lastMoveEventInfo:np(b,this.transformPagePoint),this.history);this.startEvent&&k&&k(x,N),S&&S(x,N)},!Pm(s))return;this.dragSnapToOrigin=d,this.handlers=i,this.transformPagePoint=r,this.contextWindow=c||window;const u=al(s),p=np(u,this.transformPagePoint),{point:h}=p,{timestamp:g}=Qt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,sp(p,this.history)),this.removeListeners=sl(Br(this.contextWindow,"pointermove",this.handlePointerMove),Br(this.contextWindow,"pointerup",this.handlePointerUp),Br(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Oa(this.updatePoint)}}function np(t,s){return s?{point:s(t.point)}:t}function By(t,s){return{x:t.x-s.x,y:t.y-s.y}}function sp({point:t},s){return{point:t,delta:By(t,z_(s)),offset:By(t,o3(s)),velocity:r3(s,.1)}}function o3(t){return t[0]}function z_(t){return t[t.length-1]}function r3(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,r=null;const c=z_(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 U_=1e-4,l3=1-U_,c3=1+U_,$_=.01,d3=0-$_,u3=0+$_;function Dn(t){return t.max-t.min}function f3(t,s,i){return Math.abs(t-s)<=i}function zy(t,s,i,r=.5){t.origin=r,t.originPoint=Tt(s.min,s.max,t.origin),t.scale=Dn(i)/Dn(s),t.translate=Tt(i.min,i.max,t.origin)-t.originPoint,(t.scale>=l3&&t.scale<=c3||isNaN(t.scale))&&(t.scale=1),(t.translate>=d3&&t.translate<=u3||isNaN(t.translate))&&(t.translate=0)}function zr(t,s,i,r){zy(t.x,s.x,i.x,r?r.originX:void 0),zy(t.y,s.y,i.y,r?r.originY:void 0)}function Uy(t,s,i){t.min=i.min+s.min,t.max=t.min+Dn(s)}function p3(t,s,i){Uy(t.x,s.x,i.x),Uy(t.y,s.y,i.y)}function $y(t,s,i){t.min=s.min-i.min,t.max=t.min+Dn(s)}function Ur(t,s,i){$y(t.x,s.x,i.x),$y(t.y,s.y,i.y)}function m3(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 Py(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 h3(t,{top:s,left:i,bottom:r,right:c}){return{x:Py(t.x,i,c),y:Py(t.y,s,r)}}function Vy(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 g3(t,s){return{x:Vy(t.x,s.x),y:Vy(t.y,s.y)}}function v3(t,s){let i=.5;const r=Dn(t),c=Dn(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 y3(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 Up=.35;function b3(t=Up){return t===!1?t=0:t===!0&&(t=Up),{x:Hy(t,"left","right"),y:Hy(t,"top","bottom")}}function Hy(t,s,i){return{min:qy(t,s),max:qy(t,i)}}function qy(t,s){return typeof t=="number"?t:t[s]||0}const Gy=()=>({translate:0,scale:1,origin:0,originPoint:0}),bo=()=>({x:Gy(),y:Gy()}),Fy=()=>({min:0,max:0}),Mt=()=>({x:Fy(),y:Fy()});function Zn(t){return[t("x"),t("y")]}function P_({top:t,left:s,right:i,bottom:r}){return{x:{min:s,max:i},y:{min:t,max:r}}}function x3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function _3(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 ap(t){return t===void 0||t===1}function $p({scale:t,scaleX:s,scaleY:i}){return!ap(t)||!ap(s)||!ap(i)}function pi(t){return $p(t)||V_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function V_(t){return Zy(t.x)||Zy(t.y)}function Zy(t){return t&&t!=="0%"}function Xc(t,s,i){const r=t-i,c=s*r;return i+c}function Ky(t,s,i,r,c){return c!==void 0&&(t=Xc(t,c,r)),Xc(t,i,r)+s}function Pp(t,s=0,i=1,r,c){t.min=Ky(t.min,s,i,r,c),t.max=Ky(t.max,s,i,r,c)}function H_(t,{x:s,y:i}){Pp(t.x,s.translate,s.scale,s.originPoint),Pp(t.y,i.translate,i.scale,i.originPoint)}const Yy=.999999999999,Jy=1.0000000000001;function k3(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:h}=d.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&d.options.layoutScroll&&d.scroll&&d!==d.root&&_o(t,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),u&&(s.x*=u.x.scale,s.y*=u.y.scale,H_(t,u)),r&&pi(d.latestValues)&&_o(t,d.latestValues))}s.x<Jy&&s.x>Yy&&(s.x=1),s.y<Jy&&s.y>Yy&&(s.y=1)}function xo(t,s){t.min=t.min+s,t.max=t.max+s}function Wy(t,s,i,r,c=.5){const d=Tt(t.min,t.max,c);Pp(t,s,i,d,r)}function _o(t,s){Wy(t.x,s.x,s.scaleX,s.scale,s.originX),Wy(t.y,s.y,s.scaleY,s.scale,s.originY)}function q_(t,s){return P_(_3(t.getBoundingClientRect(),s))}function S3(t,s,i){const r=q_(t,i),{scroll:c}=s;return c&&(xo(r.x,c.offset.x),xo(r.y,c.offset.y)),r}const G_=({current:t})=>t?t.ownerDocument.defaultView:null,T3=new WeakMap;class j3{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:x}=this.getProps();x?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(al(v).point)},d=(v,x)=>{const{drag:b,dragPropagation:k,onDragStart:S}=this.getProps();if(b&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=s3(b),!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),Zn(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=Dn(E)*(parseFloat(T)/100))}}this.originPoint[N]=T}),S&&xt.postRender(()=>S(v,x)),Ep(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},u=(v,x)=>{const{dragPropagation:b,dragDirectionLock:k,onDirectionLock:S,onDrag:w}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:N}=x;if(k&&this.currentDirection===null){this.currentDirection=w3(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",x.point,N),this.updateAxis("y",x.point,N),this.visualElement.render(),w&&w(v,x)},p=(v,x)=>this.stop(v,x),h=()=>Zn(v=>{var x;return this.getAnimationState(v)==="paused"&&((x=this.getAxisMotionValue(v).animation)===null||x===void 0?void 0:x.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new B_(s,{onSessionStart:c,onStart:d,onMove:u,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:G_(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&&xt.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||!Cc(s,c,this.currentDirection))return;const d=this.getAxisMotionValue(s);let u=this.originPoint[s]+r[s];this.constraints&&this.constraints[s]&&(u=m3(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=h3(c.layoutBox,i):this.constraints=!1,this.elastic=b3(r),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&Zn(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=y3(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=S3(r,c.root,this.visualElement.getTransformPagePoint());let u=g3(c.layout.layoutBox,d);if(i){const p=i(x3(u));this.hasMutatedConstraints=!!p,p&&(u=P_(p))}return u}startAnimation(s){const{drag:i,dragMomentum:r,dragElastic:c,dragTransition:d,dragSnapToOrigin:u,onDragTransitionEnd:p}=this.getProps(),h=this.constraints||{},g=Zn(v=>{if(!Cc(v,i,this.currentDirection))return;let x=h&&h[v]||{};u&&(x={min:0,max:0});const b=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:r?s[v]:0,bounceStiffness:b,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...d,...x};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const r=this.getAxisMotionValue(s);return Ep(this.visualElement,s),r.start($m(s,r,0,i,this.visualElement,!1))}stopAnimation(){Zn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){Zn(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){Zn(i=>{const{drag:r}=this.getProps();if(!Cc(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};Zn(u=>{const p=this.getAxisMotionValue(u);if(p&&this.constraints!==!1){const h=p.get();c[u]=v3({min:h,max:h},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(),Zn(u=>{if(!Cc(u,s,null))return;const p=this.getAxisMotionValue(u),{min:h,max:g}=this.constraints[u];p.set(Tt(h,g,c[u]))})}addListeners(){if(!this.visualElement.current)return;T3.set(this.visualElement,this);const s=this.visualElement.current,i=Br(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();vo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,d=c.addEventListener("measure",r);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),xt.read(r);const u=Yr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Zn(v=>{const x=this.getAxisMotionValue(v);x&&(this.originPoint[v]+=h[v].translate,x.set(x.get()+h[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=Up,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:r,dragPropagation:c,dragConstraints:d,dragElastic:u,dragMomentum:p}}}function Cc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function w3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class N3 extends Ua{constructor(s){super(s),this.removeGroupControls=An,this.removeListeners=An,this.controls=new j3(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 Xy=t=>(s,i)=>{t&&xt.postRender(()=>t(s,i))};class C3 extends Ua{constructor(){super(...arguments),this.removePointerDownListener=An}onPointerDown(s){this.session=new B_(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:G_(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:r,onPanEnd:c}=this.node.getProps();return{onSessionStart:Xy(s),onStart:Xy(i),onMove:r,onEnd:(d,u)=>{delete this.session,c&&xt.postRender(()=>c(d,u))}}}mount(){this.removePointerDownListener=Br(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 Pc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Qy(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const wr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(Ce.test(t))t=parseFloat(t);else return t;const i=Qy(t,s.target.x),r=Qy(t,s.target.y);return`${i}% ${r}%`}},E3={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,h=i.y.scale*s.y;c[0+u]/=p,c[1+u]/=h;const g=Tt(p,h,.5);return typeof c[2+u]=="number"&&(c[2+u]/=g),typeof c[3+u]=="number"&&(c[3+u]/=g),d(c)}};class A3 extends y.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:r,layoutId:c}=this.props,{projection:d}=s;nD(D3),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()})),Pc.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()||xt.postRender(()=>{const p=u.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),hm.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 F_(t){const[s,i]=Ax(),r=y.useContext(lm);return o.jsx(A3,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(zx),isPresent:s,safeToRemove:i})}const D3={borderRadius:{...wr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:wr,borderTopRightRadius:wr,borderBottomLeftRadius:wr,borderBottomRightRadius:wr,boxShadow:E3};function R3(t,s,i){const r=an(t)?t:Zr(t);return r.start($m("",r,s,i)),r.animation}function M3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const I3=(t,s)=>t.depth-s.depth;class O3{constructor(){this.children=[],this.isDirty=!1}add(s){wm(this.children,s),this.isDirty=!0}remove(s){Nm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(I3),this.isDirty=!1,this.children.forEach(s)}}function L3(t,s){const i=xs.now(),r=({timestamp:c})=>{const d=c-i;d>=s&&(Oa(r),t(d-s))};return xt.read(r,!0),()=>Oa(r)}const Z_=["TopLeft","TopRight","BottomLeft","BottomRight"],B3=Z_.length,eb=t=>typeof t=="string"?parseFloat(t):t,tb=t=>typeof t=="number"||Ce.test(t);function z3(t,s,i,r,c,d){c?(t.opacity=Tt(0,i.opacity!==void 0?i.opacity:1,U3(r)),t.opacityExit=Tt(s.opacity!==void 0?s.opacity:1,0,$3(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<B3;u++){const p=`border${Z_[u]}Radius`;let h=nb(s,p),g=nb(i,p);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||tb(h)===tb(g)?(t[p]=Math.max(Tt(eb(h),eb(g),r),0),(bs.test(g)||bs.test(h))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=Tt(s.rotate||0,i.rotate||0,r))}function nb(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const U3=K_(0,.5,d_),$3=K_(.5,.95,An);function K_(t,s,i){return r=>r<t?0:r>s?1:i(No(t,s,r))}function sb(t,s){t.min=s.min,t.max=s.max}function qn(t,s){sb(t.x,s.x),sb(t.y,s.y)}function ab(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function ib(t,s,i,r,c){return t-=s,t=Xc(t,1/i,r),c!==void 0&&(t=Xc(t,1/c,r)),t}function P3(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=ib(t.min,s,i,p,c),t.max=ib(t.max,s,i,p,c)}function ob(t,s,[i,r,c],d,u){P3(t,s[i],s[r],s[c],s.scale,d,u)}const V3=["x","scaleX","originX"],H3=["y","scaleY","originY"];function rb(t,s,i,r){ob(t.x,s,V3,i?i.x:void 0,r?r.x:void 0),ob(t.y,s,H3,i?i.y:void 0,r?r.y:void 0)}function lb(t){return t.translate===0&&t.scale===1}function Y_(t){return lb(t.x)&&lb(t.y)}function cb(t,s){return t.min===s.min&&t.max===s.max}function q3(t,s){return cb(t.x,s.x)&&cb(t.y,s.y)}function db(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function J_(t,s){return db(t.x,s.x)&&db(t.y,s.y)}function ub(t){return Dn(t.x)/Dn(t.y)}function fb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class G3{constructor(){this.members=[]}add(s){wm(this.members,s),s.scheduleRender()}remove(s){if(Nm(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 F3(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:x,rotateY:b,skewX:k,skewY:S}=i;g&&(r=`perspective(${g}px) ${r}`),v&&(r+=`rotate(${v}deg) `),x&&(r+=`rotateX(${x}deg) `),b&&(r+=`rotateY(${b}deg) `),k&&(r+=`skewX(${k}deg) `),S&&(r+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,h=t.y.scale*s.y;return(p!==1||h!==1)&&(r+=`scale(${p}, ${h})`),r||"none"}const mi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Rr=typeof window<"u"&&window.MotionDebug!==void 0,ip=["","X","Y","Z"],Z3={visibility:"hidden"},pb=1e3;let K3=0;function op(t,s,i,r){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),r&&(r[t]=0))}function W_(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=e_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:d}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",xt,!(c||d))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&W_(r)}function X_({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:r,resetTransform:c}){return class{constructor(u={},p=s==null?void 0:s()){this.id=K3++,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,Rr&&(mi.totalNodes=mi.resolvedTargetDeltas=mi.recalculatedProjection=0),this.nodes.forEach(W3),this.nodes.forEach(nM),this.nodes.forEach(sM),this.nodes.forEach(X3),Rr&&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 h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new O3)}addEventListener(u,p){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Cm),this.eventHandlers.get(u).add(p)}notifyListeners(u,...p){const h=this.eventHandlers.get(u);h&&h.notify(...p)}hasListeners(u){return this.eventHandlers.has(u)}mount(u,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=M3(u),this.instance=u;const{layoutId:h,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||h)&&(this.isLayoutDirty=!0),t){let x;const b=()=>this.root.updateBlockedByResize=!1;t(u,()=>{this.root.updateBlockedByResize=!0,x&&x(),x=L3(b,250),Pc.hasAnimatedSinceResize&&(Pc.hasAnimatedSinceResize=!1,this.nodes.forEach(hb))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:x,hasLayoutChanged:b,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||v.getDefaultTransition()||lM,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!J_(this.targetLayout,S)||k,E=!b&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||b&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(x,E);const D={...jm(w,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(D.delay=0,D.type=!1),this.startAnimation(D)}else b||hb(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(aM),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&&W_(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const x=this.path[v];x.shouldResetTransform=!0,x.updateScroll("snapshot"),x.options.layoutRoot&&x.willUpdate(!1)}const{layoutId:p,layout:h}=this.options;if(p===void 0&&!h)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(mb);return}this.isUpdating||this.nodes.forEach(eM),this.isUpdating=!1,this.nodes.forEach(tM),this.nodes.forEach(Y3),this.nodes.forEach(J3),this.clearAllSnapshots();const p=xs.now();Qt.delta=Xs(0,1e3/60,p-Qt.timestamp),Qt.timestamp=p,Qt.isProcessing=!0,Wf.update.process(Qt),Wf.preRender.process(Qt),Wf.render.process(Qt),Qt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,hm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Q3),this.sharedNodes.forEach(iM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,xt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){xt.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 h=0;h<this.path.length;h++)this.path[h].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 h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!c)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!Y_(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(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 h=this.removeElementScroll(p);return u&&(h=this.removeTransform(h)),cM(h),{animationId:this.root.animationId,measuredBox:p,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:p}=this.options;if(!p)return Mt();const h=p.measureViewportBox();if(!(((u=this.scroll)===null||u===void 0?void 0:u.wasRoot)||this.path.some(dM))){const{scroll:v}=this.root;v&&(xo(h.x,v.offset.x),xo(h.y,v.offset.y))}return h}removeElementScroll(u){var p;const h=Mt();if(qn(h,u),!((p=this.scroll)===null||p===void 0)&&p.wasRoot)return h;for(let g=0;g<this.path.length;g++){const v=this.path[g],{scroll:x,options:b}=v;v!==this.root&&x&&b.layoutScroll&&(x.wasRoot&&qn(h,u),xo(h.x,x.offset.x),xo(h.y,x.offset.y))}return h}applyTransform(u,p=!1){const h=Mt();qn(h,u);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&_o(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),pi(v.latestValues)&&_o(h,v.latestValues)}return pi(this.latestValues)&&_o(h,this.latestValues),h}removeTransform(u){const p=Mt();qn(p,u);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!pi(g.latestValues))continue;$p(g.latestValues)&&g.updateSnapshot();const v=Mt(),x=g.measurePageBox();qn(v,x),rb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return pi(this.latestValues)&&rb(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 h=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=h.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=h.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=h.isSharedProjectionDirty);const g=!!this.resumingFrom||this!==h;if(!(u||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:x,layoutId:b}=this.options;if(!(!this.layout||!(x||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(),Ur(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),qn(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(),p3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):qn(this.target,this.layout.layoutBox),H_(this.target,this.targetDelta)):qn(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(),Ur(this.relativeTargetOrigin,this.target,k.target),qn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Rr&&mi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||$p(this.parent.latestValues)||V_(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(),h=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((u=this.parent)===null||u===void 0)&&u.isProjectionDirty)&&(g=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Qt.timestamp&&(g=!1),g)return;const{layout:v,layoutId:x}=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||x))return;qn(this.layoutCorrected,this.layout.layoutBox);const b=this.treeScale.x,k=this.treeScale.y;k3(this.layoutCorrected,this.treeScale,this.path,h),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():(ab(this.prevProjectionDelta.x,this.projectionDelta.x),ab(this.prevProjectionDelta.y,this.projectionDelta.y)),zr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==k||!fb(this.projectionDelta.x,this.prevProjectionDelta.x)||!fb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Rr&&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 h=this.getStack();h&&h.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 h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},x=bo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const b=Mt(),k=h?h.source:void 0,S=this.layout?this.layout.source:void 0,w=k!==S,N=this.getStack(),T=!N||N.members.length<=1,C=!!(w&&!T&&this.options.crossfade===!0&&!this.path.some(rM));this.animationProgress=0;let E;this.mixTargetDelta=D=>{const A=D/1e3;gb(x.x,u.x,A),gb(x.y,u.y,A),this.setTargetDelta(x),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ur(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),oM(this.relativeTarget,this.relativeTargetOrigin,b,A),E&&q3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Mt()),qn(E,this.relativeTarget)),w&&(this.animationValues=v,z3(v,g,this.latestValues,A,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=A},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=xt.update(()=>{Pc.hasAnimatedSinceResize=!0,this.currentAnimation=R3(0,pb,{...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(pb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:p,target:h,layout:g,latestValues:v}=u;if(!(!p||!h||!g)){if(this!==u&&this.layout&&g&&Q_(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Mt();const x=Dn(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+x;const b=Dn(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+b}qn(p,h),_o(p,v),zr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(u,p){this.sharedNodes.has(u)||this.sharedNodes.set(u,new G3),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:h}={}){const g=this.getStack();g&&g.promote(this,h),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:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(p=!0),!p)return;const g={};h.z&&op("z",u,g,this.animationValues);for(let v=0;v<ip.length;v++)op(`rotate${ip[v]}`,u,g,this.animationValues),op(`skew${ip[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,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Z3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Uc(u==null?void 0:u.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const x=this.getLead();if(!this.projectionDelta||!this.layout||!x.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=Uc(u==null?void 0:u.pointerEvents)||""),this.hasProjected&&!pi(this.latestValues)&&(w.transform=v?v({},""):"none",this.hasProjected=!1),w}const b=x.animationValues||x.latestValues;this.applyTransformsToTarget(),g.transform=F3(this.projectionDeltaWithTransform,this.treeScale,b),v&&(g.transform=v(b,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,x.animationValues?g.opacity=x===this?(h=(p=b.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:b.opacityExit:g.opacity=x===this?b.opacity!==void 0?b.opacity:"":b.opacityExit!==void 0?b.opacityExit:0;for(const w in Zc){if(b[w]===void 0)continue;const{correct:N,applyTo:T}=Zc[w],C=g.transform==="none"?b[w]:N(b[w],x);if(T){const E=T.length;for(let D=0;D<E;D++)g[T[D]]=C}else g[w]=C}return this.options.layoutId&&(g.pointerEvents=x===this?Uc(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(mb),this.root.sharedNodes.clear()}}}function Y3(t){t.updateLayout()}function J3(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"?Zn(x=>{const b=u?i.measuredBox[x]:i.layoutBox[x],k=Dn(b);b.min=r[x].min,b.max=b.min+k}):Q_(d,i.layoutBox,r)&&Zn(x=>{const b=u?i.measuredBox[x]:i.layoutBox[x],k=Dn(r[x]);b.max=b.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[x].max=t.relativeTarget[x].min+k)});const p=bo();zr(p,r,i.layoutBox);const h=bo();u?zr(h,t.applyTransform(c,!0),i.measuredBox):zr(h,r,i.layoutBox);const g=!Y_(p);let v=!1;if(!t.resumeFrom){const x=t.getClosestProjectingParent();if(x&&!x.resumeFrom){const{snapshot:b,layout:k}=x;if(b&&k){const S=Mt();Ur(S,i.layoutBox,b.layoutBox);const w=Mt();Ur(w,r,k.layoutBox),J_(S,w)||(v=!0),x.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=S,t.relativeParent=x)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:i,delta:h,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function W3(t){Rr&&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 X3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Q3(t){t.clearSnapshot()}function mb(t){t.clearMeasurements()}function eM(t){t.isLayoutDirty=!1}function tM(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function hb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function nM(t){t.resolveTargetDelta()}function sM(t){t.calcProjection()}function aM(t){t.resetSkewAndRotation()}function iM(t){t.removeLeadSnapshot()}function gb(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 vb(t,s,i,r){t.min=Tt(s.min,i.min,r),t.max=Tt(s.max,i.max,r)}function oM(t,s,i,r){vb(t.x,s.x,i.x,r),vb(t.y,s.y,i.y,r)}function rM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const lM={duration:.45,ease:[.4,0,.1,1]},yb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),bb=yb("applewebkit/")&&!yb("chrome/")?Math.round:An;function xb(t){t.min=bb(t.min),t.max=bb(t.max)}function cM(t){xb(t.x),xb(t.y)}function Q_(t,s,i){return t==="position"||t==="preserve-aspect"&&!f3(ub(s),ub(i),.2)}function dM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const uM=X_({attachResizeListener:(t,s)=>Yr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rp={current:void 0},e1=X_({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!rp.current){const t=new uM({});t.mount(window),t.setOptions({layoutScroll:!0}),rp.current=t}return rp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),fM={pan:{Feature:C3},drag:{Feature:N3,ProjectionNode:e1,MeasureLayout:F_}};function pM(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 t1(t,s){const i=pM(t),r=new AbortController,c={passive:!0,...s,signal:r.signal};return[i,c,()=>r.abort()]}function _b(t){return s=>{s.pointerType==="touch"||L_()||t(s)}}function mM(t,s,i={}){const[r,c,d]=t1(t,i),u=_b(p=>{const{target:h}=p,g=s(p);if(typeof g!="function"||!h)return;const v=_b(x=>{g(x),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return r.forEach(p=>{p.addEventListener("pointerenter",u,c)}),d}function kb(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&&xt.postRender(()=>d(s,al(s)))}class hM extends Ua{mount(){const{current:s}=this.node;s&&(this.unmount=mM(s,i=>(kb(this.node,i,"Start"),r=>kb(this.node,r,"End"))))}unmount(){}}class gM 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=sl(Yr(this.node.current,"focus",()=>this.onFocus()),Yr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const n1=(t,s)=>s?t===s?!0:n1(t,s.parentElement):!1,vM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function yM(t){return vM.has(t.tagName)||t.tabIndex!==-1}const Mr=new WeakSet;function Sb(t){return s=>{s.key==="Enter"&&t(s)}}function lp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const bM=(t,s)=>{const i=t.currentTarget;if(!i)return;const r=Sb(()=>{if(Mr.has(i))return;lp(i,"down");const c=Sb(()=>{lp(i,"up")}),d=()=>lp(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 Tb(t){return Pm(t)&&!L_()}function xM(t,s,i={}){const[r,c,d]=t1(t,i),u=p=>{const h=p.currentTarget;if(!Tb(p)||Mr.has(h))return;Mr.add(h);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",b),!(!Tb(k)||!Mr.has(h))&&(Mr.delete(h),typeof g=="function"&&g(k,{success:S}))},x=k=>{v(k,i.useGlobalTarget||n1(h,k.target))},b=k=>{v(k,!1)};window.addEventListener("pointerup",x,c),window.addEventListener("pointercancel",b,c)};return r.forEach(p=>{!yM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",u,c),p.addEventListener("focus",g=>bM(g,c),c)}),d}function jb(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&&xt.postRender(()=>d(s,al(s)))}class _M extends Ua{mount(){const{current:s}=this.node;s&&(this.unmount=xM(s,i=>(jb(this.node,i,"Start"),(r,{success:c})=>jb(this.node,r,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Vp=new WeakMap,cp=new WeakMap,kM=t=>{const s=Vp.get(t.target);s&&s(t)},SM=t=>{t.forEach(kM)};function TM({root:t,...s}){const i=t||document;cp.has(i)||cp.set(i,{});const r=cp.get(i),c=JSON.stringify(s);return r[c]||(r[c]=new IntersectionObserver(SM,{root:t,...s})),r[c]}function jM(t,s,i){const r=TM(s);return Vp.set(t,i),r.observe(t),()=>{Vp.delete(t),r.unobserve(t)}}const wM={some:0,all:1};class NM 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:wM[c]},p=h=>{const{isIntersecting:g}=h;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:x}=this.node.getProps(),b=g?v:x;b&&b(h)};return jM(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(CM(s,i))&&this.startObserver()}unmount(){}}function CM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const EM={inView:{Feature:NM},tap:{Feature:_M},focus:{Feature:gM},hover:{Feature:hM}},AM={layout:{ProjectionNode:e1,MeasureLayout:F_}},Qc={current:null},Vm={current:!1};function s1(){if(Vm.current=!0,!!um)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>Qc.current=t.matches;t.addListener(s),s()}else Qc.current=!1}const DM=[...T_,sn,La],RM=t=>DM.find(S_(t)),wb=new WeakMap;function MM(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,Zr(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,Zr(u!==void 0?u:c,{owner:t}))}}for(const r in i)s[r]===void 0&&t.removeValue(r);return s}const Nb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class IM{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=Bm,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=xs.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,xt.render(this.render,!1,!0))};const{latestValues:h,renderState:g,onUpdate:v}=u;this.onUpdate=v,this.latestValues=h,this.baseTarget={...h},this.initialValues=i.initial?{...h}:{},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=gd(i),this.isVariantNode=Lx(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:x,...b}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in b){const S=b[k];h[k]!==void 0&&an(S)&&S.set(h[k],!1)}}mount(s){this.current=s,wb.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)),Vm.current||s1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Qc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){wb.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&&xt.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 wo){const i=wo[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<Nb.length;r++){const c=Nb[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=MM(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=Zr(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"&&(__(c)||f_(c))?c=parseFloat(c):!RM(c)&&La.test(i)&&(c=y_(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=vm(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 Cm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class a1 extends IM{constructor(){super(...arguments),this.KeyframeResolver=j_}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 OM(t){return window.getComputedStyle(t)}class LM extends a1{constructor(){super(...arguments),this.type="html",this.renderInstance=Gx}readValueFromInstance(s,i){if(Ti.has(i)){const r=Lm(i);return r&&r.default||0}else{const r=OM(s),c=(Vx(i)?r.getPropertyValue(i):r[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return q_(s,i)}build(s,i,r){xm(s,i,r.transformTemplate)}scrapeMotionValuesFromProps(s,i,r){return Tm(s,i,r)}}class BM extends a1{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=Lm(i);return r&&r.default||0}return i=Fx.has(i)?i:mm(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,r){return Yx(s,i,r)}build(s,i,r){_m(s,i,this.isSVGTag,r.transformTemplate)}renderInstance(s,i,r,c){Zx(s,i,r,c)}mount(s){this.isSVGTag=Sm(s.tagName),super.mount(s)}}const zM=(t,s)=>gm(t)?new BM(s):new LM(s,{allowProjection:t!==y.Fragment}),UM=uD({...n3,...EM,...fM,...AM},zM),Et=wA(UM);function $M(){!Vm.current&&s1();const[t]=y.useState(Qc.current);return t}const PM="_overlay_cmicx_1",VM="_dialog_cmicx_11",HM="_title_cmicx_30",qM="_description_cmicx_38",GM="_actions_cmicx_45",FM="_cancelButton_cmicx_52",ZM="_confirmButton_cmicx_79",ci={overlay:PM,dialog:VM,title:HM,description:qM,actions:GM,cancelButton:FM,confirmButton:ZM};function xi({isOpen:t,title:s,description:i,confirmLabel:r="Delete",onConfirm:c,onCancel:d}){const u=y.useId(),p=y.useId();return o.jsx(ls,{children:t&&o.jsx(Et.div,{className:ci.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:d,onKeyDown:h=>{h.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:h=>h.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 KM="_skeleton_1gqp4_9",YM="_circular_1gqp4_17",JM="_textContainer_1gqp4_26",WM="_card_1gqp4_31",ed={skeleton:KM,circular:YM,textContainer:JM,card:WM};function _e({width:t="100%",height:s="1rem",borderRadius:i,variant:r="rectangular",className:c}){const d=[ed.skeleton,r==="circular"?ed.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 Hp({lines:t=3,lastLineWidth:s="60%",lineHeight:i="0.75rem",gap:r="var(--space-sm)",className:c}){return o.jsx("div",{className:`${ed.textContainer} ${c??""}`,style:{gap:r},"aria-hidden":"true","data-testid":"skeleton-text",children:Array.from({length:t},(d,u)=>o.jsx(_e,{width:u===t-1&&t>1?s:"100%",height:i},u))})}function td({lines:t=2,className:s}){return o.jsxs("div",{className:`${ed.card} ${s??""}`,"aria-hidden":"true","data-testid":"skeleton-card",children:[o.jsx(_e,{width:"40%",height:"1.25rem"}),o.jsx(Hp,{lines:t})]})}const XM="_spinner_1uyt1_1",QM="_spin_1uyt1_1",e6="_sm_1uyt1_14",t6="_md_1uyt1_20",n6="_lg_1uyt1_26",s6="_xl_1uyt1_32",Cb={spinner:XM,spin:QM,sm:e6,md:t6,lg:n6,xl:s6};function i1({size:t="md",className:s,label:i="Loading",liveRegion:r=!1}){return o.jsx("span",{className:`${Cb.spinner} ${Cb[t]} ${s??""}`,role:r?"status":void 0,"aria-label":i,"aria-hidden":r?void 0:!0})}const a6="_splash_1bn1g_1",i6="_logo_1bn1g_11",Eb={splash:a6,logo:i6};function o1(){return o.jsxs("div",{className:Eb.splash,"data-testid":"splash-screen",children:[o.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Eb.logo}),o.jsx(i1,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const o6="_row_ldkru_1",r6="_hoverActions_ldkru_5",l6="_hoverButton_ldkru_31",c6="_selectingRow_ldkru_72",d6="_selected_ldkru_83",u6="_checkboxArea_ldkru_90",f6="_checkbox_ldkru_90",p6="_contentArea_ldkru_106",ss={row:o6,hoverActions:r6,hoverButton:l6,selectingRow:c6,selected:d6,checkboxArea:u6,checkbox:f6,contentArea:p6};function m6({copyText:t,isContentBearing:s,isSelecting:i,isSelected:r,checkboxLabel:c,onSelect:d,onToggle:u,onCopied:p,children:h}){const[g,v]=y.useState(!1),x=y.useRef(void 0);y.useEffect(()=>()=>{x.current!==void 0&&clearTimeout(x.current)},[]);const b=y.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),x.current!==void 0&&clearTimeout(x.current),x.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:`${ss.row} ${ss.selectingRow} ${r?ss.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[o.jsx("div",{className:ss.checkboxArea,children:o.jsx("input",{type:"checkbox",checked:r,onChange:S=>{u(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:ss.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),o.jsx("div",{className:ss.contentArea,children:h})]}):o.jsxs("div",{className:ss.row,"data-testid":"event-hover-row",children:[o.jsxs("div",{className:ss.hoverActions,"data-testid":"event-hover-actions",children:[o.jsx("button",{type:"button",className:ss.hoverButton,onClick:()=>{b().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?o.jsx(_i,{size:at,"aria-hidden":"true"}):o.jsx(ax,{size:at,"aria-hidden":"true"})}),o.jsx("button",{type:"button",className:ss.hoverButton,onClick:d,"aria-label":"Select this event","data-testid":"event-hover-select",children:o.jsx($2,{size:at,"aria-hidden":"true"})})]}),h]}):o.jsx("div",{className:ss.row,children:h})}const h6="_bar_1vah7_1",g6="_left_1vah7_21",v6="_right_1vah7_27",y6="_count_1vah7_33",b6="_toggleButton_1vah7_40",x6="_copyButton_1vah7_68",_6="_cancelButton_1vah7_108",di={bar:h6,left:g6,right:v6,count:y6,toggleButton:b6,copyButton:x6,cancelButton:_6};function k6({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(a2,{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 r1=50;function S6(t,s,i,r,c=r1){return r?t<c:s-t-i<c}function T6(t,s){const i=s-t;return i>0?i:0}function j6({scrollRef:t,contentLength:s,isReversed:i,paused:r}){const[c,d]=y.useState(!0),u=y.useRef(0),p=y.useRef(!1),h=y.useRef(0);y.useEffect(()=>{const v=t.current;if(!v)return;let x=!0;const b=()=>{h.current||(h.current=requestAnimationFrame(()=>{h.current=0;const k=S6(v.scrollTop,v.scrollHeight,v.clientHeight,i,r1);k!==x&&(x=k,d(k))}))};return v.addEventListener("scroll",b,{passive:!0}),()=>{v.removeEventListener("scroll",b),h.current&&(cancelAnimationFrame(h.current),h.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 x=T6(u.current,v.scrollHeight);x>0&&(v.scrollTop+=x)}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 x=i?0:v.scrollHeight;v.scrollTo({top:x,behavior:"smooth"}),d(!0)},[t,i]);return{isAtAnchor:c,scrollToAnchor:g}}const w6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function Jr(t){return w6.has(t.eventType)}function N6(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 Ab(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 C6(t){var i;const s=[];for(const r of t){if(!Jr(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=Ab(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=Ab(u),h=p?`**Tool: ${d}** ${p}`:`**Tool: ${d}**`;u!==void 0?s.push(`${h} (${c}):
269
+ \`\`\`json
270
+ ${JSON.stringify(u,void 0,2)}
271
+ \`\`\``):s.push(`${h} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
272
+ ${r.content}`);break}}}return s.join(`
273
+
274
+ `)}function E6({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]),h=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,w)=>{if(w&&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&&Jr(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]),x=y.useCallback(()=>{const S=new Set;for(let w=0;w<t.length;w++)Jr(t[w])&&S.add(w);d(S)},[t]),b=y.useCallback(()=>{d(new Set)},[]),k=y.useCallback(async()=>{const w=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(w.length===0)return!1;const N=s(w);try{return await navigator.clipboard.writeText(N),!0}catch{return!1}},[c,t,s]);return{isSelecting:i,selectedIndices:c,selectedCount:p,enterSelectionMode:h,cancelSelection:g,toggleEvent:v,selectAll:x,deselectAll:b,copySelected:k}}const A6="_wrapper_1cdza_1",D6="_scrollContainer_1cdza_9",R6="_selectingPadding_1cdza_16",M6="_toolbar_1cdza_20",I6="_directionToggle_1cdza_27",O6="_scrollToAnchor_1cdza_65",L6="_scrollToAnchorBottom_1cdza_89",B6="_scrollToAnchorTop_1cdza_93",z6="_eventOverflowWarning_1cdza_97",Fs={wrapper:A6,scrollContainer:D6,selectingPadding:R6,toolbar:M6,directionToggle:I6,scrollToAnchor:O6,scrollToAnchorBottom:L6,scrollToAnchorTop:B6,eventOverflowWarning:z6};function U6(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 l1="grackle-stream-direction";function $6(){try{return localStorage.getItem(l1)==="reversed"}catch{return!1}}function P6({eventsDropped:t}){return t<=0?o.jsx(o.Fragment,{}):o.jsxs("div",{className:Fs.eventOverflowWarning,role:"alert",children:[o.jsx(Wp,{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 Hm({events:t,eventsDropped:s,emptyState:i,onShowToast:r}){const c=y.useRef(null),[d,u]=y.useState($6),p=$M(),h=E6({events:t,formatForClipboard:C6}),g=y.useMemo(()=>t.filter(Jr).length,[t]),v=y.useMemo(()=>d?[...t].reverse():t,[t,d]),{isAtAnchor:x,scrollToAnchor:b}=j6({scrollRef:c,contentLength:t.length,isReversed:d,paused:h.isSelecting}),k=()=>{const T=!d;u(T);try{localStorage.setItem(l1,T?"reversed":"default")}catch{}};y.useEffect(()=>{if(!h.isSelecting)return;const T=C=>{C.key==="Escape"&&h.cancelSelection()};return window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T)}},[h.isSelecting,h.cancelSelection]);const S=y.useCallback(async()=>{await h.copySelected()&&(r==null||r(`Copied ${h.selectedCount} message${h.selectedCount===1?"":"s"} to clipboard`,"success"))},[h,r]),w=p?0:.2,N=d?-8:8;return o.jsxs("div",{className:Fs.wrapper,children:[o.jsx("div",{className:Fs.toolbar,children:o.jsx("button",{className:Fs.directionToggle,onClick:k,title:d?"Showing newest first":"Showing oldest first","aria-label":d?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:d?o.jsx(W0,{size:Zt,"aria-hidden":"true"}):o.jsx(X0,{size:Zt,"aria-hidden":"true"})})}),o.jsxs("div",{ref:c,className:`${Fs.scrollContainer} ${h.isSelecting?Fs.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&i,o.jsx(P6,{eventsDropped:s}),o.jsx(ls,{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:w,ease:"easeOut"},children:o.jsx(m6,{copyText:N6(T),isContentBearing:Jr(T),isSelecting:h.isSelecting,isSelected:h.selectedIndices.has(E),checkboxLabel:U6(T),onSelect:()=>{h.enterSelectionMode(E)},onToggle:D=>{h.toggleEvent(E,D)},onCopied:()=>{r==null||r("Copied to clipboard","success")},children:o.jsx(mA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${E}`)})})]}),o.jsx(ls,{children:h.isSelecting&&o.jsx(k6,{selectedCount:h.selectedCount,totalSelectable:g,onSelectAll:h.selectAll,onDeselectAll:h.deselectAll,onCopy:()=>{S().catch(()=>{})},onCancel:h.cancelSelection})}),o.jsx(ls,{children:!x&&o.jsxs(Et.button,{className:`${Fs.scrollToAnchor} ${d?Fs.scrollToAnchorTop:Fs.scrollToAnchorBottom}`,onClick:b,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(X0,{size:Zt,"aria-hidden":"true"}):o.jsx(W0,{size:Zt,"aria-hidden":"true"})," New events"]})})]})}function qm(t){const{value:s,onSave:i,validate:r,fieldId:c,activeFieldId:d,onActivate:u,enterToSave:p=!0,trimOnSave:h=!0}=t,[g,v]=y.useState(""),[x,b]=y.useState(""),k=y.useRef(!1),S=d===c,w=y.useCallback(R=>{v(R),b("")},[]),N=y.useCallback(()=>{b("")},[]),T=y.useCallback(()=>{k.current=!1,u==null||u(null),v(""),b("")},[u]),C=y.useCallback(()=>{const R=h?g.trim():g;if(r){const K=r(g);if(K){b(K);return}}const U=h?s.trim():s;if(R===U){T();return}i(R),T()},[g,s,h,r,i,T]),E=y.useCallback(()=>{k.current=!0,u==null||u(c),v(s),b("")},[c,s,u]),D=y.useCallback(R=>{if(k.current){k.current=!1;return}R.relatedTarget instanceof HTMLElement&&R.relatedTarget.dataset.editAction===c||C()},[c,C]),A=y.useCallback(R=>{R.key==="Escape"?T():R.key==="Enter"&&p&&C()},[T,p,C]),B=(()=>{if(!S)return!1;const R=h?s.trim():s;return(h?g.trim():g)!==R})();return y.useEffect(()=>{!S&&(g!==""||x!=="")&&(v(""),b(""))},[S,g,x]),{isEditing:S,draft:g,error:x,isDirty:B,startEdit:E,cancelEdit:T,save:C,setDraft:w,clearError:N,handleBlur:D,handleKeyDown:A,ignoreInitialBlurRef:k}}const V6="_editFieldWrapper_yuzty_1",H6="_editInput_yuzty_10",q6="_editTextarea_yuzty_42",G6="_editSelect_yuzty_78",F6="_editError_yuzty_111",Z6="_editInputInvalid_yuzty_118",K6="_editHint_yuzty_123",Y6="_unsavedDot_yuzty_132",J6="_metaValueClickable_yuzty_140",W6="_editButton_yuzty_159",X6="_metaPlaceholder_yuzty_175",Q6="_worktreeToggle_yuzty_180",Xe={editFieldWrapper:V6,editInput:H6,editTextarea:q6,editSelect:G6,editError:F6,editInputInvalid:Z6,editHint:K6,unsavedDot:Y6,metaValueClickable:J6,editButton:W6,metaPlaceholder:X6,worktreeToggle:Q6};function en(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="text",activeFieldId:u,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,maxLength:x,ariaLabel:b,"data-testid":k}=t,S=y.useRef(null),w=qm({value:s,onSave:i,validate:r,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!0,trimOnSave:!0});if(y.useEffect(()=>{if(w.isEditing){const T=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[w.isEditing]),c==="create"){const T=E=>{h==null||h(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:x,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),C&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:C})]})}if(w.isEditing)return o.jsxs("div",{className:Xe.editFieldWrapper,children:[o.jsx("input",{ref:S,className:`${Xe.editInput} ${w.error?Xe.editInputInvalid:""}`,value:w.draft,onChange:T=>w.setDraft(T.target.value),onBlur:w.handleBlur,onKeyDown:w.handleKeyDown,maxLength:x,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),w.isDirty&&o.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),w.error&&o.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:w.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:()=>w.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),w.startEdit())},title:"Click to edit","aria-label":b,"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 qp(t){const{value:s,onSave:i,validate:r,mode:c="edit",fieldId:d="textarea",activeFieldId:u,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:x,"data-testid":b}=t,k=y.useRef(null),S=qm({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=>{h==null||h(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":x,"data-testid":b?`${b}-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:x,"aria-label":x,"data-testid":b?`${b}-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 w=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":x,"data-testid":b?`${b}-button`:void 0,children:[w!==void 0?w: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 nd(t){var E;const{value:s,onSave:i,mode:r="edit",options:c,fieldId:d="select",activeFieldId:u,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:x,"data-testid":b}=t,k=y.useRef(null),S=qm({value:s,onSave:i,fieldId:d,activeFieldId:u,onActivate:p,enterToSave:!1,trimOnSave:!1});y.useEffect(()=>{if(S.isEditing){const D=window.setTimeout(()=>{var A;(A=k.current)==null||A.focus()},0);return()=>window.clearTimeout(D)}},[S.isEditing]);const w=y.useCallback(D=>{const A=D.target.value;S.ignoreInitialBlurRef.current=!1,A!==s&&i(A),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=>h==null?void 0:h(D.target.value),"aria-label":x,"data-testid":b?`${b}-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:w,onBlur:N,title:x,"aria-label":x,"data-testid":b?`${b}-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":x,"data-testid":b?`${b}-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 e4(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 t4="_envRow_1e1r5_1",n4="_envDot_1e1r5_7",s4="_envDotGreen_1e1r5_14",a4="_envDotYellow_1e1r5_18",i4="_envDotRed_1e1r5_22",o4="_envDotGray_1e1r5_26",ko={envRow:t4,envDot:n4,envDotGreen:s4,envDotYellow:a4,envDotRed:i4,envDotGray:o4};function r4(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 l4(t){const{value:s,onSave:i,environments:r,allowNone:c=!1,fieldId:d="environment",activeFieldId:u,onActivate:p,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=t,x=r.find(S=>S.id===s),b=[...c?[{value:"",label:"None"}]:[],...r.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(x)return o.jsxs("span",{className:ko.envRow,children:[o.jsx("span",{className:`${ko.envDot} ${r4(x.status)}`}),x.displayName]})};return o.jsx(nd,{value:s,onSave:i,options:b,fieldId:d,activeFieldId:u,onActivate:p,renderDisplay:k,placeholder:h,ariaLabel:g,"data-testid":v})}const c4="_nav_1snmp_1",d4="_searchForm_1snmp_8",u4="_searchInput_1snmp_15",f4="_searchButton_1snmp_33",p4="_clearButton_1snmp_68",m4="_workspaceSelect_1snmp_85",h4="_listHeader_1snmp_99",g4="_nodeList_1snmp_108",v4="_nodeItem_1snmp_116",y4="_indicator_1snmp_129",b4="_label_1snmp_136",x4="_badge_1snmp_145",Gn={nav:c4,searchForm:d4,searchInput:u4,searchButton:f4,clearButton:p4,workspaceSelect:m4,listHeader:h4,nodeList:g4,nodeItem:v4,indicator:y4,label:b4,badge:x4};function _4({nodes:t,workspaces:s,loading:i,searchQuery:r,onSearch:c,onClearSearch:d,onSelectNode:u,onWorkspaceChange:p}){const[h,g]=y.useState(""),v=y.useCallback(S=>{S.preventDefault(),h.trim()&&c(h.trim())},[h,c]),x=y.useCallback(()=>{g(""),d()},[d]),b=y.useCallback(S=>{u(S)},[u]),k=y.useCallback(S=>{g(""),p(S)},[p]);return o.jsxs("div",{className:Gn.nav,"data-testid":"knowledge-nav",children:[o.jsxs("form",{className:Gn.searchForm,onSubmit:v,children:[o.jsx("input",{className:Gn.searchInput,type:"text",placeholder:"Search...",value:h,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input"}),o.jsx("button",{type:"submit",className:Gn.searchButton,disabled:i,children:"Go"})]}),r&&o.jsx("button",{type:"button",className:Gn.clearButton,onClick:x,children:"Clear search"}),o.jsxs("select",{className:Gn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter",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:Gn.listHeader,children:["Nodes (",t.length,")"]}),o.jsx("ul",{className:Gn.nodeList,children:t.map(S=>o.jsxs("li",{className:Gn.nodeItem,onClick:()=>{b(S.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),b(S.id))},role:"button",tabIndex:0,children:[o.jsx("span",{className:Gn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),o.jsx("span",{className:Gn.label,children:S.label}),o.jsx("span",{className:Gn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const k4="_container_1mq5u_1",S4="_hamburger_1mq5u_33",T4="_brand_1mq5u_49",j4="_brandLogo_1mq5u_68",w4="_info_1mq5u_75",N4="_connectionLabel_1mq5u_90",C4="_connectionDot_1mq5u_103",E4="_connected_1mq5u_106",A4="_disconnected_1mq5u_110",qs={container:k4,hamburger:S4,brand:T4,brandLogo:j4,info:w4,connectionLabel:N4,connectionDot:C4,connected:E4,disconnected:A4};function D4({connected:t,environments:s,sessions:i,onToggleSidebar:r,sidebarOpen:c}){const d=_t(),u=s.length,p=s.filter(g=>g.status==="connected").length,h=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(j2,{size:It,"aria-hidden":"true"})}),o.jsxs("button",{type:"button",className:qs.brand,onClick:()=>d(bi),title:"Home",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:Xp,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:[h," active"]})]})]})}const R4="_nav_13gkc_1",M4="_tab_13gkc_35",I4="_tabIcon_13gkc_68",O4="_tabLabel_13gkc_79",L4="_tabActive_13gkc_84",Nr={nav:R4,tab:M4,tabIcon:I4,tabLabel:O4,tabActive:L4},ui=[{view:"dashboard",label:"Dashboard",icon:o.jsx(f2,{size:It}),route:bi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:o.jsx(N2,{size:It}),route:Yw,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:o.jsx(QT,{size:It}),route:Jw,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:o.jsx(E2,{size:It}),route:To,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:o.jsx(ZT,{size:It}),route:Nx,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:o.jsx(ix,{size:It}),route:fd,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:o.jsx(z2,{size:It}),route:Gw,testId:"sidebar-tab-settings"}];function B4(t){return t===bi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(Nx)?"knowledge":t.startsWith(fd)?"findings":t.startsWith(So)?"settings":"tasks"}function z4(){const t=Ht(),s=_t(),i=y.useRef(null),r=B4(t.pathname),c=y.useCallback(u=>{s(u.route)},[s]),d=y.useCallback(u=>{var x,b;const p=(x=i.current)==null?void 0:x.querySelectorAll('[role="tab"]');if(!p)return;const h=Array.from(p).findIndex(k=>k===document.activeElement),g=h>=0?h: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),(b=p[v])==null||b.focus()},[r,s]);return o.jsx("nav",{className:Nr.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.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Nr.tab} ${p?Nr.tabActive:""}`,onClick:()=>c(u),"data-testid":u.testId,title:u.label,"aria-label":u.label,children:[o.jsx("span",{className:Nr.tabIcon,"aria-hidden":"true",children:u.icon}),o.jsx("span",{className:Nr.tabLabel,children:u.label})]},u.view)})})}const U4="_container_pi6ii_1",$4="_content_pi6ii_66",Db={container:U4,content:$4},P4=320,c1=220,d1=600,u1="grackle-sidebar-width";function V4(){try{const t=localStorage.getItem(u1);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=c1&&s<=d1)return s}}catch{}return P4}function H4(t){try{localStorage.setItem(u1,String(t))}catch{}}function q4({content:t}){const[s]=y.useState(V4),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 h=Math.round(p.inlineSize);h>=c1&&h<=d1&&H4(h)}}});return c.observe(r),()=>{c.disconnect()}},[]),t!==void 0)return o.jsx("div",{className:Db.container,ref:i,"data-testid":"sidebar",style:{width:s},children:o.jsx("div",{className:Db.content,children:t})})}const G4="_bar_tnfsh_1",F4="_btnPrimary_tnfsh_32",Z4="_statusText_tnfsh_85",K4="_statusCompleted_tnfsh_90",Y4="_statusFailed_tnfsh_94",J4="_statusBlocked_tnfsh_98",W4="_hintText_tnfsh_103",St={bar:G4,btnPrimary:F4,statusText:Z4,statusCompleted:K4,statusFailed:Y4,statusBlocked:J4,hintText:W4};function X4({sessions:t,tasks:s,environments:i}){const r=_t(),c=Ht(),d=Nt("/sessions/:sessionId"),u=Nt("/tasks/:taskId"),p=Nt("/tasks/:taskId/stream"),h=Nt("/tasks/:taskId/findings"),g=Nt("/tasks/:taskId/edit"),v=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId"),x=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),b=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=Nt("/sessions/new"),w=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,A=(u==null?void 0:u.params.taskId)??(p==null?void 0:p.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(x==null?void 0:x.params.taskId)??(b==null?void 0:b.params.taskId)??(k==null?void 0:k.params.taskId),B=v??x??b??k,R=(B==null?void 0:B.params.environmentId)??(w==null?void 0:w.params.environmentId),U=c.pathname.startsWith("/environments")&&!w&&!B,K=!!T,ne=!!S,F=!!w&&!v&&!x&&!b&&!k,ee=!!N;if(!!C&&!ne&&!F&&!ee||!!E||(!!g||!!k)||ee||U||ne)return o.jsx(o.Fragment,{});if(K)return i.find(G=>G.adapterType==="local"&&G.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(F)return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Select a task or click + to create one"})});if(A){const O=s.find(ue=>ue.id===A);if(!O)return o.jsx("div",{className:St.bar,children:o.jsx("span",{className:St.hintText,children:"Loading..."})});const G=new Map(s.map(ue=>[ue.id,ue])),se=O.dependsOn.some(ue=>{const de=G.get(ue);return de!==void 0&&de.status!=="complete"});if(O.status==="not_started"){const ue=se?O.dependsOn.map(de=>G.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,R)),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),G=(O==null?void 0:O.status)==="stopped";if(O!==void 0&&!G)return o.jsx(o.Fragment,{});if(G)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(Tx(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 Q4="_nav_14i94_1",eI="_tab_14i94_24",tI="_tabActive_14i94_62",nI="_tabLabel_14i94_75",sI="_statusDot_14i94_81",aI="_pulse_14i94_87",iI="_addButton_14i94_99",oI="_empty_14i94_132",wa={nav:Q4,tab:eI,tabActive:tI,tabLabel:nI,statusDot:sI,pulse:aI,addButton:iI,empty:oI},rI={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function lI({environments:t}){const s=_t(),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),h=p==="new"?void 0:p,g=y.useCallback(b=>{s(yi(b))},[s]),v=y.useCallback(b=>{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),w=S>=0?S:t.findIndex(C=>C.id===h);let N=w;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),N=(w+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),N=(w-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),N=0;else if(b.key==="End")b.preventDefault(),N=k.length-1;else return;N<t.length&&s(yi(t[N].id)),k[N].focus()},[h,t,s]),x=h??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:wa.nav,"data-testid":"environment-nav",children:[o.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(b=>{const k=b.id===h,S=b.id===x,w=rI[b.status]||"var(--text-tertiary)",N=b.status==="connected";return o.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${wa.tab} ${k?wa.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"env-nav-item",children:[o.jsx("span",{className:`${wa.statusDot} ${N?wa.pulse:""}`,style:{color:w},"aria-hidden":"true",children:o.jsx(Ma,{size:Xp,fill:"currentColor"})}),o.jsx("span",{className:wa.tabLabel,title:b.displayName||b.id,children:b.displayName||b.id})]},b.id)})}),o.jsx("button",{type:"button",className:wa.addButton,onClick:()=>s(Hw),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&o.jsx("div",{className:wa.empty,children:"No environments yet."})]})}function Gm(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 h=s.getFullYear()===i.getFullYear(),g=s.toLocaleString("en-US",{month:"short"}),v=s.getDate();return h?`${g} ${v}`:`${g} ${v} ${s.getFullYear()}`}const Rb={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 sd(t){return Rb[t]||Rb.general}const cI="_nav_dlm8m_1",dI="_categoryPills_dlm8m_24",uI="_categoryPill_dlm8m_24",fI="_tab_dlm8m_42",pI="_tabActive_dlm8m_80",mI="_tabContent_dlm8m_93",hI="_tabLabel_dlm8m_100",gI="_tabMeta_dlm8m_106",vI="_categoryDot_dlm8m_111",yI="_empty_dlm8m_118",gs={nav:cI,categoryPills:dI,categoryPill:uI,tab:fI,tabActive:pI,tabContent:mI,tabLabel:hI,tabMeta:gI,categoryDot:vI,empty:yI};function bI({findings:t,workspaceId:s,environmentId:i}){const r=_t(),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),h=y.useMemo(()=>{const b=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(b).sort()},[t]),g=y.useCallback(b=>{r(jp(b,s,i))},[r,s,i]),v=y.useCallback(b=>{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),w=S>=0?S:t.findIndex(C=>C.id===p);let N=w;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),N=(w+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),N=(w-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),N=0;else if(b.key==="End")b.preventDefault(),N=k.length-1;else return;N<t.length&&r(jp(t[N].id,s,i)),k[N].focus()},[p,t,r,s,i]),x=p??(t.length>0?t[0].id:void 0);return o.jsxs("div",{className:gs.nav,"data-testid":"findings-nav",children:[h.length>1&&o.jsx("div",{className:gs.categoryPills,"data-testid":"findings-nav-categories",children:h.map(b=>o.jsx("span",{className:gs.categoryPill,style:{color:sd(b).text},children:b},b))}),o.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(b=>{const k=b.id===p,S=b.id===x;return o.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${gs.tab} ${k?gs.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"finding-nav-item",children:[o.jsx("span",{className:gs.categoryDot,style:{color:sd(b.category).text},"aria-hidden":"true",children:o.jsx(Ma,{size:Xp,fill:"currentColor"})}),o.jsxs("span",{className:gs.tabContent,children:[o.jsx("span",{className:gs.tabLabel,title:b.title,children:b.title}),o.jsx("span",{className:gs.tabMeta,title:b.createdAt,children:Gm(b.createdAt)})]})]},b.id)})}),t.length===0&&o.jsx("div",{className:gs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function xI(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 f1({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return o.jsx(o.Fragment,{children:t});const r=xI(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 _I(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 kI(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,h=i.get(p);h?h.push(d):i.set(p,[d])}const r=[],c=new Set;for(const d of Z2){c.add(d);const u=i.get(d);if(u&&u.length>0){u.sort((h,g)=>h.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((h,g)=>h.sortOrder-g.sortOrder);const p=Ia(d);r.push({status:d,label:p.label,style:p,tasks:u})}return r}const SI="_container_z4i38_1",TI="_header_z4i38_5",jI="_headerActions_z4i38_17",wI="_searchInput_z4i38_23",NI="_searchHighlight_z4i38_56",CI="_groupToggle_z4i38_62",EI="_groupToggleActive_z4i38_89",AI="_addButton_z4i38_93",DI="_taskRow_z4i38_120",RI="_selected_z4i38_140",MI="_expandArrow_z4i38_150",II="_expanded_z4i38_157",OI="_leafSpacer_z4i38_161",LI="_taskStatusIcon_z4i38_166",BI="_taskTitle_z4i38_170",zI="_workspaceBadge_z4i38_177",UI="_childCountBadge_z4i38_195",$I="_dependencyBadge_z4i38_208",PI="_blockedBadge_z4i38_220",VI="_addChildButton_z4i38_225",HI="_emptyState_z4i38_268",qI="_statusGroupHeader_z4i38_275",GI="_statusGroupIcon_z4i38_294",FI="_statusGroupLabel_z4i38_298",ZI="_statusGroupCount_z4i38_303",qe={container:SI,header:TI,headerActions:jI,searchInput:wI,searchHighlight:NI,groupToggle:CI,groupToggleActive:EI,addButton:AI,taskRow:DI,selected:RI,expandArrow:MI,expanded:II,leafSpacer:OI,taskStatusIcon:LI,taskTitle:BI,workspaceBadge:zI,childCountBadge:UI,dependencyBadge:$I,blockedBadge:PI,addChildButton:VI,emptyState:HI,statusGroupHeader:qI,statusGroupIcon:GI,statusGroupLabel:FI,statusGroupCount:ZI},KI=[{name:"title",weight:2},{name:"description",weight:1}],p1=16,YI=16,m1="grackle-task-group-by-status";function Mb(){try{return localStorage.getItem(m1)==="true"}catch{return!1}}function JI(t){try{localStorage.setItem(m1,String(t))}catch{}}function WI({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(ls,{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 h=Ia(p.status),g=r===p.id,v=p.parentTaskId||!p.workspaceId?void 0:u.get(p.workspaceId);return o.jsxs("div",{onClick:()=>c(cs(p.id)),className:`${qe.taskRow} ${g?qe.selected:""}`,style:{"--task-indent":`${p1}px`},"data-task-id":p.id,children:[o.jsx("span",{className:qe.leafSpacer}),o.jsx("span",{className:qe.taskStatusIcon,style:{color:h.color},"aria-hidden":"true","data-testid":`task-status-${Xr(p.status)}`,children:h.icon}),o.jsx("span",{className:qe.taskTitle,title:p.title,children:o.jsx(f1,{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 h1({node:t,depth:s,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:h}){const g=Ia(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>u.get(T)!=="complete"),x=i.has(t.id),b=t.children.length>0,k=c===t.id,S=p1+s*YI,N=s===0&&!t.parentTaskId&&t.workspaceId?h.get(t.workspaceId):void 0;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{onClick:()=>d(cs(t.id)),className:`${qe.taskRow} ${k?qe.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[b&&o.jsx("span",{className:`${qe.expandArrow} ${x?qe.expanded:""}`,role:"button",tabIndex:0,"aria-label":x?"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"})}),!b&&o.jsx("span",{className:qe.leafSpacer}),o.jsx("span",{className:qe.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${Xr(t.status)}`,children:g.icon}),o.jsx("span",{className:qe.taskTitle,title:t.title,children:o.jsx(f1,{text:t.title,indices:p.get(t.id),highlightClass:qe.searchHighlight})}),N&&o.jsx("span",{className:qe.workspaceBadge,title:N,children:N}),b&&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<sT&&o.jsx("button",{onClick:T=>{T.stopPropagation(),d(Si(t.workspaceId,t.id))},title:"Add child task","aria-label":"Add child task",className:qe.addChildButton,children:"+"})]}),o.jsx(ls,{children:b&&x&&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(h1,{node:T,depth:s+1,expandedTasks:i,toggleTask:r,selectedTaskId:c,navigate:d,taskStatusById:u,titleHighlights:p,workspaceNames:h},T.id))})})]})}function XI({workspaces:t,tasks:s}){const i=_t(),[r,c]=y.useState(new Set),[d,u]=y.useState(new Set),[p,h]=y.useState(Mb),[g,v]=y.useState(Mb),[x,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,w=y.useMemo(()=>new Map(s.map(X=>[X.id,X.status])),[s]),N=y.useMemo(()=>new Map(t.map(X=>[X.id,X.name])),[t]),T=()=>{const X=!p;JI(X),h(X),X&&(v(!0),b(new Map))},C=X=>{b(re=>{const O=new Map(re),G=O.has(X)?O.get(X):g;return O.set(X,!G),O})},E=X=>x.has(X)?x.get(X):g,D=X=>{c(re=>{const O=new Set(re);return O.has(X)?(O.delete(X),u(G=>new Set(G).add(X))):(O.add(X),u(G=>{const se=new Set(G);return se.delete(X),se})),O})};y.useEffect(()=>{const X=new Set(s.filter(re=>re.parentTaskId).map(re=>re.parentTaskId));X.size>0&&c(re=>{const O=new Set(re);for(const G of X)d.has(G)||O.add(G);return O})},[s,d]);const[A,B]=y.useState(""),{directMatchTaskIds:R,treeMatchTaskIds:U,titleHighlights:K}=y.useMemo(()=>{if(!A.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const X=nT(s,A,KI),re=new Set(X.map(ue=>ue.item.id)),O=new Map;for(const ue of X){const de=ue.matches.find(Ge=>Ge.key==="title");de&&O.set(ue.item.id,de.indices)}const G=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;)G.add(de.parentTaskId),de=se.get(de.parentTaskId)}return{directMatchTaskIds:re,treeMatchTaskIds:G,titleHighlights:O}},[A,s]),ne=R!==null,F=ne?p?R:U:null,ee=F?s.filter(X=>F.has(X.id)):s,ae=p?[]:_I(ee);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("button",{className:`${qe.groupToggle} ${p?qe.groupToggleActive:""}`,onClick:T,"aria-label":p?"Switch to tree view":"Group tasks by status","aria-pressed":p,title:p?"Switch to tree view":"Group tasks by status","data-testid":"task-group-by-status-toggle",children:o.jsx(_2,{size:Zt})}),o.jsx("button",{className:qe.addButton,onClick:()=>i(Si()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&o.jsx("input",{type:"text",value:A,onChange:X=>B(X.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:qe.searchInput,"data-testid":"sidebar-search"}),p?kI(ee,w).map(X=>o.jsx(WI,{group:X,isExpanded:E(X.status),onToggle:()=>C(X.status),selectedTaskId:S,navigate:i,titleHighlights:K,workspaceNames:N},X.status)):ae.map(X=>o.jsx(h1,{node:X,depth:0,expandedTasks:r,toggleTask:D,selectedTaskId:S,navigate:i,taskStatusById:w,titleHighlights:K,workspaceNames:N},X.id)),ee.length===0&&!ne&&o.jsx("div",{className:qe.emptyState,children:"No tasks yet. Click + to create one."}),ee.length===0&&ne&&o.jsx("div",{className:qe.emptyState,children:"No matching tasks"})]})}const QI="_toast_ed2dk_1",e5="_success_ed2dk_18",t5="_icon_ed2dk_22",n5="_error_ed2dk_25",s5="_warning_ed2dk_32",a5="_info_ed2dk_38",i5="_message_ed2dk_53",o5="_close_ed2dk_60",Cr={toast:QI,success:e5,icon:t5,error:n5,warning:s5,info:a5,message:i5,close:o5},r5={success:o.jsx(_i,{size:It}),error:o.jsx(Ba,{size:It}),warning:o.jsx(Wp,{size:It}),info:o.jsx(Jp,{size:It})};function l5({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:`${Cr.toast} ${Cr[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:Cr.icon,"aria-hidden":"true",children:r5[t.variant]}),o.jsx("span",{className:Cr.message,children:t.message}),o.jsx("button",{type:"button",className:Cr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:o.jsx(Ba,{size:Zt,"aria-hidden":"true"})})]})}const c5="_container_qqse2_1",d5={container:c5};function u5({toasts:t,onDismiss:s}){return o.jsx("div",{className:d5.container,"data-testid":"toast-container",children:o.jsx(ls,{children:t.map(i=>o.jsx(l5,{toast:i,onDismiss:s},i.id))})})}const f5="_callout_e5awm_1",p5="_success_e5awm_11",m5="_icon_e5awm_15",h5="_error_e5awm_18",g5="_warning_e5awm_25",v5="_info_e5awm_32",y5="_content_e5awm_48",b5="_close_e5awm_53",Er={callout:f5,success:p5,icon:m5,error:h5,warning:g5,info:v5,content:y5,close:b5},x5={success:o.jsx(_i,{size:It}),error:o.jsx(Ba,{size:It}),warning:o.jsx(Wp,{size:It}),info:o.jsx(Jp,{size:It})};function _5({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:[Er.callout,Er[t],r].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[o.jsx("span",{className:Er.icon,"aria-hidden":"true",children:x5[t]}),o.jsx("span",{className:Er.content,children:s}),i&&o.jsx("button",{type:"button",className:Er.close,onClick:()=>d(!0),"aria-label":"Dismiss",children:o.jsx(Ba,{size:Zt,"aria-hidden":"true"})})]})})}function k5({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(_5,{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 S5="_container_de44x_1",T5="_emptyState_de44x_8",j5="_card_de44x_14",w5="_cardClickable_de44x_34",N5="_cardHeader_de44x_42",C5="_categoryBadge_de44x_54",E5="_findingTitle_de44x_62",A5="_findingDate_de44x_68",D5="_findingContent_de44x_80",R5="_tags_de44x_86",M5="_tag_de44x_86",as={container:S5,emptyState:T5,card:j5,cardClickable:w5,cardHeader:N5,categoryBadge:C5,findingTitle:E5,findingDate:A5,findingContent:D5,tags:R5,tag:M5};function g1({findings:t,onFindingClick:s}){return t.length===0?o.jsx("div",{className:as.emptyState,children:"No findings yet. Agents will post discoveries here."}):o.jsx("div",{className:as.container,children:t.map((i,r)=>{const c=sd(i.category),d=s?Et.button:Et.div;return o.jsxs(d,{type:s?"button":void 0,className:`${as.card} ${s?as.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:as.cardHeader,children:[o.jsx("span",{className:as.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),o.jsx("span",{className:as.findingTitle,children:i.title}),o.jsx("span",{className:as.findingDate,title:i.createdAt,children:Gm(i.createdAt)})]}),o.jsx("div",{className:as.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&o.jsx("div",{className:as.tags,children:i.tags.map(u=>o.jsx("span",{className:as.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:u},u))})]},i.id)})})}const I5="_section_1ingb_14",O5="_sectionTitle_1ingb_26",L5="_sectionDescription_1ingb_35",B5="_tokenList_1ingb_48",z5="_tokenRow_1ingb_55",U5="_tokenBadge_1ingb_68",$5="_tokenName_1ingb_83",P5="_tokenTarget_1ingb_90",V5="_deleteButton_1ingb_99",H5="_addForm_1ingb_113",q5="_formRow_1ingb_119",G5="_input_1ingb_125",F5="_select_1ingb_155",Z5="_addButton_1ingb_187",K5="_emptyStateInfo_1ingb_221",Y5="_themeOptions_1ingb_229",J5="_themeOption_1ingb_229",W5="_themeOptionSelected_1ingb_254",X5="_themeOptionHeader_1ingb_259",Q5="_themeOptionLabel_1ingb_266",eO="_themeOptionDesc_1ingb_273",tO="_variantToggle_1ingb_279",nO="_variantButton_1ingb_286",sO="_variantActive_1ingb_305",aO="_themeSwatches_1ingb_311",iO="_themeSwatch_1ingb_311",oO="_systemToggle_1ingb_325",rO="_systemToggleHint_1ingb_341",lO="_themeActive_1ingb_348",cO="_aboutGrid_1ingb_354",dO="_aboutItem_1ingb_360",uO="_aboutLabel_1ingb_373",fO="_aboutValue_1ingb_379",pO="_aboutDot_1ingb_387",mO="_aboutDotConnected_1ingb_394",hO="_aboutDotDisconnected_1ingb_398",ge={section:I5,sectionTitle:O5,sectionDescription:L5,tokenList:B5,tokenRow:z5,tokenBadge:U5,tokenName:$5,tokenTarget:P5,deleteButton:V5,addForm:H5,formRow:q5,input:G5,select:F5,addButton:Z5,emptyStateInfo:K5,themeOptions:Y5,themeOption:J5,themeOptionSelected:W5,themeOptionHeader:X5,themeOptionLabel:Q5,themeOptionDesc:eO,variantToggle:tO,variantButton:nO,variantActive:sO,themeSwatches:aO,themeSwatch:iO,systemToggle:oO,systemToggleHint:rO,themeActive:lO,aboutGrid:cO,aboutItem:dO,aboutLabel:uO,aboutValue:fO,aboutDot:pO,aboutDotConnected:mO,aboutDotDisconnected:hO},gO=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function vO({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:r}){const[c,d]=y.useState(""),[u,p]=y.useState(""),[h,g]=y.useState("env_var"),[v,x]=y.useState(""),[b,k]=y.useState(null),S=T=>{if(T.preventDefault(),!c||!u)return;const C=h==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,u,h,C,h==="file"?v:""),r==null||r("Token saved successfully","success"),d(""),p(""),x("")},w=T=>{k(T)},N=()=>{b&&(i(b),r==null||r("Token deleted","info")),k(null)};return o.jsxs(o.Fragment,{children:[o.jsx(xi,{isOpen:b!==null,title:"Delete Token?",description:b?`"${b}" 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:()=>w(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:h,onChange:T=>g(T.target.value),children:gO.map(T=>o.jsx("option",{value:T.value,children:T.label},T.value))}),o.jsx("input",{className:ge.input,type:"text",placeholder:h==="env_var"?"Env var name (e.g. API_TOKEN)":"File path (e.g. /home/user/.token)",value:v,onChange:T=>x(T.target.value)}),o.jsx("button",{className:ge.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const bd=[{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"]}],v1=new Set(bd.map(t=>t.id)),Ib="grackle";function Gp(t){return bd.find(s=>s.id===t)}function yO({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:bd.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,h=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&&h?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&&h,children:"☼"}),o.jsx("span",{role:"button",tabIndex:0,className:`${ge.variantButton} ${p&&!h?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&&!h,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 bO({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.0"})]})]})]})}const xO="_container_cddyd_1",_O="_header_cddyd_8",kO="_headerTitle_cddyd_35",SO="_badge_cddyd_44",TO="_headerActions_cddyd_54",jO="_body_cddyd_61",wO="_formContent_cddyd_73",NO="_section_cddyd_85",CO="_label_cddyd_91",EO="_titleInput_cddyd_98",AO="_descriptionTextarea_cddyd_131",DO="_parentContext_cddyd_167",RO="_parentLabel_cddyd_175",MO="_parentName_cddyd_182",IO="_personaSelect_cddyd_186",OO="_depList_cddyd_220",LO="_depItem_cddyd_226",BO="_depItemSelected_cddyd_248",zO="_noDeps_cddyd_252",UO="_btnPrimary_cddyd_258",$O="_btnGhost_cddyd_289",We={container:xO,header:_O,headerTitle:kO,badge:SO,headerActions:TO,body:jO,formContent:wO,section:NO,label:CO,titleInput:EO,descriptionTextarea:AO,parentContext:DO,parentLabel:RO,parentName:MO,personaSelect:IO,depList:OO,depItem:LO,depItemSelected:BO,noDeps:zO,btnPrimary:UO,btnGhost:$O};function y1({mode:t,taskId:s,workspaceId:i,parentTaskId:r,environmentId:c,tasks:d,workspaces:u,personas:p,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:x}){const b=_t(),k=t==="edit",S=k&&s?d.find(me=>me.id===s):void 0,w=k?(S==null?void 0:S.workspaceId)??"":i??"",[N,T]=y.useState(w),C=w||N,E=u.find(me=>me.id===C),D=c??(E==null?void 0:E.environmentId),A=!k&&!i,B=k?(S==null?void 0:S.parentTaskId)??"":r??"",R=B?d.find(me=>me.id===B):void 0,[U,K]=y.useState((S==null?void 0:S.title)??""),[ne,F]=y.useState((S==null?void 0:S.description)??""),[ee,ae]=y.useState((S==null?void 0:S.dependsOn)??[]),[X,re]=y.useState((S==null?void 0:S.defaultPersonaId)??""),[O,G]=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,K(S.title),F(S.description),ae(S.dependsOn),re(S.defaultPersonaId),G(S.canDecompose))},[k,S]);const Ge=d.filter(me=>me.workspaceId===C&&(!k||me.id!==s)&&me.id!==B),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(),ne,ee,X),x==null||x("Task updated","success"),v?v():b(cs(s,void 0,C,D),{replace:!0})):(ue(!0),h(C,U.trim(),ne,ee.length>0?ee:void 0,B||void 0,X,O,()=>{x==null||x("Task created","success"),b(i?vi(i,D):"/tasks",{replace:!0})},me=>{x==null||x(me,"error"),ue(!1)})))},fe=()=>{if(v){v();return}b(k&&s?cs(s,void 0,C,D):i?vi(i,D):"/tasks")},ye=k?"edit task":B?"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}),R&&o.jsxs("span",{className:We.parentContext,children:[o.jsx("span",{className:We.parentLabel,children:"Child of"}),o.jsx("span",{className:We.parentName,children:R.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:[A&&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=>K(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:ne,onChange:me=>F(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:X,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=>G(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=ee.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 PO="_container_legrg_1",VO="_header_legrg_8",HO="_headerTitle_legrg_35",qO="_badge_legrg_44",GO="_headerActions_legrg_54",FO="_body_legrg_61",ZO="_formContent_legrg_73",KO="_section_legrg_85",YO="_label_legrg_91",JO="_nameInput_legrg_98",WO="_fieldInput_legrg_131",XO="_adapterSelect_legrg_164",QO="_readOnlyValue_legrg_198",eL="_codespaceSection_legrg_204",tL="_codespaceActions_legrg_210",nL="_creatingHint_legrg_216",sL="_errorHint_legrg_222",aL="_btnPrimary_legrg_235",iL="_btnGhost_legrg_266",oe={container:PO,header:VO,headerTitle:HO,badge:qO,headerActions:GO,body:FO,formContent:ZO,section:KO,label:YO,nameInput:JO,fieldInput:WO,adapterSelect:XO,readOnlyValue:QO,codespaceSection:eL,codespaceActions:tL,creatingHint:nL,errorHint:sL,btnPrimary:aL,btnGhost:iL},Vc=1,Hc=65535;function dp(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Vc&&s<=Hc}function up(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function oL({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:h}){const[g,v]=y.useState("pick"),[x,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:x,onChange:w=>b(w.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:w=>S(w.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:()=>{x.trim()&&(h(x.trim(),k.trim()||void 0),v("pick"),b(""),S(""))},disabled:!x.trim(),className:oe.btnPrimary,children:"Create"}),o.jsx("button",{onClick:()=>{v("pick"),b(""),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:w=>{w.target.value==="__create__"?(v("create"),s("")):(s(w.target.value),w.target.value&&!i.trim()&&r(w.target.value))},disabled:p,className:oe.adapterSelect,"data-testid":"env-codespace-select",children:[o.jsx("option",{value:"",children:"Select a codespace..."}),c.map(w=>o.jsxs("option",{value:w.name,children:[w.name," (",w.repository,") — ",w.state]},w.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:w=>s(w.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 b1({mode:t,environmentId:s,environments:i,onAddEnvironment:r,onUpdateEnvironment:c,onListCodespaces:d,codespaces:u,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:x}){const b=_t(),k=t==="edit",S=k&&s?i.find(fe=>fe.id===s):void 0,[w,N]=y.useState(""),[T,C]=y.useState("local"),[E,D]=y.useState(""),[A,B]=y.useState(""),[R,U]=y.useState(""),[K,ne]=y.useState(""),[F,ee]=y.useState(""),[ae,X]=y.useState(""),[re,O]=y.useState(""),[G,se]=y.useState(null),ue=y.useCallback(()=>{const fe={};if(T==="local"){if(E.trim()&&(fe.host=E.trim()),A.trim()){const ye=Number(A);Number.isInteger(ye)&&(fe.port=ye)}}else if(T==="ssh"){if(fe.host=E.trim(),R.trim()&&(fe.user=R.trim()),A.trim()){const ye=Number(A);Number.isInteger(ye)&&(fe.sshPort=ye)}K.trim()&&(fe.identityFile=K.trim())}else T==="docker"?(F.trim()&&(fe.image=F.trim()),ae.trim()&&(fe.repo=ae.trim())):T==="codespace"&&(fe.codespaceName=re.trim());return fe},[T,E,A,R,K,F,ae,re]),de=()=>!(!w.trim()||T==="ssh"&&!E.trim()||T==="codespace"&&!re.trim()||(T==="local"||T==="ssh")&&!dp(A)),Ge=()=>{de()&&(r(w.trim(),T,ue()),x==null||x("Environment added successfully","success"),b(To,{replace:!0}))},De=()=>{b(s?yi(s):To)},Ne=y.useCallback((fe,ye)=>{if(!S||!s)return;const me=up(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=up(S.adapterConfig);if(ye.trim()){const Ue=Number(ye);Number.isInteger(Ue)&&Ue>=Vc&&Ue<=Hc&&(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=up(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:G,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:G,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=>dp(ye)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:G,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:G,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:G,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=>dp(ye)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:G,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:G,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:G,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:G,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:G,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:w,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:Vc,max:Hc,value:A,onChange:fe=>B(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:R,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:Vc,max:Hc,value:A,onChange:fe=>B(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:K,onChange:fe=>ne(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:F,onChange:fe=>ee(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=>X(fe.target.value),placeholder:"Repo (optional)...",className:oe.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&o.jsx(oL,{codespaceName:re,onCodespaceNameChange:O,envName:w,onEnvNameChange:N,codespaces:u,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const rL="_group_1iprv_1",lL="_groupTitle_1iprv_8",cL="_shortcutList_1iprv_17",dL="_shortcutRow_1iprv_23",uL="_keys_1iprv_36",fL="_kbd_1iprv_43",pL="_description_1iprv_60",fi={group:rL,groupTitle:lL,shortcutList:cL,shortcutRow:dL,keys:uL,kbd:fL,description:pL},mL=[{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 hL(){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."}),mL.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 gL="_workpadSection_y8nj9_1",vL="_workpadLabel_y8nj9_9",yL="_workpadStatus_y8nj9_17",bL="_workpadSummary_y8nj9_23",xL="_workpadExtra_y8nj9_29",Na={workpadSection:gL,workpadLabel:vL,workpadStatus:yL,workpadSummary:bL,workpadExtra:xL};function _L({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 kL=[{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 SL({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:kL.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 TL="_container_10efq_1",jL="_header_10efq_7",wL="_list_10efq_105",NL="_card_10efq_111",CL="_cardHeader_10efq_125",EL="_cardTitle_10efq_135",AL="_defaultBadge_10efq_141",DL="_cardActions_10efq_155",RL="_description_10efq_160",ML="_meta_10efq_166",IL="_empty_10efq_212",OL="_typeBadge_10efq_362",Fn={container:TL,header:jL,list:wL,card:NL,cardHeader:CL,cardTitle:EL,defaultBadge:AL,cardActions:DL,description:RL,meta:ML,empty:IL,typeBadge:OL};function LL({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:r,onNavigateToNew:c,onNavigateToPersona:d}){const[u,p]=y.useState(null),h=u?t.find(v=>v.id===u):void 0,g=async v=>{await i(v),p(null)};return o.jsxs("div",{className:Fn.container,children:[o.jsxs("div",{className:Fn.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:Fn.empty,children:"No personas yet. Create one to get started."}):o.jsx("div",{className:Fn.list,children:t.map(v=>{const x=s===v.id,b=v.type==="script";return o.jsxs("div",{className:Fn.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:Fn.cardHeader,children:[o.jsxs("span",{className:Fn.cardTitle,children:[o.jsx("strong",{children:v.name}),o.jsx("span",{className:Fn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:b?"Script":"Agent"}),x&&o.jsx("span",{className:Fn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),o.jsxs("div",{className:Fn.cardActions,onClick:k=>k.stopPropagation(),children:[!x&&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:Fn.description,children:v.description}),o.jsxs("div",{className:Fn.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(xi,{isOpen:u!==null,title:"Delete Persona?",description:`"${(h==null?void 0:h.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{u&&g(u).catch(()=>{})},onCancel:()=>p(null)})]})}const BL="_container_uy08i_1",zL="_header_uy08i_7",UL="_count_uy08i_13",$L="_presets_uy08i_18",PL="_presetButton_uy08i_24",VL="_filterInput_uy08i_41",HL="_groups_uy08i_53",qL="_group_uy08i_53",GL="_groupHeader_uy08i_68",FL="_groupName_uy08i_77",ZL="_groupCount_uy08i_81",KL="_toolList_uy08i_87",YL="_toolItem_uy08i_95",JL="_toolName_uy08i_103",cn={container:BL,header:zL,count:UL,presets:$L,presetButton:PL,filterInput:VL,groups:HL,group:qL,groupHeader:GL,groupName:FL,groupCount:ZL,toolList:KL,toolItem:YL,toolName:JL},WL=(()=>{const t=new Map;for(const s of Qb){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()}))})(),XL=[{name:"default",label:"Default",tools:ex},{name:"worker",label:"Worker",tools:aT},{name:"orchestrator",label:"Orchestrator",tools:iT},{name:"admin",label:"Admin",tools:oT}];function Ob({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 x=new Set(d);x.has(v)?x.delete(v):x.add(v),s([...x].sort())},[d,s,i]),p=y.useCallback((v,x)=>{if(i)return;const b=new Set(d);for(const k of v)x?b.delete(k):b.add(k);s([...b].sort())},[d,s,i]),h=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 (${ex.length} tools)`:`${t.length} of ${Qb.size} tools selected`})}),o.jsxs("div",{className:cn.presets,"data-testid":"mcp-tool-presets",children:[XL.map(v=>o.jsx("button",{type:"button",className:cn.presetButton,disabled:i,onClick:()=>h(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:WL.map(({group:v,tools:x})=>{const b=g?x.filter(S=>S.toLowerCase().includes(g)):x;if(b.length===0)return null;const k=b.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(b,k),disabled:i,"data-testid":`group-toggle-${v}`}),o.jsx("span",{className:cn.groupName,children:v}),o.jsxs("span",{className:cn.groupCount,children:["(",b.filter(S=>d.has(S)).length,"/",b.length,")"]})]}),o.jsx("div",{className:cn.toolList,children:b.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 QL="_nav_1bhou_1",eB="_tab_1bhou_24",tB="_tabIcon_1bhou_62",nB="_tabActive_1bhou_68",Ec={nav:QL,tab:eB,tabIcon:tB,tabActive:nB},Gs=[{path:"credentials",label:"Credentials",icon:o.jsx(h2,{size:It})},{path:"personas",label:"Personas",icon:o.jsx(H2,{size:It})},{path:"appearance",label:"Appearance",icon:o.jsx(D2,{size:It})},{path:"shortcuts",label:"Shortcuts",icon:o.jsx(v2,{size:It})},{path:"about",label:"About",icon:o.jsx(Jp,{size:It})}];function sB(){var u;const t=Ht(),s=_t(),i=y.useRef(null),r=((u=Gs.find(p=>{const h=`${So}/${p.path}`;return t.pathname===h||t.pathname.startsWith(`${h}/`)}))==null?void 0:u.path)??Gs[0].path,c=y.useCallback(p=>{s(`${So}/${p}`)},[s]),d=y.useCallback(p=>{var k,S;const h=(k=i.current)==null?void 0:k.querySelectorAll('[role="tab"]');if(!h)return;const g=Array.from(h).findIndex(w=>w===document.activeElement),v=g>=0?g:Gs.findIndex(w=>w.path===r);let x=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),x=(v+1)%Gs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),x=(v-1+Gs.length)%Gs.length;else if(p.key==="Home")p.preventDefault(),x=0;else if(p.key==="End")p.preventDefault(),x=Gs.length-1;else return;const b=Gs[x].path;s(`${So}/${b}`),(S=h[x])==null||S.focus()},[r,s]);return o.jsx("nav",{className:Ec.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:d,children:Gs.map(p=>{const h=p.path===r;return o.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${Ec.tab} ${h?Ec.tabActive:""}`,onClick:()=>c(p.path),children:[o.jsx("span",{className:Ec.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function aB({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(Q0.map(d=>[d,[]]));for(const d of t){const u=Xr(d.status),p=d.dependsOn.length>0&&d.dependsOn.some(S=>s.get(S)!=="complete"),h=r.get(d.id)??[],g=h.length,v=h.filter(S=>S.status==="complete").length;let x;if(u==="paused"&&i){const S=i.get(d.id);S==="idle"?x="Needs input":S==="completed"&&(x="Ready to complete")}const b={task:d,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:x},k=c.get(u);k?k.push(b):c.get("not_started").push(b)}for(const d of c.values())d.sort((u,p)=>u.task.sortOrder-p.task.sortOrder);return Q0.map(d=>{const u=Ia(d);return{status:d,label:u.label,style:u,tasks:c.get(d)??[]}})}const iB="_boardContainer_1c4y1_1",oB="_column_1c4y1_17",rB="_columnHeader_1c4y1_34",lB="_columnIcon_1c4y1_47",cB="_columnLabel_1c4y1_52",dB="_columnCount_1c4y1_57",uB="_cardList_1c4y1_67",fB="_emptyPlaceholder_1c4y1_76",pB="_card_1c4y1_67",mB="_cardHeader_1c4y1_107",hB="_cardStatusIcon_1c4y1_113",gB="_cardTitle_1c4y1_119",vB="_cardBadges_1c4y1_127",yB="_badge_1c4y1_134",bB="_blockedBadge_1c4y1_146",xB="_childBadge_1c4y1_151",_B="_depBadge_1c4y1_155",kB="_parentBadge_1c4y1_159",SB="_pausedSubBadge_1c4y1_166",TB="_personaBadge_1c4y1_170",jB="_envBadge_1c4y1_174",wB="_emptyCta_1c4y1_178",NB="_ctaButton_1c4y1_188",CB="_ctaDescription_1c4y1_204",tt={boardContainer:iB,column:oB,columnHeader:rB,columnIcon:lB,columnLabel:cB,columnCount:dB,cardList:uB,emptyPlaceholder:fB,card:pB,cardHeader:mB,cardStatusIcon:hB,cardTitle:gB,cardBadges:vB,badge:yB,blockedBadge:bB,childBadge:xB,depBadge:_B,parentBadge:kB,pausedSubBadge:SB,personaBadge:TB,envBadge:jB,emptyCta:wB,ctaButton:NB,ctaDescription:CB};function EB({workspaceId:t,environmentId:s,tasks:i,sessions:r,personas:c,environments:d}){const u=_t(),p=y.useMemo(()=>i.filter(b=>b.workspaceId===t),[i,t]),h=y.useMemo(()=>new Map(i.map(b=>[b.id,b.status])),[i]),g=y.useMemo(()=>new Map(p.map(b=>[b.id,b])),[p]),v=y.useMemo(()=>{const b=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])),w=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const E=b.get(C.latestSessionId);if(E){if(w.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:w,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,r,c,d]),x=y.useMemo(()=>aB({tasks:p,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,h,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:x.map(b=>o.jsxs("section",{className:tt.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[o.jsxs("div",{className:tt.columnHeader,children:[o.jsx("span",{className:tt.columnIcon,style:{color:b.style.color},children:b.style.icon}),o.jsx("span",{className:tt.columnLabel,children:b.label}),o.jsx("span",{className:tt.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),o.jsx("div",{className:tt.cardList,children:b.tasks.length===0?o.jsx("div",{className:tt.emptyPlaceholder,children:"No tasks"}):o.jsx(ls,{mode:"popLayout",children:b.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(AB,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>u(cs(k.task.id,void 0,t,s))})},k.task.id))})})]},b.status))})}function AB({boardTask:t,tasksById:s,personaName:i,envName:r,onClick:c}){const{task:d,isBlocked:u,childCount:p,doneChildCount:h,pausedSubBadge:g}=t,v=Ia(d.status),x=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:b=>{(b.key==="Enter"||b.key===" ")&&(b.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:[x&&o.jsx("span",{className:`${tt.badge} ${tt.parentBadge}`,title:x.title,children:x.title}),p>0&&o.jsxs("span",{className:`${tt.badge} ${tt.childBadge}`,children:[h,"/",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 DB="_formContent_ymnez_1",RB="_section_ymnez_13",MB="_label_ymnez_19",IB="_titleInput_ymnez_26",OB="_descriptionTextarea_ymnez_58",LB="_selectField_ymnez_94",BB="_checkboxRow_ymnez_128",zB="_checkboxLabel_ymnez_141",UB="_fieldError_ymnez_146",yt={formContent:DB,section:RB,label:MB,titleInput:IB,descriptionTextarea:OB,selectField:LB,checkboxRow:BB,checkboxLabel:zB,fieldError:UB};function $B(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 PB=100;function VB({values:t,onChange:s,environments:i,personas:r,errors:c,disabled:d,autoFocusName:u}){const p=(h,g)=>{s({...t,[h]: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:h=>p("name",h.target.value),placeholder:"Workspace name",maxLength:PB,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:h=>p("description",h.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:h=>p("repoUrl",h.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:h=>p("environmentId",h.target.value),disabled:d,"data-testid":"workspace-form-environment",children:[o.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>o.jsx("option",{value:h.id,children:h.displayName||h.id},h.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:h=>p("defaultPersonaId",h.target.value),disabled:d,"data-testid":"workspace-form-persona",children:[o.jsx("option",{value:"",children:"(Inherit)"}),r.map(h=>o.jsx("option",{value:h.id,children:h.name},h.id))]})]}),o.jsx("div",{className:yt.section,children:o.jsxs("label",{className:yt.checkboxRow,children:[o.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:h=>p("useWorktrees",h.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:h=>p("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:d,"data-testid":"workspace-form-workdir"})]})]})}const x1=y.createContext(void 0),HB=4e3;function qB({children:t}){const[s,i]=y.useState([]),r=y.useRef(0),c=y.useCallback(u=>{i(p=>p.filter(h=>h.id!==u))},[]),d=y.useCallback((u,p="info",h=HB)=>{const g=`toast-${++r.current}`;i(v=>[...v,{id:g,message:u,variant:p,duration:h}])},[]);return o.jsx(x1.Provider,{value:{toasts:s,showToast:d,dismissToast:c},children:t})}function yn(){const t=y.useContext(x1);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Fp="grackle-theme",_1="grackle-prefer-system",k1="(prefers-color-scheme: dark)";let Ir=[],qc;function fp(){qc=void 0;for(const t of Ir)t()}function Zp(){return typeof window>"u"?!1:window.matchMedia(k1).matches}function $r(){if(typeof localStorage>"u")return Ib;try{const t=localStorage.getItem(Fp);if(t!==null&&v1.has(t))return t}catch{}return Ib}function ad(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(_1)==="true"}catch{return!1}}function Kp(t){return bd.find(s=>s.variantLightId===t||s.variantDarkId===t)}function S1(t,s){const i=Gp(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?Zp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const r=Kp(t);if(r!=null&&r.variantLightId&&r.variantDarkId)return Zp()?r.variantDarkId:r.variantLightId}return t}function go(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=S1(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&go($r(),ad());function GB(){return qc===void 0&&(qc={themeId:$r(),systemDark:Zp(),preferSystem:ad()}),qc}function FB(t){return Ir=[...Ir,t],()=>{Ir=Ir.filter(s=>s!==t)}}function ZB(){const t=y.useSyncExternalStore(FB,GB),{themeId:s,preferSystem:i}=t,r=S1(s,i),c=y.useCallback(u=>{if(v1.has(u)){try{localStorage.setItem(Fp,u)}catch{}go(u,ad(),!0),fp()}},[]),d=y.useCallback(u=>{try{localStorage.setItem(_1,u?"true":"false")}catch{}if(u){const p=$r(),h=Gp(p);if(h!=null&&h.hidden){const g=Kp(p);if(g)try{localStorage.setItem(Fp,g.id)}catch{}}}go($r(),u,!0),fp()},[]);return y.useEffect(()=>{go(s,i)},[s,i]),y.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia(k1),p=()=>{const h=$r(),g=ad();if(g){const v=Gp(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&go(h,g),v!=null&&v.hidden){const x=Kp(h);x!=null&&x.variantDarkId&&x.variantLightId&&go(h,g)}}fp()};return u.addEventListener("change",p),()=>{u.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:r,preferSystem:i,setPreferSystem:d}}const T1=y.createContext(void 0);function KB({children:t}){const s=ZB();return o.jsx(T1.Provider,{value:s,children:t})}function j1(){const t=y.useContext(T1);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const w1=y.createContext(void 0),N1=y.createContext(void 0);function YB({children:t}){const[s,i]=y.useState(void 0),r=y.useCallback(c=>{i(c)},[]);return o.jsx(N1.Provider,{value:r,children:o.jsx(w1.Provider,{value:s,children:t})})}function JB(){return y.useContext(w1)}function WB(){const t=y.useContext(N1);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Fm=y.createContext(void 0);function lt(){const t=y.useContext(Fm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function C1(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function E1(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function XB(t){return C1(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 QB=new Set(["off","subscription","api_key"]),Ac=new Set(["off","on"]);function e8(t){return C1(t)&&QB.has(t.claude)&&Ac.has(t.github)&&Ac.has(t.copilot)&&Ac.has(t.codex)&&Ac.has(t.goose)}function A1(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 D1(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 t8(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 n8(t){return t?[Qs,{label:"Settings",url:So},{label:t,url:void 0}]:[Qs,{label:"Settings",url:void 0}]}const Zm={label:"Environments",url:To};function s8(){return[Qs,{label:"Environments",url:void 0}]}function a8(){return[Qs,{label:"New Chat",url:void 0}]}function i8(t){return[Qs,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function o8(t,s,i,r){const c=i.find(u=>u.id===t),d=r.find(u=>u.id===s);return[Qs,Zm,{label:(d==null?void 0:d.displayName)??"Environment",url:yi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function r8(t,s,i,r,c){const d=t8(t,c),u=c.get(t),p=u==null?void 0:u.workspaceId,h=p?i.find(k=>k.id===p):void 0,g=s??(h==null?void 0:h.environmentId),v=g?r.find(k=>k.id===g):void 0,x=[Qs];v&&g&&(x.push(Zm),x.push({label:v.displayName,url:yi(g)})),h&&g&&x.push({label:h.name,url:vi(h.id,g)});for(let k=0;k<d.length-1;k++)x.push({label:d[k].title,url:cs(d[k].id,void 0,p,g)});const b=d[d.length-1];return x.push({label:(b==null?void 0:b.title)??t,url:void 0}),x}const l8={label:"Findings",url:fd};function c8(){return[Qs,{label:"Findings",url:void 0}]}function R1(t,s,i,r,c){const d=[Qs];if(s&&i){const u=r.find(h=>h.id===s),p=c.find(h=>h.id===i);d.push(Zm),p&&d.push({label:p.displayName,url:yi(i)}),u&&d.push({label:u.name,url:vi(s,i)}),d.push({label:"Findings",url:Ww(s,i)})}else d.push(l8);return d.push({label:t,url:void 0}),d}function Km(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 Dc(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 d8(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 Ym(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 x=s.get(v),b=x?Dc(x):void 0;if(b)try{const k=JSON.parse(v.content);i.set(b,{tool:k.tool,args:k.args})}catch{}}const r=new Set,c=new Set,d=t.map((v,x)=>{if(v.eventType!=="tool_result")return v;const b=s.get(v),k=b?d8(b):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;r.add(k),c.add(x);let w;const N=v.content.trim();if(N.startsWith("{"))try{const T=JSON.parse(N);typeof T.detailedContent=="string"&&(w=T.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:w}}}),u=[];for(let v=0;v<d.length;v++){if(d[v].eventType!=="tool_use")continue;const x=s.get(d[v]),b=x?Dc(x):void 0;b&&r.has(b)||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 h=0;for(const v of u){for(;h<p.length&&p[h]<v;)h++;if(h>=p.length)break;const x=p[h];if(x!==v+1)continue;const b=d[v],k=d[x];let S;try{const w=JSON.parse(b.content);S={tool:w.tool,args:w.args}}catch{}if(S){let w;const N=k.content.trim();if(N.startsWith("{"))try{const E=JSON.parse(N);typeof E.detailedContent=="string"&&(w=E.detailedContent)}catch{}d[x]={...k,toolUseCtx:{...S,detailedResult:w}},c.add(x);const T=s.get(b),C=T?Dc(T):void 0;C?r.add(C):(r.add(`__seq_${v}`),s.set(b,{...T??{},__seqId:`__seq_${v}`})),h++}}const g=d.filter(v=>{if(v.eventType!=="tool_use")return!0;const x=s.get(v);if(!x)return!0;const b=Dc(x);if(b&&r.has(b))return!1;const k=x.__seqId;return!(k&&r.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let x=!1;for(let b=v+1;b<g.length;b++)if(g[b].eventType!=="tool_use"){x=!0;break}x&&(g[v]={...g[v],settled:!0})}return g}function u8(t,s,i){const r=t.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=M1(s),d=s.filter(h=>Yp(h,c)).length,u=s.filter(h=>h.status==="paused"||h.status==="failed"||Yp(h,c)).length,p=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:r,blockedTasks:d,attentionTasks:u,unhealthyEnvironments:p}}function M1(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function Yp(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function f8(t,s){var u;const i=new Map;for(const p of s)i.set(p.id,p);const r=M1(t),c=[];for(const p of t){const h=p.workspaceId?((u=i.get(p.workspaceId))==null?void 0:u.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:h}):Yp(p,r)?c.push({task:p,reason:"blocked",workspaceName:h}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:h})}const d={failed:0,blocked:1,paused:2};return c.sort((p,h)=>(d[p.reason]??3)-(d[h.reason]??3)),c}function p8(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 m8(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"}],h8=new Map(vs.map(t=>[t.id,t]));function pp(t){const s=h8.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Lb={"kn-auth-flow":{node:pp("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:pp("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:pp("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"}]}},g8=[{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}],v8=[{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}],y8=[{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"}],b8=[{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"}],x8=[{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:""}],Rc=[{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"}],_8=[{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:""}],k8=[{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:[]}],S8={"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 Bb=[{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"}}]}],zb=400;function T8({children:t}){const[s,i]=y.useState(g8),[r,c]=y.useState(v8),[d,u]=y.useState(y8),[p,h]=y.useState(void 0),[g,v]=y.useState(b8),[x,b]=y.useState(x8),[k,S]=y.useState(Rc),[w,N]=y.useState(void 0),T=!1,[C,E]=y.useState(_8),[D,A]=y.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[B,R]=y.useState(k8),[U]=y.useState(S8),[K,ne]=y.useState(""),[F,ee]=y.useState(vs),[ae,X]=y.useState(Ca),[re,O]=y.useState(void 0),[G,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(x);ye.current=x;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=Bb[Ne.current%Bb.length];return Ne.current+=1,P},[]),ie=y.useCallback((P,te,le)=>{const pe=setTimeout(()=>{var he;Oe.current.delete(pe),le&&((he=fe.current.get(le))==null||he.delete(pe)),P()},te);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 te=fe.current.get(P);te&&(te.forEach(le=>{clearTimeout(le),Oe.current.delete(le)}),fe.current.delete(P))},[]),ct=y.useCallback((P,te,le)=>{c(pe=>pe.map(he=>he.id===P?{...he,status:te,...le!==void 0?{endReason:le}:{}}:he))},[]),Le=y.useCallback(P=>{u(te=>[...te,P])},[]),$t=y.useCallback((P,te,le)=>{te.forEach((pe,he)=>{ie(()=>{const $e={sessionId:P,...pe.event,timestamp:new Date().toISOString()};if(Le($e),pe.event.eventType==="status"){const ke=A1(pe.event.content),Re=D1(pe.event.content);ct(P,ke,Re)}he===te.length-1&&le&&le()},pe.delayMs,P)})},[ie,Le,ct]),dt=y.useCallback(async(P,te,le,pe)=>{console.log("[MockGrackle] spawn",{environmentId:P,prompt:te,runtime:pe});const he=pt("sess"),$e={id:he,environmentId:P,runtime:pe||"claude-code",status:"running",prompt:te,startedAt:new Date().toISOString()};c(Re=>[...Re,$e]),h(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+zb,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"}),b(te=>te.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"}),b(te=>te.map(le=>le.latestSessionId===P&&le.status==="working"?{...le,status:"not_started"}:le))},[W,ct,Le]),xn=y.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),Ss=y.useCallback(async P=>{console.log("[MockGrackle] loadSessionEvents",P)},[]),us=y.useCallback(()=>{console.log("[MockGrackle] clearEvents"),u([])},[]),ji=y.useCallback(async(P,te,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createWorkspace",{name:P,description:te});const ut={id:pt("proj"),name:P,description:te||"",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]),Jn=y.useCallback(async P=>{console.log("[MockGrackle] archiveWorkspace",P),v(te=>te.map(le=>le.id===P?{...le,status:"archived"}:le))},[]),xe=y.useCallback(async P=>{console.log("[MockGrackle] loadTasks",P)},[]),Qe=y.useCallback(async(P,te,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createTask",{workspaceId:P,title:te,parentTaskId:he}),b(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:te,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,te,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]),b(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+zb,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"?b(Kt=>Kt.map(At=>At.id===P&&At.status==="working"?{...At,status:"paused"}:At)):Pt==="failed"&&b(Kt=>Kt.map(At=>At.id===P&&At.status==="working"?{...At,status:"failed"}:At))},Ke+100,ke)}},[pt,bn,$t,ie,ct,Le]),_n=y.useCallback(async(P,te)=>{console.log("[MockGrackle] sendInput",{sessionId:P,text:te}),Le({sessionId:P,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${te}`}),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(()=>{b(he=>he.map($e=>$e.id===pe.taskId&&$e.status==="working"?{...$e,status:"paused"}:$e))},pe.delayAfterResume,P))},[Le,ct,$t,ie]),Mn=y.useCallback(async P=>{console.log("[MockGrackle] completeTask",P),b(te=>te.map(le=>le.id===P?{...le,status:"complete"}:le))},[]),wi=y.useCallback(async P=>{console.log("[MockGrackle] resumeTask",P)},[]),Pa=y.useCallback(async(P,te,le,pe,he)=>{console.log("[MockGrackle] updateTask",{taskId:P,title:te}),b($e=>$e.map(ke=>ke.id===P?{...ke,title:te.trim()||ke.title,description:le,dependsOn:pe,...he!==void 0?{defaultPersonaId:he}:{}}:ke))},[]),Ni=y.useCallback(async P=>{console.log("[MockGrackle] deleteTask",P),b(te=>te.filter(le=>le.id!==P))},[]),Ci=y.useCallback(async P=>{console.log("[MockGrackle] loadFindings",P),S(Rc.filter(te=>te.workspaceId===P))},[]),na=y.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),S([...Rc])},[]),tn=y.useCallback(async P=>{console.log("[MockGrackle] loadFinding",P);const te=Rc.find(le=>le.id===P);N(te)},[]),Wn=y.useCallback(async(P,te,le,pe,he)=>{console.log("[MockGrackle] postFinding",{workspaceId:P,title:te});const $e={id:pt("find"),workspaceId:P,taskId:"",sessionId:"",category:pe||"general",title:te,content:le,tags:he||[],createdAt:new Date().toISOString()};S(ke=>[...ke,$e])},[pt]),nn=y.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),ol=y.useCallback(async(P,te,le)=>{console.log("[MockGrackle] addEnvironment",{displayName:P,adapterType:te,adapterConfig:le})},[]),rl=y.useCallback(async(P,te)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:P,...te}),i(le=>le.map(pe=>pe.id!==P?pe:{...pe,...te.displayName!==void 0?{displayName:te.displayName}:{},...te.adapterConfig!==void 0?{adapterConfig:JSON.stringify(te.adapterConfig)}:{}}))},[]),ll=y.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),Va=y.useCallback(async(P,te,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(te=>te.filter(le=>le.name!==P))},[]),qa=y.useCallback(async P=>{console.log("[MockGrackle] updateCredentialProviders",P),A(P)},[]);y.useEffect(()=>()=>{Oe.current.forEach(clearTimeout),Oe.current.clear()},[]);const Ts=y.useMemo(()=>({connected:!0,environmentsLoading:!1,sessionsLoading:!1,workspacesLoading:!1,tasksLoading:!1,tokensLoading:!1,credentialsLoading:!1,personasLoading:!1,send:()=>{},environments:s,sessions:r,events:d,eventsDropped:0,lastSpawnedId:p,workspaces:g,tasks:x,findings:k,selectedFinding:w,findingLoading:T,findingsLoading:!1,tokens:C,credentialProviders:D,spawn:dt,sendInput:_n,kill:ta,stopGraceful:ks,refresh:xn,loadSessionEvents:Ss,clearEvents:us,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:ji,archiveWorkspace:Jn,updateWorkspace:async(P,te)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:P,...te}),v(le=>le.map(pe=>pe.id!==P?pe:{...pe,...te.name!==void 0?{name:te.name}:{},...te.description!==void 0?{description:te.description}:{},...te.repoUrl!==void 0?{repoUrl:te.repoUrl}:{},...te.environmentId!==void 0?{environmentId:te.environmentId}:{},...te.workingDirectory!==void 0?{workingDirectory:te.workingDirectory}:{},...te.useWorktrees!==void 0?{useWorktrees:te.useWorktrees}:{},...te.defaultPersonaId!==void 0?{defaultPersonaId:te.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},loadTasks:xe,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:Qe,startTask:on,stopTask:async P=>{console.log("[MockGrackle] stopTask",{taskId:P}),await Mn(P)},completeTask:Mn,resumeTask:wi,updateTask:Pa,deleteTask:Ni,loadFindings:Ci,loadAllFindings:na,loadFinding:tn,postFinding:Wn,loadEnvironments:nn,addEnvironment:ol,updateEnvironment:rl,loadTokens:ll,setToken:Va,deleteToken:Ha,updateCredentialProviders:qa,provisionStatus:{},environmentOperationError:"",clearEnvironmentOperationError:()=>{},provisionEnvironment:async(P,te)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},workspaceCreating:!1,taskStartingId:void 0,personas:B,createPersona:async(P,te,le,pe,he,$e,ke,Re,Ze)=>{console.log("[MockGrackle] createPersona",{name:P});const ut={id:`mock-persona-${Date.now()}`,name:P,description:te,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 R(Ke=>[...Ke,ut]),ut},updatePersona:async(P,te,le,pe,he,$e,ke,Re,Ze,ut)=>{console.log("[MockGrackle] updatePersona",{personaId:P,name:te});const Ke=B.find(At=>At.id===P);if(!Ke)throw new Error(`Persona not found: ${P}`);const Pt=new Date().toISOString(),Kt={...Ke,...te!==void 0?{name:te}:{},...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 R(At=>At.map(rn=>rn.id===P?Kt:rn)),Kt},deletePersona:async P=>{console.log("[MockGrackle] deletePersona",P),R(te=>te.filter(le=>le.id!==P))},taskSessions:U,loadTaskSessions:async P=>{console.log("[MockGrackle] loadTaskSessions",P)},appDefaultPersonaId:K,setAppDefaultPersonaId:async P=>{console.log("[MockGrackle] setAppDefaultPersonaId",P),ne(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,te)=>{console.log(`[MockGrackle] loadUsage(${P}, ${te})`)},knowledge:{graphData:{nodes:F,links:ae},selectedNode:re,loading:!1,selectedId:G,searchQuery:ue,search:async P=>{if(console.log("[MockGrackle] knowledge.search",P),!P.trim()){de(P);return}de(P);const te=Ge.current,le=te?vs.filter(ke=>!ke.workspaceId||ke.workspaceId===te):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))});ee(he);const $e=new Set(he.map(ke=>ke.id));X(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,te=P?vs.filter(pe=>!pe.workspaceId||pe.workspaceId===P):vs;ee(te);const le=new Set(te.map(pe=>pe.id));X(Ca.filter(pe=>le.has(pe.source)&&le.has(pe.target)))},selectNode:async P=>{console.log("[MockGrackle] knowledge.selectNode",P),se(P);const te=P in Lb?Lb[P]:void 0;if(te)O(te);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),ee(te=>{const le=new Set(te.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 te;const $e=vs.filter(Re=>he.has(Re.id)),ke=new Set([...le,...he]);return X(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}),[...te,...$e]})},loadRecent:async P=>{if(console.log("[MockGrackle] knowledge.loadRecent",P),Ge.current=P,P){const te=vs.filter(pe=>!pe.workspaceId||pe.workspaceId===P);ee(te);const le=new Set(te.map(pe=>pe.id));X(Ca.filter(pe=>le.has(pe.source)&&le.has(pe.target)))}else ee(vs),X(Ca);de("")},handleEvent:()=>!1}}),[s,r,d,p,g,x,k,w,C,D,B,U,K,F,ae,re,G,ue,dt,_n,ta,ks,xn,Ss,us,ji,Jn,xe,Qe,on,Mn,wi,Pa,Ni,Ci,na,tn,Wn,nn,ol,rl,ll,Va,Ha,qa]);return o.jsx(Fm.Provider,{value:Ts,children:t})}const j8=3e3;function w8(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,h;async function g(){var v,x;if(!p){try{const b=Te.streamEvents({});i(!0),Promise.resolve((v=d.current)==null?void 0:v.call(d)).catch(()=>{});for await(const k of b){if(p)break;const S=k.event;if(S.case==="sessionEvent"){const w=S.value;r.current({sessionId:w.sessionId,type:w.type,timestamp:w.timestamp,content:w.content,raw:w.raw})}else if(S.case==="domainEvent"){const w=S.value;c.current({id:w.id,type:w.type,timestamp:w.timestamp,payloadJson:w.payloadJson})}}}catch(b){if(b instanceof Wr&&b.code===rT.Unauthenticated){window.location.href=Kw;return}}p||(i(!1),(x=u.current)==null||x.call(u),h=setTimeout(()=>{g().catch(()=>{})},j8))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function N8(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Ub(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 C8(t){return{sessionId:t.sessionId,eventType:tx(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function E8(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:lT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function $b(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:cT(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 mp(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 A8(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function D8(t){return{claude:dT(t.claude),github:_c(t.github),copilot:_c(t.copilot),codex:_c(t.codex),goose:_c(t.goose)}}function R8(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function hp(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 M8(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Mc(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 gp(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 Pb=5e3;function Ar(t){return t instanceof Wr?t.message:"Operation failed"}function I8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState({}),[u,p]=y.useState(""),h=y.useCallback(()=>{p("")},[]),g=y.useCallback(async()=>{try{const T=await r(Te.listEnvironments({}));s(T.environments.map(N8))}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 E1("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 A={...D};return delete A[E],A})},Pb)}return!0}default:return!1}},[g]),x=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},[]),b=y.useCallback(async(T,C,E)=>{p("");try{await Te.addEnvironment({displayName:T,adapterType:C,adapterConfig:JSON.stringify(E??{})})}catch(D){p(Ar(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(Ar(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(A=>({...A,[T]:{stage:D.stage,message:D.message,progress:D.progress}})),D.stage==="ready"&&setTimeout(()=>{d(A=>{const B={...A};return delete B[T],B})},Pb)}catch(E){d(D=>{const A={...D};return delete A[T],A}),p(Ar(E))}},[]),w=y.useCallback(async T=>{p("");try{await Te.stopEnvironment({id:T})}catch(C){p(Ar(C))}},[]),N=y.useCallback(async T=>{p("");try{await Te.removeEnvironment({id:T})}catch(C){p(Ar(C))}},[]);return{environments:t,environmentsLoading:i,provisionStatus:c,operationError:u,clearOperationError:h,loadEnvironments:g,addEnvironment:b,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:w,removeEnvironment:N,handleEvent:v,handleLegacyMessage:x}}const vp=new Set(["pending","running","idle"]),O8=new Set(["completed","failed","interrupted","hibernating","suspended"]),Vb=["pending","running","idle"];function L8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState([]),[u,p]=y.useState(0),[h,g]=y.useState(void 0),[v,x]=y.useState({}),b=y.useCallback(async()=>{try{const U=(await r(Te.listSessions({}))).sessions.map(Ub);s(K=>{const ne=new Map(K.map(F=>[F.id,F]));return U.map(F=>{const ee=ne.get(F.id),ae=ee==null?void 0:ee.status;return!ae||ae===F.status?F:O8.has(ae)&&vp.has(F.status)?{...F,status:ae,...ee.endReason!==void 0?{endReason:ee.endReason}:{}}:vp.has(ae)&&vp.has(F.status)&&Vb.indexOf(ae)>Vb.indexOf(F.status)?{...F,status:ae}:F})})}catch{}},[r]),k=y.useCallback(R=>{if(R.type!=="session_event")return!1;if(!XB(R.payload))return E1("session_event","payload is not a valid SessionEvent"),!0;const U=R.payload;let K=0;if(d(ne=>{const F=[...ne,U];return F.length>ho?(K=F.length-ho,F.slice(-ho)):F}),K>0&&p(ne=>ne+K),U.eventType==="usage")try{const ne=JSON.parse(U.content),F=Number(ne.input_tokens)||0,ee=Number(ne.output_tokens)||0,ae=Number(ne.cost_usd)||0;(F>0||ee>0||ae>0)&&s(X=>X.map(re=>re.id===U.sessionId?{...re,inputTokens:(re.inputTokens??0)+F,outputTokens:(re.outputTokens??0)+ee,costUsd:(re.costUsd??0)+ae}:re))}catch{}if(U.eventType==="status"){const ne=A1(U.content),F=D1(U.content);s(ee=>ee.some(X=>X.id===U.sessionId)?ee.map(X=>X.id===U.sessionId?{...X,status:ne,...F!==void 0?{endReason:F}:{}}:X):[...ee,{id:U.sessionId,environmentId:"",runtime:"",status:ne,prompt:"",startedAt:U.timestamp,...F!==void 0?{endReason:F}:{}}])}return!0},[]),S=y.useCallback(R=>{k({type:"session_event",payload:R})},[k]),w=y.useCallback(R=>{var U,K,ne,F,ee;switch(R.type){case"sessions":{const ae=Array.isArray((U=R.payload)==null?void 0:U.sessions)?R.payload.sessions:[];return s(ae),!0}case"spawned":{const ae=(K=R.payload)==null?void 0:K.sessionId;return typeof ae=="string"&&ae&&g(ae),b().catch(()=>{}),!0}case"session_events":{const ae=Array.isArray((ne=R.payload)==null?void 0:ne.events)?R.payload.events:[];return ae.length>0&&d(ae),!0}case"task_sessions":{const ae=(F=R.payload)==null?void 0:F.taskId;if(typeof ae=="string"&&ae){const X=Array.isArray((ee=R.payload)==null?void 0:ee.sessions)?R.payload.sessions:[];x(re=>({...re,[ae]:X}))}return!0}default:return!1}},[b]),N=y.useCallback(async(R,U,K,ne)=>{try{const F=await Te.spawnAgent({environmentId:R,prompt:U,personaId:K||"",workingDirectory:ne||""});g(F.id),await b()}catch{}},[b]),T=y.useCallback(async(R,U)=>{try{await Te.sendInput({sessionId:R,text:U})}catch{}},[]),C=y.useCallback(async R=>{try{await Te.killAgent({id:R,graceful:!1})}catch{}},[]),E=y.useCallback(async R=>{try{await Te.killAgent({id:R,graceful:!0})}catch{}},[]),D=y.useCallback(async R=>{try{const K=(await Te.getSessionEvents({id:R})).events.map(C8);if(K.length>0){let ne=0;d(F=>{const ee=new Set;for(const re of F)re.sessionId===R&&ee.add(`${re.timestamp}|${re.eventType}`);const ae=K.filter(re=>!ee.has(`${re.timestamp}|${re.eventType}`)),X=[...F,...ae].sort((re,O)=>re.sessionId!==O.sessionId?0:re.timestamp.localeCompare(O.timestamp));return X.length>ho?(ne=X.length-ho,X.slice(-ho)):X}),ne>0&&p(F=>F+ne)}}catch{}},[]),A=y.useCallback(()=>{d([]),p(0)},[]),B=y.useCallback(async R=>{try{const K=(await Te.getTaskSessions({id:R})).sessions.map(Ub);x(ne=>({...ne,[R]:K}))}catch{}},[]);return{sessions:t,sessionsLoading:i,events:c,eventsDropped:u,lastSpawnedId:h,taskSessions:v,loadSessions:b,spawn:N,sendInput:T,kill:C,stopGraceful:E,loadSessionEvents:D,clearEvents:A,loadTaskSessions:B,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:w}}function B8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),[c,d]=y.useState(!1),u=y.useCallback(async()=>{try{const b=await r(Te.listWorkspaces({}));s(b.workspaces.map(E8))}catch{}},[r]),p=y.useCallback(b=>{switch(b.type){case"workspace.created":return d(!1),u().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return u().catch(()=>{}),!0;default:return!1}},[u]),h=y.useCallback(()=>{d(!1)},[]),g=y.useCallback(async(b,k,S,w,N,T,C,E,D)=>{d(!0);try{await Te.createWorkspace({name:b,description:k||"",repoUrl:S||"",environmentId:w||"",defaultPersonaId:N||void 0,useWorktrees:T??!0,workingDirectory:C||void 0}),d(!1),E==null||E()}catch(A){d(!1);const B=A instanceof Wr?A.message:"Failed to create workspace";D==null||D(B)}},[]),v=y.useCallback(async b=>{try{await Te.archiveWorkspace({id:b})}catch{}},[]),x=y.useCallback(async(b,k)=>{try{await Te.updateWorkspace({id:b,...k})}catch{}},[]);return{workspaces:t,workspacesLoading:i,workspaceCreating:c,loadWorkspaces:u,createWorkspace:g,archiveWorkspace:v,updateWorkspace:x,handleEvent:p,onDisconnect:h}}function z8(){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 B=(await Te.listTasks({workspaceId:D})).tasks.map($b);s(R=>[...R.filter(U=>U.workspaceId!==D),...B])}catch{}},[]),h=y.useCallback(async()=>{try{const A=(await r(Te.listTasks({}))).tasks.map($b);s(B=>{const R=new Set(A.map(U=>U.id));return[...B.filter(U=>!R.has(U.id)),...A]})}catch{}},[r]),g=y.useCallback((D,A)=>{const B=R=>{clearTimeout(u.current[R]),u.current[R]=setTimeout(()=>{delete u.current[R],p(R).catch(()=>{})},200)};D?B(D):A&&s(R=>{const U=R.find(K=>K.id===A);return U!=null&&U.workspaceId?B(U.workspaceId):h().catch(()=>{}),R})},[p,h]),v=y.useCallback(D=>{const A=D.payload;switch(D.type){case"task.created":{const B=typeof A.workspaceId=="string"?A.workspaceId:"";return B&&p(B).catch(()=>{}),!0}case"task.started":{const B=typeof A.taskId=="string"?A.taskId:"",R=typeof A.sessionId=="string"?A.sessionId:"",U=typeof A.workspaceId=="string"?A.workspaceId:"";return d(K=>B&&K===B?void 0:K),R&&B&&s(K=>K.map(ne=>ne.id===B?{...ne,latestSessionId:R}:ne)),g(U,B),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const B=typeof A.workspaceId=="string"?A.workspaceId:"",R=typeof A.taskId=="string"?A.taskId:"";return g(B,R),!0}default:return!1}},[p,g]),x=y.useCallback(()=>{d(void 0)},[]),b=y.useCallback(D=>{var A,B;if(D.type==="tasks"){const R=Array.isArray((A=D.payload)==null?void 0:A.tasks)?D.payload.tasks:[],U=typeof((B=D.payload)==null?void 0:B.workspaceId)=="string"&&D.payload.workspaceId?D.payload.workspaceId:"";return s(U?K=>[...K.filter(ne=>ne.workspaceId!==U),...R]:K=>{const ne=new Set(R.map(F=>F.id));return[...K.filter(F=>!ne.has(F.id)),...R]}),!0}return!1},[]),k=y.useCallback(async(D,A,B,R,U,K,ne,F,ee)=>{try{await Te.createTask({workspaceId:D,title:A,description:B||"",dependsOn:R||[],parentTaskId:U||"",defaultPersonaId:K||void 0,canDecompose:ne??void 0}),F==null||F()}catch(ae){const X=ae instanceof Wr?ae.message:"Failed to create task";ee==null||ee(X)}},[]),S=y.useCallback(async(D,A,B,R)=>{d(D);try{await Te.startTask({taskId:D,personaId:A||"",environmentId:B||"",notes:R||""})}catch{d(void 0)}},[]),w=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,A,B,R,U)=>{try{await Te.updateTask({id:D,title:A,description:B,dependsOn:R,...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:h,createTask:k,startTask:S,stopTask:w,completeTask:N,resumeTask:T,updateTask:C,deleteTask:E,handleEvent:v,onDisconnect:x,handleLegacyMessage:b}}function U8(){const[t,s]=y.useState([]),[i,r]=y.useState(void 0),[c,d]=y.useState(!1),{loading:u,track:p}=$a(),h=y.useCallback(async k=>{try{const S=await p(Te.queryFindings({workspaceId:k}));s(S.findings.map(mp))}catch{}},[p]),g=y.useCallback(async()=>{try{const k=await p(Te.queryFindings({workspaceId:""}));s(k.findings.map(mp))}catch{}},[p]),v=y.useCallback(async k=>{r(void 0),d(!0);try{const S=await Te.getFinding({id:k});r(mp(S))}catch{r(void 0)}finally{d(!1)}},[]),x=y.useCallback(k=>{if(k.type==="finding.posted"){const S=typeof k.payload.workspaceId=="string"?k.payload.workspaceId:"";return S&&h(S).catch(()=>{}),!0}return!1},[h]),b=y.useCallback(async(k,S,w,N,T)=>{try{await Te.postFinding({workspaceId:k,title:S,content:w,category:N??"general",tags:T??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,findingsLoading:u,loadFindings:h,loadAllFindings:g,loadFinding:v,postFinding:b,handleEvent:x}}function $8(){const[t,s]=y.useState([]),{loading:i,track:r}=$a(),c=y.useCallback(async()=>{try{const h=await r(Te.listTokens({}));s(h.tokens.map(A8))}catch{}},[r]),d=y.useCallback(h=>h.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),u=y.useCallback(async(h,g,v,x,b)=>{try{await Te.setToken({name:h,value:g,type:v,envVar:x,filePath:b})}catch{}},[]),p=y.useCallback(async h=>{try{await Te.deleteToken({name:h})}catch{}},[]);return{tokens:t,tokensLoading:i,loadTokens:c,setToken:u,deleteToken:p,handleEvent:d}}function P8(){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(D8(p))}catch{}},[r]),d=y.useCallback(p=>p.type==="credential.providers_changed"?(e8(p.payload)&&s(p.payload),!0):!1,[]),u=y.useCallback(async p=>{const h=[{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(h.map(({provider:g,value:v})=>Te.setCredentialProvider({provider:g,value:v})))},[]);return{credentialProviders:t,credentialsLoading:i,loadCredentials:c,updateCredentialProviders:u,handleEvent:d}}function V8(){const[t,s]=y.useState([]),[i,r]=y.useState(""),[c,d]=y.useState(""),[u,p]=y.useState(!1),h=y.useCallback(async()=>{try{const v=await Te.listCodespaces({});s(v.codespaces.map(R8)),d(v.error)}catch{}},[]),g=y.useCallback(async(v,x)=>{p(!0),r("");try{await Te.createCodespace({repo:v,machine:x??""}),p(!1),await h()}catch(b){p(!1);const k=b instanceof Wr?b.message:"Failed to create codespace";r(k)}},[h]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:u,listCodespaces:h,createCodespace:g}}function H8(){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(hp))}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,x,b,k,S,w,N,T)=>{const C=await Te.createPersona({name:g,description:v,systemPrompt:x,runtime:b||"",model:k||"",maxTurns:S||0,type:w||"agent",script:N||"",allowedMcpTools:T||[]}),E=hp(C);return s(D=>[...D.filter(A=>A.id!==E.id),E]),E},[]),p=y.useCallback(async(g,v,x,b,k,S,w,N,T,C)=>{const E={id:g};v!==void 0&&(E.name=v),x!==void 0&&(E.description=x),b!==void 0&&(E.systemPrompt=b),k!==void 0&&(E.runtime=k),S!==void 0&&(E.model=S),w!==void 0&&(E.maxTurns=w),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),A=hp(D);return s(B=>B.map(R=>R.id===A.id?A:R)),A},[]),h=y.useCallback(async g=>{await Te.deletePersona({id:g}),s(v=>v.filter(x=>x.id!==g))},[]);return{personas:t,personasLoading:i,loadPersonas:c,createPersona:u,updatePersona:p,deletePersona:h,handleEvent:d}}function q8(t){if(t)try{return JSON.parse(t)}catch{return}}function G8(){const[t,s]=y.useState(new Map),[i,r]=y.useState([]),[c,d]=y.useState(void 0),[u,p]=y.useState(void 0),[h,g]=y.useState(!1),[v,x]=y.useState(""),b=y.useRef(""),k=y.useCallback(async D=>{const A=D??"";b.current=A,x(""),g(!0);try{const B=await Te.listRecentKnowledgeNodes({limit:30,workspaceId:A}),R=new Map,U=[];for(const K of B.nodes)R.set(K.id,Mc(K));for(const K of B.edges)U.push(gp(K));for(const K of U){const ne=R.get(K.source);ne&&(ne.val+=1);const F=R.get(K.target);F&&(F.val+=1)}s(R),r(U)}catch{}finally{g(!1)}},[]),S=y.useCallback(async D=>{if(D.trim()){x(D),p(void 0),d(void 0),g(!0);try{const A=await Te.searchKnowledge({query:D,limit:20,workspaceId:b.current}),B=new Map,R=[];for(const U of A.results){U.node&&B.set(U.node.id,Mc(U.node,U.edges.length));for(const K of U.edges)R.push(gp(K))}s(B),r(R)}catch{}finally{g(!1)}}},[]),w=y.useCallback(()=>{k(b.current).catch(()=>{})},[k]),N=y.useCallback(async D=>{p(D);try{const A=await Te.getKnowledgeNode({id:D});if(!A.node){d(void 0);return}d({node:Mc(A.node,A.edges.length),edges:A.edges.map(B=>({fromId:B.fromId,toId:B.toId,type:B.type,metadata:q8(B.metadataJson)}))})}catch{d(void 0)}},[]),T=y.useCallback(()=>{p(void 0),d(void 0)},[]),C=y.useCallback(async D=>{try{const A=await Te.expandKnowledgeNode({id:D,depth:1});s(B=>{const R=new Map(B);for(const U of A.nodes)R.has(U.id)||R.set(U.id,Mc(U));return R}),r(B=>{const R=new Set(B.map(K=>`${K.source}:${K.target}:${K.type}`)),U=[];for(const K of A.edges){const ne=gp(K),F=`${ne.source}:${ne.target}:${ne.type}`;R.has(F)||U.push(ne)}return[...B,...U]})}catch{}},[]),E=y.useCallback(D=>!1,[]);return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:u,loading:h,searchQuery:v,search:S,clearSearch:w,selectNode:N,clearSelection:T,expandNode:C,loadRecent:k,handleEvent:E}}function F8(){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 Z8(){const[t,s]=y.useState(""),[i,r]=y.useState(void 0),[c,d]=y.useState({}),u=I8(),p=L8(),h=B8(),g=z8(),v=U8(),x=$8(),b=P8(),k=V8(),S=H8(),w=G8(),N=F8(),{connected:T}=w8({onSessionEvent:F=>{p.handleSessionEvent({sessionId:F.sessionId,eventType:tx(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const ee=JSON.parse(F.payloadJson);R({id:F.id,type:F.type,timestamp:F.timestamp,payload:ee})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onConnect:U,onDisconnect:K}),C="default_persona_id",E="onboarding_completed",D=y.useCallback(async F=>{const ee=await Te.setSetting({key:C,value:F});s(ee.value)},[]),A=y.useCallback(async()=>{r(!0);try{await Te.setSetting({key:E,value:"true"})}catch{}},[]),B=y.useCallback(async(F,ee)=>{try{const ae=await Te.getUsage({scope:F,id:ee}),X=`${F}:${ee}`;d(re=>({...re,[X]:M8(ae)}))}catch{}},[]);function R(F){const ee=F.payload.key,ae=F.payload.value;if(F.type==="setting.changed"){ee===C&&s(ae??""),ee===E&&r(ae==="true");return}if(u.handleEvent(F)){(F.type==="environment.removed"||F.type==="environment.changed")&&p.loadSessions().catch(()=>{});return}if(!h.handleEvent(F)){if(g.handleEvent(F)){F.type==="task.started"&&p.loadSessions().catch(()=>{});return}v.handleEvent(F)||x.handleEvent(F)||b.handleEvent(F)||S.handleEvent(F)||w.handleEvent(F)||N.handleEvent(F)}}async function U(){u.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),x.loadTokens().catch(()=>{}),b.loadCredentials().catch(()=>{}),S.loadPersonas().catch(()=>{}),g.loadAllTasks().catch(()=>{});try{const F=await Te.getSetting({key:C});s(F.value)}catch{}try{const F=await Te.getSetting({key:E});r(F.value==="true")}catch{}}function K(){h.onDisconnect(),g.onDisconnect()}const ne=y.useCallback(()=>{u.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),x.loadTokens().catch(()=>{})},[u.loadEnvironments,p.loadSessions,h.loadWorkspaces,x.loadTokens]);return{connected:T,environmentsLoading:u.environmentsLoading,sessionsLoading:p.sessionsLoading,workspacesLoading:h.workspacesLoading,tasksLoading:g.tasksLoading,tokensLoading:x.tokensLoading,credentialsLoading:b.credentialsLoading,personasLoading:S.personasLoading,environments:u.environments,sessions:p.sessions,events:p.events,eventsDropped:p.eventsDropped,lastSpawnedId:p.lastSpawnedId,workspaces:h.workspaces,tasks:g.tasks,findings:v.findings,selectedFinding:v.selectedFinding,findingLoading:v.findingLoading,findingsLoading:v.findingsLoading,tokens:x.tokens,spawn:p.spawn,sendInput:p.sendInput,kill:p.kill,stopGraceful:p.stopGraceful,refresh:ne,loadSessionEvents:p.loadSessionEvents,clearEvents:p.clearEvents,loadWorkspaces:h.loadWorkspaces,createWorkspace:h.createWorkspace,archiveWorkspace:h.archiveWorkspace,updateWorkspace:h.updateWorkspace,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,loadFindings:v.loadFindings,loadAllFindings:v.loadAllFindings,loadFinding:v.loadFinding,postFinding:v.postFinding,loadEnvironments:u.loadEnvironments,addEnvironment:u.addEnvironment,updateEnvironment:u.updateEnvironment,loadTokens:x.loadTokens,setToken:x.setToken,deleteToken:x.deleteToken,credentialProviders:b.credentialProviders,updateCredentialProviders:b.updateCredentialProviders,provisionStatus:u.provisionStatus,environmentOperationError:u.operationError,clearEnvironmentOperationError:u.clearOperationError,provisionEnvironment:u.provisionEnvironment,stopEnvironment:u.stopEnvironment,removeEnvironment:u.removeEnvironment,codespaces:k.codespaces,codespaceError:k.codespaceError,codespaceListError:k.codespaceListError,codespaceCreating:k.codespaceCreating,listCodespaces:k.listCodespaces,createCodespace:k.createCodespace,workspaceCreating:h.workspaceCreating,taskStartingId:g.taskStartingId,personas:S.personas,createPersona:S.createPersona,updatePersona:S.updatePersona,deletePersona:S.deletePersona,taskSessions:p.taskSessions,loadTaskSessions:p.loadTaskSessions,appDefaultPersonaId:t,setAppDefaultPersonaId:D,onboardingCompleted:i,completeOnboarding:A,usageCache:c,loadUsage:B,knowledge:w}}function K8({children:t}){const s=Z8();return o.jsx(Fm.Provider,{value:s,children:t})}function Y8(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 J8(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 W8={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 X8(t){return W8[t]}function Q8(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=X8(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 ez(t,s){const i=y.useRef(void 0);y.useEffect(()=>{const r=i.current;i.current=t;const c=Q8(r,t);for(const d of c)s(d.message,d.variant)},[t,s])}const tz="_dashboard_16pzm_1",nz="_kpiStrip_16pzm_11",sz="_kpiCard_16pzm_23",az="_kpiValue_16pzm_68",iz="_kpiLabel_16pzm_76",oz="_bodyGrid_16pzm_84",rz="_section_16pzm_96",lz="_sectionHeader_16pzm_109",cz="_sectionIcon_16pzm_118",dz="_sectionTitle_16pzm_123",uz="_sectionCount_16pzm_131",fz="_sectionBody_16pzm_138",pz="_emptyHint_16pzm_143",mz="_sessionRow_16pzm_150",hz="_sessionPrompt_16pzm_177",gz="_sessionEnv_16pzm_186",vz="_sessionRuntime_16pzm_192",yz="_sessionStatus_16pzm_198",bz="_statusDot_16pzm_207",xz="_attentionRow_16pzm_233",_z="_attentionTitle_16pzm_259",kz="_attentionMeta_16pzm_267",Sz="_reasonBadge_16pzm_274",Tz="_bottomGrid_16pzm_301",jz="_envRow_16pzm_312",wz="_envName_16pzm_323",Nz="_envStatusBadge_16pzm_333",Cz="_workspaceRow_16pzm_369",Ez="_workspaceTop_16pzm_395",Az="_workspaceName_16pzm_401",Dz="_workspaceCounts_16pzm_407",Rz="_progressBar_16pzm_415",Mz="_progressFill_16pzm_422",ce={dashboard:tz,kpiStrip:nz,kpiCard:sz,kpiValue:az,kpiLabel:iz,bodyGrid:oz,section:rz,sectionHeader:lz,sectionIcon:cz,sectionTitle:dz,sectionCount:uz,sectionBody:fz,emptyHint:pz,sessionRow:mz,sessionPrompt:hz,sessionEnv:gz,sessionRuntime:vz,sessionStatus:yz,statusDot:bz,attentionRow:xz,attentionTitle:_z,attentionMeta:kz,reasonBadge:Sz,bottomGrid:Tz,envRow:jz,envName:wz,envStatusBadge:Nz,workspaceRow:Cz,workspaceTop:Ez,workspaceName:Az,workspaceCounts:Dz,progressBar:Rz,progressFill:Mz};function Iz(){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(_e,{width:"3rem",height:"2rem"}),o.jsx(_e,{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(_e,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(_e,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(_e,{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(_e,{width:"60%",height:"0.875rem"}),o.jsx(_e,{width:"4rem",height:"0.75rem"}),o.jsx(_e,{width:"3rem",height:"0.75rem"}),o.jsx(_e,{width:"3rem",height:"0.75rem"})]},s))})]}),o.jsxs("div",{className:ce.section,children:[o.jsxs("div",{className:ce.sectionHeader,children:[o.jsx(_e,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(_e,{width:"8rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(_e,{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(_e,{width:"3rem",height:"0.875rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"70%",height:"0.875rem"})]}),o.jsx("div",{className:ce.attentionMeta,children:o.jsx(_e,{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(_e,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(_e,{width:"9rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(_e,{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(_e,{width:"60%",height:"0.875rem"}),o.jsx(_e,{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(_e,{width:"1rem",height:"1rem",variant:"circular"}),o.jsx(_e,{width:"6rem",height:"0.75rem"}),o.jsx("span",{className:ce.sectionCount,children:o.jsx(_e,{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(_e,{width:"50%",height:"0.875rem"}),o.jsx(_e,{width:"2rem",height:"0.75rem"})]}),o.jsx("div",{className:ce.progressBar,children:o.jsx("div",{className:ce.progressFill,style:{width:"0%"}})})]},s))})]})]})]})}const Oz={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Ic={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function Lz(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 Oc({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:Oz,initial:"hidden",animate:"visible",custom:r,children:[o.jsx("span",{className:ce.kpiValue,children:t}),o.jsx("span",{className:ce.kpiLabel,children:s})]})}function Bz(){const{workspaces:t,tasks:s,sessions:i,environments:r,loadTasks:c,sessionsLoading:d,tasksLoading:u,environmentsLoading:p,workspacesLoading:h}=lt(),g=_t(),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 x=y.useMemo(()=>u8(i,s,r),[i,s,r]),b=y.useMemo(()=>p8(i,r),[i,r]),k=y.useMemo(()=>f8(s,t),[s,t]),S=y.useMemo(()=>m8(t,s),[t,s,r]);return i.length===0&&s.length===0&&r.length===0&&t.length===0&&(d||u||p||h)?o.jsx(Iz,{}):o.jsxs("div",{className:ce.dashboard,"data-testid":"dashboard",children:[o.jsxs("div",{className:ce.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[o.jsx(Oc,{value:x.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),o.jsx(Oc,{value:x.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),o.jsx(Oc,{value:x.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),o.jsx(Oc,{value:x.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:Ic,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:b.length})]}),o.jsx("div",{className:ce.sectionBody,children:b.length===0?o.jsx("div",{className:ce.emptyHint,children:"No active sessions"}):b.map(({session:N,environmentName:T})=>o.jsxs("button",{type:"button",className:ce.sessionRow,onClick:()=>g(rm(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:Ic,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(cs(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:Ic,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:r.length})]}),o.jsx("div",{className:ce.sectionBody,children:r.length===0?o.jsx("div",{className:ce.emptyHint,children:"No environments configured"}):r.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:Ic,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 A=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":Lz(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:`${A}%`}})})]},N.id)})})]})]})]})}const zz="_panelContainer_101ly_1",Uz="_emptyState_101ly_8",$z="_fadeIn_101ly_1",Pz="_workspaceSummary_101ly_17",Vz="_workspaceSummaryTitle_101ly_28",Hz="_workspaceSummarySubtitle_101ly_32",qz="_header_101ly_36",Gz="_headerInfo_101ly_71",Fz="_killButton_101ly_77",Zz="_headerTitle_101ly_106",Kz="_headerActions_101ly_121",Yz="_taskStatusBadge_101ly_128",Jz="_taskBranch_101ly_137",Wz="_taskBlockedBadge_101ly_143",Xz="_btnPrimary_101ly_151",Qz="_btnDanger_101ly_182",e7="_btnGhost_101ly_221",t7="_rejectInput_101ly_247",n7="_tabBar_101ly_277",s7="_tab_101ly_277",a7="_active_101ly_303",i7="_eventScroll_101ly_308",o7="_tabContent_101ly_314",r7="_noContext_101ly_319",l7="_overviewContent_101ly_325",c7="_overviewDashboard_101ly_334",d7="_overviewHero_101ly_340",u7="_statusBadge_101ly_347",f7="_statusPending_101ly_359",p7="_statusAssigned_101ly_364",m7="_statusInProgress_101ly_369",h7="_statusReview_101ly_374",g7="_statusDone_101ly_379",v7="_statusFailed_101ly_384",y7="_statusWaitingInput_101ly_389",b7="_overviewBranchPill_101ly_394",x7="_branchLink_101ly_409",_7="_overviewSection_101ly_420",k7="_overviewLabel_101ly_426",S7="_overviewValue_101ly_433",T7="_overviewMuted_101ly_438",j7="_overviewMarkdown_101ly_444",w7="_envRow_101ly_513",N7="_envDot_101ly_519",C7="_envDotGreen_101ly_526",E7="_envDotYellow_101ly_530",A7="_envDotRed_101ly_534",D7="_envDotGray_101ly_538",R7="_depList_101ly_542",M7="_depItem_101ly_548",I7="_depBlocked_101ly_555",O7="_depDone_101ly_559",L7="_timeline_101ly_563",B7="_timelineRow_101ly_569",z7="_timelineKey_101ly_576",U7="_timelineValue_101ly_582",$7="_timelineDelta_101ly_586",P7="_reviewNotes_101ly_597",V7="_overviewDescription_101ly_608",H7="_waitingMessage_101ly_614",q7="_errorMessage_101ly_618",G7="_attemptSelector_101ly_622",F7="_attemptLabel_101ly_638",Z7="_attemptButton_101ly_642",K7="_attemptActive_101ly_659",Y7="_attemptStatus_101ly_665",J7="_emptyCta_101ly_671",W7="_ctaTitle_101ly_683",X7="_ctaDescription_101ly_689",Q7="_ctaButton_101ly_696",eU="_ctaCreateForm_101ly_731",tU="_ctaCreateInput_101ly_737",nU="_ctaCreateOk_101ly_768",sU="_ctaLink_101ly_803",aU="_workspaceHeader_101ly_817",iU="_workspaceName_101ly_842",oU="_workspaceMeta_101ly_855",rU="_metaRow_101ly_863",lU="_metaLabel_101ly_876",cU="_metaValue_101ly_891",dU="_archiveButton_101ly_901",uU="_repoLink_101ly_931",fU="_metaToggle_101ly_941",pU="_metaToggleArrow_101ly_962",mU="_metaToggleArrowOpen_101ly_967",hU="_progressBarContainer_101ly_971",gU="_progressBar_101ly_971",vU="_progressFill_101ly_987",yU="_progressLabel_101ly_994",bU="_metaTimestamps_101ly_1001",xU="_metaTimestamp_101ly_1001",L={panelContainer:zz,emptyState:Uz,fadeIn:$z,workspaceSummary:Pz,workspaceSummaryTitle:Vz,workspaceSummarySubtitle:Hz,header:qz,headerInfo:Gz,killButton:Fz,headerTitle:Zz,headerActions:Kz,taskStatusBadge:Yz,taskBranch:Jz,taskBlockedBadge:Wz,btnPrimary:Xz,btnDanger:Qz,btnGhost:e7,rejectInput:t7,tabBar:n7,tab:s7,active:a7,eventScroll:i7,tabContent:o7,noContext:r7,overviewContent:l7,overviewDashboard:c7,overviewHero:d7,statusBadge:u7,statusPending:f7,statusAssigned:p7,statusInProgress:m7,statusReview:h7,statusDone:g7,statusFailed:v7,statusWaitingInput:y7,overviewBranchPill:b7,branchLink:x7,overviewSection:_7,overviewLabel:k7,overviewValue:S7,overviewMuted:T7,overviewMarkdown:j7,envRow:w7,envDot:N7,envDotGreen:C7,envDotYellow:E7,envDotRed:A7,envDotGray:D7,depList:R7,depItem:M7,depBlocked:I7,depDone:O7,timeline:L7,timelineRow:B7,timelineKey:z7,timelineValue:U7,timelineDelta:$7,reviewNotes:P7,overviewDescription:V7,waitingMessage:H7,errorMessage:q7,attemptSelector:G7,attemptLabel:F7,attemptButton:Z7,attemptActive:K7,attemptStatus:Y7,emptyCta:J7,ctaTitle:W7,ctaDescription:X7,ctaButton:Q7,ctaCreateForm:eU,ctaCreateInput:tU,ctaCreateOk:nU,ctaLink:sU,workspaceHeader:aU,workspaceName:iU,workspaceMeta:oU,metaRow:rU,metaLabel:lU,metaValue:cU,archiveButton:dU,repoLink:uU,metaToggle:fU,metaToggleArrow:pU,metaToggleArrowOpen:mU,progressBarContainer:hU,progressBar:gU,progressFill:vU,progressLabel:yU,metaTimestamps:bU,metaTimestamp:xU};function _U(){return o.jsx("div",{className:L.emptyState,children:"Select a task or click + to create one"})}function kU(){return o.jsx("div",{className:L.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function SU(){const{workspaces:t,environments:s}=lt(),i=_t(),r=s.length>0;return t.length>0?o.jsx(Bz,{}):o.jsxs("div",{className:L.emptyCta,"data-testid":"welcome-cta",children:[o.jsx("div",{className:L.ctaTitle,children:"Welcome to Grackle"}),o.jsx("div",{className:L.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),o.jsx("button",{className:L.ctaButton,onClick:()=>i(wx),disabled:!r,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!r&&o.jsx("div",{className:L.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const TU="_panelContainer_19poq_1",jU="_chatHeader_19poq_8",wU="_chatHeaderInfo_19poq_37",NU="_emptyState_19poq_43",CU="_emptyTitle_19poq_55",EU="_emptyDescription_19poq_61",AU="_emptyHint_19poq_67",Ra={panelContainer:TU,chatHeader:jU,chatHeaderInfo:wU,emptyState:NU,emptyTitle:CU,emptyDescription:EU,emptyHint:AU};function DU(){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(_e,{width:"65%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"85%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"45%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"75%",height:"3rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"55%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})}function RU({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 MU(){const{tasks:t,sessions:s,events:i,eventsDropped:r,environments:c,loadTaskSessions:d,loadSessionEvents:u,kill:p,stopGraceful:h,taskSessions:g,sendInput:v,spawn:x,startTask:b,personas:k,provisionEnvironment:S,sessionsLoading:w,tasksLoading:N}=lt(),{showToast:T}=yn(),C=y.useRef(void 0),[E,D]=y.useState(),A=t.find(ee=>ee.id===Sr),B=A!=null&&A.latestSessionId?s.find(ee=>ee.id===A.latestSessionId)??(g[Sr]??[]).find(ee=>ee.id===A.latestSessionId):void 0;y.useEffect(()=>{d(Sr).catch(()=>{})},[d]),y.useEffect(()=>{A!=null&&A.latestSessionId&&d(Sr).catch(()=>{})},[A==null?void 0:A.latestSessionId,d]),y.useEffect(()=>{B&&B.id!==C.current&&(C.current=B.id,u(B.id).catch(()=>{}))},[B==null?void 0:B.id,u]);const R=y.useMemo(()=>{if(!B)return[];const ee=i.filter(ae=>ae.sessionId===B.id);return Ym(Km(ee))},[i,B==null?void 0:B.id]),U=c.find(ee=>ee.adapterType==="local"&&ee.status==="connected"),K=B!==void 0&&B.status!=="stopped"&&B.status!=="suspended",ne=(B==null?void 0:B.status)==="idle";y.useEffect(()=>{E&&B&&ne&&(v(B.id,E).catch(()=>{}),D(void 0))},[E,ne,B==null?void 0:B.id,v]);const F=y.useCallback((ee,ae,X,re)=>{re&&D(re),b(ee,ae,X).catch(()=>{})},[b]);return!A&&(w||N)?o.jsx(DU,{}):o.jsxs("div",{className:Ra.panelContainer,"data-testid":"chat-page",children:[K&&o.jsxs("div",{className:Ra.chatHeader,children:[o.jsxs("span",{className:Ra.chatHeaderInfo,children:["Session: ",B.id.slice(0,8)," | ",B.runtime," | ",B.status]}),o.jsx(Cx,{label:"Stop",onClick:()=>{h(B.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{h(B.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{p(B.id).catch(()=>{})}}]})]}),o.jsx(Hm,{events:R,eventsDropped:r,emptyState:o.jsx(RU,{hasLocalEnvironment:!!U}),onShowToast:T}),U&&K&&o.jsx(Vr,{mode:"send",sessionId:B.id,environmentId:B.environmentId,personas:k,environments:c,onSendInput:(ee,ae)=>{v(ee,ae).catch(()=>{})},onSpawn:(ee,ae,X)=>{x(ee,ae,X).catch(()=>{})},onStartTask:(ee,ae,X)=>{b(ee,ae,X).catch(()=>{})},onProvisionEnvironment:ee=>{S(ee).catch(()=>{})},onShowToast:T}),U&&!K&&o.jsx(Vr,{mode:"start",taskId:Sr,environmentId:U.id,personas:k,environments:c,onSendInput:(ee,ae)=>{v(ee,ae).catch(()=>{})},onSpawn:(ee,ae,X)=>{x(ee,ae,X).catch(()=>{})},onStartTask:F,onProvisionEnvironment:ee=>{S(ee).catch(()=>{})},onShowToast:T})]})}function IU(){const t=a8(),[s]=om(),i=s.get("env")??"",{sendInput:r,spawn:c,startTask:d,personas:u,environments:p,provisionEnvironment:h}=lt(),{showToast:g}=yn();return o.jsxs("div",{className:L.panelContainer,children:[o.jsx(_s,{segments:t}),o.jsx("div",{className:L.emptyState,children:"Enter a prompt below to start a new session"}),o.jsx(Vr,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:u,environments:p,onSendInput:(v,x)=>{r(v,x).catch(()=>{})},onSpawn:(v,x,b)=>{c(v,x,b).catch(()=>{})},onStartTask:(v,x,b)=>{d(v,x,b).catch(()=>{})},onProvisionEnvironment:v=>{h(v).catch(()=>{})},onShowToast:g})]})}function OU(){return o.jsxs("div",{className:L.panelContainer,"aria-hidden":"true",children:[o.jsxs("div",{className:L.header,children:[o.jsx("span",{children:o.jsx(_e,{width:"10rem",height:"0.875rem"})}),o.jsx("span",{className:L.headerInfo,children:o.jsx(_e,{width:"16rem",height:"0.875rem"})})]}),o.jsx("div",{className:L.eventScroll,children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-md)"},children:[o.jsx(_e,{width:"70%",height:"2.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"90%",height:"4rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"50%",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"80%",height:"3.5rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"60%",height:"2.5rem",borderRadius:"var(--radius-sm)"})]})})]})}function LU({sessionId:t,session:s,isActive:i,onStop:r,onKill:c}){return o.jsxs("div",{className:L.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?` | ${Ex((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${jo(s.costUsd??0)}`:""]}),o.jsxs("span",{className:L.headerInfo,children:[s&&o.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&o.jsx(Cx,{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 BU({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?L.errorMessage:L.waitingMessage,children:i})}function zU(){const{sessionId:t}=ds(),{events:s,eventsDropped:i,sessions:r,kill:c,stopGraceful:d,loadSessionEvents:u,sendInput:p,spawn:h,startTask:g,personas:v,environments:x,provisionEnvironment:b,sessionsLoading:k}=lt(),{showToast:S}=yn(),w=y.useRef(void 0),N=i8(t),T=r.find(D=>D.id===t)??void 0,C=y.useMemo(()=>{const D=t?s.filter(A=>A.sessionId===t):[];return Ym(Km(D))},[s,t]);if(y.useEffect(()=>{t&&t!==w.current&&(w.current=t,u(t).catch(()=>{}))},[t,u]),!T&&k)return o.jsx(OU,{});if(!t)return o.jsx("div",{className:L.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:L.panelContainer,children:[o.jsx(_s,{segments:N}),o.jsx(LU,{sessionId:t,session:T,isActive:E,onStop:()=>{d(t).catch(()=>{})},onKill:()=>{c(t).catch(()=>{})}}),o.jsx(Hm,{events:C,eventsDropped:i,emptyState:o.jsx(BU,{session:T}),onShowToast:S}),E&&o.jsx(Vr,{mode:"send",sessionId:t,environmentId:T.environmentId,personas:v,environments:x,onSendInput:(D,A)=>{p(D,A).catch(()=>{})},onSpawn:(D,A,B)=>{h(D,A,B).catch(()=>{})},onStartTask:(D,A,B)=>{g(D,A,B).catch(()=>{})},onProvisionEnvironment:D=>{b(D).catch(()=>{})},onShowToast:S})]})}function UU(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 h=g=>{if(u&&UU(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",h),()=>{document.removeEventListener("keydown",h)}},[r,c,d,u,p])}function $U(){return o.jsxs("div",{className:L.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:L.workspaceHeader,children:o.jsx("span",{className:L.workspaceName,children:o.jsx(_e,{width:"12rem",height:"1.25rem"})})}),o.jsx("div",{className:L.metaToggle,style:{cursor:"default"},children:o.jsx(_e,{width:"4rem",height:"0.625rem"})}),o.jsxs("div",{className:L.progressBarContainer,children:[o.jsx("div",{className:L.progressBar,children:o.jsx("div",{className:L.progressFill,style:{width:"0%"}})}),o.jsx(_e,{width:"2rem",height:"0.625rem"})]}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("span",{className:`${L.tab} ${L.active}`,children:"Graph"}),o.jsx("span",{className:L.tab,children:"Board"}),o.jsx("span",{className:L.tab,children:"Tasks"})]}),o.jsx("div",{className:L.overviewContent,children:Array.from({length:3},(t,s)=>o.jsx(td,{lines:2},s))})]})}function Hb(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 yp=100;function PU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function VU(){const{workspaceId:t,environmentId:s}=ds(),i=_t(),{tasks:r,environments:c,workspaces:d,personas:u,sessions:p,archiveWorkspace:h,updateWorkspace:g,usageCache:v,loadUsage:x,workspacesLoading:b}=lt(),{resolvedThemeId:k}=j1(),[S,w]=y.useState("tasks"),[N,T]=y.useState(!1),[C,E]=y.useState(null),[D,A]=y.useState(!1),B=y.useRef(void 0),R=d.find(O=>O.id===t),U=s??(R==null?void 0:R.environmentId)??"",K=o8(t,U,d,c);Js({key:"1"},()=>w("graph")),Js({key:"2"},()=>w("board")),Js({key:"3"},()=>w("tasks")),y.useEffect(()=>{const O=B.current;B.current=t,!(O===void 0||O===t)&&C!==null&&E(null)},[t,C]);const ne=p.reduce((O,G)=>O+(G.costUsd??0),0);y.useEffect(()=>{t&&x("workspace",t).catch(()=>{})},[t,x,ne]);const F=t?v[`workspace:${t}`]:void 0,ee=r.filter(O=>O.workspaceId===t),ae=ee.filter(O=>O.status==="complete").length,X=ee.length,re=X>0?Math.round(ae/X*100):0;return!R&&b?o.jsx($U,{}):o.jsxs("div",{className:L.panelContainer,children:[o.jsx(_s,{segments:K}),o.jsxs("div",{className:L.workspaceHeader,children:[o.jsx("span",{className:L.workspaceName,"data-testid":"workspace-name",children:o.jsx(en,{value:(R==null?void 0:R.name)||"",onSave:O=>{R&&g(R.id,{name:O}).catch(()=>{})},validate:O=>{const G=O.trim();if(!G)return"Name is required";if(G.length>yp)return`Max ${yp} characters`},maxLength:yp,fieldId:"name",activeFieldId:C,onActivate:E,ariaLabel:"Workspace name",renderDisplay:O=>O||t||void 0,"data-testid":"edit-name"})}),o.jsx("button",{className:L.archiveButton,onClick:()=>T(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),o.jsxs("button",{className:L.metaToggle,onClick:()=>A(!D),"aria-expanded":!D,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[o.jsx("span",{className:`${L.metaToggleArrow} ${D?"":L.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!D&&o.jsxs("div",{className:L.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Description"}),o.jsx("div",{className:L.metaValue,children:o.jsx(qp,{value:(R==null?void 0:R.description)||"",onSave:O=>{R&&g(R.id,{description:O}).catch(()=>{})},fieldId:"description",activeFieldId:C,onActivate:E,renderDisplay:O=>O?o.jsx("span",{className:L.overviewMarkdown,children:o.jsx(od,{remarkPlugins:[rd],children:O})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Repository"}),o.jsx("div",{className:L.metaValue,children:o.jsx(en,{value:(R==null?void 0:R.repoUrl)||"",onSave:O=>{R&&g(R.id,{repoUrl:O}).catch(()=>{})},validate:O=>{const G=O.trim();if(G&&!/^https?:\/\/.+/.test(G))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:C,onActivate:E,renderDisplay:O=>{const G=PU(O);return G?o.jsx("a",{className:L.repoLink,href:G,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:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Environment"}),o.jsx("div",{className:L.metaValue,children:o.jsx(l4,{value:(R==null?void 0:R.environmentId)||"",onSave:O=>{R&&O&&g(R.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:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Persona"}),o.jsx("div",{className:L.metaValue,children:o.jsx(nd,{value:(R==null?void 0:R.defaultPersonaId)||"",onSave:O=>{R&&g(R.id,{defaultPersonaId:O}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...u.map(O=>({value:O.id,label:O.name}))],fieldId:"defaultPersonaId",activeFieldId:C,onActivate:E,renderDisplay:O=>{const G=u.find(se=>se.id===O);if(G)return o.jsx("span",{children:G.name})},placeholder:(R==null?void 0:R.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Worktrees"}),o.jsx("div",{className:L.metaValue,children:o.jsx(e4,{checked:(R==null?void 0:R.useWorktrees)??!0,onChange:O=>{R&&g(R.id,{useWorktrees:O}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),o.jsxs("div",{className:L.metaRow,children:[o.jsx("span",{className:L.metaLabel,children:"Working Dir"}),o.jsx("div",{className:L.metaValue,children:o.jsx(en,{value:(R==null?void 0:R.workingDirectory)||"",onSave:O=>{R&&g(R.id,{workingDirectory:O}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:C,onActivate:E,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),R&&o.jsxs("div",{className:L.metaTimestamps,children:[o.jsxs("span",{className:L.metaTimestamp,children:["Created ",Hb(R.createdAt)]}),R.updatedAt&&R.updatedAt!==R.createdAt&&o.jsxs("span",{className:L.metaTimestamp,children:["· Updated ",Hb(R.updatedAt)]})]})]}),X>0&&o.jsxs("div",{className:L.progressBarContainer,"data-testid":"progress-bar",children:[o.jsx("div",{className:L.progressBar,children:o.jsx("div",{className:L.progressFill,style:{width:`${re}%`}})}),o.jsxs("span",{className:L.progressLabel,children:[ae,"/",X]})]}),F&&F.costUsd>0&&o.jsx("div",{className:L.progressBarContainer,children:o.jsxs("span",{className:L.progressLabel,children:["Usage: ",jo(F.costUsd)," (",F.sessionCount," session",F.sessionCount!==1?"s":"",")"]})}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Workspace view",children:[o.jsx("button",{role:"tab","aria-selected":S==="graph",className:`${L.tab} ${S==="graph"?L.active:""}`,onClick:()=>w("graph"),children:"Graph"}),o.jsx("button",{role:"tab","aria-selected":S==="board",className:`${L.tab} ${S==="board"?L.active:""}`,onClick:()=>w("board"),"data-testid":"board-tab",children:"Board"}),o.jsx("button",{role:"tab","aria-selected":S==="tasks",className:`${L.tab} ${S==="tasks"?L.active:""}`,onClick:()=>w("tasks"),children:"Tasks"})]}),S==="tasks"&&X>0&&o.jsxs("div",{className:L.workspaceSummary,children:[o.jsx("span",{className:L.workspaceSummaryTitle,children:`${ae}/${X} tasks complete`}),o.jsx("span",{className:L.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),S==="tasks"&&X===0&&o.jsxs("div",{className:L.emptyCta,children:[o.jsx("button",{className:L.ctaButton,onClick:()=>i(Si(t,void 0,U)),children:"Create Task"}),o.jsx("div",{className:L.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),S==="board"&&o.jsx(EB,{workspaceId:t,environmentId:U,tasks:r,sessions:p,personas:u,environments:c}),S==="graph"&&o.jsx(eN,{workspaceId:t,environmentId:U,tasks:r,resolvedThemeId:k}),o.jsx(xi,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{R&&(h(R.id).catch(()=>{}),i("/",{replace:!0})),T(!1)},onCancel:()=>T(!1)})]})}const HU="_container_3pgew_1",qU="_header_3pgew_8",GU="_headerTitle_3pgew_35",FU="_headerActions_3pgew_44",ZU="_body_3pgew_51",KU="_btnPrimary_3pgew_63",YU="_btnGhost_3pgew_94",JU="_error_3pgew_116",Ea={container:HU,header:qU,headerTitle:GU,headerActions:FU,body:ZU,btnPrimary:KU,btnGhost:YU,error:JU};function WU(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 XU=[{label:"Home",url:bi},{label:"New Workspace",url:void 0}];function QU(){const[t]=om(),s=t.get("environment")??void 0,{environments:i,personas:r,createWorkspace:c,workspaceCreating:d}=lt(),{showToast:u}=yn(),p=_t(),[h,g]=y.useState(()=>{var N;return $B(void 0,s||((N=i[0])==null?void 0:N.id))}),[v,x]=y.useState(),[b,k]=y.useState();y.useEffect(()=>{s||h.environmentId||i.length===0||g(N=>{var T;return N.environmentId?N:{...N,environmentId:((T=i[0])==null?void 0:T.id)??""}})},[i,s,h.environmentId]);const S=()=>{const N=WU(h);if(N){x(N),k(void 0);return}x(void 0),k(void 0),c(h.name.trim(),h.description,h.repoUrl.trim(),h.environmentId,h.defaultPersonaId,h.useWorktrees,h.workingDirectory,()=>{u("Workspace created","success"),p(bi,{replace:!0})},T=>{k(T)}).catch(()=>{})},w=()=>{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(_s,{segments:XU})}),o.jsxs("div",{className:Ea.headerActions,children:[o.jsx("button",{className:Ea.btnGhost,onClick:w,disabled:d,"data-testid":"workspace-create-cancel",children:"Cancel"}),o.jsx("button",{className:Ea.btnPrimary,onClick:S,disabled:d||!h.name.trim()||!h.environmentId,"data-testid":"workspace-create-save",children:d?o.jsx(i1,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),o.jsxs("div",{className:Ea.body,children:[o.jsx(VB,{values:h,onChange:N=>{g(N),x(void 0),k(void 0)},environments:i,personas:r,errors:v,disabled:d,autoFocusName:!0}),b&&o.jsx("div",{className:Ea.error,"data-testid":"workspace-create-submit-error",children:b})]})]})}function qb(){const{workspaceId:t,environmentId:s}=ds(),[i]=om(),r=t??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:d,workspaces:u,personas:p,createTask:h,updateTask:g}=lt(),{showToast:v}=yn();return o.jsx(y1,{mode:"new",workspaceId:r,parentTaskId:c,environmentId:s,tasks:d,workspaces:u,personas:p,onCreateTask:(x,b,k,S,w,N,T,C,E)=>{h(x,b,k,S,w,N,T,C,E).catch(()=>{})},onUpdateTask:(x,b,k,S,w)=>{g(x,b,k,S,w).catch(()=>{})},onShowToast:v})}function e$(){return o.jsxs("div",{className:L.panelContainer,"aria-hidden":"true",children:[o.jsx("div",{className:L.header,children:o.jsxs("span",{className:L.headerTitle,children:[o.jsx(_e,{width:"12rem",height:"1rem"}),o.jsx(_e,{width:"4rem",height:"1rem",borderRadius:"var(--radius-full)"})]})}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("span",{className:`${L.tab} ${L.active}`,children:"Overview"}),o.jsx("span",{className:L.tab,children:"Stream"}),o.jsx("span",{className:L.tab,children:"Findings"})]}),o.jsx("div",{className:L.overviewContent,children:o.jsxs("div",{className:L.overviewDashboard,children:[o.jsx("div",{className:L.overviewHero,children:o.jsx(_e,{width:"5rem",height:"1.5rem",borderRadius:"var(--radius-full)"})}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Description"}),o.jsx(Hp,{lines:2})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Environment"}),o.jsxs("div",{className:L.envRow,children:[o.jsx(_e,{width:"0.5rem",height:"0.5rem",variant:"circular"}),o.jsx(_e,{width:"8rem",height:"0.875rem"})]})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Dependencies"}),o.jsx(Hp,{lines:2})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Timeline"}),o.jsx("div",{className:L.timeline,children:Array.from({length:4},(t,s)=>o.jsxs("div",{className:L.timelineRow,children:[o.jsx(_e,{width:"4rem",height:"0.75rem"}),o.jsx(_e,{width:"10rem",height:"0.75rem"})]},s))})]})]})})]})}function Lc(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 bp(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 Gb(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?L.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?L.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?L.envDotRed:L.envDotGray}function t$({status:t}){const s=Ia(t),i=F2(t);return o.jsx("span",{className:`${L.statusBadge} ${L[i]??L.statusPending}`,children:s.label})}function n$({task:t,tasksById:s,environments:i,workspaces:r,taskSessions:c,selectedEnvId:d}){const{loadUsage:u,usageCache:p}=lt(),h=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,h]);const g=`task:${t.id}`,v=g in p?p[g]:void 0,x=`task_tree:${t.id}`,b=t.childTaskIds.length>0&&x in p?p[x]:void 0,k=c.length>0?c[c.length-1]:void 0,S=(k==null?void 0:k.environmentId)??"",w=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:L.overviewDashboard,children:[o.jsxs("div",{className:L.overviewHero,children:[o.jsx(t$,{status:t.status}),t.branch&&o.jsx("span",{className:L.overviewBranchPill,children:C?o.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:L.branchLink,children:["🔗"," ",t.branch]}):o.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Description"}),o.jsx("div",{className:L.overviewMarkdown,children:o.jsx(od,{remarkPlugins:[rd],children:t.description})})]}),t.workpad&&o.jsx(_L,{workpad:t.workpad}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Environment"}),S&&w?o.jsxs("div",{className:L.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${L.envDot} ${Gb(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),o.jsx("span",{className:L.overviewValue,children:w.displayName})]}):T?o.jsxs("div",{className:L.envRow,"data-testid":"task-overview-environment",children:[o.jsx("span",{className:`${L.envDot} ${Gb(T.status)}`,title:T.status,"aria-label":`Status: ${T.status}`,role:"img"}),o.jsx("span",{className:L.overviewValue,children:T.displayName}),o.jsx("span",{className:L.overviewMuted,children:"(workspace default)"})]}):o.jsx("div",{className:L.overviewMuted,children:"Set in workspace settings"})]}),o.jsxs("div",{className:L.overviewSection,"data-testid":"task-overview-dependencies",children:[o.jsx("div",{className:L.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?o.jsx("div",{className:L.overviewMuted,children:"None"}):o.jsx("div",{className:L.depList,children:t.dependsOn.map(E=>{const D=s.get(E),A=(D==null?void 0:D.status)==="complete";return o.jsxs("div",{className:`${L.depItem} ${A?L.depDone:L.depBlocked}`,children:[o.jsx("span",{children:A?"✓":"○"}),o.jsx("span",{children:(D==null?void 0:D.title)??E})]},E)})})]}),o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Timeline"}),o.jsxs("div",{className:L.timeline,children:[t.createdAt&&o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Created"}),o.jsx("span",{className:L.timelineValue,children:Lc(t.createdAt)})]}),t.assignedAt&&(()=>{const E=bp(t.createdAt,t.assignedAt);return o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Assigned"}),o.jsx("span",{className:L.timelineValue,children:Lc(t.assignedAt)}),E!==void 0&&o.jsx("span",{className:L.timelineDelta,children:E})]})})(),t.startedAt&&(()=>{const E=bp(t.assignedAt??t.createdAt,t.startedAt);return o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Started"}),o.jsx("span",{className:L.timelineValue,children:Lc(t.startedAt)}),E!==void 0&&o.jsx("span",{className:L.timelineDelta,children:E})]})})(),t.completedAt&&(()=>{const E=bp(t.startedAt,t.completedAt);return o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Completed"}),o.jsx("span",{className:L.timelineValue,children:Lc(t.completedAt)}),E!==void 0&&o.jsx("span",{className:L.timelineDelta,children:E})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&o.jsx("div",{className:L.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Usage"}),o.jsxs("div",{className:L.timeline,children:[o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Cost"}),o.jsx("span",{className:L.timelineValue,children:jo(v.costUsd)}),o.jsxs("span",{className:L.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),b&&b.costUsd>v.costUsd&&o.jsxs("div",{className:L.timelineRow,children:[o.jsx("span",{className:L.timelineKey,children:"Total (incl. subtasks)"}),o.jsx("span",{className:L.timelineValue,children:jo(b.costUsd)}),o.jsxs("span",{className:L.timelineDelta,children:[b.sessionCount," session",b.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&o.jsxs("div",{className:L.overviewSection,children:[o.jsx("div",{className:L.overviewLabel,children:"Review Notes"}),o.jsx("div",{className:L.reviewNotes,children:t.reviewNotes})]})]})}function s$({task:t,sessionId:s,isBlocked:i,onStart:r,onResume:c,onStop:d,onPause:u,onDelete:p,onEdit:h}){if(t.status==="not_started")return i?o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:h,className:L.btnGhost,children:"Edit"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]}):o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{"data-testid":"task-header-start",onClick:r,className:L.btnPrimary,children:"Start"}),o.jsx("button",{onClick:h,className:L.btnGhost,children:"Edit"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]});if(t.status==="working")return o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:d,className:L.btnDanger,children:"Stop"}),o.jsx("button",{onClick:u,disabled:!s,className:L.btnGhost,children:"Pause"})]});if(t.status==="paused")return o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:d,className:L.btnPrimary,children:"Stop"}),o.jsx("button",{onClick:c,className:L.btnGhost,children:"Resume"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]});if(t.status==="complete")return o.jsx("div",{className:L.headerActions,children:o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})});if(t.status==="failed")return o.jsxs("div",{className:L.headerActions,children:[o.jsx("button",{onClick:r,className:L.btnPrimary,children:"Retry"}),o.jsx("button",{onClick:p,className:L.btnDanger,children:"Delete"})]})}function a$({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return o.jsxs("div",{className:L.attemptSelector,"data-testid":"attempt-selector",children:[o.jsx("span",{className:L.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:`${L.attemptButton} ${d?L.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:L.attemptStatus,children:u})]},r.id)})]})}function Aa(){const{taskId:t,workspaceId:s,environmentId:i}=ds(),r=Ht(),c=_t(),{showToast:d}=yn(),{events:u,eventsDropped:p,tasks:h,sessions:g,environments:v,findings:x,loadSessionEvents:b,loadFindings:k,kill:S,startTask:w,stopTask:N,resumeTask:T,deleteTask:C,createTask:E,updateTask:D,workspaces:A,taskSessions:B,loadTaskSessions:R,sendInput:U,spawn:K,personas:ne,provisionEnvironment:F,tasksLoading:ee}=lt(),ae=y.useRef(void 0),X=y.useRef(void 0),re=y.useRef(void 0),O=y.useRef(void 0),G=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=h.find(xe=>xe.id===t),ct=(W==null?void 0:W.workspaceId)||void 0,Le=A.find(xe=>xe.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(v.length>0){const xe=v.find(Qe=>Qe.status==="connected");me((xe==null?void 0:xe.id)??v[0].id)}}},[ye,Le==null?void 0:Le.environmentId,v]);const $t=W?B[W.id]??[]:[];let dt;Oe&&$t.some(xe=>xe.id===Oe)?dt=Oe:dt=(W==null?void 0:W.latestSessionId)||void 0;const ta=()=>{Ne(!0)},ks=()=>{if(!W)return;C(W.id).catch(()=>{}),Ne(!1);const xe=i??(Le==null?void 0:Le.environmentId);c(W.workspaceId&&xe?vi(W.workspaceId,xe):"/",{replace:!0})};y.useEffect(()=>{(W==null?void 0:W.id)!==X.current&&(X.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 xe=W.id!==O.current,Qe=W.latestSessionId!==G.current;(xe||Qe)&&(O.current=W.id,G.current=W.latestSessionId,R(W.id).catch(()=>{}))},[W==null?void 0:W.id,W==null?void 0:W.latestSessionId,R]),y.useEffect(()=>{if((W==null?void 0:W.status)!==re.current){const xe=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&&!(xe&&se!=="overview")&&Ge(Qe)}},[W==null?void 0:W.status,de,se]);const xn=y.useMemo(()=>new Map(h.map(xe=>[xe.id,xe])),[h]),Ss=y.useMemo(()=>{const xe=dt?u.filter(Qe=>Qe.sessionId===dt):[];return Ym(Km(xe))},[u,dt]),us=W?W.dependsOn.some(xe=>{const Qe=xn.get(xe);return Qe!==void 0&&Qe.status!=="complete"}):!1,ji=y.useMemo(()=>r8(t,i,A,v,xn),[t,i,A,v,xn]);y.useEffect(()=>{dt&&dt!==ae.current&&(ae.current=dt,b(dt).catch(()=>{}))},[dt,b]),y.useEffect(()=>{de==="findings"&&ct&&k(ct).catch(()=>{})},[de,ct,k]);const Jn=xe=>{Ge(xe),c(cs(t,xe==="overview"?void 0:xe,s,i))};return Js({key:"1"},()=>Jn("overview")),Js({key:"2"},()=>Jn("stream")),Js({key:"3"},()=>Jn("findings")),!W&&ee?o.jsx(e$,{}):o.jsxs("div",{className:L.panelContainer,children:[o.jsx(_s,{segments:ji}),o.jsxs("div",{className:L.header,children:[o.jsxs("span",{className:L.headerTitle,children:[o.jsx("span",{"data-testid":"task-title",children:(W==null?void 0:W.title)||t}),W&&o.jsx("span",{className:L.taskStatusBadge,"data-testid":"task-status",children:W.status}),(W==null?void 0:W.branch)&&o.jsx("span",{className:L.taskBranch,children:W.branch}),us&&o.jsx("span",{className:L.taskBlockedBadge,children:"blocked"})]}),W&&o.jsx(s$,{task:W,sessionId:dt,isBlocked:us,onStart:()=>{w(W.id,void 0,ye).catch(()=>{})},onResume:()=>{T(W.id).catch(()=>{})},onStop:()=>{N(W.id).catch(()=>{})},onPause:()=>{dt&&S(dt).catch(()=>{})},onDelete:ta,onEdit:()=>pt(!0)})]}),o.jsxs("div",{className:L.tabBar,role:"tablist","aria-label":"Task view",children:[o.jsx("button",{role:"tab","aria-selected":de==="overview",className:`${L.tab} ${de==="overview"?L.active:""}`,onClick:()=>Jn("overview"),children:"Overview"}),o.jsx("button",{role:"tab","aria-selected":de==="stream",className:`${L.tab} ${de==="stream"?L.active:""}`,onClick:()=>Jn("stream"),children:"Stream"}),o.jsx("button",{role:"tab","aria-selected":de==="findings",className:`${L.tab} ${de==="findings"?L.active:""}`,onClick:()=>Jn("findings"),children:"Findings"})]}),o.jsxs(ls,{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:L.overviewContent,"data-testid":"task-overview",children:Ue&&W?o.jsx(y1,{mode:"edit",taskId:W.id,workspaceId:ct,environmentId:i,tasks:h,workspaces:A,personas:ne,onCreateTask:(xe,Qe,on,_n,Mn,wi,Pa,Ni,Ci)=>{E(xe,Qe,on,_n,Mn,wi,Pa,Ni,Ci).catch(()=>{})},onUpdateTask:(xe,Qe,on,_n,Mn)=>{D(xe,Qe,on,_n,Mn).catch(()=>{})},onEditDone:()=>{ue?c(cs(W.id,void 0,s,i),{replace:!0}):pt(!1)},onShowToast:d}):W?o.jsx(n$,{task:W,tasksById:xn,environments:v,workspaces:A,taskSessions:$t,selectedEnvId:ye}):o.jsx("div",{className:L.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(a$,{taskSessions:$t,selectedSessionId:dt,onSelect:xe=>fe(xe)}),o.jsx(Hm,{events:Ss,eventsDropped:p,emptyState:!dt&&W?us?o.jsx("div",{className:L.emptyCta,"data-testid":"stream-blocked-message",children:o.jsx("div",{className:L.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):o.jsxs("div",{className:L.emptyCta,children:[o.jsx("button",{"data-testid":"stream-start-cta",className:L.ctaButton,onClick:()=>{w(W.id,void 0,ye).catch(()=>{})},children:"Start Task"}),o.jsx("div",{className:L.ctaDescription,children:"Click to begin agent execution"})]}):dt&&Ss.length===0?o.jsx("div",{className:L.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:L.tabContent,children:ct?o.jsx(g1,{findings:x.filter(xe=>xe.workspaceId===ct)}):o.jsx("div",{className:L.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!W||W.status!=="working"&&W.status!=="paused")return;const xe=dt?g.find(Qe=>Qe.id===dt):void 0;if(!(!xe||xe.status==="stopped"))return o.jsx(Vr,{mode:"send",sessionId:xe.id,environmentId:xe.environmentId,personas:ne,environments:v,onSendInput:(Qe,on)=>{U(Qe,on).catch(()=>{})},onSpawn:(Qe,on,_n)=>{K(Qe,on,_n).catch(()=>{})},onStartTask:(Qe,on,_n)=>{w(Qe,on,_n).catch(()=>{})},onProvisionEnvironment:Qe=>{F(Qe).catch(()=>{})},onShowToast:d})})(),W&&o.jsx(xi,{isOpen:De,title:"Delete Task?",description:`"${W.title}" will be permanently removed.`,onConfirm:ks,onCancel:()=>Ne(!1)})]})}function i$(){const{environments:t,addEnvironment:s,updateEnvironment:i,listCodespaces:r,codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,createCodespace:h}=lt(),{showToast:g}=yn();return o.jsx(b1,{mode:"new",environments:t,onAddEnvironment:(v,x,b)=>{s(v,x,b).catch(()=>{})},onUpdateEnvironment:(v,x)=>{i(v,x).catch(()=>{})},onListCodespaces:()=>{r().catch(()=>{})},codespaces:c,codespaceError:d,codespaceListError:u,codespaceCreating:p,onCreateCodespace:(v,x)=>{h(v,x).catch(()=>{})},onShowToast:g})}function o$(){const{environmentId:t}=ds(),{environments:s,addEnvironment:i,updateEnvironment:r,listCodespaces:c,codespaces:d,codespaceError:u,codespaceListError:p,codespaceCreating:h,createCodespace:g}=lt(),{showToast:v}=yn();return o.jsx(b1,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(x,b,k)=>{i(x,b,k).catch(()=>{})},onUpdateEnvironment:(x,b)=>{r(x,b).catch(()=>{})},onListCodespaces:()=>{c().catch(()=>{})},codespaces:d,codespaceError:u,codespaceListError:p,codespaceCreating:h,onCreateCodespace:(x,b)=>{g(x,b).catch(()=>{})},onShowToast:v})}const r$="_layout_11u79_1",l$="_content_11u79_8",c$="_tabPanel_11u79_14",Pr={layout:r$,content:l$,tabPanel:c$};function d$(){const t=s8();return o.jsxs("div",{className:Pr.layout,children:[o.jsx(_s,{segments:t}),o.jsx("div",{className:Pr.content,children:o.jsx(za,{})})]})}const u$="_container_13sb6_1",f$="_envHeader_13sb6_6",p$="_envTitleRow_13sb6_10",m$="_statusDot_13sb6_16",h$="_envName_13sb6_21",g$="_statusBadge_13sb6_27",v$="_envMeta_13sb6_33",y$="_metaTag_13sb6_39",b$="_actions_13sb6_51",x$="_provisionMessage_13sb6_59",_$="_errorMessage_13sb6_64",k$="_section_13sb6_69",S$="_sectionHeader_13sb6_73",T$="_cardList_13sb6_121",j$="_card_13sb6_121",w$="_cardHeader_13sb6_138",N$="_cardName_13sb6_144",C$="_cardActions_13sb6_149",E$="_cardDescription_13sb6_154",A$="_cardMeta_13sb6_160",D$="_repoLink_13sb6_166",R$="_empty_13sb6_174",M$="_btnPrimary_13sb6_180",I$="_btnOutline_13sb6_214",O$="_btnSmall_13sb6_241",L$="_btnDanger_13sb6_267",Ae={container:u$,envHeader:f$,envTitleRow:p$,statusDot:m$,envName:h$,statusBadge:g$,envMeta:v$,metaTag:y$,actions:b$,provisionMessage:x$,errorMessage:_$,section:k$,sectionHeader:S$,cardList:T$,card:j$,cardHeader:w$,cardName:N$,cardActions:C$,cardDescription:E$,cardMeta:A$,repoLink:D$,empty:R$,btnPrimary:M$,btnOutline:I$,btnSmall:O$,btnDanger:L$};function B$(){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(_e,{width:"0.875rem",height:"0.875rem",variant:"circular"}),o.jsx(_e,{width:"12rem",height:"1.5rem"}),o.jsx(_e,{width:"4rem",height:"0.875rem"})]}),o.jsxs("div",{className:Ae.envMeta,children:[o.jsx(_e,{width:"6rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{width:"4.5rem",height:"1.25rem",borderRadius:"var(--radius-sm)"})]})]}),o.jsxs("div",{className:Ae.actions,children:[o.jsx(_e,{width:"5rem",height:"2rem",borderRadius:"var(--radius-sm)"}),o.jsx(_e,{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(td,{lines:2}),o.jsx(td,{lines:2})]})]})]})}const z$={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function U$(){const{environmentId:t}=ds(),s=_t(),{environments:i,workspaces:r,sessions:c,provisionStatus:d,provisionEnvironment:u,stopEnvironment:p,removeEnvironment:h,archiveWorkspace:g,environmentsLoading:v}=lt(),[x,b]=y.useState(!1),[k,S]=y.useState(!1),[w,N]=y.useState(void 0),T=i.find(ae=>ae.id===t);if(!T&&v)return o.jsx(B$,{});if(!t||!T)return o.jsx(rs,{to:To,replace:!0});const C=r.filter(ae=>ae.environmentId===T.id),E=c.filter(ae=>ae.environmentId===T.id),D=E.reduce((ae,X)=>ae+(X.costUsd??0),0),A=z$[T.status]||"var(--text-tertiary)",B=T.status==="connected",R=T.status==="connecting",U=T.status==="disconnected"||T.status==="error"||T.status==="sleeping",K=T.id in d?d[T.id]:void 0,ne=()=>{h(T.id).catch(()=>{}),b(!1),s(To,{replace:!0})},F=()=>{S(!1),u(T.id,!0).catch(()=>{})},ee=ae=>{g(ae).catch(()=>{}),N(void 0)};return o.jsxs("div",{className:Ae.container,children:[o.jsx(xi,{isOpen:x,title:"Delete Environment?",description:`"${T.displayName||T.id}" will be permanently removed along with all its data.`,onConfirm:ne,onCancel:()=>b(!1)}),o.jsx(xi,{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:F,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:A},children:"●"}),o.jsx("h2",{className:Ae.envName,children:T.displayName||T.id}),o.jsx("span",{className:Ae.statusBadge,style:{color:A},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: ",jo(D)]})]})]}),o.jsxs("div",{className:Ae.actions,children:[B&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:Ae.btnPrimary,onClick:()=>s(Tx(T.id)),children:"New Chat"}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>{p(T.id).catch(()=>{})},children:"Stop"}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>S(!0),disabled:K!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),U&&o.jsx("button",{className:Ae.btnPrimary,onClick:()=>{u(T.id).catch(()=>{})},children:T.status==="error"?"Retry":T.status==="sleeping"?"Wake":"Connect"}),R&&K!==void 0&&o.jsx("span",{className:Ae.provisionMessage,children:K.message}),T.status==="error"&&(K==null?void 0:K.stage)==="error"&&o.jsx("span",{className:Ae.errorMessage,children:K.message}),o.jsx("button",{className:Ae.btnOutline,onClick:()=>s(qw(T.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),o.jsx("button",{className:Ae.btnDanger,onClick:()=>b(!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(`${wx}?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($$,{workspace:ae,confirmArchiveId:w,onOpen:()=>s(vi(ae.id,T.id)),onArchive:()=>N(ae.id),onConfirmArchive:()=>ee(ae.id),onCancelArchive:()=>N(void 0)},ae.id))})]})]})}function $$({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 P$={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function V$(){const s=Ht().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=P$[s],r=n8(i);return o.jsxs("div",{className:Pr.layout,children:[o.jsx(_s,{segments:r}),o.jsx("div",{className:Pr.content,children:o.jsx("div",{className:Pr.tabPanel,children:o.jsx(za,{})},s)})]})}function H$(){const{tokens:t,setToken:s,deleteToken:i,credentialProviders:r,updateCredentialProviders:c}=lt(),{showToast:d}=yn();return o.jsxs(o.Fragment,{children:[o.jsx(SL,{credentialProviders:r,onUpdateCredentialProviders:u=>{c(u).catch(()=>{})}}),o.jsx(vO,{tokens:t,onSetToken:(u,p,h,g,v)=>{s(u,p,h,g,v).catch(()=>{})},onDeleteToken:u=>{i(u).catch(()=>{})},onShowToast:d})]})}function q$(){const{personas:t,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:r}=lt(),{showToast:c}=yn(),d=_t();return o.jsx(LL,{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(Fw),onNavigateToPersona:u=>d(jx(u))})}const G$="_container_1ooin_1",F$="_form_1ooin_7",Z$="_formActions_1ooin_75",K$="_editableSection_1ooin_82",Y$="_defaultBadge_1ooin_93",J$="_typeToggle_1ooin_107",W$="_scriptEditor_1ooin_121",X$="_optional_1ooin_128",is={container:G$,form:F$,formActions:Z$,editableSection:K$,defaultBadge:Y$,typeToggle:J$,scriptEditor:W$,optional:X$},Fb=[{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)"}],Zb=[{value:"genaiscript",label:"genaiscript"}],Q$="0";function Kb(){const{personaId:t}=ds(),s=_t(),{showToast:i}=yn(),{personas:r,createPersona:c,updatePersona:d,deletePersona:u,appDefaultPersonaId:p,setAppDefaultPersonaId:h}=lt(),g=t===void 0,v=g?void 0:r.find(b=>b.id===t);if(!g&&r.length>0&&!v)return o.jsx(rs,{to:Lf,replace:!0});const x=[{label:"Settings",url:So},{label:"Personas",url:Lf},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return o.jsxs("div",{className:is.container,children:[o.jsx(_s,{segments:x}),o.jsx(e9,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:d,onDeletePersona:u,onSetAppDefaultPersonaId:h,onDone:()=>{s(Lf)},showToast:i})]})}function e9({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:r,onUpdatePersona:c,onDeletePersona:d,onSetAppDefaultPersonaId:u,onDone:p,showToast:h}){const g=_t(),[v,x]=y.useState((t==null?void 0:t.name)??""),[b,k]=y.useState((t==null?void 0:t.description)??""),[S,w]=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,A]=y.useState((t==null?void 0:t.maxTurns)??0),[B,R]=y.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[U,K]=y.useState((t==null?void 0:t.script)??""),[ne,F]=y.useState((t==null?void 0:t.allowedMcpTools)??[]),[ee,ae]=y.useState(!1),[X,re]=y.useState(null),[O,G]=y.useState(!!s);y.useEffect(()=>{if(!s&&t&&!O){G(!0),x(t.name),k(t.description),w(t.systemPrompt);const ie=t.type==="script"?"script":"agent";T(ie==="script"?t.runtime||"genaiscript":t.runtime),E(t.model),A(t.maxTurns),R(ie),K(t.script||""),F(t.allowedMcpTools)}},[s,t,O]);const se=ie=>{R(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&&(B==="script"?U.trim().length>0:!!N&&!!C),Ge=s&&de,De=!s&&i===(t==null?void 0:t.id),Ne=!s&&t&&!De&&B==="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,b,S,N,C,D,B,U).then(()=>{h("Persona updated","success"),p()},()=>{h("Failed to save persona","error")});return}r(v,b,S,N,C,D,B,U,ne).then(W=>{h("Persona created","success"),g(jx(W.id),{replace:!0})},()=>{h("Failed to save persona","error")})}},ye=()=>{t&&d(t.id).then(()=>{h("Persona deleted","success"),p()},()=>{h("Failed to delete persona","error")})},me=async(ie,W,ct,Le)=>ie().then(()=>{W(),h(ct,"success")},()=>{h(Le,"error")}),Ue=(ie,W)=>{if(!t)return;const ct=ie==="type"?String(W):B,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):b,ta,Le,$t,dt,ct,ks),()=>{if(ie==="type"){const xn=String(W)==="script"?"script":"agent";R(xn),T(Le)}ie==="runtime"&&T(String(W)),ie==="name"&&x(String(W)),ie==="description"&&k(String(W)),ie==="systemPrompt"&&w(String(W)),ie==="model"&&E(String(W)),ie==="maxTurns"&&A(Number(W)),ie==="script"&&K(String(W))},"Persona updated","Failed to update persona").catch(()=>{})},pt=ie=>{fe(ie)},bn=()=>{t&&u(t.id).then(()=>{h("Set as app default","success")},()=>{h("Failed to set app default","error")})};return o.jsxs(o.Fragment,{children:[ue?o.jsxs("div",{className:is.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsx("p",{children:"Loading persona..."})]}):s?o.jsxs("form",{onSubmit:pt,className:is.form,children:[o.jsx("h3",{children:"Create Persona"}),o.jsxs("div",{className:is.typeToggle,"data-testid":"persona-type-toggle",children:[o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:B==="agent",onChange:()=>se("agent")}),"Agent"]}),o.jsxs("label",{children:[o.jsx("input",{type:"radio",name:"personaType",value:"script",checked:B==="script",onChange:()=>se("script")}),"Script"]})]}),o.jsxs("label",{children:["Name",o.jsx("input",{type:"text",value:v,onChange:ie=>x(ie.target.value),placeholder:B==="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:b,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:(B==="script"?Zb:Fb).map(ie=>o.jsx("option",{value:ie.value,children:ie.label},ie.value))})]}),B==="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=>A(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=>w(ie.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),B==="script"&&o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:["Model ",o.jsx("span",{className:is.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=>w(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=>K(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:is.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),B==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(Ob,{selectedTools:ne,onChange:F})]}),o.jsxs("div",{className:is.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:is.form,children:[o.jsx("h3",{children:"Edit Persona"}),o.jsxs("div",{className:is.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:is.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:is.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:X,onActivate:re,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),o.jsxs("label",{children:["Description",o.jsx(en,{value:b,onSave:ie=>{Ue("description",ie)},fieldId:"persona-description",activeFieldId:X,onActivate:re,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),o.jsxs("label",{children:["Type",o.jsx(nd,{value:B,onSave:ie=>{Ue("type",ie)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:X,onActivate:re,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),o.jsxs("label",{children:["Runtime",o.jsx(nd,{value:N,onSave:ie=>{Ue("runtime",ie)},options:B==="script"?Zb:Fb,fieldId:"persona-runtime",activeFieldId:X,onActivate:re,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),o.jsxs("label",{children:["Model",B==="script"?" (optional)":"",o.jsx(en,{value:C,onSave:ie=>{Ue("model",ie)},validate:B==="agent"?ie=>Oe(ie,"Model"):void 0,fieldId:"persona-model",activeFieldId:X,onActivate:re,placeholder:B==="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:X,onActivate:re,placeholder:Q$,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),o.jsxs("label",{children:["System Prompt",o.jsx(qp,{value:S,onSave:ie=>{Ue("systemPrompt",ie)},validate:ie=>Oe(ie,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:X,onActivate:re,placeholder:B==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),B==="script"&&o.jsxs("label",{children:["Script",o.jsx(qp,{value:U,onSave:ie=>{Ue("script",ie)},validate:ie=>Oe(ie,"Script"),fieldId:"persona-script",activeFieldId:X,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"})]}),B==="agent"&&o.jsxs("div",{children:[o.jsx("label",{children:"Allowed MCP Tools"}),o.jsx(Ob,{selectedTools:ne,onChange:ie=>{F(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(xi,{isOpen:ee,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ye,onCancel:()=>ae(!1)})]})}function t9(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:r,setPreferSystem:c}=j1();return o.jsx(yO,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:r,onSetPreferSystem:c})}function n9(){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 s9(){const{connected:t,environments:s,sessions:i}=lt(),r=n9();return o.jsxs(o.Fragment,{children:[r&&o.jsx(k5,{currentVersion:r.currentVersion,latestVersion:r.latestVersion,updateAvailable:r.updateAvailable,isDocker:r.isDocker}),o.jsx(bO,{connected:t,environments:s,sessions:i})]})}function a9(){return o.jsx(hL,{})}const Yb=Si();function i9(){const t=_t();return Js({key:"?"},()=>{t(Zw)}),Js({key:"n"},()=>{t(Yb)}),Js({key:"N"},()=>{t(Yb)}),o.jsx(o.Fragment,{})}function il(t){const s=WB();y.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function o9(){const{workspaces:t,tasks:s}=lt(),i=y.useMemo(()=>o.jsx(XI,{workspaces:t,tasks:s}),[t,s]);return il(i),o.jsx(za,{})}function r9(){const{environments:t}=lt(),s=y.useMemo(()=>o.jsx(lI,{environments:t}),[t]);return il(s),o.jsx(za,{})}function l9(){const t=y.useMemo(()=>o.jsx(sB,{}),[]);return il(t),o.jsx(za,{})}function c9(){const{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(bI,{findings:t,workspaceId:r,environmentId:c}),[t,r,c]);return il(d),o.jsx(za,{})}function d9(){const{knowledge:t,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(_4,{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 il(u),o.jsx(za,{})}const u9="_container_ce571_1",f9="_title_ce571_6",id={container:u9,title:f9};function p9(){return o.jsxs("div",{className:id.container,"aria-hidden":"true",children:[o.jsx("h1",{className:id.title,children:"Findings"}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"var(--space-sm)"},children:Array.from({length:4},(t,s)=>o.jsx(td,{lines:3},s))})]})}function Jb(){const{environmentId:t,workspaceId:s}=ds(),{findings:i,loadFindings:r,workspaces:c,environments:d,findingsLoading:u}=lt(),p=_t();y.useEffect(()=>{s&&r(s).catch(()=>{})},[s,r]);const h=y.useCallback(v=>{p(jp(v,s,t))},[p,s,t]);if(u)return o.jsx(p9,{});const g=s&&t?R1("Findings",s,t,c,d).slice(0,-1):c8();return o.jsxs("div",{className:id.container,"data-testid":"findings-list-page",children:[o.jsx(_s,{segments:g}),o.jsx("h1",{className:id.title,children:"Findings"}),o.jsx(g1,{findings:i,onFindingClick:h})]})}const m9="_container_1wwpb_1",h9="_notFound_1wwpb_6",g9="_header_1wwpb_12",v9="_categoryBadge_1wwpb_19",y9="_title_1wwpb_28",b9="_content_1wwpb_35",x9="_tags_1wwpb_77",_9="_tag_1wwpb_77",k9="_meta_1wwpb_92",S9="_metaTimestamp_1wwpb_100",T9="_metaLink_1wwpb_105",dn={container:m9,notFound:h9,header:g9,categoryBadge:v9,title:y9,content:b9,tags:x9,tag:_9,meta:k9,metaTimestamp:S9,metaLink:T9};function Wb(){const{findingId:t,environmentId:s,workspaceId:i}=ds(),{selectedFinding:r,findingLoading:c,loadFinding:d,workspaces:u,environments:p}=lt(),h=_t();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=R1(r.title,i,s,u,p),v=sd(r.category);return o.jsxs("div",{className:dn.container,"data-testid":"finding-detail-page",children:[o.jsx(_s,{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(od,{remarkPlugins:[rd],children:r.content})}),r.tags.length>0&&o.jsx("div",{className:dn.tags,children:r.tags.map(x=>o.jsx("span",{className:dn.tag,children:x},x))}),o.jsxs("div",{className:dn.meta,children:[o.jsx("span",{className:dn.metaTimestamp,title:r.createdAt,children:Gm(r.createdAt)}),r.taskId&&o.jsx("button",{type:"button",className:dn.metaLink,onClick:()=>{h(cs(r.taskId))},children:"View Task"}),r.sessionId&&o.jsx("button",{type:"button",className:dn.metaLink,onClick:()=>{h(rm(r.sessionId))},children:"View Session"})]})]})}const j9="_wizard_1260s_1",w9="_container_1260s_10",N9="_stepContent_1260s_19",C9="_logoArea_1260s_28",E9="_logoImage_1260s_32",A9="_heading_1260s_41",D9="_tagline_1260s_49",R9="_subtitle_1260s_56",M9="_featureList_1260s_64",I9="_runtimeGrid_1260s_89",O9="_runtimeCard_1260s_101",L9="_runtimeName_1260s_133",B9="_runtimeDescription_1260s_139",z9="_buttonRow_1260s_144",U9="_primaryButton_1260s_151",$9="_ghostButton_1260s_185",P9="_dots_1260s_213",V9="_dot_1260s_213",mt={wizard:j9,container:w9,stepContent:N9,logoArea:C9,logoImage:E9,heading:A9,tagline:D9,subtitle:R9,featureList:M9,runtimeGrid:I9,runtimeCard:O9,runtimeName:L9,runtimeDescription:B9,buttonRow:z9,primaryButton:U9,ghostButton:$9,dots:P9,dot:V9};function H9({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 q9({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 G9=[{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 F9({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:G9.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 Z9=3,Xb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function K9(){const{personas:t,updatePersona:s,completeOnboarding:i,onboardingCompleted:r}=lt(),{showToast:c}=yn(),d=_t(),[u,p]=y.useState(0),[h,g]=y.useState(!1),v=t.find(b=>b.id==="claude-code"),x=y.useCallback(b=>{g(!0);const k=[];if(v&&b!==v.runtime){const w=Xb[b]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,b,w))}const S=t.find(w=>w.id===H0);if(S&&b!==S.runtime){const w=Xb[b]??"sonnet";k.push(s(H0,void 0,void 0,void 0,b,w))}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(rs,{to:"/",replace:!0}):o.jsx("div",{className:mt.wizard,"data-testid":"setup-wizard",children:o.jsxs("div",{className:mt.container,children:[o.jsx(ls,{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(H9,{onNext:()=>p(1)}),u===1&&o.jsx(q9,{onNext:()=>p(2),onBack:()=>p(0)}),u===2&&o.jsx(F9,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:x,onBack:()=>p(1),finishDisabled:!v||h})]},u)}),o.jsx("div",{className:mt.dots,children:Array.from({length:Z9},(b,k)=>o.jsx("span",{className:mt.dot,"data-active":k===u},k))})]})})}const Y9="_root_zndgp_1",J9="_body_zndgp_7",W9="_main_zndgp_19",X9="_sidebarWrapper_zndgp_26",Q9="_overlay_zndgp_51",Or={root:Y9,body:J9,main:W9,sidebarWrapper:X9,overlay:Q9},eP=y.lazy(()=>kT(()=>import("./KnowledgePage-BG3nhSS6.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),I1=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function tP(){const{connected:t,environments:s,sessions:i,tasks:r}=lt(),{toasts:c,dismissToast:d}=yn(),u=Ht(),p=JB(),h=p!==void 0,[g,v]=y.useState(!1),x=y.useCallback(()=>v(b=>!b),[]);return y.useEffect(()=>{v(!1)},[u.pathname]),y.useEffect(()=>{if(!g)return;const b=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[g]),o.jsxs(o.Fragment,{children:[o.jsx(D4,{connected:t,environments:s,sessions:i,onToggleSidebar:h?x:void 0,sidebarOpen:g}),o.jsx(z4,{}),o.jsxs("div",{className:Or.body,children:[h&&o.jsx("div",{className:Or.sidebarWrapper,"data-sidebar-open":g,children:o.jsx(q4,{content:p})}),h&&g&&o.jsx("div",{className:Or.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),o.jsxs("div",{className:Or.main,children:[o.jsx(za,{}),o.jsx(X4,{sessions:i,tasks:r,environments:s})]})]}),o.jsx(u5,{toasts:c,onDismiss:d}),o.jsx(i9,{})]})}function nP(){const{lastSpawnedId:t,environments:s,tasks:i,connected:r,onboardingCompleted:c,environmentOperationError:d,clearEnvironmentOperationError:u}=lt(),{showToast:p}=yn();Y8(s,p),ez(i,p),J8(d,u,p);const h=_t(),g=Ht();return y.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&h(rm(t),{replace:!0})},[t,h,g.pathname]),r&&c===!1?o.jsx(rs,{to:"/setup",replace:!0}):o.jsx(YB,{children:o.jsxs("div",{className:Or.root,children:[I1&&o.jsx(SN,{}),o.jsx(tP,{})]})})}function xp(){const{workspaceId:t}=ds(),{workspaces:s}=lt(),i=Ht(),r=s.find(h=>h.id===t);if(!(r!=null&&r.environmentId))return s.length===0?void 0:o.jsx(rs,{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(rs,{to:p,replace:!0})}function sP(){return o.jsxs(lw,{children:[o.jsx(we,{path:"setup",element:o.jsx(K9,{})}),o.jsxs(we,{element:o.jsx(nP,{}),children:[o.jsx(we,{index:!0,element:o.jsx(SU,{})}),o.jsx(we,{path:"chat",element:o.jsx(MU,{})}),o.jsx(we,{path:"sessions/new",element:o.jsx(IU,{})}),o.jsx(we,{path:"sessions/:sessionId",element:o.jsx(zU,{})}),o.jsx(we,{element:o.jsx(d9,{}),children:o.jsx(we,{path:"knowledge",element:o.jsx(y.Suspense,{fallback:o.jsx(o1,{}),children:o.jsx(eP,{})})})}),o.jsxs(we,{element:o.jsx(o9,{}),children:[o.jsx(we,{path:"tasks",element:o.jsx(_U,{})}),o.jsx(we,{path:"tasks/new",element:o.jsx(qb,{})}),o.jsx(we,{path:"tasks/:taskId",element:o.jsx(Aa,{})}),o.jsx(we,{path:"tasks/:taskId/edit",element:o.jsx(Aa,{})}),o.jsx(we,{path:"tasks/:taskId/stream",element:o.jsx(Aa,{})}),o.jsx(we,{path:"tasks/:taskId/findings",element:o.jsx(Aa,{})})]}),o.jsxs(we,{element:o.jsx(c9,{}),children:[o.jsx(we,{path:"findings",element:o.jsx(Jb,{})}),o.jsx(we,{path:"findings/:findingId",element:o.jsx(Wb,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:o.jsx(Jb,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:o.jsx(Wb,{})})]}),o.jsxs(we,{element:o.jsx(r9,{}),children:[o.jsx(we,{path:"workspaces",element:o.jsx(rs,{to:"/environments",replace:!0})}),o.jsx(we,{path:"workspaces/new",element:o.jsx(QU,{})}),o.jsx(we,{path:"workspaces/:workspaceId",element:o.jsx(xp,{})}),o.jsx(we,{path:"workspaces/:workspaceId/tasks/:taskId",element:o.jsx(xp,{})}),o.jsx(we,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:o.jsx(xp,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId",element:o.jsx(VU,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:o.jsx(qb,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:o.jsx(Aa,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:o.jsx(Aa,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:o.jsx(Aa,{})}),o.jsx(we,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:o.jsx(Aa,{})}),o.jsxs(we,{path:"environments",element:o.jsx(d$,{}),children:[o.jsx(we,{index:!0,element:o.jsx(kU,{})}),o.jsx(we,{path:"new",element:o.jsx(i$,{})}),o.jsx(we,{path:":environmentId",element:o.jsx(U$,{})}),o.jsx(we,{path:":environmentId/edit",element:o.jsx(o$,{})})]})]}),o.jsx(we,{element:o.jsx(l9,{}),children:o.jsxs(we,{path:"settings",element:o.jsx(V$,{}),children:[o.jsx(we,{index:!0,element:o.jsx(rs,{to:"credentials",replace:!0})}),o.jsx(we,{path:"environments",element:o.jsx(rs,{to:"/environments",replace:!0})}),o.jsx(we,{path:"credentials",element:o.jsx(H$,{})}),o.jsx(we,{path:"tokens",element:o.jsx(rs,{to:"../credentials",replace:!0})}),o.jsx(we,{path:"personas",element:o.jsx(q$,{})}),o.jsx(we,{path:"personas/new",element:o.jsx(Kb,{})}),o.jsx(we,{path:"personas/:personaId",element:o.jsx(Kb,{})}),o.jsx(we,{path:"appearance",element:o.jsx(t9,{})}),o.jsx(we,{path:"shortcuts",element:o.jsx(a9,{})}),o.jsx(we,{path:"about",element:o.jsx(s9,{})})]})}),o.jsx(we,{path:"*",element:o.jsx(rs,{to:"/",replace:!0})})]})]})}const aP=1e4;function iP(){const{onboardingCompleted:t}=lt(),[s,i]=y.useState(!1);y.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),aP);return()=>clearTimeout(c)},[t]);const r=t===void 0&&!s;return o.jsx(ls,{mode:"wait",children:r?o.jsx(Et.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:o.jsx(o1,{})},"splash"):o.jsx(Et.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:o.jsx(Mw,{basename:"/".replace(/\/$/,""),children:o.jsx(sP,{})})},"app")})}function oP(){const t=I1?T8:K8;return o.jsx(KB,{children:o.jsx(qB,{children:o.jsx(t,{children:o.jsx(iP,{})})})})}bT.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(oP,{})}));export{_s as B,Nx as K,lt as a,jp as f,rm as s,cs as t,_t as u};