@grackle-ai/web 0.90.0 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,715 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KnowledgePage-5UF9Wqu5.js","assets/dagview-Dv4uDOZ5.js","assets/grpc-CRztlRZY.js","assets/markdown-Bpil_wz-.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as PS,a as VS,b,j as r,d as I0,H as O0,P as B0,i as HS,B as qS,c as GS,C as FS,M as ZS}from"./dagview-Dv4uDOZ5.js";import{c as KS,a as YS,G as JS,f as WS,M as XS,A as Kb,D as Yb,W as QS,O as eT,b as tT,C as Kr,d as nT,e as Jb,w as sT,t as aT,p as bc,g as iT,R as _r,S as L0}from"./grpc-CRztlRZY.js";import{v as oT,r as rT,t as _c,i as lT,f as cT,M as tu,a as nu}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"]'))o(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();var wf={exports:{}},xr={},Nf={exports:{}},jf={};/**
3
- * @license React
4
- * scheduler.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var z0;function uT(){return z0||(z0=1,(function(t){function s(B,Z){var ne=B.length;B.push(Z);e:for(;0<ne;){var re=ne-1>>>1,ue=B[re];if(0<c(ue,Z))B[re]=Z,B[ne]=ue,ne=re;else break e}}function i(B){return B.length===0?null:B[0]}function o(B){if(B.length===0)return null;var Z=B[0],ne=B.pop();if(ne!==Z){B[0]=ne;e:for(var re=0,ue=B.length,Ke=ue>>>1;re<Ke;){var je=2*(re+1)-1,Te=B[je],Ie=je+1,le=B[Ie];if(0>c(Te,ne))Ie<ue&&0>c(le,Te)?(B[re]=le,B[Ie]=ne,re=Ie):(B[re]=Te,B[je]=ne,re=je);else if(Ie<ue&&0>c(le,ne))B[re]=le,B[Ie]=ne,re=Ie;else break e}}return Z}function c(B,Z){var ne=B.sortIndex-Z.sortIndex;return ne!==0?ne:B.id-Z.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var d=Date,p=d.now();t.unstable_now=function(){return d.now()-p}}var h=[],g=[],v=1,y=null,_=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 R(B){for(var Z=i(g);Z!==null;){if(Z.callback===null)o(g);else if(Z.startTime<=B)o(g),Z.sortIndex=Z.expirationTime,s(h,Z);else break;Z=i(g)}}function D(B){if(w=!1,R(B),!S)if(i(h)!==null)S=!0,A||(A=!0,ae());else{var Z=i(g);Z!==null&&ee(D,Z.startTime-B)}}var A=!1,q=-1,$=5,Y=-1;function G(){return N?!0:!(t.unstable_now()-Y<$)}function Q(){if(N=!1,A){var B=t.unstable_now();Y=B;var Z=!0;try{e:{S=!1,w&&(w=!1,C(q),q=-1),k=!0;var ne=_;try{t:{for(R(B),y=i(h);y!==null&&!(y.expirationTime>B&&G());){var re=y.callback;if(typeof re=="function"){y.callback=null,_=y.priorityLevel;var ue=re(y.expirationTime<=B);if(B=t.unstable_now(),typeof ue=="function"){y.callback=ue,R(B),Z=!0;break t}y===i(h)&&o(h),R(B)}else o(h);y=i(h)}if(y!==null)Z=!0;else{var Ke=i(g);Ke!==null&&ee(D,Ke.startTime-B),Z=!1}}break e}finally{y=null,_=ne,k=!1}Z=void 0}}finally{Z?ae():A=!1}}}var ae;if(typeof E=="function")ae=function(){E(Q)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,ie=me.port2;me.port1.onmessage=Q,ae=function(){ie.postMessage(null)}}else ae=function(){T(Q,0)};function ee(B,Z){q=T(function(){B(t.unstable_now())},Z)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_next=function(B){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var ne=_;_=Z;try{return B()}finally{_=ne}},t.unstable_requestPaint=function(){N=!0},t.unstable_runWithPriority=function(B,Z){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ne=_;_=B;try{return Z()}finally{_=ne}},t.unstable_scheduleCallback=function(B,Z,ne){var re=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?re+ne:re):ne=re,B){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=ne+ue,B={id:v++,callback:Z,priorityLevel:B,startTime:ne,expirationTime:ue,sortIndex:-1},ne>re?(B.sortIndex=ne,s(g,B),i(h)===null&&B===i(g)&&(w?(C(q),q=-1):w=!0,ee(D,ne-re))):(B.sortIndex=ue,s(h,B),S||k||(S=!0,A||(A=!0,ae()))),B},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(B){var Z=_;return function(){var ne=_;_=Z;try{return B.apply(this,arguments)}finally{_=ne}}}})(jf)),jf}var U0;function dT(){return U0||(U0=1,Nf.exports=uT()),Nf.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 $0;function fT(){if($0)return xr;$0=1;var t=dT(),s=PS(),i=VS();function o(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 u(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 d(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(u(e)!==e)throw Error(o(188))}function g(e){var n=e.alternate;if(!n){if(n=u(e),n===null)throw Error(o(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(o(188))}if(a.return!==l.return)a=f,l=m;else{for(var x=!1,j=f.child;j;){if(j===a){x=!0,a=f,l=m;break}if(j===l){x=!0,l=f,a=m;break}j=j.sibling}if(!x){for(j=m.child;j;){if(j===a){x=!0,a=m,l=f;break}if(j===l){x=!0,l=m,a=f;break}j=j.sibling}if(!x)throw Error(o(189))}}if(a.alternate!==l)throw Error(o(190))}if(a.tag!==3)throw Error(o(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 y=Object.assign,_=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"),R=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function ae(e){return e===null||typeof e!="object"?null:(e=Q&&e[Q]||e["@@iterator"],typeof e=="function"?e:null)}var me=Symbol.for("react.client.reference");function ie(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===me?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 D:return"Suspense";case A:return"SuspenseList";case Y: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 R:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return n=e.displayName||null,n!==null?n:ie(e.type)||"Memo";case $:n=e._payload,e=e._init;try{return ie(e(n))}catch{}}return null}var ee=Array.isArray,B=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ue=-1;function Ke(e){return{current:e}}function je(e){0>ue||(e.current=re[ue],re[ue]=null,ue--)}function Te(e,n){ue++,re[ue]=e.current,e.current=n}var Ie=Ke(null),le=Ke(null),ve=Ke(null),de=Ke(null);function Oe(e,n){switch(Te(ve,n),Te(le,e),Te(Ie,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?s0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=s0(n),e=a0(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}je(Ie),Te(Ie,e)}function _t(){je(Ie),je(le),je(ve)}function vn(e){e.memoizedState!==null&&Te(de,e);var n=Ie.current,a=a0(n,e.type);n!==a&&(Te(le,e),Te(Ie,a))}function L(e){le.current===e&&(je(Ie),je(le)),de.current===e&&(je(de),gr._currentValue=ne)}var Me,et;function tt(e){if(Me===void 0)try{throw Error()}catch(a){var n=a.stack.trim().match(/\n( *(at )?)/);Me=n&&n[1]||"",et=-1<a.stack.indexOf(`
19
- at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
20
- `+Me+e+et}var qe=!1;function cs(e,n){if(!e||qe)return"";qe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(n){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(K){var F=K}Reflect.construct(e,[],X)}else{try{X.call()}catch(K){F=K}e.call(X.prototype)}}else{try{throw Error()}catch(K){F=K}(X=e())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(K){if(K&&F&&typeof K.stack=="string")return[K.stack,F.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(),x=m[0],j=m[1];if(x&&j){var M=x.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 J=`
23
- `+M[l].replace(" at new "," at ");return e.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",e.displayName)),J}while(1<=l&&0<=f);break}}}finally{qe=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?tt(a):""}function ea(e,n){switch(e.tag){case 26:case 27:case 5:return tt(e.type);case 16:return tt("Lazy");case 13:return e.child!==n&&n!==null?tt("Suspense Fallback"):tt("Suspense");case 19:return tt("SuspenseList");case 0:case 15:return cs(e.type,!1);case 11:return cs(e.type.render,!1);case 1:return cs(e.type,!0);case 31:return tt("Activity");default:return""}}function An(e){try{var n="",a=null;do n+=ea(e,a),a=e,e=e.return;while(e);return n}catch(l){return`
24
- Error generating stack: `+l.message+`
25
- `+l.stack}}var Zn=Object.prototype.hasOwnProperty,us=t.unstable_scheduleCallback,ta=t.unstable_cancelCallback,Kn=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Ce=t.unstable_now,cn=t.unstable_getCurrentPriorityLevel,yn=t.unstable_ImmediatePriority,ks=t.unstable_UserBlockingPriority,ds=t.unstable_NormalPriority,Ti=t.unstable_LowPriority,Ua=t.unstable_IdlePriority,wi=t.log,sl=t.unstable_setDisableYieldValue,na=null,Qt=null;function Yn(e){if(typeof wi=="function"&&sl(e),Qt&&typeof Qt.setStrictMode=="function")try{Qt.setStrictMode(na,e)}catch{}}var en=Math.clz32?Math.clz32:ol,al=Math.log,il=Math.LN2;function ol(e){return e>>>=0,e===0?32:31-(al(e)/il|0)|0}var $a=256,Pa=262144,Va=4194304;function Ss(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,x=e.pingedLanes;e=e.warmLanes;var j=l&134217727;return j!==0?(l=j&~m,l!==0?f=Ss(l):(x&=j,x!==0?f=Ss(x):a||(a=j&~e,a!==0&&(f=Ss(a))))):(j=l&~m,j!==0?f=Ss(j):x!==0?f=Ss(x):a||(a=l&~e,a!==0&&(f=Ss(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 oe(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 ce(){var e=Va;return Va<<=1,(Va&62914560)===0&&(Va=4194304),e}function fe(e){for(var n=[],a=0;31>a;a++)n.push(e);return n}function ze(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ye(e,n,a,l,f,m){var x=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var j=e.entanglements,M=e.expirationTimes,H=e.hiddenUpdates;for(a=x&~a;0<a;){var J=31-en(a),X=1<<J;j[J]=0,M[J]=-1;var F=H[J];if(F!==null)for(H[J]=null,J=0;J<F.length;J++){var K=F[J];K!==null&&(K.lane&=-536870913)}a&=~X}l!==0&&Ae(e,l,0),m!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=m&~(x&~n))}function Ae(e,n,a){e.pendingLanes|=n,e.suspendedLanes&=~n;var l=31-en(n);e.entangledLanes|=n,e.entanglements[l]=e.entanglements[l]|1073741824|a&261930}function Fe(e,n){var a=e.entangledLanes|=n;for(e=e.entanglements;a;){var l=31-en(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:Ze(a),(a&(e.suspendedLanes|n))!==0?0:a}function Ze(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 Ut(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ft(){var e=Z.p;return e!==0?e:(e=window.event,e===void 0?32:j0(e.type))}function Et(e,n){var a=Z.p;try{return Z.p=e,n()}finally{Z.p=a}}var sn=Math.random().toString(36).slice(2),pt="__reactFiber$"+sn,Vt="__reactProps$"+sn,Ni="__reactContainer$"+sn,hu="__reactEvents$"+sn,Ax="__reactListeners$"+sn,Dx="__reactHandles$"+sn,qm="__reactResources$"+sn,Do="__reactMarker$"+sn;function gu(e){delete e[pt],delete e[Vt],delete e[hu],delete e[Ax],delete e[Dx]}function ji(e){var n=e[pt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[Ni]||a[pt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=d0(e);e!==null;){if(a=e[pt])return a;e=d0(e)}return n}e=a,a=e.parentNode}return null}function Ci(e){if(e=e[pt]||e[Ni]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Ro(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function Ei(e){var n=e[qm];return n||(n=e[qm]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ht(e){e[Do]=!0}var Gm=new Set,Fm={};function Ha(e,n){Ai(e,n),Ai(e+"Capture",n)}function Ai(e,n){for(Fm[e]=n,e=0;e<n.length;e++)Gm.add(n[e])}var Rx=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]*$"),Zm={},Km={};function Mx(e){return Zn.call(Km,e)?!0:Zn.call(Zm,e)?!1:Rx.test(e)?Km[e]=!0:(Zm[e]=!0,!1)}function rl(e,n,a){if(Mx(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 ll(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 Ts(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 Dn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ym(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ix(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(x){a=""+x,m.call(this,x)}}),Object.defineProperty(e,n,{enumerable:l.enumerable}),{getValue:function(){return a},setValue:function(x){a=""+x},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function vu(e){if(!e._valueTracker){var n=Ym(e)?"checked":"value";e._valueTracker=Ix(e,n,""+e[n])}}function Jm(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=Ym(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function cl(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 Ox=/[\n"\\]/g;function Rn(e){return e.replace(Ox,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function yu(e,n,a,l,f,m,x,j){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Dn(n)):e.value!==""+Dn(n)&&(e.value=""+Dn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?bu(e,x,Dn(n)):a!=null?bu(e,x,Dn(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=""+Dn(j):e.removeAttribute("name")}function Wm(e,n,a,l,f,m,x,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)){vu(e);return}a=a!=null?""+Dn(a):"",n=n!=null?""+Dn(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,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),vu(e)}function bu(e,n,a){n==="number"&&cl(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Di(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=""+Dn(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 Xm(e,n,a){if(n!=null&&(n=""+Dn(n),n!==e.value&&(e.value=n),a==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=a!=null?""+Dn(a):""}function Qm(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(o(92));if(ee(l)){if(1<l.length)throw Error(o(93));l=l[0]}a=l}a==null&&(a=""),n=a}a=Dn(n),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l),vu(e)}function Ri(e,n){if(n){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=n;return}}e.textContent=n}var Bx=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 eh(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||Bx.has(n)?n==="float"?e.cssFloat=a:e[n]=(""+a).trim():e[n]=a+"px"}function th(e,n,a){if(n!=null&&typeof n!="object")throw Error(o(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&&eh(e,f,l)}else for(var m in n)n.hasOwnProperty(m)&&eh(e,m,n[m])}function _u(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 Lx=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"]]),zx=/^[\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 ul(e){return zx.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ws(){}var xu=null;function ku(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Mi=null,Ii=null;function nh(e){var n=Ci(e);if(n&&(e=n.stateNode)){var a=e[Vt]||null;e:switch(e=n.stateNode,n.type){case"input":if(yu(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="'+Rn(""+n)+'"][type="radio"]'),n=0;n<a.length;n++){var l=a[n];if(l!==e&&l.form===e.form){var f=l[Vt]||null;if(!f)throw Error(o(90));yu(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&&Jm(l)}break e;case"textarea":Xm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Di(e,!!a.multiple,n,!1)}}}var Su=!1;function sh(e,n,a){if(Su)return e(n,a);Su=!0;try{var l=e(n);return l}finally{if(Su=!1,(Mi!==null||Ii!==null)&&(Wl(),Mi&&(n=Mi,e=Ii,Ii=Mi=null,nh(n),e)))for(n=0;n<e.length;n++)nh(e[n])}}function Mo(e,n){var a=e.stateNode;if(a===null)return null;var l=a[Vt]||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(o(231,n,typeof a));return a}var Ns=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tu=!1;if(Ns)try{var Io={};Object.defineProperty(Io,"passive",{get:function(){Tu=!0}}),window.addEventListener("test",Io,Io),window.removeEventListener("test",Io,Io)}catch{Tu=!1}var sa=null,wu=null,dl=null;function ah(){if(dl)return dl;var e,n=wu,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 x=a-e;for(l=1;l<=x&&n[a-l]===f[m-l];l++);return dl=f.slice(e,1<l?1-l:void 0)}function fl(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 pl(){return!0}function ih(){return!1}function un(e){function n(a,l,f,m,x){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=x,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)?pl:ih,this.isPropagationStopped=ih,this}return y(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=pl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=pl)},persist:function(){},isPersistent:pl}),n}var qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ml=un(qa),Oo=y({},qa,{view:0,detail:0}),Ux=un(Oo),Nu,ju,Bo,hl=y({},Oo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Eu,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!==Bo&&(Bo&&e.type==="mousemove"?(Nu=e.screenX-Bo.screenX,ju=e.screenY-Bo.screenY):ju=Nu=0,Bo=e),Nu)},movementY:function(e){return"movementY"in e?e.movementY:ju}}),oh=un(hl),$x=y({},hl,{dataTransfer:0}),Px=un($x),Vx=y({},Oo,{relatedTarget:0}),Cu=un(Vx),Hx=y({},qa,{animationName:0,elapsedTime:0,pseudoElement:0}),qx=un(Hx),Gx=y({},qa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Fx=un(Gx),Zx=y({},qa,{data:0}),rh=un(Zx),Kx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Yx={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"},Jx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Jx[e])?!!n[e]:!1}function Eu(){return Wx}var Xx=y({},Oo,{key:function(e){if(e.key){var n=Kx[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=fl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Yx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Eu,charCode:function(e){return e.type==="keypress"?fl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qx=un(Xx),ek=y({},hl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lh=un(ek),tk=y({},Oo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eu}),nk=un(tk),sk=y({},qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),ak=un(sk),ik=y({},hl,{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}),ok=un(ik),rk=y({},qa,{newState:0,oldState:0}),lk=un(rk),ck=[9,13,27,32],Au=Ns&&"CompositionEvent"in window,Lo=null;Ns&&"documentMode"in document&&(Lo=document.documentMode);var uk=Ns&&"TextEvent"in window&&!Lo,ch=Ns&&(!Au||Lo&&8<Lo&&11>=Lo),uh=" ",dh=!1;function fh(e,n){switch(e){case"keyup":return ck.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ph(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oi=!1;function dk(e,n){switch(e){case"compositionend":return ph(n);case"keypress":return n.which!==32?null:(dh=!0,uh);case"textInput":return e=n.data,e===uh&&dh?null:e;default:return null}}function fk(e,n){if(Oi)return e==="compositionend"||!Au&&fh(e,n)?(e=ah(),dl=wu=sa=null,Oi=!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 ch&&n.locale!=="ko"?null:n.data;default:return null}}var pk={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 mh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!pk[e.type]:n==="textarea"}function hh(e,n,a,l){Mi?Ii?Ii.push(l):Ii=[l]:Mi=l,n=ac(n,"onChange"),0<n.length&&(a=new ml("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var zo=null,Uo=null;function mk(e){Wv(e,0)}function gl(e){var n=Ro(e);if(Jm(n))return e}function gh(e,n){if(e==="change")return n}var vh=!1;if(Ns){var Du;if(Ns){var Ru="oninput"in document;if(!Ru){var yh=document.createElement("div");yh.setAttribute("oninput","return;"),Ru=typeof yh.oninput=="function"}Du=Ru}else Du=!1;vh=Du&&(!document.documentMode||9<document.documentMode)}function bh(){zo&&(zo.detachEvent("onpropertychange",_h),Uo=zo=null)}function _h(e){if(e.propertyName==="value"&&gl(Uo)){var n=[];hh(n,Uo,e,ku(e)),sh(mk,n)}}function hk(e,n,a){e==="focusin"?(bh(),zo=n,Uo=a,zo.attachEvent("onpropertychange",_h)):e==="focusout"&&bh()}function gk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return gl(Uo)}function vk(e,n){if(e==="click")return gl(n)}function yk(e,n){if(e==="input"||e==="change")return gl(n)}function bk(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var bn=typeof Object.is=="function"?Object.is:bk;function $o(e,n){if(bn(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(!Zn.call(n,f)||!bn(e[f],n[f]))return!1}return!0}function xh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function kh(e,n){var a=xh(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=xh(a)}}function Sh(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Sh(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Th(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=cl(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=cl(e.document)}return n}function Mu(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 _k=Ns&&"documentMode"in document&&11>=document.documentMode,Bi=null,Iu=null,Po=null,Ou=!1;function wh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Ou||Bi==null||Bi!==cl(l)||(l=Bi,"selectionStart"in l&&Mu(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}),Po&&$o(Po,l)||(Po=l,l=ac(Iu,"onSelect"),0<l.length&&(n=new ml("onSelect","select",null,n,a),e.push({event:n,listeners:l}),n.target=Bi)))}function Ga(e,n){var a={};return a[e.toLowerCase()]=n.toLowerCase(),a["Webkit"+e]="webkit"+n,a["Moz"+e]="moz"+n,a}var Li={animationend:Ga("Animation","AnimationEnd"),animationiteration:Ga("Animation","AnimationIteration"),animationstart:Ga("Animation","AnimationStart"),transitionrun:Ga("Transition","TransitionRun"),transitionstart:Ga("Transition","TransitionStart"),transitioncancel:Ga("Transition","TransitionCancel"),transitionend:Ga("Transition","TransitionEnd")},Bu={},Nh={};Ns&&(Nh=document.createElement("div").style,"AnimationEvent"in window||(delete Li.animationend.animation,delete Li.animationiteration.animation,delete Li.animationstart.animation),"TransitionEvent"in window||delete Li.transitionend.transition);function Fa(e){if(Bu[e])return Bu[e];if(!Li[e])return e;var n=Li[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in Nh)return Bu[e]=n[a];return e}var jh=Fa("animationend"),Ch=Fa("animationiteration"),Eh=Fa("animationstart"),xk=Fa("transitionrun"),kk=Fa("transitionstart"),Sk=Fa("transitioncancel"),Ah=Fa("transitionend"),Dh=new Map,Lu="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(" ");Lu.push("scrollEnd");function Jn(e,n){Dh.set(e,n),Ha(n,[e])}var vl=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)},Mn=[],zi=0,zu=0;function yl(){for(var e=zi,n=zu=zi=0;n<e;){var a=Mn[n];Mn[n++]=null;var l=Mn[n];Mn[n++]=null;var f=Mn[n];Mn[n++]=null;var m=Mn[n];if(Mn[n++]=null,l!==null&&f!==null){var x=l.pending;x===null?f.next=f:(f.next=x.next,x.next=f),l.pending=f}m!==0&&Rh(a,f,m)}}function bl(e,n,a,l){Mn[zi++]=e,Mn[zi++]=n,Mn[zi++]=a,Mn[zi++]=l,zu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Uu(e,n,a,l){return bl(e,n,a,l),_l(e)}function Za(e,n){return bl(e,null,null,n),_l(e)}function Rh(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-en(a),e=m.hiddenUpdates,l=e[f],l===null?e[f]=[n]:l.push(n),n.lane=a|536870912),m):null}function _l(e){if(50<cr)throw cr=0,Kd=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Ui={};function Tk(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 _n(e,n,a,l){return new Tk(e,n,a,l)}function $u(e){return e=e.prototype,!(!e||!e.isReactComponent)}function js(e,n){var a=e.alternate;return a===null?(a=_n(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 Mh(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 xl(e,n,a,l,f,m){var x=0;if(l=e,typeof e=="function")$u(e)&&(x=1);else if(typeof e=="string")x=ES(e,a,Ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Y:return e=_n(31,a,n,f),e.elementType=Y,e.lanes=m,e;case w:return Ka(a.children,f,m,n);case N:x=8,f|=24;break;case T:return e=_n(12,a,n,f|2),e.elementType=T,e.lanes=m,e;case D:return e=_n(13,a,n,f),e.elementType=D,e.lanes=m,e;case A:return e=_n(19,a,n,f),e.elementType=A,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case E:x=10;break e;case C:x=9;break e;case R:x=11;break e;case q:x=14;break e;case $:x=16,l=null;break e}x=29,a=Error(o(130,e===null?"null":typeof e,"")),l=null}return n=_n(x,a,n,f),n.elementType=e,n.type=l,n.lanes=m,n}function Ka(e,n,a,l){return e=_n(7,e,l,n),e.lanes=a,e}function Pu(e,n,a){return e=_n(6,e,null,n),e.lanes=a,e}function Ih(e){var n=_n(18,null,null,0);return n.stateNode=e,n}function Vu(e,n,a){return n=_n(4,e.children!==null?e.children:[],e.key,n),n.lanes=a,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var Oh=new WeakMap;function In(e,n){if(typeof e=="object"&&e!==null){var a=Oh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:An(n)},Oh.set(e,n),n)}return{value:e,source:n,stack:An(n)}}var $i=[],Pi=0,kl=null,Vo=0,On=[],Bn=0,aa=null,fs=1,ps="";function Cs(e,n){$i[Pi++]=Vo,$i[Pi++]=kl,kl=e,Vo=n}function Bh(e,n,a){On[Bn++]=fs,On[Bn++]=ps,On[Bn++]=aa,aa=e;var l=fs;e=ps;var f=32-en(l)-1;l&=~(1<<f),a+=1;var m=32-en(n)+f;if(30<m){var x=f-f%5;m=(l&(1<<x)-1).toString(32),l>>=x,f-=x,fs=1<<32-en(n)+f|a<<f|l,ps=m+e}else fs=1<<m|a<<f|l,ps=e}function Hu(e){e.return!==null&&(Cs(e,1),Bh(e,1,0))}function qu(e){for(;e===kl;)kl=$i[--Pi],$i[Pi]=null,Vo=$i[--Pi],$i[Pi]=null;for(;e===aa;)aa=On[--Bn],On[Bn]=null,ps=On[--Bn],On[Bn]=null,fs=On[--Bn],On[Bn]=null}function Lh(e,n){On[Bn++]=fs,On[Bn++]=ps,On[Bn++]=aa,fs=n.id,ps=n.overflow,aa=e}var Zt=null,mt=null,Pe=!1,ia=null,Ln=!1,Gu=Error(o(519));function oa(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ho(In(n,e)),Gu}function zh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[pt]=e,n[Vt]=l,a){case"dialog":Le("cancel",n),Le("close",n);break;case"iframe":case"object":case"embed":Le("load",n);break;case"video":case"audio":for(a=0;a<dr.length;a++)Le(dr[a],n);break;case"source":Le("error",n);break;case"img":case"image":case"link":Le("error",n),Le("load",n);break;case"details":Le("toggle",n);break;case"input":Le("invalid",n),Wm(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Le("invalid",n);break;case"textarea":Le("invalid",n),Qm(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||t0(n.textContent,a)?(l.popover!=null&&(Le("beforetoggle",n),Le("toggle",n)),l.onScroll!=null&&Le("scroll",n),l.onScrollEnd!=null&&Le("scrollend",n),l.onClick!=null&&(n.onclick=ws),n=!0):n=!1,n||oa(e,!0)}function Uh(e){for(Zt=e.return;Zt;)switch(Zt.tag){case 5:case 31:case 13:Ln=!1;return;case 27:case 3:Ln=!0;return;default:Zt=Zt.return}}function Vi(e){if(e!==Zt)return!1;if(!Pe)return Uh(e),Pe=!0,!1;var n=e.tag,a;if((a=n!==3&&n!==27)&&((a=n===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||uf(e.type,e.memoizedProps)),a=!a),a&&mt&&oa(e),Uh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=u0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=u0(e)}else n===27?(n=mt,_a(e.type)?(e=hf,hf=null,mt=e):mt=n):mt=Zt?Un(e.stateNode.nextSibling):null;return!0}function Ya(){mt=Zt=null,Pe=!1}function Fu(){var e=ia;return e!==null&&(mn===null?mn=e:mn.push.apply(mn,e),ia=null),e}function Ho(e){ia===null?ia=[e]:ia.push(e)}var Zu=Ke(null),Ja=null,Es=null;function ra(e,n,a){Te(Zu,n._currentValue),n._currentValue=a}function As(e){e._currentValue=Zu.current,je(Zu)}function Ku(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 Yu(e,n,a,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var m=f.dependencies;if(m!==null){var x=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),Ku(m.return,a,e),l||(x=null);break e}m=j.next}}else if(f.tag===18){if(x=f.return,x===null)throw Error(o(341));x.lanes|=a,m=x.alternate,m!==null&&(m.lanes|=a),Ku(x,a,e),x=null}else x=f.child;if(x!==null)x.return=f;else for(x=f;x!==null;){if(x===e){x=null;break}if(f=x.sibling,f!==null){f.return=x.return,x=f;break}x=x.return}f=x}}function Hi(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 x=f.alternate;if(x===null)throw Error(o(387));if(x=x.memoizedProps,x!==null){var j=f.type;bn(f.pendingProps.value,x.value)||(e!==null?e.push(j):e=[j])}}else if(f===de.current){if(x=f.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(gr):e=[gr])}f=f.return}e!==null&&Yu(n,e,a,l),n.flags|=262144}function Sl(e){for(e=e.firstContext;e!==null;){if(!bn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wa(e){Ja=e,Es=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kt(e){return $h(Ja,e)}function Tl(e,n){return Ja===null&&Wa(e),$h(e,n)}function $h(e,n){var a=n._currentValue;if(n={context:n,memoizedValue:a,next:null},Es===null){if(e===null)throw Error(o(308));Es=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else Es=Es.next=n;return a}var wk=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()})}},Nk=t.unstable_scheduleCallback,jk=t.unstable_NormalPriority,Ot={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ju(){return{controller:new wk,data:new Map,refCount:0}}function qo(e){e.refCount--,e.refCount===0&&Nk(jk,function(){e.controller.abort()})}var Go=null,Wu=0,qi=0,Gi=null;function Ck(e,n){if(Go===null){var a=Go=[];Wu=0,qi=ef(),Gi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Wu++,n.then(Ph,Ph),n}function Ph(){if(--Wu===0&&Go!==null){Gi!==null&&(Gi.status="fulfilled");var e=Go;Go=null,qi=0,Gi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Ek(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 Vh=B.S;B.S=function(e,n){wv=Ce(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Ck(e,n),Vh!==null&&Vh(e,n)};var Xa=Ke(null);function Xu(){var e=Xa.current;return e!==null?e:dt.pooledCache}function wl(e,n){n===null?Te(Xa,Xa.current):Te(Xa,n.pool)}function Hh(){var e=Xu();return e===null?null:{parent:Ot._currentValue,pool:e}}var Fi=Error(o(460)),Qu=Error(o(474)),Nl=Error(o(542)),jl={then:function(){}};function qh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Gh(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,Zh(e),e;default:if(typeof n.status=="string")n.then(ws,ws);else{if(e=dt,e!==null&&100<e.shellSuspendCounter)throw Error(o(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,Zh(e),e}throw ei=n,Fi}}function Qa(e){try{var n=e._init;return n(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(ei=a,Fi):a}}var ei=null;function Fh(){if(ei===null)throw Error(o(459));var e=ei;return ei=null,e}function Zh(e){if(e===Fi||e===Nl)throw Error(o(483))}var Zi=null,Fo=0;function Cl(e){var n=Fo;return Fo+=1,Zi===null&&(Zi=[]),Gh(Zi,e,n)}function Zo(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function El(e,n){throw n.$$typeof===_?Error(o(525)):(e=Object.prototype.toString.call(n),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Kh(e){function n(z,O){if(e){var V=z.deletions;V===null?(z.deletions=[O],z.flags|=16):V.push(O)}}function a(z,O){if(!e)return null;for(;O!==null;)n(z,O),O=O.sibling;return null}function l(z){for(var O=new Map;z!==null;)z.key!==null?O.set(z.key,z):O.set(z.index,z),z=z.sibling;return O}function f(z,O){return z=js(z,O),z.index=0,z.sibling=null,z}function m(z,O,V){return z.index=V,e?(V=z.alternate,V!==null?(V=V.index,V<O?(z.flags|=67108866,O):V):(z.flags|=67108866,O)):(z.flags|=1048576,O)}function x(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function j(z,O,V,W){return O===null||O.tag!==6?(O=Pu(V,z.mode,W),O.return=z,O):(O=f(O,V),O.return=z,O)}function M(z,O,V,W){var be=V.type;return be===w?J(z,O,V.props.children,W,V.key):O!==null&&(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===$&&Qa(be)===O.type)?(O=f(O,V.props),Zo(O,V),O.return=z,O):(O=xl(V.type,V.key,V.props,null,z.mode,W),Zo(O,V),O.return=z,O)}function H(z,O,V,W){return O===null||O.tag!==4||O.stateNode.containerInfo!==V.containerInfo||O.stateNode.implementation!==V.implementation?(O=Vu(V,z.mode,W),O.return=z,O):(O=f(O,V.children||[]),O.return=z,O)}function J(z,O,V,W,be){return O===null||O.tag!==7?(O=Ka(V,z.mode,W,be),O.return=z,O):(O=f(O,V),O.return=z,O)}function X(z,O,V){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=Pu(""+O,z.mode,V),O.return=z,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case k:return V=xl(O.type,O.key,O.props,null,z.mode,V),Zo(V,O),V.return=z,V;case S:return O=Vu(O,z.mode,V),O.return=z,O;case $:return O=Qa(O),X(z,O,V)}if(ee(O)||ae(O))return O=Ka(O,z.mode,V,null),O.return=z,O;if(typeof O.then=="function")return X(z,Cl(O),V);if(O.$$typeof===E)return X(z,Tl(z,O),V);El(z,O)}return null}function F(z,O,V,W){var be=O!==null?O.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return be!==null?null:j(z,O,""+V,W);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case k:return V.key===be?M(z,O,V,W):null;case S:return V.key===be?H(z,O,V,W):null;case $:return V=Qa(V),F(z,O,V,W)}if(ee(V)||ae(V))return be!==null?null:J(z,O,V,W,null);if(typeof V.then=="function")return F(z,O,Cl(V),W);if(V.$$typeof===E)return F(z,O,Tl(z,V),W);El(z,V)}return null}function K(z,O,V,W,be){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return z=z.get(V)||null,j(O,z,""+W,be);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return z=z.get(W.key===null?V:W.key)||null,M(O,z,W,be);case S:return z=z.get(W.key===null?V:W.key)||null,H(O,z,W,be);case $:return W=Qa(W),K(z,O,V,W,be)}if(ee(W)||ae(W))return z=z.get(V)||null,J(O,z,W,be,null);if(typeof W.then=="function")return K(z,O,V,Cl(W),be);if(W.$$typeof===E)return K(z,O,V,Tl(O,W),be);El(O,W)}return null}function he(z,O,V,W){for(var be=null,Ye=null,ge=O,Re=O=0,$e=null;ge!==null&&Re<V.length;Re++){ge.index>Re?($e=ge,ge=null):$e=ge.sibling;var Je=F(z,ge,V[Re],W);if(Je===null){ge===null&&(ge=$e);break}e&&ge&&Je.alternate===null&&n(z,ge),O=m(Je,O,Re),Ye===null?be=Je:Ye.sibling=Je,Ye=Je,ge=$e}if(Re===V.length)return a(z,ge),Pe&&Cs(z,Re),be;if(ge===null){for(;Re<V.length;Re++)ge=X(z,V[Re],W),ge!==null&&(O=m(ge,O,Re),Ye===null?be=ge:Ye.sibling=ge,Ye=ge);return Pe&&Cs(z,Re),be}for(ge=l(ge);Re<V.length;Re++)$e=K(ge,z,Re,V[Re],W),$e!==null&&(e&&$e.alternate!==null&&ge.delete($e.key===null?Re:$e.key),O=m($e,O,Re),Ye===null?be=$e:Ye.sibling=$e,Ye=$e);return e&&ge.forEach(function(wa){return n(z,wa)}),Pe&&Cs(z,Re),be}function ke(z,O,V,W){if(V==null)throw Error(o(151));for(var be=null,Ye=null,ge=O,Re=O=0,$e=null,Je=V.next();ge!==null&&!Je.done;Re++,Je=V.next()){ge.index>Re?($e=ge,ge=null):$e=ge.sibling;var wa=F(z,ge,Je.value,W);if(wa===null){ge===null&&(ge=$e);break}e&&ge&&wa.alternate===null&&n(z,ge),O=m(wa,O,Re),Ye===null?be=wa:Ye.sibling=wa,Ye=wa,ge=$e}if(Je.done)return a(z,ge),Pe&&Cs(z,Re),be;if(ge===null){for(;!Je.done;Re++,Je=V.next())Je=X(z,Je.value,W),Je!==null&&(O=m(Je,O,Re),Ye===null?be=Je:Ye.sibling=Je,Ye=Je);return Pe&&Cs(z,Re),be}for(ge=l(ge);!Je.done;Re++,Je=V.next())Je=K(ge,z,Re,Je.value,W),Je!==null&&(e&&Je.alternate!==null&&ge.delete(Je.key===null?Re:Je.key),O=m(Je,O,Re),Ye===null?be=Je:Ye.sibling=Je,Ye=Je);return e&&ge.forEach(function($S){return n(z,$S)}),Pe&&Cs(z,Re),be}function lt(z,O,V,W){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 be=V.key;O!==null;){if(O.key===be){if(be=V.type,be===w){if(O.tag===7){a(z,O.sibling),W=f(O,V.props.children),W.return=z,z=W;break e}}else if(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===$&&Qa(be)===O.type){a(z,O.sibling),W=f(O,V.props),Zo(W,V),W.return=z,z=W;break e}a(z,O);break}else n(z,O);O=O.sibling}V.type===w?(W=Ka(V.props.children,z.mode,W,V.key),W.return=z,z=W):(W=xl(V.type,V.key,V.props,null,z.mode,W),Zo(W,V),W.return=z,z=W)}return x(z);case S:e:{for(be=V.key;O!==null;){if(O.key===be)if(O.tag===4&&O.stateNode.containerInfo===V.containerInfo&&O.stateNode.implementation===V.implementation){a(z,O.sibling),W=f(O,V.children||[]),W.return=z,z=W;break e}else{a(z,O);break}else n(z,O);O=O.sibling}W=Vu(V,z.mode,W),W.return=z,z=W}return x(z);case $:return V=Qa(V),lt(z,O,V,W)}if(ee(V))return he(z,O,V,W);if(ae(V)){if(be=ae(V),typeof be!="function")throw Error(o(150));return V=be.call(V),ke(z,O,V,W)}if(typeof V.then=="function")return lt(z,O,Cl(V),W);if(V.$$typeof===E)return lt(z,O,Tl(z,V),W);El(z,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,O!==null&&O.tag===6?(a(z,O.sibling),W=f(O,V),W.return=z,z=W):(a(z,O),W=Pu(V,z.mode,W),W.return=z,z=W),x(z)):a(z,O)}return function(z,O,V,W){try{Fo=0;var be=lt(z,O,V,W);return Zi=null,be}catch(ge){if(ge===Fi||ge===Nl)throw ge;var Ye=_n(29,ge,null,z.mode);return Ye.lanes=W,Ye.return=z,Ye}finally{}}}var ti=Kh(!0),Yh=Kh(!1),la=!1;function ed(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function td(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 ua(e,n,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var f=l.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),l.pending=n,n=_l(e),Rh(e,null,a),n}return bl(e,l,n,a),_l(e)}function Ko(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,Fe(e,a)}}function nd(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 x={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=x:m=m.next=x,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 sd=!1;function Yo(){if(sd){var e=Gi;if(e!==null)throw e}}function Jo(e,n,a,l){sd=!1;var f=e.updateQueue;la=!1;var m=f.firstBaseUpdate,x=f.lastBaseUpdate,j=f.shared.pending;if(j!==null){f.shared.pending=null;var M=j,H=M.next;M.next=null,x===null?m=H:x.next=H,x=M;var J=e.alternate;J!==null&&(J=J.updateQueue,j=J.lastBaseUpdate,j!==x&&(j===null?J.firstBaseUpdate=H:j.next=H,J.lastBaseUpdate=M))}if(m!==null){var X=f.baseState;x=0,J=H=M=null,j=m;do{var F=j.lane&-536870913,K=F!==j.lane;if(K?(Ue&F)===F:(l&F)===F){F!==0&&F===qi&&(sd=!0),J!==null&&(J=J.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var he=e,ke=j;F=n;var lt=a;switch(ke.tag){case 1:if(he=ke.payload,typeof he=="function"){X=he.call(lt,X,F);break e}X=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ke.payload,F=typeof he=="function"?he.call(lt,X,F):he,F==null)break e;X=y({},X,F);break e;case 2:la=!0}}F=j.callback,F!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[F]:K.push(F))}else K={lane:F,tag:j.tag,payload:j.payload,callback:j.callback,next:null},J===null?(H=J=K,M=X):J=J.next=K,x|=F;if(j=j.next,j===null){if(j=f.shared.pending,j===null)break;K=j,j=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);J===null&&(M=X),f.baseState=M,f.firstBaseUpdate=H,f.lastBaseUpdate=J,m===null&&(f.shared.lanes=0),ha|=x,e.lanes=x,e.memoizedState=X}}function Jh(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Wh(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Jh(a[e],n)}var Ki=Ke(null),Al=Ke(0);function Xh(e,n){e=Us,Te(Al,e),Te(Ki,n),Us=e|n.baseLanes}function ad(){Te(Al,Us),Te(Ki,Ki.current)}function id(){Us=Al.current,je(Ki),je(Al)}var xn=Ke(null),zn=null;function da(e){var n=e.alternate;Te(At,At.current&1),Te(xn,e),zn===null&&(n===null||Ki.current!==null||n.memoizedState!==null)&&(zn=e)}function od(e){Te(At,At.current),Te(xn,e),zn===null&&(zn=e)}function Qh(e){e.tag===22?(Te(At,At.current),Te(xn,e),zn===null&&(zn=e)):fa()}function fa(){Te(At,At.current),Te(xn,xn.current)}function kn(e){je(xn),zn===e&&(zn=null),je(At)}var At=Ke(0);function Dl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||pf(a)||mf(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 Ds=0,De=null,ot=null,Bt=null,Rl=!1,Yi=!1,ni=!1,Ml=0,Wo=0,Ji=null,Ak=0;function Tt(){throw Error(o(321))}function rd(e,n){if(n===null)return!1;for(var a=0;a<n.length&&a<e.length;a++)if(!bn(e[a],n[a]))return!1;return!0}function ld(e,n,a,l,f,m){return Ds=m,De=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,B.H=e===null||e.memoizedState===null?Bg:Sd,ni=!1,m=a(l,f),ni=!1,Yi&&(m=tg(n,a,l,f)),eg(e),m}function eg(e){B.H=er;var n=ot!==null&&ot.next!==null;if(Ds=0,Bt=ot=De=null,Rl=!1,Wo=0,Ji=null,n)throw Error(o(300));e===null||Lt||(e=e.dependencies,e!==null&&Sl(e)&&(Lt=!0))}function tg(e,n,a,l){De=e;var f=0;do{if(Yi&&(Ji=null),Wo=0,Yi=!1,25<=f)throw Error(o(301));if(f+=1,Bt=ot=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}B.H=Lg,m=n(a,l)}while(Yi);return m}function Dk(){var e=B.H,n=e.useState()[0];return n=typeof n.then=="function"?Xo(n):n,e=e.useState()[0],(ot!==null?ot.memoizedState:null)!==e&&(De.flags|=1024),n}function cd(){var e=Ml!==0;return Ml=0,e}function ud(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function dd(e){if(Rl){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Rl=!1}Ds=0,Bt=ot=De=null,Yi=!1,Wo=Ml=0,Ji=null}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?De.memoizedState=Bt=e:Bt=Bt.next=e,Bt}function Dt(){if(ot===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=ot.next;var n=Bt===null?De.memoizedState:Bt.next;if(n!==null)Bt=n,ot=e;else{if(e===null)throw De.alternate===null?Error(o(467)):Error(o(310));ot=e,e={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},Bt===null?De.memoizedState=Bt=e:Bt=Bt.next=e}return Bt}function Il(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Xo(e){var n=Wo;return Wo+=1,Ji===null&&(Ji=[]),e=Gh(Ji,e,n),n=De,(Bt===null?n.memoizedState:Bt.next)===null&&(n=n.alternate,B.H=n===null||n.memoizedState===null?Bg:Sd),e}function Ol(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Xo(e);if(e.$$typeof===E)return Kt(e)}throw Error(o(438,String(e)))}function fd(e){var n=null,a=De.updateQueue;if(a!==null&&(n=a.memoCache),n==null){var l=De.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=Il(),De.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]=G;return n.index++,a}function Rs(e,n){return typeof n=="function"?n(e):n}function Bl(e){var n=Dt();return pd(n,ot,e)}function pd(e,n,a){var l=e.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=a;var f=e.baseQueue,m=l.pending;if(m!==null){if(f!==null){var x=f.next;f.next=m.next,m.next=x}n.baseQueue=f=m,l.pending=null}if(m=e.baseState,f===null)e.memoizedState=m;else{n=f.next;var j=x=null,M=null,H=n,J=!1;do{var X=H.lane&-536870913;if(X!==H.lane?(Ue&X)===X:(Ds&X)===X){var F=H.revertLane;if(F===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null}),X===qi&&(J=!0);else if((Ds&F)===F){H=H.next,F===qi&&(J=!0);continue}else X={lane:0,revertLane:H.revertLane,gesture:null,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(j=M=X,x=m):M=M.next=X,De.lanes|=F,ha|=F;X=H.action,ni&&a(m,X),m=H.hasEagerState?H.eagerState:a(m,X)}else F={lane:X,revertLane:H.revertLane,gesture:H.gesture,action:H.action,hasEagerState:H.hasEagerState,eagerState:H.eagerState,next:null},M===null?(j=M=F,x=m):M=M.next=F,De.lanes|=X,ha|=X;H=H.next}while(H!==null&&H!==n);if(M===null?x=m:M.next=j,!bn(m,e.memoizedState)&&(Lt=!0,J&&(a=Gi,a!==null)))throw a;e.memoizedState=m,e.baseState=x,e.baseQueue=M,l.lastRenderedState=m}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function md(e){var n=Dt(),a=n.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=e;var l=a.dispatch,f=a.pending,m=n.memoizedState;if(f!==null){a.pending=null;var x=f=f.next;do m=e(m,x.action),x=x.next;while(x!==f);bn(m,n.memoizedState)||(Lt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,l]}function ng(e,n,a){var l=De,f=Dt(),m=Pe;if(m){if(a===void 0)throw Error(o(407));a=a()}else a=n();var x=!bn((ot||f).memoizedState,a);if(x&&(f.memoizedState=a,Lt=!0),f=f.queue,vd(ig.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Bt!==null&&Bt.memoizedState.tag&1){if(l.flags|=2048,Wi(9,{destroy:void 0},ag.bind(null,l,f,a,n),null),dt===null)throw Error(o(349));m||(Ds&127)!==0||sg(l,n,a)}return a}function sg(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=De.updateQueue,n===null?(n=Il(),De.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function ag(e,n,a,l){n.value=a,n.getSnapshot=l,og(n)&&rg(e)}function ig(e,n,a){return a(function(){og(n)&&rg(e)})}function og(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!bn(e,a)}catch{return!0}}function rg(e){var n=Za(e,2);n!==null&&hn(n,e,2)}function hd(e){var n=an();if(typeof e=="function"){var a=e;if(e=a(),ni){Yn(!0);try{a()}finally{Yn(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:e},n}function lg(e,n,a,l){return e.baseState=a,pd(e,ot,typeof l=="function"?l:Rs)}function Rk(e,n,a,l,f){if(Ul(e))throw Error(o(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(x){m.listeners.push(x)}};B.T!==null?a(!0):m.isTransition=!1,l(m),a=n.pending,a===null?(m.next=n.pending=m,cg(n,m)):(m.next=a.next,n.pending=a.next=m)}}function cg(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var m=B.T,x={};B.T=x;try{var j=a(f,l),M=B.S;M!==null&&M(x,j),ug(e,n,j)}catch(H){gd(e,n,H)}finally{m!==null&&x.types!==null&&(m.types=x.types),B.T=m}}else try{m=a(f,l),ug(e,n,m)}catch(H){gd(e,n,H)}}function ug(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){dg(e,n,l)},function(l){return gd(e,n,l)}):dg(e,n,a)}function dg(e,n,a){n.status="fulfilled",n.value=a,fg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,cg(e,a)))}function gd(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,fg(n),n=n.next;while(n!==l)}e.action=null}function fg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function pg(e,n){return n}function mg(e,n){if(Pe){var a=dt.formState;if(a!==null){e:{var l=De;if(Pe){if(mt){t:{for(var f=mt,m=Ln;f.nodeType!==8;){if(!m){f=null;break t}if(f=Un(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){mt=Un(f.nextSibling),l=f.data==="F!";break e}}oa(l)}l=!1}l&&(n=a[0])}}return a=an(),a.memoizedState=a.baseState=n,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:pg,lastRenderedState:n},a.queue=l,a=Mg.bind(null,De,l),l.dispatch=a,l=hd(!1),m=kd.bind(null,De,!1,l.queue),l=an(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=Rk.bind(null,De,f,m,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function hg(e){var n=Dt();return gg(n,ot,e)}function gg(e,n,a){if(n=pd(e,n,pg)[0],e=Bl(Rs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Xo(n)}catch(x){throw x===Fi?Nl:x}else l=n;n=Dt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(De.flags|=2048,Wi(9,{destroy:void 0},Mk.bind(null,f,a),null)),[l,m,e]}function Mk(e,n){e.action=n}function vg(e){var n=Dt(),a=ot;if(a!==null)return gg(n,a,e);Dt(),n=n.memoizedState,a=Dt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function Wi(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=De.updateQueue,n===null&&(n=Il(),De.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 yg(){return Dt().memoizedState}function Ll(e,n,a,l){var f=an();De.flags|=e,f.memoizedState=Wi(1|n,{destroy:void 0},a,l===void 0?null:l)}function zl(e,n,a,l){var f=Dt();l=l===void 0?null:l;var m=f.memoizedState.inst;ot!==null&&l!==null&&rd(l,ot.memoizedState.deps)?f.memoizedState=Wi(n,m,a,l):(De.flags|=e,f.memoizedState=Wi(1|n,m,a,l))}function bg(e,n){Ll(8390656,8,e,n)}function vd(e,n){zl(2048,8,e,n)}function Ik(e){De.flags|=4;var n=De.updateQueue;if(n===null)n=Il(),De.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function _g(e){var n=Dt().memoizedState;return Ik({ref:n,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function xg(e,n){return zl(4,2,e,n)}function kg(e,n){return zl(4,4,e,n)}function Sg(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 Tg(e,n,a){a=a!=null?a.concat([e]):null,zl(4,4,Sg.bind(null,n,e),a)}function yd(){}function wg(e,n){var a=Dt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&rd(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function Ng(e,n){var a=Dt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&rd(n,l[1]))return l[0];if(l=e(),ni){Yn(!0);try{e()}finally{Yn(!1)}}return a.memoizedState=[l,n],l}function bd(e,n,a){return a===void 0||(Ds&1073741824)!==0&&(Ue&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=jv(),De.lanes|=e,ha|=e,a)}function jg(e,n,a,l){return bn(a,n)?a:Ki.current!==null?(e=bd(e,a,l),bn(e,n)||(Lt=!0),e):(Ds&42)===0||(Ds&1073741824)!==0&&(Ue&261930)===0?(Lt=!0,e.memoizedState=a):(e=jv(),De.lanes|=e,ha|=e,n)}function Cg(e,n,a,l,f){var m=Z.p;Z.p=m!==0&&8>m?m:8;var x=B.T,j={};B.T=j,kd(e,!1,n,a);try{var M=f(),H=B.S;if(H!==null&&H(j,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var J=Ek(M,l);Qo(e,n,J,wn(e))}else Qo(e,n,l,wn(e))}catch(X){Qo(e,n,{then:function(){},status:"rejected",reason:X},wn())}finally{Z.p=m,x!==null&&j.types!==null&&(x.types=j.types),B.T=x}}function Ok(){}function _d(e,n,a,l){if(e.tag!==5)throw Error(o(476));var f=Eg(e).queue;Cg(e,f,n,ne,a===null?Ok:function(){return Ag(e),a(l)})}function Eg(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:ne},next:null};var a={};return n.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:a},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function Ag(e){var n=Eg(e);n.next===null&&(n=e.alternate.memoizedState),Qo(e,n.next.queue,{},wn())}function xd(){return Kt(gr)}function Dg(){return Dt().memoizedState}function Rg(){return Dt().memoizedState}function Bk(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var a=wn();e=ca(a);var l=ua(n,e,a);l!==null&&(hn(l,n,a),Ko(l,n,a)),n={cache:Ju()},e.payload=n;return}n=n.return}}function Lk(e,n,a){var l=wn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Ul(e)?Ig(n,a):(a=Uu(e,n,a,l),a!==null&&(hn(a,e,l),Og(a,n,l)))}function Mg(e,n,a){var l=wn();Qo(e,n,a,l)}function Qo(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ul(e))Ig(n,f);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var x=n.lastRenderedState,j=m(x,a);if(f.hasEagerState=!0,f.eagerState=j,bn(j,x))return bl(e,n,f,0),dt===null&&yl(),!1}catch{}finally{}if(a=Uu(e,n,f,l),a!==null)return hn(a,e,l),Og(a,n,l),!0}return!1}function kd(e,n,a,l){if(l={lane:2,revertLane:ef(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ul(e)){if(n)throw Error(o(479))}else n=Uu(e,a,l,2),n!==null&&hn(n,e,2)}function Ul(e){var n=e.alternate;return e===De||n!==null&&n===De}function Ig(e,n){Yi=Rl=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Og(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Fe(e,a)}}var er={readContext:Kt,use:Ol,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};er.useEffectEvent=Tt;var Bg={readContext:Kt,use:Ol,useCallback:function(e,n){return an().memoizedState=[e,n===void 0?null:n],e},useContext:Kt,useEffect:bg,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,Ll(4194308,4,Sg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return Ll(4194308,4,e,n)},useInsertionEffect:function(e,n){Ll(4,2,e,n)},useMemo:function(e,n){var a=an();n=n===void 0?null:n;var l=e();if(ni){Yn(!0);try{e()}finally{Yn(!1)}}return a.memoizedState=[l,n],l},useReducer:function(e,n,a){var l=an();if(a!==void 0){var f=a(n);if(ni){Yn(!0);try{a(n)}finally{Yn(!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=Lk.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var n=an();return e={current:e},n.memoizedState=e},useState:function(e){e=hd(e);var n=e.queue,a=Mg.bind(null,De,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:yd,useDeferredValue:function(e,n){var a=an();return bd(a,e,n)},useTransition:function(){var e=hd(!1);return e=Cg.bind(null,De,e.queue,!0,!1),an().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,a){var l=De,f=an();if(Pe){if(a===void 0)throw Error(o(407));a=a()}else{if(a=n(),dt===null)throw Error(o(349));(Ue&127)!==0||sg(l,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,bg(ig.bind(null,l,m,e),[e]),l.flags|=2048,Wi(9,{destroy:void 0},ag.bind(null,l,m,a,n),null),a},useId:function(){var e=an(),n=dt.identifierPrefix;if(Pe){var a=ps,l=fs;a=(l&~(1<<32-en(l)-1)).toString(32)+a,n="_"+n+"R_"+a,a=Ml++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Ak++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:xd,useFormState:mg,useActionState:mg,useOptimistic:function(e){var n=an();n.memoizedState=n.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=a,n=kd.bind(null,De,!0,a),a.dispatch=n,[e,n]},useMemoCache:fd,useCacheRefresh:function(){return an().memoizedState=Bk.bind(null,De)},useEffectEvent:function(e){var n=an(),a={impl:e};return n.memoizedState=a,function(){if((Qe&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}},Sd={readContext:Kt,use:Ol,useCallback:wg,useContext:Kt,useEffect:vd,useImperativeHandle:Tg,useInsertionEffect:xg,useLayoutEffect:kg,useMemo:Ng,useReducer:Bl,useRef:yg,useState:function(){return Bl(Rs)},useDebugValue:yd,useDeferredValue:function(e,n){var a=Dt();return jg(a,ot.memoizedState,e,n)},useTransition:function(){var e=Bl(Rs)[0],n=Dt().memoizedState;return[typeof e=="boolean"?e:Xo(e),n]},useSyncExternalStore:ng,useId:Dg,useHostTransitionStatus:xd,useFormState:hg,useActionState:hg,useOptimistic:function(e,n){var a=Dt();return lg(a,ot,e,n)},useMemoCache:fd,useCacheRefresh:Rg};Sd.useEffectEvent=_g;var Lg={readContext:Kt,use:Ol,useCallback:wg,useContext:Kt,useEffect:vd,useImperativeHandle:Tg,useInsertionEffect:xg,useLayoutEffect:kg,useMemo:Ng,useReducer:md,useRef:yg,useState:function(){return md(Rs)},useDebugValue:yd,useDeferredValue:function(e,n){var a=Dt();return ot===null?bd(a,e,n):jg(a,ot.memoizedState,e,n)},useTransition:function(){var e=md(Rs)[0],n=Dt().memoizedState;return[typeof e=="boolean"?e:Xo(e),n]},useSyncExternalStore:ng,useId:Dg,useHostTransitionStatus:xd,useFormState:vg,useActionState:vg,useOptimistic:function(e,n){var a=Dt();return ot!==null?lg(a,ot,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:fd,useCacheRefresh:Rg};Lg.useEffectEvent=_g;function Td(e,n,a,l){n=e.memoizedState,a=a(l,n),a=a==null?n:y({},n,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var wd={enqueueSetState:function(e,n,a){e=e._reactInternals;var l=wn(),f=ca(l);f.payload=n,a!=null&&(f.callback=a),n=ua(e,f,l),n!==null&&(hn(n,e,l),Ko(n,e,l))},enqueueReplaceState:function(e,n,a){e=e._reactInternals;var l=wn(),f=ca(l);f.tag=1,f.payload=n,a!=null&&(f.callback=a),n=ua(e,f,l),n!==null&&(hn(n,e,l),Ko(n,e,l))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var a=wn(),l=ca(a);l.tag=2,n!=null&&(l.callback=n),n=ua(e,l,a),n!==null&&(hn(n,e,a),Ko(n,e,a))}};function zg(e,n,a,l,f,m,x){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,m,x):n.prototype&&n.prototype.isPureReactComponent?!$o(a,l)||!$o(f,m):!0}function Ug(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&&wd.enqueueReplaceState(n,n.state,null)}function si(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=y({},a));for(var f in e)a[f]===void 0&&(a[f]=e[f])}return a}function $g(e){vl(e)}function Pg(e){console.error(e)}function Vg(e){vl(e)}function $l(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function Hg(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 Nd(e,n,a){return a=ca(a),a.tag=3,a.payload={element:null},a.callback=function(){$l(e,n)},a}function qg(e){return e=ca(e),e.tag=3,e}function Gg(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(){Hg(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){Hg(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 zk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&Hi(n,a,f,!0),a=xn.current,a!==null){switch(a.tag){case 31:case 13:return zn===null?Xl():a.alternate===null&&wt===0&&(wt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===jl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),Wd(e,l,f)),!1;case 22:return a.flags|=65536,l===jl?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)),Wd(e,l,f)),!1}throw Error(o(435,a.tag))}return Wd(e,l,f),Xl(),!1}if(Pe)return n=xn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Gu&&(e=Error(o(422),{cause:l}),Ho(In(e,a)))):(l!==Gu&&(n=Error(o(423),{cause:l}),Ho(In(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=In(l,a),f=Nd(e.stateNode,l,f),nd(e,f),wt!==4&&(wt=2)),!1;var m=Error(o(520),{cause:l});if(m=In(m,a),lr===null?lr=[m]:lr.push(m),wt!==4&&(wt=2),n===null)return!0;l=In(l,a),a=n;do{switch(a.tag){case 3:return a.flags|=65536,e=f&-f,a.lanes|=e,e=Nd(a.stateNode,l,e),nd(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=qg(f),Gg(f,e,a,l),nd(a,f),!1}a=a.return}while(a!==null);return!1}var jd=Error(o(461)),Lt=!1;function Yt(e,n,a,l){n.child=e===null?Yh(n,null,a,l):ti(n,e.child,a,l)}function Fg(e,n,a,l,f){a=a.render;var m=n.ref;if("ref"in l){var x={};for(var j in l)j!=="ref"&&(x[j]=l[j])}else x=l;return Wa(n),l=ld(e,n,a,x,m,f),j=cd(),e!==null&&!Lt?(ud(e,n,f),Ms(e,n,f)):(Pe&&j&&Hu(n),n.flags|=1,Yt(e,n,l,f),n.child)}function Zg(e,n,a,l,f){if(e===null){var m=a.type;return typeof m=="function"&&!$u(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,Kg(e,n,m,l,f)):(e=xl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!Od(e,f)){var x=m.memoizedProps;if(a=a.compare,a=a!==null?a:$o,a(x,l)&&e.ref===n.ref)return Ms(e,n,f)}return n.flags|=1,e=js(m,l),e.ref=n.ref,e.return=n,n.child=e}function Kg(e,n,a,l,f){if(e!==null){var m=e.memoizedProps;if($o(m,l)&&e.ref===n.ref)if(Lt=!1,n.pendingProps=l=m,Od(e,f))(e.flags&131072)!==0&&(Lt=!0);else return n.lanes=e.lanes,Ms(e,n,f)}return Cd(e,n,a,l,f)}function Yg(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 Jg(e,n,m,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&wl(n,m!==null?m.cachePool:null),m!==null?Xh(n,m):ad(),Qh(n);else return l=n.lanes=536870912,Jg(e,n,m!==null?m.baseLanes|a:a,a,l)}else m!==null?(wl(n,m.cachePool),Xh(n,m),fa(),n.memoizedState=null):(e!==null&&wl(n,null),ad(),fa());return Yt(e,n,f,a),n.child}function tr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Jg(e,n,a,l,f){var m=Xu();return m=m===null?null:{parent:Ot._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&wl(n,null),ad(),Qh(n),e!==null&&Hi(e,n,l,!0),n.childLanes=f,null}function Pl(e,n){return n=Hl({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Wg(e,n,a){return ti(n,e.child,null,a),e=Pl(n,n.pendingProps),e.flags|=2,kn(n),n.memoizedState=null,e}function Uk(e,n,a){var l=n.pendingProps,f=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(Pe){if(l.mode==="hidden")return e=Pl(n,l),n.lanes=536870912,tr(null,e);if(od(n),(e=mt)?(e=c0(e,Ln),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=Ih(e),a.return=n,n.child=a,Zt=n,mt=null)):e=null,e===null)throw oa(n);return n.lanes=536870912,null}return Pl(n,l)}var m=e.memoizedState;if(m!==null){var x=m.dehydrated;if(od(n),f)if(n.flags&256)n.flags&=-257,n=Wg(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(Lt||Hi(e,n,a,!1),f=(a&e.childLanes)!==0,Lt||f){if(l=dt,l!==null&&(x=ut(l,a),x!==0&&x!==m.retryLane))throw m.retryLane=x,Za(e,x),hn(l,e,x),jd;Xl(),n=Wg(e,n,a)}else e=m.treeContext,mt=Un(x.nextSibling),Zt=n,Pe=!0,ia=null,Ln=!1,e!==null&&Lh(n,e),n=Pl(n,l),n.flags|=4096;return n}return e=js(e.child,{mode:l.mode,children:l.children}),e.ref=n.ref,n.child=e,e.return=n,e}function Vl(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(o(284));(e===null||e.ref!==a)&&(n.flags|=4194816)}}function Cd(e,n,a,l,f){return Wa(n),a=ld(e,n,a,l,void 0,f),l=cd(),e!==null&&!Lt?(ud(e,n,f),Ms(e,n,f)):(Pe&&l&&Hu(n),n.flags|=1,Yt(e,n,a,f),n.child)}function Xg(e,n,a,l,f,m){return Wa(n),n.updateQueue=null,a=tg(n,l,a,f),eg(e),l=cd(),e!==null&&!Lt?(ud(e,n,m),Ms(e,n,m)):(Pe&&l&&Hu(n),n.flags|=1,Yt(e,n,a,m),n.child)}function Qg(e,n,a,l,f){if(Wa(n),n.stateNode===null){var m=Ui,x=a.contextType;typeof x=="object"&&x!==null&&(m=Kt(x)),m=new a(l,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=wd,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},ed(n),x=a.contextType,m.context=typeof x=="object"&&x!==null?Kt(x):Ui,m.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(Td(n,a,x,l),m.state=n.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(x=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),x!==m.state&&wd.enqueueReplaceState(m,m.state,null),Jo(n,l,m,f),Yo(),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=si(a,j);m.props=M;var H=m.context,J=a.contextType;x=Ui,typeof J=="object"&&J!==null&&(x=Kt(J));var X=a.getDerivedStateFromProps;J=typeof X=="function"||typeof m.getSnapshotBeforeUpdate=="function",j=n.pendingProps!==j,J||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(j||H!==x)&&Ug(n,m,l,x),la=!1;var F=n.memoizedState;m.state=F,Jo(n,l,m,f),Yo(),H=n.memoizedState,j||F!==H||la?(typeof X=="function"&&(Td(n,a,X,l),H=n.memoizedState),(M=la||zg(n,a,M,l,F,H,x))?(J||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=x,l=M):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{m=n.stateNode,td(e,n),x=n.memoizedProps,J=si(a,x),m.props=J,X=n.pendingProps,F=m.context,H=a.contextType,M=Ui,typeof H=="object"&&H!==null&&(M=Kt(H)),j=a.getDerivedStateFromProps,(H=typeof j=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x!==X||F!==M)&&Ug(n,m,l,M),la=!1,F=n.memoizedState,m.state=F,Jo(n,l,m,f),Yo();var K=n.memoizedState;x!==X||F!==K||la||e!==null&&e.dependencies!==null&&Sl(e.dependencies)?(typeof j=="function"&&(Td(n,a,j,l),K=n.memoizedState),(J=la||zg(n,a,J,l,F,K,M)||e!==null&&e.dependencies!==null&&Sl(e.dependencies))?(H||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,K,M),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,K,M)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),m.props=l,m.state=K,m.context=M,l=J):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&F===e.memoizedState||(n.flags|=1024),l=!1)}return m=l,Vl(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=ti(n,e.child,null,f),n.child=ti(n,null,a,f)):Yt(e,n,a,f),n.memoizedState=m.state,e=n.child):e=Ms(e,n,f),e}function ev(e,n,a,l){return Ya(),n.flags|=256,Yt(e,n,a,l),n.child}var Ed={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ad(e){return{baseLanes:e,cachePool:Hh()}}function Dd(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Tn),e}function tv(e,n,a){var l=n.pendingProps,f=!1,m=(n.flags&128)!==0,x;if((x=m)||(x=e!==null&&e.memoizedState===null?!1:(At.current&2)!==0),x&&(f=!0,n.flags&=-129),x=(n.flags&32)!==0,n.flags&=-33,e===null){if(Pe){if(f?da(n):fa(),(e=mt)?(e=c0(e,Ln),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=Ih(e),a.return=n,n.child=a,Zt=n,mt=null)):e=null,e===null)throw oa(n);return mf(e)?n.lanes=32:n.lanes=536870912,null}var j=l.children;return l=l.fallback,f?(fa(),f=n.mode,j=Hl({mode:"hidden",children:j},f),l=Ka(l,f,a,null),j.return=n,l.return=n,j.sibling=l,n.child=j,l=n.child,l.memoizedState=Ad(a),l.childLanes=Dd(e,x,a),n.memoizedState=Ed,tr(null,l)):(da(n),Rd(n,j))}var M=e.memoizedState;if(M!==null&&(j=M.dehydrated,j!==null)){if(m)n.flags&256?(da(n),n.flags&=-257,n=Md(e,n,a)):n.memoizedState!==null?(fa(),n.child=e.child,n.flags|=128,n=null):(fa(),j=l.fallback,f=n.mode,l=Hl({mode:"visible",children:l.children},f),j=Ka(j,f,a,null),j.flags|=2,l.return=n,j.return=n,l.sibling=j,n.child=l,ti(n,e.child,null,a),l=n.child,l.memoizedState=Ad(a),l.childLanes=Dd(e,x,a),n.memoizedState=Ed,n=tr(null,l));else if(da(n),mf(j)){if(x=j.nextSibling&&j.nextSibling.dataset,x)var H=x.dgst;x=H,l=Error(o(419)),l.stack="",l.digest=x,Ho({value:l,source:null,stack:null}),n=Md(e,n,a)}else if(Lt||Hi(e,n,a,!1),x=(a&e.childLanes)!==0,Lt||x){if(x=dt,x!==null&&(l=ut(x,a),l!==0&&l!==M.retryLane))throw M.retryLane=l,Za(e,l),hn(x,e,l),jd;pf(j)||Xl(),n=Md(e,n,a)}else pf(j)?(n.flags|=192,n.child=e.child,n=null):(e=M.treeContext,mt=Un(j.nextSibling),Zt=n,Pe=!0,ia=null,Ln=!1,e!==null&&Lh(n,e),n=Rd(n,l.children),n.flags|=4096);return n}return f?(fa(),j=l.fallback,f=n.mode,M=e.child,H=M.sibling,l=js(M,{mode:"hidden",children:l.children}),l.subtreeFlags=M.subtreeFlags&65011712,H!==null?j=js(H,j):(j=Ka(j,f,a,null),j.flags|=2),j.return=n,l.return=n,l.sibling=j,n.child=l,tr(null,l),l=n.child,j=e.child.memoizedState,j===null?j=Ad(a):(f=j.cachePool,f!==null?(M=Ot._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=Hh(),j={baseLanes:j.baseLanes|a,cachePool:f}),l.memoizedState=j,l.childLanes=Dd(e,x,a),n.memoizedState=Ed,tr(e.child,l)):(da(n),a=e.child,e=a.sibling,a=js(a,{mode:"visible",children:l.children}),a.return=n,a.sibling=null,e!==null&&(x=n.deletions,x===null?(n.deletions=[e],n.flags|=16):x.push(e)),n.child=a,n.memoizedState=null,a)}function Rd(e,n){return n=Hl({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function Hl(e,n){return e=_n(22,e,null,n),e.lanes=0,e}function Md(e,n,a){return ti(n,e.child,null,a),e=Rd(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function nv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Ku(e.return,n,a)}function Id(e,n,a,l,f,m){var x=e.memoizedState;x===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f,treeForkCount:m}:(x.isBackwards=n,x.rendering=null,x.renderingStartTime=0,x.last=l,x.tail=a,x.tailMode=f,x.treeForkCount=m)}function sv(e,n,a){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var x=At.current,j=(x&2)!==0;if(j?(x=x&1|2,n.flags|=128):x&=1,Te(At,x),Yt(e,n,l,a),l=Pe?Vo:0,!j&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nv(e,a,n);else if(e.tag===19)nv(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&&Dl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Id(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&&Dl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Id(n,!0,a,null,m,l);break;case"together":Id(n,!1,null,null,void 0,l);break;default:n.memoizedState=null}return n.child}function Ms(e,n,a){if(e!==null&&(n.dependencies=e.dependencies),ha|=n.lanes,(a&n.childLanes)===0)if(e!==null){if(Hi(e,n,a,!1),(a&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(o(153));if(n.child!==null){for(e=n.child,a=js(e,e.pendingProps),n.child=a,a.return=n;e.sibling!==null;)e=e.sibling,a=a.sibling=js(e,e.pendingProps),a.return=n;a.sibling=null}return n.child}function Od(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Sl(e)))}function $k(e,n,a){switch(n.tag){case 3:Oe(n,n.stateNode.containerInfo),ra(n,Ot,e.memoizedState.cache),Ya();break;case 27:case 5:vn(n);break;case 4:Oe(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,od(n),null;break;case 13:var l=n.memoizedState;if(l!==null)return l.dehydrated!==null?(da(n),n.flags|=128,null):(a&n.child.childLanes)!==0?tv(e,n,a):(da(n),e=Ms(e,n,a),e!==null?e.sibling:null);da(n);break;case 19:var f=(e.flags&128)!==0;if(l=(a&n.childLanes)!==0,l||(Hi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return sv(e,n,a);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Te(At,At.current),l)break;return null;case 22:return n.lanes=0,Yg(e,n,a,n.pendingProps);case 24:ra(n,Ot,e.memoizedState.cache)}return Ms(e,n,a)}function av(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Lt=!0;else{if(!Od(e,a)&&(n.flags&128)===0)return Lt=!1,$k(e,n,a);Lt=(e.flags&131072)!==0}else Lt=!1,Pe&&(n.flags&1048576)!==0&&Bh(n,Vo,n.index);switch(n.lanes=0,n.tag){case 16:e:{var l=n.pendingProps;if(e=Qa(n.elementType),n.type=e,typeof e=="function")$u(e)?(l=si(e,l),n.tag=1,n=Qg(null,n,e,l,a)):(n.tag=0,n=Cd(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===R){n.tag=11,n=Fg(null,n,e,l,a);break e}else if(f===q){n.tag=14,n=Zg(null,n,e,l,a);break e}}throw n=ie(e)||e,Error(o(306,n,""))}}return n;case 0:return Cd(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=si(l,n.pendingProps),Qg(e,n,l,f,a);case 3:e:{if(Oe(n,n.stateNode.containerInfo),e===null)throw Error(o(387));l=n.pendingProps;var m=n.memoizedState;f=m.element,td(e,n),Jo(n,l,null,a);var x=n.memoizedState;if(l=x.cache,ra(n,Ot,l),l!==m.cache&&Yu(n,[Ot],a,!0),Yo(),l=x.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:x.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=ev(e,n,l,a);break e}else if(l!==f){f=In(Error(o(424)),n),Ho(f),n=ev(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(mt=Un(e.firstChild),Zt=n,Pe=!0,ia=null,Ln=!0,a=Yh(n,null,l,a),n.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ya(),l===f){n=Ms(e,n,a);break e}Yt(e,n,l,a)}n=n.child}return n;case 26:return Vl(e,n),e===null?(a=h0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,e=n.pendingProps,l=ic(ve.current).createElement(a),l[pt]=n,l[Vt]=e,Jt(l,a,e),Ht(l),n.stateNode=l):n.memoizedState=h0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return vn(n),e===null&&Pe&&(l=n.stateNode=f0(n.type,n.pendingProps,ve.current),Zt=n,Ln=!0,f=mt,_a(n.type)?(hf=f,mt=Un(l.firstChild)):mt=f),Yt(e,n,n.pendingProps.children,a),Vl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((f=l=mt)&&(l=gS(l,n.type,n.pendingProps,Ln),l!==null?(n.stateNode=l,Zt=n,mt=Un(l.firstChild),Ln=!1,f=!0):f=!1),f||oa(n)),vn(n),f=n.type,m=n.pendingProps,x=e!==null?e.memoizedProps:null,l=m.children,uf(f,m)?l=null:x!==null&&uf(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=ld(e,n,Dk,null,null,a),gr._currentValue=f),Vl(e,n),Yt(e,n,l,a),n.child;case 6:return e===null&&Pe&&((e=a=mt)&&(a=vS(a,n.pendingProps,Ln),a!==null?(n.stateNode=a,Zt=n,mt=null,e=!0):e=!1),e||oa(n)),null;case 13:return tv(e,n,a);case 4:return Oe(n,n.stateNode.containerInfo),l=n.pendingProps,e===null?n.child=ti(n,null,l,a):Yt(e,n,l,a),n.child;case 11:return Fg(e,n,n.type,n.pendingProps,a);case 7:return Yt(e,n,n.pendingProps,a),n.child;case 8:return Yt(e,n,n.pendingProps.children,a),n.child;case 12:return Yt(e,n,n.pendingProps.children,a),n.child;case 10:return l=n.pendingProps,ra(n,n.type,l.value),Yt(e,n,l.children,a),n.child;case 9:return f=n.type._context,l=n.pendingProps.children,Wa(n),f=Kt(f),l=l(f),n.flags|=1,Yt(e,n,l,a),n.child;case 14:return Zg(e,n,n.type,n.pendingProps,a);case 15:return Kg(e,n,n.type,n.pendingProps,a);case 19:return sv(e,n,a);case 31:return Uk(e,n,a);case 22:return Yg(e,n,a,n.pendingProps);case 24:return Wa(n),l=Kt(Ot),e===null?(f=Xu(),f===null&&(f=dt,m=Ju(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:l,cache:f},ed(n),ra(n,Ot,f)):((e.lanes&a)!==0&&(td(e,n),Jo(n,null,null,a),Yo()),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,Ot,l)):(l=m.cache,ra(n,Ot,l),l!==f.cache&&Yu(n,[Ot],a,!0))),Yt(e,n,n.pendingProps.children,a),n.child;case 29:throw n.pendingProps}throw Error(o(156,n.tag))}function Is(e){e.flags|=4}function Bd(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(Dv())e.flags|=8192;else throw ei=jl,Qu}else e.flags&=-16777217}function iv(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!_0(n))if(Dv())e.flags|=8192;else throw ei=jl,Qu}function ql(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ce():536870912,e.lanes|=n,to|=n)}function nr(e,n){if(!Pe)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 ht(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 Pk(e,n,a){var l=n.pendingProps;switch(qu(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ht(n),null;case 1:return ht(n),null;case 3:return a=n.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),n.memoizedState.cache!==l&&(n.flags|=2048),As(Ot),_t(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Vi(n)?Is(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Fu())),ht(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(Is(n),m!==null?(ht(n),iv(n,m)):(ht(n),Bd(n,f,null,l,a))):m?m!==e.memoizedState?(Is(n),ht(n),iv(n,m)):(ht(n),n.flags&=-16777217):(e=e.memoizedProps,e!==l&&Is(n),ht(n),Bd(n,f,e,l,a)),null;case 27:if(L(n),a=ve.current,f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Is(n);else{if(!l){if(n.stateNode===null)throw Error(o(166));return ht(n),null}e=Ie.current,Vi(n)?zh(n):(e=f0(f,l,a),n.stateNode=e,Is(n))}return ht(n),null;case 5:if(L(n),f=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==l&&Is(n);else{if(!l){if(n.stateNode===null)throw Error(o(166));return ht(n),null}if(m=Ie.current,Vi(n))zh(n);else{var x=ic(ve.current);switch(m){case 1:m=x.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:m=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":m=x.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":m=x.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":m=x.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof l.is=="string"?x.createElement("select",{is:l.is}):x.createElement("select"),l.multiple?m.multiple=!0:l.size&&(m.size=l.size);break;default:m=typeof l.is=="string"?x.createElement(f,{is:l.is}):x.createElement(f)}}m[pt]=n,m[Vt]=l;e:for(x=n.child;x!==null;){if(x.tag===5||x.tag===6)m.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===n)break e;for(;x.sibling===null;){if(x.return===null||x.return===n)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}n.stateNode=m;e:switch(Jt(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&&Is(n)}}return ht(n),Bd(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,a),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==l&&Is(n);else{if(typeof l!="string"&&n.stateNode===null)throw Error(o(166));if(e=ve.current,Vi(n)){if(e=n.stateNode,a=n.memoizedProps,l=null,f=Zt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[pt]=n,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||t0(e.nodeValue,a)),e||oa(n,!0)}else e=ic(e).createTextNode(l),e[pt]=n,n.stateNode=e}return ht(n),null;case 31:if(a=n.memoizedState,e===null||e.memoizedState!==null){if(l=Vi(n),a!==null){if(e===null){if(!l)throw Error(o(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[pt]=n}else Ya(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ht(n),e=!1}else a=Fu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return n.flags&256?(kn(n),n):(kn(n),null);if((n.flags&128)!==0)throw Error(o(558))}return ht(n),null;case 13:if(l=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Vi(n),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(o(318));if(f=n.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(o(317));f[pt]=n}else Ya(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ht(n),f=!1}else f=Fu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return n.flags&256?(kn(n),n):(kn(n),null)}return kn(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),ql(n,n.updateQueue),ht(n),null);case 4:return _t(),e===null&&af(n.stateNode.containerInfo),ht(n),null;case 10:return As(n.type),ht(n),null;case 19:if(je(At),l=n.memoizedState,l===null)return ht(n),null;if(f=(n.flags&128)!==0,m=l.rendering,m===null)if(f)nr(l,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=Dl(e),m!==null){for(n.flags|=128,nr(l,!1),e=m.updateQueue,n.updateQueue=e,ql(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Mh(a,e),a=a.sibling;return Te(At,At.current&1|2),Pe&&Cs(n,l.treeForkCount),n.child}e=e.sibling}l.tail!==null&&Ce()>Yl&&(n.flags|=128,f=!0,nr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Dl(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,ql(n,e),nr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!m.alternate&&!Pe)return ht(n),null}else 2*Ce()-l.renderingStartTime>Yl&&a!==536870912&&(n.flags|=128,f=!0,nr(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=Ce(),e.sibling=null,a=At.current,Te(At,f?a&1|2:a&1),Pe&&Cs(n,l.treeForkCount),e):(ht(n),null);case 22:case 23:return kn(n),id(),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&&(ht(n),n.subtreeFlags&6&&(n.flags|=8192)):ht(n),a=n.updateQueue,a!==null&&ql(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&&je(Xa),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),n.memoizedState.cache!==a&&(n.flags|=2048),As(Ot),ht(n),null;case 25:return null;case 30:return null}throw Error(o(156,n.tag))}function Vk(e,n){switch(qu(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return As(Ot),_t(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return L(n),null;case 31:if(n.memoizedState!==null){if(kn(n),n.alternate===null)throw Error(o(340));Ya()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(kn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(o(340));Ya()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return je(At),null;case 4:return _t(),null;case 10:return As(n.type),null;case 22:case 23:return kn(n),id(),e!==null&&je(Xa),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return As(Ot),null;case 25:return null;default:return null}}function ov(e,n){switch(qu(n),n.tag){case 3:As(Ot),_t();break;case 26:case 27:case 5:L(n);break;case 4:_t();break;case 31:n.memoizedState!==null&&kn(n);break;case 13:kn(n);break;case 19:je(At);break;case 10:As(n.type);break;case 22:case 23:kn(n),id(),e!==null&&je(Xa);break;case 24:As(Ot)}}function sr(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,x=a.inst;l=m(),x.destroy=l}a=a.next}while(a!==f)}}catch(j){at(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 x=l.inst,j=x.destroy;if(j!==void 0){x.destroy=void 0,f=n;var M=a,H=j;try{H()}catch(J){at(f,M,J)}}}l=l.next}while(l!==m)}}catch(J){at(n,n.return,J)}}function rv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Wh(n,a)}catch(l){at(e,e.return,l)}}}function lv(e,n,a){a.props=si(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){at(e,n,l)}}function ar(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){at(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){at(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){at(e,n,f)}else a.current=null}function cv(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){at(e,e.return,f)}}function Ld(e,n,a){try{var l=e.stateNode;uS(l,e.type,a,n),l[Vt]=n}catch(f){at(e,e.return,f)}}function uv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_a(e.type)||e.tag===4}function zd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uv(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&_a(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ud(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&&_a(e.type)&&(a=e.stateNode,n=null),e=e.child,e!==null))for(Ud(e,n,a),e=e.sibling;e!==null;)Ud(e,n,a),e=e.sibling}function Gl(e,n,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,n?a.insertBefore(e,n):a.appendChild(e);else if(l!==4&&(l===27&&_a(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Gl(e,n,a),e=e.sibling;e!==null;)Gl(e,n,a),e=e.sibling}function dv(e){var n=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,f=n.attributes;f.length;)n.removeAttributeNode(f[0]);Jt(n,l,a),n[pt]=e,n[Vt]=a}catch(m){at(e,e.return,m)}}var Os=!1,zt=!1,$d=!1,fv=typeof WeakSet=="function"?WeakSet:Set,qt=null;function Hk(e,n){if(e=e.containerInfo,lf=fc,e=Th(e),Mu(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 x=0,j=-1,M=-1,H=0,J=0,X=e,F=null;t:for(;;){for(var K;X!==a||f!==0&&X.nodeType!==3||(j=x+f),X!==m||l!==0&&X.nodeType!==3||(M=x+l),X.nodeType===3&&(x+=X.nodeValue.length),(K=X.firstChild)!==null;)F=X,X=K;for(;;){if(X===e)break t;if(F===a&&++H===f&&(j=x),F===m&&++J===l&&(M=x),(K=X.nextSibling)!==null)break;X=F,F=X.parentNode}X=K}a=j===-1||M===-1?null:{start:j,end:M}}else a=null}a=a||{start:0,end:0}}else a=null;for(cf={focusedElem:e,selectionRange:a},fc=!1,qt=n;qt!==null;)if(n=qt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,qt=e;else for(;qt!==null;){switch(n=qt,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 he=si(a.type,f);e=l.getSnapshotBeforeUpdate(he,m),l.__reactInternalSnapshotBeforeUpdate=e}catch(ke){at(a,a.return,ke)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,a=e.nodeType,a===9)ff(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ff(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=n.sibling,e!==null){e.return=n.return,qt=e;break}qt=n.return}}function pv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Ls(e,a),l&4&&sr(5,a);break;case 1:if(Ls(e,a),l&4)if(e=a.stateNode,n===null)try{e.componentDidMount()}catch(x){at(a,a.return,x)}else{var f=si(a.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(f,n,e.__reactInternalSnapshotBeforeUpdate)}catch(x){at(a,a.return,x)}}l&64&&rv(a),l&512&&ar(a,a.return);break;case 3:if(Ls(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{Wh(e,n)}catch(x){at(a,a.return,x)}}break;case 27:n===null&&l&4&&dv(a);case 26:case 5:Ls(e,a),n===null&&l&4&&cv(a),l&512&&ar(a,a.return);break;case 12:Ls(e,a);break;case 31:Ls(e,a),l&4&&gv(e,a);break;case 13:Ls(e,a),l&4&&vv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Xk.bind(null,a),yS(e,a))));break;case 22:if(l=a.memoizedState!==null||Os,!l){n=n!==null&&n.memoizedState!==null||zt,f=Os;var m=zt;Os=l,(zt=n)&&!m?zs(e,a,(a.subtreeFlags&8772)!==0):Ls(e,a),Os=f,zt=m}break;case 30:break;default:Ls(e,a)}}function mv(e){var n=e.alternate;n!==null&&(e.alternate=null,mv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&gu(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 xt=null,dn=!1;function Bs(e,n,a){for(a=a.child;a!==null;)hv(e,n,a),a=a.sibling}function hv(e,n,a){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(na,a)}catch{}switch(a.tag){case 26:zt||ms(a,n),Bs(e,n,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:zt||ms(a,n);var l=xt,f=dn;_a(a.type)&&(xt=a.stateNode,dn=!1),Bs(e,n,a),pr(a.stateNode),xt=l,dn=f;break;case 5:zt||ms(a,n);case 6:if(l=xt,f=dn,xt=null,Bs(e,n,a),xt=l,dn=f,xt!==null)if(dn)try{(xt.nodeType===9?xt.body:xt.nodeName==="HTML"?xt.ownerDocument.body:xt).removeChild(a.stateNode)}catch(m){at(a,n,m)}else try{xt.removeChild(a.stateNode)}catch(m){at(a,n,m)}break;case 18:xt!==null&&(dn?(e=xt,r0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),co(e)):r0(xt,a.stateNode));break;case 4:l=xt,f=dn,xt=a.stateNode.containerInfo,dn=!0,Bs(e,n,a),xt=l,dn=f;break;case 0:case 11:case 14:case 15:pa(2,a,n),zt||pa(4,a,n),Bs(e,n,a);break;case 1:zt||(ms(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&lv(a,n,l)),Bs(e,n,a);break;case 21:Bs(e,n,a);break;case 22:zt=(l=zt)||a.memoizedState!==null,Bs(e,n,a),zt=l;break;default:Bs(e,n,a)}}function gv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{co(e)}catch(a){at(n,n.return,a)}}}function vv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{co(e)}catch(a){at(n,n.return,a)}}function qk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new fv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new fv),n;default:throw Error(o(435,e.tag))}}function Fl(e,n){var a=qk(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=Qk.bind(null,e,l);l.then(f,f)}})}function fn(e,n){var a=n.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],m=e,x=n,j=x;e:for(;j!==null;){switch(j.tag){case 27:if(_a(j.type)){xt=j.stateNode,dn=!1;break e}break;case 5:xt=j.stateNode,dn=!1;break e;case 3:case 4:xt=j.stateNode.containerInfo,dn=!0;break e}j=j.return}if(xt===null)throw Error(o(160));hv(m,x,f),xt=null,dn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)yv(n,e),n=n.sibling}var Wn=null;function yv(e,n){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fn(n,e),pn(e),l&4&&(pa(3,e,e.return),sr(3,e),pa(5,e,e.return));break;case 1:fn(n,e),pn(e),l&512&&(zt||a===null||ms(a,a.return)),l&64&&Os&&(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=Wn;if(fn(n,e),pn(e),l&512&&(zt||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[Do]||m[pt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),Jt(m,l,a),m[pt]=e,Ht(m),l=m;break e;case"link":var x=y0("link","href",f).get(l+(a.href||""));if(x){for(var j=0;j<x.length;j++)if(m=x[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)){x.splice(j,1);break t}}m=f.createElement(l),Jt(m,l,a),f.head.appendChild(m);break;case"meta":if(x=y0("meta","content",f).get(l+(a.content||""))){for(j=0;j<x.length;j++)if(m=x[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)){x.splice(j,1);break t}}m=f.createElement(l),Jt(m,l,a),f.head.appendChild(m);break;default:throw Error(o(468,l))}m[pt]=e,Ht(m),l=m}e.stateNode=l}else b0(f,e.type,e.stateNode);else e.stateNode=v0(f,l,e.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?b0(f,e.type,e.stateNode):v0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Ld(e,e.memoizedProps,a.memoizedProps)}break;case 27:fn(n,e),pn(e),l&512&&(zt||a===null||ms(a,a.return)),a!==null&&l&4&&Ld(e,e.memoizedProps,a.memoizedProps);break;case 5:if(fn(n,e),pn(e),l&512&&(zt||a===null||ms(a,a.return)),e.flags&32){f=e.stateNode;try{Ri(f,"")}catch(he){at(e,e.return,he)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Ld(e,f,a!==null?a.memoizedProps:f)),l&1024&&($d=!0);break;case 6:if(fn(n,e),pn(e),l&4){if(e.stateNode===null)throw Error(o(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(he){at(e,e.return,he)}}break;case 3:if(lc=null,f=Wn,Wn=oc(n.containerInfo),fn(n,e),Wn=f,pn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{co(n.containerInfo)}catch(he){at(e,e.return,he)}$d&&($d=!1,bv(e));break;case 4:l=Wn,Wn=oc(e.stateNode.containerInfo),fn(n,e),pn(e),Wn=l;break;case 12:fn(n,e),pn(e);break;case 31:fn(n,e),pn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Fl(e,l)));break;case 13:fn(n,e),pn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Kl=Ce()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Fl(e,l)));break;case 22:f=e.memoizedState!==null;var M=a!==null&&a.memoizedState!==null,H=Os,J=zt;if(Os=H||f,zt=J||M,fn(n,e),zt=J,Os=H,pn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||M||Os||zt||ai(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){M=a=n;try{if(m=M.stateNode,f)x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{j=M.stateNode;var X=M.memoizedProps.style,F=X!=null&&X.hasOwnProperty("display")?X.display:null;j.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(he){at(M,M.return,he)}}}else if(n.tag===6){if(a===null){M=n;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(he){at(M,M.return,he)}}}else if(n.tag===18){if(a===null){M=n;try{var K=M.stateNode;f?l0(K,!0):l0(M.stateNode,!1)}catch(he){at(M,M.return,he)}}}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,Fl(e,a))));break;case 19:fn(n,e),pn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Fl(e,l)));break;case 30:break;case 21:break;default:fn(n,e),pn(e)}}function pn(e){var n=e.flags;if(n&2){try{for(var a,l=e.return;l!==null;){if(uv(l)){a=l;break}l=l.return}if(a==null)throw Error(o(160));switch(a.tag){case 27:var f=a.stateNode,m=zd(e);Gl(e,m,f);break;case 5:var x=a.stateNode;a.flags&32&&(Ri(x,""),a.flags&=-33);var j=zd(e);Gl(e,j,x);break;case 3:case 4:var M=a.stateNode.containerInfo,H=zd(e);Ud(e,H,M);break;default:throw Error(o(161))}}catch(J){at(e,e.return,J)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function bv(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;bv(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Ls(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)pv(e,n.alternate,n),n=n.sibling}function ai(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),ai(n);break;case 1:ms(n,n.return);var a=n.stateNode;typeof a.componentWillUnmount=="function"&&lv(n,n.return,a),ai(n);break;case 27:pr(n.stateNode);case 26:case 5:ms(n,n.return),ai(n);break;case 22:n.memoizedState===null&&ai(n);break;case 30:ai(n);break;default:ai(n)}e=e.sibling}}function zs(e,n,a){for(a=a&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var l=n.alternate,f=e,m=n,x=m.flags;switch(m.tag){case 0:case 11:case 15:zs(f,m,a),sr(4,m);break;case 1:if(zs(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(H){at(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++)Jh(M[f],j)}catch(H){at(l,l.return,H)}}a&&x&64&&rv(m),ar(m,m.return);break;case 27:dv(m);case 26:case 5:zs(f,m,a),a&&l===null&&x&4&&cv(m),ar(m,m.return);break;case 12:zs(f,m,a);break;case 31:zs(f,m,a),a&&x&4&&gv(f,m);break;case 13:zs(f,m,a),a&&x&4&&vv(f,m);break;case 22:m.memoizedState===null&&zs(f,m,a),ar(m,m.return);break;case 30:break;default:zs(f,m,a)}n=n.sibling}}function Pd(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&&qo(a))}function Vd(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&qo(e))}function Xn(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)_v(e,n,a,l),n=n.sibling}function _v(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Xn(e,n,a,l),f&2048&&sr(9,n);break;case 1:Xn(e,n,a,l);break;case 3:Xn(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&&qo(e)));break;case 12:if(f&2048){Xn(e,n,a,l),e=n.stateNode;try{var m=n.memoizedProps,x=m.id,j=m.onPostCommit;typeof j=="function"&&j(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){at(n,n.return,M)}}else Xn(e,n,a,l);break;case 31:Xn(e,n,a,l);break;case 13:Xn(e,n,a,l);break;case 23:break;case 22:m=n.stateNode,x=n.alternate,n.memoizedState!==null?m._visibility&2?Xn(e,n,a,l):ir(e,n):m._visibility&2?Xn(e,n,a,l):(m._visibility|=2,Xi(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Pd(x,n);break;case 24:Xn(e,n,a,l),f&2048&&Vd(n.alternate,n);break;default:Xn(e,n,a,l)}}function Xi(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,x=n,j=a,M=l,H=x.flags;switch(x.tag){case 0:case 11:case 15:Xi(m,x,j,M,f),sr(8,x);break;case 23:break;case 22:var J=x.stateNode;x.memoizedState!==null?J._visibility&2?Xi(m,x,j,M,f):ir(m,x):(J._visibility|=2,Xi(m,x,j,M,f)),f&&H&2048&&Pd(x.alternate,x);break;case 24:Xi(m,x,j,M,f),f&&H&2048&&Vd(x.alternate,x);break;default:Xi(m,x,j,M,f)}n=n.sibling}}function ir(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:ir(a,l),f&2048&&Pd(l.alternate,l);break;case 24:ir(a,l),f&2048&&Vd(l.alternate,l);break;default:ir(a,l)}n=n.sibling}}var or=8192;function Qi(e,n,a){if(e.subtreeFlags&or)for(e=e.child;e!==null;)xv(e,n,a),e=e.sibling}function xv(e,n,a){switch(e.tag){case 26:Qi(e,n,a),e.flags&or&&e.memoizedState!==null&&AS(a,Wn,e.memoizedState,e.memoizedProps);break;case 5:Qi(e,n,a);break;case 3:case 4:var l=Wn;Wn=oc(e.stateNode.containerInfo),Qi(e,n,a),Wn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=or,or=16777216,Qi(e,n,a),or=l):Qi(e,n,a));break;default:Qi(e,n,a)}}function kv(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 rr(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];qt=l,Tv(l,e)}kv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Sv(e),e=e.sibling}function Sv(e){switch(e.tag){case 0:case 11:case 15:rr(e),e.flags&2048&&pa(9,e,e.return);break;case 3:rr(e);break;case 12:rr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Zl(e)):rr(e);break;default:rr(e)}}function Zl(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];qt=l,Tv(l,e)}kv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:pa(8,n,n.return),Zl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Zl(n));break;default:Zl(n)}e=e.sibling}}function Tv(e,n){for(;qt!==null;){var a=qt;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:qo(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,qt=l;else e:for(a=e;qt!==null;){l=qt;var f=l.sibling,m=l.return;if(mv(l),l===a){qt=null;break e}if(f!==null){f.return=m,qt=f;break e}qt=m}}}var Gk={getCacheForType:function(e){var n=Kt(Ot),a=n.data.get(e);return a===void 0&&(a=e(),n.data.set(e,a)),a},cacheSignal:function(){return Kt(Ot).controller.signal}},Fk=typeof WeakMap=="function"?WeakMap:Map,Qe=0,dt=null,Be=null,Ue=0,st=0,Sn=null,ma=!1,eo=!1,Hd=!1,Us=0,wt=0,ha=0,ii=0,qd=0,Tn=0,to=0,lr=null,mn=null,Gd=!1,Kl=0,wv=0,Yl=1/0,Jl=null,ga=null,$t=0,va=null,no=null,$s=0,Fd=0,Zd=null,Nv=null,cr=0,Kd=null;function wn(){return(Qe&2)!==0&&Ue!==0?Ue&-Ue:B.T!==null?ef():Ft()}function jv(){if(Tn===0)if((Ue&536870912)===0||Pe){var e=Pa;Pa<<=1,(Pa&3932160)===0&&(Pa=262144),Tn=e}else Tn=536870912;return e=xn.current,e!==null&&(e.flags|=32),Tn}function hn(e,n,a){(e===dt&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(so(e,0),ya(e,Ue,Tn,!1)),ze(e,a),((Qe&2)===0||e!==dt)&&(e===dt&&((Qe&2)===0&&(ii|=a),wt===4&&ya(e,Ue,Tn,!1)),hs(e))}function Cv(e,n,a){if((Qe&6)!==0)throw Error(o(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||te(e,n),f=l?Yk(e,n):Jd(e,n,!0),m=l;do{if(f===0){eo&&!l&&ya(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!Zk(a)){f=Jd(e,n,!1),m=!1;continue}if(f===2){if(m=n,e.errorRecoveryDisabledLanes&m)var x=0;else x=e.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){n=x;e:{var j=e;f=lr;var M=j.current.memoizedState.isDehydrated;if(M&&(so(j,x).flags|=256),x=Jd(j,x,!1),x!==2){if(Hd&&!M){j.errorRecoveryDisabledLanes|=m,ii|=m,f=4;break e}m=mn,mn=f,m!==null&&(mn===null?mn=m:mn.push.apply(mn,m))}f=x}if(m=!1,f!==2)continue}}if(f===1){so(e,0),ya(e,n,0,!0);break}e:{switch(l=e,m=f,m){case 0:case 1:throw Error(o(345));case 4:if((n&4194048)!==n)break;case 6:ya(l,n,Tn,!ma);break e;case 2:mn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((n&62914560)===n&&(f=Kl+300-Ce(),10<f)){if(ya(l,n,Tn,!ma),P(l,0,!0)!==0)break e;$s=n,l.timeoutHandle=i0(Ev.bind(null,l,a,mn,Jl,Gd,n,Tn,ii,to,ma,m,"Throttled",-0,0),f);break e}Ev(l,a,mn,Jl,Gd,n,Tn,ii,to,ma,m,null,-0,0)}}break}while(!0);hs(e)}function Ev(e,n,a,l,f,m,x,j,M,H,J,X,F,K){if(e.timeoutHandle=-1,X=n.subtreeFlags,X&8192||(X&16785408)===16785408){X={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ws},xv(n,m,X);var he=(m&62914560)===m?Kl-Ce():(m&4194048)===m?wv-Ce():0;if(he=DS(X,he),he!==null){$s=m,e.cancelPendingCommit=he(Lv.bind(null,e,n,m,a,l,f,x,j,M,J,X,null,F,K)),ya(e,m,x,!H);return}}Lv(e,n,m,a,l,f,x,j,M)}function Zk(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(!bn(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&=~qd,n&=~ii,e.suspendedLanes|=n,e.pingedLanes&=~n,l&&(e.warmLanes|=n),l=e.expirationTimes;for(var f=n;0<f;){var m=31-en(f),x=1<<m;l[m]=-1,f&=~x}a!==0&&Ae(e,a,n)}function Wl(){return(Qe&6)===0?(ur(0),!1):!0}function Yd(){if(Be!==null){if(st===0)var e=Be.return;else e=Be,Es=Ja=null,dd(e),Zi=null,Fo=0,e=Be;for(;e!==null;)ov(e.alternate,e),e=e.return;Be=null}}function so(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,pS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),$s=0,Yd(),dt=e,Be=a=js(e.current,null),Ue=n,st=0,Sn=null,ma=!1,eo=te(e,n),Hd=!1,to=Tn=qd=ii=ha=wt=0,mn=lr=null,Gd=!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-en(l),m=1<<f;n|=e[f],l&=~m}return Us=n,yl(),a}function Av(e,n){De=null,B.H=er,n===Fi||n===Nl?(n=Fh(),st=3):n===Qu?(n=Fh(),st=4):st=n===jd?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Sn=n,Be===null&&(wt=1,$l(e,In(n,e.current)))}function Dv(){var e=xn.current;return e===null?!0:(Ue&4194048)===Ue?zn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?e===zn:!1}function Rv(){var e=B.H;return B.H=er,e===null?er:e}function Mv(){var e=B.A;return B.A=Gk,e}function Xl(){wt=4,ma||(Ue&4194048)!==Ue&&xn.current!==null||(eo=!0),(ha&134217727)===0&&(ii&134217727)===0||dt===null||ya(dt,Ue,Tn,!1)}function Jd(e,n,a){var l=Qe;Qe|=2;var f=Rv(),m=Mv();(dt!==e||Ue!==n)&&(Jl=null,so(e,n)),n=!1;var x=wt;e:do try{if(st!==0&&Be!==null){var j=Be,M=Sn;switch(st){case 8:Yd(),x=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(n=!0);var H=st;if(st=0,Sn=null,ao(e,j,M,H),a&&eo){x=0;break e}break;default:H=st,st=0,Sn=null,ao(e,j,M,H)}}Kk(),x=wt;break}catch(J){Av(e,J)}while(!0);return n&&e.shellSuspendCounter++,Es=Ja=null,Qe=l,B.H=f,B.A=m,Be===null&&(dt=null,Ue=0,yl()),x}function Kk(){for(;Be!==null;)Iv(Be)}function Yk(e,n){var a=Qe;Qe|=2;var l=Rv(),f=Mv();dt!==e||Ue!==n?(Jl=null,Yl=Ce()+500,so(e,n)):eo=te(e,n);e:do try{if(st!==0&&Be!==null){n=Be;var m=Sn;t:switch(st){case 1:st=0,Sn=null,ao(e,n,m,1);break;case 2:case 9:if(qh(m)){st=0,Sn=null,Ov(n);break}n=function(){st!==2&&st!==9||dt!==e||(st=7),hs(e)},m.then(n,n);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:qh(m)?(st=0,Sn=null,Ov(n)):(st=0,Sn=null,ao(e,n,m,7));break;case 5:var x=null;switch(Be.tag){case 26:x=Be.memoizedState;case 5:case 27:var j=Be;if(x?_0(x):j.stateNode.complete){st=0,Sn=null;var M=j.sibling;if(M!==null)Be=M;else{var H=j.return;H!==null?(Be=H,Ql(H)):Be=null}break t}}st=0,Sn=null,ao(e,n,m,5);break;case 6:st=0,Sn=null,ao(e,n,m,6);break;case 8:Yd(),wt=6;break e;default:throw Error(o(462))}}Jk();break}catch(J){Av(e,J)}while(!0);return Es=Ja=null,B.H=l,B.A=f,Qe=a,Be!==null?0:(dt=null,Ue=0,yl(),wt)}function Jk(){for(;Be!==null&&!Kn();)Iv(Be)}function Iv(e){var n=av(e.alternate,e,Us);e.memoizedProps=e.pendingProps,n===null?Ql(e):Be=n}function Ov(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Xg(a,n,n.pendingProps,n.type,void 0,Ue);break;case 11:n=Xg(a,n,n.pendingProps,n.type.render,n.ref,Ue);break;case 5:dd(n);default:ov(a,n),n=Be=Mh(n,Us),n=av(a,n,Us)}e.memoizedProps=e.pendingProps,n===null?Ql(e):Be=n}function ao(e,n,a,l){Es=Ja=null,dd(n),Zi=null,Fo=0;var f=n.return;try{if(zk(e,f,n,a,Ue)){wt=1,$l(e,In(a,e.current)),Be=null;return}}catch(m){if(f!==null)throw Be=f,m;wt=1,$l(e,In(a,e.current)),Be=null;return}n.flags&32768?(Pe||l===1?e=!0:eo||(Ue&536870912)!==0?e=!1:(ma=e=!0,(l===2||l===9||l===3||l===6)&&(l=xn.current,l!==null&&l.tag===13&&(l.flags|=16384))),Bv(n,e)):Ql(n)}function Ql(e){var n=e;do{if((n.flags&32768)!==0){Bv(n,ma);return}e=n.return;var a=Pk(n.alternate,n,Us);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 Bv(e,n){do{var a=Vk(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 Lv(e,n,a,l,f,m,x,j,M){e.cancelPendingCommit=null;do ec();while($t!==0);if((Qe&6)!==0)throw Error(o(327));if(n!==null){if(n===e.current)throw Error(o(177));if(m=n.lanes|n.childLanes,m|=zu,ye(e,a,m,x,j,M),e===dt&&(Be=dt=null,Ue=0),no=n,va=e,$s=a,Fd=m,Zd=f,Nv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,eS(ds,function(){return Vv(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=Z.p,Z.p=2,x=Qe,Qe|=4;try{Hk(e,n,a)}finally{Qe=x,Z.p=f,B.T=l}}$t=1,zv(),Uv(),$v()}}function zv(){if($t===1){$t=0;var e=va,n=no,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var l=Z.p;Z.p=2;var f=Qe;Qe|=4;try{yv(n,e);var m=cf,x=Th(e.containerInfo),j=m.focusedElem,M=m.selectionRange;if(x!==j&&j&&j.ownerDocument&&Sh(j.ownerDocument.documentElement,j)){if(M!==null&&Mu(j)){var H=M.start,J=M.end;if(J===void 0&&(J=H),"selectionStart"in j)j.selectionStart=H,j.selectionEnd=Math.min(J,j.value.length);else{var X=j.ownerDocument||document,F=X&&X.defaultView||window;if(F.getSelection){var K=F.getSelection(),he=j.textContent.length,ke=Math.min(M.start,he),lt=M.end===void 0?ke:Math.min(M.end,he);!K.extend&&ke>lt&&(x=lt,lt=ke,ke=x);var z=kh(j,ke),O=kh(j,lt);if(z&&O&&(K.rangeCount!==1||K.anchorNode!==z.node||K.anchorOffset!==z.offset||K.focusNode!==O.node||K.focusOffset!==O.offset)){var V=X.createRange();V.setStart(z.node,z.offset),K.removeAllRanges(),ke>lt?(K.addRange(V),K.extend(O.node,O.offset)):(V.setEnd(O.node,O.offset),K.addRange(V))}}}}for(X=[],K=j;K=K.parentNode;)K.nodeType===1&&X.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;j<X.length;j++){var W=X[j];W.element.scrollLeft=W.left,W.element.scrollTop=W.top}}fc=!!lf,cf=lf=null}finally{Qe=f,Z.p=l,B.T=a}}e.current=n,$t=2}}function Uv(){if($t===2){$t=0;var e=va,n=no,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var l=Z.p;Z.p=2;var f=Qe;Qe|=4;try{pv(e,n.alternate,n)}finally{Qe=f,Z.p=l,B.T=a}}$t=3}}function $v(){if($t===4||$t===3){$t=0,Ne();var e=va,n=no,a=$s,l=Nv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?$t=5:($t=0,no=va=null,Pv(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(ga=null),Ut(a),n=n.stateNode,Qt&&typeof Qt.onCommitFiberRoot=="function")try{Qt.onCommitFiberRoot(na,n,void 0,(n.current.flags&128)===128)}catch{}if(l!==null){n=B.T,f=Z.p,Z.p=2,B.T=null;try{for(var m=e.onRecoverableError,x=0;x<l.length;x++){var j=l[x];m(j.value,{componentStack:j.stack})}}finally{B.T=n,Z.p=f}}($s&3)!==0&&ec(),hs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Kd?cr++:(cr=0,Kd=e):cr=0,ur(0)}}function Pv(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,qo(n)))}function ec(){return zv(),Uv(),$v(),Vv()}function Vv(){if($t!==5)return!1;var e=va,n=Fd;Fd=0;var a=Ut($s),l=B.T,f=Z.p;try{Z.p=32>a?32:a,B.T=null,a=Zd,Zd=null;var m=va,x=$s;if($t=0,no=va=null,$s=0,(Qe&6)!==0)throw Error(o(331));var j=Qe;if(Qe|=4,Sv(m.current),_v(m,m.current,x,a),Qe=j,ur(0,!1),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(na,m)}catch{}return!0}finally{Z.p=f,B.T=l,Pv(e,n)}}function Hv(e,n,a){n=In(a,n),n=Nd(e.stateNode,n,2),e=ua(e,n,2),e!==null&&(ze(e,2),hs(e))}function at(e,n,a){if(e.tag===3)Hv(e,e,a);else for(;n!==null;){if(n.tag===3){Hv(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=In(a,e),a=qg(2),l=ua(n,a,2),l!==null&&(Gg(a,l,n,e),ze(l,2),hs(l));break}}n=n.return}}function Wd(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Fk;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)||(Hd=!0,f.add(a),e=Wk.bind(null,e,n,a),n.then(e,e))}function Wk(e,n,a){var l=e.pingCache;l!==null&&l.delete(n),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,dt===e&&(Ue&a)===a&&(wt===4||wt===3&&(Ue&62914560)===Ue&&300>Ce()-Kl?(Qe&2)===0&&so(e,0):qd|=a,to===Ue&&(to=0)),hs(e)}function qv(e,n){n===0&&(n=ce()),e=Za(e,n),e!==null&&(ze(e,n),hs(e))}function Xk(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),qv(e,a)}function Qk(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(o(314))}l!==null&&l.delete(n),qv(e,a)}function eS(e,n){return us(e,n)}var tc=null,io=null,Xd=!1,nc=!1,Qd=!1,ba=0;function hs(e){e!==io&&e.next===null&&(io===null?tc=io=e:io=io.next=e),nc=!0,Xd||(Xd=!0,nS())}function ur(e,n){if(!Qd&&nc){Qd=!0;do for(var a=!1,l=tc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var x=l.suspendedLanes,j=l.pingedLanes;m=(1<<31-en(42|e)+1)-1,m&=f&~(x&~j),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,Kv(l,m))}else m=Ue,m=P(l,l===dt?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||te(l,m)||(a=!0,Kv(l,m));l=l.next}while(a);Qd=!1}}function tS(){Gv()}function Gv(){nc=Xd=!1;var e=0;ba!==0&&fS()&&(e=ba);for(var n=Ce(),a=null,l=tc;l!==null;){var f=l.next,m=Fv(l,n);m===0?(l.next=null,a===null?tc=f:a.next=f,f===null&&(io=a)):(a=l,(e!==0||(m&3)!==0)&&(nc=!0)),l=f}$t!==0&&$t!==5||ur(e),ba!==0&&(ba=0)}function Fv(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var x=31-en(m),j=1<<x,M=f[x];M===-1?((j&a)===0||(j&l)!==0)&&(f[x]=oe(j,n)):M<=n&&(e.expiredLanes|=j),m&=~j}if(n=dt,a=Ue,a=P(e,e===n?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===n&&(st===2||st===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&ta(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&&ta(l),Ut(a)){case 2:case 8:a=ks;break;case 32:a=ds;break;case 268435456:a=Ua;break;default:a=ds}return l=Zv.bind(null,e),a=us(a,l),e.callbackPriority=n,e.callbackNode=a,n}return l!==null&&l!==null&&ta(l),e.callbackPriority=2,e.callbackNode=null,2}function Zv(e,n){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ec()&&e.callbackNode!==a)return null;var l=Ue;return l=P(e,e===dt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Cv(e,l,n),Fv(e,Ce()),e.callbackNode!=null&&e.callbackNode===a?Zv.bind(null,e):null)}function Kv(e,n){if(ec())return null;Cv(e,n,!0)}function nS(){mS(function(){(Qe&6)!==0?us(yn,tS):Gv()})}function ef(){if(ba===0){var e=qi;e===0&&(e=$a,$a<<=1,($a&261888)===0&&($a=256)),ba=e}return ba}function Yv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ul(""+e)}function Jv(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 sS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var m=Yv((f[Vt]||null).action),x=l.submitter;x&&(n=(n=x[Vt]||null)?Yv(n.formAction):x.getAttribute("formAction"),n!==null&&(m=n,x=null));var j=new ml("action","action",null,l,f);e.push({event:j,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ba!==0){var M=x?Jv(f,x):new FormData(f);_d(a,{pending:!0,data:M,method:f.method,action:m},null,M)}}else typeof m=="function"&&(j.preventDefault(),M=x?Jv(f,x):new FormData(f),_d(a,{pending:!0,data:M,method:f.method,action:m},m,M))},currentTarget:f}]})}}for(var tf=0;tf<Lu.length;tf++){var nf=Lu[tf],aS=nf.toLowerCase(),iS=nf[0].toUpperCase()+nf.slice(1);Jn(aS,"on"+iS)}Jn(jh,"onAnimationEnd"),Jn(Ch,"onAnimationIteration"),Jn(Eh,"onAnimationStart"),Jn("dblclick","onDoubleClick"),Jn("focusin","onFocus"),Jn("focusout","onBlur"),Jn(xk,"onTransitionRun"),Jn(kk,"onTransitionStart"),Jn(Sk,"onTransitionCancel"),Jn(Ah,"onTransitionEnd"),Ai("onMouseEnter",["mouseout","mouseover"]),Ai("onMouseLeave",["mouseout","mouseover"]),Ai("onPointerEnter",["pointerout","pointerover"]),Ai("onPointerLeave",["pointerout","pointerover"]),Ha("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ha("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ha("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ha("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ha("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ha("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),oS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(dr));function Wv(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 x=l.length-1;0<=x;x--){var j=l[x],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(J){vl(J)}f.currentTarget=null,m=M}else for(x=0;x<l.length;x++){if(j=l[x],M=j.instance,H=j.currentTarget,j=j.listener,M!==m&&f.isPropagationStopped())break e;m=j,f.currentTarget=H;try{m(f)}catch(J){vl(J)}f.currentTarget=null,m=M}}}}function Le(e,n){var a=n[hu];a===void 0&&(a=n[hu]=new Set);var l=e+"__bubble";a.has(l)||(Xv(n,e,2,!1),a.add(l))}function sf(e,n,a){var l=0;n&&(l|=4),Xv(a,e,l,n)}var sc="_reactListening"+Math.random().toString(36).slice(2);function af(e){if(!e[sc]){e[sc]=!0,Gm.forEach(function(a){a!=="selectionchange"&&(oS.has(a)||sf(a,!1,e),sf(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[sc]||(n[sc]=!0,sf("selectionchange",!1,n))}}function Xv(e,n,a,l){switch(j0(n)){case 2:var f=IS;break;case 8:f=OS;break;default:f=_f}a=f.bind(null,n,a,e),f=void 0,!Tu||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 of(e,n,a,l,f){var m=l;if((n&1)===0&&(n&2)===0&&l!==null)e:for(;;){if(l===null)return;var x=l.tag;if(x===3||x===4){var j=l.stateNode.containerInfo;if(j===f)break;if(x===4)for(x=l.return;x!==null;){var M=x.tag;if((M===3||M===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;j!==null;){if(x=ji(j),x===null)return;if(M=x.tag,M===5||M===6||M===26||M===27){l=m=x;continue e}j=j.parentNode}}l=l.return}sh(function(){var H=m,J=ku(a),X=[];e:{var F=Dh.get(e);if(F!==void 0){var K=ml,he=e;switch(e){case"keypress":if(fl(a)===0)break e;case"keydown":case"keyup":K=Qx;break;case"focusin":he="focus",K=Cu;break;case"focusout":he="blur",K=Cu;break;case"beforeblur":case"afterblur":K=Cu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=oh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Px;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=nk;break;case jh:case Ch:case Eh:K=qx;break;case Ah:K=ak;break;case"scroll":case"scrollend":K=Ux;break;case"wheel":K=ok;break;case"copy":case"cut":case"paste":K=Fx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=lh;break;case"toggle":case"beforetoggle":K=lk}var ke=(n&4)!==0,lt=!ke&&(e==="scroll"||e==="scrollend"),z=ke?F!==null?F+"Capture":null:F;ke=[];for(var O=H,V;O!==null;){var W=O;if(V=W.stateNode,W=W.tag,W!==5&&W!==26&&W!==27||V===null||z===null||(W=Mo(O,z),W!=null&&ke.push(fr(O,W,V))),lt)break;O=O.return}0<ke.length&&(F=new K(F,he,null,a,J),X.push({event:F,listeners:ke}))}}if((n&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",F&&a!==xu&&(he=a.relatedTarget||a.fromElement)&&(ji(he)||he[Ni]))break e;if((K||F)&&(F=J.window===J?J:(F=J.ownerDocument)?F.defaultView||F.parentWindow:window,K?(he=a.relatedTarget||a.toElement,K=H,he=he?ji(he):null,he!==null&&(lt=u(he),ke=he.tag,he!==lt||ke!==5&&ke!==27&&ke!==6)&&(he=null)):(K=null,he=H),K!==he)){if(ke=oh,W="onMouseLeave",z="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(ke=lh,W="onPointerLeave",z="onPointerEnter",O="pointer"),lt=K==null?F:Ro(K),V=he==null?F:Ro(he),F=new ke(W,O+"leave",K,a,J),F.target=lt,F.relatedTarget=V,W=null,ji(J)===H&&(ke=new ke(z,O+"enter",he,a,J),ke.target=V,ke.relatedTarget=lt,W=ke),lt=W,K&&he)t:{for(ke=rS,z=K,O=he,V=0,W=z;W;W=ke(W))V++;W=0;for(var be=O;be;be=ke(be))W++;for(;0<V-W;)z=ke(z),V--;for(;0<W-V;)O=ke(O),W--;for(;V--;){if(z===O||O!==null&&z===O.alternate){ke=z;break t}z=ke(z),O=ke(O)}ke=null}else ke=null;K!==null&&Qv(X,F,K,ke,!1),he!==null&&lt!==null&&Qv(X,lt,he,ke,!0)}}e:{if(F=H?Ro(H):window,K=F.nodeName&&F.nodeName.toLowerCase(),K==="select"||K==="input"&&F.type==="file")var Ye=gh;else if(mh(F))if(vh)Ye=yk;else{Ye=gk;var ge=hk}else K=F.nodeName,!K||K.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?H&&_u(H.elementType)&&(Ye=gh):Ye=vk;if(Ye&&(Ye=Ye(e,H))){hh(X,Ye,a,J);break e}ge&&ge(e,F,H),e==="focusout"&&H&&F.type==="number"&&H.memoizedProps.value!=null&&bu(F,"number",F.value)}switch(ge=H?Ro(H):window,e){case"focusin":(mh(ge)||ge.contentEditable==="true")&&(Bi=ge,Iu=H,Po=null);break;case"focusout":Po=Iu=Bi=null;break;case"mousedown":Ou=!0;break;case"contextmenu":case"mouseup":case"dragend":Ou=!1,wh(X,a,J);break;case"selectionchange":if(_k)break;case"keydown":case"keyup":wh(X,a,J)}var Re;if(Au)e:{switch(e){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Oi?fh(e,a)&&($e="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&($e="onCompositionStart");$e&&(ch&&a.locale!=="ko"&&(Oi||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Oi&&(Re=ah()):(sa=J,wu="value"in sa?sa.value:sa.textContent,Oi=!0)),ge=ac(H,$e),0<ge.length&&($e=new rh($e,e,null,a,J),X.push({event:$e,listeners:ge}),Re?$e.data=Re:(Re=ph(a),Re!==null&&($e.data=Re)))),(Re=uk?dk(e,a):fk(e,a))&&($e=ac(H,"onBeforeInput"),0<$e.length&&(ge=new rh("onBeforeInput","beforeinput",null,a,J),X.push({event:ge,listeners:$e}),ge.data=Re)),sS(X,e,H,a,J)}Wv(X,n)})}function fr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function ac(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=Mo(e,a),f!=null&&l.unshift(fr(e,f,m)),f=Mo(e,n),f!=null&&l.push(fr(e,f,m))),e.tag===3)return l;e=e.return}return[]}function rS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Qv(e,n,a,l,f){for(var m=n._reactName,x=[];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=Mo(a,m),H!=null&&x.unshift(fr(a,H,M))):f||(H=Mo(a,m),H!=null&&x.push(fr(a,H,M)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var lS=/\r\n?/g,cS=/\u0000|\uFFFD/g;function e0(e){return(typeof e=="string"?e:""+e).replace(lS,`
26
- `).replace(cS,"")}function t0(e,n){return n=e0(n),e0(e)===n}function rt(e,n,a,l,f,m){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Ri(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Ri(e,""+l);break;case"className":ll(e,"class",l);break;case"tabIndex":ll(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":ll(e,a,l);break;case"style":th(e,l,m);break;case"data":if(n!=="object"){ll(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=ul(""+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"&&rt(e,n,"name",f.name,f,null),rt(e,n,"formEncType",f.formEncType,f,null),rt(e,n,"formMethod",f.formMethod,f,null),rt(e,n,"formTarget",f.formTarget,f,null)):(rt(e,n,"encType",f.encType,f,null),rt(e,n,"method",f.method,f,null),rt(e,n,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ul(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=ws);break;case"onScroll":l!=null&&Le("scroll",e);break;case"onScrollEnd":l!=null&&Le("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(o(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=ul(""+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":Le("beforetoggle",e),Le("toggle",e),rl(e,"popover",l);break;case"xlinkActuate":Ts(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ts(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ts(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ts(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ts(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ts(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ts(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ts(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ts(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":rl(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=Lx.get(a)||a,rl(e,a,l))}}function rf(e,n,a,l,f,m){switch(a){case"style":th(e,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(o(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(o(60));e.innerHTML=a}}break;case"children":typeof l=="string"?Ri(e,l):(typeof l=="number"||typeof l=="bigint")&&Ri(e,""+l);break;case"onScroll":l!=null&&Le("scroll",e);break;case"onScrollEnd":l!=null&&Le("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(!Fm.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[Vt]||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,""):rl(e,a,l)}}}function Jt(e,n,a){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Le("error",e),Le("load",e);var l=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var x=a[m];if(x!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:rt(e,n,m,x,a,null)}}f&&rt(e,n,"srcSet",a.srcSet,a,null),l&&rt(e,n,"src",a.src,a,null);return;case"input":Le("invalid",e);var j=m=x=f=null,M=null,H=null;for(l in a)if(a.hasOwnProperty(l)){var J=a[l];if(J!=null)switch(l){case"name":f=J;break;case"type":x=J;break;case"checked":M=J;break;case"defaultChecked":H=J;break;case"value":m=J;break;case"defaultValue":j=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(o(137,n));break;default:rt(e,n,l,J,a,null)}}Wm(e,m,j,M,H,x,f,!1);return;case"select":Le("invalid",e),l=x=m=null;for(f in a)if(a.hasOwnProperty(f)&&(j=a[f],j!=null))switch(f){case"value":m=j;break;case"defaultValue":x=j;break;case"multiple":l=j;default:rt(e,n,f,j,a,null)}n=m,a=x,e.multiple=!!l,n!=null?Di(e,!!l,n,!1):a!=null&&Di(e,!!l,a,!0);return;case"textarea":Le("invalid",e),m=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(j=a[x],j!=null))switch(x){case"value":l=j;break;case"defaultValue":f=j;break;case"children":m=j;break;case"dangerouslySetInnerHTML":if(j!=null)throw Error(o(91));break;default:rt(e,n,x,j,a,null)}Qm(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:rt(e,n,M,l,a,null)}return;case"dialog":Le("beforetoggle",e),Le("toggle",e),Le("cancel",e),Le("close",e);break;case"iframe":case"object":Le("load",e);break;case"video":case"audio":for(l=0;l<dr.length;l++)Le(dr[l],e);break;case"image":Le("error",e),Le("load",e);break;case"details":Le("toggle",e);break;case"embed":case"source":case"link":Le("error",e),Le("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(o(137,n));default:rt(e,n,H,l,a,null)}return;default:if(_u(n)){for(J in a)a.hasOwnProperty(J)&&(l=a[J],l!==void 0&&rf(e,n,J,l,a,void 0));return}}for(j in a)a.hasOwnProperty(j)&&(l=a[j],l!=null&&rt(e,n,j,l,a,null))}function uS(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,x=null,j=null,M=null,H=null,J=null;for(K in a){var X=a[K];if(a.hasOwnProperty(K)&&X!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":M=X;default:l.hasOwnProperty(K)||rt(e,n,K,null,l,X)}}for(var F in l){var K=l[F];if(X=a[F],l.hasOwnProperty(F)&&(K!=null||X!=null))switch(F){case"type":m=K;break;case"name":f=K;break;case"checked":H=K;break;case"defaultChecked":J=K;break;case"value":x=K;break;case"defaultValue":j=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,n));break;default:K!==X&&rt(e,n,F,K,l,X)}}yu(e,x,j,M,H,J,m,f);return;case"select":K=x=j=F=null;for(m in a)if(M=a[m],a.hasOwnProperty(m)&&M!=null)switch(m){case"value":break;case"multiple":K=M;default:l.hasOwnProperty(m)||rt(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":F=m;break;case"defaultValue":j=m;break;case"multiple":x=m;default:m!==M&&rt(e,n,f,m,l,M)}n=j,a=x,l=K,F!=null?Di(e,!!a,F,!1):!!l!=!!a&&(n!=null?Di(e,!!a,n,!0):Di(e,!!a,a?[]:"",!1));return;case"textarea":K=F=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:rt(e,n,j,null,l,f)}for(x in l)if(f=l[x],m=a[x],l.hasOwnProperty(x)&&(f!=null||m!=null))switch(x){case"value":F=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:f!==m&&rt(e,n,x,f,l,m)}Xm(e,F,K);return;case"option":for(var he in a)if(F=a[he],a.hasOwnProperty(he)&&F!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:rt(e,n,he,null,l,F)}for(M in l)if(F=l[M],K=a[M],l.hasOwnProperty(M)&&F!==K&&(F!=null||K!=null))switch(M){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:rt(e,n,M,F,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ke in a)F=a[ke],a.hasOwnProperty(ke)&&F!=null&&!l.hasOwnProperty(ke)&&rt(e,n,ke,null,l,F);for(H in l)if(F=l[H],K=a[H],l.hasOwnProperty(H)&&F!==K&&(F!=null||K!=null))switch(H){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(o(137,n));break;default:rt(e,n,H,F,l,K)}return;default:if(_u(n)){for(var lt in a)F=a[lt],a.hasOwnProperty(lt)&&F!==void 0&&!l.hasOwnProperty(lt)&&rf(e,n,lt,void 0,l,F);for(J in l)F=l[J],K=a[J],!l.hasOwnProperty(J)||F===K||F===void 0&&K===void 0||rf(e,n,J,F,l,K);return}}for(var z in a)F=a[z],a.hasOwnProperty(z)&&F!=null&&!l.hasOwnProperty(z)&&rt(e,n,z,null,l,F);for(X in l)F=l[X],K=a[X],!l.hasOwnProperty(X)||F===K||F==null&&K==null||rt(e,n,X,F,l,K)}function n0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function dS(){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,x=f.initiatorType,j=f.duration;if(m&&j&&n0(x)){for(x=0,j=f.responseEnd,l+=1;l<a.length;l++){var M=a[l],H=M.startTime;if(H>j)break;var J=M.transferSize,X=M.initiatorType;J&&n0(X)&&(M=M.responseEnd,x+=J*(M<j?1:(j-H)/(M-H)))}if(--l,n+=8*(m+x)/(f.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var lf=null,cf=null;function ic(e){return e.nodeType===9?e:e.ownerDocument}function s0(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 a0(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 uf(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 df=null;function fS(){var e=window.event;return e&&e.type==="popstate"?e===df?!1:(df=e,!0):(df=null,!1)}var i0=typeof setTimeout=="function"?setTimeout:void 0,pS=typeof clearTimeout=="function"?clearTimeout:void 0,o0=typeof Promise=="function"?Promise:void 0,mS=typeof queueMicrotask=="function"?queueMicrotask:typeof o0<"u"?function(e){return o0.resolve(null).then(e).catch(hS)}:i0;function hS(e){setTimeout(function(){throw e})}function _a(e){return e==="head"}function r0(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),co(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")pr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,pr(a);for(var m=a.firstChild;m;){var x=m.nextSibling,j=m.nodeName;m[Do]||j==="SCRIPT"||j==="STYLE"||j==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=x}}else a==="body"&&pr(e.ownerDocument.body);a=f}while(a);co(n)}function l0(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 ff(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":ff(a),gu(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function gS(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[Do])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=Un(e.nextSibling),e===null)break}return null}function vS(e,n,a){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Un(e.nextSibling),e===null))return null;return e}function c0(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Un(e.nextSibling),e===null))return null;return e}function pf(e){return e.data==="$?"||e.data==="$~"}function mf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function yS(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 Un(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 hf=null;function u0(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(n===0)return Un(e.nextSibling);n--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||n++}e=e.nextSibling}return null}function d0(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 f0(e,n,a){switch(n=ic(a),e){case"html":if(e=n.documentElement,!e)throw Error(o(452));return e;case"head":if(e=n.head,!e)throw Error(o(453));return e;case"body":if(e=n.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function pr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);gu(e)}var $n=new Map,p0=new Set;function oc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ps=Z.d;Z.d={f:bS,r:_S,D:xS,C:kS,L:SS,m:TS,X:NS,S:wS,M:jS};function bS(){var e=Ps.f(),n=Wl();return e||n}function _S(e){var n=Ci(e);n!==null&&n.tag===5&&n.type==="form"?Ag(n):Ps.r(e)}var oo=typeof document>"u"?null:document;function m0(e,n,a){var l=oo;if(l&&typeof n=="string"&&n){var f=Rn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),p0.has(f)||(p0.add(f),e={rel:e,crossOrigin:a,href:n},l.querySelector(f)===null&&(n=l.createElement("link"),Jt(n,"link",e),Ht(n),l.head.appendChild(n)))}}function xS(e){Ps.D(e),m0("dns-prefetch",e,null)}function kS(e,n){Ps.C(e,n),m0("preconnect",e,n)}function SS(e,n,a){Ps.L(e,n,a);var l=oo;if(l&&e&&n){var f='link[rel="preload"][as="'+Rn(n)+'"]';n==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Rn(a.imageSizes)+'"]')):f+='[href="'+Rn(e)+'"]';var m=f;switch(n){case"style":m=ro(e);break;case"script":m=lo(e)}$n.has(m)||(e=y({rel:"preload",href:n==="image"&&a&&a.imageSrcSet?void 0:e,as:n},a),$n.set(m,e),l.querySelector(f)!==null||n==="style"&&l.querySelector(mr(m))||n==="script"&&l.querySelector(hr(m))||(n=l.createElement("link"),Jt(n,"link",e),Ht(n),l.head.appendChild(n)))}}function TS(e,n){Ps.m(e,n);var a=oo;if(a&&e){var l=n&&typeof n.as=="string"?n.as:"script",f='link[rel="modulepreload"][as="'+Rn(l)+'"][href="'+Rn(e)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=lo(e)}if(!$n.has(m)&&(e=y({rel:"modulepreload",href:e},n),$n.set(m,e),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(hr(m)))return}l=a.createElement("link"),Jt(l,"link",e),Ht(l),a.head.appendChild(l)}}}function wS(e,n,a){Ps.S(e,n,a);var l=oo;if(l&&e){var f=Ei(l).hoistableStyles,m=ro(e);n=n||"default";var x=f.get(m);if(!x){var j={loading:0,preload:null};if(x=l.querySelector(mr(m)))j.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=$n.get(m))&&gf(e,a);var M=x=l.createElement("link");Ht(M),Jt(M,"link",e),M._p=new Promise(function(H,J){M.onload=H,M.onerror=J}),M.addEventListener("load",function(){j.loading|=1}),M.addEventListener("error",function(){j.loading|=2}),j.loading|=4,rc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:j},f.set(m,x)}}}function NS(e,n){Ps.X(e,n);var a=oo;if(a&&e){var l=Ei(a).hoistableScripts,f=lo(e),m=l.get(f);m||(m=a.querySelector(hr(f)),m||(e=y({src:e,async:!0},n),(n=$n.get(f))&&vf(e,n),m=a.createElement("script"),Ht(m),Jt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function jS(e,n){Ps.M(e,n);var a=oo;if(a&&e){var l=Ei(a).hoistableScripts,f=lo(e),m=l.get(f);m||(m=a.querySelector(hr(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=$n.get(f))&&vf(e,n),m=a.createElement("script"),Ht(m),Jt(m,"link",e),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function h0(e,n,a,l){var f=(f=ve.current)?oc(f):null;if(!f)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(n=ro(a.href),a=Ei(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=ro(a.href);var m=Ei(f).hoistableStyles,x=m.get(e);if(x||(f=f.ownerDocument||f,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,x),(m=f.querySelector(mr(e)))&&!m._p&&(x.instance=m,x.state.loading=5),$n.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},$n.set(e,a),m||CS(f,e,a,x.state))),n&&l===null)throw Error(o(528,""));return x}if(n&&l!==null)throw Error(o(529,""));return null;case"script":return n=a.async,a=a.src,typeof a=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=lo(a),a=Ei(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(o(444,e))}}function ro(e){return'href="'+Rn(e)+'"'}function mr(e){return'link[rel="stylesheet"]['+e+"]"}function g0(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function CS(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}),Jt(n,"link",a),Ht(n),e.head.appendChild(n))}function lo(e){return'[src="'+Rn(e)+'"]'}function hr(e){return"script[async]"+e}function v0(e,n,a){if(n.count++,n.instance===null)switch(n.type){case"style":var l=e.querySelector('style[data-href~="'+Rn(a.href)+'"]');if(l)return n.instance=l,Ht(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),Ht(l),Jt(l,"style",f),rc(l,a.precedence,e),n.instance=l;case"stylesheet":f=ro(a.href);var m=e.querySelector(mr(f));if(m)return n.state.loading|=4,n.instance=m,Ht(m),m;l=g0(a),(f=$n.get(f))&&gf(l,f),m=(e.ownerDocument||e).createElement("link"),Ht(m);var x=m;return x._p=new Promise(function(j,M){x.onload=j,x.onerror=M}),Jt(m,"link",l),n.state.loading|=4,rc(m,a.precedence,e),n.instance=m;case"script":return m=lo(a.src),(f=e.querySelector(hr(m)))?(n.instance=f,Ht(f),f):(l=a,(f=$n.get(m))&&(l=y({},a),vf(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),Ht(f),Jt(f,"link",l),e.head.appendChild(f),n.instance=f);case"void":return null;default:throw Error(o(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(l=n.instance,n.state.loading|=4,rc(l,a.precedence,e));return n.instance}function rc(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,x=0;x<l.length;x++){var j=l[x];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 gf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function vf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var lc=null;function y0(e,n,a){if(lc===null){var l=new Map,f=lc=new Map;f.set(a,l)}else f=lc,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[Do]||m[pt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var x=m.getAttribute(n)||"";x=e+x;var j=l.get(x);j?j.push(m):l.set(x,[m])}}return l}function b0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function ES(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 _0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function AS(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=ro(l.href),m=n.querySelector(mr(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=cc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,Ht(m);return}m=n.ownerDocument||n,l=g0(l),(f=$n.get(f))&&gf(l,f),m=m.createElement("link"),Ht(m);var x=m;x._p=new Promise(function(j,M){x.onload=j,x.onerror=M}),Jt(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=cc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var yf=0;function DS(e,n){return e.stylesheets&&e.count===0&&dc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&dc(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&yf===0&&(yf=62500*dS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dc(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>yf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function cc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var uc=null;function dc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,uc=new Map,n.forEach(RS,e),uc=null,cc.call(e))}function RS(e,n){if(!(n.state.loading&4)){var a=uc.get(e);if(a)var l=a.get(null);else{a=new Map,uc.set(e,a);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var x=f[m];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(a.set(x.dataset.precedence,x),l=x)}l&&a.set(null,l)}f=n.instance,x=f.getAttribute("data-precedence"),m=a.get(x)||l,m===l&&a.set(null,f),a.set(x,f),this.count++,l=cc.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 gr={$$typeof:E,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function MS(e,n,a,l,f,m,x,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=fe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fe(0),this.hiddenUpdates=fe(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function x0(e,n,a,l,f,m,x,j,M,H,J,X){return e=new MS(e,n,a,x,M,H,J,X,j),n=1,m===!0&&(n|=24),m=_n(3,null,null,n),e.current=m,m.stateNode=e,n=Ju(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:n},ed(m),e}function k0(e){return e?(e=Ui,e):Ui}function S0(e,n,a,l,f,m){f=k0(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=ua(e,l,n),a!==null&&(hn(a,e,n),Ko(a,e,n))}function T0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function bf(e,n){T0(e,n),(e=e.alternate)&&T0(e,n)}function w0(e){if(e.tag===13||e.tag===31){var n=Za(e,67108864);n!==null&&hn(n,e,67108864),bf(e,67108864)}}function N0(e){if(e.tag===13||e.tag===31){var n=wn();n=Ze(n);var a=Za(e,n);a!==null&&hn(a,e,n),bf(e,n)}}var fc=!0;function IS(e,n,a,l){var f=B.T;B.T=null;var m=Z.p;try{Z.p=2,_f(e,n,a,l)}finally{Z.p=m,B.T=f}}function OS(e,n,a,l){var f=B.T;B.T=null;var m=Z.p;try{Z.p=8,_f(e,n,a,l)}finally{Z.p=m,B.T=f}}function _f(e,n,a,l){if(fc){var f=xf(l);if(f===null)of(e,n,l,pc,a),C0(e,l);else if(LS(f,e,n,a,l))l.stopPropagation();else if(C0(e,l),n&4&&-1<BS.indexOf(e)){for(;f!==null;){var m=Ci(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=Ss(m.pendingLanes);if(x!==0){var j=m;for(j.pendingLanes|=2,j.entangledLanes|=2;x;){var M=1<<31-en(x);j.entanglements[1]|=M,x&=~M}hs(m),(Qe&6)===0&&(Yl=Ce()+500,ur(0))}}break;case 31:case 13:j=Za(m,2),j!==null&&hn(j,m,2),Wl(),bf(m,2)}if(m=xf(l),m===null&&of(e,n,l,pc,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else of(e,n,l,null,a)}}function xf(e){return e=ku(e),kf(e)}var pc=null;function kf(e){if(pc=null,e=ji(e),e!==null){var n=u(e);if(n===null)e=null;else{var a=n.tag;if(a===13){if(e=d(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 pc=e,null}function j0(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(cn()){case yn:return 2;case ks:return 8;case ds:case Ti:return 32;case Ua:return 268435456;default:return 32}default:return 32}}var Sf=!1,xa=null,ka=null,Sa=null,vr=new Map,yr=new Map,Ta=[],BS="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 C0(e,n){switch(e){case"focusin":case"focusout":xa=null;break;case"dragenter":case"dragleave":ka=null;break;case"mouseover":case"mouseout":Sa=null;break;case"pointerover":case"pointerout":vr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":yr.delete(n.pointerId)}}function br(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=Ci(n),n!==null&&w0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function LS(e,n,a,l,f){switch(n){case"focusin":return xa=br(xa,e,n,a,l,f),!0;case"dragenter":return ka=br(ka,e,n,a,l,f),!0;case"mouseover":return Sa=br(Sa,e,n,a,l,f),!0;case"pointerover":var m=f.pointerId;return vr.set(m,br(vr.get(m)||null,e,n,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,yr.set(m,br(yr.get(m)||null,e,n,a,l,f)),!0}return!1}function E0(e){var n=ji(e.target);if(n!==null){var a=u(n);if(a!==null){if(n=a.tag,n===13){if(n=d(a),n!==null){e.blockedOn=n,Et(e.priority,function(){N0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Et(e.priority,function(){N0(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 mc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=xf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);xu=l,a.target.dispatchEvent(l),xu=null}else return n=Ci(a),n!==null&&w0(n),e.blockedOn=a,!1;n.shift()}return!0}function A0(e,n,a){mc(e)&&a.delete(n)}function zS(){Sf=!1,xa!==null&&mc(xa)&&(xa=null),ka!==null&&mc(ka)&&(ka=null),Sa!==null&&mc(Sa)&&(Sa=null),vr.forEach(A0),yr.forEach(A0)}function hc(e,n){e.blockedOn===n&&(e.blockedOn=null,Sf||(Sf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,zS)))}var gc=null;function D0(e){gc!==e&&(gc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){gc===e&&(gc=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(kf(l||a)===null)continue;break}var m=Ci(a);m!==null&&(e.splice(n,3),n-=3,_d(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function co(e){function n(M){return hc(M,e)}xa!==null&&hc(xa,e),ka!==null&&hc(ka,e),Sa!==null&&hc(Sa,e),vr.forEach(n),yr.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);)E0(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],x=f[Vt]||null;if(typeof m=="function")x||D0(a);else if(x){var j=null;if(m&&m.hasAttribute("formAction")){if(f=m,x=m[Vt]||null)j=x.formAction;else if(kf(f)!==null)continue}else j=x.action;typeof j=="function"?a[l+1]=j:(a.splice(l,3),l-=3),D0(a)}}}function R0(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(x){return f=x})},focusReset:"manual",scroll:"manual"})}function n(){f!==null&&(f(),f=null),l||setTimeout(a,20)}function a(){if(!l&&!navigation.transition){var 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 Tf(e){this._internalRoot=e}vc.prototype.render=Tf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var a=n.current,l=wn();S0(a,l,e,n,null,null)},vc.prototype.unmount=Tf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;S0(e.current,2,null,e,null,null),Wl(),n[Ni]=null}};function vc(e){this._internalRoot=e}vc.prototype.unstable_scheduleHydration=function(e){if(e){var n=Ft();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&&E0(e)}};var M0=s.version;if(M0!=="19.2.4")throw Error(o(527,M0,"19.2.4"));Z.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=g(n),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var US={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yc.isDisabled&&yc.supportsFiber)try{na=yc.inject(US),Qt=yc}catch{}}return xr.createRoot=function(e,n){if(!c(e))throw Error(o(299));var a=!1,l="",f=$g,m=Pg,x=Vg;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&&(x=n.onRecoverableError)),n=x0(e,1,!1,null,null,a,l,null,f,m,x,R0),e[Ni]=n.current,af(e),new Tf(n)},xr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(o(299));var l=!1,f="",m=$g,x=Pg,j=Vg,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&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError),a.formState!==void 0&&(M=a.formState)),n=x0(e,1,!0,n,a??null,l,f,M,m,x,j,R0),n.context=k0(null),a=n.current,l=wn(),l=Ze(l),f=ca(l),f.callback=null,ua(a,f,l),a=l,n.current.lanes=a,ze(n,a),hs(n),e[Ni]=n.current,af(e),new vc(n)},xr.version="19.2.4",xr}var P0;function pT(){if(P0)return wf.exports;P0=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(),wf.exports=fT(),wf.exports}var mT=pT();const hT="modulepreload",gT=function(t){return"/"+t},V0={},vT=function(s,i,o){let c=Promise.resolve();if(i&&i.length>0){let d=function(g){return Promise.all(g.map(v=>Promise.resolve(v).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};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=d(i.map(g=>{if(g=gT(g),g in V0)return;V0[g]=!0;const v=g.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${y}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":hT,v||(_.as="script"),_.crossOrigin="",_.href=g,h&&_.setAttribute("nonce",h),document.head.appendChild(_),v)return new Promise((k,S)=>{_.addEventListener("load",k),_.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function u(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return c.then(d=>{for(const p of d||[])p.status==="rejected"&&u(p.reason);return s().catch(u)})},yT=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),bT=KS({baseUrl:"/",fetch:yT}),xe=YS(JS,bT),_T="_bar_1xhb4_1",xT="_input_1xhb4_32",kT="_select_1xhb4_67",ST="_btnPrimary_1xhb4_103",TT="_btnGhost_1xhb4_173",wT="_badge_1xhb4_195",NT="_disconnectHint_1xhb4_205",Nn={bar:_T,input:xT,select:kT,btnPrimary:ST,btnGhost:TT,badge:wT,disconnectHint:NT};function jT(t,s){if(!t)return!1;const i=s.find(o=>o.id===t);return i!==void 0&&(i.status==="disconnected"||i.status==="error")}function CT({environmentId:t,onReconnect:s}){return r.jsxs(r.Fragment,{children:[r.jsx("span",{className:Nn.disconnectHint,"data-testid":"env-disconnect-hint",children:"Environment unavailable"}),r.jsx("button",{type:"button",onClick:()=>s(t),className:Nn.btnGhost,"data-testid":"reconnect-btn",title:"Reconnect the environment to resume messaging",children:"Reconnect"})]})}function Ur({mode:t,sessionId:s,environmentId:i,taskId:o,showPersonaSelect:c,personas:u,environments:d,onSendInput:p,onSpawn:h,onStartTask:g,onProvisionEnvironment:v,onShowToast:y}){const[_,k]=b.useState(""),[S,w]=b.useState(""),N=jT(i,d),T=C=>{if(C.preventDefault(),!!_.trim())if(t==="send"){if(!s||N)return;p(s,_),k("")}else if(t==="spawn"){if(!i)return;h(i,_,S),y==null||y("Session started","success"),k(""),w("")}else{if(!o)return;g(o,void 0,i,_),k("")}};return t==="spawn"?r.jsxs("form",{onSubmit:T,className:Nn.bar,children:[r.jsx("span",{className:Nn.badge,children:"new chat"}),r.jsx("input",{type:"text",value:_,onChange:C=>k(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:Nn.input}),c&&r.jsxs("select",{value:S,onChange:C=>w(C.target.value),className:Nn.select,children:[r.jsx("option",{value:"",children:"(Default)"}),u.map(C=>r.jsx("option",{value:C.id,children:C.name},C.id))]}),r.jsx("button",{type:"submit",disabled:!_.trim()||!i,className:Nn.btnPrimary,children:"Go"})]}):t==="start"?r.jsxs("form",{onSubmit:T,className:Nn.bar,children:[r.jsx("input",{type:"text",value:_,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:Nn.input}),r.jsx("button",{type:"submit",disabled:!_.trim(),className:Nn.btnPrimary,children:"Send"})]}):r.jsxs("form",{onSubmit:T,className:Nn.bar,children:[N&&i&&r.jsx(CT,{environmentId:i,onReconnect:v}),r.jsx("input",{type:"text",value:_,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!N,disabled:N,className:Nn.input}),r.jsx("span",{title:N?"Environment is unavailable — reconnect first":void 0,children:r.jsx("button",{type:"submit",disabled:!_.trim()||N,className:Nn.btnPrimary,children:"Send"})})]})}const H0=220,q0=70,ET=40,AT=60,DT="hierarchy",RT="dependency";function MT(t){return b.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new I0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:ET,ranksep:AT});const i=new Map(t.map(d=>[d.id,d])),o=new Map;for(const d of t)if(d.parentTaskId&&i.has(d.parentTaskId)){const p=o.get(d.parentTaskId)||[];p.push(d),o.set(d.parentTaskId,p)}for(const d of t)s.setNode(d.id,{width:H0,height:q0});const c=[];for(const d of t){if(d.parentTaskId&&i.has(d.parentTaskId)){const p=`hierarchy-${d.parentTaskId}-${d.id}`;s.setEdge(d.parentTaskId,d.id,{},p),c.push({id:p,source:d.parentTaskId,target:d.id,type:"smoothstep",data:{edgeType:DT},style:{stroke:"var(--accent-green)",strokeWidth:2},animated:!1})}for(const p of d.dependsOn)if(i.has(p)){const h=`dependency-${p}-${d.id}`;s.setEdge(p,d.id,{},h),c.push({id:h,source:p,target:d.id,type:"smoothstep",data:{edgeType:RT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return I0.layout(s),{nodes:t.map(d=>{const p=s.node(d.id),h=o.get(d.id)||[];return{id:d.id,type:"task",position:{x:p.x-H0/2,y:p.y-q0/2},data:{task:d,childCount:h.length,doneChildCount:h.filter(g=>g.status==="complete").length,hasDependencies:d.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 IT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Wb=(...t)=>t.filter((s,i,o)=>!!s&&s.trim()!==""&&o.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 OT={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 BT=b.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...p},h)=>b.createElement("svg",{ref:h,...OT,width:s,height:s,stroke:t,strokeWidth:o?Number(i)*24/Number(s):i,className:Wb("lucide",c),...p},[...d.map(([g,v])=>b.createElement(g,v)),...Array.isArray(u)?u:[u]]));/**
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 Ge=(t,s)=>{const i=b.forwardRef(({className:o,...c},u)=>b.createElement(BT,{ref:u,iconNode:s,className:Wb(`lucide-${IT(t)}`,o),...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 LT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],G0=Ge("ArrowDown",LT);/**
52
- * @license lucide-react v0.474.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const zT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],F0=Ge("ArrowUp",zT);/**
57
- * @license lucide-react v0.474.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const UT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],$T=Ge("Ban",UT);/**
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 PT=[["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"}]],VT=Ge("Brain",PT);/**
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 HT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_i=Ge("Check",HT);/**
72
- * @license lucide-react v0.474.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const qT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Xb=Ge("ChevronDown",qT);/**
77
- * @license lucide-react v0.474.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const GT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qs=Ge("ChevronRight",GT);/**
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 FT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ra=Ge("Circle",FT);/**
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 ZT=[["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"}]],KT=Ge("ClipboardList",ZT);/**
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 YT=[["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"}]],Qb=Ge("Clipboard",YT);/**
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 JT=[["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"}]],WT=Ge("Cog",JT);/**
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 XT=[["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"}]],QT=Ge("Copy",XT);/**
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 e2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],t2=Ge("CornerDownRight",e2);/**
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 n2=[["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"}]],s2=Ge("FilePen",n2);/**
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 a2=[["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"}]],i2=Ge("FileText",a2);/**
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 o2=[["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"}]],r2=Ge("House",o2);/**
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 l2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],qp=Ge("Info",l2);/**
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 c2=[["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"}]],u2=Ge("Key",c2);/**
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 d2=[["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"}]],f2=Ge("Keyboard",d2);/**
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 p2=[["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"}]],m2=Ge("ListChecks",p2);/**
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 h2=[["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"}]],g2=Ge("List",h2);/**
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 v2=[["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"}]],y2=Ge("Loader",v2);/**
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 b2=[["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"}]],_2=Ge("Menu",b2);/**
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 x2=[["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"}]],k2=Ge("MessageSquare",x2);/**
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 S2=[["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"}]],T2=Ge("Monitor",S2);/**
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 w2=[["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"}]],N2=Ge("Palette",w2);/**
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 j2=[["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"}]],C2=Ge("Pause",j2);/**
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 E2=[["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"}]],A2=Ge("Pencil",E2);/**
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 D2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],e_=Ge("Search",D2);/**
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 R2=[["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"}]],M2=Ge("Settings",R2);/**
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 I2=[["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"}]],O2=Ge("SquareCheckBig",I2);/**
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 B2=[["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"}]],Gp=Ge("TriangleAlert",B2);/**
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 L2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],z2=Ge("User",L2);/**
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 U2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ba=Ge("X",U2),Fp=8,it=12,Gt=14,Mt=16,gp={not_started:{color:"var(--text-tertiary)",icon:r.jsx(Ra,{size:it}),label:"Not Started"},working:{color:"var(--accent-green)",icon:r.jsx(Ra,{size:it,fill:"currentColor"}),label:"Working"},paused:{color:"var(--accent-yellow)",icon:r.jsx(C2,{size:it}),label:"Paused"},complete:{color:"var(--accent-green)",icon:r.jsx(_i,{size:it}),label:"Complete"},failed:{color:"var(--accent-red)",icon:r.jsx(Ba,{size:it}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:r.jsx($T,{size:it}),label:"Blocked"}};function Ma(t){return t==="blocked"?gp.blocked:gp[Yr(t)]}const $2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function P2(t){return $2[Yr(t)]??"statusPending"}const V2=["working","paused","failed","not_started","blocked","complete"],Z0=["not_started","working","paused","complete","failed"],H2={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function Yr(t){return t in gp&&t!=="blocked"?t:H2[t]??"not_started"}const q2={not_started:"--text-tertiary",working:"--accent-green",paused:"--accent-yellow",complete:"--accent-green",failed:"--accent-red",pending:"--text-tertiary",assigned:"--text-tertiary",in_progress:"--accent-green",review:"--accent-yellow",done:"--accent-green",waiting_input:"--accent-yellow"},G2="_dagContainer_js4w6_1",F2="_taskNode_js4w6_26",Z2="_taskNodeBorder_js4w6_54",K2="_taskNodeContent_js4w6_60",Y2="_taskNodeHeader_js4w6_70",J2="_taskNodeIcon_js4w6_77",W2="_taskNodeTitle_js4w6_82",X2="_taskNodeBadges_js4w6_90",Q2="_childBadge_js4w6_95",ew="_depBadge_js4w6_107",tw="_handle_js4w6_119",nw="_emptyCta_js4w6_126",sw="_ctaDescription_js4w6_137",aw="_ctaButton_js4w6_144",ln={dagContainer:G2,taskNode:F2,taskNodeBorder:Z2,taskNodeContent:K2,taskNodeHeader:Y2,taskNodeIcon:J2,taskNodeTitle:W2,taskNodeBadges:X2,childBadge:Q2,depBadge:ew,handle:tw,emptyCta:nw,ctaDescription:sw,ctaButton:aw};function iw({data:t}){const{task:s,childCount:i,doneChildCount:o,hasDependencies:c}=t,u=Ma(s.status);return r.jsxs("div",{className:ln.taskNode,"data-task-id":s.id,"data-task-title":s.title,children:[r.jsx(O0,{type:"target",position:B0.Top,className:ln.handle}),r.jsx("div",{className:ln.taskNodeBorder,style:{backgroundColor:u.color}}),r.jsxs("div",{className:ln.taskNodeContent,children:[r.jsxs("div",{className:ln.taskNodeHeader,children:[r.jsx("span",{className:ln.taskNodeIcon,style:{color:u.color},children:u.icon}),r.jsx("span",{className:ln.taskNodeTitle,children:s.title})]}),r.jsxs("div",{className:ln.taskNodeBadges,children:[i>0&&r.jsxs("span",{className:ln.childBadge,children:[o,"/",i]}),c&&r.jsx("span",{className:ln.depBadge,children:"dep"})]})]}),r.jsx(O0,{type:"source",position:B0.Bottom,className:ln.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 K0="popstate";function Y0(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function ow(t={}){function s(o,c){var g;let u=(g=c.state)==null?void 0:g.masked,{pathname:d,search:p,hash:h}=u||o.location;return vp("",{pathname:d,search:p,hash:h},c.state&&c.state.usr||null,c.state&&c.state.key||"default",u?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function i(o,c){return typeof c=="string"?c:$r(c)}return lw(s,i,null,t)}function vt(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function Gn(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function rw(){return Math.random().toString(36).substring(2,10)}function J0(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 vp(t,s,i=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?No(s):s,state:i,key:s&&s.key||o||rw(),unstable_mask:c}}function $r({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 No(t){let s={};if(t){let i=t.indexOf("#");i>=0&&(s.hash=t.substring(i),t=t.substring(0,i));let o=t.indexOf("?");o>=0&&(s.search=t.substring(o),t=t.substring(0,o)),t&&(s.pathname=t)}return s}function lw(t,s,i,o={}){let{window:c=document.defaultView,v5Compat:u=!1}=o,d=c.history,p="POP",h=null,g=v();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function v(){return(d.state||{idx:null}).idx}function y(){p="POP";let N=v(),T=N==null?null:N-g;g=N,h&&h({action:p,location:w.location,delta:T})}function _(N,T){p="PUSH";let C=Y0(N)?N:vp(w.location,N,T);g=v()+1;let E=J0(C,g),R=w.createHref(C.unstable_mask||C);try{d.pushState(E,"",R)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;c.location.assign(R)}u&&h&&h({action:p,location:w.location,delta:1})}function k(N,T){p="REPLACE";let C=Y0(N)?N:vp(w.location,N,T);g=v();let E=J0(C,g),R=w.createHref(C.unstable_mask||C);d.replaceState(E,"",R),u&&h&&h({action:p,location:w.location,delta:0})}function S(N){return cw(N)}let w={get action(){return p},get location(){return t(c,d)},listen(N){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(K0,y),h=N,()=>{c.removeEventListener(K0,y),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:_,replace:k,go(N){return d.go(N)}};return w}function cw(t,s=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),vt(i,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:$r(t);return o=o.replace(/ $/,"%20"),!s&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function t_(t,s,i="/"){return uw(t,s,i,!1)}function uw(t,s,i,o){let c=typeof s=="string"?No(s):s,u=Js(c.pathname||"/",i);if(u==null)return null;let d=n_(t);dw(d);let p=null;for(let h=0;p==null&&h<d.length;++h){let g=a_(u);p=_w(d[h],g,o)}return p}function n_(t,s=[],i=[],o="",c=!1){let u=(d,p,h=c,g)=>{let v={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:p,route:d};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(o)&&h)return;vt(v.relativePath.startsWith(o),`Absolute route path "${v.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(o.length)}let y=ys([o,v.relativePath]),_=i.concat(v);d.children&&d.children.length>0&&(vt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),n_(d.children,s,_,y,h)),!(d.path==null&&!d.index)&&s.push({path:y,score:yw(y,d.index),routesMeta:_})};return t.forEach((d,p)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))u(d,p);else for(let g of s_(d.path))u(d,p,!0,g)}),s}function s_(t){let s=t.split("/");if(s.length===0)return[];let[i,...o]=s,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(o.length===0)return c?[u,""]:[u];let d=s_(o.join("/")),p=[];return p.push(...d.map(h=>h===""?u:[u,h].join("/"))),c&&p.push(...d),p.map(h=>t.startsWith("/")&&h===""?"/":h)}function dw(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:bw(s.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var fw=/^:[\w-]+$/,pw=3,mw=2,hw=1,gw=10,vw=-2,W0=t=>t==="*";function yw(t,s){let i=t.split("/"),o=i.length;return i.some(W0)&&(o+=vw),s&&(o+=mw),i.filter(c=>!W0(c)).reduce((c,u)=>c+(fw.test(u)?pw:u===""?hw:gw),o)}function bw(t,s){return t.length===s.length&&t.slice(0,-1).every((o,c)=>o===s[c])?t[t.length-1]-s[s.length-1]:0}function _w(t,s,i=!1){let{routesMeta:o}=t,c={},u="/",d=[];for(let p=0;p<o.length;++p){let h=o[p],g=p===o.length-1,v=u==="/"?s:s.slice(u.length)||"/",y=Pr({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),_=h.route;if(!y&&g&&i&&!o[o.length-1].route.index&&(y=Pr({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!y)return null;Object.assign(c,y.params),d.push({params:c,pathname:ys([u,y.pathname]),pathnameBase:ww(ys([u,y.pathnameBase])),route:_}),y.pathnameBase!=="/"&&(u=ys([u,y.pathnameBase]))}return d}function Pr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,o]=xw(t.path,t.caseSensitive,t.end),c=s.match(i);if(!c)return null;let u=c[0],d=u.replace(/(.)\/+$/,"$1"),p=c.slice(1);return{params:o.reduce((g,{paramName:v,isOptional:y},_)=>{if(v==="*"){let S=p[_]||"";d=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[_];return y&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:d,pattern:t}}function xw(t,s=!1,i=!0){Gn(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 o=[],c="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,p,h,g,v)=>{if(o.push({paramName:p,isOptional:h!=null}),h){let y=v.charAt(g+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(o.push({paramName:"*"}),c+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":t!==""&&t!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,s?void 0:"i"),o]}function a_(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return Gn(!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 Js(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let i=s.endsWith("/")?s.length-1:s.length,o=t.charAt(i);return o&&o!=="/"?null:t.slice(i)||"/"}var kw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Sw(t,s="/"){let{pathname:i,search:o="",hash:c=""}=typeof t=="string"?No(t):t,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=X0(i.substring(1),"/"):u=X0(i,s)):u=s,{pathname:u,search:Nw(o),hash:jw(c)}}function X0(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 Cf(t,s,i,o){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(o)}]. 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 Tw(t){return t.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function Zp(t){let s=Tw(t);return s.map((i,o)=>o===s.length-1?i.pathname:i.pathnameBase)}function su(t,s,i,o=!1){let c;typeof t=="string"?c=No(t):(c={...t},vt(!c.pathname||!c.pathname.includes("?"),Cf("?","pathname","search",c)),vt(!c.pathname||!c.pathname.includes("#"),Cf("#","pathname","hash",c)),vt(!c.search||!c.search.includes("#"),Cf("#","search","hash",c)));let u=t===""||c.pathname==="",d=u?"/":c.pathname,p;if(d==null)p=i;else{let y=s.length-1;if(!o&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),y-=1;c.pathname=_.join("/")}p=y>=0?s[y]:"/"}let h=Sw(c,p),g=d&&d!=="/"&&d.endsWith("/"),v=(u||d===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(g||v)&&(h.pathname+="/"),h}var ys=t=>t.join("/").replace(/\/\/+/g,"/"),ww=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),Nw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,jw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Cw=class{constructor(t,s,i,o=!1){this.status=t,this.statusText=s||"",this.internal=o,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function Ew(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Aw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var i_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function o_(t,s){let i=t;if(typeof i!="string"||!kw.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,c=!1;if(i_)try{let u=new URL(window.location.href),d=i.startsWith("//")?new URL(u.protocol+i):new URL(i),p=Js(d.pathname,s);d.origin===u.origin&&p!=null?i=p+d.search+d.hash:c=!0}catch{Gn(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var r_=["POST","PUT","PATCH","DELETE"];new Set(r_);var Dw=["GET",...r_];new Set(Dw);var jo=b.createContext(null);jo.displayName="DataRouter";var au=b.createContext(null);au.displayName="DataRouterState";var Rw=b.createContext(!1),l_=b.createContext({isTransitioning:!1});l_.displayName="ViewTransition";var Mw=b.createContext(new Map);Mw.displayName="Fetchers";var Iw=b.createContext(null);Iw.displayName="Await";var En=b.createContext(null);En.displayName="Navigation";var Jr=b.createContext(null);Jr.displayName="Location";var Fn=b.createContext({outlet:null,matches:[],isDataRoute:!1});Fn.displayName="Route";var Kp=b.createContext(null);Kp.displayName="RouteError";var c_="REACT_ROUTER_ERROR",Ow="REDIRECT",Bw="ROUTE_ERROR_RESPONSE";function Lw(t){if(t.startsWith(`${c_}:${Ow}:{`))try{let s=JSON.parse(t.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function zw(t){if(t.startsWith(`${c_}:${Bw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Cw(s.status,s.statusText,s.data)}catch{}}function Uw(t,{relative:s}={}){vt(xi(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=b.useContext(En),{hash:c,pathname:u,search:d}=Wr(t,{relative:s}),p=u;return i!=="/"&&(p=u==="/"?i:ys([i,u])),o.createHref({pathname:p,search:d,hash:c})}function xi(){return b.useContext(Jr)!=null}function Pt(){return vt(xi(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Jr).location}function Nt(t){vt(xi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Pt();return b.useMemo(()=>Pr(t,a_(s)),[s,t])}var u_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function d_(t){b.useContext(En).static||b.useLayoutEffect(t)}function iu(){let{isDataRoute:t}=b.useContext(Fn);return t?eN():$w()}function $w(){vt(xi(),"useNavigate() may be used only in the context of a <Router> component.");let t=b.useContext(jo),{basename:s,navigator:i}=b.useContext(En),{matches:o}=b.useContext(Fn),{pathname:c}=Pt(),u=JSON.stringify(Zp(o)),d=b.useRef(!1);return d_(()=>{d.current=!0}),b.useCallback((h,g={})=>{if(Gn(d.current,u_),!d.current)return;if(typeof h=="number"){i.go(h);return}let v=su(h,JSON.parse(u),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,u,c,t])}var Pw=b.createContext(null);function Vw(t){let s=b.useContext(Fn).outlet;return b.useMemo(()=>s&&b.createElement(Pw.Provider,{value:t},s),[s,t])}function ls(){let{matches:t}=b.useContext(Fn),s=t[t.length-1];return s?s.params:{}}function Wr(t,{relative:s}={}){let{matches:i}=b.useContext(Fn),{pathname:o}=Pt(),c=JSON.stringify(Zp(i));return b.useMemo(()=>su(t,JSON.parse(c),o,s==="path"),[t,c,o,s])}function Hw(t,s){return f_(t,s)}function f_(t,s,i){var N;vt(xi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=b.useContext(En),{matches:c}=b.useContext(Fn),u=c[c.length-1],d=u?u.params:{},p=u?u.pathname:"/",h=u?u.pathnameBase:"/",g=u&&u.route;{let T=g&&g.path||"";m_(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=Pt(),y;if(s){let T=typeof s=="string"?No(s):s;vt(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.`),y=T}else y=v;let _=y.pathname||"/",k=_;if(h!=="/"){let T=h.replace(/^\//,"").split("/");k="/"+_.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=t_(t,{pathname:k});Gn(g||S!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Gn(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 "${y.pathname}${y.search}${y.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=Kw(S&&S.map(T=>Object.assign({},T,{params:Object.assign({},d,T.params),pathname:ys([h,o.encodeLocation?o.encodeLocation(T.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?h:ys([h,o.encodeLocation?o.encodeLocation(T.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,i);return s&&w?b.createElement(Jr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...y},navigationType:"POP"}},w):w}function qw(){let t=Qw(),s=Ew(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),i=t instanceof Error?t.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},u={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",t),d=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:u},"ErrorBoundary")," or"," ",b.createElement("code",{style:u},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},s),i?b.createElement("pre",{style:c},i):null,d)}var Gw=b.createElement(qw,null),p_=class extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const i=zw(t.digest);i&&(t=i)}let s=t!==void 0?b.createElement(Fn.Provider,{value:this.props.routeContext},b.createElement(Kp.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?b.createElement(Fw,{error:t},s):s}};p_.contextType=Rw;var Ef=new WeakMap;function Fw({children:t,error:s}){let{basename:i}=b.useContext(En);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let o=Lw(s.digest);if(o){let c=Ef.get(s);if(c)throw c;let u=o_(o.location,i);if(i_&&!Ef.get(s))if(u.isExternal||o.reloadDocument)window.location.href=u.absoluteURL||u.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:o.replace}));throw Ef.set(s,d),d}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function Zw({routeContext:t,match:s,children:i}){let o=b.useContext(jo);return o&&o.static&&o.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=s.route.id),b.createElement(Fn.Provider,{value:t},i)}function Kw(t,s=[],i){let o=i==null?void 0:i.state;if(t==null){if(!o)return null;if(o.errors)t=o.matches;else if(s.length===0&&!o.initialized&&o.matches.length>0)t=o.matches;else return null}let c=t,u=o==null?void 0:o.errors;if(u!=null){let v=c.findIndex(y=>y.route.id&&(u==null?void 0:u[y.route.id])!==void 0);vt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let d=!1,p=-1;if(i&&o){d=o.renderFallback;for(let v=0;v<c.length;v++){let y=c[v];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(p=v),y.route.id){let{loaderData:_,errors:k}=o,S=y.route.loader&&!_.hasOwnProperty(y.route.id)&&(!k||k[y.route.id]===void 0);if(y.route.lazy||S){i.isStatic&&(d=!0),p>=0?c=c.slice(0,p+1):c=[c[0]];break}}}}let h=i==null?void 0:i.onError,g=o&&h?(v,y)=>{var _,k;h(v,{location:o.location,params:((k=(_=o.matches)==null?void 0:_[0])==null?void 0:k.params)??{},unstable_pattern:Aw(o.matches),errorInfo:y})}:void 0;return c.reduceRight((v,y,_)=>{let k,S=!1,w=null,N=null;o&&(k=u&&y.route.id?u[y.route.id]:void 0,w=y.route.errorElement||Gw,d&&(p<0&&_===0?(m_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,N=null):p===_&&(S=!0,N=y.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,_+1)),C=()=>{let E;return k?E=w:S?E=N:y.route.Component?E=b.createElement(y.route.Component,null):y.route.element?E=y.route.element:E=v,b.createElement(Zw,{match:y,routeContext:{outlet:v,matches:T,isDataRoute:o!=null},children:E})};return o&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?b.createElement(p_,{location:o.location,revalidation:o.revalidation,component:w,error:k,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function Yp(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yw(t){let s=b.useContext(jo);return vt(s,Yp(t)),s}function Jw(t){let s=b.useContext(au);return vt(s,Yp(t)),s}function Ww(t){let s=b.useContext(Fn);return vt(s,Yp(t)),s}function Jp(t){let s=Ww(t),i=s.matches[s.matches.length-1];return vt(i.route.id,`${t} can only be used on routes that contain a unique "id"`),i.route.id}function Xw(){return Jp("useRouteId")}function Qw(){var o;let t=b.useContext(Kp),s=Jw("useRouteError"),i=Jp("useRouteError");return t!==void 0?t:(o=s.errors)==null?void 0:o[i]}function eN(){let{router:t}=Yw("useNavigate"),s=Jp("useNavigate"),i=b.useRef(!1);return d_(()=>{i.current=!0}),b.useCallback(async(c,u={})=>{Gn(i.current,u_),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...u}))},[t,s])}var Q0={};function m_(t,s,i){!s&&!Q0[t]&&(Q0[t]=!0,Gn(!1,i))}b.memo(tN);function tN({routes:t,future:s,state:i,isStatic:o,onError:c}){return f_(t,void 0,{state:i,isStatic:o,onError:c})}function is({to:t,replace:s,state:i,relative:o}){vt(xi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=b.useContext(En);Gn(!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:u}=b.useContext(Fn),{pathname:d}=Pt(),p=iu(),h=su(t,Zp(u),d,o==="path"),g=JSON.stringify(h);return b.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:o})},[p,g,o,s,i]),null}function La(t){return Vw(t.context)}function Se(t){vt(!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 nN({basename:t="/",children:s=null,location:i,navigationType:o="POP",navigator:c,static:u=!1,unstable_useTransitions:d}){vt(!xi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=t.replace(/^\/*/,"/"),h=b.useMemo(()=>({basename:p,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[p,c,u,d]);typeof i=="string"&&(i=No(i));let{pathname:g="/",search:v="",hash:y="",state:_=null,key:k="default",unstable_mask:S}=i,w=b.useMemo(()=>{let N=Js(g,p);return N==null?null:{location:{pathname:N,search:v,hash:y,state:_,key:k,unstable_mask:S},navigationType:o}},[p,g,v,y,_,k,o,S]);return Gn(w!=null,`<Router basename="${p}"> is not able to match the URL "${g}${v}${y}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:b.createElement(En.Provider,{value:h},b.createElement(Jr.Provider,{children:s,value:w}))}function sN({children:t,location:s}){return Hw(yp(t),s)}function yp(t,s=[]){let i=[];return b.Children.forEach(t,(o,c)=>{if(!b.isValidElement(o))return;let u=[...s,c];if(o.type===b.Fragment){i.push.apply(i,yp(o.props.children,u));return}vt(o.type===Se,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),vt(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||u.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=yp(o.props.children,u)),i.push(d)}),i}var Oc="get",Bc="application/x-www-form-urlencoded";function ou(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function aN(t){return ou(t)&&t.tagName.toLowerCase()==="button"}function iN(t){return ou(t)&&t.tagName.toLowerCase()==="form"}function oN(t){return ou(t)&&t.tagName.toLowerCase()==="input"}function rN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function lN(t,s){return t.button===0&&(!s||s==="_self")&&!rN(t)}function bp(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((s,i)=>{let o=t[i];return s.concat(Array.isArray(o)?o.map(c=>[i,c]):[[i,o]])},[]))}function cN(t,s){let i=bp(t);return s&&s.forEach((o,c)=>{i.has(c)||s.getAll(c).forEach(u=>{i.append(c,u)})}),i}var xc=null;function uN(){if(xc===null)try{new FormData(document.createElement("form"),0),xc=!1}catch{xc=!0}return xc}var dN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Af(t){return t!=null&&!dN.has(t)?(Gn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bc}"`),null):t}function fN(t,s){let i,o,c,u,d;if(iN(t)){let p=t.getAttribute("action");o=p?Js(p,s):null,i=t.getAttribute("method")||Oc,c=Af(t.getAttribute("enctype"))||Bc,u=new FormData(t)}else if(aN(t)||oN(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(o=h?Js(h,s):null,i=t.getAttribute("formmethod")||p.getAttribute("method")||Oc,c=Af(t.getAttribute("formenctype"))||Af(p.getAttribute("enctype"))||Bc,u=new FormData(p,t),!uN()){let{name:g,type:v,value:y}=t;if(v==="image"){let _=g?`${g}.`:"";u.append(`${_}x`,"0"),u.append(`${_}y`,"0")}else g&&u.append(g,y)}}else{if(ou(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Oc,o=null,c=Bc,d=t}return u&&c==="text/plain"&&(d=u,u=void 0),{action:o,method:i.toLowerCase(),encType:c,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Wp(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function pN(t,s,i,o){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}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:s&&Js(c.pathname,s)==="/"?c.pathname=`${s.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function mN(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 hN(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 gN(t,s,i){let o=await Promise.all(t.map(async c=>{let u=s.routes[c.route.id];if(u){let d=await mN(u,i);return d.links?d.links():[]}return[]}));return _N(o.flat(1).filter(hN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function ey(t,s,i,o,c,u){let d=(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 u==="assets"?s.filter((h,g)=>d(h,g)||p(h,g)):u==="data"?s.filter((h,g)=>{var y;let v=o.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(d(h,g)||p(h,g))return!0;if(h.route.shouldRevalidate){let _=h.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:((y=i[0])==null?void 0:y.params)||{},nextUrl:new URL(t,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function vN(t,s,{includeHydrateFallback:i}={}){return yN(t.map(o=>{let c=s.routes[o.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function yN(t){return[...new Set(t)]}function bN(t){let s={},i=Object.keys(t).sort();for(let o of i)s[o]=t[o];return s}function _N(t,s){let i=new Set;return new Set(s),t.reduce((o,c)=>{let u=JSON.stringify(bN(c));return i.has(u)||(i.add(u),o.push({key:u,link:c})),o},[])}function h_(){let t=b.useContext(jo);return Wp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function xN(){let t=b.useContext(au);return Wp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Xp=b.createContext(void 0);Xp.displayName="FrameworkContext";function g_(){let t=b.useContext(Xp);return Wp(t,"You must render this element inside a <HydratedRouter> element"),t}function kN(t,s){let i=b.useContext(Xp),[o,c]=b.useState(!1),[u,d]=b.useState(!1),{onFocus:p,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:y}=s,_=b.useRef(null);b.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let w=T=>{T.forEach(C=>{d(C.isIntersecting)})},N=new IntersectionObserver(w,{threshold:.5});return _.current&&N.observe(_.current),()=>{N.disconnect()}}},[t]),b.useEffect(()=>{if(o){let w=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(w)}}},[o]);let k=()=>{c(!0)},S=()=>{c(!1),d(!1)};return i?t!=="intent"?[u,_,{}]:[u,_,{onFocus:kr(p,k),onBlur:kr(h,S),onMouseEnter:kr(g,k),onMouseLeave:kr(v,S),onTouchStart:kr(y,k)}]:[!1,_,{}]}function kr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function SN({page:t,...s}){let{router:i}=h_(),o=b.useMemo(()=>t_(i.routes,t,i.basename),[i.routes,t,i.basename]);return o?b.createElement(wN,{page:t,matches:o,...s}):null}function TN(t){let{manifest:s,routeModules:i}=g_(),[o,c]=b.useState([]);return b.useEffect(()=>{let u=!1;return gN(t,s,i).then(d=>{u||c(d)}),()=>{u=!0}},[t,s,i]),o}function wN({page:t,matches:s,...i}){let o=Pt(),{future:c,manifest:u,routeModules:d}=g_(),{basename:p}=h_(),{loaderData:h,matches:g}=xN(),v=b.useMemo(()=>ey(t,s,g,u,o,"data"),[t,s,g,u,o]),y=b.useMemo(()=>ey(t,s,g,u,o,"assets"),[t,s,g,u,o]),_=b.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let w=new Set,N=!1;if(s.forEach(C=>{var R;let E=u.routes[C.route.id];!E||!E.hasLoader||(!v.some(D=>D.route.id===C.route.id)&&C.route.id in h&&((R=d[C.route.id])!=null&&R.shouldRevalidate)||E.hasClientLoader?N=!0:w.add(C.route.id))}),w.size===0)return[];let T=pN(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,o,u,v,s,t,d]),k=b.useMemo(()=>vN(y,u),[y,u]),S=TN(y);return b.createElement(b.Fragment,null,_.map(w=>b.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),k.map(w=>b.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),S.map(({key:w,link:N})=>b.createElement("link",{key:w,nonce:i.nonce,...N,crossOrigin:N.crossOrigin??i.crossOrigin})))}function NN(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var jN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jN&&(window.__reactRouterVersion="7.13.2")}catch{}function CN({basename:t,children:s,unstable_useTransitions:i,window:o}){let c=b.useRef();c.current==null&&(c.current=ow({window:o,v5Compat:!0}));let u=c.current,[d,p]=b.useState({action:u.action,location:u.location}),h=b.useCallback(g=>{i===!1?p(g):b.startTransition(()=>p(g))},[i]);return b.useLayoutEffect(()=>u.listen(h),[u,h]),b.createElement(nN,{basename:t,children:s,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var v_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qp=b.forwardRef(function({onClick:s,discover:i="render",prefetch:o="none",relative:c,reloadDocument:u,replace:d,unstable_mask:p,state:h,target:g,to:v,preventScrollReset:y,viewTransition:_,unstable_defaultShouldRevalidate:k,...S},w){let{basename:N,navigator:T,unstable_useTransitions:C}=b.useContext(En),E=typeof v=="string"&&v_.test(v),R=o_(v,N);v=R.to;let D=Uw(v,{relative:c}),A=Pt(),q=null;if(p){let ee=su(p,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);N!=="/"&&(ee.pathname=ee.pathname==="/"?N:ys([N,ee.pathname])),q=T.createHref(ee)}let[$,Y,G]=kN(o,S),Q=RN(v,{replace:d,unstable_mask:p,state:h,target:g,preventScrollReset:y,relative:c,viewTransition:_,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function ae(ee){s&&s(ee),ee.defaultPrevented||Q(ee)}let me=!(R.isExternal||u),ie=b.createElement("a",{...S,...G,href:(me?q:void 0)||R.absoluteURL||D,onClick:me?ae:s,ref:NN(w,Y),target:g,"data-discover":!E&&i==="render"?"true":void 0});return $&&!E?b.createElement(b.Fragment,null,ie,b.createElement(SN,{page:D})):ie});Qp.displayName="Link";var EN=b.forwardRef(function({"aria-current":s="page",caseSensitive:i=!1,className:o="",end:c=!1,style:u,to:d,viewTransition:p,children:h,...g},v){let y=Wr(d,{relative:g.relative}),_=Pt(),k=b.useContext(au),{navigator:S,basename:w}=b.useContext(En),N=k!=null&&LN(y)&&p===!0,T=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,C=_.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;i||(C=C.toLowerCase(),E=E?E.toLowerCase():null,T=T.toLowerCase()),E&&w&&(E=Js(E,w)||E);const R=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let D=C===T||!c&&C.startsWith(T)&&C.charAt(R)==="/",A=E!=null&&(E===T||!c&&E.startsWith(T)&&E.charAt(T.length)==="/"),q={isActive:D,isPending:A,isTransitioning:N},$=D?s:void 0,Y;typeof o=="function"?Y=o(q):Y=[o,D?"active":null,A?"pending":null,N?"transitioning":null].filter(Boolean).join(" ");let G=typeof u=="function"?u(q):u;return b.createElement(Qp,{...g,"aria-current":$,className:Y,ref:v,style:G,to:d,viewTransition:p},typeof h=="function"?h(q):h)});EN.displayName="NavLink";var AN=b.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:o,replace:c,state:u,method:d=Oc,action:p,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:_,...k},S)=>{let{unstable_useTransitions:w}=b.useContext(En),N=ON(),T=BN(p,{relative:g}),C=d.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&v_.test(p),R=D=>{if(h&&h(D),D.defaultPrevented)return;D.preventDefault();let A=D.nativeEvent.submitter,q=(A==null?void 0:A.getAttribute("formmethod"))||d,$=()=>N(A||D.currentTarget,{fetcherKey:s,method:q,navigate:i,replace:c,state:u,relative:g,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:_});w&&i!==!1?b.startTransition(()=>$()):$()};return b.createElement("form",{ref:S,method:C,action:T,onSubmit:o?h:R,...k,"data-discover":!E&&t==="render"?"true":void 0})});AN.displayName="Form";function DN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function y_(t){let s=b.useContext(jo);return vt(s,DN(t)),s}function RN(t,{target:s,replace:i,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:p,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=iu(),y=Pt(),_=Wr(t,{relative:d});return b.useCallback(k=>{if(lN(k,s)){k.preventDefault();let S=i!==void 0?i:$r(y)===$r(_),w=()=>v(t,{replace:S,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:p,unstable_defaultShouldRevalidate:h});g?b.startTransition(()=>w()):w()}},[y,v,_,i,o,c,s,t,u,d,p,h,g])}function em(t){Gn(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=b.useRef(bp(t)),i=b.useRef(!1),o=Pt(),c=b.useMemo(()=>cN(o.search,i.current?null:s.current),[o.search]),u=iu(),d=b.useCallback((p,h)=>{const g=bp(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,u("?"+g,h)},[u,c]);return[c,d]}var MN=0,IN=()=>`__${String(++MN)}__`;function ON(){let{router:t}=y_("useSubmit"),{basename:s}=b.useContext(En),i=Xw(),o=t.fetch,c=t.navigate;return b.useCallback(async(u,d={})=>{let{action:p,method:h,encType:g,formData:v,body:y}=fN(u,s);if(d.navigate===!1){let _=d.fetcherKey||IN();await o(_,i,d.action||p,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:y,formMethod:d.method||h,formEncType:d.encType||g,flushSync:d.flushSync})}else await c(d.action||p,{unstable_defaultShouldRevalidate:d.unstable_defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:v,body:y,formMethod:d.method||h,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:i,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,c,s,i])}function BN(t,{relative:s}={}){let{basename:i}=b.useContext(En),o=b.useContext(Fn);vt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Wr(t||".",{relative:s})},d=Pt();if(t==null){u.search=d.search;let p=new URLSearchParams(u.search),h=p.getAll("index");if(h.some(v=>v==="")){p.delete("index"),h.filter(y=>y).forEach(y=>p.append("index",y));let v=p.toString();u.search=v?`?${v}`:""}}return(!t||t===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:ys([i,u.pathname])),$r(u)}function LN(t,{relative:s}={}){let i=b.useContext(l_);vt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=y_("useViewTransitionState"),c=Wr(t,{relative:s});if(!i.isTransitioning)return!1;let u=Js(i.currentLocation.pathname,o)||i.currentLocation.pathname,d=Js(i.nextLocation.pathname,o)||i.nextLocation.pathname;return Pr(c.pathname,d)!=null||Pr(c.pathname,u)!=null}function bt(){const t=iu();return b.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function tm(t){return`/sessions/${encodeURIComponent(t)}`}function gi(t,s){return s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}`:`/workspaces/${encodeURIComponent(t)}`}function rs(t,s,i,o){const c=encodeURIComponent(t);let u;return i&&o?u=`/environments/${encodeURIComponent(o)}/workspaces/${encodeURIComponent(i)}/tasks/${c}`:i?u=`/workspaces/${encodeURIComponent(i)}/tasks/${c}`:u=`/tasks/${c}`,s?`${u}/${s}`:u}function ki(t,s,i){const o=new URLSearchParams;t&&o.set("workspace",t),s&&o.set("parent",s);const c=o.toString();if(t&&i){const u=`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(t)}/tasks/new`;return s?`${u}?parent=${encodeURIComponent(s)}`:u}return c?`/tasks/new?${c}`:"/tasks/new"}function b_(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const xo="/environments",zN="/environments/new";function vi(t){return`/environments/${encodeURIComponent(t)}`}function UN(t){return`/environments/${encodeURIComponent(t)}/edit`}const _o="/settings",$N="/settings/credentials",Df="/settings/personas",PN="/settings/personas/new";function __(t){return`/settings/personas/${encodeURIComponent(t)}`}const VN="/settings/shortcuts",HN="/pair",qN="/chat",yi="/",GN="/tasks",x_="/workspaces/new",k_="/knowledge",ru="/findings";function FN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:ru}function _p(t,s,i){const o=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${o}`:`/findings/${o}`}const ZN=q2,KN={task:iw};function YN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:o}){const c=bt(),u=b.useMemo(()=>i.filter(y=>y.workspaceId===t),[i,t]),{nodes:d,edges:p}=MT(u),h=b.useMemo(()=>{const y=getComputedStyle(document.documentElement),_={};for(const[k,S]of Object.entries(ZN))_[k]=y.getPropertyValue(S).trim()||"#6b7a8d";return _},[o]),g=b.useCallback((y,_)=>{c(rs(_.id,void 0,t,s))},[c,t,s]),v=b.useCallback(y=>{const _=y.data;return h[_.task.status]||h.pending},[h]);return u.length===0?r.jsxs("div",{className:ln.emptyCta,children:[r.jsx("button",{className:ln.ctaButton,onClick:()=>c(ki(t,void 0,s)),children:"Create Task"}),r.jsx("div",{className:ln.ctaDescription,children:"Create tasks to see the dependency graph"})]}):r.jsx("div",{className:ln.dagContainer,children:r.jsxs(HS,{nodes:d,edges:p,nodeTypes:KN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[r.jsx(qS,{variant:GS.Dots,gap:24,size:1,color:"var(--text-disabled)"}),r.jsx(FS,{showInteractive:!1}),r.jsx(ZS,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const JN="_breadcrumbs_17or2_1",WN="_list_17or2_11",XN="_item_17or2_21",QN="_separator_17or2_28",ej="_link_17or2_34",tj="_current_17or2_57",uo={breadcrumbs:JN,list:WN,item:XN,separator:QN,link:ej,current:tj};function xs({segments:t}){return r.jsx("nav",{className:uo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:r.jsx("ol",{className:uo.list,children:t.map((s,i)=>{const o=i===t.length-1;return r.jsxs("li",{className:uo.item,children:[i>0&&r.jsx("span",{className:uo.separator,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),s.url&&!o?r.jsx(Qp,{className:uo.link,to:s.url,title:s.label,children:s.label}):r.jsx("span",{className:uo.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const nj="_btn_dwk2o_1",sj="_sm_dwk2o_22",aj="_md_dwk2o_28",ij="_lg_dwk2o_34",oj="_primary_dwk2o_40",rj="_danger_dwk2o_55",lj="_outline_dwk2o_70",cj="_ghost_dwk2o_80",Rf={btn:nj,sm:sj,md:aj,lg:ij,primary:oj,danger:rj,outline:lj,ghost:cj},Fs=b.forwardRef(function({variant:s="primary",size:i="md",className:o,children:c,...u},d){const p=[Rf.btn,Rf[s],Rf[i],o].filter(Boolean).join(" ");return r.jsx("button",{ref:d,className:p,...u,children:c})}),uj="_copyButton_1bqk0_1",dj={copyButton:uj},fj=2e3;function pj({text:t,className:s,"data-testid":i}){const[o,c]=b.useState(!1),u=b.useRef(void 0);b.useEffect(()=>()=>{u.current!==void 0&&clearTimeout(u.current)},[]);const d=b.useCallback(async()=>{try{await navigator.clipboard.writeText(t),c(!0),u.current!==void 0&&clearTimeout(u.current),u.current=setTimeout(()=>{c(!1),u.current=void 0},fj)}catch{}},[t]);return r.jsx("button",{type:"button",className:`${dj.copyButton} ${s??""}`,onClick:()=>{d().catch(()=>{})},"aria-label":o?"Copied":"Copy to clipboard","data-testid":i??"copy-button",children:o?r.jsx(_i,{size:Gt,"aria-hidden":"true"}):r.jsx(Qb,{size:Gt,"aria-hidden":"true"})})}const mj="_banner_bxqlh_1",hj="_label_bxqlh_15",gj="_text_bxqlh_25",vj="_link_bxqlh_29",kc={banner:mj,label:hj,text:gj,link:vj};function yj(){return r.jsxs("div",{className:kc.banner,"data-testid":"demo-banner",children:[r.jsx("span",{className:kc.label,children:"DEMO"}),r.jsxs("span",{className:kc.text,children:["This is an interactive demo with mock data."," ",r.jsx("a",{href:"https://github.com/nick-pape/grackle",target:"_blank",rel:"noopener noreferrer",className:kc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const bj="_container_og0yp_1",_j="_chevronButton_og0yp_6",xj="_mainButton_og0yp_6",kj="_sm_og0yp_34",Sj="_md_og0yp_34",Tj="_lg_og0yp_34",wj="_primary_og0yp_57",Nj="_danger_og0yp_70",jj="_outline_og0yp_83",Cj="_ghost_og0yp_92",Ej="_dropdown_og0yp_100",Aj="_option_og0yp_113",Dj="_optionLabel_og0yp_130",Rj="_optionDesc_og0yp_135",Vs={container:bj,chevronButton:_j,mainButton:xj,sm:kj,md:Sj,lg:Tj,primary:wj,danger:Nj,outline:jj,ghost:Cj,dropdown:Ej,option:Aj,optionLabel:Dj,optionDesc:Rj};function S_({label:t,onClick:s,options:i,variant:o="primary",size:c="md","data-testid":u}){const[d,p]=b.useState(!1),h=b.useRef(null);b.useEffect(()=>{if(!d)return;function _(k){h.current&&k.target instanceof Node&&!h.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[d]),b.useEffect(()=>{if(!d)return;function _(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[d]);const g=Vs[o]||"",v=Vs[c]||"",y=()=>{d&&p(!1),s()};return r.jsxs("div",{ref:h,className:Vs.container,"data-testid":u,children:[r.jsx("button",{type:"button",className:`${Vs.mainButton} ${g} ${v}`,onClick:y,"data-testid":u?`${u}-main`:void 0,children:t}),r.jsx("button",{type:"button",className:`${Vs.chevronButton} ${g} ${v}`,onClick:()=>p(_=>!_),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":d,"data-testid":u?`${u}-chevron`:void 0,children:r.jsx(Xb,{size:Gt,"aria-hidden":"true"})}),d&&r.jsx("div",{className:Vs.dropdown,"data-testid":u?`${u}-menu`:void 0,children:i.map((_,k)=>r.jsxs("button",{type:"button",className:Vs.option,onClick:()=>{_.onClick(),p(!1)},children:[r.jsx("span",{className:Vs.optionLabel,children:_.label}),_.description&&r.jsx("span",{className:Vs.optionDesc,children:_.description})]},k))})]})}function xp(){xp=function(c,u){return new i(c,void 0,u)};var t=RegExp.prototype,s=new WeakMap;function i(c,u,d){var p=new RegExp(c,u);return s.set(p,d||s.get(c)),Hc(p,i.prototype)}function o(c,u){var d=s.get(u);return Object.keys(d).reduce(function(p,h){var g=d[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,u){if(typeof u!="function"&&u!==null)throw new TypeError("Super expression must either be null or a function");c.prototype=Object.create(u&&u.prototype,{constructor:{value:c,writable:!0,configurable:!0}}),Object.defineProperty(c,"prototype",{writable:!1}),u&&Hc(c,u)})(i,RegExp),i.prototype.exec=function(c){var u=t.exec.call(this,c);if(u){u.groups=o(u,this);var d=u.indices;d&&(d.groups=o(d,this))}return u},i.prototype[Symbol.replace]=function(c,u){if(typeof u=="string"){var d=s.get(this);return t[Symbol.replace].call(this,c,u.replace(/\$<([^>]+)>/g,function(h,g){var v=d[g];return"$"+(Array.isArray(v)?v.join("$"):v)}))}if(typeof u=="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(o(h,p)),u.apply(this,h)})}return t[Symbol.replace].call(this,c,u)},xp.apply(this,arguments)}function Hc(t,s){return Hc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},Hc(t,s)}function ty(t,s){(s==null||s>t.length)&&(s=t.length);for(var i=0,o=new Array(s);i<s;i++)o[i]=t[i];return o}function Mf(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,u){if(c){if(typeof c=="string")return ty(c,u);var d=Object.prototype.toString.call(c).slice(8,-1);return d==="Object"&&c.constructor&&(d=c.constructor.name),d==="Map"||d==="Set"?Array.from(c):d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d)?ty(c,u):void 0}})(t))||s){i&&(t=i);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}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 Mj=(function(t){return function(s){return s===void 0&&(s={}),(function(o,c){if(c&&!o.registered(c))throw new Error('The default language "'+c+'" is not registered with refractor.')})(t,s.defaultLanguage),function(o){oT(o,"element",i)};function i(o,c,u){var d,p;if(u&&u.tagName==="pre"&&o.tagName==="code"){var h=(o==null||(d=o.data)==null?void 0:d.meta)||(o==null||(p=o.properties)==null?void 0:p.metastring)||"";o.properties.className?typeof o.properties.className=="boolean"?o.properties.className=[]:Array.isArray(o.properties.className)||(o.properties.className=[o.properties.className]):o.properties.className=[];var g,v,y=(function(D){for(var A,q=Mf(D.properties.className);!(A=q()).done;){var $=A.value;if($.slice(0,9)==="language-")return $.slice(9).toLowerCase()}return null})(o);if(!y&&s.defaultLanguage&&o.properties.className.push("language-"+(y=s.defaultLanguage)),o.properties.className.push("code-highlight"),y)try{var _,k;k=(_=y)!=null&&_.includes("diff-")?y.split("-")[1]:y,g=t.highlight(_c(o),k),u.properties.className=(u.properties.className||[]).concat("language-"+k)}catch(D){if(!s.ignoreMissing||!/Unknown language/.test(D.message))throw D;g=o}else g=o;g.children=(v=1,function D(A){return A.reduce(function(q,$){if($.type==="text"){var Y=$.value,G=(Y.match(/\n/g)||"").length;if(G===0)$.position={start:{line:v,column:1},end:{line:v,column:1}},q.push($);else for(var Q,ae=Y.split(`
229
- `),me=Mf(ae.entries());!(Q=me()).done;){var ie=Q.value,ee=ie[0],B=ie[1];q.push({type:"text",value:ee===ae.length-1?B:B+`
230
- `,position:{start:{line:v+ee,column:1},end:{line:v+ee,column:1}}})}return v+=G,q}if(Object.prototype.hasOwnProperty.call($,"children")){var Z=v;return $.children=D($.children),q.push($),$.position={start:{line:Z,column:1},end:{line:v,column:1}},q}return q.push($),q},[])})(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(D){var A=/{([\d,-]+)}/,q=D.split(",").map(function(G){return G.trim()}).join();if(A.test(q)){var $=A.exec(q)[1],Y=lT($);return function(G){return Y.includes(G+1)}}return function(){return!1}})(h),N=(function(D){var A=xp(/showLineNumbers=(\d+)/i,{lines:1});if(A.test(D)){var q=A.exec(D);return Number(q.groups.lines)}return 1})(h),T=(function(D){for(var A=new Array(D),q=0;q<D;q++)A[q]={type:"element",tagName:"span",properties:{className:[]},children:[]};return A})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],E=function(){var D,A,q=S.value,$=q[0],Y=q[1];Y.properties.className=["code-line"];var G=cT(g,function(Q){return Q.position.start.line<=$+1&&Q.position.end.line>=$+1});Y.children=G.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(y))&&!C.some(function(Q){return h.toLowerCase().includes(Q)})&&(Y.properties.line=[($+N).toString()],Y.properties.className.push("line-number")),w($)&&Y.properties.className.push("highlight-line"),(y==="diff"||(D=y)!=null&&D.includes("diff-"))&&_c(Y).substring(0,1)==="-"?Y.properties.className.push("deleted"):(y==="diff"||(A=y)!=null&&A.includes("diff-"))&&_c(Y).substring(0,1)==="+"&&Y.properties.className.push("inserted")},R=Mf(T.entries());!(S=R()).done;)E();T.length>0&&_c(T[T.length-1]).trim()===""&&T.pop(),o.children=T}}}})(rT);function T_(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 ko(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const ny=new Set(["grackle"]);function Co(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const o=t.slice(5,i);if(ny.has(o))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(ny.has(i))return t.slice(s+1)}return t}const Ij={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 Oj(t){const s=Co(t);return Ij[s.toLowerCase()]??"generic"}const Bj="_card_qkm9i_2",Lj="_cardBlue_qkm9i_20",zj="_cardOrange_qkm9i_24",Uj="_cardGreen_qkm9i_28",$j="_cardPurple_qkm9i_32",Pj="_cardNeutral_qkm9i_36",Vj="_cardRed_qkm9i_40",Hj="_cardTeal_qkm9i_44",qj="_header_qkm9i_48",Gj="_icon_qkm9i_55",Fj="_toolName_qkm9i_64",Zj="_fileName_qkm9i_71",Kj="_badge_qkm9i_80",Yj="_spacer_qkm9i_87",Jj="_bodyToggle_qkm9i_91",Wj="_chevron_qkm9i_109",Xj="_chevronExpanded_qkm9i_115",Qj="_pre_qkm9i_119",eC="_diffAdd_qkm9i_143",tC="_diffRemove_qkm9i_155",nC="_diffContext_qkm9i_167",sC="_diffHeader_qkm9i_176",aC="_diffLine_qkm9i_182",iC="_exitOk_qkm9i_188",oC="_exitError_qkm9i_194",rC="_exitPending_qkm9i_200",lC="_inProgress_qkm9i_228",cC="_metadata_qkm9i_232",uC="_metadataPrefix_qkm9i_239",I={card:Bj,cardBlue:Lj,cardOrange:zj,cardGreen:Uj,cardPurple:$j,cardNeutral:Pj,cardRed:Vj,cardTeal:Hj,header:qj,icon:Gj,toolName:Fj,fileName:Zj,badge:Kj,spacer:Yj,bodyToggle:Jj,chevron:Wj,chevronExpanded:Xj,pre:Qj,diffAdd:eC,diffRemove:tC,diffContext:nC,diffHeader:sC,diffLine:aC,exitOk:iC,exitError:oC,exitPending:rC,inProgress:lC,metadata:cC,metadataPrefix:uC};function dC(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 fC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const If=5;function sy({tool:t,args:s,result:i,isError:o,writeVariant:c}){const[u,d]=b.useState(!1),p=dC(s),h=fC(p),g=i===void 0,v=o?I.cardRed:c?I.cardGreen:I.cardBlue,y=c?"var(--accent-green)":"var(--accent-blue)",_=c?r.jsx(s2,{size:Gt}):r.jsx(i2,{size:Gt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(i==null?void 0:i.split(`
231
- `))??[],w=S.length>If,N=u?S:S.slice(0,If);return r.jsxs("div",{className:`${I.card} ${v} ${g?I.inProgress:""}`,"data-testid":k,children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,children:_}),r.jsx("span",{className:I.toolName,style:{color:y},children:t}),h&&r.jsx("span",{className:I.fileName,title:p,children:h}),!g&&S.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,children:[S.length," lines"]})]})]}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&S.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:N.map((T,C)=>r.jsxs("span",{className:I.diffLine,children:[r.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&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${u?I.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),u?"collapse":`${S.length-If} more lines`]})]})]})}function pC(t){const s=t.split(`
232
- `),i=[];for(const o of s)o.startsWith("diff --git")||o.startsWith("index ")||(o.startsWith("--- ")||o.startsWith("+++ "))&&!o.startsWith("---- ")&&!o.startsWith("++++ ")||(o.startsWith("@@")?i.push({type:"header",content:o}):o.startsWith("+")?i.push({type:"add",content:o.slice(1)}):o.startsWith("-")?i.push({type:"remove",content:o.slice(1)}):o.startsWith(" ")?i.push({type:"context",content:o.slice(1)}):o===""&&i.push({type:"context",content:""}));return i}function mC(t,s){const i=t.split(`
233
- `),o=s.split(`
234
- `),c=[];for(const u of i)c.push({type:"remove",content:u});for(const u of o)c.push({type:"add",content:u});return c}function hC(t){let s=0,i=0;for(const o of t)o.type==="add"&&s++,o.type==="remove"&&i++;return{added:s,removed:i}}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){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),o=(typeof s.new_string=="string"?s.new_string:void 0)??(typeof s.new_str=="string"?s.new_str:void 0);if(i!==void 0&&o!==void 0)return{oldStr:i,newStr:o}}function yC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function bC(t,s){if(s){let o=s;if(s.trimStart().startsWith("{"))try{const c=JSON.parse(s);typeof c.detailedContent=="string"&&(o=c.detailedContent)}catch{}if(o.includes("@@")||o.startsWith("diff ")){const c=pC(o);if(c.length>0)return c}}const i=vC(t);if(i)return mC(i.oldStr,i.newStr)}const Of=5;function _C({tool:t,args:s,result:i,isError:o,detailedResult:c}){const[u,d]=b.useState(!1),p=gC(s),h=yC(p),g=i===void 0,v=bC(s,c),y=v?hC(v):null,_=((v==null?void 0:v.length)??0)>Of,k=u?v:v==null?void 0:v.slice(0,Of);return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardOrange} ${g?I.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,children:r.jsx(A2,{size:Gt})}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow)"},children:t}),h&&r.jsx("span",{className:I.fileName,title:p,children:h}),y&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,"data-testid":"tool-card-diff-stats",children:[r.jsxs("span",{style:{color:"var(--accent-green)"},children:["+",y.added]})," ",r.jsxs("span",{style:{color:"var(--accent-red)"},children:["−",y.removed]})]})]})]}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&k&&k.length>0&&r.jsxs(r.Fragment,{children:[r.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),r.jsx("span",{className:`${I.diffLine} ${N}`,children:S.content},w)})}),_&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${u?I.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),u?"collapse":`${((v==null?void 0:v.length)??0)-Of} more lines`]})]}),!o&&!v&&!g&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-content",children:i})]})}const xC=/^\[exit (\d+)\]\s*/;function kC(t){const s=xC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function SC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function TC(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 Bf=3;function wC({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),d=SC(s),p=TC(d),h=i===void 0,g=i?kC(i):null,v=(g==null?void 0:g.output.split(`
235
- `))??[],y=v.length>Bf,_=c?v:v.slice(0,Bf),k=g==null?void 0:g.exitCode,S=o||k!==void 0&&k!==0;return r.jsxs("div",{className:`${I.card} ${S?I.cardRed:I.cardNeutral}`,"data-testid":"tool-card-shell",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),r.jsx("span",{className:I.fileName,style:{flex:1,color:"var(--text-primary)"},title:d!==p?d:void 0,"data-testid":"tool-card-command",children:p}),k!==void 0&&r.jsxs("span",{className:k===0?I.exitOk:I.exitError,"data-testid":"tool-card-exit-code",children:[k===0?r.jsx(_i,{size:it,"aria-hidden":"true"}):r.jsx(Ba,{size:it,"aria-hidden":"true"})," ","exit ",k]}),h&&r.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:r.jsx(y2,{size:it,"aria-hidden":"true"})})]}),!h&&g&&g.output.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-output",children:_.join(`
236
- `)}),y&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(w=>!w)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),c?"collapse":`${v.length-Bf} more lines`]})]})]})}function NC(t){if(t==null||typeof t!="object")return{pattern:"",path:""};const s=t,i=typeof s.pattern=="string"?s.pattern:"",o=typeof s.path=="string"?s.path:"";return{pattern:i,path:o}}const Lf=5;function jC({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),{pattern:d,path:p}=NC(s),h=i===void 0,g=(i==null?void 0:i.split(`
237
- `).filter(_=>_.length>0))??[],v=g.length>Lf,y=c?g:g.slice(0,Lf);return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardPurple} ${h?I.inProgress:""}`,"data-testid":"tool-card-search",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,children:r.jsx(e_,{size:Gt})}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),d&&r.jsxs("span",{className:I.fileName,"data-testid":"tool-card-pattern",children:['"',d,'"']}),p&&r.jsxs("span",{className:I.fileName,style:{flexShrink:1},"data-testid":"tool-card-search-path",children:["in ",p]}),!h&&!o&&g.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&y.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-results",children:y.join(`
238
- `)}),v&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),c?"collapse":`${g.length-Lf} more matches`]})]})]})}const CC="_progressBar_14f5c_1",EC="_progressFill_14f5c_9",AC="_activeTask_14f5c_16",DC="_activeIcon_14f5c_27",RC="_todoPulse_14f5c_1",MC="_activeText_14f5c_34",IC="_checklist_14f5c_48",OC="_item_14f5c_55",BC="_itemIcon_14f5c_65",LC="_itemText_14f5c_73",zC="_pending_14f5c_78",UC="_in_progress_14f5c_85",$C="_completed_14f5c_97",PC="_emptyMessage_14f5c_108",Qn={progressBar:CC,progressFill:EC,activeTask:AC,activeIcon:DC,todoPulse:RC,activeText:MC,checklist:IC,item:OC,itemIcon:BC,itemText:LC,pending:zC,in_progress:UC,completed:$C,emptyMessage:PC},VC=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function HC(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:ay(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:ay(i.status)})):typeof s.content=="string"?qC(s.content):[]}function ay(t){switch(t.toLowerCase()){case"completed":case"done":case"complete":return"completed";case"in_progress":case"in-progress":case"working":case"active":return"in_progress";default:return"pending"}}function qC(t){const s=t.split(`
239
- `),i=[];for(const o of s){const c=VC.exec(o.trim());if(c){const u=c[1],d=c[2].trim();let p="pending";u==="x"||u==="X"?p="completed":(u==="~"||u==="/"||u==="!")&&(p="in_progress"),i.push({content:d,status:p})}}return i}function GC(t){switch(t){case"completed":return r.jsx(_i,{size:it});case"in_progress":return r.jsx(Ra,{size:it,fill:"currentColor"});default:return r.jsx(Ra,{size:it})}}function FC({args:t}){const s=HC(t),i=s.filter(u=>u.status==="completed").length,o=s.find(u=>u.status==="in_progress"),c=s.length===0;return r.jsxs("div",{className:`${I.card} ${I.cardBlue}`,"data-testid":"tool-card-todo",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,children:r.jsx(m2,{size:Gt})}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,"data-testid":"tool-card-todo-progress",children:[i,"/",s.length]})]})]}),!c&&r.jsx("div",{className:Qn.progressBar,"data-testid":"tool-card-todo-bar",children:r.jsx("div",{className:Qn.progressFill,style:{width:`${i/s.length*100}%`}})}),o&&r.jsxs("div",{className:Qn.activeTask,"data-testid":"tool-card-todo-active",children:[r.jsx("span",{className:Qn.activeIcon,children:r.jsx(Ra,{size:it,fill:"currentColor"})}),r.jsx("span",{className:Qn.activeText,children:o.activeForm||o.content})]}),!c&&r.jsx("div",{className:Qn.checklist,"data-testid":"tool-card-todo-list",children:s.map((u,d)=>r.jsxs("div",{className:`${Qn.item} ${Qn[u.status]}`,"data-testid":"tool-card-todo-item",children:[r.jsx("span",{className:Qn.itemIcon,children:GC(u.status)}),r.jsx("span",{className:Qn.itemText,children:u.content})]},d))}),c&&r.jsx("div",{className:Qn.emptyMessage,children:"All items completed and cleared."})]})}function ZC(t,s){if(s==null||typeof s!="object")return"";const i=s;if(typeof i.intent=="string")return i.intent;for(const o of Object.values(i))if(typeof o=="string")return o;return t}function KC({tool:t,args:s}){const i=ZC(t,s);return r.jsxs("div",{className:I.metadata,"data-testid":"tool-card-metadata",children:[r.jsx("span",{className:I.metadataPrefix,children:r.jsx(t2,{size:it})}),i]})}function YC(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 JC(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 zf=5,Uf=5;function WC({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),d=Co(t),p=YC(s),h=i===void 0,{single:g,list:v}=JC(i),y=(g==null?void 0:g.title)??p.title,_=v?void 0:(g==null?void 0:g.category)??p.category,k=v?void 0:(g==null?void 0:g.tags)??p.tags;return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardPurple} ${h?I.inProgress:""}`,"data-testid":"tool-card-finding",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,"aria-hidden":"true",children:"💡"}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:d}),y&&r.jsxs("span",{className:I.fileName,"data-testid":"tool-card-finding-title",children:['"',y,'"']}),_&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsx("span",{className:I.badge,"data-testid":"tool-card-finding-category",children:_})]}),v&&!_&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),k&&k.length>0&&r.jsx("div",{className:I.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:k.map((S,w)=>r.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",S]},w))}),h&&!y&&s!==null&&s!==void 0&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&(g==null?void 0:g.content)&&r.jsx(r.Fragment,{children:(()=>{const S=g.content.split(`
240
- `),w=S.length>Uf,N=c?g.content:S.slice(0,Uf).join(`
241
- `);return r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-content",children:N}),w&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${S.length-Uf} more lines`]})]})})()}),!o&&v&&v.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,zf)).map((S,w)=>`${S.category?`[${S.category}] `:""}${S.title??S.id??`Finding ${w+1}`}`).join(`
242
- `)}),v.length>zf&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-zf} more findings`]})]})]})}function XC(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 QC(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 iy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function eE(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 $f=5;function tE({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),d=Co(t),p=XC(s),h=i===void 0,{single:g,list:v,sessionId:y}=QC(i),_=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardBlue} ${h?I.inProgress:""}`,"data-testid":"tool-card-task",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📋"}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:d}),_&&r.jsxs("span",{className:I.fileName,"data-testid":"tool-card-task-title",children:['"',_,'"']}),!_&&p.taskId&&r.jsx("span",{className:I.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,style:{color:eE(k)},"data-testid":"tool-card-task-status",children:[iy(k)," ",k]})]}),v&&!k&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),h&&!_&&!p.taskId&&s!==null&&s!==void 0&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&y&&r.jsxs("div",{className:I.pre,style:{padding:"4px 8px",fontSize:"0.85em"},"data-testid":"tool-card-task-session",children:["session: ",y]}),!o&&g&&!v&&!y&&r.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
- `)}),!o&&v&&v.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,$f)).map(S=>{const w=iy(S.status),N=S.title??S.id??"untitled";return`${w} ${N}`}).join(`
244
- `)}),v.length>$f&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-$f} more tasks`]})]})]})}function nE(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 sE(t){if(!t)return{};try{const s=JSON.parse(t);if(typeof s!="object"||s===null)return{};const i=s,o=typeof i.workpad=="object"&&i.workpad!==null?i.workpad:i;return{status:typeof o.status=="string"?o.status:void 0,summary:typeof o.summary=="string"?o.summary:void 0,extra:typeof o.extra=="object"&&o.extra!==null?o.extra:void 0}}catch{}return{}}function aE({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),d=Co(t),p=nE(s),h=i===void 0,g=sE(i),v=g.status??p.status,y=g.summary??p.summary;return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardGreen} ${h?I.inProgress:""}`,"data-testid":"tool-card-workpad",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,"aria-hidden":"true",children:"📓"}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-green, #4ade80)"},children:d}),v&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsx("span",{className:I.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),y&&r.jsx("pre",{className:I.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:y}),h&&!y&&s!==null&&s!==void 0&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&!y&&!v&&!g.extra&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:i}),!o&&g.extra&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function iE(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 oE(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(o=>o!==null&&typeof o=="object")};if(typeof i.node=="object"&&i.node!==null){const o=Array.isArray(i.edges)?i.edges.length:0;return{node:i.node,edgeCount:o}}if(typeof i.id=="string")return{node:i}}catch{}return{}}const Pf=5;function rE({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),d=Co(t),p=iE(s),h=i===void 0,g=oE(i);return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardPurple} ${h?I.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🧠"}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:d}),p.query&&r.jsxs("span",{className:I.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&r.jsx("span",{className:I.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.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&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.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&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&g.results&&g.results.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,Pf)).map(v=>{var k,S,w;const y=((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",_=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${y}${_}`}).join(`
245
- `)}),g.results.length>Pf&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-Pf} more results`]})]}),!o&&g.node&&!g.results&&r.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 lE(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 cE(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(o=>o!==null&&typeof o=="object"):void 0,success:typeof i.success=="boolean"?i.success:void 0,output:typeof i.output=="string"?i.output:void 0}}catch{}return{}}function uE({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),d=Co(t),p=lE(s),h=i===void 0,g=cE(i);let v="";p.pipe?v=`[${p.pipe}]`:p.fd!==void 0?v=`fd:${p.fd}`:p.name&&(v=`"${p.name}"`);const y=p.prompt?p.prompt.length>60?`${p.prompt.slice(0,60)}...`:p.prompt:void 0;return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardOrange} ${h?I.inProgress:""}`,"data-testid":"tool-card-ipc",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔀"}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:d}),v&&r.jsx("span",{className:I.fileName,"data-testid":"tool-card-ipc-info",children:v}),y&&r.jsx("span",{className:I.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:y}),g.fds&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.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&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.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&&!y&&!v&&s!==null&&s!==void 0&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&g.sessionId&&r.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}`]}),!o&&g.output&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-output",children:g.output}),!o&&g.fds&&g.fds.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(_=>{const k=[`fd:${_.fd??"?"}`,_.permission??"",_.deliveryMode??""];return _.streamName&&k.push(_.streamName),_.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
247
- `)}),g.fds.length>5&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(_=>!_)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function dE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const Vf=8;function fE({args:t,result:s,isError:i}){const[o,c]=b.useState(!1),u=dE(t),d=s===void 0,p=(s==null?void 0:s.split(`
248
- `))??[],h=p.length>Vf,g=o?s:p.slice(0,Vf).join(`
249
- `);return r.jsxs("div",{className:`${I.card} ${i?I.cardRed:I.cardNeutral} ${d?I.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,"aria-hidden":"true",children:"🔧"}),r.jsx("span",{className:I.toolName,children:"ToolSearch"}),u&&r.jsxs("span",{className:I.fileName,"data-testid":"tool-card-tool-search-query",children:['"',u,'"']}),!d&&!i&&s&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:I.spacer}),r.jsxs("span",{className:I.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),d&&!u&&t!==null&&t!==void 0&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),i&&s&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:s}),!i&&!d&&s&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-tool-search-result",children:g}),h&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":o,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${o?I.chevronExpanded:""}`,children:"▸"}),o?"collapse":`${p.length-Vf} more lines`]})]})]})}function pE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function mE(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 Hf=5;function hE({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),{display:d}=pE(t),p=mE(s),h=i===void 0,g=(i==null?void 0:i.split(`
250
- `))??[],v=g.length>Hf,y=c?i:g.slice(0,Hf).join(`
251
- `);let _="";if(s!=null)try{_=JSON.stringify(s,null,2)}catch{_=String(s)}return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardBlue} ${h?I.inProgress:""}`,"data-testid":"tool-card-generic",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,children:r.jsx(WT,{size:Gt,"aria-hidden":"true"})}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-blue)"},children:d}),p&&r.jsx("span",{className:I.fileName,children:p})]}),h&&_&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-args",children:_}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:y}),v&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),c?"collapse":`${g.length-Hf} more lines`]})]})]})}const gE="_badgePill_o7eqc_1",vE="_modelBadge_o7eqc_14",yE="_backgroundBadge_o7eqc_26",bE="_backgroundDot_o7eqc_36",_E="_backgroundDotPulsing_o7eqc_41",xE="_description_o7eqc_55",kE="_statusLine_o7eqc_62",SE="_statusCompleted_o7eqc_72",TE="_statusRunning_o7eqc_77",wE="_statusError_o7eqc_83",NE="_promptToggle_o7eqc_88",es={badgePill:gE,modelBadge:vE,backgroundBadge:yE,backgroundDot:bE,backgroundDotPulsing:_E,description:xE,statusLine:kE,statusCompleted:SE,statusRunning:TE,statusError:wE,promptToggle:NE};function jE(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 CE=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function EE(t){const s=CE.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 qf=5;function AE({tool:t,args:s,result:i,isError:o}){const[c,u]=b.useState(!1),[d,p]=b.useState(!1),h=jE(t,s),g=i===void 0,v=h.isPoll&&i?EE(i):void 0,y=(v==null?void 0:v.content)??i,_=(y==null?void 0:y.split(`
252
- `))??[],k=_.length>qf,S=c?y:_.slice(0,qf).join(`
253
- `),w=h.isPoll?"Subagent":"Agent";return r.jsxs("div",{className:`${I.card} ${o?I.cardRed:I.cardTeal} ${g?I.inProgress:""}`,"data-testid":"tool-card-agent",children:[r.jsxs("div",{className:I.header,children:[r.jsx("span",{className:I.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),r.jsx("span",{className:I.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:w}),h.agentType&&r.jsx("span",{className:es.badgePill,"data-testid":"tool-card-agent-type",children:h.agentType}),h.model&&r.jsx("span",{className:es.modelBadge,"data-testid":"tool-card-agent-model",children:h.model}),h.isBackground&&r.jsxs("span",{className:es.backgroundBadge,"data-testid":"tool-card-agent-background",children:[r.jsx("span",{className:g?es.backgroundDotPulsing:es.backgroundDot,children:"●"}),"BG"]}),h.agentName&&r.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-name",children:h.agentName}),h.agentId&&r.jsx("span",{className:I.fileName,"data-testid":"tool-card-agent-id",children:h.agentId}),r.jsx("span",{className:I.spacer}),g&&!h.isBackground&&r.jsx("span",{className:I.exitPending,"data-testid":"tool-card-pending",children:"●"})]}),h.description&&r.jsx("div",{className:es.description,"data-testid":"tool-card-agent-description",children:h.isResume?`Resuming: ${h.description}`:h.description}),v&&r.jsxs("div",{className:es.statusLine,"data-testid":"tool-card-agent-status",children:[r.jsx("span",{className:v.status==="completed"?es.statusCompleted:v.status==="running"?es.statusRunning:es.statusError,children:v.status}),v.metadata&&r.jsx("span",{children:v.metadata})]}),h.prompt&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:es.promptToggle,onClick:()=>{p(N=>!N)},"aria-expanded":d,"data-testid":"tool-card-prompt-toggle",children:[r.jsx("span",{className:`${I.chevron} ${d?I.chevronExpanded:""}`,children:"▸"}),"prompt"]}),d&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-prompt",children:h.prompt})]}),o&&i&&r.jsx("pre",{className:I.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&y&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:I.pre,"data-testid":"tool-card-result",children:S}),k&&r.jsxs("button",{type:"button",className:I.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${I.chevron} ${c?I.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${_.length-qf} more lines`]})]})]})}function Gf(t){switch(Oj(t.tool)){case"file-read":return r.jsx(sy,{...t});case"file-edit":return r.jsx(_C,{...t});case"file-write":return r.jsx(sy,{...t,writeVariant:!0});case"shell":return r.jsx(wC,{...t});case"search":return r.jsx(jC,{...t});case"todo":return r.jsx(FC,{...t});case"metadata":return r.jsx(KC,{...t});case"finding":return r.jsx(WC,{...t});case"task":return r.jsx(tE,{...t});case"workpad":return r.jsx(aE,{...t});case"knowledge":return r.jsx(rE,{...t});case"ipc":return r.jsx(uE,{...t});case"tool-search":return r.jsx(fE,{...t});case"agent":return r.jsx(AE,{...t});default:return r.jsx(hE,{...t})}}const DE="_systemContextEvent_hmqlm_1",RE="_systemContextHeader_hmqlm_7",ME="_systemContextBadge_hmqlm_28",IE="_systemContextToggle_hmqlm_37",OE="_systemContextPre_hmqlm_43",BE="_systemContextEllipsis_hmqlm_54",LE="_systemEvent_hmqlm_58",zE="_systemTimestamp_hmqlm_65",UE="_textEvent_hmqlm_69",$E="_codeBlockWrapper_hmqlm_156",PE="_codeBlockCopyButton_hmqlm_159",VE="_errorEvent_hmqlm_163",HE="_statusEvent_hmqlm_171",qE="_userInputEvent_hmqlm_180",GE="_userInputContent_hmqlm_186",FE="_signalEvent_hmqlm_203",ZE="_signalBadge_hmqlm_214",KE="_signalContent_hmqlm_223",YE="_usageEvent_hmqlm_228",JE="_usageBadge_hmqlm_235",WE="_defaultEvent_hmqlm_244",It={systemContextEvent:DE,systemContextHeader:RE,systemContextBadge:ME,systemContextToggle:IE,systemContextPre:OE,systemContextEllipsis:BE,systemEvent:LE,systemTimestamp:zE,textEvent:UE,codeBlockWrapper:$E,codeBlockCopyButton:PE,errorEvent:VE,statusEvent:HE,userInputEvent:qE,userInputContent:GE,signalEvent:FE,signalBadge:ZE,signalContent:KE,usageEvent:YE,usageBadge:JE,defaultEvent:WE},oy=3;function XE({content:t}){const[s,i]=b.useState(!1),o=t.split(`
254
- `),c=o.length>oy,u=s?t:o.slice(0,oy).join(`
255
- `);return r.jsxs("div",{className:It.systemContextEvent,"data-testid":"system-context-event",children:[r.jsxs("button",{type:"button",className:It.systemContextHeader,onClick:()=>{i(d=>!d)},"aria-expanded":s,children:[r.jsx("span",{className:It.systemContextBadge,children:"SYSTEM PROMPT"}),c&&r.jsx("span",{className:It.systemContextToggle,"aria-hidden":"true",children:s?r.jsx(Xb,{size:it}):r.jsx(Qs,{size:it})})]}),r.jsxs("pre",{className:It.systemContextPre,children:[u,!s&&c&&r.jsx("span",{className:It.systemContextEllipsis,children:"…"})]})]})}function QE({time:t,content:s}){return r.jsxs("div",{className:It.systemEvent,children:[r.jsxs("span",{className:It.systemTimestamp,children:["[",t,"]"]})," ",s]})}function kp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(kp).join(""):t!=null&&typeof t=="object"&&"props"in t?kp(t.props.children):""}function eA({children:t,node:s,...i}){const o=kp(t);return r.jsxs("div",{className:It.codeBlockWrapper,children:[r.jsx("pre",{...i,children:t}),r.jsx(pj,{text:o,"data-testid":"copy-code-block",className:It.codeBlockCopyButton})]})}const tA={pre:eA};function nA({content:t}){return r.jsx("div",{className:It.textEvent,children:r.jsx(tu,{remarkPlugins:[nu],rehypePlugins:[Mj],components:tA,children:t})})}function sA({content:t}){return r.jsxs("div",{className:It.errorEvent,children:["Error: ",t]})}function aA({content:t}){return r.jsxs("div",{className:It.statusEvent,children:["--- ",t," ---"]})}function iA({content:t}){return r.jsx("div",{className:It.userInputEvent,children:r.jsx("span",{className:It.userInputContent,children:t})})}function oA({content:t}){return r.jsxs("div",{className:It.signalEvent,"data-testid":"signal-event",children:[r.jsx("span",{className:It.signalBadge,children:"SIGNAL"}),r.jsx("span",{className:It.signalContent,children:t})]})}function rA({content:t}){let s=t;try{const i=JSON.parse(t),o=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,u=T_(o+c),d=ko(Number(i.cost_usd)||0);s=`${u} tokens · ${d}`}catch{}return r.jsx("div",{className:It.usageEvent,"data-testid":"usage-event",children:r.jsx("span",{className:It.usageBadge,children:s})})}function lA({content:t}){return r.jsx("div",{className:It.defaultEvent,children:t})}function cA({event:t,toolUseCtx:s,settled:i}){const o=new Date(t.timestamp).toLocaleTimeString();switch(t.eventType){case"system":{if(t.raw)try{if(JSON.parse(t.raw).systemContext===!0)return r.jsx(XE,{content:t.content})}catch{}return r.jsx(QE,{time:o,content:t.content})}case"text":case"output":return r.jsx(nA,{content:t.content});case"tool_use":{let c="",u={};try{const d=JSON.parse(t.content);c=d.tool||"",u=d.args}catch{}return r.jsx(Gf,{tool:c,args:u,result:i?"":void 0})}case"tool_result":{let c=!1;if(t.raw)try{c=JSON.parse(t.raw).is_error===!0}catch{}let u=t.content;if(t.content.trimStart().startsWith("{"))try{const d=JSON.parse(t.content);typeof d.content=="string"&&(u=d.content)}catch{}return s?r.jsx(Gf,{tool:s.tool,args:s.args,result:u,isError:c,detailedResult:s.detailedResult}):r.jsx(Gf,{tool:"Tool output",args:void 0,result:u,isError:c})}case"error":return r.jsx(sA,{content:t.content});case"status":return r.jsx(aA,{content:t.content});case"user_input":return r.jsx(iA,{content:t.content});case"signal":return r.jsx(oA,{content:t.content});case"usage":return r.jsx(rA,{content:t.content});default:return r.jsx(lA,{content:t.content})}}const nm=b.createContext({});function sm(t){const s=b.useRef(null);return s.current===null&&(s.current=t()),s.current}const lu=b.createContext(null),am=b.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class uA extends b.Component{getSnapshotBeforeUpdate(s){const i=this.props.childRef.current;if(i&&s.isPresent&&!this.props.isPresent){const o=this.props.sizeRef.current;o.height=i.offsetHeight||0,o.width=i.offsetWidth||0,o.top=i.offsetTop,o.left=i.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function dA({children:t,isPresent:s}){const i=b.useId(),o=b.useRef(null),c=b.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=b.useContext(am);return b.useInsertionEffect(()=>{const{width:d,height:p,top:h,left:g}=c.current;if(s||!o.current||!d||!p)return;o.current.dataset.motionPopId=i;const v=document.createElement("style");return u&&(v.nonce=u),document.head.appendChild(v),v.sheet&&v.sheet.insertRule(`
256
- [data-motion-pop-id="${i}"] {
257
- position: absolute !important;
258
- width: ${d}px !important;
259
- height: ${p}px !important;
260
- top: ${h}px !important;
261
- left: ${g}px !important;
262
- }
263
- `),()=>{document.head.removeChild(v)}},[s]),r.jsx(uA,{isPresent:s,childRef:o,sizeRef:c,children:b.cloneElement(t,{ref:o})})}const fA=({children:t,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const p=sm(pA),h=b.useId(),g=b.useCallback(y=>{p.set(y,!0);for(const _ of p.values())if(!_)return;o&&o()},[p,o]),v=b.useMemo(()=>({id:h,initial:s,isPresent:i,custom:c,onExitComplete:g,register:y=>(p.set(y,!1),()=>p.delete(y))}),u?[Math.random(),g]:[i,g]);return b.useMemo(()=>{p.forEach((y,_)=>p.set(_,!1))},[i]),b.useEffect(()=>{!i&&!p.size&&o&&o()},[i]),d==="popLayout"&&(t=r.jsx(dA,{isPresent:i,children:t})),r.jsx(lu.Provider,{value:v,children:t})};function pA(){return new Map}function w_(t=!0){const s=b.useContext(lu);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=b.useId();b.useEffect(()=>{t&&c(u)},[t]);const d=b.useCallback(()=>t&&o&&o(u),[u,o,t]);return!i&&o?[!1,d]:[!0]}const Sc=t=>t.key||"";function ry(t){const s=[];return b.Children.forEach(t,i=>{b.isValidElement(i)&&s.push(i)}),s}const im=typeof window<"u",N_=im?b.useLayoutEffect:b.useEffect,os=({children:t,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[p,h]=w_(d),g=b.useMemo(()=>ry(t),[t]),v=d&&!p?[]:g.map(Sc),y=b.useRef(!0),_=b.useRef(g),k=sm(()=>new Map),[S,w]=b.useState(g),[N,T]=b.useState(g);N_(()=>{y.current=!1,_.current=g;for(let R=0;R<N.length;R++){const D=Sc(N[R]);v.includes(D)?k.delete(D):k.get(D)!==!0&&k.set(D,!1)}},[N,v.length,v.join("-")]);const C=[];if(g!==S){let R=[...g];for(let D=0;D<N.length;D++){const A=N[D],q=Sc(A);v.includes(q)||(R.splice(D,0,A),C.push(A))}u==="wait"&&C.length&&(R=C),T(ry(R)),w(g);return}const{forceRender:E}=b.useContext(nm);return r.jsx(r.Fragment,{children:N.map(R=>{const D=Sc(R),A=d&&!p?!1:g===N||v.includes(D),q=()=>{if(k.has(D))k.set(D,!0);else return;let $=!0;k.forEach(Y=>{Y||($=!1)}),$&&(E==null||E(),T(_.current),d&&(h==null||h()),o&&o())};return r.jsx(fA,{isPresent:A,initial:!y.current||i?void 0:!1,custom:A?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:A?void 0:q,children:R},D)})})},jn=t=>t;let j_=jn;const mA={useManualTiming:!1};function hA(t){let s=new Set,i=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function p(g){u.has(g)&&(h.schedule(g),t()),g(d)}const h={schedule:(g,v=!1,y=!1)=>{const k=y&&o?s:i;return v&&u.add(g),k.has(g)||k.add(g),g},cancel:g=>{i.delete(g),u.delete(g)},process:g=>{if(d=g,o){c=!0;return}o=!0,[s,i]=[i,s],s.forEach(p),s.clear(),o=!1,c&&(c=!1,h.process(g))}};return h}const Tc=["read","resolveKeyframes","update","preRender","render","postRender"],gA=40;function C_(t,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=Tc.reduce((T,C)=>(T[C]=hA(u),T),{}),{read:p,resolveKeyframes:h,update:g,preRender:v,render:y,postRender:_}=d,k=()=>{const T=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(T-c.timestamp,gA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),h.process(c),g.process(c),v.process(c),y.process(c),_.process(c),c.isProcessing=!1,i&&s&&(o=!1,t(k))},S=()=>{i=!0,o=!0,c.isProcessing||t(k)};return{schedule:Tc.reduce((T,C)=>{const E=d[C];return T[C]=(R,D=!1,A=!1)=>(i||S(),E.schedule(R,D,A)),T},{}),cancel:T=>{for(let C=0;C<Tc.length;C++)d[Tc[C]].cancel(T)},state:c,steps:d}}const{schedule:yt,cancel:Ia,state:Wt,steps:Ff}=C_(typeof requestAnimationFrame<"u"?requestAnimationFrame:jn,!0),E_=b.createContext({strict:!1}),ly={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"]},So={};for(const t in ly)So[t]={isEnabled:s=>ly[t].some(i=>!!s[i])};function vA(t){for(const s in t)So[s]={...So[s],...t[s]}}const yA=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 qc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||yA.has(t)}let A_=t=>!qc(t);function bA(t){t&&(A_=s=>s.startsWith("on")?!qc(s):t(s))}try{bA(require("@emotion/is-prop-valid").default)}catch{}function _A(t,s,i){const o={};for(const c in t)c==="values"&&typeof t.values=="object"||(A_(c)||i===!0&&qc(c)||!s&&!qc(c)||t.draggable&&c.startsWith("onDrag"))&&(o[c]=t[c]);return o}function xA(t){if(typeof Proxy>"u")return t;const s=new Map,i=(...o)=>t(...o);return new Proxy(i,{get:(o,c)=>c==="create"?t:(s.has(c)||s.set(c,t(c)),s.get(c))})}const cu=b.createContext({});function Vr(t){return typeof t=="string"||Array.isArray(t)}function uu(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const om=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rm=["initial",...om];function du(t){return uu(t.animate)||rm.some(s=>Vr(t[s]))}function D_(t){return!!(du(t)||t.variants)}function kA(t,s){if(du(t)){const{initial:i,animate:o}=t;return{initial:i===!1||Vr(i)?i:void 0,animate:Vr(o)?o:void 0}}return t.inherit!==!1?s:{}}function SA(t){const{initial:s,animate:i}=kA(t,b.useContext(cu));return b.useMemo(()=>({initial:s,animate:i}),[cy(s),cy(i)])}function cy(t){return Array.isArray(t)?t.join(" "):t}const TA=Symbol.for("motionComponentSymbol");function mo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function wA(t,s,i){return b.useCallback(o=>{o&&t.onMount&&t.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):mo(i)&&(i.current=o))},[s])}const lm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),NA="framerAppearId",R_="data-"+lm(NA),{schedule:cm}=C_(queueMicrotask,!1),M_=b.createContext({});function jA(t,s,i,o,c){var u,d;const{visualElement:p}=b.useContext(cu),h=b.useContext(E_),g=b.useContext(lu),v=b.useContext(am).reducedMotion,y=b.useRef(null);o=o||h.renderer,!y.current&&o&&(y.current=o(t,{visualState:s,parent:p,props:i,presenceContext:g,blockInitialAnimation:g?g.initial===!1:!1,reducedMotionConfig:v}));const _=y.current,k=b.useContext(M_);_&&!_.projection&&c&&(_.type==="html"||_.type==="svg")&&CA(y.current,i,c,k);const S=b.useRef(!1);b.useInsertionEffect(()=>{_&&S.current&&_.update(i,g)});const w=i[R_],N=b.useRef(!!w&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,w))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,w)));return N_(()=>{_&&(S.current=!0,window.MotionIsMounted=!0,_.updateFeatures(),cm.render(_.render),N.current&&_.animationState&&_.animationState.animateChanges())}),b.useEffect(()=>{_&&(!N.current&&_.animationState&&_.animationState.animateChanges(),N.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,w)}),N.current=!1))}),_}function CA(t,s,i,o){const{layoutId:c,layout:u,drag:d,dragConstraints:p,layoutScroll:h,layoutRoot:g}=s;t.projection=new i(t.latestValues,s["data-framer-portal-id"]?void 0:I_(t.parent)),t.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||p&&mo(p),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function I_(t){if(t)return t.options.allowProjection!==!1?t.projection:I_(t.parent)}function EA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;t&&vA(t);function p(g,v){let y;const _={...b.useContext(am),...g,layoutId:AA(g)},{isStatic:k}=_,S=SA(g),w=o(g,k);if(!k&&im){DA();const N=RA(_);y=N.MeasureLayout,S.visualElement=jA(c,w,_,s,N.ProjectionNode)}return r.jsxs(cu.Provider,{value:S,children:[y&&S.visualElement?r.jsx(y,{visualElement:S.visualElement,..._}):null,i(c,g,wA(w,S.visualElement,v),w,k,S.visualElement)]})}p.displayName=`motion.${typeof c=="string"?c:`create(${(d=(u=c.displayName)!==null&&u!==void 0?u:c.name)!==null&&d!==void 0?d:""})`}`;const h=b.forwardRef(p);return h[TA]=c,h}function AA({layoutId:t}){const s=b.useContext(nm).id;return s&&t!==void 0?s+"-"+t:t}function DA(t,s){b.useContext(E_).strict}function RA(t){const{drag:s,layout:i}=So;if(!s&&!i)return{};const o={...s,...i};return{MeasureLayout:s!=null&&s.isEnabled(t)||i!=null&&i.isEnabled(t)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}const MA=["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 um(t){return typeof t!="string"||t.includes("-")?!1:!!(MA.indexOf(t)>-1||/[A-Z]/u.test(t))}function uy(t){const s=[{},{}];return t==null||t.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function dm(t,s,i,o){if(typeof s=="function"){const[c,u]=uy(o);s=s(i!==void 0?i:t.custom,c,u)}if(typeof s=="string"&&(s=t.variants&&t.variants[s]),typeof s=="function"){const[c,u]=uy(o);s=s(i!==void 0?i:t.custom,c,u)}return s}const Sp=t=>Array.isArray(t),IA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),OA=t=>Sp(t)?t[t.length-1]||0:t,nn=t=>!!(t&&t.getVelocity);function Lc(t){const s=nn(t)?t.get():t;return IA(s)?s.toValue():s}function BA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:LA(o,c,u,t),renderState:s()};return i&&(d.onMount=p=>i({props:o,current:p,...d}),d.onUpdate=p=>i(p)),d}const O_=t=>(s,i)=>{const o=b.useContext(cu),c=b.useContext(lu),u=()=>BA(t,s,o,c);return i?u():sm(u)};function LA(t,s,i,o){const c={},u=o(t,{});for(const _ in u)c[_]=Lc(u[_]);let{initial:d,animate:p}=t;const h=du(t),g=D_(t);s&&g&&!h&&t.inherit!==!1&&(d===void 0&&(d=s.initial),p===void 0&&(p=s.animate));let v=i?i.initial===!1:!1;v=v||d===!1;const y=v?p:d;if(y&&typeof y!="boolean"&&!uu(y)){const _=Array.isArray(y)?y:[y];for(let k=0;k<_.length;k++){const S=dm(t,_[k]);if(S){const{transitionEnd:w,transition:N,...T}=S;for(const C in T){let E=T[C];if(Array.isArray(E)){const R=v?E.length-1:0;E=E[R]}E!==null&&(c[C]=E)}for(const C in w)c[C]=w[C]}}}return c}const Eo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Si=new Set(Eo),B_=t=>s=>typeof s=="string"&&s.startsWith(t),L_=B_("--"),zA=B_("var(--"),fm=t=>zA(t)?UA.test(t.split("/*")[0].trim()):!1,UA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,z_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Ws=(t,s,i)=>i>s?s:i<t?t:i,Ao={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Hr={...Ao,transform:t=>Ws(0,1,t)},wc={...Ao,default:1},Xr=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Da=Xr("deg"),bs=Xr("%"),we=Xr("px"),$A=Xr("vh"),PA=Xr("vw"),dy={...bs,parse:t=>bs.parse(t)/100,transform:t=>bs.transform(t*100)},VA={borderWidth:we,borderTopWidth:we,borderRightWidth:we,borderBottomWidth:we,borderLeftWidth:we,borderRadius:we,radius:we,borderTopLeftRadius:we,borderTopRightRadius:we,borderBottomRightRadius:we,borderBottomLeftRadius:we,width:we,maxWidth:we,height:we,maxHeight:we,top:we,right:we,bottom:we,left:we,padding:we,paddingTop:we,paddingRight:we,paddingBottom:we,paddingLeft:we,margin:we,marginTop:we,marginRight:we,marginBottom:we,marginLeft:we,backgroundPositionX:we,backgroundPositionY:we},HA={rotate:Da,rotateX:Da,rotateY:Da,rotateZ:Da,scale:wc,scaleX:wc,scaleY:wc,scaleZ:wc,skew:Da,skewX:Da,skewY:Da,distance:we,translateX:we,translateY:we,translateZ:we,x:we,y:we,z:we,perspective:we,transformPerspective:we,opacity:Hr,originX:dy,originY:dy,originZ:we},fy={...Ao,transform:Math.round},pm={...VA,...HA,zIndex:fy,size:we,fillOpacity:Hr,strokeOpacity:Hr,numOctaves:fy},qA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},GA=Eo.length;function FA(t,s,i){let o="",c=!0;for(let u=0;u<GA;u++){const d=Eo[u],p=t[d];if(p===void 0)continue;let h=!0;if(typeof p=="number"?h=p===(d.startsWith("scale")?1:0):h=parseFloat(p)===0,!h||i){const g=z_(p,pm[d]);if(!h){c=!1;const v=qA[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function mm(t,s,i){const{style:o,vars:c,transformOrigin:u}=t;let d=!1,p=!1;for(const h in s){const g=s[h];if(Si.has(h)){d=!0;continue}else if(L_(h)){c[h]=g;continue}else{const v=z_(g,pm[h]);h.startsWith("origin")?(p=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=FA(s,t.transform,i):o.transform&&(o.transform="none")),p){const{originX:h="50%",originY:g="50%",originZ:v=0}=u;o.transformOrigin=`${h} ${g} ${v}`}}const ZA={offset:"stroke-dashoffset",array:"stroke-dasharray"},KA={offset:"strokeDashoffset",array:"strokeDasharray"};function YA(t,s,i=1,o=0,c=!0){t.pathLength=1;const u=c?ZA:KA;t[u.offset]=we.transform(-o);const d=we.transform(s),p=we.transform(i);t[u.array]=`${d} ${p}`}function py(t,s,i){return typeof t=="string"?t:we.transform(s+i*t)}function JA(t,s,i){const o=py(s,t.x,t.width),c=py(i,t.y,t.height);return`${o} ${c}`}function hm(t,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:p=1,pathOffset:h=0,...g},v,y){if(mm(t,g,y),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:_,style:k,dimensions:S}=t;_.transform&&(S&&(k.transform=_.transform),delete _.transform),S&&(c!==void 0||u!==void 0||k.transform)&&(k.transformOrigin=JA(S,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(_.x=s),i!==void 0&&(_.y=i),o!==void 0&&(_.scale=o),d!==void 0&&YA(_,d,p,h,!1)}const gm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),U_=()=>({...gm(),attrs:{}}),vm=t=>typeof t=="string"&&t.toLowerCase()==="svg";function $_(t,{style:s,vars:i},o,c){Object.assign(t.style,s,c&&c.getProjectionStyles(o));for(const u in i)t.style.setProperty(u,i[u])}const P_=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 V_(t,s,i,o){$_(t,s,void 0,o);for(const c in s.attrs)t.setAttribute(P_.has(c)?c:lm(c),s.attrs[c])}const Gc={};function WA(t){Object.assign(Gc,t)}function H_(t,{layout:s,layoutId:i}){return Si.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Gc[t]||t==="opacity")}function ym(t,s,i){var o;const{style:c}=t,u={};for(const d in c)(nn(c[d])||s.style&&nn(s.style[d])||H_(d,t)||((o=i==null?void 0:i.getValue(d))===null||o===void 0?void 0:o.liveStyle)!==void 0)&&(u[d]=c[d]);return u}function q_(t,s,i){const o=ym(t,s,i);for(const c in t)if(nn(t[c])||nn(s[c])){const u=Eo.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=t[c]}return o}function XA(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 my=["x","y","width","height","cx","cy","r"],QA={useVisualState:O_({scrapeMotionValuesFromProps:q_,createRenderState:U_,onUpdate:({props:t,prevProps:s,current:i,renderState:o,latestValues:c})=>{if(!i)return;let u=!!t.drag;if(!u){for(const p in c)if(Si.has(p)){u=!0;break}}if(!u)return;let d=!s;if(s)for(let p=0;p<my.length;p++){const h=my[p];t[h]!==s[h]&&(d=!0)}d&&yt.read(()=>{XA(i,o),yt.render(()=>{hm(o,c,vm(i.tagName),t.transformTemplate),V_(i,o)})})}})},eD={useVisualState:O_({scrapeMotionValuesFromProps:ym,createRenderState:gm})};function G_(t,s,i){for(const o in s)!nn(s[o])&&!H_(o,i)&&(t[o]=s[o])}function tD({transformTemplate:t},s){return b.useMemo(()=>{const i=gm();return mm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function nD(t,s){const i=t.style||{},o={};return G_(o,i,t),Object.assign(o,tD(t,s)),o}function sD(t,s){const i={},o=nD(t,s);return t.drag&&t.dragListener!==!1&&(i.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.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=o,i}function aD(t,s,i,o){const c=b.useMemo(()=>{const u=U_();return hm(u,s,vm(o),t.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(t.style){const u={};G_(u,t.style,t),c.style={...u,...c.style}}return c}function iD(t=!1){return(i,o,c,{latestValues:u},d)=>{const h=(um(i)?aD:sD)(o,u,d,i),g=_A(o,typeof i=="string",t),v=i!==b.Fragment?{...g,...h,ref:c}:{},{children:y}=o,_=b.useMemo(()=>nn(y)?y.get():y,[y]);return b.createElement(i,{...v,children:_})}}function oD(t,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...um(o)?QA:eD,preloadedFeatures:t,useRender:iD(c),createVisualElement:s,Component:o};return EA(d)}}function F_(t,s){if(!Array.isArray(s))return!1;const i=s.length;if(i!==t.length)return!1;for(let o=0;o<i;o++)if(s[o]!==t[o])return!1;return!0}function fu(t,s,i){const o=t.getProps();return dm(o,s,i!==void 0?i:o.custom,t)}function bm(t,s){return t?t[s]||t.default||t:void 0}const Z_=new Set(["width","height","top","left","right","bottom",...Eo]);let zc;function rD(){zc=void 0}const _s={now:()=>(zc===void 0&&_s.set(Wt.isProcessing||mA.useManualTiming?Wt.timestamp:performance.now()),zc),set:t=>{zc=t,queueMicrotask(rD)}};function _m(t,s){t.indexOf(s)===-1&&t.push(s)}function xm(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class km{constructor(){this.subscriptions=[]}add(s){return _m(this.subscriptions,s),()=>xm(this.subscriptions,s)}notify(s,i,o){const c=this.subscriptions.length;if(c)if(c===1)this.subscriptions[0](s,i,o);else for(let u=0;u<c;u++){const d=this.subscriptions[u];d&&d(s,i,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function K_(t,s){return s?t*(1e3/s):0}const hy=30,lD=t=>!isNaN(parseFloat(t));class cD{constructor(s,i={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(o,c=!0)=>{const u=_s.now();this.updatedAt!==u&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),c&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(s),this.owner=i.owner}setCurrent(s){this.current=s,this.updatedAt=_s.now(),this.canTrackVelocity===null&&s!==void 0&&(this.canTrackVelocity=lD(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 km);const o=this.events[s].add(i);return s==="change"?()=>{o(),yt.read(()=>{this.events.change.getSize()||this.stop()})}:o}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,o){this.set(i),this.prev=void 0,this.prevFrameValue=s,this.prevUpdatedAt=this.updatedAt-o}jump(s,i=!0){this.updateAndNotify(s),this.prev=s,this.prevUpdatedAt=this.prevFrameValue=void 0,i&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const s=_s.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||s-this.updatedAt>hy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,hy);return K_(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 qr(t,s){return new cD(t,s)}function uD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,qr(i))}function dD(t,s){const i=fu(t,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const p=OA(u[d]);uD(t,d,p)}}function fD(t){return!!(nn(t)&&t.add)}function Tp(t,s){const i=t.getValue("willChange");if(fD(i))return i.add(s)}function Y_(t){return t.props[R_]}function Sm(t){let s;return()=>(s===void 0&&(s=t()),s)}const pD=Sm(()=>window.ScrollTimeline!==void 0);class mD{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 o=0;o<this.animations.length;o++)this.animations[o][s]=i}attachTimeline(s,i){const o=this.animations.map(c=>{if(pD()&&c.attachTimeline)return c.attachTimeline(s);if(typeof i=="function")return i(c)});return()=>{o.forEach((c,u)=>{c&&c(),this.animations[u].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 hD extends mD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Zs=t=>t*1e3,Ks=t=>t/1e3;function Tm(t){return typeof t=="function"}function gy(t,s){t.timeline=s,t.onfinish=null}const wm=t=>Array.isArray(t)&&typeof t[0]=="number",gD={linearEasing:void 0};function vD(t,s){const i=Sm(t);return()=>{var o;return(o=gD[s])!==null&&o!==void 0?o:i()}}const Fc=vD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),To=(t,s,i)=>{const o=s-t;return o===0?1:(i-t)/o},J_=(t,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=t(To(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function W_(t){return!!(typeof t=="function"&&Fc()||!t||typeof t=="string"&&(t in wp||Fc())||wm(t)||Array.isArray(t)&&t.every(W_))}const Cr=([t,s,i,o])=>`cubic-bezier(${t}, ${s}, ${i}, ${o})`,wp={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Cr([0,.65,.55,1]),circOut:Cr([.55,0,1,.45]),backIn:Cr([.31,.01,.66,-.59]),backOut:Cr([.33,1.53,.69,.99])};function X_(t,s){if(t)return typeof t=="function"&&Fc()?J_(t,s):wm(t)?Cr(t):Array.isArray(t)?t.map(i=>X_(i,s)||wp.easeOut):wp[t]}const Q_=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,yD=1e-7,bD=12;function _D(t,s,i,o,c){let u,d,p=0;do d=s+(i-s)/2,u=Q_(d,o,c)-t,u>0?i=d:s=d;while(Math.abs(u)>yD&&++p<bD);return d}function Qr(t,s,i,o){if(t===s&&i===o)return jn;const c=u=>_D(u,0,1,t,i);return u=>u===0||u===1?u:Q_(c(u),s,o)}const e1=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,t1=t=>s=>1-t(1-s),n1=Qr(.33,1.53,.69,.99),Nm=t1(n1),s1=e1(Nm),a1=t=>(t*=2)<1?.5*Nm(t):.5*(2-Math.pow(2,-10*(t-1))),jm=t=>1-Math.sin(Math.acos(t)),i1=t1(jm),o1=e1(jm),r1=t=>/^0[^.\s]+$/u.test(t);function xD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||r1(t):!0}const Mr=t=>Math.round(t*1e5)/1e5,Cm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function kD(t){return t==null}const SD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Em=(t,s)=>i=>!!(typeof i=="string"&&SD.test(i)&&i.startsWith(t)||s&&!kD(i)&&Object.prototype.hasOwnProperty.call(i,s)),l1=(t,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,p]=o.match(Cm);return{[t]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:p!==void 0?parseFloat(p):1}},TD=t=>Ws(0,255,t),Zf={...Ao,transform:t=>Math.round(TD(t))},pi={test:Em("rgb","red"),parse:l1("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:o=1})=>"rgba("+Zf.transform(t)+", "+Zf.transform(s)+", "+Zf.transform(i)+", "+Mr(Hr.transform(o))+")"};function wD(t){let s="",i="",o="",c="";return t.length>5?(s=t.substring(1,3),i=t.substring(3,5),o=t.substring(5,7),c=t.substring(7,9)):(s=t.substring(1,2),i=t.substring(2,3),o=t.substring(3,4),c=t.substring(4,5),s+=s,i+=i,o+=o,c+=c),{red:parseInt(s,16),green:parseInt(i,16),blue:parseInt(o,16),alpha:c?parseInt(c,16)/255:1}}const Np={test:Em("#"),parse:wD,transform:pi.transform},ho={test:Em("hsl","hue"),parse:l1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(t)+", "+bs.transform(Mr(s))+", "+bs.transform(Mr(i))+", "+Mr(Hr.transform(o))+")"},tn={test:t=>pi.test(t)||Np.test(t)||ho.test(t),parse:t=>pi.test(t)?pi.parse(t):ho.test(t)?ho.parse(t):Np.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?pi.transform(t):ho.transform(t)},ND=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function jD(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Cm))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(ND))===null||i===void 0?void 0:i.length)||0)>0}const c1="number",u1="color",CD="var",ED="var(",vy="${}",AD=/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 Gr(t){const s=t.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const p=s.replace(AD,h=>(tn.test(h)?(o.color.push(u),c.push(u1),i.push(tn.parse(h))):h.startsWith(ED)?(o.var.push(u),c.push(CD),i.push(h)):(o.number.push(u),c.push(c1),i.push(parseFloat(h))),++u,vy)).split(vy);return{values:i,split:p,indexes:o,types:c}}function d1(t){return Gr(t).values}function f1(t){const{split:s,types:i}=Gr(t),o=s.length;return c=>{let u="";for(let d=0;d<o;d++)if(u+=s[d],c[d]!==void 0){const p=i[d];p===c1?u+=Mr(c[d]):p===u1?u+=tn.transform(c[d]):u+=c[d]}return u}}const DD=t=>typeof t=="number"?0:t;function RD(t){const s=d1(t);return f1(t)(s.map(DD))}const Oa={test:jD,parse:d1,createTransformer:f1,getAnimatableNone:RD},MD=new Set(["brightness","contrast","saturate","opacity"]);function ID(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[o]=i.match(Cm)||[];if(!o)return t;const c=i.replace(o,"");let u=MD.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const OD=/\b([a-z-]*)\(.*?\)/gu,jp={...Oa,getAnimatableNone:t=>{const s=t.match(OD);return s?s.map(ID).join(" "):t}},BD={...pm,color:tn,backgroundColor:tn,outlineColor:tn,fill:tn,stroke:tn,borderColor:tn,borderTopColor:tn,borderRightColor:tn,borderBottomColor:tn,borderLeftColor:tn,filter:jp,WebkitFilter:jp},Am=t=>BD[t];function p1(t,s){let i=Am(t);return i!==jp&&(i=Oa),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const LD=new Set(["auto","none","0"]);function zD(t,s,i){let o=0,c;for(;o<t.length&&!c;){const u=t[o];typeof u=="string"&&!LD.has(u)&&Gr(u).values.length&&(c=t[o]),o++}if(c&&i)for(const u of s)t[u]=p1(i,c)}const yy=t=>t===Ao||t===we,by=(t,s)=>parseFloat(t.split(", ")[s]),_y=(t,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return by(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?by(u[1],t):0}},UD=new Set(["x","y","z"]),$D=Eo.filter(t=>!UD.has(t));function PD(t){const s=[];return $D.forEach(i=>{const o=t.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const wo={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:_y(4,13),y:_y(5,14)};wo.translateX=wo.x;wo.translateY=wo.y;const hi=new Set;let Cp=!1,Ep=!1;function m1(){if(Ep){const t=Array.from(hi).filter(o=>o.needsMeasurement),s=new Set(t.map(o=>o.element)),i=new Map;s.forEach(o=>{const c=PD(o);c.length&&(i.set(o,c),o.render())}),t.forEach(o=>o.measureInitialState()),s.forEach(o=>{o.render();const c=i.get(o);c&&c.forEach(([u,d])=>{var p;(p=o.getValue(u))===null||p===void 0||p.set(d)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}Ep=!1,Cp=!1,hi.forEach(t=>t.complete()),hi.clear()}function h1(){hi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ep=!0)})}function VD(){h1(),m1()}class Dm{constructor(s,i,o,c,u,d=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...s],this.onComplete=i,this.name=o,this.motionValue=c,this.element=u,this.isAsync=d}scheduleResolve(){this.isScheduled=!0,this.isAsync?(hi.add(this),Cp||(Cp=!0,yt.read(h1),yt.resolveKeyframes(m1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:s,name:i,element:o,motionValue:c}=this;for(let u=0;u<s.length;u++)if(s[u]===null)if(u===0){const d=c==null?void 0:c.get(),p=s[s.length-1];if(d!==void 0)s[0]=d;else if(o&&i){const h=o.readValue(i,p);h!=null&&(s[0]=h)}s[0]===void 0&&(s[0]=p),c&&d===void 0&&c.set(s[0])}else s[u]=s[u-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),hi.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,hi.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const g1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),HD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qD(t){const s=HD.exec(t);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function v1(t,s,i=1){const[o,c]=qD(t);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return g1(d)?parseFloat(d):d}return fm(c)?v1(c,s,i+1):c}const y1=t=>s=>s.test(t),GD={test:t=>t==="auto",parse:t=>t},b1=[Ao,we,bs,Da,PA,$A,GD],xy=t=>b1.find(y1(t));class _1 extends Dm{constructor(s,i,o,c,u){super(s,i,o,c,u,!0)}readKeyframes(){const{unresolvedKeyframes:s,element:i,name:o}=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(),fm(g))){const v=v1(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!Z_.has(o)||s.length!==2)return;const[c,u]=s,d=xy(c),p=xy(u);if(d!==p)if(yy(d)&&yy(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,o=[];for(let c=0;c<s.length;c++)xD(s[c])&&o.push(c);o.length&&zD(s,o,i)}measureInitialState(){const{element:s,unresolvedKeyframes:i,name:o}=this;if(!s||!s.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=wo[o](s.measureViewportBox(),window.getComputedStyle(s.current)),i[0]=this.measuredOrigin;const c=i[i.length-1];c!==void 0&&s.getValue(o,c).jump(c,!1)}measureEndState(){var s;const{element:i,name:o,unresolvedKeyframes:c}=this;if(!i||!i.current)return;const u=i.getValue(o);u&&u.jump(this.measuredOrigin,!1);const d=c.length-1,p=c[d];c[d]=wo[o](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 ky=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Oa.test(t)||t==="0")&&!t.startsWith("url("));function FD(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 ZD(t,s,i,o){const c=t[0];if(c===null)return!1;if(s==="display"||s==="visibility")return!0;const u=t[t.length-1],d=ky(c,s),p=ky(u,s);return!d||!p?!1:FD(t)||(i==="spring"||Tm(i))&&o}const KD=t=>t!==null;function pu(t,{repeat:s,repeatType:i="loop"},o){const c=t.filter(KD),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const YD=40;class x1{constructor({autoplay:s=!0,delay:i=0,type:o="keyframes",repeat:c=0,repeatDelay:u=0,repeatType:d="loop",...p}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=_s.now(),this.options={autoplay:s,delay:i,type:o,repeat:c,repeatDelay:u,repeatType:d,...p},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>YD?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&VD(),this._resolved}onKeyframesResolved(s,i){this.resolvedAt=_s.now(),this.hasAttemptedResolve=!0;const{name:o,type:c,velocity:u,delay:d,onComplete:p,onUpdate:h,isGenerator:g}=this.options;if(!g&&!ZD(s,o,c,u))if(d)this.options.duration=0;else{h&&h(pu(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 Ap=2e4;function k1(t){let s=0;const i=50;let o=t.next(s);for(;!o.done&&s<Ap;)s+=i,o=t.next(s);return s>=Ap?1/0:s}const St=(t,s,i)=>t+(s-t)*i;function Kf(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 JD({hue:t,saturation:s,lightness:i,alpha:o}){t/=360,s/=100,i/=100;let c=0,u=0,d=0;if(!s)c=u=d=i;else{const p=i<.5?i*(1+s):i+s-i*s,h=2*i-p;c=Kf(h,p,t+1/3),u=Kf(h,p,t),d=Kf(h,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Zc(t,s){return i=>i>0?s:t}const Yf=(t,s,i)=>{const o=t*t,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},WD=[Np,pi,ho],XD=t=>WD.find(s=>s.test(t));function Sy(t){const s=XD(t);if(!s)return!1;let i=s.parse(t);return s===ho&&(i=JD(i)),i}const Ty=(t,s)=>{const i=Sy(t),o=Sy(s);if(!i||!o)return Zc(t,s);const c={...i};return u=>(c.red=Yf(i.red,o.red,u),c.green=Yf(i.green,o.green,u),c.blue=Yf(i.blue,o.blue,u),c.alpha=St(i.alpha,o.alpha,u),pi.transform(c))},QD=(t,s)=>i=>s(t(i)),el=(...t)=>t.reduce(QD),Dp=new Set(["none","hidden"]);function eR(t,s){return Dp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function tR(t,s){return i=>St(t,s,i)}function Rm(t){return typeof t=="number"?tR:typeof t=="string"?fm(t)?Zc:tn.test(t)?Ty:aR:Array.isArray(t)?S1:typeof t=="object"?tn.test(t)?Ty:nR:Zc}function S1(t,s){const i=[...t],o=i.length,c=t.map((u,d)=>Rm(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function nR(t,s){const i={...t,...s},o={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(o[c]=Rm(t[c])(t[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function sR(t,s){var i;const o=[],c={color:0,var:0,number:0};for(let u=0;u<s.values.length;u++){const d=s.types[u],p=t.indexes[d][c[d]],h=(i=t.values[p])!==null&&i!==void 0?i:0;o[u]=h,c[d]++}return o}const aR=(t,s)=>{const i=Oa.createTransformer(s),o=Gr(t),c=Gr(s);return o.indexes.var.length===c.indexes.var.length&&o.indexes.color.length===c.indexes.color.length&&o.indexes.number.length>=c.indexes.number.length?Dp.has(t)&&!c.values.length||Dp.has(s)&&!o.values.length?eR(t,s):el(S1(sR(o,c),c.values),i):Zc(t,s)};function T1(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?St(t,s,i):Rm(t)(t,s)}const iR=5;function w1(t,s,i){const o=Math.max(s-iR,0);return K_(i-t(o),s-o)}const jt={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},Jf=.001;function oR({duration:t=jt.duration,bounce:s=jt.bounce,velocity:i=jt.velocity,mass:o=jt.mass}){let c,u,d=1-s;d=Ws(jt.minDamping,jt.maxDamping,d),t=Ws(jt.minDuration,jt.maxDuration,Ks(t)),d<1?(c=g=>{const v=g*d,y=v*t,_=v-i,k=Rp(g,d),S=Math.exp(-y);return Jf-_/k*S},u=g=>{const y=g*d*t,_=y*i+i,k=Math.pow(d,2)*Math.pow(g,2)*t,S=Math.exp(-y),w=Rp(Math.pow(g,2),d);return(-c(g)+Jf>0?-1:1)*((_-k)*S)/w}):(c=g=>{const v=Math.exp(-g*t),y=(g-i)*t+1;return-Jf+v*y},u=g=>{const v=Math.exp(-g*t),y=(i-g)*(t*t);return v*y});const p=5/t,h=lR(c,u,p);if(t=Zs(t),isNaN(h))return{stiffness:jt.stiffness,damping:jt.damping,duration:t};{const g=Math.pow(h,2)*o;return{stiffness:g,damping:d*2*Math.sqrt(o*g),duration:t}}}const rR=12;function lR(t,s,i){let o=i;for(let c=1;c<rR;c++)o=o-t(o)/s(o);return o}function Rp(t,s){return t*Math.sqrt(1-s*s)}const cR=["duration","bounce"],uR=["stiffness","damping","mass"];function wy(t,s){return s.some(i=>t[i]!==void 0)}function dR(t){let s={velocity:jt.velocity,stiffness:jt.stiffness,damping:jt.damping,mass:jt.mass,isResolvedFromDuration:!1,...t};if(!wy(t,uR)&&wy(t,cR))if(t.visualDuration){const i=t.visualDuration,o=2*Math.PI/(i*1.2),c=o*o,u=2*Ws(.05,1,1-(t.bounce||0))*Math.sqrt(c);s={...s,mass:jt.mass,stiffness:c,damping:u}}else{const i=oR(t);s={...s,...i,mass:jt.mass},s.isResolvedFromDuration=!0}return s}function N1(t=jt.visualDuration,s=jt.bounce){const i=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:s}:t;let{restSpeed:o,restDelta:c}=i;const u=i.keyframes[0],d=i.keyframes[i.keyframes.length-1],p={done:!1,value:u},{stiffness:h,damping:g,mass:v,duration:y,velocity:_,isResolvedFromDuration:k}=dR({...i,velocity:-Ks(i.velocity||0)}),S=_||0,w=g/(2*Math.sqrt(h*v)),N=d-u,T=Ks(Math.sqrt(h/v)),C=Math.abs(N)<5;o||(o=C?jt.restSpeed.granular:jt.restSpeed.default),c||(c=C?jt.restDelta.granular:jt.restDelta.default);let E;if(w<1){const D=Rp(T,w);E=A=>{const q=Math.exp(-w*T*A);return d-q*((S+w*T*N)/D*Math.sin(D*A)+N*Math.cos(D*A))}}else if(w===1)E=D=>d-Math.exp(-T*D)*(N+(S+T*N)*D);else{const D=T*Math.sqrt(w*w-1);E=A=>{const q=Math.exp(-w*T*A),$=Math.min(D*A,300);return d-q*((S+w*T*N)*Math.sinh($)+D*N*Math.cosh($))/D}}const R={calculatedDuration:k&&y||null,next:D=>{const A=E(D);if(k)p.done=D>=y;else{let q=0;w<1&&(q=D===0?Zs(S):w1(E,D,A));const $=Math.abs(q)<=o,Y=Math.abs(d-A)<=c;p.done=$&&Y}return p.value=p.done?d:A,p},toString:()=>{const D=Math.min(k1(R),Ap),A=J_(q=>R.next(D*q).value,D,30);return D+"ms "+A}};return R}function Ny({keyframes:t,velocity:s=0,power:i=.8,timeConstant:o=325,bounceDamping:c=10,bounceStiffness:u=500,modifyTarget:d,min:p,max:h,restDelta:g=.5,restSpeed:v}){const y=t[0],_={done:!1,value:y},k=$=>p!==void 0&&$<p||h!==void 0&&$>h,S=$=>p===void 0?h:h===void 0||Math.abs(p-$)<Math.abs(h-$)?p:h;let w=i*s;const N=y+w,T=d===void 0?N:d(N);T!==N&&(w=T-y);const C=$=>-w*Math.exp(-$/o),E=$=>T+C($),R=$=>{const Y=C($),G=E($);_.done=Math.abs(Y)<=g,_.value=_.done?T:G};let D,A;const q=$=>{k(_.value)&&(D=$,A=N1({keyframes:[_.value,S(_.value)],velocity:w1(E,$,_.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return q(0),{calculatedDuration:null,next:$=>{let Y=!1;return!A&&D===void 0&&(Y=!0,R($),q($)),D!==void 0&&$>=D?A.next($-D):(!Y&&R($),_)}}}const fR=Qr(.42,0,1,1),pR=Qr(0,0,.58,1),j1=Qr(.42,0,.58,1),mR=t=>Array.isArray(t)&&typeof t[0]!="number",hR={linear:jn,easeIn:fR,easeInOut:j1,easeOut:pR,circIn:jm,circInOut:o1,circOut:i1,backIn:Nm,backInOut:s1,backOut:n1,anticipate:a1},jy=t=>{if(wm(t)){j_(t.length===4);const[s,i,o,c]=t;return Qr(s,i,o,c)}else if(typeof t=="string")return hR[t];return t};function gR(t,s,i){const o=[],c=i||T1,u=t.length-1;for(let d=0;d<u;d++){let p=c(t[d],t[d+1]);if(s){const h=Array.isArray(s)?s[d]||jn:s;p=el(h,p)}o.push(p)}return o}function vR(t,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=t.length;if(j_(u===s.length),u===1)return()=>s[0];if(u===2&&s[0]===s[1])return()=>s[1];const d=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),s=[...s].reverse());const p=gR(s,o,c),h=p.length,g=v=>{if(d&&v<t[0])return s[0];let y=0;if(h>1)for(;y<t.length-2&&!(v<t[y+1]);y++);const _=To(t[y],t[y+1],v);return p[y](_)};return i?v=>g(Ws(t[0],t[u-1],v)):g}function yR(t,s){const i=t[t.length-1];for(let o=1;o<=s;o++){const c=To(0,s,o);t.push(St(i,1,c))}}function bR(t){const s=[0];return yR(s,t.length-1),s}function _R(t,s){return t.map(i=>i*s)}function xR(t,s){return t.map(()=>s||j1).splice(0,t.length-1)}function Kc({duration:t=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=mR(o)?o.map(jy):jy(o),u={done:!1,value:s[0]},d=_R(i&&i.length===s.length?i:bR(s),t),p=vR(d,s,{ease:Array.isArray(c)?c:xR(s,c)});return{calculatedDuration:t,next:h=>(u.value=p(h),u.done=h>=t,u)}}const kR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>yt.update(s,!0),stop:()=>Ia(s),now:()=>Wt.isProcessing?Wt.timestamp:_s.now()}},SR={decay:Ny,inertia:Ny,tween:Kc,keyframes:Kc,spring:N1},TR=t=>t/100;class Mm extends x1{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:o,element:c,keyframes:u}=this.options,d=(c==null?void 0:c.KeyframeResolver)||Dm,p=(h,g)=>this.onKeyframesResolved(h,g);this.resolver=new d(u,p,i,o,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:o=0,repeatDelay:c=0,repeatType:u,velocity:d=0}=this.options,p=Tm(i)?i:SR[i]||Kc;let h,g;p!==Kc&&typeof s[0]!="number"&&(h=el(TR,T1(s[0],s[1])),s=[0,100]);const v=p({...this.options,keyframes:s});u==="mirror"&&(g=p({...this.options,keyframes:[...s].reverse(),velocity:-d})),v.calculatedDuration===null&&(v.calculatedDuration=k1(v));const{calculatedDuration:y}=v,_=y+c,k=_*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:y,resolvedDuration:_,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:o}=this;if(!o){const{keyframes:$}=this.options;return{done:!0,value:$[$.length-1]}}const{finalKeyframe:c,generator:u,mirroredGenerator:d,mapPercentToKeyframes:p,keyframes:h,calculatedDuration:g,totalDuration:v,resolvedDuration:y}=o;if(this.startTime===null)return u.next(0);const{delay:_,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-_*(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,R=u;if(k){const $=Math.min(this.currentTime,v)/y;let Y=Math.floor($),G=$%1;!G&&$>=1&&(G=1),G===1&&Y--,Y=Math.min(Y,k+1),!!(Y%2)&&(S==="reverse"?(G=1-G,w&&(G-=w/y)):S==="mirror"&&(R=d)),E=Ws(0,1,G)*y}const D=C?{done:!1,value:h[0]}:R.next(E);p&&(D.value=p(D.value));let{done:A}=D;!C&&g!==null&&(A=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const q=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return q&&c!==void 0&&(D.value=pu(h,this.options,c)),N&&N(D.value),q&&this.finish(),D}get duration(){const{resolved:s}=this;return s?Ks(s.calculatedDuration):0}get time(){return Ks(this.currentTime)}set time(s){s=Zs(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=Ks(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:s=kR,onPlay:i,startTime:o}=this.options;this.driver||(this.driver=s(u=>this.tick(u))),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=o??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 wR=new Set(["opacity","clipPath","filter","transform"]);function NR(t,s,i,{delay:o=0,duration:c=300,repeat:u=0,repeatType:d="loop",ease:p="easeInOut",times:h}={}){const g={[s]:i};h&&(g.offset=h);const v=X_(p,c);return Array.isArray(v)&&(g.easing=v),t.animate(g,{delay:o,duration:c,easing:Array.isArray(v)?"linear":v,fill:"both",iterations:u+1,direction:d==="reverse"?"alternate":"normal"})}const jR=Sm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Yc=10,CR=2e4;function ER(t){return Tm(t.type)||t.type==="spring"||!W_(t.ease)}function AR(t,s){const i=new Mm({...s,keyframes:t,repeat:0,delay:0,isGenerator:!0});let o={done:!1,value:t[0]};const c=[];let u=0;for(;!o.done&&u<CR;)o=i.sample(u),c.push(o.value),u+=Yc;return{times:void 0,keyframes:c,duration:u-Yc,ease:"linear"}}const C1={anticipate:a1,backInOut:s1,circInOut:o1};function DR(t){return t in C1}class Cy extends x1{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new _1(u,(d,p)=>this.onKeyframesResolved(d,p),i,o,c),this.resolver.scheduleResolve()}initPlayback(s,i){let{duration:o=300,times:c,ease:u,type:d,motionValue:p,name:h,startTime:g}=this.options;if(!p.owner||!p.owner.current)return!1;if(typeof u=="string"&&Fc()&&DR(u)&&(u=C1[u]),ER(this.options)){const{onComplete:y,onUpdate:_,motionValue:k,element:S,...w}=this.options,N=AR(s,w);s=N.keyframes,s.length===1&&(s[1]=s[0]),o=N.duration,c=N.times,u=N.ease,d="keyframes"}const v=NR(p.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(gy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:y}=this.options;p.set(pu(s,this.options,i)),y&&y(),this.cancel(),this.resolveFinishedPromise()},{animation:v,duration:o,times:c,type:d,ease:u,keyframes:s}}get duration(){const{resolved:s}=this;if(!s)return 0;const{duration:i}=s;return Ks(i)}get time(){const{resolved:s}=this;if(!s)return 0;const{animation:i}=s;return Ks(i.currentTime||0)}set time(s){const{resolved:i}=this;if(!i)return;const{animation:o}=i;o.currentTime=Zs(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:o}=i;o.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 jn;const{animation:o}=i;gy(o,s)}return jn}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:o,duration:c,type:u,ease:d,times:p}=s;if(i.playState==="idle"||i.playState==="finished")return;if(this.time){const{motionValue:g,onUpdate:v,onComplete:y,element:_,...k}=this.options,S=new Mm({...k,keyframes:o,duration:c,type:u,ease:d,times:p,isGenerator:!0}),w=Zs(this.time);g.setWithVelocity(S.sample(w-Yc).value,S.sample(w).value,Yc)}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:o,repeatDelay:c,repeatType:u,damping:d,type:p}=s;if(!i||!i.owner||!(i.owner.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:g}=i.owner.getProps();return jR()&&o&&wR.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&p!=="inertia"}}const RR={type:"spring",stiffness:500,damping:25,restSpeed:10},MR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),IR={type:"keyframes",duration:.8},OR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},BR=(t,{keyframes:s})=>s.length>2?IR:Si.has(t)?t.startsWith("scale")?MR(s[1]):RR:OR;function LR({when:t,delay:s,delayChildren:i,staggerChildren:o,staggerDirection:c,repeat:u,repeatType:d,repeatDelay:p,from:h,elapsed:g,...v}){return!!Object.keys(v).length}const Im=(t,s,i,o={},c,u)=>d=>{const p=bm(o,t)||{},h=p.delay||o.delay||0;let{elapsed:g=0}=o;g=g-Zs(h);let v={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:s.getVelocity(),...p,delay:-g,onUpdate:_=>{s.set(_),p.onUpdate&&p.onUpdate(_)},onComplete:()=>{d(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:u?void 0:c};LR(p)||(v={...v,...BR(t,v)}),v.duration&&(v.duration=Zs(v.duration)),v.repeatDelay&&(v.repeatDelay=Zs(v.repeatDelay)),v.from!==void 0&&(v.keyframes[0]=v.from);let y=!1;if((v.type===!1||v.duration===0&&!v.repeatDelay)&&(v.duration=0,v.delay===0&&(y=!0)),y&&!u&&s.get()!==void 0){const _=pu(v.keyframes,p);if(_!==void 0)return yt.update(()=>{v.onUpdate(_),v.onComplete()}),new hD([])}return!u&&Cy.supports(v)?new Cy(v):new Mm(v)};function zR({protectedKeys:t,needsAnimating:s},i){const o=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function E1(t,s,{delay:i=0,transitionOverride:o,type:c}={}){var u;let{transition:d=t.getDefaultTransition(),transitionEnd:p,...h}=s;o&&(d=o);const g=[],v=c&&t.animationState&&t.animationState.getState()[c];for(const y in h){const _=t.getValue(y,(u=t.latestValues[y])!==null&&u!==void 0?u:null),k=h[y];if(k===void 0||v&&zR(v,y))continue;const S={delay:i,...bm(d||{},y)};let w=!1;if(window.MotionHandoffAnimation){const T=Y_(t);if(T){const C=window.MotionHandoffAnimation(T,y,yt);C!==null&&(S.startTime=C,w=!0)}}Tp(t,y),_.start(Im(y,_,k,t.shouldReduceMotion&&Z_.has(y)?{type:!1}:S,t,w));const N=_.animation;N&&g.push(N)}return p&&Promise.all(g).then(()=>{yt.update(()=>{p&&dD(t,p)})}),g}function Mp(t,s,i={}){var o;const c=fu(t,s,i.type==="exit"?(o=t.presenceContext)===null||o===void 0?void 0:o.custom:void 0);let{transition:u=t.getDefaultTransition()||{}}=c||{};i.transitionOverride&&(u=i.transitionOverride);const d=c?()=>Promise.all(E1(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:y,staggerDirection:_}=u;return UR(t,s,v+g,y,_,i)}:()=>Promise.resolve(),{when:h}=u;if(h){const[g,v]=h==="beforeChildren"?[d,p]:[p,d];return g().then(()=>v())}else return Promise.all([d(),p(i.delay)])}function UR(t,s,i=0,o=0,c=1,u){const d=[],p=(t.variantChildren.size-1)*o,h=c===1?(g=0)=>g*o:(g=0)=>p-g*o;return Array.from(t.variantChildren).sort($R).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(Mp(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function $R(t,s){return t.sortNodePosition(s)}function PR(t,s,i={}){t.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>Mp(t,u,i));o=Promise.all(c)}else if(typeof s=="string")o=Mp(t,s,i);else{const c=typeof s=="function"?fu(t,s,i.custom):s;o=Promise.all(E1(t,c,i))}return o.then(()=>{t.notify("AnimationComplete",s)})}const VR=rm.length;function A1(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?A1(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<VR;i++){const o=rm[i],c=t.props[o];(Vr(c)||c===!1)&&(s[o]=c)}return s}const HR=[...om].reverse(),qR=om.length;function GR(t){return s=>Promise.all(s.map(({animation:i,options:o})=>PR(t,i,o)))}function FR(t){let s=GR(t),i=Ey(),o=!0;const c=h=>(g,v)=>{var y;const _=fu(t,v,h==="exit"?(y=t.presenceContext)===null||y===void 0?void 0:y.custom:void 0);if(_){const{transition:k,transitionEnd:S,...w}=_;g={...g,...w,...S}}return g};function u(h){s=h(t)}function d(h){const{props:g}=t,v=A1(t.parent)||{},y=[],_=new Set;let k={},S=1/0;for(let N=0;N<qR;N++){const T=HR[N],C=i[T],E=g[T]!==void 0?g[T]:v[T],R=Vr(E),D=T===h?C.isActive:null;D===!1&&(S=N);let A=E===v[T]&&E!==g[T]&&R;if(A&&o&&t.manuallyAnimateOnMount&&(A=!1),C.protectedKeys={...k},!C.isActive&&D===null||!E&&!C.prevProp||uu(E)||typeof E=="boolean")continue;const q=ZR(C.prevProp,E);let $=q||T===h&&C.isActive&&!A&&R||N>S&&R,Y=!1;const G=Array.isArray(E)?E:[E];let Q=G.reduce(c(T),{});D===!1&&(Q={});const{prevResolvedValues:ae={}}=C,me={...ae,...Q},ie=Z=>{$=!0,_.has(Z)&&(Y=!0,_.delete(Z)),C.needsAnimating[Z]=!0;const ne=t.getValue(Z);ne&&(ne.liveStyle=!1)};for(const Z in me){const ne=Q[Z],re=ae[Z];if(k.hasOwnProperty(Z))continue;let ue=!1;Sp(ne)&&Sp(re)?ue=!F_(ne,re):ue=ne!==re,ue?ne!=null?ie(Z):_.add(Z):ne!==void 0&&_.has(Z)?ie(Z):C.protectedKeys[Z]=!0}C.prevProp=E,C.prevResolvedValues=Q,C.isActive&&(k={...k,...Q}),o&&t.blockInitialAnimation&&($=!1),$&&(!(A&&q)||Y)&&y.push(...G.map(Z=>({animation:Z,options:{type:T}})))}if(_.size){const N={};_.forEach(T=>{const C=t.getBaseTarget(T),E=t.getValue(T);E&&(E.liveStyle=!0),N[T]=C??null}),y.push({animation:N})}let w=!!y.length;return o&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(w=!1),o=!1,w?s(y):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(_=>{var k;return(k=_.animationState)===null||k===void 0?void 0:k.setActive(h,g)}),i[h].isActive=g;const y=d(h);for(const _ in i)i[_].protectedKeys={};return y}return{animateChanges:d,setActive:p,setAnimateFunction:u,getState:()=>i,reset:()=>{i=Ey(),o=!0}}}function ZR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!F_(s,t):!1}function oi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ey(){return{animate:oi(!0),whileInView:oi(),whileHover:oi(),whileTap:oi(),whileDrag:oi(),whileFocus:oi(),exit:oi()}}class za{constructor(s){this.isMounted=!1,this.node=s}update(){}}class KR extends za{constructor(s){super(s),s.animationState||(s.animationState=FR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();uu(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 YR=0;class JR extends za{constructor(){super(...arguments),this.id=YR++}update(){if(!this.node.presenceContext)return;const{isPresent:s,onExitComplete:i}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||s===o)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 WR={animation:{Feature:KR},exit:{Feature:JR}},as={x:!1,y:!1};function D1(){return as.x||as.y}function XR(t){return t==="x"||t==="y"?as[t]?null:(as[t]=!0,()=>{as[t]=!1}):as.x||as.y?null:(as.x=as.y=!0,()=>{as.x=as.y=!1})}const Om=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Fr(t,s,i,o={passive:!0}){return t.addEventListener(s,i,o),()=>t.removeEventListener(s,i)}function tl(t){return{point:{x:t.pageX,y:t.pageY}}}const QR=t=>s=>Om(s)&&t(s,tl(s));function Ir(t,s,i,o){return Fr(t,s,QR(i),o)}const Ay=(t,s)=>Math.abs(t-s);function e3(t,s){const i=Ay(t.x,s.x),o=Ay(t.y,s.y);return Math.sqrt(i**2+o**2)}class R1{constructor(s,i,{transformPagePoint:o,contextWindow:c,dragSnapToOrigin:u=!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 y=Xf(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,k=e3(y.offset,{x:0,y:0})>=3;if(!_&&!k)return;const{point:S}=y,{timestamp:w}=Wt;this.history.push({...S,timestamp:w});const{onStart:N,onMove:T}=this.handlers;_||(N&&N(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,y)},this.handlePointerMove=(y,_)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=Wf(_,this.transformPagePoint),yt.update(this.updatePoint,!0)},this.handlePointerUp=(y,_)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const N=Xf(y.type==="pointercancel"?this.lastMoveEventInfo:Wf(_,this.transformPagePoint),this.history);this.startEvent&&k&&k(y,N),S&&S(y,N)},!Om(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=tl(s),p=Wf(d,this.transformPagePoint),{point:h}=p,{timestamp:g}=Wt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Xf(p,this.history)),this.removeListeners=el(Ir(this.contextWindow,"pointermove",this.handlePointerMove),Ir(this.contextWindow,"pointerup",this.handlePointerUp),Ir(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ia(this.updatePoint)}}function Wf(t,s){return s?{point:s(t.point)}:t}function Dy(t,s){return{x:t.x-s.x,y:t.y-s.y}}function Xf({point:t},s){return{point:t,delta:Dy(t,M1(s)),offset:Dy(t,t3(s)),velocity:n3(s,.1)}}function t3(t){return t[0]}function M1(t){return t[t.length-1]}function n3(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,o=null;const c=M1(t);for(;i>=0&&(o=t[i],!(c.timestamp-o.timestamp>Zs(s)));)i--;if(!o)return{x:0,y:0};const u=Ks(c.timestamp-o.timestamp);if(u===0)return{x:0,y:0};const d={x:(c.x-o.x)/u,y:(c.y-o.y)/u};return d.x===1/0&&(d.x=0),d.y===1/0&&(d.y=0),d}const I1=1e-4,s3=1-I1,a3=1+I1,O1=.01,i3=0-O1,o3=0+O1;function Cn(t){return t.max-t.min}function r3(t,s,i){return Math.abs(t-s)<=i}function Ry(t,s,i,o=.5){t.origin=o,t.originPoint=St(s.min,s.max,t.origin),t.scale=Cn(i)/Cn(s),t.translate=St(i.min,i.max,t.origin)-t.originPoint,(t.scale>=s3&&t.scale<=a3||isNaN(t.scale))&&(t.scale=1),(t.translate>=i3&&t.translate<=o3||isNaN(t.translate))&&(t.translate=0)}function Or(t,s,i,o){Ry(t.x,s.x,i.x,o?o.originX:void 0),Ry(t.y,s.y,i.y,o?o.originY:void 0)}function My(t,s,i){t.min=i.min+s.min,t.max=t.min+Cn(s)}function l3(t,s,i){My(t.x,s.x,i.x),My(t.y,s.y,i.y)}function Iy(t,s,i){t.min=s.min-i.min,t.max=t.min+Cn(s)}function Br(t,s,i){Iy(t.x,s.x,i.x),Iy(t.y,s.y,i.y)}function c3(t,{min:s,max:i},o){return s!==void 0&&t<s?t=o?St(s,t,o.min):Math.max(t,s):i!==void 0&&t>i&&(t=o?St(i,t,o.max):Math.min(t,i)),t}function Oy(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 u3(t,{top:s,left:i,bottom:o,right:c}){return{x:Oy(t.x,i,c),y:Oy(t.y,s,o)}}function By(t,s){let i=s.min-t.min,o=s.max-t.max;return s.max-s.min<t.max-t.min&&([i,o]=[o,i]),{min:i,max:o}}function d3(t,s){return{x:By(t.x,s.x),y:By(t.y,s.y)}}function f3(t,s){let i=.5;const o=Cn(t),c=Cn(s);return c>o?i=To(s.min,s.max-o,t.min):o>c&&(i=To(t.min,t.max-c,s.min)),Ws(0,1,i)}function p3(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 Ip=.35;function m3(t=Ip){return t===!1?t=0:t===!0&&(t=Ip),{x:Ly(t,"left","right"),y:Ly(t,"top","bottom")}}function Ly(t,s,i){return{min:zy(t,s),max:zy(t,i)}}function zy(t,s){return typeof t=="number"?t:t[s]||0}const Uy=()=>({translate:0,scale:1,origin:0,originPoint:0}),go=()=>({x:Uy(),y:Uy()}),$y=()=>({min:0,max:0}),Rt=()=>({x:$y(),y:$y()});function qn(t){return[t("x"),t("y")]}function B1({top:t,left:s,right:i,bottom:o}){return{x:{min:s,max:i},y:{min:t,max:o}}}function h3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function g3(t,s){if(!s)return t;const i=s({x:t.left,y:t.top}),o=s({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:o.y,right:o.x}}function Qf(t){return t===void 0||t===1}function Op({scale:t,scaleX:s,scaleY:i}){return!Qf(t)||!Qf(s)||!Qf(i)}function di(t){return Op(t)||L1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function L1(t){return Py(t.x)||Py(t.y)}function Py(t){return t&&t!=="0%"}function Jc(t,s,i){const o=t-i,c=s*o;return i+c}function Vy(t,s,i,o,c){return c!==void 0&&(t=Jc(t,c,o)),Jc(t,i,o)+s}function Bp(t,s=0,i=1,o,c){t.min=Vy(t.min,s,i,o,c),t.max=Vy(t.max,s,i,o,c)}function z1(t,{x:s,y:i}){Bp(t.x,s.translate,s.scale,s.originPoint),Bp(t.y,i.translate,i.scale,i.originPoint)}const Hy=.999999999999,qy=1.0000000000001;function v3(t,s,i,o=!1){const c=i.length;if(!c)return;s.x=s.y=1;let u,d;for(let p=0;p<c;p++){u=i[p],d=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(o&&u.options.layoutScroll&&u.scroll&&u!==u.root&&yo(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,z1(t,d)),o&&di(u.latestValues)&&yo(t,u.latestValues))}s.x<qy&&s.x>Hy&&(s.x=1),s.y<qy&&s.y>Hy&&(s.y=1)}function vo(t,s){t.min=t.min+s,t.max=t.max+s}function Gy(t,s,i,o,c=.5){const u=St(t.min,t.max,c);Bp(t,s,i,u,o)}function yo(t,s){Gy(t.x,s.x,s.scaleX,s.scale,s.originX),Gy(t.y,s.y,s.scaleY,s.scale,s.originY)}function U1(t,s){return B1(g3(t.getBoundingClientRect(),s))}function y3(t,s,i){const o=U1(t,i),{scroll:c}=s;return c&&(vo(o.x,c.offset.x),vo(o.y,c.offset.y)),o}const $1=({current:t})=>t?t.ownerDocument.defaultView:null,b3=new WeakMap;class _3{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=Rt(),this.visualElement=s}start(s,{snapToCursor:i=!1}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=v=>{const{dragSnapToOrigin:y}=this.getProps();y?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(tl(v).point)},u=(v,y)=>{const{drag:_,dragPropagation:k,onDragStart:S}=this.getProps();if(_&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XR(_),!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),qn(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=Cn(E)*(parseFloat(T)/100))}}this.originPoint[N]=T}),S&&yt.postRender(()=>S(v,y)),Tp(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},d=(v,y)=>{const{dragPropagation:_,dragDirectionLock:k,onDirectionLock:S,onDrag:w}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:N}=y;if(k&&this.currentDirection===null){this.currentDirection=x3(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",y.point,N),this.updateAxis("y",y.point,N),this.visualElement.render(),w&&w(v,y)},p=(v,y)=>this.stop(v,y),h=()=>qn(v=>{var y;return this.getAnimationState(v)==="paused"&&((y=this.getAxisMotionValue(v).animation)===null||y===void 0?void 0:y.play())}),{dragSnapToOrigin:g}=this.getProps();this.panSession=new R1(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:$1(this.visualElement)})}stop(s,i){const o=this.isDragging;if(this.cancel(),!o)return;const{velocity:c}=i;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&yt.postRender(()=>u(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:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(s,i,o){const{drag:c}=this.getProps();if(!o||!Nc(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=c3(d,this.constraints[s],this.elastic[s])),u.set(d)}resolveConstraints(){var s;const{dragConstraints:i,dragElastic:o}=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,u=this.constraints;i&&mo(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=u3(c.layoutBox,i):this.constraints=!1,this.elastic=m3(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&qn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=p3(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!mo(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=y3(o,c.root,this.visualElement.getTransformPagePoint());let d=d3(c.layout.layoutBox,u);if(i){const p=i(h3(d));this.hasMutatedConstraints=!!p,p&&(d=B1(p))}return d}startAnimation(s){const{drag:i,dragMomentum:o,dragElastic:c,dragTransition:u,dragSnapToOrigin:d,onDragTransitionEnd:p}=this.getProps(),h=this.constraints||{},g=qn(v=>{if(!Nc(v,i,this.currentDirection))return;let y=h&&h[v]||{};d&&(y={min:0,max:0});const _=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:o?s[v]:0,bounceStiffness:_,bounceDamping:k,timeConstant:750,restDelta:1,restSpeed:10,...u,...y};return this.startAxisValueAnimation(v,S)});return Promise.all(g).then(p)}startAxisValueAnimation(s,i){const o=this.getAxisMotionValue(s);return Tp(this.visualElement,s),o.start(Im(s,o,0,i,this.visualElement,!1))}stopAnimation(){qn(s=>this.getAxisMotionValue(s).stop())}pauseAnimation(){qn(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()}`,o=this.visualElement.getProps(),c=o[i];return c||this.visualElement.getValue(s,(o.initial?o.initial[s]:void 0)||0)}snapToCursor(s){qn(i=>{const{drag:o}=this.getProps();if(!Nc(i,o,this.currentDirection))return;const{projection:c}=this.visualElement,u=this.getAxisMotionValue(i);if(c&&c.layout){const{min:d,max:p}=c.layout.layoutBox[i];u.set(s[i]-St(d,p,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:s,dragConstraints:i}=this.getProps(),{projection:o}=this.visualElement;if(!mo(i)||!o||!this.constraints)return;this.stopAnimation();const c={x:0,y:0};qn(d=>{const p=this.getAxisMotionValue(d);if(p&&this.constraints!==!1){const h=p.get();c[d]=f3({min:h,max:h},this.constraints[d])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),qn(d=>{if(!Nc(d,s,null))return;const p=this.getAxisMotionValue(d),{min:h,max:g}=this.constraints[d];p.set(St(h,g,c[d]))})}addListeners(){if(!this.visualElement.current)return;b3.set(this.visualElement,this);const s=this.visualElement.current,i=Ir(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();mo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:c}=this.visualElement,u=c.addEventListener("measure",o);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),yt.read(o);const d=Fr(window,"resize",()=>this.scalePositionWithinConstraints()),p=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(qn(v=>{const y=this.getAxisMotionValue(v);y&&(this.originPoint[v]+=h[v].translate,y.set(y.get()+h[v].translate))}),this.visualElement.render())}));return()=>{d(),i(),u(),p&&p()}}getProps(){const s=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:o=!1,dragPropagation:c=!1,dragConstraints:u=!1,dragElastic:d=Ip,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:p}}}function Nc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function x3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class k3 extends za{constructor(s){super(s),this.removeGroupControls=jn,this.removeListeners=jn,this.controls=new _3(s)}mount(){const{dragControls:s}=this.node.getProps();s&&(this.removeGroupControls=s.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||jn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Fy=t=>(s,i)=>{t&&yt.postRender(()=>t(s,i))};class S3 extends za{constructor(){super(...arguments),this.removePointerDownListener=jn}onPointerDown(s){this.session=new R1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:$1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Fy(s),onStart:Fy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&yt.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=Ir(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 Uc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Zy(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Sr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(we.test(t))t=parseFloat(t);else return t;const i=Zy(t,s.target.x),o=Zy(t,s.target.y);return`${i}% ${o}%`}},T3={correct:(t,{treeScale:s,projectionDelta:i})=>{const o=t,c=Oa.parse(t);if(c.length>5)return o;const u=Oa.createTransformer(t),d=typeof c[0]!="number"?1:0,p=i.x.scale*s.x,h=i.y.scale*s.y;c[0+d]/=p,c[1+d]/=h;const g=St(p,h,.5);return typeof c[2+d]=="number"&&(c[2+d]/=g),typeof c[3+d]=="number"&&(c[3+d]/=g),u(c)}};class w3 extends b.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;WA(N3),u&&(i.group&&i.group.add(u),o&&o.register&&c&&o.register(u),u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),Uc.hasEverUpdated=!0}getSnapshotBeforeUpdate(s){const{layoutDependency:i,visualElement:o,drag:c,isPresent:u}=this.props,d=o.projection;return d&&(d.isPresent=u,c||s.layoutDependency!==i||i===void 0?d.willUpdate():this.safeToRemove(),s.isPresent!==u&&(u?d.promote():d.relegate()||yt.postRender(()=>{const p=d.getStack();(!p||!p.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:s}=this.props.visualElement;s&&(s.root.didUpdate(),cm.postRender(()=>{!s.currentAnimation&&s.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o}=this.props,{projection:c}=s;c&&(c.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(c),o&&o.deregister&&o.deregister(c))}safeToRemove(){const{safeToRemove:s}=this.props;s&&s()}render(){return null}}function P1(t){const[s,i]=w_(),o=b.useContext(nm);return r.jsx(w3,{...t,layoutGroup:o,switchLayoutGroup:b.useContext(M_),isPresent:s,safeToRemove:i})}const N3={borderRadius:{...Sr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Sr,borderTopRightRadius:Sr,borderBottomLeftRadius:Sr,borderBottomRightRadius:Sr,boxShadow:T3};function j3(t,s,i){const o=nn(t)?t:qr(t);return o.start(Im("",o,s,i)),o.animation}function C3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const E3=(t,s)=>t.depth-s.depth;class A3{constructor(){this.children=[],this.isDirty=!1}add(s){_m(this.children,s),this.isDirty=!0}remove(s){xm(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(E3),this.isDirty=!1,this.children.forEach(s)}}function D3(t,s){const i=_s.now(),o=({timestamp:c})=>{const u=c-i;u>=s&&(Ia(o),t(u-s))};return yt.read(o,!0),()=>Ia(o)}const V1=["TopLeft","TopRight","BottomLeft","BottomRight"],R3=V1.length,Ky=t=>typeof t=="string"?parseFloat(t):t,Yy=t=>typeof t=="number"||we.test(t);function M3(t,s,i,o,c,u){c?(t.opacity=St(0,i.opacity!==void 0?i.opacity:1,I3(o)),t.opacityExit=St(s.opacity!==void 0?s.opacity:1,0,O3(o))):u&&(t.opacity=St(s.opacity!==void 0?s.opacity:1,i.opacity!==void 0?i.opacity:1,o));for(let d=0;d<R3;d++){const p=`border${V1[d]}Radius`;let h=Jy(s,p),g=Jy(i,p);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||Yy(h)===Yy(g)?(t[p]=Math.max(St(Ky(h),Ky(g),o),0),(bs.test(g)||bs.test(h))&&(t[p]+="%")):t[p]=g}(s.rotate||i.rotate)&&(t.rotate=St(s.rotate||0,i.rotate||0,o))}function Jy(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const I3=H1(0,.5,i1),O3=H1(.5,.95,jn);function H1(t,s,i){return o=>o<t?0:o>s?1:i(To(t,s,o))}function Wy(t,s){t.min=s.min,t.max=s.max}function Pn(t,s){Wy(t.x,s.x),Wy(t.y,s.y)}function Xy(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function Qy(t,s,i,o,c){return t-=s,t=Jc(t,1/i,o),c!==void 0&&(t=Jc(t,1/c,o)),t}function B3(t,s=0,i=1,o=.5,c,u=t,d=t){if(bs.test(s)&&(s=parseFloat(s),s=St(d.min,d.max,s/100)-d.min),typeof s!="number")return;let p=St(u.min,u.max,o);t===u&&(p-=s),t.min=Qy(t.min,s,i,p,c),t.max=Qy(t.max,s,i,p,c)}function eb(t,s,[i,o,c],u,d){B3(t,s[i],s[o],s[c],s.scale,u,d)}const L3=["x","scaleX","originX"],z3=["y","scaleY","originY"];function tb(t,s,i,o){eb(t.x,s,L3,i?i.x:void 0,o?o.x:void 0),eb(t.y,s,z3,i?i.y:void 0,o?o.y:void 0)}function nb(t){return t.translate===0&&t.scale===1}function q1(t){return nb(t.x)&&nb(t.y)}function sb(t,s){return t.min===s.min&&t.max===s.max}function U3(t,s){return sb(t.x,s.x)&&sb(t.y,s.y)}function ab(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function G1(t,s){return ab(t.x,s.x)&&ab(t.y,s.y)}function ib(t){return Cn(t.x)/Cn(t.y)}function ob(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class $3{constructor(){this.members=[]}add(s){_m(this.members,s),s.scheduleRender()}remove(s){if(xm(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 o;for(let c=i;c>=0;c--){const u=this.members[c];if(u.isPresent!==!1){o=u;break}}return o?(this.promote(o),!0):!1}promote(s,i){const o=this.lead;if(s!==o&&(this.prevLead=o,this.lead=s,s.show(),o)){o.instance&&o.scheduleRender(),s.scheduleRender(),s.resumeFrom=o,i&&(s.resumeFrom.preserveOpacity=!0),o.snapshot&&(s.snapshot=o.snapshot,s.snapshot.latestValues=o.animationValues||o.latestValues),s.root&&s.root.isUpdating&&(s.isLayoutDirty=!0);const{crossfade:c}=s.options;c===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(s=>{const{options:i,resumingFrom:o}=s;i.onExitComplete&&i.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(s=>{s.instance&&s.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function P3(t,s,i){let o="";const c=t.x.translate/s.x,u=t.y.translate/s.y,d=(i==null?void 0:i.z)||0;if((c||u||d)&&(o=`translate3d(${c}px, ${u}px, ${d}px) `),(s.x!==1||s.y!==1)&&(o+=`scale(${1/s.x}, ${1/s.y}) `),i){const{transformPerspective:g,rotate:v,rotateX:y,rotateY:_,skewX:k,skewY:S}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),y&&(o+=`rotateX(${y}deg) `),_&&(o+=`rotateY(${_}deg) `),k&&(o+=`skewX(${k}deg) `),S&&(o+=`skewY(${S}deg) `)}const p=t.x.scale*s.x,h=t.y.scale*s.y;return(p!==1||h!==1)&&(o+=`scale(${p}, ${h})`),o||"none"}const fi={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Er=typeof window<"u"&&window.MotionDebug!==void 0,ep=["","X","Y","Z"],V3={visibility:"hidden"},rb=1e3;let H3=0;function tp(t,s,i,o){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),o&&(o[t]=0))}function F1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=Y_(s);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:c,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",yt,!(c||u))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&F1(o)}function Z1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},p=s==null?void 0:s()){this.id=H3++,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,Er&&(fi.totalNodes=fi.resolvedTargetDeltas=fi.recalculatedProjection=0),this.nodes.forEach(F3),this.nodes.forEach(W3),this.nodes.forEach(X3),this.nodes.forEach(Z3),Er&&window.MotionDebug.record(fi)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=d,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 A3)}addEventListener(d,p){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new km),this.eventHandlers.get(d).add(p)}notifyListeners(d,...p){const h=this.eventHandlers.get(d);h&&h.notify(...p)}hasListeners(d){return this.eventHandlers.has(d)}mount(d,p=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=C3(d),this.instance=d;const{layoutId:h,layout:g,visualElement:v}=this.options;if(v&&!v.current&&v.mount(d),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),p&&(g||h)&&(this.isLayoutDirty=!0),t){let y;const _=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=D3(_,250),Uc.hasAnimatedSinceResize&&(Uc.hasAnimatedSinceResize=!1,this.nodes.forEach(cb))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:_,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||v.getDefaultTransition()||sM,{onLayoutAnimationStart:N,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!G1(this.targetLayout,S)||k,E=!_&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||_&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(y,E);const R={...bm(w,"layout"),onPlay:N,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(R.delay=0,R.type=!1),this.startAnimation(R)}else _||cb(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const d=this.getStack();d&&d.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ia(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(Q3),this.animationId++)}getTransformTemplate(){const{visualElement:d}=this.options;return d&&d.getProps().transformTemplate}willUpdate(d=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&F1(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let v=0;v<this.path.length;v++){const y=this.path[v];y.shouldResetTransform=!0,y.updateScroll("snapshot"),y.options.layoutRoot&&y.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(),d&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(lb);return}this.isUpdating||this.nodes.forEach(Y3),this.isUpdating=!1,this.nodes.forEach(J3),this.nodes.forEach(q3),this.nodes.forEach(G3),this.clearAllSnapshots();const p=_s.now();Wt.delta=Ws(0,1e3/60,p-Wt.timestamp),Wt.timestamp=p,Wt.isProcessing=!0,Ff.update.process(Wt),Ff.preRender.process(Wt),Ff.render.process(Wt),Wt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(K3),this.sharedNodes.forEach(eM)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,yt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){yt.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 d=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Rt(),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,d?d.layoutBox:void 0)}updateScroll(d="measure"){let p=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===d&&(p=!1),p){const h=o(this.instance);this.scroll={animationId:this.root.animationId,phase:d,isRoot:h,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!c)return;const d=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,p=this.projectionDelta&&!q1(this.projectionDelta),h=this.getTransformTemplate(),g=h?h(this.latestValues,""):void 0,v=g!==this.prevTransformTemplateValue;d&&(p||di(this.latestValues)||v)&&(c(this.instance,g),this.shouldResetTransform=!1,this.scheduleRender())}measure(d=!0){const p=this.measurePageBox();let h=this.removeElementScroll(p);return d&&(h=this.removeTransform(h)),aM(h),{animationId:this.root.animationId,measuredBox:p,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:p}=this.options;if(!p)return Rt();const h=p.measureViewportBox();if(!(((d=this.scroll)===null||d===void 0?void 0:d.wasRoot)||this.path.some(iM))){const{scroll:v}=this.root;v&&(vo(h.x,v.offset.x),vo(h.y,v.offset.y))}return h}removeElementScroll(d){var p;const h=Rt();if(Pn(h,d),!((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:y,options:_}=v;v!==this.root&&y&&_.layoutScroll&&(y.wasRoot&&Pn(h,d),vo(h.x,y.offset.x),vo(h.y,y.offset.y))}return h}applyTransform(d,p=!1){const h=Rt();Pn(h,d);for(let g=0;g<this.path.length;g++){const v=this.path[g];!p&&v.options.layoutScroll&&v.scroll&&v!==v.root&&yo(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),di(v.latestValues)&&yo(h,v.latestValues)}return di(this.latestValues)&&yo(h,this.latestValues),h}removeTransform(d){const p=Rt();Pn(p,d);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!g.instance||!di(g.latestValues))continue;Op(g.latestValues)&&g.updateSnapshot();const v=Rt(),y=g.measurePageBox();Pn(v,y),tb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return di(this.latestValues)&&tb(p,this.latestValues),p}setTargetDelta(d){this.targetDelta=d,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(d){this.options={...this.options,...d,crossfade:d.crossfade!==void 0?d.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!==Wt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(d=!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(!(d||g&&this.isSharedProjectionDirty||this.isProjectionDirty||!((p=this.parent)===null||p===void 0)&&p.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:_}=this.options;if(!(!this.layout||!(y||_))){if(this.resolvedRelativeTargetAt=Wt.timestamp,!this.targetDelta&&!this.relativeTarget){const k=this.getClosestProjectingParent();k&&k.layout&&this.animationProgress!==1?(this.relativeParent=k,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Rt(),this.relativeTargetOrigin=Rt(),Br(this.relativeTargetOrigin,this.layout.layoutBox,k.layout.layoutBox),Pn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Rt(),this.targetWithTransforms=Rt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),l3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Pn(this.target,this.layout.layoutBox),z1(this.target,this.targetDelta)):Pn(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=Rt(),this.relativeTargetOrigin=Rt(),Br(this.relativeTargetOrigin,this.target,k.target),Pn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Er&&fi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Op(this.parent.latestValues)||L1(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 d;const p=this.getLead(),h=!!this.resumingFrom||this!==p;let g=!0;if((this.isProjectionDirty||!((d=this.parent)===null||d===void 0)&&d.isProjectionDirty)&&(g=!1),h&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(g=!1),this.resolvedRelativeTargetAt===Wt.timestamp&&(g=!1),g)return;const{layout:v,layoutId:y}=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||y))return;Pn(this.layoutCorrected,this.layout.layoutBox);const _=this.treeScale.x,k=this.treeScale.y;v3(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=Rt());const{target:S}=p;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Xy(this.prevProjectionDelta.x,this.projectionDelta.x),Xy(this.prevProjectionDelta.y,this.projectionDelta.y)),Or(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==_||this.treeScale.y!==k||!ob(this.projectionDelta.x,this.prevProjectionDelta.x)||!ob(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Er&&fi.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(d=!0){var p;if((p=this.options.visualElement)===null||p===void 0||p.scheduleRender(),d){const h=this.getStack();h&&h.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=go(),this.projectionDelta=go(),this.projectionDeltaWithTransform=go()}setAnimationOrigin(d,p=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},y=go();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const _=Rt(),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(nM));this.animationProgress=0;let E;this.mixTargetDelta=R=>{const D=R/1e3;ub(y.x,d.x,D),ub(y.y,d.y,D),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Br(_,this.layout.layoutBox,this.relativeParent.layout.layoutBox),tM(this.relativeTarget,this.relativeTargetOrigin,_,D),E&&U3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Rt()),Pn(E,this.relativeTarget)),w&&(this.animationValues=v,M3(v,g,this.latestValues,D,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(d){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ia(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=yt.update(()=>{Uc.hasAnimatedSinceResize=!0,this.currentAnimation=j3(0,rb,{...d,onUpdate:p=>{this.mixTargetDelta(p),d.onUpdate&&d.onUpdate(p)},onComplete:()=>{d.onComplete&&d.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 d=this.getStack();d&&d.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(rb),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const d=this.getLead();let{targetWithTransforms:p,target:h,layout:g,latestValues:v}=d;if(!(!p||!h||!g)){if(this!==d&&this.layout&&g&&K1(this.options.animationType,this.layout.layoutBox,g.layoutBox)){h=this.target||Rt();const y=Cn(this.layout.layoutBox.x);h.x.min=d.target.x.min,h.x.max=h.x.min+y;const _=Cn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+_}Pn(p,h),yo(p,v),Or(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(d,p){this.sharedNodes.has(d)||this.sharedNodes.set(d,new $3),this.sharedNodes.get(d).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 d=this.getStack();return d?d.lead===this:!0}getLead(){var d;const{layoutId:p}=this.options;return p?((d=this.getStack())===null||d===void 0?void 0:d.lead)||this:this}getPrevLead(){var d;const{layoutId:p}=this.options;return p?(d=this.getStack())===null||d===void 0?void 0:d.prevLead:void 0}getStack(){const{layoutId:d}=this.options;if(d)return this.root.sharedNodes.get(d)}promote({needsReset:d,transition:p,preserveFollowOpacity:h}={}){const g=this.getStack();g&&g.promote(this,h),d&&(this.projectionDelta=void 0,this.needsReset=!0),p&&this.setOptions({transition:p})}relegate(){const d=this.getStack();return d?d.relegate(this):!1}resetSkewAndRotation(){const{visualElement:d}=this.options;if(!d)return;let p=!1;const{latestValues:h}=d;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(p=!0),!p)return;const g={};h.z&&tp("z",d,g,this.animationValues);for(let v=0;v<ep.length;v++)tp(`rotate${ep[v]}`,d,g,this.animationValues),tp(`skew${ep[v]}`,d,g,this.animationValues);d.render();for(const v in g)d.setStaticValue(v,g[v]),this.animationValues&&(this.animationValues[v]=g[v]);d.scheduleRender()}getProjectionStyles(d){var p,h;if(!this.instance||this.isSVG)return;if(!this.isVisible)return V3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=Lc(d==null?void 0:d.pointerEvents)||"",g.transform=v?v(this.latestValues,""):"none",g;const y=this.getLead();if(!this.projectionDelta||!this.layout||!y.target){const w={};return this.options.layoutId&&(w.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,w.pointerEvents=Lc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!di(this.latestValues)&&(w.transform=v?v({},""):"none",this.hasProjected=!1),w}const _=y.animationValues||y.latestValues;this.applyTransformsToTarget(),g.transform=P3(this.projectionDeltaWithTransform,this.treeScale,_),v&&(g.transform=v(_,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,y.animationValues?g.opacity=y===this?(h=(p=_.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:_.opacityExit:g.opacity=y===this?_.opacity!==void 0?_.opacity:"":_.opacityExit!==void 0?_.opacityExit:0;for(const w in Gc){if(_[w]===void 0)continue;const{correct:N,applyTo:T}=Gc[w],C=g.transform==="none"?_[w]:N(_[w],y);if(T){const E=T.length;for(let R=0;R<E;R++)g[T[R]]=C}else g[w]=C}return this.options.layoutId&&(g.pointerEvents=y===this?Lc(d==null?void 0:d.pointerEvents)||"":"none"),g}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(d=>{var p;return(p=d.currentAnimation)===null||p===void 0?void 0:p.stop()}),this.root.nodes.forEach(lb),this.root.sharedNodes.clear()}}}function q3(t){t.updateLayout()}function G3(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:o,measuredBox:c}=t.layout,{animationType:u}=t.options,d=i.source!==t.layout.source;u==="size"?qn(y=>{const _=d?i.measuredBox[y]:i.layoutBox[y],k=Cn(_);_.min=o[y].min,_.max=_.min+k}):K1(u,i.layoutBox,o)&&qn(y=>{const _=d?i.measuredBox[y]:i.layoutBox[y],k=Cn(o[y]);_.max=_.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+k)});const p=go();Or(p,o,i.layoutBox);const h=go();d?Or(h,t.applyTransform(c,!0),i.measuredBox):Or(h,o,i.layoutBox);const g=!q1(p);let v=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:_,layout:k}=y;if(_&&k){const S=Rt();Br(S,i.layoutBox,_.layoutBox);const w=Rt();Br(w,o,k.layoutBox),G1(S,w)||(v=!0),y.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:o,snapshot:i,delta:h,layoutDelta:p,hasLayoutChanged:g,hasRelativeTargetChanged:v})}else if(t.isLead()){const{onExitComplete:o}=t.options;o&&o()}t.options.transition=void 0}function F3(t){Er&&fi.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 Z3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function K3(t){t.clearSnapshot()}function lb(t){t.clearMeasurements()}function Y3(t){t.isLayoutDirty=!1}function J3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function cb(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function W3(t){t.resolveTargetDelta()}function X3(t){t.calcProjection()}function Q3(t){t.resetSkewAndRotation()}function eM(t){t.removeLeadSnapshot()}function ub(t,s,i){t.translate=St(s.translate,0,i),t.scale=St(s.scale,1,i),t.origin=s.origin,t.originPoint=s.originPoint}function db(t,s,i,o){t.min=St(s.min,i.min,o),t.max=St(s.max,i.max,o)}function tM(t,s,i,o){db(t.x,s.x,i.x,o),db(t.y,s.y,i.y,o)}function nM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const sM={duration:.45,ease:[.4,0,.1,1]},fb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),pb=fb("applewebkit/")&&!fb("chrome/")?Math.round:jn;function mb(t){t.min=pb(t.min),t.max=pb(t.max)}function aM(t){mb(t.x),mb(t.y)}function K1(t,s,i){return t==="position"||t==="preserve-aspect"&&!r3(ib(s),ib(i),.2)}function iM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const oM=Z1({attachResizeListener:(t,s)=>Fr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),np={current:void 0},Y1=Z1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!np.current){const t=new oM({});t.mount(window),t.setOptions({layoutScroll:!0}),np.current=t}return np.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),rM={pan:{Feature:S3},drag:{Feature:k3,ProjectionNode:Y1,MeasureLayout:P1}};function lM(t,s,i){var o;if(t instanceof Element)return[t];if(typeof t=="string"){let c=document;const u=(o=void 0)!==null&&o!==void 0?o:c.querySelectorAll(t);return u?Array.from(u):[]}return Array.from(t)}function J1(t,s){const i=lM(t),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function hb(t){return s=>{s.pointerType==="touch"||D1()||t(s)}}function cM(t,s,i={}){const[o,c,u]=J1(t,i),d=hb(p=>{const{target:h}=p,g=s(p);if(typeof g!="function"||!h)return;const v=hb(y=>{g(y),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(p=>{p.addEventListener("pointerenter",d,c)}),u}function gb(t,s,i){const{props:o}=t;t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",i==="Start");const c="onHover"+i,u=o[c];u&&yt.postRender(()=>u(s,tl(s)))}class uM extends za{mount(){const{current:s}=this.node;s&&(this.unmount=cM(s,i=>(gb(this.node,i,"Start"),o=>gb(this.node,o,"End"))))}unmount(){}}class dM extends za{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=el(Fr(this.node.current,"focus",()=>this.onFocus()),Fr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const W1=(t,s)=>s?t===s?!0:W1(t,s.parentElement):!1,fM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function pM(t){return fM.has(t.tagName)||t.tabIndex!==-1}const Ar=new WeakSet;function vb(t){return s=>{s.key==="Enter"&&t(s)}}function sp(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const mM=(t,s)=>{const i=t.currentTarget;if(!i)return;const o=vb(()=>{if(Ar.has(i))return;sp(i,"down");const c=vb(()=>{sp(i,"up")}),u=()=>sp(i,"cancel");i.addEventListener("keyup",c,s),i.addEventListener("blur",u,s)});i.addEventListener("keydown",o,s),i.addEventListener("blur",()=>i.removeEventListener("keydown",o),s)};function yb(t){return Om(t)&&!D1()}function hM(t,s,i={}){const[o,c,u]=J1(t,i),d=p=>{const h=p.currentTarget;if(!yb(p)||Ar.has(h))return;Ar.add(h);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",_),!(!yb(k)||!Ar.has(h))&&(Ar.delete(h),typeof g=="function"&&g(k,{success:S}))},y=k=>{v(k,i.useGlobalTarget||W1(h,k.target))},_=k=>{v(k,!1)};window.addEventListener("pointerup",y,c),window.addEventListener("pointercancel",_,c)};return o.forEach(p=>{!pM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",d,c),p.addEventListener("focus",g=>mM(g,c),c)}),u}function bb(t,s,i){const{props:o}=t;t.animationState&&o.whileTap&&t.animationState.setActive("whileTap",i==="Start");const c="onTap"+(i==="End"?"":i),u=o[c];u&&yt.postRender(()=>u(s,tl(s)))}class gM extends za{mount(){const{current:s}=this.node;s&&(this.unmount=hM(s,i=>(bb(this.node,i,"Start"),(o,{success:c})=>bb(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Lp=new WeakMap,ap=new WeakMap,vM=t=>{const s=Lp.get(t.target);s&&s(t)},yM=t=>{t.forEach(vM)};function bM({root:t,...s}){const i=t||document;ap.has(i)||ap.set(i,{});const o=ap.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(yM,{root:t,...s})),o[c]}function _M(t,s,i){const o=bM(s);return Lp.set(t,i),o.observe(t),()=>{Lp.delete(t),o.unobserve(t)}}const xM={some:0,all:1};class kM extends za{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:s={}}=this.node.getProps(),{root:i,margin:o,amount:c="some",once:u}=s,d={root:i?i.current:void 0,rootMargin:o,threshold:typeof c=="number"?c:xM[c]},p=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,u&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:v,onViewportLeave:y}=this.node.getProps(),_=g?v:y;_&&_(h)};return _M(this.node.current,d,p)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:s,prevProps:i}=this.node;["amount","margin","root"].some(SM(s,i))&&this.startObserver()}unmount(){}}function SM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const TM={inView:{Feature:kM},tap:{Feature:gM},focus:{Feature:dM},hover:{Feature:uM}},wM={layout:{ProjectionNode:Y1,MeasureLayout:P1}},Wc={current:null},Bm={current:!1};function X1(){if(Bm.current=!0,!!im)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>Wc.current=t.matches;t.addListener(s),s()}else Wc.current=!1}const NM=[...b1,tn,Oa],jM=t=>NM.find(y1(t)),_b=new WeakMap;function CM(t,s,i){for(const o in s){const c=s[o],u=i[o];if(nn(c))t.addValue(o,c);else if(nn(u))t.addValue(o,qr(c,{owner:t}));else if(u!==c)if(t.hasValue(o)){const d=t.getValue(o);d.liveStyle===!0?d.jump(c):d.hasAnimated||d.set(c)}else{const d=t.getStaticValue(o);t.addValue(o,qr(d!==void 0?d:c,{owner:t}))}}for(const o in i)s[o]===void 0&&t.removeValue(o);return s}const xb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class EM{scrapeMotionValuesFromProps(s,i,o){return{}}constructor({parent:s,props:i,presenceContext:o,reducedMotionConfig:c,blockInitialAnimation:u,visualState:d},p={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Dm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const k=_s.now();this.renderScheduledAt<k&&(this.renderScheduledAt=k,yt.render(this.render,!1,!0))};const{latestValues:h,renderState:g,onUpdate:v}=d;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=o,this.depth=s?s.depth+1:0,this.reducedMotionConfig=c,this.options=p,this.blockInitialAnimation=!!u,this.isControllingVariants=du(i),this.isVariantNode=D_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:y,..._}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in _){const S=_[k];h[k]!==void 0&&nn(S)&&S.set(h[k],!1)}}mount(s){this.current=s,_b.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,o)=>this.bindToMotionValue(o,i)),Bm.current||X1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Wc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){_b.delete(this.current),this.projection&&this.projection.unmount(),Ia(this.notifyUpdate),Ia(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 o=Si.has(s),c=i.on("change",p=>{this.latestValues[s]=p,this.props.onUpdate&&yt.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0)}),u=i.on("renderRequest",this.scheduleRender);let d;window.MotionCheckAppearSync&&(d=window.MotionCheckAppearSync(this,s,i)),this.valueSubscriptions.set(s,()=>{c(),u(),d&&d(),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 So){const i=So[s];if(!i)continue;const{isEnabled:o,Feature:c}=i;if(!this.features[s]&&c&&o(this.props)&&(this.features[s]=new c(this)),this.features[s]){const u=this.features[s];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Rt()}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 o=0;o<xb.length;o++){const c=xb[o];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);const u="on"+c,d=s[u];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=CM(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 o=this.values.get(s);i!==o&&(o&&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 o=this.values.get(s);return o===void 0&&i!==void 0&&(o=qr(i===null?void 0:i,{owner:this}),this.addValue(s,o)),o}readValue(s,i){var o;let c=this.latestValues[s]!==void 0||!this.current?this.latestValues[s]:(o=this.getBaseTargetFromProps(this.props,s))!==null&&o!==void 0?o:this.readValueFromInstance(this.current,s,this.options);return c!=null&&(typeof c=="string"&&(g1(c)||r1(c))?c=parseFloat(c):!jM(c)&&Oa.test(i)&&(c=p1(s,i)),this.setBaseTarget(s,nn(c)?c.get():c)),nn(c)?c.get():c}setBaseTarget(s,i){this.baseTarget[s]=i}getBaseTarget(s){var i;const{initial:o}=this.props;let c;if(typeof o=="string"||typeof o=="object"){const d=dm(this.props,o,(i=this.presenceContext)===null||i===void 0?void 0:i.custom);d&&(c=d[s])}if(o&&c!==void 0)return c;const u=this.getBaseTargetFromProps(this.props,s);return u!==void 0&&!nn(u)?u:this.initialValues[s]!==void 0&&c===void 0?void 0:this.baseTarget[s]}on(s,i){return this.events[s]||(this.events[s]=new km),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class Q1 extends EM{constructor(){super(...arguments),this.KeyframeResolver=_1}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:o}){delete i[s],delete o[s]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:s}=this.props;nn(s)&&(this.childSubscription=s.on("change",i=>{this.current&&(this.current.textContent=`${i}`)}))}}function AM(t){return window.getComputedStyle(t)}class DM extends Q1{constructor(){super(...arguments),this.type="html",this.renderInstance=$_}readValueFromInstance(s,i){if(Si.has(i)){const o=Am(i);return o&&o.default||0}else{const o=AM(s),c=(L_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return U1(s,i)}build(s,i,o){mm(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return ym(s,i,o)}}class RM extends Q1{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Rt}getBaseTargetFromProps(s,i){return s[i]}readValueFromInstance(s,i){if(Si.has(i)){const o=Am(i);return o&&o.default||0}return i=P_.has(i)?i:lm(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return q_(s,i,o)}build(s,i,o){hm(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){V_(s,i,o,c)}mount(s){this.isSVGTag=vm(s.tagName),super.mount(s)}}const MM=(t,s)=>um(t)?new RM(s):new DM(s,{allowProjection:t!==b.Fragment}),IM=oD({...WR,...TM,...rM,...wM},MM),Ct=xA(IM);function OM(){!Bm.current&&X1();const[t]=b.useState(Wc.current);return t}const BM="_overlay_cmicx_1",LM="_dialog_cmicx_11",zM="_title_cmicx_30",UM="_description_cmicx_38",$M="_actions_cmicx_45",PM="_cancelButton_cmicx_52",VM="_confirmButton_cmicx_79",ri={overlay:BM,dialog:LM,title:zM,description:UM,actions:$M,cancelButton:PM,confirmButton:VM};function bi({isOpen:t,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=b.useId(),p=b.useId();return r.jsx(os,{children:t&&r.jsx(Ct.div,{className:ri.overlay,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},onClick:u,onKeyDown:h=>{h.key==="Escape"&&u()},role:"dialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":i?p:void 0,children:r.jsxs(Ct.div,{className:ri.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:[r.jsx("h3",{id:d,className:ri.title,children:s}),i&&r.jsx("p",{id:p,className:ri.description,children:i}),r.jsxs("div",{className:ri.actions,children:[r.jsx("button",{type:"button",className:ri.cancelButton,onClick:u,autoFocus:!0,children:"Cancel"}),r.jsx("button",{type:"button",className:ri.confirmButton,onClick:c,children:o})]})]})})})}const HM="_spinner_1uyt1_1",qM="_spin_1uyt1_1",GM="_sm_1uyt1_14",FM="_md_1uyt1_20",ZM="_lg_1uyt1_26",KM="_xl_1uyt1_32",kb={spinner:HM,spin:qM,sm:GM,md:FM,lg:ZM,xl:KM};function ex({size:t="md",className:s,label:i="Loading",liveRegion:o=!1}){return r.jsx("span",{className:`${kb.spinner} ${kb[t]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const YM="_splash_1bn1g_1",JM="_logo_1bn1g_11",Sb={splash:YM,logo:JM};function tx(){return r.jsxs("div",{className:Sb.splash,"data-testid":"splash-screen",children:[r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Sb.logo}),r.jsx(ex,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const WM="_row_ldkru_1",XM="_hoverActions_ldkru_5",QM="_hoverButton_ldkru_31",e6="_selectingRow_ldkru_72",t6="_selected_ldkru_83",n6="_checkboxArea_ldkru_90",s6="_checkbox_ldkru_90",a6="_contentArea_ldkru_106",ts={row:WM,hoverActions:XM,hoverButton:QM,selectingRow:e6,selected:t6,checkboxArea:n6,checkbox:s6,contentArea:a6};function i6({copyText:t,isContentBearing:s,isSelecting:i,isSelected:o,checkboxLabel:c,onSelect:u,onToggle:d,onCopied:p,children:h}){const[g,v]=b.useState(!1),y=b.useRef(void 0);b.useEffect(()=>()=>{y.current!==void 0&&clearTimeout(y.current)},[]);const _=b.useCallback(async()=>{try{await navigator.clipboard.writeText(t),v(!0),p==null||p(),y.current!==void 0&&clearTimeout(y.current),y.current=setTimeout(()=>{v(!1)},2e3)}catch{}},[t,p]),k=b.useCallback(S=>{!i||S.target.closest("a, button, input, textarea, select, [role=button]")||(S.preventDefault(),d(S.shiftKey))},[i,d]);return s?i?r.jsxs("div",{className:`${ts.row} ${ts.selectingRow} ${o?ts.selected:""}`,onClick:k,"data-testid":"event-selectable-row",children:[r.jsx("div",{className:ts.checkboxArea,children:r.jsx("input",{type:"checkbox",checked:o,onChange:S=>{d(S.nativeEvent.shiftKey)},onClick:S=>{S.stopPropagation()},className:ts.checkbox,"aria-label":c??"Select this event","data-testid":"event-select-checkbox"})}),r.jsx("div",{className:ts.contentArea,children:h})]}):r.jsxs("div",{className:ts.row,"data-testid":"event-hover-row",children:[r.jsxs("div",{className:ts.hoverActions,"data-testid":"event-hover-actions",children:[r.jsx("button",{type:"button",className:ts.hoverButton,onClick:()=>{_().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?r.jsx(_i,{size:it,"aria-hidden":"true"}):r.jsx(Qb,{size:it,"aria-hidden":"true"})}),r.jsx("button",{type:"button",className:ts.hoverButton,onClick:u,"aria-label":"Select this event","data-testid":"event-hover-select",children:r.jsx(O2,{size:it,"aria-hidden":"true"})})]}),h]}):r.jsx("div",{className:ts.row,children:h})}const o6="_bar_1vah7_1",r6="_left_1vah7_21",l6="_right_1vah7_27",c6="_count_1vah7_33",u6="_toggleButton_1vah7_40",d6="_copyButton_1vah7_68",f6="_cancelButton_1vah7_108",li={bar:o6,left:r6,right:l6,count:c6,toggleButton:u6,copyButton:d6,cancelButton:f6};function p6({selectedCount:t,totalSelectable:s,onSelectAll:i,onDeselectAll:o,onCopy:c,onCancel:u}){const d=t>0&&t>=s;return r.jsxs(Ct.div,{className:li.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:[r.jsxs("div",{className:li.left,children:[r.jsxs("span",{className:li.count,"data-testid":"floating-bar-count",children:[t," selected"]}),r.jsx("button",{type:"button",className:li.toggleButton,onClick:d?o:i,"data-testid":"floating-bar-select-all",children:d?"Deselect all":"Select all"})]}),r.jsxs("div",{className:li.right,children:[r.jsxs("button",{type:"button",className:li.copyButton,onClick:c,disabled:t===0,"data-testid":"floating-bar-copy",children:[r.jsx(QT,{size:it,"aria-hidden":"true"}),"Copy"]}),r.jsx("button",{type:"button",className:li.cancelButton,onClick:u,"aria-label":"Cancel selection","data-testid":"floating-bar-cancel",children:r.jsx(Ba,{size:it,"aria-hidden":"true"})})]})]})}const nx=50;function m6(t,s,i,o,c=nx){return o?t<c:s-t-i<c}function h6(t,s){const i=s-t;return i>0?i:0}function g6({scrollRef:t,contentLength:s,isReversed:i,paused:o}){const[c,u]=b.useState(!0),d=b.useRef(0),p=b.useRef(!1),h=b.useRef(0);b.useEffect(()=>{const v=t.current;if(!v)return;let y=!0;const _=()=>{h.current||(h.current=requestAnimationFrame(()=>{h.current=0;const k=m6(v.scrollTop,v.scrollHeight,v.clientHeight,i,nx);k!==y&&(y=k,u(k))}))};return v.addEventListener("scroll",_,{passive:!0}),()=>{v.removeEventListener("scroll",_),h.current&&(cancelAnimationFrame(h.current),h.current=0)}},[t,i]),b.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,i?v.scrollTop=0:v.scrollTop=v.scrollHeight,u(!0))},[t,i]),b.useLayoutEffect(()=>{const v=t.current;if(v){if(o){d.current=v.scrollHeight;return}if(i&&!c){const y=h6(d.current,v.scrollHeight);y>0&&(v.scrollTop+=y)}c&&(i?v.scrollTo({top:0,behavior:"smooth"}):v.scrollTo({top:v.scrollHeight,behavior:"smooth"})),d.current=v.scrollHeight}},[s,c,i,o,t]);const g=b.useCallback(()=>{const v=t.current;if(!v)return;const y=i?0:v.scrollHeight;v.scrollTo({top:y,behavior:"smooth"}),u(!0)},[t,i]);return{isAtAnchor:c,scrollToAnchor:g}}const v6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function Zr(t){return v6.has(t.eventType)}function y6(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 o=JSON.parse(t.content);typeof o.content=="string"&&(i=o.content)}catch{}return i}case"tool_use":try{const i=JSON.parse(t.content),o=i.tool??"tool",c=i.args!==void 0?JSON.stringify(i.args,void 0,2):"";return`${o}
264
- ${c}`}catch{return t.content}default:return t.content}}function Tb(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 b6(t){var i;const s=[];for(const o of t){if(!Zr(o))continue;const c=new Date(o.timestamp).toLocaleTimeString();switch(o.eventType){case"text":case"output":{s.push(`**Assistant** (${c}):
265
- ${o.content}`);break}case"user_input":{s.push(`**User** (${c}):
266
- ${o.content}`);break}case"tool_result":{let u=((i=o.toolUseCtx)==null?void 0:i.detailedResult)??void 0;if(!u&&(u=o.content,o.content.trimStart().startsWith("{")))try{const d=JSON.parse(o.content);typeof d.content=="string"&&(u=d.content)}catch{}if(o.toolUseCtx){const d=Tb(o.toolUseCtx.args),p=d?`**Tool: ${o.toolUseCtx.tool}** ${d}`:`**Tool: ${o.toolUseCtx.tool}**`;s.push(`${p} (${c}):
267
- ${u}`)}else s.push(`**Tool output** (${c}):
268
- ${u}`);break}case"tool_use":{let u="tool",d;try{const g=JSON.parse(o.content);u=g.tool??"tool",d=g.args}catch{}const p=Tb(d),h=p?`**Tool: ${u}** ${p}`:`**Tool: ${u}**`;d!==void 0?s.push(`${h} (${c}):
269
- \`\`\`json
270
- ${JSON.stringify(d,void 0,2)}
271
- \`\`\``):s.push(`${h} (${c}):`);break}case"error":{s.push(`**Error** (${c}):
272
- ${o.content}`);break}}}return s.join(`
273
-
274
- `)}function _6({events:t,formatForClipboard:s}){const[i,o]=b.useState(!1),[c,u]=b.useState(new Set),d=b.useRef(void 0),p=b.useMemo(()=>c.size,[c]),h=b.useCallback(S=>{o(!0),S!==void 0?(u(new Set([S])),d.current=S):(u(new Set),d.current=void 0)},[]),g=b.useCallback(()=>{o(!1),u(new Set),d.current=void 0},[]),v=b.useCallback((S,w)=>{if(w&&d.current!==void 0){const N=Math.min(d.current,S),T=Math.max(d.current,S);u(C=>{const E=new Set(C);for(let R=N;R<=T;R++)R<t.length&&Zr(t[R])&&E.add(R);return E})}else u(N=>{const T=new Set(N);return T.has(S)?T.delete(S):T.add(S),T.size===0?(o(!1),d.current=void 0):d.current=S,T})},[t]),y=b.useCallback(()=>{const S=new Set;for(let w=0;w<t.length;w++)Zr(t[w])&&S.add(w);u(S)},[t]),_=b.useCallback(()=>{u(new Set)},[]),k=b.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:y,deselectAll:_,copySelected:k}}const x6="_wrapper_1cdza_1",k6="_scrollContainer_1cdza_9",S6="_selectingPadding_1cdza_16",T6="_toolbar_1cdza_20",w6="_directionToggle_1cdza_27",N6="_scrollToAnchor_1cdza_65",j6="_scrollToAnchorBottom_1cdza_89",C6="_scrollToAnchorTop_1cdza_93",E6="_eventOverflowWarning_1cdza_97",Gs={wrapper:x6,scrollContainer:k6,selectingPadding:S6,toolbar:T6,directionToggle:w6,scrollToAnchor:N6,scrollToAnchorBottom:j6,scrollToAnchorTop:C6,eventOverflowWarning:E6};function A6(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 sx="grackle-stream-direction";function D6(){try{return localStorage.getItem(sx)==="reversed"}catch{return!1}}function R6({eventsDropped:t}){return t<=0?r.jsx(r.Fragment,{}):r.jsxs("div",{className:Gs.eventOverflowWarning,role:"alert",children:[r.jsx(Gp,{size:Gt,"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 Lm({events:t,eventsDropped:s,emptyState:i,onShowToast:o}){const c=b.useRef(null),[u,d]=b.useState(D6),p=OM(),h=_6({events:t,formatForClipboard:b6}),g=b.useMemo(()=>t.filter(Zr).length,[t]),v=b.useMemo(()=>u?[...t].reverse():t,[t,u]),{isAtAnchor:y,scrollToAnchor:_}=g6({scrollRef:c,contentLength:t.length,isReversed:u,paused:h.isSelecting}),k=()=>{const T=!u;d(T);try{localStorage.setItem(sx,T?"reversed":"default")}catch{}};b.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=b.useCallback(async()=>{await h.copySelected()&&(o==null||o(`Copied ${h.selectedCount} message${h.selectedCount===1?"":"s"} to clipboard`,"success"))},[h,o]),w=p?0:.2,N=u?-8:8;return r.jsxs("div",{className:Gs.wrapper,children:[r.jsx("div",{className:Gs.toolbar,children:r.jsx("button",{className:Gs.directionToggle,onClick:k,title:u?"Showing newest first":"Showing oldest first","aria-label":u?"Switch to newest at bottom":"Switch to newest at top","data-testid":"direction-toggle",children:u?r.jsx(G0,{size:Gt,"aria-hidden":"true"}):r.jsx(F0,{size:Gt,"aria-hidden":"true"})})}),r.jsxs("div",{ref:c,className:`${Gs.scrollContainer} ${h.isSelecting?Gs.selectingPadding:""}`,"data-testid":"event-stream-scroll",children:[t.length===0&&i,r.jsx(R6,{eventsDropped:s}),r.jsx(os,{initial:!1,children:v.map((T,C)=>{const E=u?t.length-1-C:C;return r.jsx(Ct.div,{initial:{opacity:0,y:N},animate:{opacity:1,y:0},transition:{duration:w,ease:"easeOut"},children:r.jsx(i6,{copyText:y6(T),isContentBearing:Zr(T),isSelecting:h.isSelecting,isSelected:h.selectedIndices.has(E),checkboxLabel:A6(T),onSelect:()=>{h.enterSelectionMode(E)},onToggle:R=>{h.toggleEvent(E,R)},onCopied:()=>{o==null||o("Copied to clipboard","success")},children:r.jsx(cA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${E}`)})})]}),r.jsx(os,{children:h.isSelecting&&r.jsx(p6,{selectedCount:h.selectedCount,totalSelectable:g,onSelectAll:h.selectAll,onDeselectAll:h.deselectAll,onCopy:()=>{S().catch(()=>{})},onCancel:h.cancelSelection})}),r.jsx(os,{children:!y&&r.jsxs(Ct.button,{className:`${Gs.scrollToAnchor} ${u?Gs.scrollToAnchorTop:Gs.scrollToAnchorBottom}`,onClick:_,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[u?r.jsx(F0,{size:Gt,"aria-hidden":"true"}):r.jsx(G0,{size:Gt,"aria-hidden":"true"})," New events"]})})]})}function zm(t){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:p=!0,trimOnSave:h=!0}=t,[g,v]=b.useState(""),[y,_]=b.useState(""),k=b.useRef(!1),S=u===c,w=b.useCallback(q=>{v(q),_("")},[]),N=b.useCallback(()=>{_("")},[]),T=b.useCallback(()=>{k.current=!1,d==null||d(null),v(""),_("")},[d]),C=b.useCallback(()=>{const q=h?g.trim():g;if(o){const Y=o(g);if(Y){_(Y);return}}const $=h?s.trim():s;if(q===$){T();return}i(q),T()},[g,s,h,o,i,T]),E=b.useCallback(()=>{k.current=!0,d==null||d(c),v(s),_("")},[c,s,d]),R=b.useCallback(q=>{if(k.current){k.current=!1;return}q.relatedTarget instanceof HTMLElement&&q.relatedTarget.dataset.editAction===c||C()},[c,C]),D=b.useCallback(q=>{q.key==="Escape"?T():q.key==="Enter"&&p&&C()},[T,p,C]),A=(()=>{if(!S)return!1;const q=h?s.trim():s;return(h?g.trim():g)!==q})();return b.useEffect(()=>{!S&&(g!==""||y!=="")&&(v(""),_(""))},[S,g,y]),{isEditing:S,draft:g,error:y,isDirty:A,startEdit:E,cancelEdit:T,save:C,setDraft:w,clearError:N,handleBlur:R,handleKeyDown:D,ignoreInitialBlurRef:k}}const M6="_editFieldWrapper_yuzty_1",I6="_editInput_yuzty_10",O6="_editTextarea_yuzty_42",B6="_editSelect_yuzty_78",L6="_editError_yuzty_111",z6="_editInputInvalid_yuzty_118",U6="_editHint_yuzty_123",$6="_unsavedDot_yuzty_132",P6="_metaValueClickable_yuzty_140",V6="_editButton_yuzty_159",H6="_metaPlaceholder_yuzty_175",q6="_worktreeToggle_yuzty_180",Xe={editFieldWrapper:M6,editInput:I6,editTextarea:O6,editSelect:B6,editError:L6,editInputInvalid:z6,editHint:U6,unsavedDot:$6,metaValueClickable:P6,editButton:V6,metaPlaceholder:H6,worktreeToggle:q6};function Xt(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="text",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,maxLength:y,ariaLabel:_,"data-testid":k}=t,S=b.useRef(null),w=zm({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!0,trimOnSave:!0});if(b.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=o==null?void 0:o(s);return r.jsxs("div",{className:Xe.editFieldWrapper,children:[r.jsx("input",{className:`${Xe.editInput} ${C?Xe.editInputInvalid:""}`,value:s,onChange:T,maxLength:y,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),C&&r.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:C})]})}if(w.isEditing)return r.jsxs("div",{className:Xe.editFieldWrapper,children:[r.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:y,placeholder:v,"aria-label":_,"data-testid":k?`${k}-input`:void 0}),w.isDirty&&r.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),w.error&&r.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:w.error}),r.jsx("span",{className:Xe.editHint,children:"Enter to save · Esc to cancel"})]});const N=g==null?void 0:g(s);return r.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":_,"data-testid":k?`${k}-button`:void 0,children:[N!==void 0?N:s?r.jsx("span",{children:s}):r.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function zp(t){const{value:s,onSave:i,validate:o,mode:c="edit",fieldId:u="textarea",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:y,"data-testid":_}=t,k=b.useRef(null),S=zm({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});if(b.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=o==null?void 0:o(s);return r.jsxs("div",{className:Xe.editFieldWrapper,children:[r.jsx("textarea",{className:`${Xe.editTextarea} ${T?Xe.editInputInvalid:""}`,value:s,onChange:N,placeholder:v,"aria-label":y,"data-testid":_?`${_}-input`:void 0}),T&&r.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:T})]})}if(S.isEditing)return r.jsxs("div",{className:Xe.editFieldWrapper,children:[r.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:y,"aria-label":y,"data-testid":_?`${_}-input`:void 0}),S.isDirty&&r.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),S.error&&r.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:S.error}),r.jsx("span",{className:Xe.editHint,children:"Tab to save · Esc to cancel"})]});const w=g==null?void 0:g(s);return r.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":y,"data-testid":_?`${_}-button`:void 0,children:[w!==void 0?w:s?r.jsx("span",{children:s}):r.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function Xc(t){var E;const{value:s,onSave:i,mode:o="edit",options:c,fieldId:u="select",activeFieldId:d,onActivate:p,onChange:h,renderDisplay:g,placeholder:v,ariaLabel:y,"data-testid":_}=t,k=b.useRef(null),S=zm({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});b.useEffect(()=>{if(S.isEditing){const R=window.setTimeout(()=>{var D;(D=k.current)==null||D.focus()},0);return()=>window.clearTimeout(R)}},[S.isEditing]);const w=b.useCallback(R=>{const D=R.target.value;S.ignoreInitialBlurRef.current=!1,D!==s&&i(D),S.cancelEdit()},[s,i,S]),N=b.useCallback(R=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}R.relatedTarget instanceof HTMLElement&&R.relatedTarget.dataset.editAction===u||S.cancelEdit()},[u,S]);if(o==="create")return r.jsx("select",{className:Xe.editSelect,value:s,onChange:R=>h==null?void 0:h(R.target.value),"aria-label":y,"data-testid":_?`${_}-select`:void 0,children:c.map(R=>r.jsx("option",{value:R.value,children:R.label},R.value))});if(S.isEditing)return r.jsx("select",{ref:k,className:Xe.editSelect,value:S.draft,onChange:w,onBlur:N,title:y,"aria-label":y,"data-testid":_?`${_}-select`:void 0,children:c.map(R=>r.jsx("option",{value:R.value,children:R.label},R.value))});const T=g==null?void 0:g(s),C=(E=c.find(R=>R.value===s))==null?void 0:E.label;return r.jsxs("button",{type:"button",className:Xe.metaValueClickable,onClick:()=>S.startEdit(),title:"Click to change","aria-label":y,"data-testid":_?`${_}-button`:void 0,children:[T!==void 0?T:C?r.jsx("span",{children:C}):r.jsx("span",{className:Xe.metaPlaceholder,children:v||"None"}),r.jsx("span",{className:Xe.editButton,"aria-hidden":"true",children:"✏️"})]})}function G6(t){const{checked:s,onChange:i,label:o,ariaLabel:c,"data-testid":u}=t;return r.jsxs("label",{className:Xe.worktreeToggle,"data-testid":u,children:[r.jsx("input",{type:"checkbox",checked:s,onChange:d=>i(d.target.checked),"aria-label":c}),r.jsx("span",{children:o})]})}const F6="_envRow_1e1r5_1",Z6="_envDot_1e1r5_7",K6="_envDotGreen_1e1r5_14",Y6="_envDotYellow_1e1r5_18",J6="_envDotRed_1e1r5_22",W6="_envDotGray_1e1r5_26",bo={envRow:F6,envDot:Z6,envDotGreen:K6,envDotYellow:Y6,envDotRed:J6,envDotGray:W6};function X6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?bo.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?bo.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?bo.envDotRed:bo.envDotGray}function Q6(t){const{value:s,onSave:i,environments:o,allowNone:c=!1,fieldId:u="environment",activeFieldId:d,onActivate:p,placeholder:h="No environment",ariaLabel:g="Environment","data-testid":v}=t,y=o.find(S=>S.id===s),_=[...c?[{value:"",label:"None"}]:[],...o.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(y)return r.jsxs("span",{className:bo.envRow,children:[r.jsx("span",{className:`${bo.envDot} ${X6(y.status)}`}),y.displayName]})};return r.jsx(Xc,{value:s,onSave:i,options:_,fieldId:u,activeFieldId:d,onActivate:p,renderDisplay:k,placeholder:h,ariaLabel:g,"data-testid":v})}const e4="_nav_1snmp_1",t4="_searchForm_1snmp_8",n4="_searchInput_1snmp_15",s4="_searchButton_1snmp_33",a4="_clearButton_1snmp_68",i4="_workspaceSelect_1snmp_85",o4="_listHeader_1snmp_99",r4="_nodeList_1snmp_108",l4="_nodeItem_1snmp_116",c4="_indicator_1snmp_129",u4="_label_1snmp_136",d4="_badge_1snmp_145",Vn={nav:e4,searchForm:t4,searchInput:n4,searchButton:s4,clearButton:a4,workspaceSelect:i4,listHeader:o4,nodeList:r4,nodeItem:l4,indicator:c4,label:u4,badge:d4};function f4({nodes:t,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:p}){const[h,g]=b.useState(""),v=b.useCallback(S=>{S.preventDefault(),h.trim()&&c(h.trim())},[h,c]),y=b.useCallback(()=>{g(""),u()},[u]),_=b.useCallback(S=>{d(S)},[d]),k=b.useCallback(S=>{g(""),p(S)},[p]);return r.jsxs("div",{className:Vn.nav,"data-testid":"knowledge-nav",children:[r.jsxs("form",{className:Vn.searchForm,onSubmit:v,children:[r.jsx("input",{className:Vn.searchInput,type:"text",placeholder:"Search...",value:h,onChange:S=>{g(S.target.value)},"data-testid":"knowledge-search-input"}),r.jsx("button",{type:"submit",className:Vn.searchButton,disabled:i,children:"Go"})]}),o&&r.jsx("button",{type:"button",className:Vn.clearButton,onClick:y,children:"Clear search"}),r.jsxs("select",{className:Vn.workspaceSelect,onChange:S=>{k(S.target.value)},"data-testid":"knowledge-workspace-filter",children:[r.jsx("option",{value:"",children:"All workspaces"}),s.map(S=>r.jsx("option",{value:S.id,children:S.name},S.id))]}),r.jsxs("div",{className:Vn.listHeader,children:["Nodes (",t.length,")"]}),r.jsx("ul",{className:Vn.nodeList,children:t.map(S=>r.jsxs("li",{className:Vn.nodeItem,onClick:()=>{_(S.id)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),_(S.id))},role:"button",tabIndex:0,children:[r.jsx("span",{className:Vn.indicator,style:{backgroundColor:S.kind==="reference"?"#4A9EFF":S.category==="decision"?"#22C55E":S.category==="concept"?"#A855F7":S.category==="snippet"?"#6B7280":"#EAB308"}}),r.jsx("span",{className:Vn.label,children:S.label}),r.jsx("span",{className:Vn.badge,children:S.kind==="reference"?S.sourceType:S.category})]},S.id))})]})}const p4="_container_1mq5u_1",m4="_hamburger_1mq5u_33",h4="_brand_1mq5u_49",g4="_brandLogo_1mq5u_68",v4="_info_1mq5u_75",y4="_connectionLabel_1mq5u_90",b4="_connectionDot_1mq5u_103",_4="_connected_1mq5u_106",x4="_disconnected_1mq5u_110",Hs={container:p4,hamburger:m4,brand:h4,brandLogo:g4,info:v4,connectionLabel:y4,connectionDot:b4,connected:_4,disconnected:x4};function k4({connected:t,environments:s,sessions:i,onToggleSidebar:o,sidebarOpen:c}){const u=bt(),d=s.length,p=s.filter(g=>g.status==="connected").length,h=i.filter(g=>["running","idle"].includes(g.status)).length;return r.jsxs("div",{className:Hs.container,children:[o&&r.jsx("button",{type:"button",className:Hs.hamburger,onClick:o,"aria-label":"Toggle sidebar","aria-expanded":c,children:r.jsx(_2,{size:Mt,"aria-hidden":"true"})}),r.jsxs("button",{type:"button",className:Hs.brand,onClick:()=>u(yi),title:"Home",children:[r.jsx("img",{src:"/icon-192x192.png",alt:"",className:Hs.brandLogo,"aria-hidden":"true","data-testid":"statusbar-logo"}),"Grackle"]}),r.jsxs("div",{className:Hs.info,children:[r.jsxs("span",{"aria-label":t?"Connected":"Disconnected",children:[r.jsx("span",{className:`${Hs.connectionDot} ${t?Hs.connected:Hs.disconnected}`,"aria-hidden":"true",children:r.jsx(Ra,{size:Fp,fill:"currentColor"})})," ",r.jsx("span",{className:Hs.connectionLabel,"aria-hidden":"true",children:t?"Connected":"Disconnected"})]}),r.jsxs("span",{children:[p,"/",d," env",d!==1?"s":""]}),r.jsxs("span",{children:[h," active"]})]})]})}const S4="_nav_13gkc_1",T4="_tab_13gkc_35",w4="_tabIcon_13gkc_68",N4="_tabLabel_13gkc_79",j4="_tabActive_13gkc_84",Tr={nav:S4,tab:T4,tabIcon:w4,tabLabel:N4,tabActive:j4},ci=[{view:"dashboard",label:"Dashboard",icon:r.jsx(r2,{size:Mt}),route:yi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:r.jsx(k2,{size:Mt}),route:qN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:r.jsx(KT,{size:Mt}),route:GN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:r.jsx(T2,{size:Mt}),route:xo,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:r.jsx(VT,{size:Mt}),route:k_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:r.jsx(e_,{size:Mt}),route:ru,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:r.jsx(M2,{size:Mt}),route:$N,testId:"sidebar-tab-settings"}];function C4(t){return t===yi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(k_)?"knowledge":t.startsWith(ru)?"findings":t.startsWith(_o)?"settings":"tasks"}function E4(){const t=Pt(),s=bt(),i=b.useRef(null),o=C4(t.pathname),c=b.useCallback(d=>{s(d.route)},[s]),u=b.useCallback(d=>{var y,_;const p=(y=i.current)==null?void 0:y.querySelectorAll('[role="tab"]');if(!p)return;const h=Array.from(p).findIndex(k=>k===document.activeElement),g=h>=0?h:ci.findIndex(k=>k.view===o);let v=g;if(d.key==="ArrowRight"||d.key==="j"||d.key==="J")d.preventDefault(),v=(g+1)%ci.length;else if(d.key==="ArrowLeft"||d.key==="k"||d.key==="K")d.preventDefault(),v=(g-1+ci.length)%ci.length;else if(d.key==="Home")d.preventDefault(),v=0;else if(d.key==="End")d.preventDefault(),v=ci.length-1;else return;s(ci[v].route),(_=p[v])==null||_.focus()},[o,s]);return r.jsx("nav",{className:Tr.nav,ref:i,role:"tablist","aria-orientation":"horizontal","aria-label":"App navigation",onKeyDown:u,"data-testid":"sidebar-nav",children:ci.map(d=>{const p=d.view===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":p,tabIndex:p?0:-1,className:`${Tr.tab} ${p?Tr.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[r.jsx("span",{className:Tr.tabIcon,"aria-hidden":"true",children:d.icon}),r.jsx("span",{className:Tr.tabLabel,children:d.label})]},d.view)})})}const A4="_container_pi6ii_1",D4="_content_pi6ii_66",wb={container:A4,content:D4},R4=320,ax=220,ix=600,ox="grackle-sidebar-width";function M4(){try{const t=localStorage.getItem(ox);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=ax&&s<=ix)return s}}catch{}return R4}function I4(t){try{localStorage.setItem(ox,String(t))}catch{}}function O4({content:t}){const[s]=b.useState(M4),i=b.useRef(null);if(b.useEffect(()=>{const o=i.current;if(!o)return;const c=new ResizeObserver(u=>{for(const d of u){const p=d.borderBoxSize[0];if(p){const h=Math.round(p.inlineSize);h>=ax&&h<=ix&&I4(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),t!==void 0)return r.jsx("div",{className:wb.container,ref:i,"data-testid":"sidebar",style:{width:s},children:r.jsx("div",{className:wb.content,children:t})})}const B4="_bar_tnfsh_1",L4="_btnPrimary_tnfsh_32",z4="_statusText_tnfsh_85",U4="_statusCompleted_tnfsh_90",$4="_statusFailed_tnfsh_94",P4="_statusBlocked_tnfsh_98",V4="_hintText_tnfsh_103",kt={bar:B4,btnPrimary:L4,statusText:z4,statusCompleted:U4,statusFailed:$4,statusBlocked:P4,hintText:V4};function H4({sessions:t,tasks:s,environments:i}){const o=bt(),c=Pt(),u=Nt("/sessions/:sessionId"),d=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"),y=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream"),_=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=Nt("/sessions/new"),w=Nt("/environments/:environmentId/workspaces/:workspaceId"),N=Nt("/tasks/new"),T=Nt("/chat"),C=Nt("/"),E=Nt("/settings/*"),R=u==null?void 0:u.params.sessionId,D=(d==null?void 0:d.params.taskId)??(p==null?void 0:p.params.taskId)??(h==null?void 0:h.params.taskId)??(v==null?void 0:v.params.taskId)??(y==null?void 0:y.params.taskId)??(_==null?void 0:_.params.taskId)??(k==null?void 0:k.params.taskId),A=v??y??_??k,q=(A==null?void 0:A.params.environmentId)??(w==null?void 0:w.params.environmentId),$=c.pathname.startsWith("/environments")&&!w&&!A,Y=!!T,G=!!S,Q=!!w&&!v&&!y&&!_&&!k,ae=!!N;if(!!C&&!G&&!Q&&!ae||!!E||(!!g||!!k)||ae||$||G)return r.jsx(r.Fragment,{});if(Y)return i.find(Z=>Z.adapterType==="local"&&Z.status==="connected")?r.jsx(r.Fragment,{}):r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Add a local environment to start chatting"})});if(Q)return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Select a task or click + to create one"})});if(D){const B=s.find(re=>re.id===D);if(!B)return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Loading..."})});const Z=new Map(s.map(re=>[re.id,re])),ne=B.dependsOn.some(re=>{const ue=Z.get(re);return ue!==void 0&&ue.status!=="complete"});if(B.status==="not_started"){const re=ne?B.dependsOn.map(ue=>Z.get(ue)).filter(ue=>ue&&ue.status!=="complete").map(ue=>ue.title):[];return r.jsx("div",{className:kt.bar,children:ne?r.jsxs("span",{className:kt.statusBlocked,children:["Blocked by: ",re.join(", ")]}):r.jsx("span",{className:kt.hintText,children:"Use the buttons above to start or manage this task"})})}if(B.status==="working"||B.status==="paused"){const re=B.latestSessionId||void 0,ue=re?t.find(je=>je.id===re):void 0;return ue&&ue.status!=="stopped"?r.jsx(r.Fragment,{}):r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Waiting for agent..."})})}if(B.status==="complete")return r.jsxs("div",{className:kt.bar,children:[r.jsx("span",{className:`${kt.statusText} ${kt.statusCompleted}`,children:"Task completed"}),r.jsx("button",{onClick:()=>o(ki(B.workspaceId,void 0,q)),className:kt.btnPrimary,children:"+ New Task"})]});if(B.status==="failed")return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:`${kt.statusText} ${kt.statusFailed}`,children:"Task failed"})})}if(R){const B=t.find(re=>re.id===R),Z=(B==null?void 0:B.status)==="stopped";if(B!==void 0&&!Z)return r.jsx(r.Fragment,{});if(Z)return r.jsxs("div",{className:kt.bar,children:[r.jsxs("span",{className:`${kt.statusText} ${kt.hintText}`,children:["Session ",B.endReason||B.status]}),r.jsx("button",{onClick:()=>o(b_(B.environmentId)),className:kt.btnPrimary,children:"+ New Chat"})]})}return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Loading..."})})}const q4="_nav_14i94_1",G4="_tab_14i94_24",F4="_tabActive_14i94_62",Z4="_tabLabel_14i94_75",K4="_statusDot_14i94_81",Y4="_pulse_14i94_87",J4="_addButton_14i94_99",W4="_empty_14i94_132",Na={nav:q4,tab:G4,tabActive:F4,tabLabel:Z4,statusDot:K4,pulse:Y4,addButton:J4,empty:W4},X4={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function Q4({environments:t}){const s=bt(),i=b.useRef(null),o=Nt("/environments/:environmentId"),c=Nt("/environments/:environmentId/edit"),u=Nt("/environments/:environmentId/workspaces/:workspaceId"),d=Nt("/environments/:environmentId/workspaces/:workspaceId/*"),p=(o==null?void 0:o.params.environmentId)??(c==null?void 0:c.params.environmentId)??(u==null?void 0:u.params.environmentId)??(d==null?void 0:d.params.environmentId),h=p==="new"?void 0:p,g=b.useCallback(_=>{s(vi(_))},[s]),v=b.useCallback(_=>{var T;const k=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),w=S>=0?S:t.findIndex(C=>C.id===h);let N=w;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(w+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(w-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=k.length-1;else return;N<t.length&&s(vi(t[N].id)),k[N].focus()},[h,t,s]),y=h??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:Na.nav,"data-testid":"environment-nav",children:[r.jsx("nav",{ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Environments",onKeyDown:v,children:t.map(_=>{const k=_.id===h,S=_.id===y,w=X4[_.status]||"var(--text-tertiary)",N=_.status==="connected";return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${Na.tab} ${k?Na.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"env-nav-item",children:[r.jsx("span",{className:`${Na.statusDot} ${N?Na.pulse:""}`,style:{color:w},"aria-hidden":"true",children:r.jsx(Ra,{size:Fp,fill:"currentColor"})}),r.jsx("span",{className:Na.tabLabel,title:_.displayName||_.id,children:_.displayName||_.id})]},_.id)})}),r.jsx("button",{type:"button",className:Na.addButton,onClick:()=>s(zN),title:"Add environment","data-testid":"env-nav-add",children:"+ Add Environment"}),t.length===0&&r.jsx("div",{className:Na.empty,children:"No environments yet."})]})}function Um(t){const s=new Date(t),i=new Date,o=i.getTime()-s.getTime(),c=Math.floor(o/1e3),u=Math.floor(c/60),d=Math.floor(u/60),p=Math.floor(d/24);if(c<60)return"just now";if(u<60)return`${u}m ago`;if(d<24)return`${d}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 Nb={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 Qc(t){return Nb[t]||Nb.general}const eI="_nav_dlm8m_1",tI="_categoryPills_dlm8m_24",nI="_categoryPill_dlm8m_24",sI="_tab_dlm8m_42",aI="_tabActive_dlm8m_80",iI="_tabContent_dlm8m_93",oI="_tabLabel_dlm8m_100",rI="_tabMeta_dlm8m_106",lI="_categoryDot_dlm8m_111",cI="_empty_dlm8m_118",gs={nav:eI,categoryPills:tI,categoryPill:nI,tab:sI,tabActive:aI,tabContent:iI,tabLabel:oI,tabMeta:rI,categoryDot:lI,empty:cI};function uI({findings:t,workspaceId:s,environmentId:i}){const o=bt(),c=b.useRef(null),u=Nt("/findings/:findingId"),d=Nt("/environments/:environmentId/workspaces/:workspaceId/findings/:findingId"),p=(u==null?void 0:u.params.findingId)??(d==null?void 0:d.params.findingId),h=b.useMemo(()=>{const _=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(_).sort()},[t]),g=b.useCallback(_=>{o(_p(_,s,i))},[o,s,i]),v=b.useCallback(_=>{var T;const k=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),w=S>=0?S:t.findIndex(C=>C.id===p);let N=w;if(_.key==="ArrowDown"||_.key==="j"||_.key==="J")_.preventDefault(),N=(w+1)%k.length;else if(_.key==="ArrowUp"||_.key==="k"||_.key==="K")_.preventDefault(),N=(w-1+k.length)%k.length;else if(_.key==="Home")_.preventDefault(),N=0;else if(_.key==="End")_.preventDefault(),N=k.length-1;else return;N<t.length&&o(_p(t[N].id,s,i)),k[N].focus()},[p,t,o,s,i]),y=p??(t.length>0?t[0].id:void 0);return r.jsxs("div",{className:gs.nav,"data-testid":"findings-nav",children:[h.length>1&&r.jsx("div",{className:gs.categoryPills,"data-testid":"findings-nav-categories",children:h.map(_=>r.jsx("span",{className:gs.categoryPill,style:{color:Qc(_).text},children:_},_))}),r.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(_=>{const k=_.id===p,S=_.id===y;return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${gs.tab} ${k?gs.tabActive:""}`,onClick:()=>g(_.id),"data-testid":"finding-nav-item",children:[r.jsx("span",{className:gs.categoryDot,style:{color:Qc(_.category).text},"aria-hidden":"true",children:r.jsx(Ra,{size:Fp,fill:"currentColor"})}),r.jsxs("span",{className:gs.tabContent,children:[r.jsx("span",{className:gs.tabLabel,title:_.title,children:_.title}),r.jsx("span",{className:gs.tabMeta,title:_.createdAt,children:Um(_.createdAt)})]})]},_.id)})}),t.length===0&&r.jsx("div",{className:gs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function dI(t){if(t.length===0)return[];const s=[...t].sort((o,c)=>o[0]-c[0]),i=[[s[0][0],s[0][1]]];for(let o=1;o<s.length;o++){const c=i[i.length-1],[u,d]=s[o];u<=c[1]+1?c[1]=Math.max(c[1],d):i.push([u,d])}return i}function rx({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return r.jsx(r.Fragment,{children:t});const o=dI(s),c=[];let u=0;for(const[d,p]of o)d>u&&c.push(r.jsx("span",{children:t.slice(u,d)},`p${u}`)),c.push(r.jsx("mark",{className:i,children:t.slice(d,p+1)},`m${d}`)),u=p+1;return u<t.length&&c.push(r.jsx("span",{children:t.slice(u)},`p${u}`)),r.jsx(r.Fragment,{children:c})}function fI(t){const s=new Map(t.map(o=>[o.id,{...o,children:[]}])),i=[];for(const o of s.values())o.parentTaskId&&s.has(o.parentTaskId)?s.get(o.parentTaskId).children.push(o):i.push(o);for(const o of s.values())o.children.sort((c,u)=>c.sortOrder-u.sortOrder);return i.sort((o,c)=>o.sortOrder-c.sortOrder)}function pI(t,s){const i=new Map;for(const u of t){const p=u.dependsOn.length>0&&u.dependsOn.some(g=>s.get(g)!=="complete")?"blocked":u.status,h=i.get(p);h?h.push(u):i.set(p,[u])}const o=[],c=new Set;for(const u of V2){c.add(u);const d=i.get(u);if(d&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Ma(u);o.push({status:u,label:p.label,style:p,tasks:d})}}for(const[u,d]of i)if(!c.has(u)&&d.length>0){d.sort((h,g)=>h.sortOrder-g.sortOrder);const p=Ma(u);o.push({status:u,label:p.label,style:p,tasks:d})}return o}const mI="_container_z4i38_1",hI="_header_z4i38_5",gI="_headerActions_z4i38_17",vI="_searchInput_z4i38_23",yI="_searchHighlight_z4i38_56",bI="_groupToggle_z4i38_62",_I="_groupToggleActive_z4i38_89",xI="_addButton_z4i38_93",kI="_taskRow_z4i38_120",SI="_selected_z4i38_140",TI="_expandArrow_z4i38_150",wI="_expanded_z4i38_157",NI="_leafSpacer_z4i38_161",jI="_taskStatusIcon_z4i38_166",CI="_taskTitle_z4i38_170",EI="_workspaceBadge_z4i38_177",AI="_childCountBadge_z4i38_195",DI="_dependencyBadge_z4i38_208",RI="_blockedBadge_z4i38_220",MI="_addChildButton_z4i38_225",II="_emptyState_z4i38_268",OI="_statusGroupHeader_z4i38_275",BI="_statusGroupIcon_z4i38_294",LI="_statusGroupLabel_z4i38_298",zI="_statusGroupCount_z4i38_303",He={container:mI,header:hI,headerActions:gI,searchInput:vI,searchHighlight:yI,groupToggle:bI,groupToggleActive:_I,addButton:xI,taskRow:kI,selected:SI,expandArrow:TI,expanded:wI,leafSpacer:NI,taskStatusIcon:jI,taskTitle:CI,workspaceBadge:EI,childCountBadge:AI,dependencyBadge:DI,blockedBadge:RI,addChildButton:MI,emptyState:II,statusGroupHeader:OI,statusGroupIcon:BI,statusGroupLabel:LI,statusGroupCount:zI},UI=[{name:"title",weight:2},{name:"description",weight:1}],lx=16,$I=16,cx="grackle-task-group-by-status";function jb(){try{return localStorage.getItem(cx)==="true"}catch{return!1}}function PI(t){try{localStorage.setItem(cx,String(t))}catch{}}function VI({group:t,isExpanded:s,onToggle:i,selectedTaskId:o,navigate:c,titleHighlights:u,workspaceNames:d}){return r.jsxs("div",{"data-testid":`status-group-${t.status}`,children:[r.jsxs("div",{className:He.statusGroupHeader,role:"button",tabIndex:0,"aria-expanded":s,onClick:i,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i())},children:[r.jsx("span",{className:`${He.expandArrow} ${s?He.expanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),r.jsx("span",{className:He.statusGroupIcon,style:{color:t.style.color},"aria-hidden":"true",children:t.style.icon}),r.jsx("span",{className:He.statusGroupLabel,children:t.label}),r.jsx("span",{className:He.statusGroupCount,children:t.tasks.length})]}),r.jsx(os,{children:s&&r.jsx(Ct.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=Ma(p.status),g=o===p.id,v=p.parentTaskId||!p.workspaceId?void 0:d.get(p.workspaceId);return r.jsxs("div",{onClick:()=>c(rs(p.id)),className:`${He.taskRow} ${g?He.selected:""}`,style:{"--task-indent":`${lx}px`},"data-task-id":p.id,children:[r.jsx("span",{className:He.leafSpacer}),r.jsx("span",{className:He.taskStatusIcon,style:{color:h.color},"aria-hidden":"true","data-testid":`task-status-${Yr(p.status)}`,children:h.icon}),r.jsx("span",{className:He.taskTitle,title:p.title,children:r.jsx(rx,{text:p.title,indices:u.get(p.id),highlightClass:He.searchHighlight})}),v&&r.jsx("span",{className:He.workspaceBadge,title:v,children:v})]},p.id)})})})]})}function ux({node:t,depth:s,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h}){const g=Ma(t.status),v=t.dependsOn.length>0&&t.dependsOn.some(T=>d.get(T)!=="complete"),y=i.has(t.id),_=t.children.length>0,k=c===t.id,S=lx+s*$I,N=s===0&&!t.parentTaskId&&t.workspaceId?h.get(t.workspaceId):void 0;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{onClick:()=>u(rs(t.id)),className:`${He.taskRow} ${k?He.selected:""}`,style:{"--task-indent":`${S}px`},"data-task-id":t.id,children:[_&&r.jsx("span",{className:`${He.expandArrow} ${y?He.expanded:""}`,role:"button",tabIndex:0,"aria-label":y?"Collapse task":"Expand task",onClick:T=>{T.stopPropagation(),o(t.id)},onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),T.stopPropagation(),o(t.id))},children:r.jsx(Qs,{size:it,"aria-hidden":"true"})}),!_&&r.jsx("span",{className:He.leafSpacer}),r.jsx("span",{className:He.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${Yr(t.status)}`,children:g.icon}),r.jsx("span",{className:He.taskTitle,title:t.title,children:r.jsx(rx,{text:t.title,indices:p.get(t.id),highlightClass:He.searchHighlight})}),N&&r.jsx("span",{className:He.workspaceBadge,title:N,children:N}),_&&r.jsxs("span",{className:He.childCountBadge,children:[t.children.filter(T=>T.status==="complete").length,"/",t.children.length]}),t.dependsOn.length>0&&r.jsx("span",{className:`${He.dependencyBadge} ${v?He.blockedBadge:""}`,title:`Depends on: ${t.dependsOn.join(", ")}`,children:v?"blocked":"dep"}),s<XS&&r.jsx("button",{onClick:T=>{T.stopPropagation(),u(ki(t.workspaceId,t.id))},title:"Add child task","aria-label":"Add child task",className:He.addChildButton,children:"+"})]}),r.jsx(os,{children:_&&y&&r.jsx(Ct.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=>r.jsx(ux,{node:T,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h},T.id))})})]})}function HI({workspaces:t,tasks:s}){const i=bt(),[o,c]=b.useState(new Set),[u,d]=b.useState(new Set),[p,h]=b.useState(jb),[g,v]=b.useState(jb),[y,_]=b.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=b.useMemo(()=>new Map(s.map(ie=>[ie.id,ie.status])),[s]),N=b.useMemo(()=>new Map(t.map(ie=>[ie.id,ie.name])),[t]),T=()=>{const ie=!p;PI(ie),h(ie),ie&&(v(!0),_(new Map))},C=ie=>{_(ee=>{const B=new Map(ee),Z=B.has(ie)?B.get(ie):g;return B.set(ie,!Z),B})},E=ie=>y.has(ie)?y.get(ie):g,R=ie=>{c(ee=>{const B=new Set(ee);return B.has(ie)?(B.delete(ie),d(Z=>new Set(Z).add(ie))):(B.add(ie),d(Z=>{const ne=new Set(Z);return ne.delete(ie),ne})),B})};b.useEffect(()=>{const ie=new Set(s.filter(ee=>ee.parentTaskId).map(ee=>ee.parentTaskId));ie.size>0&&c(ee=>{const B=new Set(ee);for(const Z of ie)u.has(Z)||B.add(Z);return B})},[s,u]);const[D,A]=b.useState(""),{directMatchTaskIds:q,treeMatchTaskIds:$,titleHighlights:Y}=b.useMemo(()=>{if(!D.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const ie=WS(s,D,UI),ee=new Set(ie.map(re=>re.item.id)),B=new Map;for(const re of ie){const ue=re.matches.find(Ke=>Ke.key==="title");ue&&B.set(re.item.id,ue.indices)}const Z=new Set(ee),ne=new Map(s.map(re=>[re.id,re]));for(const re of[...ee]){let ue=ne.get(re);for(;ue!=null&&ue.parentTaskId;)Z.add(ue.parentTaskId),ue=ne.get(ue.parentTaskId)}return{directMatchTaskIds:ee,treeMatchTaskIds:Z,titleHighlights:B}},[D,s]),G=q!==null,Q=G?p?q:$:null,ae=Q?s.filter(ie=>Q.has(ie.id)):s,me=p?[]:fI(ae);return r.jsxs("div",{className:He.container,children:[r.jsxs("div",{className:He.header,children:[r.jsx("span",{children:"Tasks"}),r.jsxs("div",{className:He.headerActions,children:[r.jsx("button",{className:`${He.groupToggle} ${p?He.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:r.jsx(g2,{size:Gt})}),r.jsx("button",{className:He.addButton,onClick:()=>i(ki()),"aria-label":"New task",title:"New task","data-testid":"new-task-button",children:"+"})]})]}),s.length>0&&r.jsx("input",{type:"text",value:D,onChange:ie=>A(ie.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:He.searchInput,"data-testid":"sidebar-search"}),p?pI(ae,w).map(ie=>r.jsx(VI,{group:ie,isExpanded:E(ie.status),onToggle:()=>C(ie.status),selectedTaskId:S,navigate:i,titleHighlights:Y,workspaceNames:N},ie.status)):me.map(ie=>r.jsx(ux,{node:ie,depth:0,expandedTasks:o,toggleTask:R,selectedTaskId:S,navigate:i,taskStatusById:w,titleHighlights:Y,workspaceNames:N},ie.id)),ae.length===0&&!G&&r.jsx("div",{className:He.emptyState,children:"No tasks yet. Click + to create one."}),ae.length===0&&G&&r.jsx("div",{className:He.emptyState,children:"No matching tasks"})]})}const qI="_toast_ed2dk_1",GI="_success_ed2dk_18",FI="_icon_ed2dk_22",ZI="_error_ed2dk_25",KI="_warning_ed2dk_32",YI="_info_ed2dk_38",JI="_message_ed2dk_53",WI="_close_ed2dk_60",wr={toast:qI,success:GI,icon:FI,error:ZI,warning:KI,info:YI,message:JI,close:WI},XI={success:r.jsx(_i,{size:Mt}),error:r.jsx(Ba,{size:Mt}),warning:r.jsx(Gp,{size:Mt}),info:r.jsx(qp,{size:Mt})};function QI({toast:t,onDismiss:s}){return b.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),r.jsxs(Ct.div,{className:`${wr.toast} ${wr[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:[r.jsx("span",{className:wr.icon,"aria-hidden":"true",children:XI[t.variant]}),r.jsx("span",{className:wr.message,children:t.message}),r.jsx("button",{type:"button",className:wr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:r.jsx(Ba,{size:Gt,"aria-hidden":"true"})})]})}const eO="_container_qqse2_1",tO={container:eO};function nO({toasts:t,onDismiss:s}){return r.jsx("div",{className:tO.container,"data-testid":"toast-container",children:r.jsx(os,{children:t.map(i=>r.jsx(QI,{toast:i,onDismiss:s},i.id))})})}const sO="_callout_e5awm_1",aO="_success_e5awm_11",iO="_icon_e5awm_15",oO="_error_e5awm_18",rO="_warning_e5awm_25",lO="_info_e5awm_32",cO="_content_e5awm_48",uO="_close_e5awm_53",Nr={callout:sO,success:aO,icon:iO,error:oO,warning:rO,info:lO,content:cO,close:uO},dO={success:r.jsx(_i,{size:Mt}),error:r.jsx(Ba,{size:Mt}),warning:r.jsx(Gp,{size:Mt}),info:r.jsx(qp,{size:Mt})};function fO({variant:t="info",children:s,dismissible:i=!1,className:o}){const[c,u]=b.useState(!1);return r.jsx(r.Fragment,{children:!c&&r.jsxs("div",{className:[Nr.callout,Nr[t],o].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[r.jsx("span",{className:Nr.icon,"aria-hidden":"true",children:dO[t]}),r.jsx("span",{className:Nr.content,children:s}),i&&r.jsx("button",{type:"button",className:Nr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:r.jsx(Ba,{size:Gt,"aria-hidden":"true"})})]})})}function pO({currentVersion:t,latestVersion:s,updateAvailable:i,isDocker:o}){if(!i)return r.jsx(r.Fragment,{});const c=o?"docker pull ghcr.io/nick-pape/grackle:latest && docker restart grackle":`npm install -g @grackle-ai/cli@${s}`;return r.jsx("div",{"data-testid":"update-banner",children:r.jsxs(fO,{variant:"info",dismissible:!0,children:[r.jsxs("strong",{children:["Grackle v",s]})," is available (you have v",t,")."," ","Run: ",r.jsx("code",{children:c})]})})}const mO="_container_de44x_1",hO="_emptyState_de44x_8",gO="_card_de44x_14",vO="_cardClickable_de44x_34",yO="_cardHeader_de44x_42",bO="_categoryBadge_de44x_54",_O="_findingTitle_de44x_62",xO="_findingDate_de44x_68",kO="_findingContent_de44x_80",SO="_tags_de44x_86",TO="_tag_de44x_86",ns={container:mO,emptyState:hO,card:gO,cardClickable:vO,cardHeader:yO,categoryBadge:bO,findingTitle:_O,findingDate:xO,findingContent:kO,tags:SO,tag:TO};function dx({findings:t,onFindingClick:s}){return t.length===0?r.jsx("div",{className:ns.emptyState,children:"No findings yet. Agents will post discoveries here."}):r.jsx("div",{className:ns.container,children:t.map((i,o)=>{const c=Qc(i.category),u=s?Ct.button:Ct.div;return r.jsxs(u,{type:s?"button":void 0,className:`${ns.card} ${s?ns.cardClickable:""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:o*.05,duration:.2},onClick:s?()=>{s(i.id)}:void 0,children:[r.jsxs("div",{className:ns.cardHeader,children:[r.jsx("span",{className:ns.categoryBadge,style:{background:c.bg,color:c.text},children:i.category}),r.jsx("span",{className:ns.findingTitle,children:i.title}),r.jsx("span",{className:ns.findingDate,title:i.createdAt,children:Um(i.createdAt)})]}),r.jsx("div",{className:ns.findingContent,children:i.content.length>300?i.content.slice(0,300)+"...":i.content}),i.tags.length>0&&r.jsx("div",{className:ns.tags,children:i.tags.map(d=>r.jsx("span",{className:ns.tag,style:{color:c.text,textShadow:`0 0 8px ${c.text}`},children:d},d))})]},i.id)})})}const wO="_section_1ingb_14",NO="_sectionTitle_1ingb_26",jO="_sectionDescription_1ingb_35",CO="_tokenList_1ingb_48",EO="_tokenRow_1ingb_55",AO="_tokenBadge_1ingb_68",DO="_tokenName_1ingb_83",RO="_tokenTarget_1ingb_90",MO="_deleteButton_1ingb_99",IO="_addForm_1ingb_113",OO="_formRow_1ingb_119",BO="_input_1ingb_125",LO="_select_1ingb_155",zO="_addButton_1ingb_187",UO="_emptyStateInfo_1ingb_221",$O="_themeOptions_1ingb_229",PO="_themeOption_1ingb_229",VO="_themeOptionSelected_1ingb_254",HO="_themeOptionHeader_1ingb_259",qO="_themeOptionLabel_1ingb_266",GO="_themeOptionDesc_1ingb_273",FO="_variantToggle_1ingb_279",ZO="_variantButton_1ingb_286",KO="_variantActive_1ingb_305",YO="_themeSwatches_1ingb_311",JO="_themeSwatch_1ingb_311",WO="_systemToggle_1ingb_325",XO="_systemToggleHint_1ingb_341",QO="_themeActive_1ingb_348",e5="_aboutGrid_1ingb_354",t5="_aboutItem_1ingb_360",n5="_aboutLabel_1ingb_373",s5="_aboutValue_1ingb_379",a5="_aboutDot_1ingb_387",i5="_aboutDotConnected_1ingb_394",o5="_aboutDotDisconnected_1ingb_398",pe={section:wO,sectionTitle:NO,sectionDescription:jO,tokenList:CO,tokenRow:EO,tokenBadge:AO,tokenName:DO,tokenTarget:RO,deleteButton:MO,addForm:IO,formRow:OO,input:BO,select:LO,addButton:zO,emptyStateInfo:UO,themeOptions:$O,themeOption:PO,themeOptionSelected:VO,themeOptionHeader:HO,themeOptionLabel:qO,themeOptionDesc:GO,variantToggle:FO,variantButton:ZO,variantActive:KO,themeSwatches:YO,themeSwatch:JO,systemToggle:WO,systemToggleHint:XO,themeActive:QO,aboutGrid:e5,aboutItem:t5,aboutLabel:n5,aboutValue:s5,aboutDot:a5,aboutDotConnected:i5,aboutDotDisconnected:o5},r5=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function l5({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=b.useState(""),[d,p]=b.useState(""),[h,g]=b.useState("env_var"),[v,y]=b.useState(""),[_,k]=b.useState(null),S=T=>{if(T.preventDefault(),!c||!d)return;const C=h==="env_var"?v||c.toUpperCase()+"_TOKEN":"";s(c,d,h,C,h==="file"?v:""),o==null||o("Token saved successfully","success"),u(""),p(""),y("")},w=T=>{k(T)},N=()=>{_&&(i(_),o==null||o("Token deleted","info")),k(null)};return r.jsxs(r.Fragment,{children:[r.jsx(bi,{isOpen:_!==null,title:"Delete Token?",description:_?`"${_}" will be permanently removed.`:void 0,onConfirm:N,onCancel:()=>k(null)}),r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Tokens"}),r.jsx("p",{className:pe.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?r.jsx("div",{className:pe.emptyStateInfo,children:"Add your first API token to enable service integrations."}):r.jsx("div",{className:pe.tokenList,children:t.map(T=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenBadge,children:T.tokenType}),r.jsx("span",{className:pe.tokenName,children:T.name}),r.jsx("span",{className:pe.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),r.jsx("button",{className:pe.deleteButton,onClick:()=>w(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:r.jsx(Ba,{size:Gt,"aria-hidden":"true"})})]},T.name))}),r.jsxs("form",{className:pe.addForm,onSubmit:S,children:[r.jsxs("div",{className:pe.formRow,children:[r.jsx("input",{className:pe.input,type:"text",placeholder:"Token name",value:c,onChange:T=>u(T.target.value)}),r.jsx("input",{className:pe.input,type:"password",placeholder:"Value",value:d,onChange:T=>p(T.target.value)})]}),r.jsxs("div",{className:pe.formRow,children:[r.jsx("select",{className:pe.select,value:h,onChange:T=>g(T.target.value),children:r5.map(T=>r.jsx("option",{value:T.value,children:T.label},T.value))}),r.jsx("input",{className:pe.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=>y(T.target.value)}),r.jsx("button",{className:pe.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const mu=[{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"]}],fx=new Set(mu.map(t=>t.id)),Cb="grackle";function Up(t){return mu.find(s=>s.id===t)}function c5({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Appearance"}),r.jsx("p",{className:pe.sectionDescription,children:"Choose how Grackle looks across the app."}),r.jsx("div",{className:pe.themeOptions,children:mu.filter(u=>!u.hidden).map(u=>{const d=!!(u.variantLightId&&u.variantDarkId),p=d?t===u.id||t===u.variantLightId||t===u.variantDarkId:t===u.id,h=d&&s===u.variantLightId;return r.jsxs("button",{type:"button",className:`${pe.themeOption} ${p?pe.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[r.jsxs("span",{className:pe.themeOptionHeader,children:[r.jsxs("span",{children:[r.jsx("span",{className:pe.themeOptionLabel,children:u.label}),r.jsx("span",{className:pe.themeOptionDesc,children:u.description})]}),d&&r.jsxs("span",{className:pe.variantToggle,children:[r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&h?pe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantLightId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantLightId))},"aria-label":"Light variant","aria-pressed":p&&h,children:"☼"}),r.jsx("span",{role:"button",tabIndex:0,className:`${pe.variantButton} ${p&&!h?pe.variantActive:""}`,onClick:g=>{g.stopPropagation(),c(!1),i(u.variantDarkId)},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),g.stopPropagation(),c(!1),i(u.variantDarkId))},"aria-label":"Dark variant","aria-pressed":p&&!h,children:"☾"})]})]}),u.swatches&&r.jsx("span",{className:pe.themeSwatches,children:u.swatches.map((g,v)=>r.jsx("span",{className:pe.themeSwatch,style:{background:g}},v))})]},u.id)})}),r.jsxs("label",{className:pe.systemToggle,children:[r.jsx("input",{type:"checkbox",checked:o,onChange:u=>c(u.target.checked)}),r.jsx("span",{children:"Match system light/dark preference"})]}),r.jsx("p",{className:pe.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),r.jsxs("p",{className:pe.themeActive,children:["Active theme: ",r.jsx("strong",{children:s})]})]})}function u5({connected:t,environments:s,sessions:i}){const o=s.filter(d=>d.status==="connected").length,c=s.length,u=i.filter(d=>["running","idle"].includes(d.status)).length;return r.jsxs("section",{className:pe.section,"data-testid":"about-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"About"}),r.jsx("p",{className:pe.sectionDescription,children:"Connection status and application information."}),r.jsxs("div",{className:pe.aboutGrid,children:[r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Connection"}),r.jsxs("span",{className:pe.aboutValue,children:[r.jsx("span",{className:`${pe.aboutDot} ${t?pe.aboutDotConnected:pe.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Environments"}),r.jsxs("span",{className:pe.aboutValue,children:[o,"/",c," connected"]})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Active Sessions"}),r.jsx("span",{className:pe.aboutValue,children:u})]}),r.jsxs("div",{className:pe.aboutItem,children:[r.jsx("span",{className:pe.aboutLabel,children:"Version"}),r.jsx("span",{className:pe.aboutValue,children:"0.89.4"})]})]})]})}const d5="_container_cddyd_1",f5="_header_cddyd_8",p5="_headerTitle_cddyd_35",m5="_badge_cddyd_44",h5="_headerActions_cddyd_54",g5="_body_cddyd_61",v5="_formContent_cddyd_73",y5="_section_cddyd_85",b5="_label_cddyd_91",_5="_titleInput_cddyd_98",x5="_descriptionTextarea_cddyd_131",k5="_parentContext_cddyd_167",S5="_parentLabel_cddyd_175",T5="_parentName_cddyd_182",w5="_personaSelect_cddyd_186",N5="_depList_cddyd_220",j5="_depItem_cddyd_226",C5="_depItemSelected_cddyd_248",E5="_noDeps_cddyd_252",A5="_btnPrimary_cddyd_258",D5="_btnGhost_cddyd_289",We={container:d5,header:f5,headerTitle:p5,badge:m5,headerActions:h5,body:g5,formContent:v5,section:y5,label:b5,titleInput:_5,descriptionTextarea:x5,parentContext:k5,parentLabel:S5,parentName:T5,personaSelect:w5,depList:N5,depItem:j5,depItemSelected:C5,noDeps:E5,btnPrimary:A5,btnGhost:D5};function px({mode:t,taskId:s,workspaceId:i,parentTaskId:o,environmentId:c,tasks:u,workspaces:d,personas:p,onCreateTask:h,onUpdateTask:g,onEditDone:v,onShowToast:y}){const _=bt(),k=t==="edit",S=k&&s?u.find(de=>de.id===s):void 0,w=k?(S==null?void 0:S.workspaceId)??"":i??"",[N,T]=b.useState(w),C=w||N,E=d.find(de=>de.id===C),R=c??(E==null?void 0:E.environmentId),D=!k&&!i,A=k?(S==null?void 0:S.parentTaskId)??"":o??"",q=A?u.find(de=>de.id===A):void 0,[$,Y]=b.useState((S==null?void 0:S.title)??""),[G,Q]=b.useState((S==null?void 0:S.description)??""),[ae,me]=b.useState((S==null?void 0:S.dependsOn)??[]),[ie,ee]=b.useState((S==null?void 0:S.defaultPersonaId)??""),[B,Z]=b.useState((S==null?void 0:S.canDecompose)??!1),[ne,re]=b.useState(!1),ue=b.useRef(!1);b.useEffect(()=>{k&&S&&!ue.current&&(ue.current=!0,Y(S.title),Q(S.description),me(S.dependsOn),ee(S.defaultPersonaId),Z(S.canDecompose))},[k,S]);const Ke=u.filter(de=>de.workspaceId===C&&(!k||de.id!==s)&&de.id!==A),je=$.trim().length>0&&(!k||S!==void 0)&&C.length>0,Te=de=>{me(Oe=>Oe.includes(de)?Oe.filter(_t=>_t!==de):[...Oe,de])},Ie=()=>{!je||ne||k&&S===void 0||(k&&s?(g(s,$.trim(),G,ae,ie),y==null||y("Task updated","success"),v?v():_(rs(s,void 0,C,R),{replace:!0})):(re(!0),h(C,$.trim(),G,ae.length>0?ae:void 0,A||void 0,ie,B,()=>{y==null||y("Task created","success"),_(i?gi(i,R):"/tasks",{replace:!0})},de=>{y==null||y(de,"error"),re(!1)})))},le=()=>{if(v){v();return}_(k&&s?rs(s,void 0,C,R):i?gi(i,R):"/tasks")},ve=k?"edit task":A?"child task":"new task";return r.jsxs("div",{className:We.container,children:[r.jsxs("div",{className:We.header,children:[r.jsxs("div",{className:We.headerTitle,children:[r.jsx("span",{className:We.badge,children:ve}),q&&r.jsxs("span",{className:We.parentContext,children:[r.jsx("span",{className:We.parentLabel,children:"Child of"}),r.jsx("span",{className:We.parentName,children:q.title})]})]}),r.jsxs("div",{className:We.headerActions,children:[r.jsx("button",{onClick:Ie,disabled:!je||ne,className:We.btnPrimary,"data-testid":"task-edit-save",children:ne?"Creating…":k?"Save Changes":"Create"}),r.jsx("button",{onClick:le,className:We.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:We.body,children:r.jsxs("div",{className:We.formContent,children:[D&&r.jsxs("div",{className:We.section,children:[r.jsx("label",{className:We.label,htmlFor:"task-edit-workspace",children:"Workspace"}),r.jsxs("select",{id:"task-edit-workspace",value:N,onChange:de=>T(de.target.value),className:We.personaSelect,"data-testid":"task-edit-workspace",children:[r.jsx("option",{value:"",children:"Select a workspace..."}),d.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),r.jsxs("div",{className:We.section,children:[r.jsx("label",{className:We.label,htmlFor:"task-edit-title",children:"Title"}),r.jsx("input",{id:"task-edit-title",type:"text",value:$,onChange:de=>Y(de.target.value),placeholder:"Task title...",autoFocus:!0,className:We.titleInput,"data-testid":"task-edit-title",onKeyDown:de=>{de.key==="Enter"&&je&&Ie()}})]}),r.jsxs("div",{className:We.section,children:[r.jsx("label",{className:We.label,htmlFor:"task-edit-description",children:"Description"}),r.jsx("textarea",{id:"task-edit-description",value:G,onChange:de=>Q(de.target.value),placeholder:"Describe the task... (markdown supported)",className:We.descriptionTextarea,"data-testid":"task-edit-description",rows:8})]}),r.jsxs("div",{className:We.section,children:[r.jsx("label",{className:We.label,htmlFor:"task-edit-persona",children:"Default Persona"}),r.jsxs("select",{id:"task-edit-persona",value:ie,onChange:de=>ee(de.target.value),className:We.personaSelect,"data-testid":"task-edit-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),p.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),!k&&r.jsx("div",{className:We.section,children:r.jsxs("label",{className:We.depItem,"data-testid":"task-edit-can-decompose",children:[r.jsx("input",{type:"checkbox",checked:B,onChange:de=>Z(de.target.checked)}),"Can spawn subtasks"]})}),r.jsxs("div",{className:We.section,children:[r.jsx("div",{className:We.label,children:"Dependencies"}),Ke.length===0?r.jsx("div",{className:We.noDeps,children:"No other tasks in this workspace"}):r.jsx("div",{className:We.depList,children:Ke.map(de=>{const Oe=ae.includes(de.id);return r.jsxs("label",{className:`${We.depItem} ${Oe?We.depItemSelected:""}`,"data-testid":`dep-option-${de.id}`,children:[r.jsx("input",{type:"checkbox",checked:Oe,onChange:()=>Te(de.id)}),de.title,r.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",de.status,")"]})]},de.id)})})]})]})})]})}const R5="_container_legrg_1",M5="_header_legrg_8",I5="_headerTitle_legrg_35",O5="_badge_legrg_44",B5="_headerActions_legrg_54",L5="_body_legrg_61",z5="_formContent_legrg_73",U5="_section_legrg_85",$5="_label_legrg_91",P5="_nameInput_legrg_98",V5="_fieldInput_legrg_131",H5="_adapterSelect_legrg_164",q5="_readOnlyValue_legrg_198",G5="_codespaceSection_legrg_204",F5="_codespaceActions_legrg_210",Z5="_creatingHint_legrg_216",K5="_errorHint_legrg_222",Y5="_btnPrimary_legrg_235",J5="_btnGhost_legrg_266",se={container:R5,header:M5,headerTitle:I5,badge:O5,headerActions:B5,body:L5,formContent:z5,section:U5,label:$5,nameInput:P5,fieldInput:V5,adapterSelect:H5,readOnlyValue:q5,codespaceSection:G5,codespaceActions:F5,creatingHint:Z5,errorHint:K5,btnPrimary:Y5,btnGhost:J5},$c=1,Pc=65535;function ip(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=$c&&s<=Pc}function op(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function W5({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:h}){const[g,v]=b.useState("pick"),[y,_]=b.useState(""),[k,S]=b.useState("");return g==="create"?r.jsxs("div",{className:se.codespaceSection,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repository"}),r.jsx("input",{type:"text",value:y,onChange:w=>_(w.target.value),placeholder:"owner/repo",className:se.fieldInput,"data-testid":"env-codespace-repo"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Machine Type"}),r.jsx("input",{type:"text",value:k,onChange:w=>S(w.target.value),placeholder:"Machine type (optional)...",className:se.fieldInput,"data-testid":"env-codespace-machine"})]}),r.jsxs("div",{className:se.codespaceActions,children:[r.jsx("button",{onClick:()=>{y.trim()&&(h(y.trim(),k.trim()||void 0),v("pick"),_(""),S(""))},disabled:!y.trim(),className:se.btnPrimary,children:"Create"}),r.jsx("button",{onClick:()=>{v("pick"),_(""),S("")},className:se.btnGhost,children:"Cancel"})]})]}):r.jsx("div",{className:se.codespaceSection,children:r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace"}),!d&&r.jsxs("select",{value:t,onChange:w=>{w.target.value==="__create__"?(v("create"),s("")):(s(w.target.value),w.target.value&&!i.trim()&&o(w.target.value))},disabled:p,className:se.adapterSelect,"data-testid":"env-codespace-select",children:[r.jsx("option",{value:"",children:"Select a codespace..."}),c.map(w=>r.jsxs("option",{value:w.name,children:[w.name," (",w.repository,") — ",w.state]},w.name)),r.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&r.jsx("span",{className:se.creatingHint,children:"Creating codespace..."}),d&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:se.errorHint,children:d}),r.jsx("input",{type:"text",value:t,onChange:w=>s(w.target.value),placeholder:"Or enter codespace name manually...",className:se.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&r.jsx("span",{className:se.errorHint,children:u})]})})}function mx({mode:t,environmentId:s,environments:i,onAddEnvironment:o,onUpdateEnvironment:c,onListCodespaces:u,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v,onShowToast:y}){const _=bt(),k=t==="edit",S=k&&s?i.find(le=>le.id===s):void 0,[w,N]=b.useState(""),[T,C]=b.useState("local"),[E,R]=b.useState(""),[D,A]=b.useState(""),[q,$]=b.useState(""),[Y,G]=b.useState(""),[Q,ae]=b.useState(""),[me,ie]=b.useState(""),[ee,B]=b.useState(""),[Z,ne]=b.useState(null),re=b.useCallback(()=>{const le={};if(T==="local"){if(E.trim()&&(le.host=E.trim()),D.trim()){const ve=Number(D);Number.isInteger(ve)&&(le.port=ve)}}else if(T==="ssh"){if(le.host=E.trim(),q.trim()&&(le.user=q.trim()),D.trim()){const ve=Number(D);Number.isInteger(ve)&&(le.sshPort=ve)}Y.trim()&&(le.identityFile=Y.trim())}else T==="docker"?(Q.trim()&&(le.image=Q.trim()),me.trim()&&(le.repo=me.trim())):T==="codespace"&&(le.codespaceName=ee.trim());return le},[T,E,D,q,Y,Q,me,ee]),ue=()=>!(!w.trim()||T==="ssh"&&!E.trim()||T==="codespace"&&!ee.trim()||(T==="local"||T==="ssh")&&!ip(D)),Ke=()=>{ue()&&(o(w.trim(),T,re()),y==null||y("Environment added successfully","success"),_(xo,{replace:!0}))},je=()=>{_(s?vi(s):xo)},Te=b.useCallback((le,ve)=>{if(!S||!s)return;const de=op(S.adapterConfig),Oe=ve.trim();Oe?de[le]=Oe:delete de[le],c(s,{adapterConfig:de})},[S,s,c]),Ie=b.useCallback((le,ve)=>{if(!S||!s)return;const de=op(S.adapterConfig);if(ve.trim()){const Oe=Number(ve);Number.isInteger(Oe)&&Oe>=$c&&Oe<=Pc&&(de[le]=Oe)}else delete de[le];c(s,{adapterConfig:de})},[S,s,c]);if(k){if(!S)return r.jsxs("div",{className:se.container,children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsx("div",{className:se.formContent,children:r.jsx("span",{className:se.readOnlyValue,children:"Environment not found"})})})]});const le=op(S.adapterConfig);return r.jsxs("div",{className:se.container,"data-testid":"env-edit-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"edit environment"})}),r.jsx("div",{className:se.headerActions,children:r.jsx("button",{onClick:je,className:se.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Name"}),r.jsx(Xt,{value:S.displayName,onSave:ve=>{s&&c(s,{displayName:ve})},validate:ve=>ve.trim()===""?"Name cannot be empty":void 0,mode:"edit",fieldId:"name",activeFieldId:Z,onActivate:ne,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Adapter Type"}),r.jsx("span",{className:se.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Port"}),r.jsx(Xt,{value:String(le.port??""),onSave:ve=>Ie("port",ve),validate:ve=>ip(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Host"}),r.jsx(Xt,{value:String(le.host??""),onSave:ve=>Te("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:ne,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"User"}),r.jsx(Xt,{value:String(le.user??""),onSave:ve=>Te("user",ve),mode:"edit",fieldId:"user",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"SSH Port"}),r.jsx(Xt,{value:String(le.sshPort??""),onSave:ve=>Ie("sshPort",ve),validate:ve=>ip(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:Z,onActivate:ne,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Identity File"}),r.jsx(Xt,{value:String(le.identityFile??""),onSave:ve=>Te("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:Z,onActivate:ne,placeholder:"~/.ssh/id_rsa",ariaLabel:"Identity File","data-testid":"env-edit-identity-file"})]})]}),S.adapterType==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Image"}),r.jsx(Xt,{value:String(le.image??""),onSave:ve=>Te("image",ve),mode:"edit",fieldId:"image",activeFieldId:Z,onActivate:ne,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Repo"}),r.jsx(Xt,{value:String(le.repo??""),onSave:ve=>Te("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:Z,onActivate:ne,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,children:"Codespace Name"}),r.jsx(Xt,{value:String(le.codespaceName??""),onSave:ve=>Te("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:Z,onActivate:ne,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return r.jsxs("div",{className:se.container,"data-testid":"env-create-panel",children:[r.jsxs("div",{className:se.header,children:[r.jsx("div",{className:se.headerTitle,children:r.jsx("span",{className:se.badge,children:"new environment"})}),r.jsxs("div",{className:se.headerActions,children:[r.jsx("button",{onClick:Ke,disabled:!ue(),className:se.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),r.jsx("button",{onClick:je,className:se.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:se.body,children:r.jsxs("div",{className:se.formContent,children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-name",children:"Name"}),r.jsx("input",{id:"env-create-name",type:"text",value:w,onChange:le=>N(le.target.value),placeholder:"Environment name...",autoFocus:!0,className:se.nameInput,"data-testid":"env-create-name",onKeyDown:le=>{le.key==="Enter"&&ue()&&Ke()}})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),r.jsxs("select",{id:"env-create-adapter",value:T,onChange:le=>{C(le.target.value),le.target.value==="codespace"&&u()},className:se.adapterSelect,"data-testid":"env-create-adapter",children:[r.jsx("option",{value:"local",children:"local"}),r.jsx("option",{value:"ssh",children:"ssh"}),r.jsx("option",{value:"docker",children:"docker"}),r.jsx("option",{value:"codespace",children:"codespace"})]})]}),T==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:le=>R(le.target.value),placeholder:"Host (optional)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:$c,max:Pc,value:D,onChange:le=>A(le.target.value),placeholder:"Port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:le=>R(le.target.value),placeholder:"Host (required)...",className:se.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-user",children:"User"}),r.jsx("input",{id:"env-create-user",type:"text",value:q,onChange:le=>$(le.target.value),placeholder:"User (optional)...",className:se.fieldInput,"data-testid":"env-create-user"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-port",children:"SSH Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:$c,max:Pc,value:D,onChange:le=>A(le.target.value),placeholder:"SSH port (optional)...",className:se.fieldInput,"data-testid":"env-create-port"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-identity",children:"Identity File"}),r.jsx("input",{id:"env-create-identity",type:"text",value:Y,onChange:le=>G(le.target.value),placeholder:"Identity file (optional)...",className:se.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-image",children:"Image"}),r.jsx("input",{id:"env-create-image",type:"text",value:Q,onChange:le=>ae(le.target.value),placeholder:"Image (optional)...",className:se.fieldInput,"data-testid":"env-create-image"})]}),r.jsxs("div",{className:se.section,children:[r.jsx("label",{className:se.label,htmlFor:"env-create-repo",children:"Repo"}),r.jsx("input",{id:"env-create-repo",type:"text",value:me,onChange:le=>ie(le.target.value),placeholder:"Repo (optional)...",className:se.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&r.jsx(W5,{codespaceName:ee,onCodespaceNameChange:B,envName:w,onEnvNameChange:N,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const X5="_group_1iprv_1",Q5="_groupTitle_1iprv_8",eB="_shortcutList_1iprv_17",tB="_shortcutRow_1iprv_23",nB="_keys_1iprv_36",sB="_kbd_1iprv_43",aB="_description_1iprv_60",ui={group:X5,groupTitle:Q5,shortcutList:eB,shortcutRow:tB,keys:nB,kbd:sB,description:aB},iB=[{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 oB(){return r.jsxs("section",{className:pe.section,"data-testid":"keyboard-shortcuts-panel",children:[r.jsx("h3",{className:pe.sectionTitle,children:"Keyboard Shortcuts"}),r.jsx("p",{className:pe.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),iB.map(t=>r.jsxs("div",{className:ui.group,children:[r.jsx("h4",{className:ui.groupTitle,children:t.title}),r.jsx("div",{className:ui.shortcutList,children:t.shortcuts.map(s=>r.jsxs("div",{className:ui.shortcutRow,children:[r.jsx("span",{className:ui.keys,children:s.keys.map(i=>r.jsx("kbd",{className:ui.kbd,children:i},i))}),r.jsx("span",{className:ui.description,children:s.description})]},s.description))})]},t.title))]})}const rB="_workpadSection_y8nj9_1",lB="_workpadLabel_y8nj9_9",cB="_workpadStatus_y8nj9_17",uB="_workpadSummary_y8nj9_23",dB="_workpadExtra_y8nj9_29",ja={workpadSection:rB,workpadLabel:lB,workpadStatus:cB,workpadSummary:uB,workpadExtra:dB};function fB({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 r.jsxs("div",{className:ja.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:ja.workpadLabel,children:"Workpad"}),r.jsx("div",{className:ja.workpadExtra,children:t})]})}if(!(!s.status&&!s.summary&&!s.extra))return r.jsxs("div",{className:ja.workpadSection,"data-testid":"workpad-panel",children:[r.jsx("div",{className:ja.workpadLabel,children:"Workpad"}),s.status&&r.jsx("div",{className:ja.workpadStatus,"data-testid":"workpad-status",children:s.status}),s.summary&&r.jsx("div",{className:ja.workpadSummary,"data-testid":"workpad-summary",children:s.summary}),s.extra&&Object.keys(s.extra).length>0&&r.jsx("div",{className:ja.workpadExtra,"data-testid":"workpad-extra",children:JSON.stringify(s.extra,null,2)})]})}const pB=[{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 mB({credentialProviders:t,onUpdateCredentialProviders:s}){const i=(o,c)=>{const u={...t};o==="claude"?u.claude=c:u[o]=c,s(u)};return r.jsxs("section",{className:pe.section,children:[r.jsx("h3",{className:pe.sectionTitle,children:"Credential Providers"}),r.jsx("p",{className:pe.sectionDescription,children:"Enable providers to automatically forward credentials to environments at task start. Credentials are read fresh from the host each time."}),r.jsx("div",{className:pe.tokenList,children:pB.map(o=>r.jsxs("div",{className:pe.tokenRow,children:[r.jsx("span",{className:pe.tokenName,children:o.label}),r.jsx("span",{className:pe.tokenTarget,children:o.description}),r.jsx("select",{className:pe.select,value:t[o.key],onChange:c=>i(o.key,c.target.value),children:o.options.map(c=>r.jsx("option",{value:c.value,children:c.label},c.value))})]},o.key))})]})}const hB="_container_10efq_1",gB="_header_10efq_7",vB="_list_10efq_105",yB="_card_10efq_111",bB="_cardHeader_10efq_125",_B="_cardTitle_10efq_135",xB="_defaultBadge_10efq_141",kB="_cardActions_10efq_155",SB="_description_10efq_160",TB="_meta_10efq_166",wB="_empty_10efq_212",NB="_typeBadge_10efq_362",Hn={container:hB,header:gB,list:vB,card:yB,cardHeader:bB,cardTitle:_B,defaultBadge:xB,cardActions:kB,description:SB,meta:TB,empty:wB,typeBadge:NB};function jB({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,p]=b.useState(null),h=d?t.find(v=>v.id===d):void 0,g=async v=>{await i(v),p(null)};return r.jsxs("div",{className:Hn.container,children:[r.jsxs("div",{className:Hn.header,children:[r.jsx("h2",{children:"Personas"}),r.jsx(Fs,{variant:"primary",size:"md",onClick:c,"data-testid":"persona-new-button",children:"+ New Persona"})]}),t.length===0?r.jsx("p",{className:Hn.empty,children:"No personas yet. Create one to get started."}):r.jsx("div",{className:Hn.list,children:t.map(v=>{const y=s===v.id,_=v.type==="script";return r.jsxs("div",{className:Hn.card,"data-testid":`persona-card-${v.id}`,onClick:()=>u(v.id),role:"button",tabIndex:0,onKeyDown:k=>{k.currentTarget===k.target&&(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u(v.id))},children:[r.jsxs("div",{className:Hn.cardHeader,children:[r.jsxs("span",{className:Hn.cardTitle,children:[r.jsx("strong",{children:v.name}),r.jsx("span",{className:Hn.typeBadge,"data-testid":`persona-type-badge-${v.id}`,children:_?"Script":"Agent"}),y&&r.jsx("span",{className:Hn.defaultBadge,"data-testid":`persona-default-badge-${v.id}`,children:"App Default"})]}),r.jsxs("div",{className:Hn.cardActions,onClick:k=>k.stopPropagation(),children:[!y&&r.jsx(Fs,{variant:"ghost",size:"sm",onClick:()=>{o(v.id).catch(()=>{})},"data-testid":`persona-set-default-${v.id}`,title:"Set as app default persona",children:"Set Default"}),r.jsx(Fs,{variant:"ghost",size:"sm",onClick:()=>u(v.id),children:"Edit"}),r.jsx(Fs,{variant:"ghost",size:"sm",onClick:()=>p(v.id),"data-testid":`persona-delete-${v.id}`,children:"Delete"})]})]}),v.description&&r.jsx("p",{className:Hn.description,children:v.description}),r.jsxs("div",{className:Hn.meta,children:[v.runtime&&r.jsxs("span",{children:["Runtime: ",v.runtime]}),v.model&&r.jsxs("span",{children:["Model: ",v.model]}),v.maxTurns>0&&r.jsxs("span",{children:["Max turns: ",v.maxTurns]})]})]},v.id)})}),r.jsx(bi,{isOpen:d!==null,title:"Delete Persona?",description:`"${(h==null?void 0:h.name)??""}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:()=>{d&&g(d).catch(()=>{})},onCancel:()=>p(null)})]})}const CB="_container_uy08i_1",EB="_header_uy08i_7",AB="_count_uy08i_13",DB="_presets_uy08i_18",RB="_presetButton_uy08i_24",MB="_filterInput_uy08i_41",IB="_groups_uy08i_53",OB="_group_uy08i_53",BB="_groupHeader_uy08i_68",LB="_groupName_uy08i_77",zB="_groupCount_uy08i_81",UB="_toolList_uy08i_87",$B="_toolItem_uy08i_95",PB="_toolName_uy08i_103",on={container:CB,header:EB,count:AB,presets:DB,presetButton:RB,filterInput:MB,groups:IB,group:OB,groupHeader:BB,groupName:LB,groupCount:zB,toolList:UB,toolItem:$B,toolName:PB},VB=(()=>{const t=new Map;for(const s of Kb){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()}))})(),HB=[{name:"default",label:"Default",tools:Yb},{name:"worker",label:"Worker",tools:QS},{name:"orchestrator",label:"Orchestrator",tools:eT},{name:"admin",label:"Admin",tools:tT}];function Eb({selectedTools:t,onChange:s,disabled:i}){const[o,c]=b.useState(""),u=b.useMemo(()=>new Set(t),[t]),d=b.useCallback(v=>{if(i)return;const y=new Set(u);y.has(v)?y.delete(v):y.add(v),s([...y].sort())},[u,s,i]),p=b.useCallback((v,y)=>{if(i)return;const _=new Set(u);for(const k of v)y?_.delete(k):_.add(k);s([..._].sort())},[u,s,i]),h=b.useCallback(v=>{i||s([...v].sort())},[s,i]),g=o.toLowerCase();return r.jsxs("div",{className:on.container,"data-testid":"mcp-tool-selector",children:[r.jsx("div",{className:on.header,children:r.jsx("span",{className:on.count,children:t.length===0?`Using default (${Yb.length} tools)`:`${t.length} of ${Kb.size} tools selected`})}),r.jsxs("div",{className:on.presets,"data-testid":"mcp-tool-presets",children:[HB.map(v=>r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>h(v.tools),"data-testid":`preset-${v.name}`,children:v.label},v.name)),r.jsx("button",{type:"button",className:on.presetButton,disabled:i,onClick:()=>s([]),"data-testid":"preset-clear",children:"Clear"})]}),r.jsx("input",{type:"text",className:on.filterInput,placeholder:"Filter tools...",value:o,onChange:v=>c(v.target.value),disabled:i,"data-testid":"mcp-tool-filter"}),r.jsx("div",{className:on.groups,children:VB.map(({group:v,tools:y})=>{const _=g?y.filter(S=>S.toLowerCase().includes(g)):y;if(_.length===0)return null;const k=_.every(S=>u.has(S));return r.jsxs("div",{className:on.group,"data-testid":`tool-group-${v}`,children:[r.jsxs("label",{className:on.groupHeader,children:[r.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(_,k),disabled:i,"data-testid":`group-toggle-${v}`}),r.jsx("span",{className:on.groupName,children:v}),r.jsxs("span",{className:on.groupCount,children:["(",_.filter(S=>u.has(S)).length,"/",_.length,")"]})]}),r.jsx("div",{className:on.toolList,children:_.map(S=>r.jsxs("label",{className:on.toolItem,children:[r.jsx("input",{type:"checkbox",checked:u.has(S),onChange:()=>d(S),disabled:i,"data-testid":`tool-${S}`}),r.jsx("span",{className:on.toolName,children:S})]},S))})]},v)})})]})}const qB="_nav_1bhou_1",GB="_tab_1bhou_24",FB="_tabIcon_1bhou_62",ZB="_tabActive_1bhou_68",jc={nav:qB,tab:GB,tabIcon:FB,tabActive:ZB},qs=[{path:"credentials",label:"Credentials",icon:r.jsx(u2,{size:Mt})},{path:"personas",label:"Personas",icon:r.jsx(z2,{size:Mt})},{path:"appearance",label:"Appearance",icon:r.jsx(N2,{size:Mt})},{path:"shortcuts",label:"Shortcuts",icon:r.jsx(f2,{size:Mt})},{path:"about",label:"About",icon:r.jsx(qp,{size:Mt})}];function KB(){var d;const t=Pt(),s=bt(),i=b.useRef(null),o=((d=qs.find(p=>{const h=`${_o}/${p.path}`;return t.pathname===h||t.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??qs[0].path,c=b.useCallback(p=>{s(`${_o}/${p}`)},[s]),u=b.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:qs.findIndex(w=>w.path===o);let y=v;if(p.key==="ArrowDown"||p.key==="j"||p.key==="J")p.preventDefault(),y=(v+1)%qs.length;else if(p.key==="ArrowUp"||p.key==="k"||p.key==="K")p.preventDefault(),y=(v-1+qs.length)%qs.length;else if(p.key==="Home")p.preventDefault(),y=0;else if(p.key==="End")p.preventDefault(),y=qs.length-1;else return;const _=qs[y].path;s(`${_o}/${_}`),(S=h[y])==null||S.focus()},[o,s]);return r.jsx("nav",{className:jc.nav,ref:i,role:"tablist","aria-orientation":"vertical","aria-label":"Settings",onKeyDown:u,children:qs.map(p=>{const h=p.path===o;return r.jsxs("button",{role:"tab",type:"button","aria-selected":h,tabIndex:h?0:-1,className:`${jc.tab} ${h?jc.tabActive:""}`,onClick:()=>c(p.path),children:[r.jsx("span",{className:jc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function YB({tasks:t,taskStatusById:s,sessionStatusByTaskId:i}){const o=new Map;for(const u of t)if(u.parentTaskId){const d=o.get(u.parentTaskId);d?d.push(u):o.set(u.parentTaskId,[u])}const c=new Map(Z0.map(u=>[u,[]]));for(const u of t){const d=Yr(u.status),p=u.dependsOn.length>0&&u.dependsOn.some(S=>s.get(S)!=="complete"),h=o.get(u.id)??[],g=h.length,v=h.filter(S=>S.status==="complete").length;let y;if(d==="paused"&&i){const S=i.get(u.id);S==="idle"?y="Needs input":S==="completed"&&(y="Ready to complete")}const _={task:u,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:y},k=c.get(d);k?k.push(_):c.get("not_started").push(_)}for(const u of c.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return Z0.map(u=>{const d=Ma(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const JB="_boardContainer_1c4y1_1",WB="_column_1c4y1_17",XB="_columnHeader_1c4y1_34",QB="_columnIcon_1c4y1_47",eL="_columnLabel_1c4y1_52",tL="_columnCount_1c4y1_57",nL="_cardList_1c4y1_67",sL="_emptyPlaceholder_1c4y1_76",aL="_card_1c4y1_67",iL="_cardHeader_1c4y1_107",oL="_cardStatusIcon_1c4y1_113",rL="_cardTitle_1c4y1_119",lL="_cardBadges_1c4y1_127",cL="_badge_1c4y1_134",uL="_blockedBadge_1c4y1_146",dL="_childBadge_1c4y1_151",fL="_depBadge_1c4y1_155",pL="_parentBadge_1c4y1_159",mL="_pausedSubBadge_1c4y1_166",hL="_personaBadge_1c4y1_170",gL="_envBadge_1c4y1_174",vL="_emptyCta_1c4y1_178",yL="_ctaButton_1c4y1_188",bL="_ctaDescription_1c4y1_204",nt={boardContainer:JB,column:WB,columnHeader:XB,columnIcon:QB,columnLabel:eL,columnCount:tL,cardList:nL,emptyPlaceholder:sL,card:aL,cardHeader:iL,cardStatusIcon:oL,cardTitle:rL,cardBadges:lL,badge:cL,blockedBadge:uL,childBadge:dL,depBadge:fL,parentBadge:pL,pausedSubBadge:mL,personaBadge:hL,envBadge:gL,emptyCta:vL,ctaButton:yL,ctaDescription:bL};function _L({workspaceId:t,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=bt(),p=b.useMemo(()=>i.filter(_=>_.workspaceId===t),[i,t]),h=b.useMemo(()=>new Map(i.map(_=>[_.id,_.status])),[i]),g=b.useMemo(()=>new Map(p.map(_=>[_.id,_])),[p]),v=b.useMemo(()=>{const _=new Map(o.map(C=>[C.id,C])),k=new Map(c.map(C=>[C.id,C])),S=new Map(u.map(C=>[C.id,C])),w=new Map,N=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const E=_.get(C.latestSessionId);if(E){if(w.set(C.id,E.endReason||E.status),E.personaId){const R=k.get(E.personaId);R&&N.set(C.id,R.name)}if(E.environmentId){const R=S.get(E.environmentId);R&&T.set(C.id,R.displayName)}}}return{sessionStatusByTaskId:w,personaNameByTaskId:N,environmentNameByTaskId:T}},[p,o,c,u]),y=b.useMemo(()=>YB({tasks:p,taskStatusById:h,sessionStatusByTaskId:v.sessionStatusByTaskId}),[p,h,v]);return p.length===0?r.jsxs("div",{className:nt.emptyCta,"data-testid":"board-empty-cta",children:[r.jsx("button",{className:nt.ctaButton,onClick:()=>d(ki(t,void 0,s)),children:"Create Task"}),r.jsx("div",{className:nt.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}):r.jsx("div",{className:nt.boardContainer,"data-testid":"board-container",children:y.map(_=>r.jsxs("section",{className:nt.column,"data-testid":`board-column-${_.status}`,"aria-label":`${_.label}, ${_.tasks.length} ${_.tasks.length===1?"task":"tasks"}`,children:[r.jsxs("div",{className:nt.columnHeader,children:[r.jsx("span",{className:nt.columnIcon,style:{color:_.style.color},children:_.style.icon}),r.jsx("span",{className:nt.columnLabel,children:_.label}),r.jsx("span",{className:nt.columnCount,"data-testid":`board-count-${_.status}`,children:_.tasks.length})]}),r.jsx("div",{className:nt.cardList,children:_.tasks.length===0?r.jsx("div",{className:nt.emptyPlaceholder,children:"No tasks"}):r.jsx(os,{mode:"popLayout",children:_.tasks.map(k=>r.jsx(Ct.div,{layout:!0,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:r.jsx(xL,{boardTask:k,tasksById:g,personaName:v.personaNameByTaskId.get(k.task.id),envName:v.environmentNameByTaskId.get(k.task.id),onClick:()=>d(rs(k.task.id,void 0,t,s))})},k.task.id))})})]},_.status))})}function xL({boardTask:t,tasksById:s,personaName:i,envName:o,onClick:c}){const{task:u,isBlocked:d,childCount:p,doneChildCount:h,pausedSubBadge:g}=t,v=Ma(u.status),y=u.parentTaskId?s.get(u.parentTaskId):void 0;return r.jsxs("div",{className:nt.card,tabIndex:0,role:"button","data-testid":`board-card-${u.id}`,onClick:c,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),c())},children:[r.jsxs("div",{className:nt.cardHeader,children:[r.jsx("span",{className:nt.cardStatusIcon,style:{color:v.color},children:v.icon}),r.jsx("span",{className:nt.cardTitle,children:u.title})]}),r.jsxs("div",{className:nt.cardBadges,children:[y&&r.jsx("span",{className:`${nt.badge} ${nt.parentBadge}`,title:y.title,children:y.title}),p>0&&r.jsxs("span",{className:`${nt.badge} ${nt.childBadge}`,children:[h,"/",p]}),d&&r.jsx("span",{className:`${nt.badge} ${nt.blockedBadge}`,children:"blocked"}),u.dependsOn.length>0&&!d&&r.jsx("span",{className:`${nt.badge} ${nt.depBadge}`,children:"dep"}),g&&r.jsx("span",{className:`${nt.badge} ${nt.pausedSubBadge}`,children:g}),i&&r.jsx("span",{className:`${nt.badge} ${nt.personaBadge}`,children:i}),o&&r.jsx("span",{className:`${nt.badge} ${nt.envBadge}`,children:o})]})]})}const kL="_formContent_ymnez_1",SL="_section_ymnez_13",TL="_label_ymnez_19",wL="_titleInput_ymnez_26",NL="_descriptionTextarea_ymnez_58",jL="_selectField_ymnez_94",CL="_checkboxRow_ymnez_128",EL="_checkboxLabel_ymnez_141",AL="_fieldError_ymnez_146",gt={formContent:kL,section:SL,label:TL,titleInput:wL,descriptionTextarea:NL,selectField:jL,checkboxRow:CL,checkboxLabel:EL,fieldError:AL};function DL(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 RL=100;function ML({values:t,onChange:s,environments:i,personas:o,errors:c,disabled:u,autoFocusName:d}){const p=(h,g)=>{s({...t,[h]:g})};return r.jsxs("div",{className:gt.formContent,children:[r.jsxs("div",{className:gt.section,children:[r.jsx("label",{className:gt.label,htmlFor:"ws-name",children:"Name"}),r.jsx("input",{id:"ws-name",className:gt.titleInput,type:"text",value:t.name,onChange:h=>p("name",h.target.value),placeholder:"Workspace name",maxLength:RL,autoFocus:d,disabled:u,"data-testid":"workspace-form-name"}),(c==null?void 0:c.name)&&r.jsx("span",{className:gt.fieldError,"data-testid":"workspace-form-error-name",children:c.name})]}),r.jsxs("div",{className:gt.section,children:[r.jsx("label",{className:gt.label,htmlFor:"ws-description",children:"Description"}),r.jsx("textarea",{id:"ws-description",className:gt.descriptionTextarea,value:t.description,onChange:h=>p("description",h.target.value),placeholder:"Optional description (Markdown supported)",disabled:u,"data-testid":"workspace-form-description"})]}),r.jsxs("div",{className:gt.section,children:[r.jsx("label",{className:gt.label,htmlFor:"ws-repo",children:"Repository URL"}),r.jsx("input",{id:"ws-repo",className:gt.titleInput,type:"text",value:t.repoUrl,onChange:h=>p("repoUrl",h.target.value),placeholder:"https://github.com/org/repo",disabled:u,"data-testid":"workspace-form-repo"}),(c==null?void 0:c.repoUrl)&&r.jsx("span",{className:gt.fieldError,"data-testid":"workspace-form-error-repoUrl",children:c.repoUrl})]}),r.jsxs("div",{className:gt.section,children:[r.jsx("label",{className:gt.label,htmlFor:"ws-environment",children:"Environment"}),r.jsxs("select",{id:"ws-environment",className:gt.selectField,value:t.environmentId,onChange:h=>p("environmentId",h.target.value),disabled:u,"data-testid":"workspace-form-environment",children:[r.jsx("option",{value:"",children:"Select environment…"}),i.map(h=>r.jsx("option",{value:h.id,children:h.displayName||h.id},h.id))]}),(c==null?void 0:c.environmentId)&&r.jsx("span",{className:gt.fieldError,"data-testid":"workspace-form-error-environmentId",children:c.environmentId})]}),r.jsxs("div",{className:gt.section,children:[r.jsx("label",{className:gt.label,htmlFor:"ws-persona",children:"Default Persona"}),r.jsxs("select",{id:"ws-persona",className:gt.selectField,value:t.defaultPersonaId,onChange:h=>p("defaultPersonaId",h.target.value),disabled:u,"data-testid":"workspace-form-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),o.map(h=>r.jsx("option",{value:h.id,children:h.name},h.id))]})]}),r.jsx("div",{className:gt.section,children:r.jsxs("label",{className:gt.checkboxRow,children:[r.jsx("input",{type:"checkbox",checked:t.useWorktrees,onChange:h=>p("useWorktrees",h.target.checked),disabled:u,"data-testid":"workspace-form-worktrees"}),r.jsx("span",{className:gt.checkboxLabel,children:"Enable worktree isolation"})]})}),r.jsxs("div",{className:gt.section,children:[r.jsx("label",{className:gt.label,htmlFor:"ws-workdir",children:"Working Directory"}),r.jsx("input",{id:"ws-workdir",className:gt.titleInput,type:"text",value:t.workingDirectory,onChange:h=>p("workingDirectory",h.target.value),placeholder:"Default (server default)",disabled:u,"data-testid":"workspace-form-workdir"})]})]})}const hx=b.createContext(void 0),IL=4e3;function OL({children:t}){const[s,i]=b.useState([]),o=b.useRef(0),c=b.useCallback(d=>{i(p=>p.filter(h=>h.id!==d))},[]),u=b.useCallback((d,p="info",h=IL)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:p,duration:h}])},[]);return r.jsx(hx.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:t})}function gn(){const t=b.useContext(hx);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const $p="grackle-theme",gx="grackle-prefer-system",vx="(prefers-color-scheme: dark)";let Dr=[],Vc;function rp(){Vc=void 0;for(const t of Dr)t()}function Pp(){return typeof window>"u"?!1:window.matchMedia(vx).matches}function Lr(){if(typeof localStorage>"u")return Cb;try{const t=localStorage.getItem($p);if(t!==null&&fx.has(t))return t}catch{}return Cb}function eu(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(gx)==="true"}catch{return!1}}function Vp(t){return mu.find(s=>s.variantLightId===t||s.variantDarkId===t)}function yx(t,s){const i=Up(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?Pp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=Vp(t);if(o!=null&&o.variantLightId&&o.variantDarkId)return Pp()?o.variantDarkId:o.variantLightId}return t}function po(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=yx(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&po(Lr(),eu());function BL(){return Vc===void 0&&(Vc={themeId:Lr(),systemDark:Pp(),preferSystem:eu()}),Vc}function LL(t){return Dr=[...Dr,t],()=>{Dr=Dr.filter(s=>s!==t)}}function zL(){const t=b.useSyncExternalStore(LL,BL),{themeId:s,preferSystem:i}=t,o=yx(s,i),c=b.useCallback(d=>{if(fx.has(d)){try{localStorage.setItem($p,d)}catch{}po(d,eu(),!0),rp()}},[]),u=b.useCallback(d=>{try{localStorage.setItem(gx,d?"true":"false")}catch{}if(d){const p=Lr(),h=Up(p);if(h!=null&&h.hidden){const g=Vp(p);if(g)try{localStorage.setItem($p,g.id)}catch{}}}po(Lr(),d,!0),rp()},[]);return b.useEffect(()=>{po(s,i)},[s,i]),b.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(vx),p=()=>{const h=Lr(),g=eu();if(g){const v=Up(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&po(h,g),v!=null&&v.hidden){const y=Vp(h);y!=null&&y.variantDarkId&&y.variantLightId&&po(h,g)}}rp()};return d.addEventListener("change",p),()=>{d.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const bx=b.createContext(void 0);function UL({children:t}){const s=zL();return r.jsx(bx.Provider,{value:s,children:t})}function _x(){const t=b.useContext(bx);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const xx=b.createContext(void 0),kx=b.createContext(void 0);function $L({children:t}){const[s,i]=b.useState(void 0),o=b.useCallback(c=>{i(c)},[]);return r.jsx(kx.Provider,{value:o,children:r.jsx(xx.Provider,{value:s,children:t})})}function PL(){return b.useContext(xx)}function VL(){const t=b.useContext(kx);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const $m=b.createContext(void 0);function ct(){const t=b.useContext($m);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function Sx(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Tx(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function HL(t){return Sx(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 qL=new Set(["off","subscription","api_key"]),Cc=new Set(["off","on"]);function GL(t){return Sx(t)&&qL.has(t.claude)&&Cc.has(t.github)&&Cc.has(t.copilot)&&Cc.has(t.codex)&&Cc.has(t.goose)}function wx(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 Nx(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 fo=5e3;function FL(t,s){const i=[];let o=t;const c=new Set;for(;o&&s.has(o)&&!c.has(o);){c.add(o);const u=s.get(o);i.unshift(u),o=u.parentTaskId||void 0}return i}const Xs={label:"Home",url:yi};function ZL(t){return t?[Xs,{label:"Settings",url:_o},{label:t,url:void 0}]:[Xs,{label:"Settings",url:void 0}]}const Pm={label:"Environments",url:xo};function KL(){return[Xs,{label:"Environments",url:void 0}]}function YL(){return[Xs,{label:"New Chat",url:void 0}]}function JL(t){return[Xs,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function WL(t,s,i,o){const c=i.find(d=>d.id===t),u=o.find(d=>d.id===s);return[Xs,Pm,{label:(u==null?void 0:u.displayName)??"Environment",url:vi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function XL(t,s,i,o,c){const u=FL(t,c),d=c.get(t),p=d==null?void 0:d.workspaceId,h=p?i.find(k=>k.id===p):void 0,g=s??(h==null?void 0:h.environmentId),v=g?o.find(k=>k.id===g):void 0,y=[Xs];v&&g&&(y.push(Pm),y.push({label:v.displayName,url:vi(g)})),h&&g&&y.push({label:h.name,url:gi(h.id,g)});for(let k=0;k<u.length-1;k++)y.push({label:u[k].title,url:rs(u[k].id,void 0,p,g)});const _=u[u.length-1];return y.push({label:(_==null?void 0:_.title)??t,url:void 0}),y}const QL={label:"Findings",url:ru};function e8(){return[Xs,{label:"Findings",url:void 0}]}function jx(t,s,i,o,c){const u=[Xs];if(s&&i){const d=o.find(h=>h.id===s),p=c.find(h=>h.id===i);u.push(Pm),p&&u.push({label:p.displayName,url:vi(i)}),d&&u.push({label:d.name,url:gi(s,i)}),u.push({label:"Findings",url:FN(s,i)})}else u.push(QL);return u.push({label:t,url:void 0}),u}function Vm(t){const s=[];for(const i of t){const o=s[s.length-1];i.eventType==="text"&&(o==null?void 0:o.eventType)==="text"?s[s.length-1]={...o,content:o.content+i.content}:s.push(i)}return s}function Ec(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 t8(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 Hm(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 y=s.get(v),_=y?Ec(y):void 0;if(_)try{const k=JSON.parse(v.content);i.set(_,{tool:k.tool,args:k.args})}catch{}}const o=new Set,c=new Set,u=t.map((v,y)=>{if(v.eventType!=="tool_result")return v;const _=s.get(v),k=_?t8(_):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;o.add(k),c.add(y);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}}}),d=[];for(let v=0;v<u.length;v++){if(u[v].eventType!=="tool_use")continue;const y=s.get(u[v]),_=y?Ec(y):void 0;_&&o.has(_)||d.push(v)}const p=[];for(let v=0;v<u.length;v++)u[v].eventType!=="tool_result"||c.has(v)||p.push(v);let h=0;for(const v of d){for(;h<p.length&&p[h]<v;)h++;if(h>=p.length)break;const y=p[h];if(y!==v+1)continue;const _=u[v],k=u[y];let S;try{const w=JSON.parse(_.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{}u[y]={...k,toolUseCtx:{...S,detailedResult:w}},c.add(y);const T=s.get(_),C=T?Ec(T):void 0;C?o.add(C):(o.add(`__seq_${v}`),s.set(_,{...T??{},__seqId:`__seq_${v}`})),h++}}const g=u.filter(v=>{if(v.eventType!=="tool_use")return!0;const y=s.get(v);if(!y)return!0;const _=Ec(y);if(_&&o.has(_))return!1;const k=y.__seqId;return!(k&&o.has(k))});for(let v=0;v<g.length;v++){if(g[v].eventType!=="tool_use")continue;let y=!1;for(let _=v+1;_<g.length;_++)if(g[_].eventType!=="tool_use"){y=!0;break}y&&(g[v]={...g[v],settled:!0})}return g}function n8(t,s,i){const o=t.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Cx(s),u=s.filter(h=>Hp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||Hp(h,c)).length,p=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:p}}function Cx(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function Hp(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function s8(t,s){var d;const i=new Map;for(const p of s)i.set(p.id,p);const o=Cx(t),c=[];for(const p of t){const h=p.workspaceId?((d=i.get(p.workspaceId))==null?void 0:d.name)??"Unknown":"Unknown";p.status==="failed"?c.push({task:p,reason:"failed",workspaceName:h}):Hp(p,o)?c.push({task:p,reason:"blocked",workspaceName:h}):p.status==="paused"&&c.push({task:p,reason:"paused",workspaceName:h})}const u={failed:0,blocked:1,paused:2};return c.sort((p,h)=>(u[p.reason]??3)-(u[h.reason]??3)),c}function a8(t,s){const i=new Map;for(const o of s)i.set(o.id,o);return t.filter(o=>o.status==="running"||o.status==="idle"||o.status==="waiting").map(o=>{var c;return{session:o,environmentName:((c=i.get(o.environmentId))==null?void 0:c.displayName)??"Unknown"}})}function i8(t,s,i){const o=new Map;for(const c of s){if(!c.workspaceId)continue;let u=o.get(c.workspaceId);u||(u={totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0},o.set(c.workspaceId,u)),u.totalTasks+=1,c.status==="complete"?u.completedTasks+=1:c.status==="working"?u.workingTasks+=1:c.status==="failed"&&(u.failedTasks+=1)}return t.map(c=>{const u=o.get(c.id)??{totalTasks:0,completedTasks:0,workingTasks:0,failedTasks:0};return{workspace:c,totalTasks:u.totalTasks,completedTasks:u.completedTasks,workingTasks:u.workingTasks,failedTasks:u.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"}],o8=new Map(vs.map(t=>[t.id,t]));function lp(t){const s=o8.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Ab={"kn-auth-flow":{node:lp("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:lp("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:lp("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"}]}},r8=[{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}],l8=[{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}],c8=[{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"}],u8=[{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"}],d8=[{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:""}],Ac=[{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"}],f8=[{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:""}],p8=[{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:[]}],m8={"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 Db=[{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"}}]}],Rb=400;function h8({children:t}){const[s,i]=b.useState(r8),[o,c]=b.useState(l8),[u,d]=b.useState(c8),[p,h]=b.useState(void 0),[g,v]=b.useState(u8),[y,_]=b.useState(d8),[k,S]=b.useState(Ac),[w,N]=b.useState(void 0),T=!1,[C,E]=b.useState(f8),[R,D]=b.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[A,q]=b.useState(p8),[$]=b.useState(m8),[Y,G]=b.useState(""),[Q,ae]=b.useState(vs),[me,ie]=b.useState(Ca),[ee,B]=b.useState(void 0),[Z,ne]=b.useState(void 0),[re,ue]=b.useState(""),Ke=b.useRef(void 0),je=b.useRef(0),Te=b.useRef(0),Ie=b.useRef(new Set),le=b.useRef(new Map),ve=b.useRef(y);ve.current=y;const de=b.useRef(new Map),Oe=b.useRef(new Map),_t=b.useCallback(P=>(je.current+=1,`mock-${P}-${String(je.current).padStart(3,"0")}`),[]),vn=b.useCallback(()=>{const P=Db[Te.current%Db.length];return Te.current+=1,P},[]),L=b.useCallback((P,te,oe)=>{const ce=setTimeout(()=>{var fe;Ie.current.delete(ce),oe&&((fe=le.current.get(oe))==null||fe.delete(ce)),P()},te);Ie.current.add(ce),oe&&(le.current.has(oe)||le.current.set(oe,new Set),le.current.get(oe).add(ce))},[]),Me=b.useCallback(P=>{const te=le.current.get(P);te&&(te.forEach(oe=>{clearTimeout(oe),Ie.current.delete(oe)}),le.current.delete(P))},[]),et=b.useCallback((P,te,oe)=>{c(ce=>ce.map(fe=>fe.id===P?{...fe,status:te,...oe!==void 0?{endReason:oe}:{}}:fe))},[]),tt=b.useCallback(P=>{d(te=>[...te,P])},[]),qe=b.useCallback((P,te,oe)=>{te.forEach((ce,fe)=>{L(()=>{const ze={sessionId:P,...ce.event,timestamp:new Date().toISOString()};if(tt(ze),ce.event.eventType==="status"){const ye=wx(ce.event.content),Ae=Nx(ce.event.content);et(P,ye,Ae)}fe===te.length-1&&oe&&oe()},ce.delayMs,P)})},[L,tt,et]),cs=b.useCallback(async(P,te,oe,ce)=>{console.log("[MockGrackle] spawn",{environmentId:P,prompt:te,runtime:ce});const fe=_t("sess"),ze={id:fe,environmentId:P,runtime:ce||"claude-code",status:"running",prompt:te,startedAt:new Date().toISOString()};c(Ae=>[...Ae,ze]),h(fe);const ye=vn();if(console.log(`[MockGrackle] Playing scenario: ${ye.label}`),ye.pauseForInput){const Ae=ye.pauseAfterStep??ye.steps.length-1,Fe=ye.steps.slice(0,Ae+1),ut=Fe.length>0?Fe[Fe.length-1].delayMs:0;qe(fe,Fe),L(()=>{et(fe,"idle"),tt({sessionId:fe,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ut+Rb,fe),ye.resumeSteps&&de.current.set(fe,ye.resumeSteps)}else qe(fe,ye.steps)},[_t,vn,qe,L,et,tt]),ea=b.useCallback(async P=>{console.log("[MockGrackle] kill",P),Me(P),de.current.delete(P),et(P,"stopped","killed"),tt({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),_(te=>te.map(oe=>oe.latestSessionId===P&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Me,et,tt]),An=b.useCallback(async P=>{console.log("[MockGrackle] stopGraceful",P),Me(P),de.current.delete(P),et(P,"stopped","terminated"),tt({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),_(te=>te.map(oe=>oe.latestSessionId===P&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Me,et,tt]),Zn=b.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),us=b.useCallback(async P=>{console.log("[MockGrackle] loadSessionEvents",P)},[]),ta=b.useCallback(()=>{console.log("[MockGrackle] clearEvents"),d([])},[]),Kn=b.useCallback(async(P,te,oe,ce,fe,ze,ye,Ae,Fe)=>{console.log("[MockGrackle] createWorkspace",{name:P,description:te});const ut={id:_t("proj"),name:P,description:te||"",repoUrl:oe||"",environmentId:ce||"",status:"active",workingDirectory:ye||"",useWorktrees:ze??!0,defaultPersonaId:fe||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Ze=>[...Ze,ut]),Ae&&Ae()},[_t]),Ne=b.useCallback(async P=>{console.log("[MockGrackle] archiveWorkspace",P),v(te=>te.map(oe=>oe.id===P?{...oe,status:"archived"}:oe))},[]),Ce=b.useCallback(async P=>{console.log("[MockGrackle] loadTasks",P)},[]),cn=b.useCallback(async(P,te,oe,ce,fe,ze,ye,Ae,Fe)=>{console.log("[MockGrackle] createTask",{workspaceId:P,title:te,parentTaskId:fe}),_(ut=>{const Ut=ut.filter(pt=>pt.workspaceId===P).reduce((pt,Vt)=>Math.max(pt,Vt.sortOrder),0),Ft=fe?ut.find(pt=>pt.id===fe):void 0;if(fe&&!Ft)return console.warn("[MockGrackle] Parent task not found:",fe),ut;if(Ft&&!Ft.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",fe),ut;const Et=Ft?Ft.depth+1:0,sn={id:_t("task"),workspaceId:P,title:te,description:oe||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:ce||[],reviewNotes:void 0,sortOrder:Ut+1,createdAt:new Date().toISOString(),parentTaskId:fe||"",depth:Et,childTaskIds:[],canDecompose:ye??!fe,defaultPersonaId:ze||"",workpad:""};return[...ut,sn]}),Ae&&Ae()},[_t]),yn=b.useCallback(async(P,te,oe,ce)=>{var ut;console.log("[MockGrackle] startTask",{taskId:P});const fe=ve.current.find(Ze=>Ze.id===P),ze=(fe==null?void 0:fe.title)??"",ye=_t("sess"),Ae={id:ye,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:ze||P,startedAt:new Date().toISOString()};c(Ze=>[...Ze,Ae]),_(Ze=>Ze.map(Ut=>Ut.id===P?{...Ut,status:"working",latestSessionId:ye,branch:`mock/${P.slice(0,8)}`}:Ut));const Fe=vn();if(console.log(`[MockGrackle] Playing task scenario: ${Fe.label}`),Fe.pauseForInput){const Ze=Fe.pauseAfterStep??Fe.steps.length-1,Ut=Fe.steps.slice(0,Ze+1),Ft=Ut.length>0?Ut[Ut.length-1].delayMs:0;if(qe(ye,Ut),L(()=>{et(ye,"idle"),tt({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Ft+Rb,ye),Fe.resumeSteps){const Et=[...Fe.resumeSteps];de.current.set(ye,Et);const sn=Et.reduce((pt,Vt)=>Math.max(pt,Vt.delayMs),0);Oe.current.set(ye,{taskId:P,delayAfterResume:sn+200})}}else{const Ze=Fe.steps.length>0?Fe.steps[Fe.steps.length-1].delayMs:0;qe(ye,Fe.steps);const Ut=(ut=Fe.steps[Fe.steps.length-1])==null?void 0:ut.event.content;L(()=>{Ut==="completed"?_(Ft=>Ft.map(Et=>Et.id===P&&Et.status==="working"?{...Et,status:"paused"}:Et)):Ut==="failed"&&_(Ft=>Ft.map(Et=>Et.id===P&&Et.status==="working"?{...Et,status:"failed"}:Et))},Ze+100,ye)}},[_t,vn,qe,L,et,tt]),ks=b.useCallback(async(P,te)=>{console.log("[MockGrackle] sendInput",{sessionId:P,text:te}),tt({sessionId:P,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${te}`}),et(P,"running"),tt({sessionId:P,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const oe=de.current.get(P);if(oe)de.current.delete(P),qe(P,oe);else{const fe=[{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"}}];qe(P,fe)}const ce=Oe.current.get(P);ce&&(Oe.current.delete(P),L(()=>{_(fe=>fe.map(ze=>ze.id===ce.taskId&&ze.status==="working"?{...ze,status:"paused"}:ze))},ce.delayAfterResume,P))},[tt,et,qe,L]),ds=b.useCallback(async P=>{console.log("[MockGrackle] completeTask",P),_(te=>te.map(oe=>oe.id===P?{...oe,status:"complete"}:oe))},[]),Ti=b.useCallback(async P=>{console.log("[MockGrackle] resumeTask",P)},[]),Ua=b.useCallback(async(P,te,oe,ce,fe)=>{console.log("[MockGrackle] updateTask",{taskId:P,title:te}),_(ze=>ze.map(ye=>ye.id===P?{...ye,title:te.trim()||ye.title,description:oe,dependsOn:ce,...fe!==void 0?{defaultPersonaId:fe}:{}}:ye))},[]),wi=b.useCallback(async P=>{console.log("[MockGrackle] deleteTask",P),_(te=>te.filter(oe=>oe.id!==P))},[]),sl=b.useCallback(async P=>{console.log("[MockGrackle] loadFindings",P),S(Ac.filter(te=>te.workspaceId===P))},[]),na=b.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),S([...Ac])},[]),Qt=b.useCallback(async P=>{console.log("[MockGrackle] loadFinding",P);const te=Ac.find(oe=>oe.id===P);N(te)},[]),Yn=b.useCallback(async(P,te,oe,ce,fe)=>{console.log("[MockGrackle] postFinding",{workspaceId:P,title:te});const ze={id:_t("find"),workspaceId:P,taskId:"",sessionId:"",category:ce||"general",title:te,content:oe,tags:fe||[],createdAt:new Date().toISOString()};S(ye=>[...ye,ze])},[_t]),en=b.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),al=b.useCallback(async(P,te,oe)=>{console.log("[MockGrackle] addEnvironment",{displayName:P,adapterType:te,adapterConfig:oe})},[]),il=b.useCallback(async(P,te)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:P,...te}),i(oe=>oe.map(ce=>ce.id!==P?ce:{...ce,...te.displayName!==void 0?{displayName:te.displayName}:{},...te.adapterConfig!==void 0?{adapterConfig:JSON.stringify(te.adapterConfig)}:{}}))},[]),ol=b.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),$a=b.useCallback(async(P,te,oe,ce,fe)=>{console.log("[MockGrackle] setToken",{name:P,tokenType:oe}),E(ze=>[...ze.filter(Ae=>Ae.name!==P),{name:P,tokenType:oe,envVar:ce,filePath:fe,expiresAt:""}])},[]),Pa=b.useCallback(async P=>{console.log("[MockGrackle] deleteToken",P),E(te=>te.filter(oe=>oe.name!==P))},[]),Va=b.useCallback(async P=>{console.log("[MockGrackle] updateCredentialProviders",P),D(P)},[]);b.useEffect(()=>()=>{Ie.current.forEach(clearTimeout),Ie.current.clear()},[]);const Ss=b.useMemo(()=>({connected:!0,send:()=>{},environments:s,sessions:o,events:u,eventsDropped:0,lastSpawnedId:p,workspaces:g,tasks:y,findings:k,selectedFinding:w,findingLoading:T,tokens:C,credentialProviders:R,spawn:cs,sendInput:ks,kill:ea,stopGraceful:An,refresh:Zn,loadSessionEvents:us,clearEvents:ta,loadWorkspaces:async()=>{console.log("[MockGrackle] loadWorkspaces")},createWorkspace:Kn,archiveWorkspace:Ne,updateWorkspace:async(P,te)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:P,...te}),v(oe=>oe.map(ce=>ce.id!==P?ce:{...ce,...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:Ce,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:cn,startTask:yn,stopTask:async P=>{console.log("[MockGrackle] stopTask",{taskId:P}),await ds(P)},completeTask:ds,resumeTask:Ti,updateTask:Ua,deleteTask:wi,loadFindings:sl,loadAllFindings:na,loadFinding:Qt,postFinding:Yn,loadEnvironments:en,addEnvironment:al,updateEnvironment:il,loadTokens:ol,setToken:$a,deleteToken:Pa,updateCredentialProviders:Va,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:A,createPersona:async(P,te,oe,ce,fe,ze,ye,Ae,Fe)=>{console.log("[MockGrackle] createPersona",{name:P});const ut={id:`mock-persona-${Date.now()}`,name:P,description:te,systemPrompt:oe,toolConfig:"{}",runtime:ce??"claude-code",model:fe||"",maxTurns:ze||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ye||"agent",script:Ae||"",allowedMcpTools:Fe||[]};return q(Ze=>[...Ze,ut]),ut},updatePersona:async(P,te,oe,ce,fe,ze,ye,Ae,Fe,ut)=>{console.log("[MockGrackle] updatePersona",{personaId:P,name:te});const Ze=A.find(Et=>Et.id===P);if(!Ze)throw new Error(`Persona not found: ${P}`);const Ut=new Date().toISOString(),Ft={...Ze,...te!==void 0?{name:te}:{},...oe!==void 0?{description:oe}:{},...ce!==void 0?{systemPrompt:ce}:{},...fe!==void 0?{runtime:fe}:{},...ze!==void 0?{model:ze}:{},...ye!==void 0?{maxTurns:ye}:{},...Ae!==void 0?{type:Ae}:{},...Fe!==void 0?{script:Fe}:{},...ut!==void 0?{allowedMcpTools:ut}:{},updatedAt:Ut};return q(Et=>Et.map(sn=>sn.id===P?Ft:sn)),Ft},deletePersona:async P=>{console.log("[MockGrackle] deletePersona",P),q(te=>te.filter(oe=>oe.id!==P))},taskSessions:$,loadTaskSessions:async P=>{console.log("[MockGrackle] loadTaskSessions",P)},appDefaultPersonaId:Y,setAppDefaultPersonaId:async P=>{console.log("[MockGrackle] setAppDefaultPersonaId",P),G(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:Q,links:me},selectedNode:ee,loading:!1,selectedId:Z,searchQuery:re,search:async P=>{if(console.log("[MockGrackle] knowledge.search",P),!P.trim()){ue(P);return}ue(P);const te=Ke.current,oe=te?vs.filter(ye=>!ye.workspaceId||ye.workspaceId===te):vs,ce=P.toLowerCase(),fe=oe.filter(ye=>{var Ae,Fe,ut;return ye.label.toLowerCase().includes(ce)||((Ae=ye.content)==null?void 0:Ae.toLowerCase().includes(ce))||((Fe=ye.tags)==null?void 0:Fe.some(Ze=>Ze.toLowerCase().includes(ce)))||((ut=ye.category)==null?void 0:ut.toLowerCase().includes(ce))});ae(fe);const ze=new Set(fe.map(ye=>ye.id));ie(Ca.filter(ye=>ze.has(ye.source)&&ze.has(ye.target))),ne(void 0),B(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),ue("");const P=Ke.current,te=P?vs.filter(ce=>!ce.workspaceId||ce.workspaceId===P):vs;ae(te);const oe=new Set(te.map(ce=>ce.id));ie(Ca.filter(ce=>oe.has(ce.source)&&oe.has(ce.target)))},selectNode:async P=>{console.log("[MockGrackle] knowledge.selectNode",P),ne(P);const te=P in Ab?Ab[P]:void 0;if(te)B(te);else{const oe=vs.find(ce=>ce.id===P);if(oe){const ce=Ca.filter(fe=>fe.source===P||fe.target===P).map(fe=>({fromId:fe.source,toId:fe.target,type:fe.type}));B({node:oe,edges:ce})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ne(void 0),B(void 0)},expandNode:async P=>{console.log("[MockGrackle] knowledge.expandNode",P),ae(te=>{const oe=new Set(te.map(Ae=>Ae.id)),ce=Ca.filter(Ae=>Ae.source===P||Ae.target===P),fe=new Set;for(const Ae of ce)oe.has(Ae.source)||fe.add(Ae.source),oe.has(Ae.target)||fe.add(Ae.target);if(fe.size===0)return te;const ze=vs.filter(Ae=>fe.has(Ae.id)),ye=new Set([...oe,...fe]);return ie(Ae=>{const Fe=new Set(Ae.map(Ze=>`${Ze.source}|${Ze.target}|${Ze.type}`)),ut=Ca.filter(Ze=>ye.has(Ze.source)&&ye.has(Ze.target)&&!Fe.has(`${Ze.source}|${Ze.target}|${Ze.type}`));return ut.length>0?[...Ae,...ut]:Ae}),[...te,...ze]})},loadRecent:async P=>{if(console.log("[MockGrackle] knowledge.loadRecent",P),Ke.current=P,P){const te=vs.filter(ce=>!ce.workspaceId||ce.workspaceId===P);ae(te);const oe=new Set(te.map(ce=>ce.id));ie(Ca.filter(ce=>oe.has(ce.source)&&oe.has(ce.target)))}else ae(vs),ie(Ca);ue("")},handleEvent:()=>!1}}),[s,o,u,p,g,y,k,w,C,R,A,$,Y,Q,me,ee,Z,re,cs,ks,ea,An,Zn,us,ta,Kn,Ne,Ce,cn,yn,ds,Ti,Ua,wi,sl,na,Qt,Yn,en,al,il,ol,$a,Pa,Va]);return r.jsx($m.Provider,{value:Ss,children:t})}const g8=3e3;function v8(t){const[s,i]=b.useState(!1),o=b.useRef(t.onSessionEvent);o.current=t.onSessionEvent;const c=b.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const u=b.useRef(t.onConnect);u.current=t.onConnect;const d=b.useRef(t.onDisconnect);return d.current=t.onDisconnect,b.useEffect(()=>{let p=!1,h;async function g(){var v,y;if(!p){try{const _=xe.streamEvents({});i(!0),Promise.resolve((v=u.current)==null?void 0:v.call(u)).catch(()=>{});for await(const k of _){if(p)break;const S=k.event;if(S.case==="sessionEvent"){const w=S.value;o.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(_){if(_ instanceof Kr&&_.code===nT.Unauthenticated){window.location.href=HN;return}}p||(i(!1),(y=d.current)==null||y.call(d),h=setTimeout(()=>{g().catch(()=>{})},g8))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function y8(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Mb(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 b8(t){return{sessionId:t.sessionId,eventType:Jb(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function _8(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:sT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Ib(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:aT(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 cp(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 x8(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function k8(t){return{claude:iT(t.claude),github:bc(t.github),copilot:bc(t.copilot),codex:bc(t.codex),goose:bc(t.goose)}}function S8(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function up(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 T8(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Dc(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 dp(t){return{source:t.fromId,target:t.toId,type:t.type}}const Ob=5e3;function jr(t){return t instanceof Kr?t.message:"Operation failed"}function w8(){const[t,s]=b.useState([]),[i,o]=b.useState({}),[c,u]=b.useState(""),d=b.useCallback(()=>{u("")},[]),p=b.useCallback(async()=>{try{const w=await xe.listEnvironments({});s(w.environments.map(y8))}catch{}},[]),h=b.useCallback(w=>{switch(w.type){case"environment.added":return!0;case"environment.removed":{const N=w.payload.environmentId;return N&&(s(T=>T.filter(C=>C.id!==N)),o(T=>{const C={...T};return delete C[N],C})),!0}case"environment.changed":return p().catch(()=>{}),!0;case"environment.provision_progress":{const N=w.payload;if(typeof N.environmentId!="string"||typeof N.stage!="string"||typeof N.message!="string"||typeof N.progress!="number")return Tx("environment.provision_progress","invalid payload"),!0;if(o(T=>({...T,[N.environmentId]:{stage:N.stage,message:N.message,progress:N.progress}})),N.stage==="ready"){const T=N.environmentId;setTimeout(()=>{o(C=>{const E={...C};return delete E[T],E})},Ob)}return!0}default:return!1}},[p]),g=b.useCallback(w=>{var N;if(w.type==="environments"){const T=Array.isArray((N=w.payload)==null?void 0:N.environments)?w.payload.environments:[];return s(T),!0}return!1},[]),v=b.useCallback(async(w,N,T)=>{u("");try{await xe.addEnvironment({displayName:w,adapterType:N,adapterConfig:JSON.stringify(T??{})})}catch(C){u(jr(C))}},[]),y=b.useCallback(async(w,N)=>{u("");try{await xe.updateEnvironment({id:w,displayName:N.displayName,adapterConfig:N.adapterConfig?JSON.stringify(N.adapterConfig):void 0})}catch(T){u(jr(T))}},[]),_=b.useCallback(async(w,N)=>{u("");try{const T=xe.provisionEnvironment({id:w,force:N??!1});for await(const C of T)o(E=>({...E,[w]:{stage:C.stage,message:C.message,progress:C.progress}})),C.stage==="ready"&&setTimeout(()=>{o(E=>{const R={...E};return delete R[w],R})},Ob)}catch(T){o(C=>{const E={...C};return delete E[w],E}),u(jr(T))}},[]),k=b.useCallback(async w=>{u("");try{await xe.stopEnvironment({id:w})}catch(N){u(jr(N))}},[]),S=b.useCallback(async w=>{u("");try{await xe.removeEnvironment({id:w})}catch(N){u(jr(N))}},[]);return{environments:t,provisionStatus:i,operationError:c,clearOperationError:d,loadEnvironments:p,addEnvironment:v,updateEnvironment:y,provisionEnvironment:_,stopEnvironment:k,removeEnvironment:S,handleEvent:h,handleLegacyMessage:g}}const fp=new Set(["pending","running","idle"]),N8=new Set(["completed","failed","interrupted","hibernating","suspended"]),Bb=["pending","running","idle"];function j8(){const[t,s]=b.useState([]),[i,o]=b.useState([]),[c,u]=b.useState(0),[d,p]=b.useState(void 0),[h,g]=b.useState({}),v=b.useCallback(async()=>{try{const A=(await xe.listSessions({})).sessions.map(Mb);s(q=>{const $=new Map(q.map(Y=>[Y.id,Y]));return A.map(Y=>{const G=$.get(Y.id),Q=G==null?void 0:G.status;return!Q||Q===Y.status?Y:N8.has(Q)&&fp.has(Y.status)?{...Y,status:Q,...G.endReason!==void 0?{endReason:G.endReason}:{}}:fp.has(Q)&&fp.has(Y.status)&&Bb.indexOf(Q)>Bb.indexOf(Y.status)?{...Y,status:Q}:Y})})}catch{}},[]),y=b.useCallback(D=>{if(D.type!=="session_event")return!1;if(!HL(D.payload))return Tx("session_event","payload is not a valid SessionEvent"),!0;const A=D.payload;let q=0;if(o($=>{const Y=[...$,A];return Y.length>fo?(q=Y.length-fo,Y.slice(-fo)):Y}),q>0&&u($=>$+q),A.eventType==="usage")try{const $=JSON.parse(A.content),Y=Number($.input_tokens)||0,G=Number($.output_tokens)||0,Q=Number($.cost_usd)||0;(Y>0||G>0||Q>0)&&s(ae=>ae.map(me=>me.id===A.sessionId?{...me,inputTokens:(me.inputTokens??0)+Y,outputTokens:(me.outputTokens??0)+G,costUsd:(me.costUsd??0)+Q}:me))}catch{}if(A.eventType==="status"){const $=wx(A.content),Y=Nx(A.content);s(G=>G.some(ae=>ae.id===A.sessionId)?G.map(ae=>ae.id===A.sessionId?{...ae,status:$,...Y!==void 0?{endReason:Y}:{}}:ae):[...G,{id:A.sessionId,environmentId:"",runtime:"",status:$,prompt:"",startedAt:A.timestamp,...Y!==void 0?{endReason:Y}:{}}])}return!0},[]),_=b.useCallback(D=>{y({type:"session_event",payload:D})},[y]),k=b.useCallback(D=>{var A,q,$,Y,G;switch(D.type){case"sessions":{const Q=Array.isArray((A=D.payload)==null?void 0:A.sessions)?D.payload.sessions:[];return s(Q),!0}case"spawned":{const Q=(q=D.payload)==null?void 0:q.sessionId;return typeof Q=="string"&&Q&&p(Q),v().catch(()=>{}),!0}case"session_events":{const Q=Array.isArray(($=D.payload)==null?void 0:$.events)?D.payload.events:[];return Q.length>0&&o(Q),!0}case"task_sessions":{const Q=(Y=D.payload)==null?void 0:Y.taskId;if(typeof Q=="string"&&Q){const ae=Array.isArray((G=D.payload)==null?void 0:G.sessions)?D.payload.sessions:[];g(me=>({...me,[Q]:ae}))}return!0}default:return!1}},[v]),S=b.useCallback(async(D,A,q,$)=>{try{const Y=await xe.spawnAgent({environmentId:D,prompt:A,personaId:q||"",workingDirectory:$||""});p(Y.id),await v()}catch{}},[v]),w=b.useCallback(async(D,A)=>{try{await xe.sendInput({sessionId:D,text:A})}catch{}},[]),N=b.useCallback(async D=>{try{await xe.killAgent({id:D,graceful:!1})}catch{}},[]),T=b.useCallback(async D=>{try{await xe.killAgent({id:D,graceful:!0})}catch{}},[]),C=b.useCallback(async D=>{try{const q=(await xe.getSessionEvents({id:D})).events.map(b8);if(q.length>0){let $=0;o(Y=>{const G=new Set;for(const me of Y)me.sessionId===D&&G.add(`${me.timestamp}|${me.eventType}`);const Q=q.filter(me=>!G.has(`${me.timestamp}|${me.eventType}`)),ae=[...Y,...Q].sort((me,ie)=>me.sessionId!==ie.sessionId?0:me.timestamp.localeCompare(ie.timestamp));return ae.length>fo?($=ae.length-fo,ae.slice(-fo)):ae}),$>0&&u(Y=>Y+$)}}catch{}},[]),E=b.useCallback(()=>{o([]),u(0)},[]),R=b.useCallback(async D=>{try{const q=(await xe.getTaskSessions({id:D})).sessions.map(Mb);g($=>({...$,[D]:q}))}catch{}},[]);return{sessions:t,events:i,eventsDropped:c,lastSpawnedId:d,taskSessions:h,loadSessions:v,spawn:S,sendInput:w,kill:N,stopGraceful:T,loadSessionEvents:C,clearEvents:E,loadTaskSessions:R,handleMessage:y,handleSessionEvent:_,handleLegacyMessage:k}}function C8(){const[t,s]=b.useState([]),[i,o]=b.useState(!1),c=b.useCallback(async()=>{try{const v=await xe.listWorkspaces({});s(v.workspaces.map(_8))}catch{}},[]),u=b.useCallback(v=>{switch(v.type){case"workspace.created":return o(!1),c().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return c().catch(()=>{}),!0;default:return!1}},[c]),d=b.useCallback(()=>{o(!1)},[]),p=b.useCallback(async(v,y,_,k,S,w,N,T,C)=>{o(!0);try{await xe.createWorkspace({name:v,description:y||"",repoUrl:_||"",environmentId:k||"",defaultPersonaId:S||void 0,useWorktrees:w??!0,workingDirectory:N||void 0}),o(!1),T==null||T()}catch(E){o(!1);const R=E instanceof Kr?E.message:"Failed to create workspace";C==null||C(R)}},[]),h=b.useCallback(async v=>{try{await xe.archiveWorkspace({id:v})}catch{}},[]),g=b.useCallback(async(v,y)=>{try{await xe.updateWorkspace({id:v,...y})}catch{}},[]);return{workspaces:t,workspaceCreating:i,loadWorkspaces:c,createWorkspace:p,archiveWorkspace:h,updateWorkspace:g,handleEvent:u,onDisconnect:d}}function E8(){const[t,s]=b.useState([]),[i,o]=b.useState(void 0),c=b.useRef({}),u=b.useCallback(async C=>{try{const R=(await xe.listTasks({workspaceId:C})).tasks.map(Ib);s(D=>[...D.filter(A=>A.workspaceId!==C),...R])}catch{}},[]),d=b.useCallback(async()=>{try{const E=(await xe.listTasks({})).tasks.map(Ib);s(R=>{const D=new Set(E.map(A=>A.id));return[...R.filter(A=>!D.has(A.id)),...E]})}catch{}},[]),p=b.useCallback((C,E)=>{const R=D=>{clearTimeout(c.current[D]),c.current[D]=setTimeout(()=>{delete c.current[D],u(D).catch(()=>{})},200)};C?R(C):E&&s(D=>{const A=D.find(q=>q.id===E);return A!=null&&A.workspaceId?R(A.workspaceId):d().catch(()=>{}),D})},[u,d]),h=b.useCallback(C=>{const E=C.payload;switch(C.type){case"task.created":{const R=typeof E.workspaceId=="string"?E.workspaceId:"";return R&&u(R).catch(()=>{}),!0}case"task.started":{const R=typeof E.taskId=="string"?E.taskId:"",D=typeof E.sessionId=="string"?E.sessionId:"",A=typeof E.workspaceId=="string"?E.workspaceId:"";return o(q=>R&&q===R?void 0:q),D&&R&&s(q=>q.map($=>$.id===R?{...$,latestSessionId:D}:$)),p(A,R),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const R=typeof E.workspaceId=="string"?E.workspaceId:"",D=typeof E.taskId=="string"?E.taskId:"";return p(R,D),!0}default:return!1}},[u,p]),g=b.useCallback(()=>{o(void 0)},[]),v=b.useCallback(C=>{var E,R;if(C.type==="tasks"){const D=Array.isArray((E=C.payload)==null?void 0:E.tasks)?C.payload.tasks:[],A=typeof((R=C.payload)==null?void 0:R.workspaceId)=="string"&&C.payload.workspaceId?C.payload.workspaceId:"";return s(A?q=>[...q.filter($=>$.workspaceId!==A),...D]:q=>{const $=new Set(D.map(Y=>Y.id));return[...q.filter(Y=>!$.has(Y.id)),...D]}),!0}return!1},[]),y=b.useCallback(async(C,E,R,D,A,q,$,Y,G)=>{try{await xe.createTask({workspaceId:C,title:E,description:R||"",dependsOn:D||[],parentTaskId:A||"",defaultPersonaId:q||void 0,canDecompose:$??void 0}),Y==null||Y()}catch(Q){const ae=Q instanceof Kr?Q.message:"Failed to create task";G==null||G(ae)}},[]),_=b.useCallback(async(C,E,R,D)=>{o(C);try{await xe.startTask({taskId:C,personaId:E||"",environmentId:R||"",notes:D||""})}catch{o(void 0)}},[]),k=b.useCallback(async C=>{try{await xe.stopTask({id:C})}catch{}},[]),S=b.useCallback(async C=>{try{await xe.completeTask({id:C})}catch{}},[]),w=b.useCallback(async C=>{try{await xe.resumeTask({id:C})}catch{}},[]),N=b.useCallback(async(C,E,R,D,A)=>{try{await xe.updateTask({id:C,title:E,description:R,dependsOn:D,...A!==void 0?{defaultPersonaId:A}:{}})}catch{}},[]),T=b.useCallback(async C=>{try{await xe.deleteTask({id:C})}catch{}},[]);return{tasks:t,taskStartingId:i,loadTasks:u,loadAllTasks:d,createTask:y,startTask:_,stopTask:k,completeTask:S,resumeTask:w,updateTask:N,deleteTask:T,handleEvent:h,onDisconnect:g,handleLegacyMessage:v}}function A8(){const[t,s]=b.useState([]),[i,o]=b.useState(void 0),[c,u]=b.useState(!1),d=b.useCallback(async y=>{try{const _=await xe.queryFindings({workspaceId:y});s(_.findings.map(cp))}catch{}},[]),p=b.useCallback(async()=>{try{const y=await xe.queryFindings({workspaceId:""});s(y.findings.map(cp))}catch{}},[]),h=b.useCallback(async y=>{o(void 0),u(!0);try{const _=await xe.getFinding({id:y});o(cp(_))}catch{o(void 0)}finally{u(!1)}},[]),g=b.useCallback(y=>{if(y.type==="finding.posted"){const _=typeof y.payload.workspaceId=="string"?y.payload.workspaceId:"";return _&&d(_).catch(()=>{}),!0}return!1},[d]),v=b.useCallback(async(y,_,k,S,w)=>{try{await xe.postFinding({workspaceId:y,title:_,content:k,category:S??"general",tags:w??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,loadFindings:d,loadAllFindings:p,loadFinding:h,postFinding:v,handleEvent:g}}function D8(){const[t,s]=b.useState([]),i=b.useCallback(async()=>{try{const d=await xe.listTokens({});s(d.tokens.map(x8))}catch{}},[]),o=b.useCallback(d=>d.type==="token.changed"?(i().catch(()=>{}),!0):!1,[i]),c=b.useCallback(async(d,p,h,g,v)=>{try{await xe.setToken({name:d,value:p,type:h,envVar:g,filePath:v})}catch{}},[]),u=b.useCallback(async d=>{try{await xe.deleteToken({name:d})}catch{}},[]);return{tokens:t,loadTokens:i,setToken:c,deleteToken:u,handleEvent:o}}function R8(){const[t,s]=b.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),i=b.useCallback(async()=>{try{const u=await xe.getCredentialProviders({});s(k8(u))}catch{}},[]),o=b.useCallback(u=>u.type==="credential.providers_changed"?(GL(u.payload)&&s(u.payload),!0):!1,[]),c=b.useCallback(async u=>{const d=[{provider:"claude",value:u.claude},{provider:"github",value:u.github},{provider:"copilot",value:u.copilot},{provider:"codex",value:u.codex},{provider:"goose",value:u.goose}];await Promise.allSettled(d.map(({provider:p,value:h})=>xe.setCredentialProvider({provider:p,value:h})))},[]);return{credentialProviders:t,loadCredentials:i,updateCredentialProviders:c,handleEvent:o}}function M8(){const[t,s]=b.useState([]),[i,o]=b.useState(""),[c,u]=b.useState(""),[d,p]=b.useState(!1),h=b.useCallback(async()=>{try{const v=await xe.listCodespaces({});s(v.codespaces.map(S8)),u(v.error)}catch{}},[]),g=b.useCallback(async(v,y)=>{p(!0),o("");try{await xe.createCodespace({repo:v,machine:y??""}),p(!1),await h()}catch(_){p(!1);const k=_ instanceof Kr?_.message:"Failed to create codespace";o(k)}},[h]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:d,listCodespaces:h,createCodespace:g}}function I8(){const[t,s]=b.useState([]),i=b.useCallback(async()=>{try{const p=await xe.listPersonas({});s(p.personas.map(up))}catch{}},[]),o=b.useCallback(p=>{switch(p.type){case"persona.created":case"persona.updated":case"persona.deleted":return i().catch(()=>{}),!0;default:return!1}},[i]),c=b.useCallback(async(p,h,g,v,y,_,k,S,w)=>{const N=await xe.createPersona({name:p,description:h,systemPrompt:g,runtime:v||"",model:y||"",maxTurns:_||0,type:k||"agent",script:S||"",allowedMcpTools:w||[]}),T=up(N);return s(C=>[...C.filter(E=>E.id!==T.id),T]),T},[]),u=b.useCallback(async(p,h,g,v,y,_,k,S,w,N)=>{const T={id:p};h!==void 0&&(T.name=h),g!==void 0&&(T.description=g),v!==void 0&&(T.systemPrompt=v),y!==void 0&&(T.runtime=y),_!==void 0&&(T.model=_),k!==void 0&&(T.maxTurns=k),S!==void 0&&(T.type=S),w!==void 0&&(T.script=w),N!==void 0&&(T.allowedMcpTools={tools:N});const C=await xe.updatePersona(T),E=up(C);return s(R=>R.map(D=>D.id===E.id?E:D)),E},[]),d=b.useCallback(async p=>{await xe.deletePersona({id:p}),s(h=>h.filter(g=>g.id!==p))},[]);return{personas:t,loadPersonas:i,createPersona:c,updatePersona:u,deletePersona:d,handleEvent:o}}function O8(t){if(t)try{return JSON.parse(t)}catch{return}}function B8(){const[t,s]=b.useState(new Map),[i,o]=b.useState([]),[c,u]=b.useState(void 0),[d,p]=b.useState(void 0),[h,g]=b.useState(!1),[v,y]=b.useState(""),_=b.useRef(""),k=b.useCallback(async R=>{const D=R??"";_.current=D,y(""),g(!0);try{const A=await xe.listRecentKnowledgeNodes({limit:30,workspaceId:D}),q=new Map,$=[];for(const Y of A.nodes)q.set(Y.id,Dc(Y));for(const Y of A.edges)$.push(dp(Y));for(const Y of $){const G=q.get(Y.source);G&&(G.val+=1);const Q=q.get(Y.target);Q&&(Q.val+=1)}s(q),o($)}catch{}finally{g(!1)}},[]),S=b.useCallback(async R=>{if(R.trim()){y(R),p(void 0),u(void 0),g(!0);try{const D=await xe.searchKnowledge({query:R,limit:20,workspaceId:_.current}),A=new Map,q=[];for(const $ of D.results){$.node&&A.set($.node.id,Dc($.node,$.edges.length));for(const Y of $.edges)q.push(dp(Y))}s(A),o(q)}catch{}finally{g(!1)}}},[]),w=b.useCallback(()=>{k(_.current).catch(()=>{})},[k]),N=b.useCallback(async R=>{p(R);try{const D=await xe.getKnowledgeNode({id:R});if(!D.node){u(void 0);return}u({node:Dc(D.node,D.edges.length),edges:D.edges.map(A=>({fromId:A.fromId,toId:A.toId,type:A.type,metadata:O8(A.metadataJson)}))})}catch{u(void 0)}},[]),T=b.useCallback(()=>{p(void 0),u(void 0)},[]),C=b.useCallback(async R=>{try{const D=await xe.expandKnowledgeNode({id:R,depth:1});s(A=>{const q=new Map(A);for(const $ of D.nodes)q.has($.id)||q.set($.id,Dc($));return q}),o(A=>{const q=new Set(A.map(Y=>`${Y.source}:${Y.target}:${Y.type}`)),$=[];for(const Y of D.edges){const G=dp(Y),Q=`${G.source}:${G.target}:${G.type}`;q.has(Q)||$.push(G)}return[...A,...$]})}catch{}},[]),E=b.useCallback(R=>!1,[]);return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:d,loading:h,searchQuery:v,search:S,clearSearch:w,selectNode:N,clearSelection:T,expandNode:C,loadRecent:k,handleEvent:E}}function L8(){const[t,s]=b.useState(""),[i,o]=b.useState(void 0),[c,u]=b.useState({}),d=w8(),p=j8(),h=C8(),g=E8(),v=A8(),y=D8(),_=R8(),k=M8(),S=I8(),w=B8(),{connected:N}=v8({onSessionEvent:G=>{p.handleSessionEvent({sessionId:G.sessionId,eventType:Jb(G.type),timestamp:G.timestamp,content:G.content,raw:G.raw||void 0})},onDomainEvent:G=>{try{const Q=JSON.parse(G.payloadJson);A({id:G.id,type:G.type,timestamp:G.timestamp,payload:Q})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",G.payloadJson)}},onConnect:q,onDisconnect:$}),T="default_persona_id",C="onboarding_completed",E=b.useCallback(async G=>{const Q=await xe.setSetting({key:T,value:G});s(Q.value)},[]),R=b.useCallback(async()=>{o(!0);try{await xe.setSetting({key:C,value:"true"})}catch{}},[]),D=b.useCallback(async(G,Q)=>{try{const ae=await xe.getUsage({scope:G,id:Q}),me=`${G}:${Q}`;u(ie=>({...ie,[me]:T8(ae)}))}catch{}},[]);function A(G){const Q=G.payload.key,ae=G.payload.value;if(G.type==="setting.changed"){Q===T&&s(ae??""),Q===C&&o(ae==="true");return}if(d.handleEvent(G)){(G.type==="environment.removed"||G.type==="environment.changed")&&p.loadSessions().catch(()=>{});return}if(!h.handleEvent(G)){if(g.handleEvent(G)){G.type==="task.started"&&p.loadSessions().catch(()=>{});return}v.handleEvent(G)||y.handleEvent(G)||_.handleEvent(G)||S.handleEvent(G)||w.handleEvent(G)}}async function q(){d.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),y.loadTokens().catch(()=>{}),_.loadCredentials().catch(()=>{}),S.loadPersonas().catch(()=>{}),g.loadAllTasks().catch(()=>{});try{const G=await xe.getSetting({key:T});s(G.value)}catch{}try{const G=await xe.getSetting({key:C});o(G.value==="true")}catch{}}function $(){h.onDisconnect(),g.onDisconnect()}const Y=b.useCallback(()=>{d.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),y.loadTokens().catch(()=>{})},[d.loadEnvironments,p.loadSessions,h.loadWorkspaces,y.loadTokens]);return{connected:N,environments:d.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,tokens:y.tokens,spawn:p.spawn,sendInput:p.sendInput,kill:p.kill,stopGraceful:p.stopGraceful,refresh:Y,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:d.loadEnvironments,addEnvironment:d.addEnvironment,updateEnvironment:d.updateEnvironment,loadTokens:y.loadTokens,setToken:y.setToken,deleteToken:y.deleteToken,credentialProviders:_.credentialProviders,updateCredentialProviders:_.updateCredentialProviders,provisionStatus:d.provisionStatus,environmentOperationError:d.operationError,clearEnvironmentOperationError:d.clearOperationError,provisionEnvironment:d.provisionEnvironment,stopEnvironment:d.stopEnvironment,removeEnvironment:d.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:E,onboardingCompleted:i,completeOnboarding:R,usageCache:c,loadUsage:D,knowledge:w}}function z8({children:t}){const s=L8();return r.jsx($m.Provider,{value:s,children:t})}function U8(t,s){const i=b.useRef(null);b.useEffect(()=>{const o=i.current;if(i.current=t,o===null)return;const c=new Map;for(const d of o)c.set(d.id,d);const u=new Set;for(const d of t){u.add(d.id);const p=c.get(d.id);if(p&&p.status!==d.status&&d.status!=="sleeping"){if(d.status==="connecting"){s("Provisioning environment…","info");continue}d.status==="connected"?s("Environment connected","success"):d.status==="error"?s("Environment provision failed","error"):d.status==="disconnected"&&(p.status==="connected"?s("Environment disconnected","warning"):s("Environment stopped","info"))}}for(const d of o)u.has(d.id)||s("Environment removed","info")},[t,s])}function $8(t,s,i){const o=b.useRef(t);b.useEffect(()=>{t&&t!==o.current&&(i(t,"error"),s()),o.current=t},[t,s,i])}const P8={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 V8(t){return P8[t]}function H8(t,s){if(t===void 0)return[];const i=[],o=new Map;for(const u of t)o.set(u.id,u);const c=new Set;for(const u of s){c.add(u.id);const d=o.get(u.id);if(!d||d.status===u.status)continue;const p=V8(u.status);p&&i.push(p)}for(const u of t)c.has(u.id)||i.push({message:"Task deleted",variant:"info"});return i}function q8(t,s){const i=b.useRef(void 0);b.useEffect(()=>{const o=i.current;i.current=t;const c=H8(o,t);for(const u of c)s(u.message,u.variant)},[t,s])}const G8="_dashboard_16pzm_1",F8="_kpiStrip_16pzm_11",Z8="_kpiCard_16pzm_23",K8="_kpiValue_16pzm_68",Y8="_kpiLabel_16pzm_76",J8="_bodyGrid_16pzm_84",W8="_section_16pzm_96",X8="_sectionHeader_16pzm_109",Q8="_sectionIcon_16pzm_118",ez="_sectionTitle_16pzm_123",tz="_sectionCount_16pzm_131",nz="_sectionBody_16pzm_138",sz="_emptyHint_16pzm_143",az="_sessionRow_16pzm_150",iz="_sessionPrompt_16pzm_177",oz="_sessionEnv_16pzm_186",rz="_sessionRuntime_16pzm_192",lz="_sessionStatus_16pzm_198",cz="_statusDot_16pzm_207",uz="_attentionRow_16pzm_233",dz="_attentionTitle_16pzm_259",fz="_attentionMeta_16pzm_267",pz="_reasonBadge_16pzm_274",mz="_bottomGrid_16pzm_301",hz="_envRow_16pzm_312",gz="_envName_16pzm_323",vz="_envStatusBadge_16pzm_333",yz="_workspaceRow_16pzm_369",bz="_workspaceTop_16pzm_395",_z="_workspaceName_16pzm_401",xz="_workspaceCounts_16pzm_407",kz="_progressBar_16pzm_415",Sz="_progressFill_16pzm_422",_e={dashboard:G8,kpiStrip:F8,kpiCard:Z8,kpiValue:K8,kpiLabel:Y8,bodyGrid:J8,section:W8,sectionHeader:X8,sectionIcon:Q8,sectionTitle:ez,sectionCount:tz,sectionBody:nz,emptyHint:sz,sessionRow:az,sessionPrompt:iz,sessionEnv:oz,sessionRuntime:rz,sessionStatus:lz,statusDot:cz,attentionRow:uz,attentionTitle:dz,attentionMeta:fz,reasonBadge:pz,bottomGrid:mz,envRow:hz,envName:gz,envStatusBadge:vz,workspaceRow:yz,workspaceTop:bz,workspaceName:_z,workspaceCounts:xz,progressBar:kz,progressFill:Sz},Tz={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Rc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function wz(t,s,i,o){const c=[`${t} of ${s} tasks completed`];return i>0&&c.push(`${i} in progress`),o>0&&c.push(`${o} failed`),c.join(", ")}function Mc({value:t,label:s,accent:i,index:o,testId:c}){return r.jsxs(Ct.div,{className:_e.kpiCard,"data-accent":i,"data-testid":c,variants:Tz,initial:"hidden",animate:"visible",custom:o,children:[r.jsx("span",{className:_e.kpiValue,children:t}),r.jsx("span",{className:_e.kpiLabel,children:s})]})}function Nz(){const{workspaces:t,tasks:s,sessions:i,environments:o,loadTasks:c}=ct(),u=bt(),d=b.useRef(new Set);b.useEffect(()=>{for(const y of t)d.current.has(y.id)||(d.current.add(y.id),c(y.id).catch(()=>{}))},[t,c]);const p=b.useMemo(()=>n8(i,s,o),[i,s,o]),h=b.useMemo(()=>a8(i,o),[i,o]),g=b.useMemo(()=>s8(s,t),[s,t]),v=b.useMemo(()=>i8(t,s),[t,s,o]);return r.jsxs("div",{className:_e.dashboard,"data-testid":"dashboard",children:[r.jsxs("div",{className:_e.kpiStrip,"data-testid":"dashboard-kpi-strip",children:[r.jsx(Mc,{value:p.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),r.jsx(Mc,{value:p.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),r.jsx(Mc,{value:p.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),r.jsx(Mc,{value:p.unhealthyEnvironments,label:"Unhealthy Envs",accent:"blue",index:3,testId:"kpi-unhealthy-envs"})]}),r.jsxs("div",{className:_e.bodyGrid,children:[r.jsxs(Ct.div,{className:_e.section,variants:Rc,initial:"hidden",animate:"visible",custom:0,"data-testid":"dashboard-active-sessions",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"●"}),r.jsx("span",{className:_e.sectionTitle,children:"Active Sessions"}),r.jsx("span",{className:_e.sectionCount,children:h.length})]}),r.jsx("div",{className:_e.sectionBody,children:h.length===0?r.jsx("div",{className:_e.emptyHint,children:"No active sessions"}):h.map(({session:y,environmentName:_})=>r.jsxs("button",{type:"button",className:_e.sessionRow,onClick:()=>u(tm(y.id)),"data-testid":"session-row",children:[r.jsx("span",{className:_e.sessionPrompt,title:y.prompt,children:y.prompt||"—"}),r.jsx("span",{className:_e.sessionEnv,children:_}),r.jsx("span",{className:_e.sessionRuntime,children:y.runtime}),r.jsxs("span",{className:_e.sessionStatus,children:[r.jsx("span",{className:_e.statusDot,"data-status":y.status}),y.status]})]},y.id))})]}),r.jsxs(Ct.div,{className:_e.section,variants:Rc,initial:"hidden",animate:"visible",custom:1,"data-testid":"dashboard-needs-attention",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"⚑"}),r.jsx("span",{className:_e.sectionTitle,children:"Needs Attention"}),r.jsx("span",{className:_e.sectionCount,children:g.length})]}),r.jsx("div",{className:_e.sectionBody,children:g.length===0?r.jsx("div",{className:_e.emptyHint,children:"All clear"}):g.map(({task:y,reason:_,workspaceName:k})=>r.jsxs("button",{type:"button",className:_e.attentionRow,onClick:()=>u(rs(y.id)),"data-testid":"attention-row",children:[r.jsxs("div",{className:_e.attentionTitle,children:[r.jsx("span",{className:_e.reasonBadge,"data-reason":_,children:_}),y.title]}),r.jsx("div",{className:_e.attentionMeta,children:r.jsx("span",{children:k})})]},y.id))})]})]}),r.jsxs("div",{className:_e.bottomGrid,children:[r.jsxs(Ct.div,{className:_e.section,variants:Rc,initial:"hidden",animate:"visible",custom:2,"data-testid":"dashboard-env-health",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"◈"}),r.jsx("span",{className:_e.sectionTitle,children:"Environment Health"}),r.jsx("span",{className:_e.sectionCount,children:o.length})]}),r.jsx("div",{className:_e.sectionBody,children:o.length===0?r.jsx("div",{className:_e.emptyHint,children:"No environments configured"}):o.map(y=>r.jsxs("div",{className:_e.envRow,"data-testid":"dashboard-env-row",children:[r.jsx("span",{className:_e.envName,children:y.displayName}),r.jsx("span",{className:_e.envStatusBadge,"data-status":y.status,children:y.status})]},y.id))})]}),r.jsxs(Ct.div,{className:_e.section,variants:Rc,initial:"hidden",animate:"visible",custom:3,"data-testid":"dashboard-workspace-snapshot",children:[r.jsxs("div",{className:_e.sectionHeader,children:[r.jsx("span",{className:_e.sectionIcon,"aria-hidden":"true",children:"▦"}),r.jsx("span",{className:_e.sectionTitle,children:"Workspaces"}),r.jsx("span",{className:_e.sectionCount,children:t.length})]}),r.jsx("div",{className:_e.sectionBody,children:v.length===0?r.jsx("div",{className:_e.emptyHint,children:"No workspaces yet"}):v.map(({workspace:y,totalTasks:_,completedTasks:k,workingTasks:S,failedTasks:w})=>{const N=_>0?Math.round(k/_*100):0;return r.jsxs("button",{type:"button",className:_e.workspaceRow,onClick:()=>u(gi(y.id,y.environmentId)),"data-testid":"workspace-row",children:[r.jsxs("div",{className:_e.workspaceTop,children:[r.jsx("span",{className:_e.workspaceName,children:y.name}),r.jsxs("span",{className:_e.workspaceCounts,"aria-label":wz(k,_,S,w),children:[k,"/",_,S>0&&r.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",S]}),w>0&&r.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",w]})]})]}),_>0&&r.jsx("div",{className:_e.progressBar,children:r.jsx("div",{className:_e.progressFill,style:{width:`${N}%`}})})]},y.id)})})]})]})]})}const jz="_panelContainer_101ly_1",Cz="_emptyState_101ly_8",Ez="_fadeIn_101ly_1",Az="_workspaceSummary_101ly_17",Dz="_workspaceSummaryTitle_101ly_28",Rz="_workspaceSummarySubtitle_101ly_32",Mz="_header_101ly_36",Iz="_headerInfo_101ly_71",Oz="_killButton_101ly_77",Bz="_headerTitle_101ly_106",Lz="_headerActions_101ly_121",zz="_taskStatusBadge_101ly_128",Uz="_taskBranch_101ly_137",$z="_taskBlockedBadge_101ly_143",Pz="_btnPrimary_101ly_151",Vz="_btnDanger_101ly_182",Hz="_btnGhost_101ly_221",qz="_rejectInput_101ly_247",Gz="_tabBar_101ly_277",Fz="_tab_101ly_277",Zz="_active_101ly_303",Kz="_eventScroll_101ly_308",Yz="_tabContent_101ly_314",Jz="_noContext_101ly_319",Wz="_overviewContent_101ly_325",Xz="_overviewDashboard_101ly_334",Qz="_overviewHero_101ly_340",e7="_statusBadge_101ly_347",t7="_statusPending_101ly_359",n7="_statusAssigned_101ly_364",s7="_statusInProgress_101ly_369",a7="_statusReview_101ly_374",i7="_statusDone_101ly_379",o7="_statusFailed_101ly_384",r7="_statusWaitingInput_101ly_389",l7="_overviewBranchPill_101ly_394",c7="_branchLink_101ly_409",u7="_overviewSection_101ly_420",d7="_overviewLabel_101ly_426",f7="_overviewValue_101ly_433",p7="_overviewMuted_101ly_438",m7="_overviewMarkdown_101ly_444",h7="_envRow_101ly_513",g7="_envDot_101ly_519",v7="_envDotGreen_101ly_526",y7="_envDotYellow_101ly_530",b7="_envDotRed_101ly_534",_7="_envDotGray_101ly_538",x7="_depList_101ly_542",k7="_depItem_101ly_548",S7="_depBlocked_101ly_555",T7="_depDone_101ly_559",w7="_timeline_101ly_563",N7="_timelineRow_101ly_569",j7="_timelineKey_101ly_576",C7="_timelineValue_101ly_582",E7="_timelineDelta_101ly_586",A7="_reviewNotes_101ly_597",D7="_overviewDescription_101ly_608",R7="_waitingMessage_101ly_614",M7="_errorMessage_101ly_618",I7="_attemptSelector_101ly_622",O7="_attemptLabel_101ly_638",B7="_attemptButton_101ly_642",L7="_attemptActive_101ly_659",z7="_attemptStatus_101ly_665",U7="_emptyCta_101ly_671",$7="_ctaTitle_101ly_683",P7="_ctaDescription_101ly_689",V7="_ctaButton_101ly_696",H7="_ctaCreateForm_101ly_731",q7="_ctaCreateInput_101ly_737",G7="_ctaCreateOk_101ly_768",F7="_ctaLink_101ly_803",Z7="_workspaceHeader_101ly_817",K7="_workspaceName_101ly_842",Y7="_workspaceMeta_101ly_855",J7="_metaRow_101ly_863",W7="_metaLabel_101ly_876",X7="_metaValue_101ly_891",Q7="_archiveButton_101ly_901",eU="_repoLink_101ly_931",tU="_metaToggle_101ly_941",nU="_metaToggleArrow_101ly_962",sU="_metaToggleArrowOpen_101ly_967",aU="_progressBarContainer_101ly_971",iU="_progressBar_101ly_971",oU="_progressFill_101ly_987",rU="_progressLabel_101ly_994",lU="_metaTimestamps_101ly_1001",cU="_metaTimestamp_101ly_1001",U={panelContainer:jz,emptyState:Cz,fadeIn:Ez,workspaceSummary:Az,workspaceSummaryTitle:Dz,workspaceSummarySubtitle:Rz,header:Mz,headerInfo:Iz,killButton:Oz,headerTitle:Bz,headerActions:Lz,taskStatusBadge:zz,taskBranch:Uz,taskBlockedBadge:$z,btnPrimary:Pz,btnDanger:Vz,btnGhost:Hz,rejectInput:qz,tabBar:Gz,tab:Fz,active:Zz,eventScroll:Kz,tabContent:Yz,noContext:Jz,overviewContent:Wz,overviewDashboard:Xz,overviewHero:Qz,statusBadge:e7,statusPending:t7,statusAssigned:n7,statusInProgress:s7,statusReview:a7,statusDone:i7,statusFailed:o7,statusWaitingInput:r7,overviewBranchPill:l7,branchLink:c7,overviewSection:u7,overviewLabel:d7,overviewValue:f7,overviewMuted:p7,overviewMarkdown:m7,envRow:h7,envDot:g7,envDotGreen:v7,envDotYellow:y7,envDotRed:b7,envDotGray:_7,depList:x7,depItem:k7,depBlocked:S7,depDone:T7,timeline:w7,timelineRow:N7,timelineKey:j7,timelineValue:C7,timelineDelta:E7,reviewNotes:A7,overviewDescription:D7,waitingMessage:R7,errorMessage:M7,attemptSelector:I7,attemptLabel:O7,attemptButton:B7,attemptActive:L7,attemptStatus:z7,emptyCta:U7,ctaTitle:$7,ctaDescription:P7,ctaButton:V7,ctaCreateForm:H7,ctaCreateInput:q7,ctaCreateOk:G7,ctaLink:F7,workspaceHeader:Z7,workspaceName:K7,workspaceMeta:Y7,metaRow:J7,metaLabel:W7,metaValue:X7,archiveButton:Q7,repoLink:eU,metaToggle:tU,metaToggleArrow:nU,metaToggleArrowOpen:sU,progressBarContainer:aU,progressBar:iU,progressFill:oU,progressLabel:rU,metaTimestamps:lU,metaTimestamp:cU};function uU(){return r.jsx("div",{className:U.emptyState,children:"Select a task or click + to create one"})}function dU(){return r.jsx("div",{className:U.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function fU(){const{workspaces:t,environments:s}=ct(),i=bt(),o=s.length>0;return t.length>0?r.jsx(Nz,{}):r.jsxs("div",{className:U.emptyCta,"data-testid":"welcome-cta",children:[r.jsx("div",{className:U.ctaTitle,children:"Welcome to Grackle"}),r.jsx("div",{className:U.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),r.jsx("button",{className:U.ctaButton,onClick:()=>i(x_),disabled:!o,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!o&&r.jsx("div",{className:U.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const pU="_panelContainer_19poq_1",mU="_chatHeader_19poq_8",hU="_chatHeaderInfo_19poq_37",gU="_emptyState_19poq_43",vU="_emptyTitle_19poq_55",yU="_emptyDescription_19poq_61",bU="_emptyHint_19poq_67",mi={panelContainer:pU,chatHeader:mU,chatHeaderInfo:hU,emptyState:gU,emptyTitle:vU,emptyDescription:yU,emptyHint:bU};function _U({hasLocalEnvironment:t}){return r.jsxs("div",{className:mi.emptyState,"data-testid":"chat-empty-state",children:[r.jsx("div",{className:mi.emptyTitle,children:"Welcome to Grackle"}),r.jsx("div",{className:mi.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&&r.jsx("div",{className:mi.emptyHint,children:"Go to Settings → Environments to add one."})]})}function xU(){const{tasks:t,sessions:s,events:i,eventsDropped:o,environments:c,loadTaskSessions:u,loadSessionEvents:d,kill:p,stopGraceful:h,taskSessions:g,sendInput:v,spawn:y,startTask:_,personas:k,provisionEnvironment:S}=ct(),{showToast:w}=gn(),N=b.useRef(void 0),[T,C]=b.useState(),E=t.find(G=>G.id===_r),R=E!=null&&E.latestSessionId?s.find(G=>G.id===E.latestSessionId)??(g[_r]??[]).find(G=>G.id===E.latestSessionId):void 0;b.useEffect(()=>{u(_r).catch(()=>{})},[u]),b.useEffect(()=>{E!=null&&E.latestSessionId&&u(_r).catch(()=>{})},[E==null?void 0:E.latestSessionId,u]),b.useEffect(()=>{R&&R.id!==N.current&&(N.current=R.id,d(R.id).catch(()=>{}))},[R==null?void 0:R.id,d]);const D=b.useMemo(()=>{if(!R)return[];const G=i.filter(Q=>Q.sessionId===R.id);return Hm(Vm(G))},[i,R==null?void 0:R.id]),A=c.find(G=>G.adapterType==="local"&&G.status==="connected"),q=R!==void 0&&R.status!=="stopped"&&R.status!=="suspended",$=(R==null?void 0:R.status)==="idle";b.useEffect(()=>{T&&R&&$&&(v(R.id,T).catch(()=>{}),C(void 0))},[T,$,R==null?void 0:R.id,v]);const Y=b.useCallback((G,Q,ae,me)=>{me&&C(me),_(G,Q,ae).catch(()=>{})},[_]);return r.jsxs("div",{className:mi.panelContainer,"data-testid":"chat-page",children:[q&&r.jsxs("div",{className:mi.chatHeader,children:[r.jsxs("span",{className:mi.chatHeaderInfo,children:["Session: ",R.id.slice(0,8)," | ",R.runtime," | ",R.status]}),r.jsx(S_,{label:"Stop",onClick:()=>{h(R.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{h(R.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{p(R.id).catch(()=>{})}}]})]}),r.jsx(Lm,{events:D,eventsDropped:o,emptyState:r.jsx(_U,{hasLocalEnvironment:!!A}),onShowToast:w}),A&&q&&r.jsx(Ur,{mode:"send",sessionId:R.id,environmentId:R.environmentId,personas:k,environments:c,onSendInput:(G,Q)=>{v(G,Q).catch(()=>{})},onSpawn:(G,Q,ae)=>{y(G,Q,ae).catch(()=>{})},onStartTask:(G,Q,ae)=>{_(G,Q,ae).catch(()=>{})},onProvisionEnvironment:G=>{S(G).catch(()=>{})},onShowToast:w}),A&&!q&&r.jsx(Ur,{mode:"start",taskId:_r,environmentId:A.id,personas:k,environments:c,onSendInput:(G,Q)=>{v(G,Q).catch(()=>{})},onSpawn:(G,Q,ae)=>{y(G,Q,ae).catch(()=>{})},onStartTask:Y,onProvisionEnvironment:G=>{S(G).catch(()=>{})},onShowToast:w})]})}function kU(){const t=YL(),[s]=em(),i=s.get("env")??"",{sendInput:o,spawn:c,startTask:u,personas:d,environments:p,provisionEnvironment:h}=ct(),{showToast:g}=gn();return r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:t}),r.jsx("div",{className:U.emptyState,children:"Enter a prompt below to start a new session"}),r.jsx(Ur,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:d,environments:p,onSendInput:(v,y)=>{o(v,y).catch(()=>{})},onSpawn:(v,y,_)=>{c(v,y,_).catch(()=>{})},onStartTask:(v,y,_)=>{u(v,y,_).catch(()=>{})},onProvisionEnvironment:v=>{h(v).catch(()=>{})},onShowToast:g})]})}function SU({sessionId:t,session:s,isActive:i,onStop:o,onKill:c}){return r.jsxs("div",{className:U.header,children:[r.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?` | ${T_((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${ko(s.costUsd??0)}`:""]}),r.jsxs("span",{className:U.headerInfo,children:[s&&r.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&r.jsx(S_,{label:"Stop",onClick:o,variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:o},{label:"Kill",description:"Force kill",onClick:c}]})]})]})}function TU({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 r.jsx("div",{className:s?U.errorMessage:U.waitingMessage,children:i})}function wU(){const{sessionId:t}=ls(),{events:s,eventsDropped:i,sessions:o,kill:c,stopGraceful:u,loadSessionEvents:d,sendInput:p,spawn:h,startTask:g,personas:v,environments:y,provisionEnvironment:_}=ct(),{showToast:k}=gn(),S=b.useRef(void 0),w=JL(t),N=o.find(E=>E.id===t)??void 0,T=b.useMemo(()=>{const E=t?s.filter(R=>R.sessionId===t):[];return Hm(Vm(E))},[s,t]);if(b.useEffect(()=>{t&&t!==S.current&&(S.current=t,d(t).catch(()=>{}))},[t,d]),!t)return r.jsx("div",{className:U.emptyState,children:"No session selected"});const C=(N==null?void 0:N.status)==="running"||(N==null?void 0:N.status)==="idle";return r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:w}),r.jsx(SU,{sessionId:t,session:N,isActive:C,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{c(t).catch(()=>{})}}),r.jsx(Lm,{events:T,eventsDropped:i,emptyState:r.jsx(TU,{session:N}),onShowToast:k}),C&&r.jsx(Ur,{mode:"send",sessionId:t,environmentId:N.environmentId,personas:v,environments:y,onSendInput:(E,R)=>{p(E,R).catch(()=>{})},onSpawn:(E,R,D)=>{h(E,R,D).catch(()=>{})},onStartTask:(E,R,D)=>{g(E,R,D).catch(()=>{})},onProvisionEnvironment:E=>{_(E).catch(()=>{})},onShowToast:k})]})}function NU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Ys(t,s){const i=b.useRef(s);i.current=s;const{key:o,ctrl:c=!1,shift:u=!1,suppressInInputs:d=!0,enabled:p=!0}=t;b.useEffect(()=>{if(!p)return;const h=g=>{if(d&&NU(document.activeElement??void 0))return;const v=g.ctrlKey||g.metaKey;c===v&&(u&&!g.shiftKey||g.key===o&&i.current())};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h)}},[o,c,u,d,p])}function Lb(t){if(!t)return"";const s=new Date(t);if(isNaN(s.getTime()))return"";const o=Date.now()-s.getTime();if(o<0)return"just now";const c=Math.floor(o/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;const u=Math.floor(c/60);if(u<24)return`${u}h ago`;const d=Math.floor(u/24);return d<30?`${d}d ago`:s.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}const pp=100;function jU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function CU(){const{workspaceId:t,environmentId:s}=ls(),i=bt(),{tasks:o,environments:c,workspaces:u,personas:d,sessions:p,archiveWorkspace:h,updateWorkspace:g,usageCache:v,loadUsage:y}=ct(),{resolvedThemeId:_}=_x(),[k,S]=b.useState("tasks"),[w,N]=b.useState(!1),[T,C]=b.useState(null),[E,R]=b.useState(!1),D=b.useRef(void 0),A=u.find(ee=>ee.id===t),q=s??(A==null?void 0:A.environmentId)??"",$=WL(t,q,u,c);Ys({key:"1"},()=>S("graph")),Ys({key:"2"},()=>S("board")),Ys({key:"3"},()=>S("tasks")),b.useEffect(()=>{const ee=D.current;D.current=t,!(ee===void 0||ee===t)&&T!==null&&C(null)},[t,T]);const Y=p.reduce((ee,B)=>ee+(B.costUsd??0),0);b.useEffect(()=>{t&&y("workspace",t).catch(()=>{})},[t,y,Y]);const G=t?v[`workspace:${t}`]:void 0,Q=o.filter(ee=>ee.workspaceId===t),ae=Q.filter(ee=>ee.status==="complete").length,me=Q.length,ie=me>0?Math.round(ae/me*100):0;return r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:$}),r.jsxs("div",{className:U.workspaceHeader,children:[r.jsx("span",{className:U.workspaceName,"data-testid":"workspace-name",children:r.jsx(Xt,{value:(A==null?void 0:A.name)||"",onSave:ee=>{A&&g(A.id,{name:ee}).catch(()=>{})},validate:ee=>{const B=ee.trim();if(!B)return"Name is required";if(B.length>pp)return`Max ${pp} characters`},maxLength:pp,fieldId:"name",activeFieldId:T,onActivate:C,ariaLabel:"Workspace name",renderDisplay:ee=>ee||t||void 0,"data-testid":"edit-name"})}),r.jsx("button",{className:U.archiveButton,onClick:()=>N(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),r.jsxs("button",{className:U.metaToggle,onClick:()=>R(!E),"aria-expanded":!E,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[r.jsx("span",{className:`${U.metaToggleArrow} ${E?"":U.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!E&&r.jsxs("div",{className:U.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Description"}),r.jsx("div",{className:U.metaValue,children:r.jsx(zp,{value:(A==null?void 0:A.description)||"",onSave:ee=>{A&&g(A.id,{description:ee}).catch(()=>{})},fieldId:"description",activeFieldId:T,onActivate:C,renderDisplay:ee=>ee?r.jsx("span",{className:U.overviewMarkdown,children:r.jsx(tu,{remarkPlugins:[nu],children:ee})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Repository"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Xt,{value:(A==null?void 0:A.repoUrl)||"",onSave:ee=>{A&&g(A.id,{repoUrl:ee}).catch(()=>{})},validate:ee=>{const B=ee.trim();if(B&&!/^https?:\/\/.+/.test(B))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:T,onActivate:C,renderDisplay:ee=>{const B=jU(ee);return B?r.jsx("a",{className:U.repoLink,href:B,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:ee}):ee?r.jsx("span",{children:ee}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Environment"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Q6,{value:(A==null?void 0:A.environmentId)||"",onSave:ee=>{A&&ee&&g(A.id,{environmentId:ee}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:T,onActivate:C,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Persona"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Xc,{value:(A==null?void 0:A.defaultPersonaId)||"",onSave:ee=>{A&&g(A.id,{defaultPersonaId:ee}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...d.map(ee=>({value:ee.id,label:ee.name}))],fieldId:"defaultPersonaId",activeFieldId:T,onActivate:C,renderDisplay:ee=>{const B=d.find(Z=>Z.id===ee);if(B)return r.jsx("span",{children:B.name})},placeholder:(A==null?void 0:A.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Worktrees"}),r.jsx("div",{className:U.metaValue,children:r.jsx(G6,{checked:(A==null?void 0:A.useWorktrees)??!0,onChange:ee=>{A&&g(A.id,{useWorktrees:ee}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),r.jsxs("div",{className:U.metaRow,children:[r.jsx("span",{className:U.metaLabel,children:"Working Dir"}),r.jsx("div",{className:U.metaValue,children:r.jsx(Xt,{value:(A==null?void 0:A.workingDirectory)||"",onSave:ee=>{A&&g(A.id,{workingDirectory:ee}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:T,onActivate:C,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),A&&r.jsxs("div",{className:U.metaTimestamps,children:[r.jsxs("span",{className:U.metaTimestamp,children:["Created ",Lb(A.createdAt)]}),A.updatedAt&&A.updatedAt!==A.createdAt&&r.jsxs("span",{className:U.metaTimestamp,children:["· Updated ",Lb(A.updatedAt)]})]})]}),me>0&&r.jsxs("div",{className:U.progressBarContainer,"data-testid":"progress-bar",children:[r.jsx("div",{className:U.progressBar,children:r.jsx("div",{className:U.progressFill,style:{width:`${ie}%`}})}),r.jsxs("span",{className:U.progressLabel,children:[ae,"/",me]})]}),G&&G.costUsd>0&&r.jsx("div",{className:U.progressBarContainer,children:r.jsxs("span",{className:U.progressLabel,children:["Usage: ",ko(G.costUsd)," (",G.sessionCount," session",G.sessionCount!==1?"s":"",")"]})}),r.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Workspace view",children:[r.jsx("button",{role:"tab","aria-selected":k==="graph",className:`${U.tab} ${k==="graph"?U.active:""}`,onClick:()=>S("graph"),children:"Graph"}),r.jsx("button",{role:"tab","aria-selected":k==="board",className:`${U.tab} ${k==="board"?U.active:""}`,onClick:()=>S("board"),"data-testid":"board-tab",children:"Board"}),r.jsx("button",{role:"tab","aria-selected":k==="tasks",className:`${U.tab} ${k==="tasks"?U.active:""}`,onClick:()=>S("tasks"),children:"Tasks"})]}),k==="tasks"&&me>0&&r.jsxs("div",{className:U.workspaceSummary,children:[r.jsx("span",{className:U.workspaceSummaryTitle,children:`${ae}/${me} tasks complete`}),r.jsx("span",{className:U.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),k==="tasks"&&me===0&&r.jsxs("div",{className:U.emptyCta,children:[r.jsx("button",{className:U.ctaButton,onClick:()=>i(ki(t,void 0,q)),children:"Create Task"}),r.jsx("div",{className:U.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),k==="board"&&r.jsx(_L,{workspaceId:t,environmentId:q,tasks:o,sessions:p,personas:d,environments:c}),k==="graph"&&r.jsx(YN,{workspaceId:t,environmentId:q,tasks:o,resolvedThemeId:_}),r.jsx(bi,{isOpen:w,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{A&&(h(A.id).catch(()=>{}),i("/",{replace:!0})),N(!1)},onCancel:()=>N(!1)})]})}const EU="_container_3pgew_1",AU="_header_3pgew_8",DU="_headerTitle_3pgew_35",RU="_headerActions_3pgew_44",MU="_body_3pgew_51",IU="_btnPrimary_3pgew_63",OU="_btnGhost_3pgew_94",BU="_error_3pgew_116",Ea={container:EU,header:AU,headerTitle:DU,headerActions:RU,body:MU,btnPrimary:IU,btnGhost:OU,error:BU};function LU(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 zU=[{label:"Home",url:yi},{label:"New Workspace",url:void 0}];function UU(){const[t]=em(),s=t.get("environment")??void 0,{environments:i,personas:o,createWorkspace:c,workspaceCreating:u}=ct(),{showToast:d}=gn(),p=bt(),[h,g]=b.useState(()=>{var N;return DL(void 0,s||((N=i[0])==null?void 0:N.id))}),[v,y]=b.useState(),[_,k]=b.useState();b.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=LU(h);if(N){y(N),k(void 0);return}y(void 0),k(void 0),c(h.name.trim(),h.description,h.repoUrl.trim(),h.environmentId,h.defaultPersonaId,h.useWorktrees,h.workingDirectory,()=>{d("Workspace created","success"),p(yi,{replace:!0})},T=>{k(T)}).catch(()=>{})},w=()=>{p(s?vi(s):yi,{replace:!0})};return r.jsxs("div",{className:Ea.container,children:[r.jsxs("div",{className:Ea.header,children:[r.jsx("div",{className:Ea.headerTitle,children:r.jsx(xs,{segments:zU})}),r.jsxs("div",{className:Ea.headerActions,children:[r.jsx("button",{className:Ea.btnGhost,onClick:w,disabled:u,"data-testid":"workspace-create-cancel",children:"Cancel"}),r.jsx("button",{className:Ea.btnPrimary,onClick:S,disabled:u||!h.name.trim()||!h.environmentId,"data-testid":"workspace-create-save",children:u?r.jsx(ex,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),r.jsxs("div",{className:Ea.body,children:[r.jsx(ML,{values:h,onChange:N=>{g(N),y(void 0),k(void 0)},environments:i,personas:o,errors:v,disabled:u,autoFocusName:!0}),_&&r.jsx("div",{className:Ea.error,"data-testid":"workspace-create-submit-error",children:_})]})]})}function zb(){const{workspaceId:t,environmentId:s}=ls(),[i]=em(),o=t??i.get("workspace")??"",c=i.get("parent")??void 0,{tasks:u,workspaces:d,personas:p,createTask:h,updateTask:g}=ct(),{showToast:v}=gn();return r.jsx(px,{mode:"new",workspaceId:o,parentTaskId:c,environmentId:s,tasks:u,workspaces:d,personas:p,onCreateTask:(y,_,k,S,w,N,T,C,E)=>{h(y,_,k,S,w,N,T,C,E).catch(()=>{})},onUpdateTask:(y,_,k,S,w)=>{g(y,_,k,S,w).catch(()=>{})},onShowToast:v})}function Ic(t){if(!t)return"—";const s=new Date(t);return isNaN(s.getTime())?"—":s.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}function mp(t,s){if(!t||!s)return;const i=new Date(s).getTime()-new Date(t).getTime();if(isNaN(i)||i<0)return;const o=Math.floor(i/6e4),c=Math.floor(i%6e4/1e3);if(o===0)return`${c}s`;const u=Math.floor(o/60),d=o%60;return u===0?`${o}m ${c}s`:`${u}h ${d}m`}function Ub(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?U.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?U.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?U.envDotRed:U.envDotGray}function $U({status:t}){const s=Ma(t),i=P2(t);return r.jsx("span",{className:`${U.statusBadge} ${U[i]??U.statusPending}`,children:s.label})}function PU({task:t,tasksById:s,environments:i,workspaces:o,taskSessions:c,selectedEnvId:u}){const{loadUsage:d,usageCache:p}=ct(),h=c.reduce((E,R)=>E+(R.costUsd??0),0);b.useEffect(()=>{d("task",t.id).catch(()=>{}),t.childTaskIds.length>0&&d("task_tree",t.id).catch(()=>{})},[t.id,t.childTaskIds.length,d,h]);const g=`task:${t.id}`,v=g in p?p[g]:void 0,y=`task_tree:${t.id}`,_=t.childTaskIds.length>0&&y in p?p[y]: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=o.find(E=>E.id===t.workspaceId),T=i.find(E=>E.id===u),C=t.branch&&(N!=null&&N.repoUrl)?`${N.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return r.jsxs("div",{className:U.overviewDashboard,children:[r.jsxs("div",{className:U.overviewHero,children:[r.jsx($U,{status:t.status}),t.branch&&r.jsx("span",{className:U.overviewBranchPill,children:C?r.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:U.branchLink,children:["🔗"," ",t.branch]}):r.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Description"}),r.jsx("div",{className:U.overviewMarkdown,children:r.jsx(tu,{remarkPlugins:[nu],children:t.description})})]}),t.workpad&&r.jsx(fB,{workpad:t.workpad}),r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Environment"}),S&&w?r.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[r.jsx("span",{className:`${U.envDot} ${Ub(w.status)}`,title:w.status,"aria-label":`Status: ${w.status}`,role:"img"}),r.jsx("span",{className:U.overviewValue,children:w.displayName})]}):T?r.jsxs("div",{className:U.envRow,"data-testid":"task-overview-environment",children:[r.jsx("span",{className:`${U.envDot} ${Ub(T.status)}`,title:T.status,"aria-label":`Status: ${T.status}`,role:"img"}),r.jsx("span",{className:U.overviewValue,children:T.displayName}),r.jsx("span",{className:U.overviewMuted,children:"(workspace default)"})]}):r.jsx("div",{className:U.overviewMuted,children:"Set in workspace settings"})]}),r.jsxs("div",{className:U.overviewSection,"data-testid":"task-overview-dependencies",children:[r.jsx("div",{className:U.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?r.jsx("div",{className:U.overviewMuted,children:"None"}):r.jsx("div",{className:U.depList,children:t.dependsOn.map(E=>{const R=s.get(E),D=(R==null?void 0:R.status)==="complete";return r.jsxs("div",{className:`${U.depItem} ${D?U.depDone:U.depBlocked}`,children:[r.jsx("span",{children:D?"✓":"○"}),r.jsx("span",{children:(R==null?void 0:R.title)??E})]},E)})})]}),r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Timeline"}),r.jsxs("div",{className:U.timeline,children:[t.createdAt&&r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Created"}),r.jsx("span",{className:U.timelineValue,children:Ic(t.createdAt)})]}),t.assignedAt&&(()=>{const E=mp(t.createdAt,t.assignedAt);return r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Assigned"}),r.jsx("span",{className:U.timelineValue,children:Ic(t.assignedAt)}),E!==void 0&&r.jsx("span",{className:U.timelineDelta,children:E})]})})(),t.startedAt&&(()=>{const E=mp(t.assignedAt??t.createdAt,t.startedAt);return r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Started"}),r.jsx("span",{className:U.timelineValue,children:Ic(t.startedAt)}),E!==void 0&&r.jsx("span",{className:U.timelineDelta,children:E})]})})(),t.completedAt&&(()=>{const E=mp(t.startedAt,t.completedAt);return r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Completed"}),r.jsx("span",{className:U.timelineValue,children:Ic(t.completedAt)}),E!==void 0&&r.jsx("span",{className:U.timelineDelta,children:E})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&r.jsx("div",{className:U.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Usage"}),r.jsxs("div",{className:U.timeline,children:[r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Cost"}),r.jsx("span",{className:U.timelineValue,children:ko(v.costUsd)}),r.jsxs("span",{className:U.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),_&&_.costUsd>v.costUsd&&r.jsxs("div",{className:U.timelineRow,children:[r.jsx("span",{className:U.timelineKey,children:"Total (incl. subtasks)"}),r.jsx("span",{className:U.timelineValue,children:ko(_.costUsd)}),r.jsxs("span",{className:U.timelineDelta,children:[_.sessionCount," session",_.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&r.jsxs("div",{className:U.overviewSection,children:[r.jsx("div",{className:U.overviewLabel,children:"Review Notes"}),r.jsx("div",{className:U.reviewNotes,children:t.reviewNotes})]})]})}function VU({task:t,sessionId:s,isBlocked:i,onStart:o,onResume:c,onStop:u,onPause:d,onDelete:p,onEdit:h}){if(t.status==="not_started")return i?r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]}):r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{"data-testid":"task-header-start",onClick:o,className:U.btnPrimary,children:"Start"}),r.jsx("button",{onClick:h,className:U.btnGhost,children:"Edit"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]});if(t.status==="working")return r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:u,className:U.btnDanger,children:"Stop"}),r.jsx("button",{onClick:d,disabled:!s,className:U.btnGhost,children:"Pause"})]});if(t.status==="paused")return r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:u,className:U.btnPrimary,children:"Stop"}),r.jsx("button",{onClick:c,className:U.btnGhost,children:"Resume"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]});if(t.status==="complete")return r.jsx("div",{className:U.headerActions,children:r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})});if(t.status==="failed")return r.jsxs("div",{className:U.headerActions,children:[r.jsx("button",{onClick:o,className:U.btnPrimary,children:"Retry"}),r.jsx("button",{onClick:p,className:U.btnDanger,children:"Delete"})]})}function HU({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return r.jsxs("div",{className:U.attemptSelector,"data-testid":"attempt-selector",children:[r.jsx("span",{className:U.attemptLabel,children:"Attempts:"}),t.map((o,c)=>{const u=o.id===s,d=o.status==="stopped"&&o.endReason==="completed"?"✓":o.status==="stopped"?"✗":o.status==="running"||o.status==="idle"?"●":"";return r.jsxs("button",{className:`${U.attemptButton} ${u?U.attemptActive:""}`,onClick:()=>i(o.id),title:`Attempt #${c+1} — ${o.status}`,"aria-label":`Attempt #${c+1}, ${o.status}`,"aria-pressed":u,"data-testid":`attempt-${c+1}`,children:["#",c+1,d&&r.jsx("span",{className:U.attemptStatus,children:d})]},o.id)})]})}function Aa(){const{taskId:t,workspaceId:s,environmentId:i}=ls(),o=Pt(),c=bt(),{showToast:u}=gn(),{events:d,eventsDropped:p,tasks:h,sessions:g,environments:v,findings:y,loadSessionEvents:_,loadFindings:k,kill:S,startTask:w,stopTask:N,resumeTask:T,deleteTask:C,createTask:E,updateTask:R,workspaces:D,taskSessions:A,loadTaskSessions:q,sendInput:$,spawn:Y,personas:G,provisionEnvironment:Q}=ct(),ae=b.useRef(void 0),me=b.useRef(void 0),ie=b.useRef(void 0),ee=b.useRef(void 0),B=b.useRef(void 0),Z=o.pathname.endsWith("/stream")?"stream":o.pathname.endsWith("/findings")?"findings":"overview",ne=o.pathname.endsWith("/edit"),[re,ue]=b.useState(Z),[Ke,je]=b.useState(!1),[Te,Ie]=b.useState(void 0),[le,ve]=b.useState(""),[de,Oe]=b.useState(ne),_t=b.useRef(Z),vn=b.useRef(ne),L=h.find(Ne=>Ne.id===t),Me=(L==null?void 0:L.workspaceId)||void 0,et=D.find(Ne=>Ne.id===Me);b.useEffect(()=>{Z!==_t.current&&(_t.current=Z,Z!==re&&ue(Z))},[Z,re]),b.useEffect(()=>{ne!==vn.current&&(vn.current=ne,ne!==de&&Oe(ne))},[ne,de]),b.useEffect(()=>{if(le===""){if(et!=null&&et.environmentId)ve(et.environmentId);else if(v.length>0){const Ne=v.find(Ce=>Ce.status==="connected");ve((Ne==null?void 0:Ne.id)??v[0].id)}}},[le,et==null?void 0:et.environmentId,v]);const tt=L?A[L.id]??[]:[];let qe;Te&&tt.some(Ne=>Ne.id===Te)?qe=Te:qe=(L==null?void 0:L.latestSessionId)||void 0;const cs=()=>{je(!0)},ea=()=>{if(!L)return;C(L.id).catch(()=>{}),je(!1);const Ne=i??(et==null?void 0:et.environmentId);c(L.workspaceId&&Ne?gi(L.workspaceId,Ne):"/",{replace:!0})};b.useEffect(()=>{(L==null?void 0:L.id)!==me.current&&(me.current=L==null?void 0:L.id,Ie(void 0),ve(""),Oe(ne))},[L==null?void 0:L.id,ne]),b.useEffect(()=>{if(!(L!=null&&L.id))return;const Ne=L.id!==ee.current,Ce=L.latestSessionId!==B.current;(Ne||Ce)&&(ee.current=L.id,B.current=L.latestSessionId,q(L.id).catch(()=>{}))},[L==null?void 0:L.id,L==null?void 0:L.latestSessionId,q]),b.useEffect(()=>{if((L==null?void 0:L.status)!==ie.current){const Ne=ie.current===void 0;ie.current=L==null?void 0:L.status;const Ce=(L==null?void 0:L.status)==="not_started"?"overview":(L==null?void 0:L.status)==="working"||(L==null?void 0:L.status)==="paused"?"stream":(L==null?void 0:L.status)==="complete"?"findings":void 0;Ce&&Ce!==re&&!(Ne&&Z!=="overview")&&ue(Ce)}},[L==null?void 0:L.status,re,Z]);const An=b.useMemo(()=>new Map(h.map(Ne=>[Ne.id,Ne])),[h]),Zn=b.useMemo(()=>{const Ne=qe?d.filter(Ce=>Ce.sessionId===qe):[];return Hm(Vm(Ne))},[d,qe]),us=L?L.dependsOn.some(Ne=>{const Ce=An.get(Ne);return Ce!==void 0&&Ce.status!=="complete"}):!1,ta=b.useMemo(()=>XL(t,i,D,v,An),[t,i,D,v,An]);b.useEffect(()=>{qe&&qe!==ae.current&&(ae.current=qe,_(qe).catch(()=>{}))},[qe,_]),b.useEffect(()=>{re==="findings"&&Me&&k(Me).catch(()=>{})},[re,Me,k]);const Kn=Ne=>{ue(Ne),c(rs(t,Ne==="overview"?void 0:Ne,s,i))};return Ys({key:"1"},()=>Kn("overview")),Ys({key:"2"},()=>Kn("stream")),Ys({key:"3"},()=>Kn("findings")),r.jsxs("div",{className:U.panelContainer,children:[r.jsx(xs,{segments:ta}),r.jsxs("div",{className:U.header,children:[r.jsxs("span",{className:U.headerTitle,children:[r.jsx("span",{"data-testid":"task-title",children:(L==null?void 0:L.title)||t}),L&&r.jsx("span",{className:U.taskStatusBadge,"data-testid":"task-status",children:L.status}),(L==null?void 0:L.branch)&&r.jsx("span",{className:U.taskBranch,children:L.branch}),us&&r.jsx("span",{className:U.taskBlockedBadge,children:"blocked"})]}),L&&r.jsx(VU,{task:L,sessionId:qe,isBlocked:us,onStart:()=>{w(L.id,void 0,le).catch(()=>{})},onResume:()=>{T(L.id).catch(()=>{})},onStop:()=>{N(L.id).catch(()=>{})},onPause:()=>{qe&&S(qe).catch(()=>{})},onDelete:cs,onEdit:()=>Oe(!0)})]}),r.jsxs("div",{className:U.tabBar,role:"tablist","aria-label":"Task view",children:[r.jsx("button",{role:"tab","aria-selected":re==="overview",className:`${U.tab} ${re==="overview"?U.active:""}`,onClick:()=>Kn("overview"),children:"Overview"}),r.jsx("button",{role:"tab","aria-selected":re==="stream",className:`${U.tab} ${re==="stream"?U.active:""}`,onClick:()=>Kn("stream"),children:"Stream"}),r.jsx("button",{role:"tab","aria-selected":re==="findings",className:`${U.tab} ${re==="findings"?U.active:""}`,onClick:()=>Kn("findings"),children:"Findings"})]}),r.jsxs(os,{mode:"wait",children:[re==="overview"&&r.jsx(Ct.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.overviewContent,"data-testid":"task-overview",children:de&&L?r.jsx(px,{mode:"edit",taskId:L.id,workspaceId:Me,environmentId:i,tasks:h,workspaces:D,personas:G,onCreateTask:(Ne,Ce,cn,yn,ks,ds,Ti,Ua,wi)=>{E(Ne,Ce,cn,yn,ks,ds,Ti,Ua,wi).catch(()=>{})},onUpdateTask:(Ne,Ce,cn,yn,ks)=>{R(Ne,Ce,cn,yn,ks).catch(()=>{})},onEditDone:()=>{ne?c(rs(L.id,void 0,s,i),{replace:!0}):Oe(!1)},onShowToast:u}):L?r.jsx(PU,{task:L,tasksById:An,environments:v,workspaces:D,taskSessions:tt,selectedEnvId:le}):r.jsx("div",{className:U.waitingMessage,children:"No additional details"})},"overview"),re==="stream"&&r.jsxs(Ct.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:[r.jsx(HU,{taskSessions:tt,selectedSessionId:qe,onSelect:Ne=>Ie(Ne)}),r.jsx(Lm,{events:Zn,eventsDropped:p,emptyState:!qe&&L?us?r.jsx("div",{className:U.emptyCta,"data-testid":"stream-blocked-message",children:r.jsx("div",{className:U.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):r.jsxs("div",{className:U.emptyCta,children:[r.jsx("button",{"data-testid":"stream-start-cta",className:U.ctaButton,onClick:()=>{w(L.id,void 0,le).catch(()=>{})},children:"Start Task"}),r.jsx("div",{className:U.ctaDescription,children:"Click to begin agent execution"})]}):qe&&Zn.length===0?r.jsx("div",{className:U.waitingMessage,children:"Waiting for events..."}):void 0,onShowToast:u})]},"stream"),re==="findings"&&r.jsx(Ct.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},className:U.tabContent,children:Me?r.jsx(dx,{findings:y.filter(Ne=>Ne.workspaceId===Me)}):r.jsx("div",{className:U.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!L||L.status!=="working"&&L.status!=="paused")return;const Ne=qe?g.find(Ce=>Ce.id===qe):void 0;if(!(!Ne||Ne.status==="stopped"))return r.jsx(Ur,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:G,environments:v,onSendInput:(Ce,cn)=>{$(Ce,cn).catch(()=>{})},onSpawn:(Ce,cn,yn)=>{Y(Ce,cn,yn).catch(()=>{})},onStartTask:(Ce,cn,yn)=>{w(Ce,cn,yn).catch(()=>{})},onProvisionEnvironment:Ce=>{Q(Ce).catch(()=>{})},onShowToast:u})})(),L&&r.jsx(bi,{isOpen:Ke,title:"Delete Task?",description:`"${L.title}" will be permanently removed.`,onConfirm:ea,onCancel:()=>je(!1)})]})}function qU(){const{environments:t,addEnvironment:s,updateEnvironment:i,listCodespaces:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,createCodespace:h}=ct(),{showToast:g}=gn();return r.jsx(mx,{mode:"new",environments:t,onAddEnvironment:(v,y,_)=>{s(v,y,_).catch(()=>{})},onUpdateEnvironment:(v,y)=>{i(v,y).catch(()=>{})},onListCodespaces:()=>{o().catch(()=>{})},codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:(v,y)=>{h(v,y).catch(()=>{})},onShowToast:g})}function GU(){const{environmentId:t}=ls(),{environments:s,addEnvironment:i,updateEnvironment:o,listCodespaces:c,codespaces:u,codespaceError:d,codespaceListError:p,codespaceCreating:h,createCodespace:g}=ct(),{showToast:v}=gn();return r.jsx(mx,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(y,_,k)=>{i(y,_,k).catch(()=>{})},onUpdateEnvironment:(y,_)=>{o(y,_).catch(()=>{})},onListCodespaces:()=>{c().catch(()=>{})},codespaces:u,codespaceError:d,codespaceListError:p,codespaceCreating:h,onCreateCodespace:(y,_)=>{g(y,_).catch(()=>{})},onShowToast:v})}const FU="_layout_11u79_1",ZU="_content_11u79_8",KU="_tabPanel_11u79_14",zr={layout:FU,content:ZU,tabPanel:KU};function YU(){const t=KL();return r.jsxs("div",{className:zr.layout,children:[r.jsx(xs,{segments:t}),r.jsx("div",{className:zr.content,children:r.jsx(La,{})})]})}const JU="_container_13sb6_1",WU="_envHeader_13sb6_6",XU="_envTitleRow_13sb6_10",QU="_statusDot_13sb6_16",e$="_envName_13sb6_21",t$="_statusBadge_13sb6_27",n$="_envMeta_13sb6_33",s$="_metaTag_13sb6_39",a$="_actions_13sb6_51",i$="_provisionMessage_13sb6_59",o$="_errorMessage_13sb6_64",r$="_section_13sb6_69",l$="_sectionHeader_13sb6_73",c$="_cardList_13sb6_121",u$="_card_13sb6_121",d$="_cardHeader_13sb6_138",f$="_cardName_13sb6_144",p$="_cardActions_13sb6_149",m$="_cardDescription_13sb6_154",h$="_cardMeta_13sb6_160",g$="_repoLink_13sb6_166",v$="_empty_13sb6_174",y$="_btnPrimary_13sb6_180",b$="_btnOutline_13sb6_214",_$="_btnSmall_13sb6_241",x$="_btnDanger_13sb6_267",Ve={container:JU,envHeader:WU,envTitleRow:XU,statusDot:QU,envName:e$,statusBadge:t$,envMeta:n$,metaTag:s$,actions:a$,provisionMessage:i$,errorMessage:o$,section:r$,sectionHeader:l$,cardList:c$,card:u$,cardHeader:d$,cardName:f$,cardActions:p$,cardDescription:m$,cardMeta:h$,repoLink:g$,empty:v$,btnPrimary:y$,btnOutline:b$,btnSmall:_$,btnDanger:x$},k$={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function S$(){const{environmentId:t}=ls(),s=bt(),{environments:i,workspaces:o,sessions:c,provisionStatus:u,provisionEnvironment:d,stopEnvironment:p,removeEnvironment:h,archiveWorkspace:g}=ct(),[v,y]=b.useState(!1),[_,k]=b.useState(!1),[S,w]=b.useState(void 0),N=i.find(ae=>ae.id===t);if(!t||!N)return r.jsx(is,{to:xo,replace:!0});const T=o.filter(ae=>ae.environmentId===N.id),C=c.filter(ae=>ae.environmentId===N.id),E=C.reduce((ae,me)=>ae+(me.costUsd??0),0),R=k$[N.status]||"var(--text-tertiary)",D=N.status==="connected",A=N.status==="connecting",q=N.status==="disconnected"||N.status==="error"||N.status==="sleeping",$=N.id in u?u[N.id]:void 0,Y=()=>{h(N.id).catch(()=>{}),y(!1),s(xo,{replace:!0})},G=()=>{k(!1),d(N.id,!0).catch(()=>{})},Q=ae=>{g(ae).catch(()=>{}),w(void 0)};return r.jsxs("div",{className:Ve.container,children:[r.jsx(bi,{isOpen:v,title:"Delete Environment?",description:`"${N.displayName||N.id}" will be permanently removed along with all its data.`,onConfirm:Y,onCancel:()=>y(!1)}),r.jsx(bi,{isOpen:_,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:G,onCancel:()=>k(!1)}),r.jsxs("div",{className:Ve.envHeader,children:[r.jsxs("div",{className:Ve.envTitleRow,children:[r.jsx("span",{className:Ve.statusDot,style:{color:R},children:"●"}),r.jsx("h2",{className:Ve.envName,children:N.displayName||N.id}),r.jsx("span",{className:Ve.statusBadge,style:{color:R},children:N.status})]}),r.jsxs("div",{className:Ve.envMeta,children:[r.jsxs("span",{className:Ve.metaTag,children:["Adapter: ",N.adapterType]}),C.length>0&&r.jsxs("span",{className:Ve.metaTag,children:[C.length," session",C.length!==1?"s":""]}),E>0&&r.jsxs("span",{className:Ve.metaTag,children:["Cost: ",ko(E)]})]})]}),r.jsxs("div",{className:Ve.actions,children:[D&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:Ve.btnPrimary,onClick:()=>s(b_(N.id)),children:"New Chat"}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>{p(N.id).catch(()=>{})},children:"Stop"}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>k(!0),disabled:$!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),q&&r.jsx("button",{className:Ve.btnPrimary,onClick:()=>{d(N.id).catch(()=>{})},children:N.status==="error"?"Retry":N.status==="sleeping"?"Wake":"Connect"}),A&&$!==void 0&&r.jsx("span",{className:Ve.provisionMessage,children:$.message}),N.status==="error"&&($==null?void 0:$.stage)==="error"&&r.jsx("span",{className:Ve.errorMessage,children:$.message}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>s(UN(N.id)),"data-testid":"env-edit-btn",children:"Edit Config"}),r.jsx("button",{className:Ve.btnDanger,onClick:()=>y(!0),children:"Delete"})]}),r.jsxs("div",{className:Ve.section,children:[r.jsxs("div",{className:Ve.sectionHeader,children:[r.jsx("h3",{children:"Workspaces"}),r.jsx("button",{className:Ve.btnPrimary,onClick:()=>s(`${x_}?environment=${encodeURIComponent(N.id)}`),"data-testid":"workspace-create-button",children:"+ New Workspace"})]}),T.length===0&&r.jsx("p",{className:Ve.empty,children:"No workspaces yet. Create one to get started."}),r.jsx("div",{className:Ve.cardList,children:T.map(ae=>r.jsx(T$,{workspace:ae,confirmArchiveId:S,onOpen:()=>s(gi(ae.id,N.id)),onArchive:()=>w(ae.id),onConfirmArchive:()=>Q(ae.id),onCancelArchive:()=>w(void 0)},ae.id))})]})]})}function T$({workspace:t,confirmArchiveId:s,onOpen:i,onArchive:o,onConfirmArchive:c,onCancelArchive:u}){const d=s===t.id,p=t.repoUrl&&/^https?:\/\//.test(t.repoUrl);return r.jsxs("div",{className:Ve.card,"data-testid":"workspace-card",children:[r.jsxs("div",{className:Ve.cardHeader,children:[r.jsx("strong",{className:Ve.cardName,children:t.name}),r.jsxs("div",{className:Ve.cardActions,children:[r.jsx("button",{className:Ve.btnSmall,onClick:i,children:"Open"}),d?r.jsxs(r.Fragment,{children:[r.jsx("button",{className:Ve.btnDanger,onClick:c,children:"Confirm"}),r.jsx("button",{className:Ve.btnSmall,onClick:u,children:"Cancel"})]}):r.jsx("button",{className:Ve.btnSmall,onClick:o,children:"Archive"})]})]}),t.description&&r.jsx("p",{className:Ve.cardDescription,children:t.description}),t.repoUrl&&r.jsx("div",{className:Ve.cardMeta,children:p?r.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noopener noreferrer",className:Ve.repoLink,children:t.repoUrl}):r.jsx("span",{children:t.repoUrl})})]})}const w$={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function N$(){const s=Pt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=w$[s],o=ZL(i);return r.jsxs("div",{className:zr.layout,children:[r.jsx(xs,{segments:o}),r.jsx("div",{className:zr.content,children:r.jsx("div",{className:zr.tabPanel,children:r.jsx(La,{})},s)})]})}function j$(){const{tokens:t,setToken:s,deleteToken:i,credentialProviders:o,updateCredentialProviders:c}=ct(),{showToast:u}=gn();return r.jsxs(r.Fragment,{children:[r.jsx(mB,{credentialProviders:o,onUpdateCredentialProviders:d=>{c(d).catch(()=>{})}}),r.jsx(l5,{tokens:t,onSetToken:(d,p,h,g,v)=>{s(d,p,h,g,v).catch(()=>{})},onDeleteToken:d=>{i(d).catch(()=>{})},onShowToast:u})]})}function C$(){const{personas:t,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:o}=ct(),{showToast:c}=gn(),u=bt();return r.jsx(jB,{personas:t,appDefaultPersonaId:i,onDeletePersona:async d=>{try{await s(d)}catch(p){throw console.error("Failed to delete persona",{personaId:d,error:p}),c("Failed to delete persona","error"),p}},onSetAppDefaultPersonaId:async d=>{try{await o(d)}catch(p){console.error("Failed to set app default persona ID",{personaId:d,error:p}),c("Failed to set app default persona","error")}},onNavigateToNew:()=>u(PN),onNavigateToPersona:d=>u(__(d))})}const E$="_container_1ooin_1",A$="_form_1ooin_7",D$="_formActions_1ooin_75",R$="_editableSection_1ooin_82",M$="_defaultBadge_1ooin_93",I$="_typeToggle_1ooin_107",O$="_scriptEditor_1ooin_121",B$="_optional_1ooin_128",ss={container:E$,form:A$,formActions:D$,editableSection:R$,defaultBadge:M$,typeToggle:I$,scriptEditor:O$,optional:B$},$b=[{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)"}],Pb=[{value:"genaiscript",label:"genaiscript"}],L$="0";function Vb(){const{personaId:t}=ls(),s=bt(),{showToast:i}=gn(),{personas:o,createPersona:c,updatePersona:u,deletePersona:d,appDefaultPersonaId:p,setAppDefaultPersonaId:h}=ct(),g=t===void 0,v=g?void 0:o.find(_=>_.id===t);if(!g&&o.length>0&&!v)return r.jsx(is,{to:Df,replace:!0});const y=[{label:"Settings",url:_o},{label:"Personas",url:Df},{label:g?"New Persona":(v==null?void 0:v.name)??"Persona",url:void 0}];return r.jsxs("div",{className:ss.container,children:[r.jsx(xs,{segments:y}),r.jsx(z$,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:u,onDeletePersona:d,onSetAppDefaultPersonaId:h,onDone:()=>{s(Df)},showToast:i})]})}function z$({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:o,onUpdatePersona:c,onDeletePersona:u,onSetAppDefaultPersonaId:d,onDone:p,showToast:h}){const g=bt(),[v,y]=b.useState((t==null?void 0:t.name)??""),[_,k]=b.useState((t==null?void 0:t.description)??""),[S,w]=b.useState((t==null?void 0:t.systemPrompt)??""),[N,T]=b.useState((t==null?void 0:t.runtime)??"claude-code"),[C,E]=b.useState((t==null?void 0:t.model)??"sonnet"),[R,D]=b.useState((t==null?void 0:t.maxTurns)??0),[A,q]=b.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[$,Y]=b.useState((t==null?void 0:t.script)??""),[G,Q]=b.useState((t==null?void 0:t.allowedMcpTools)??[]),[ae,me]=b.useState(!1),[ie,ee]=b.useState(null),[B,Z]=b.useState(!!s);b.useEffect(()=>{if(!s&&t&&!B){Z(!0),y(t.name),k(t.description),w(t.systemPrompt);const L=t.type==="script"?"script":"agent";T(L==="script"?t.runtime||"genaiscript":t.runtime),E(t.model),D(t.maxTurns),q(L),Y(t.script||""),Q(t.allowedMcpTools)}},[s,t,B]);const ne=L=>{q(L),L==="script"?T("genaiscript"):N==="genaiscript"&&T("claude-code")},re=!s&&t===void 0,ue=v.trim().length>0&&!re&&S.trim().length>0&&(A==="script"?$.trim().length>0:!!N&&!!C),Ke=s&&ue,je=!s&&i===(t==null?void 0:t.id),Te=!s&&t&&!je&&A==="agent"&&!!N&&!!C,Ie=(L,Me)=>{if(!L.trim())return`${Me} is required`},le=L=>{if(L.preventDefault(),!(re||!ue)){if(t){c(t.id,v,_,S,N,C,R,A,$).then(()=>{h("Persona updated","success"),p()},()=>{h("Failed to save persona","error")});return}o(v,_,S,N,C,R,A,$,G).then(Me=>{h("Persona created","success"),g(__(Me.id),{replace:!0})},()=>{h("Failed to save persona","error")})}},ve=()=>{t&&u(t.id).then(()=>{h("Persona deleted","success"),p()},()=>{h("Failed to delete persona","error")})},de=async(L,Me,et,tt)=>L().then(()=>{Me(),h(et,"success")},()=>{h(tt,"error")}),Oe=(L,Me)=>{if(!t)return;const et=L==="type"?String(Me):A,tt=L==="runtime"?String(Me):L==="type"?String(Me)==="script"?"genaiscript":N==="genaiscript"?"claude-code":N:N,qe=L==="model"?String(Me):C,cs=L==="maxTurns"?Number(Me):R,ea=L==="systemPrompt"?String(Me):S,An=L==="script"?String(Me):$;de(()=>c(t.id,L==="name"?String(Me):v,L==="description"?String(Me):_,ea,tt,qe,cs,et,An),()=>{if(L==="type"){const Zn=String(Me)==="script"?"script":"agent";q(Zn),T(tt)}L==="runtime"&&T(String(Me)),L==="name"&&y(String(Me)),L==="description"&&k(String(Me)),L==="systemPrompt"&&w(String(Me)),L==="model"&&E(String(Me)),L==="maxTurns"&&D(Number(Me)),L==="script"&&Y(String(Me))},"Persona updated","Failed to update persona").catch(()=>{})},_t=L=>{le(L)},vn=()=>{t&&d(t.id).then(()=>{h("Set as app default","success")},()=>{h("Failed to set app default","error")})};return r.jsxs(r.Fragment,{children:[re?r.jsxs("div",{className:ss.form,children:[r.jsx("h3",{children:"Edit Persona"}),r.jsx("p",{children:"Loading persona..."})]}):s?r.jsxs("form",{onSubmit:_t,className:ss.form,children:[r.jsx("h3",{children:"Create Persona"}),r.jsxs("div",{className:ss.typeToggle,"data-testid":"persona-type-toggle",children:[r.jsxs("label",{children:[r.jsx("input",{type:"radio",name:"personaType",value:"agent",checked:A==="agent",onChange:()=>ne("agent")}),"Agent"]}),r.jsxs("label",{children:[r.jsx("input",{type:"radio",name:"personaType",value:"script",checked:A==="script",onChange:()=>ne("script")}),"Script"]})]}),r.jsxs("label",{children:["Name",r.jsx("input",{type:"text",value:v,onChange:L=>y(L.target.value),placeholder:A==="script"?"e.g. Nightly Report":"e.g. Frontend Engineer",required:!0,"data-testid":"persona-detail-name"})]}),r.jsxs("label",{children:["Description",r.jsx("input",{type:"text",value:_,onChange:L=>k(L.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),r.jsxs("label",{children:["Runtime",r.jsx("select",{value:N,onChange:L=>T(L.target.value),"data-testid":"persona-runtime-select",children:(A==="script"?Pb:$b).map(L=>r.jsx("option",{value:L.value,children:L.label},L.value))})]}),A==="agent"&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{children:["Model",r.jsx("input",{type:"text",value:C,onChange:L=>E(L.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["Max Turns",r.jsx("input",{type:"number",value:R,onChange:L=>D(parseInt(L.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),r.jsxs("label",{children:["System Prompt",r.jsx("textarea",{value:S,onChange:L=>w(L.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),A==="script"&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{children:["Model ",r.jsx("span",{className:ss.optional,children:"(optional)"}),r.jsx("input",{type:"text",value:C,onChange:L=>E(L.target.value),placeholder:"e.g. sonnet (leave empty for script-only)","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["System Prompt",r.jsx("textarea",{value:S,onChange:L=>w(L.target.value),placeholder:"Context for the script...",rows:4,required:!0,"data-testid":"persona-detail-prompt"})]}),r.jsxs("label",{children:["Script",r.jsx("textarea",{value:$,onChange:L=>Y(L.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:ss.scriptEditor,required:!0,"data-testid":"persona-script-editor"})]})]}),A==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(Eb,{selectedTools:G,onChange:Q})]}),r.jsxs("div",{className:ss.formActions,children:[r.jsx(Fs,{type:"submit",variant:"primary",size:"md",disabled:!Ke,"data-testid":"persona-detail-save",children:"Create"}),r.jsx(Fs,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Cancel"})]})]}):t?r.jsxs("div",{className:ss.form,children:[r.jsx("h3",{children:"Edit Persona"}),r.jsxs("div",{className:ss.formActions,children:[r.jsx(Fs,{type:"button",variant:"outline",size:"md",onClick:p,"data-testid":"persona-detail-cancel",children:"Back to Personas"}),Te&&r.jsx(Fs,{type:"button",variant:"ghost",size:"md",onClick:vn,"data-testid":"persona-detail-set-default",children:"Set as App Default"}),je&&r.jsx("span",{className:ss.defaultBadge,children:"App Default"}),r.jsx(Fs,{type:"button",variant:"danger",size:"md",onClick:()=>me(!0),"data-testid":"persona-detail-delete",children:"Delete"})]}),r.jsxs("div",{className:ss.editableSection,children:[r.jsxs("label",{children:["Name",r.jsx(Xt,{value:v,onSave:L=>{Oe("name",L)},validate:L=>Ie(L,"Name"),fieldId:"persona-name",activeFieldId:ie,onActivate:ee,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),r.jsxs("label",{children:["Description",r.jsx(Xt,{value:_,onSave:L=>{Oe("description",L)},fieldId:"persona-description",activeFieldId:ie,onActivate:ee,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),r.jsxs("label",{children:["Type",r.jsx(Xc,{value:A,onSave:L=>{Oe("type",L)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:ie,onActivate:ee,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),r.jsxs("label",{children:["Runtime",r.jsx(Xc,{value:N,onSave:L=>{Oe("runtime",L)},options:A==="script"?Pb:$b,fieldId:"persona-runtime",activeFieldId:ie,onActivate:ee,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),r.jsxs("label",{children:["Model",A==="script"?" (optional)":"",r.jsx(Xt,{value:C,onSave:L=>{Oe("model",L)},validate:A==="agent"?L=>Ie(L,"Model"):void 0,fieldId:"persona-model",activeFieldId:ie,onActivate:ee,placeholder:A==="script"?"e.g. sonnet (leave empty for script-only)":"e.g. sonnet",ariaLabel:"Persona model","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["Max Turns",r.jsx(Xt,{value:String(R),onSave:L=>{Oe("maxTurns",parseInt(L,10)||0)},validate:L=>/^\d+$/.test(L.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:ie,onActivate:ee,placeholder:L$,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),r.jsxs("label",{children:["System Prompt",r.jsx(zp,{value:S,onSave:L=>{Oe("systemPrompt",L)},validate:L=>Ie(L,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:ie,onActivate:ee,placeholder:A==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),A==="script"&&r.jsxs("label",{children:["Script",r.jsx(zp,{value:$,onSave:L=>{Oe("script",L)},validate:L=>Ie(L,"Script"),fieldId:"persona-script",activeFieldId:ie,onActivate:ee,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"})]}),A==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(Eb,{selectedTools:G,onChange:L=>{Q(L),de(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,L),()=>{},"MCP tools updated","Failed to update MCP tools").catch(()=>{})}})]})]}),!Te&&!je&&r.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,r.jsx(bi,{isOpen:ae,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ve,onCancel:()=>me(!1)})]})}function U$(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=_x();return r.jsx(c5,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function $$(){const[t,s]=b.useState(void 0);return b.useEffect(()=>{let i=!1;return(async()=>{try{const c=await xe.getVersionStatus({});i||s({currentVersion:c.currentVersion,latestVersion:c.latestVersion,updateAvailable:c.updateAvailable,isDocker:c.isDocker})}catch{}})().catch(()=>{}),()=>{i=!0}},[]),t}function P$(){const{connected:t,environments:s,sessions:i}=ct(),o=$$();return r.jsxs(r.Fragment,{children:[o&&r.jsx(pO,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),r.jsx(u5,{connected:t,environments:s,sessions:i})]})}function V$(){return r.jsx(oB,{})}const Hb=ki();function H$(){const t=bt();return Ys({key:"?"},()=>{t(VN)}),Ys({key:"n"},()=>{t(Hb)}),Ys({key:"N"},()=>{t(Hb)}),r.jsx(r.Fragment,{})}function nl(t){const s=VL();b.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function q$(){const{workspaces:t,tasks:s}=ct(),i=b.useMemo(()=>r.jsx(HI,{workspaces:t,tasks:s}),[t,s]);return nl(i),r.jsx(La,{})}function G$(){const{environments:t}=ct(),s=b.useMemo(()=>r.jsx(Q4,{environments:t}),[t]);return nl(s),r.jsx(La,{})}function F$(){const t=b.useMemo(()=>r.jsx(KB,{}),[]);return nl(t),r.jsx(La,{})}function Z$(){const{findings:t,loadFindings:s,loadAllFindings:i}=ct(),{workspaceId:o,environmentId:c}=ls();b.useEffect(()=>{o?s(o).catch(()=>{}):i().catch(()=>{})},[o,s,i]);const u=b.useMemo(()=>r.jsx(uI,{findings:t,workspaceId:o,environmentId:c}),[t,o,c]);return nl(u),r.jsx(La,{})}function K$(){const{knowledge:t,workspaces:s}=ct(),i=b.useCallback(p=>{t.search(p).catch(()=>{})},[t]),o=b.useCallback(()=>{t.clearSearch()},[t]),c=b.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),u=b.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),d=b.useMemo(()=>r.jsx(f4,{nodes:t.graphData.nodes,workspaces:s,loading:t.loading,searchQuery:t.searchQuery,onSearch:i,onClearSearch:o,onSelectNode:c,onWorkspaceChange:u}),[t,s,i,o,c,u]);return nl(d),r.jsx(La,{})}const Y$="_container_ce571_1",J$="_title_ce571_6",qb={container:Y$,title:J$};function Gb(){const{environmentId:t,workspaceId:s}=ls(),{findings:i,loadFindings:o,workspaces:c,environments:u}=ct(),d=bt();b.useEffect(()=>{s&&o(s).catch(()=>{})},[s,o]);const p=b.useCallback(g=>{d(_p(g,s,t))},[d,s,t]),h=s&&t?jx("Findings",s,t,c,u).slice(0,-1):e8();return r.jsxs("div",{className:qb.container,"data-testid":"findings-list-page",children:[r.jsx(xs,{segments:h}),r.jsx("h1",{className:qb.title,children:"Findings"}),r.jsx(dx,{findings:i,onFindingClick:p})]})}const W$="_container_1wwpb_1",X$="_notFound_1wwpb_6",Q$="_header_1wwpb_12",e9="_categoryBadge_1wwpb_19",t9="_title_1wwpb_28",n9="_content_1wwpb_35",s9="_tags_1wwpb_77",a9="_tag_1wwpb_77",i9="_meta_1wwpb_92",o9="_metaTimestamp_1wwpb_100",r9="_metaLink_1wwpb_105",rn={container:W$,notFound:X$,header:Q$,categoryBadge:e9,title:t9,content:n9,tags:s9,tag:a9,meta:i9,metaTimestamp:o9,metaLink:r9};function Fb(){const{findingId:t,environmentId:s,workspaceId:i}=ls(),{selectedFinding:o,findingLoading:c,loadFinding:u,workspaces:d,environments:p}=ct(),h=bt();if(b.useEffect(()=>{t&&u(t).catch(()=>{})},[t,u]),c)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Loading..."})});if(!o)return r.jsx("div",{className:rn.container,"data-testid":"finding-detail-page",children:r.jsx("div",{className:rn.notFound,children:"Finding not found."})});const g=jx(o.title,i,s,d,p),v=Qc(o.category);return r.jsxs("div",{className:rn.container,"data-testid":"finding-detail-page",children:[r.jsx(xs,{segments:g}),r.jsxs("div",{className:rn.header,children:[r.jsx("span",{className:rn.categoryBadge,style:{background:v.bg,color:v.text},children:o.category}),r.jsx("h1",{className:rn.title,children:o.title})]}),o.content&&r.jsx("div",{className:rn.content,children:r.jsx(tu,{remarkPlugins:[nu],children:o.content})}),o.tags.length>0&&r.jsx("div",{className:rn.tags,children:o.tags.map(y=>r.jsx("span",{className:rn.tag,children:y},y))}),r.jsxs("div",{className:rn.meta,children:[r.jsx("span",{className:rn.metaTimestamp,title:o.createdAt,children:Um(o.createdAt)}),o.taskId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(rs(o.taskId))},children:"View Task"}),o.sessionId&&r.jsx("button",{type:"button",className:rn.metaLink,onClick:()=>{h(tm(o.sessionId))},children:"View Session"})]})]})}const l9="_wizard_1260s_1",c9="_container_1260s_10",u9="_stepContent_1260s_19",d9="_logoArea_1260s_28",f9="_logoImage_1260s_32",p9="_heading_1260s_41",m9="_tagline_1260s_49",h9="_subtitle_1260s_56",g9="_featureList_1260s_64",v9="_runtimeGrid_1260s_89",y9="_runtimeCard_1260s_101",b9="_runtimeName_1260s_133",_9="_runtimeDescription_1260s_139",x9="_buttonRow_1260s_144",k9="_primaryButton_1260s_151",S9="_ghostButton_1260s_185",T9="_dots_1260s_213",w9="_dot_1260s_213",ft={wizard:l9,container:c9,stepContent:u9,logoArea:d9,logoImage:f9,heading:p9,tagline:m9,subtitle:h9,featureList:g9,runtimeGrid:v9,runtimeCard:y9,runtimeName:b9,runtimeDescription:_9,buttonRow:x9,primaryButton:k9,ghostButton:S9,dots:T9,dot:w9};function N9({onNext:t}){return r.jsxs("div",{className:ft.stepContent,"data-testid":"setup-welcome",children:[r.jsx("div",{className:ft.logoArea,children:r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:ft.logoImage})}),r.jsx("h1",{className:ft.heading,children:"Welcome to Grackle"}),r.jsx("p",{className:ft.tagline,children:"Multi-agent orchestration for software teams"}),r.jsx("button",{type:"button",className:ft.primaryButton,onClick:t,"data-testid":"setup-get-started",children:"Get Started"})]})}function j9({onNext:t,onBack:s}){return r.jsxs("div",{className:ft.stepContent,"data-testid":"setup-about",children:[r.jsx("h2",{className:ft.heading,children:"What is Grackle?"}),r.jsxs("ul",{className:ft.featureList,children:[r.jsx("li",{children:"Run Claude, Copilot, and Codex agents side by side"}),r.jsx("li",{children:"Provision and control dev environments — SSH, Codespaces, or local"}),r.jsx("li",{children:"Organize work into workspaces with agent-executable tasks"}),r.jsx("li",{children:"Customize agent behavior with personas, tools, and MCP servers"}),r.jsx("li",{children:"Live-stream agent sessions with full terminal replay"})]}),r.jsxs("div",{className:ft.buttonRow,children:[r.jsx("button",{type:"button",className:ft.ghostButton,onClick:s,children:"Back"}),r.jsx("button",{type:"button",className:ft.primaryButton,onClick:t,"data-testid":"setup-about-next",children:"Next"})]})]})}const C9=[{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 E9({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=b.useState(t||"claude-code");return b.useEffect(()=>{t&&u(t)},[t]),r.jsxs("div",{className:ft.stepContent,"data-testid":"setup-runtime",children:[r.jsx("h2",{className:ft.heading,children:"Choose Your Runtime"}),r.jsx("p",{className:ft.subtitle,children:"Select the primary agent runtime for your workspace. You can change this later."}),r.jsx("div",{className:ft.runtimeGrid,children:C9.map(d=>r.jsxs("button",{type:"button",className:ft.runtimeCard,"data-selected":c===d.id,"aria-pressed":c===d.id,"data-testid":`runtime-card-${d.id}`,onClick:()=>u(d.id),children:[r.jsx("span",{className:ft.runtimeName,children:d.name}),r.jsx("span",{className:ft.runtimeDescription,children:d.description})]},d.id))}),r.jsxs("div",{className:ft.buttonRow,children:[r.jsx("button",{type:"button",className:ft.ghostButton,onClick:i,children:"Back"}),r.jsx("button",{type:"button",className:ft.primaryButton,onClick:()=>{s(c)},disabled:o,"data-testid":"setup-finish",children:"Finish"})]})]})}const A9=3,Zb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function D9(){const{personas:t,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=ct(),{showToast:c}=gn(),u=bt(),[d,p]=b.useState(0),[h,g]=b.useState(!1),v=t.find(_=>_.id==="claude-code"),y=b.useCallback(_=>{g(!0);const k=[];if(v&&_!==v.runtime){const w=Zb[_]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,_,w))}const S=t.find(w=>w.id===L0);if(S&&_!==S.runtime){const w=Zb[_]??"sonnet";k.push(s(L0,void 0,void 0,void 0,_,w))}Promise.all(k).then(()=>i()).then(()=>{u("/",{replace:!0})},()=>{c("Failed to update runtime -- please try again","error"),g(!1)})},[v,t,s,i,u,c]);return o===!0?r.jsx(is,{to:"/",replace:!0}):r.jsx("div",{className:ft.wizard,"data-testid":"setup-wizard",children:r.jsxs("div",{className:ft.container,children:[r.jsx(os,{mode:"wait",children:r.jsxs(Ct.div,{initial:{opacity:0,x:40},animate:{opacity:1,x:0},exit:{opacity:0,x:-40},transition:{duration:.2,ease:"easeInOut"},children:[d===0&&r.jsx(N9,{onNext:()=>p(1)}),d===1&&r.jsx(j9,{onNext:()=>p(2),onBack:()=>p(0)}),d===2&&r.jsx(E9,{currentRuntime:(v==null?void 0:v.runtime)??"claude-code",onFinish:y,onBack:()=>p(1),finishDisabled:!v||h})]},d)}),r.jsx("div",{className:ft.dots,children:Array.from({length:A9},(_,k)=>r.jsx("span",{className:ft.dot,"data-active":k===d},k))})]})})}const R9="_root_zndgp_1",M9="_body_zndgp_7",I9="_main_zndgp_19",O9="_sidebarWrapper_zndgp_26",B9="_overlay_zndgp_51",Rr={root:R9,body:M9,main:I9,sidebarWrapper:O9,overlay:B9},L9=b.lazy(()=>vT(()=>import("./KnowledgePage-5UF9Wqu5.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),Ex=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function z9(){const{connected:t,environments:s,sessions:i,tasks:o}=ct(),{toasts:c,dismissToast:u}=gn(),d=Pt(),p=PL(),h=p!==void 0,[g,v]=b.useState(!1),y=b.useCallback(()=>v(_=>!_),[]);return b.useEffect(()=>{v(!1)},[d.pathname]),b.useEffect(()=>{if(!g)return;const _=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[g]),r.jsxs(r.Fragment,{children:[r.jsx(k4,{connected:t,environments:s,sessions:i,onToggleSidebar:h?y:void 0,sidebarOpen:g}),r.jsx(E4,{}),r.jsxs("div",{className:Rr.body,children:[h&&r.jsx("div",{className:Rr.sidebarWrapper,"data-sidebar-open":g,children:r.jsx(O4,{content:p})}),h&&g&&r.jsx("div",{className:Rr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),r.jsxs("div",{className:Rr.main,children:[r.jsx(La,{}),r.jsx(H4,{sessions:i,tasks:o,environments:s})]})]}),r.jsx(nO,{toasts:c,onDismiss:u}),r.jsx(H$,{})]})}function U9(){const{lastSpawnedId:t,environments:s,tasks:i,connected:o,onboardingCompleted:c,environmentOperationError:u,clearEnvironmentOperationError:d}=ct(),{showToast:p}=gn();U8(s,p),q8(i,p),$8(u,d,p);const h=bt(),g=Pt();return b.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&h(tm(t),{replace:!0})},[t,h,g.pathname]),o&&c===!1?r.jsx(is,{to:"/setup",replace:!0}):r.jsx($L,{children:r.jsxs("div",{className:Rr.root,children:[Ex&&r.jsx(yj,{}),r.jsx(z9,{})]})})}function hp(){const{workspaceId:t}=ls(),{workspaces:s}=ct(),i=Pt(),o=s.find(h=>h.id===t);if(!(o!=null&&o.environmentId))return s.length===0?void 0:r.jsx(is,{to:"/environments",replace:!0});const c=encodeURIComponent(t),u=`/workspaces/${c}`,d=i.pathname.startsWith(u)?i.pathname.slice(u.length):"",p=`/environments/${encodeURIComponent(o.environmentId)}/workspaces/${c}${d}${i.search}${i.hash}`;return r.jsx(is,{to:p,replace:!0})}function $9(){return r.jsxs(sN,{children:[r.jsx(Se,{path:"setup",element:r.jsx(D9,{})}),r.jsxs(Se,{element:r.jsx(U9,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(fU,{})}),r.jsx(Se,{path:"chat",element:r.jsx(xU,{})}),r.jsx(Se,{path:"sessions/new",element:r.jsx(kU,{})}),r.jsx(Se,{path:"sessions/:sessionId",element:r.jsx(wU,{})}),r.jsx(Se,{element:r.jsx(K$,{}),children:r.jsx(Se,{path:"knowledge",element:r.jsx(b.Suspense,{fallback:r.jsx(tx,{}),children:r.jsx(L9,{})})})}),r.jsxs(Se,{element:r.jsx(q$,{}),children:[r.jsx(Se,{path:"tasks",element:r.jsx(uU,{})}),r.jsx(Se,{path:"tasks/new",element:r.jsx(zb,{})}),r.jsx(Se,{path:"tasks/:taskId",element:r.jsx(Aa,{})}),r.jsx(Se,{path:"tasks/:taskId/edit",element:r.jsx(Aa,{})}),r.jsx(Se,{path:"tasks/:taskId/stream",element:r.jsx(Aa,{})}),r.jsx(Se,{path:"tasks/:taskId/findings",element:r.jsx(Aa,{})})]}),r.jsxs(Se,{element:r.jsx(Z$,{}),children:[r.jsx(Se,{path:"findings",element:r.jsx(Gb,{})}),r.jsx(Se,{path:"findings/:findingId",element:r.jsx(Fb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:r.jsx(Gb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:r.jsx(Fb,{})})]}),r.jsxs(Se,{element:r.jsx(G$,{}),children:[r.jsx(Se,{path:"workspaces",element:r.jsx(is,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"workspaces/new",element:r.jsx(UU,{})}),r.jsx(Se,{path:"workspaces/:workspaceId",element:r.jsx(hp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId",element:r.jsx(hp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:r.jsx(hp,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId",element:r.jsx(CU,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:r.jsx(zb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId",element:r.jsx(Aa,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit",element:r.jsx(Aa,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/stream",element:r.jsx(Aa,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings",element:r.jsx(Aa,{})}),r.jsxs(Se,{path:"environments",element:r.jsx(YU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(dU,{})}),r.jsx(Se,{path:"new",element:r.jsx(qU,{})}),r.jsx(Se,{path:":environmentId",element:r.jsx(S$,{})}),r.jsx(Se,{path:":environmentId/edit",element:r.jsx(GU,{})})]})]}),r.jsx(Se,{element:r.jsx(F$,{}),children:r.jsxs(Se,{path:"settings",element:r.jsx(N$,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(is,{to:"credentials",replace:!0})}),r.jsx(Se,{path:"environments",element:r.jsx(is,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"credentials",element:r.jsx(j$,{})}),r.jsx(Se,{path:"tokens",element:r.jsx(is,{to:"../credentials",replace:!0})}),r.jsx(Se,{path:"personas",element:r.jsx(C$,{})}),r.jsx(Se,{path:"personas/new",element:r.jsx(Vb,{})}),r.jsx(Se,{path:"personas/:personaId",element:r.jsx(Vb,{})}),r.jsx(Se,{path:"appearance",element:r.jsx(U$,{})}),r.jsx(Se,{path:"shortcuts",element:r.jsx(V$,{})}),r.jsx(Se,{path:"about",element:r.jsx(P$,{})})]})}),r.jsx(Se,{path:"*",element:r.jsx(is,{to:"/",replace:!0})})]})]})}const P9=1e4;function V9(){const{onboardingCompleted:t}=ct(),[s,i]=b.useState(!1);b.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),P9);return()=>clearTimeout(c)},[t]);const o=t===void 0&&!s;return r.jsx(os,{mode:"wait",children:o?r.jsx(Ct.div,{initial:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:r.jsx(tx,{})},"splash"):r.jsx(Ct.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:r.jsx(CN,{basename:"/".replace(/\/$/,""),children:r.jsx($9,{})})},"app")})}function H9(){const t=Ex?h8:z8;return r.jsx(UL,{children:r.jsx(OL,{children:r.jsx(t,{children:r.jsx(V9,{})})})})}mT.createRoot(document.getElementById("root")).render(r.jsx(b.StrictMode,{children:r.jsx(H9,{})}));export{xs as B,k_ as K,ct as a,_p as f,tm as s,rs as t,bt as u};