@grackle-ai/web 0.91.0 → 0.91.2

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-CWqrA3AS.js","assets/dagview-Dv4uDOZ5.js","assets/grpc-CbbuZL-C.js","assets/markdown-Bpil_wz-.js","assets/KnowledgePage-BmY14aDt.css"])))=>i.map(i=>d[i]);
2
- import{r as VS,a as HS,b as _,j as r,d as O0,H as L0,P as B0,i as qS,B as GS,c as FS,C as ZS,M as KS}from"./dagview-Dv4uDOZ5.js";import{c as YS,a as JS,G as WS,f as XS,M as QS,A as Yb,D as Jb,W as eT,O as tT,b as nT,C as Yr,d as sT,e as Wb,w as aT,t as iT,p as _c,g as oT,R as xr,S as z0}from"./grpc-CbbuZL-C.js";import{v as rT,r as lT,t as xc,i as cT,f as uT,M as nu,a as su}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 Nf={exports:{}},kr={},jf={exports:{}},Cf={};/**
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 U0;function dT(){return U0||(U0=1,(function(t){function s(L,Z){var ae=L.length;L.push(Z);e:for(;0<ae;){var re=ae-1>>>1,de=L[re];if(0<c(de,Z))L[re]=Z,L[ae]=de,ae=re;else break e}}function i(L){return L.length===0?null:L[0]}function o(L){if(L.length===0)return null;var Z=L[0],ae=L.pop();if(ae!==Z){L[0]=ae;e:for(var re=0,de=L.length,Ke=de>>>1;re<Ke;){var je=2*(re+1)-1,Te=L[je],Ie=je+1,ce=L[Ie];if(0>c(Te,ae))Ie<de&&0>c(ce,Te)?(L[re]=ce,L[Ie]=ae,re=Ie):(L[re]=Te,L[je]=ae,re=je);else if(Ie<de&&0>c(ce,ae))L[re]=ce,L[Ie]=ae,re=Ie;else break e}}return Z}function c(L,Z){var ae=L.sortIndex-Z.sortIndex;return ae!==0?ae:L.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,b=3,k=!1,S=!1,N=!1,j=!1,T=typeof setTimeout=="function"?setTimeout:null,C=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function A(L){for(var Z=i(g);Z!==null;){if(Z.callback===null)o(g);else if(Z.startTime<=L)o(g),Z.sortIndex=Z.expirationTime,s(h,Z);else break;Z=i(g)}}function I(L){if(N=!1,A(L),!S)if(i(h)!==null)S=!0,D||(D=!0,te());else{var Z=i(g);Z!==null&&J(I,Z.startTime-L)}}var D=!1,B=-1,z=5,X=-1;function Y(){return j?!0:!(t.unstable_now()-X<z)}function F(){if(j=!1,D){var L=t.unstable_now();X=L;var Z=!0;try{e:{S=!1,N&&(N=!1,C(B),B=-1),k=!0;var ae=b;try{t:{for(A(L),y=i(h);y!==null&&!(y.expirationTime>L&&Y());){var re=y.callback;if(typeof re=="function"){y.callback=null,b=y.priorityLevel;var de=re(y.expirationTime<=L);if(L=t.unstable_now(),typeof de=="function"){y.callback=de,A(L),Z=!0;break t}y===i(h)&&o(h),A(L)}else o(h);y=i(h)}if(y!==null)Z=!0;else{var Ke=i(g);Ke!==null&&J(I,Ke.startTime-L),Z=!1}}break e}finally{y=null,b=ae,k=!1}Z=void 0}}finally{Z?te():D=!1}}}var te;if(typeof E=="function")te=function(){E(F)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,se=le.port2;le.port1.onmessage=F,te=function(){se.postMessage(null)}}else te=function(){T(F,0)};function J(L,Z){B=T(function(){L(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(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(L){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ae=b;b=Z;try{return L()}finally{b=ae}},t.unstable_requestPaint=function(){j=!0},t.unstable_runWithPriority=function(L,Z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var ae=b;b=L;try{return Z()}finally{b=ae}},t.unstable_scheduleCallback=function(L,Z,ae){var re=t.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?re+ae:re):ae=re,L){case 1:var de=-1;break;case 2:de=250;break;case 5:de=1073741823;break;case 4:de=1e4;break;default:de=5e3}return de=ae+de,L={id:v++,callback:Z,priorityLevel:L,startTime:ae,expirationTime:de,sortIndex:-1},ae>re?(L.sortIndex=ae,s(g,L),i(h)===null&&L===i(g)&&(N?(C(B),B=-1):N=!0,J(I,ae-re))):(L.sortIndex=de,s(h,L),S||k||(S=!0,D||(D=!0,te()))),L},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(L){var Z=b;return function(){var ae=b;b=Z;try{return L.apply(this,arguments)}finally{b=ae}}}})(Cf)),Cf}var $0;function fT(){return $0||($0=1,jf.exports=dT()),jf.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 P0;function pT(){if(P0)return kr;P0=1;var t=fT(),s=VS(),i=HS();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,w=f.child;w;){if(w===a){x=!0,a=f,l=m;break}if(w===l){x=!0,l=f,a=m;break}w=w.sibling}if(!x){for(w=m.child;w;){if(w===a){x=!0,a=m,l=f;break}if(w===l){x=!0,l=m,a=f;break}w=w.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,b=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),N=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var le=Symbol.for("react.client.reference");function se(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case N:return"Fragment";case T:return"Profiler";case j:return"StrictMode";case I:return"Suspense";case D:return"SuspenseList";case X: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 A:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return n=e.displayName||null,n!==null?n:se(e.type)||"Memo";case z:n=e._payload,e=e._init;try{return se(e(n))}catch{}}return null}var J=Array.isArray,L=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,ae={pending:!1,data:null,method:null,action:null},re=[],de=-1;function Ke(e){return{current:e}}function je(e){0>de||(e.current=re[de],re[de]=null,de--)}function Te(e,n){de++,re[de]=e.current,e.current=n}var Ie=Ke(null),ce=Ke(null),ve=Ke(null),fe=Ke(null);function Oe(e,n){switch(Te(ve,n),Te(ce,e),Te(Ie,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?a0(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=a0(n),e=i0(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(ce),je(ve)}function vn(e){e.memoizedState!==null&&Te(fe,e);var n=Ie.current,a=i0(n,e.type);n!==a&&(Te(ce,e),Te(Ie,a))}function U(e){ce.current===e&&(je(Ie),je(ce)),fe.current===e&&(je(fe),vr._currentValue=ae)}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 ee=function(){throw Error()};if(Object.defineProperty(ee.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ee,[])}catch(K){var G=K}Reflect.construct(e,[],ee)}else{try{ee.call()}catch(K){G=K}e.call(ee.prototype)}}else{try{throw Error()}catch(K){G=K}(ee=e())&&typeof ee.catch=="function"&&ee.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),x=m[0],w=m[1];if(x&&w){var R=x.split(`
21
- `),q=w.split(`
22
- `);for(f=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;f<q.length&&!q[f].includes("DetermineComponentFrameRoot");)f++;if(l===R.length||f===q.length)for(l=R.length-1,f=q.length-1;1<=l&&0<=f&&R[l]!==q[f];)f--;for(;1<=l&&0<=f;l--,f--)if(R[l]!==q[f]){if(l!==1||f!==1)do if(l--,f--,0>f||R[l]!==q[f]){var W=`
23
- `+R[l].replace(" at new "," at ");return e.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",e.displayName)),W}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,wi=t.unstable_LowPriority,Ua=t.unstable_IdlePriority,Ni=t.log,al=t.unstable_setDisableYieldValue,na=null,Qt=null;function Yn(e){if(typeof Ni=="function"&&al(e),Qt&&typeof Qt.setStrictMode=="function")try{Qt.setStrictMode(na,e)}catch{}}var en=Math.clz32?Math.clz32:rl,il=Math.log,ol=Math.LN2;function rl(e){return e>>>=0,e===0?32:31-(il(e)/ol|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 V(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 w=l&134217727;return w!==0?(l=w&~m,l!==0?f=Ss(l):(x&=w,x!==0?f=Ss(x):a||(a=w&~e,a!==0&&(f=Ss(a))))):(w=l&~m,w!==0?f=Ss(w):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 ne(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 ue(){var e=Va;return Va<<=1,(Va&62914560)===0&&(Va=4194304),e}function pe(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 w=e.entanglements,R=e.expirationTimes,q=e.hiddenUpdates;for(a=x&~a;0<a;){var W=31-en(a),ee=1<<W;w[W]=0,R[W]=-1;var G=q[W];if(G!==null)for(q[W]=null,W=0;W<G.length;W++){var K=G[W];K!==null&&(K.lane&=-536870913)}a&=~ee}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:C0(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,ji="__reactContainer$"+sn,gu="__reactEvents$"+sn,Dx="__reactListeners$"+sn,Rx="__reactHandles$"+sn,Gm="__reactResources$"+sn,Ro="__reactMarker$"+sn;function vu(e){delete e[pt],delete e[Vt],delete e[gu],delete e[Dx],delete e[Rx]}function Ci(e){var n=e[pt];if(n)return n;for(var a=e.parentNode;a;){if(n=a[ji]||a[pt]){if(a=n.alternate,n.child!==null||a!==null&&a.child!==null)for(e=f0(e);e!==null;){if(a=e[pt])return a;e=f0(e)}return n}e=a,a=e.parentNode}return null}function Ei(e){if(e=e[pt]||e[ji]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function Mo(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(o(33))}function Ai(e){var n=e[Gm];return n||(n=e[Gm]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Ht(e){e[Ro]=!0}var Fm=new Set,Zm={};function Ha(e,n){Di(e,n),Di(e+"Capture",n)}function Di(e,n){for(Zm[e]=n,e=0;e<n.length;e++)Fm.add(n[e])}var Mx=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]*$"),Km={},Ym={};function Ix(e){return Zn.call(Ym,e)?!0:Zn.call(Km,e)?!1:Mx.test(e)?Ym[e]=!0:(Km[e]=!0,!1)}function ll(e,n,a){if(Ix(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 cl(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 Jm(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ox(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 yu(e){if(!e._valueTracker){var n=Jm(e)?"checked":"value";e._valueTracker=Ox(e,n,""+e[n])}}function Wm(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var a=n.getValue(),l="";return e&&(l=Jm(e)?e.checked?"true":"false":e.value),e=l,e!==a?(n.setValue(e),!0):!1}function ul(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Lx=/[\n"\\]/g;function Rn(e){return e.replace(Lx,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function bu(e,n,a,l,f,m,x,w){e.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.type=x:e.removeAttribute("type"),n!=null?x==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+Dn(n)):e.value!==""+Dn(n)&&(e.value=""+Dn(n)):x!=="submit"&&x!=="reset"||e.removeAttribute("value"),n!=null?_u(e,x,Dn(n)):a!=null?_u(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"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+Dn(w):e.removeAttribute("name")}function Xm(e,n,a,l,f,m,x,w){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)){yu(e);return}a=a!=null?""+Dn(a):"",n=n!=null?""+Dn(n):a,w||n===e.value||(e.value=n),e.defaultValue=n}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(e.name=x),yu(e)}function _u(e,n,a){n==="number"&&ul(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ri(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 Qm(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 eh(e,n,a,l){if(n==null){if(l!=null){if(a!=null)throw Error(o(92));if(J(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),yu(e)}function Mi(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 th(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 nh(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&&th(e,f,l)}else for(var m in n)n.hasOwnProperty(m)&&th(e,m,n[m])}function xu(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 zx=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"]]),Ux=/^[\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 dl(e){return Ux.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ws(){}var ku=null;function Su(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ii=null,Oi=null;function sh(e){var n=Ei(e);if(n&&(e=n.stateNode)){var a=e[Vt]||null;e:switch(e=n.stateNode,n.type){case"input":if(bu(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));bu(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&&Wm(l)}break e;case"textarea":Qm(e,a.value,a.defaultValue);break e;case"select":n=a.value,n!=null&&Ri(e,!!a.multiple,n,!1)}}}var Tu=!1;function ah(e,n,a){if(Tu)return e(n,a);Tu=!0;try{var l=e(n);return l}finally{if(Tu=!1,(Ii!==null||Oi!==null)&&(Xl(),Ii&&(n=Ii,e=Oi,Oi=Ii=null,sh(n),e)))for(n=0;n<e.length;n++)sh(e[n])}}function Io(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"),wu=!1;if(Ns)try{var Oo={};Object.defineProperty(Oo,"passive",{get:function(){wu=!0}}),window.addEventListener("test",Oo,Oo),window.removeEventListener("test",Oo,Oo)}catch{wu=!1}var sa=null,Nu=null,fl=null;function ih(){if(fl)return fl;var e,n=Nu,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 fl=f.slice(e,1<l?1-l:void 0)}function pl(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 ml(){return!0}function oh(){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 w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(m):m[w]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?ml:oh,this.isPropagationStopped=oh,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=ml)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=ml)},persist:function(){},isPersistent:ml}),n}var qa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hl=un(qa),Lo=y({},qa,{view:0,detail:0}),$x=un(Lo),ju,Cu,Bo,gl=y({},Lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Au,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"?(ju=e.screenX-Bo.screenX,Cu=e.screenY-Bo.screenY):Cu=ju=0,Bo=e),ju)},movementY:function(e){return"movementY"in e?e.movementY:Cu}}),rh=un(gl),Px=y({},gl,{dataTransfer:0}),Vx=un(Px),Hx=y({},Lo,{relatedTarget:0}),Eu=un(Hx),qx=y({},qa,{animationName:0,elapsedTime:0,pseudoElement:0}),Gx=un(qx),Fx=y({},qa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zx=un(Fx),Kx=y({},qa,{data:0}),lh=un(Kx),Yx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jx={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"},Wx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Xx(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Wx[e])?!!n[e]:!1}function Au(){return Xx}var Qx=y({},Lo,{key:function(e){if(e.key){var n=Yx[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=pl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Jx[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Au,charCode:function(e){return e.type==="keypress"?pl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?pl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ek=un(Qx),tk=y({},gl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ch=un(tk),nk=y({},Lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Au}),sk=un(nk),ak=y({},qa,{propertyName:0,elapsedTime:0,pseudoElement:0}),ik=un(ak),ok=y({},gl,{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}),rk=un(ok),lk=y({},qa,{newState:0,oldState:0}),ck=un(lk),uk=[9,13,27,32],Du=Ns&&"CompositionEvent"in window,zo=null;Ns&&"documentMode"in document&&(zo=document.documentMode);var dk=Ns&&"TextEvent"in window&&!zo,uh=Ns&&(!Du||zo&&8<zo&&11>=zo),dh=" ",fh=!1;function ph(e,n){switch(e){case"keyup":return uk.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function mh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Li=!1;function fk(e,n){switch(e){case"compositionend":return mh(n);case"keypress":return n.which!==32?null:(fh=!0,dh);case"textInput":return e=n.data,e===dh&&fh?null:e;default:return null}}function pk(e,n){if(Li)return e==="compositionend"||!Du&&ph(e,n)?(e=ih(),fl=Nu=sa=null,Li=!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 uh&&n.locale!=="ko"?null:n.data;default:return null}}var mk={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 hh(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!mk[e.type]:n==="textarea"}function gh(e,n,a,l){Ii?Oi?Oi.push(l):Oi=[l]:Ii=l,n=ic(n,"onChange"),0<n.length&&(a=new hl("onChange","change",null,a,l),e.push({event:a,listeners:n}))}var Uo=null,$o=null;function hk(e){Xv(e,0)}function vl(e){var n=Mo(e);if(Wm(n))return e}function vh(e,n){if(e==="change")return n}var yh=!1;if(Ns){var Ru;if(Ns){var Mu="oninput"in document;if(!Mu){var bh=document.createElement("div");bh.setAttribute("oninput","return;"),Mu=typeof bh.oninput=="function"}Ru=Mu}else Ru=!1;yh=Ru&&(!document.documentMode||9<document.documentMode)}function _h(){Uo&&(Uo.detachEvent("onpropertychange",xh),$o=Uo=null)}function xh(e){if(e.propertyName==="value"&&vl($o)){var n=[];gh(n,$o,e,Su(e)),ah(hk,n)}}function gk(e,n,a){e==="focusin"?(_h(),Uo=n,$o=a,Uo.attachEvent("onpropertychange",xh)):e==="focusout"&&_h()}function vk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vl($o)}function yk(e,n){if(e==="click")return vl(n)}function bk(e,n){if(e==="input"||e==="change")return vl(n)}function _k(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var bn=typeof Object.is=="function"?Object.is:_k;function Po(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 kh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sh(e,n){var a=kh(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=kh(a)}}function Th(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Th(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function wh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=ul(e.document);n instanceof e.HTMLIFrameElement;){try{var a=typeof n.contentWindow.location.href=="string"}catch{a=!1}if(a)e=n.contentWindow;else break;n=ul(e.document)}return n}function Iu(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 xk=Ns&&"documentMode"in document&&11>=document.documentMode,Bi=null,Ou=null,Vo=null,Lu=!1;function Nh(e,n,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Lu||Bi==null||Bi!==ul(l)||(l=Bi,"selectionStart"in l&&Iu(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}),Vo&&Po(Vo,l)||(Vo=l,l=ic(Ou,"onSelect"),0<l.length&&(n=new hl("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 zi={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={},jh={};Ns&&(jh=document.createElement("div").style,"AnimationEvent"in window||(delete zi.animationend.animation,delete zi.animationiteration.animation,delete zi.animationstart.animation),"TransitionEvent"in window||delete zi.transitionend.transition);function Fa(e){if(Bu[e])return Bu[e];if(!zi[e])return e;var n=zi[e],a;for(a in n)if(n.hasOwnProperty(a)&&a in jh)return Bu[e]=n[a];return e}var Ch=Fa("animationend"),Eh=Fa("animationiteration"),Ah=Fa("animationstart"),kk=Fa("transitionrun"),Sk=Fa("transitionstart"),Tk=Fa("transitioncancel"),Dh=Fa("transitionend"),Rh=new Map,zu="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(" ");zu.push("scrollEnd");function Jn(e,n){Rh.set(e,n),Ha(n,[e])}var yl=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=[],Ui=0,Uu=0;function bl(){for(var e=Ui,n=Uu=Ui=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&&Mh(a,f,m)}}function _l(e,n,a,l){Mn[Ui++]=e,Mn[Ui++]=n,Mn[Ui++]=a,Mn[Ui++]=l,Uu|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function $u(e,n,a,l){return _l(e,n,a,l),xl(e)}function Za(e,n){return _l(e,null,null,n),xl(e)}function Mh(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 xl(e){if(50<ur)throw ur=0,Yd=null,Error(o(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var $i={};function wk(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 wk(e,n,a,l)}function Pu(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 Ih(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 kl(e,n,a,l,f,m){var x=0;if(l=e,typeof e=="function")Pu(e)&&(x=1);else if(typeof e=="string")x=AS(e,a,Ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case X:return e=_n(31,a,n,f),e.elementType=X,e.lanes=m,e;case N:return Ka(a.children,f,m,n);case j:x=8,f|=24;break;case T:return e=_n(12,a,n,f|2),e.elementType=T,e.lanes=m,e;case I:return e=_n(13,a,n,f),e.elementType=I,e.lanes=m,e;case D:return e=_n(19,a,n,f),e.elementType=D,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 A:x=11;break e;case B:x=14;break e;case z: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 Vu(e,n,a){return e=_n(6,e,null,n),e.lanes=a,e}function Oh(e){var n=_n(18,null,null,0);return n.stateNode=e,n}function Hu(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 Lh=new WeakMap;function In(e,n){if(typeof e=="object"&&e!==null){var a=Lh.get(e);return a!==void 0?a:(n={value:e,source:n,stack:An(n)},Lh.set(e,n),n)}return{value:e,source:n,stack:An(n)}}var Pi=[],Vi=0,Sl=null,Ho=0,On=[],Ln=0,aa=null,fs=1,ps="";function Cs(e,n){Pi[Vi++]=Ho,Pi[Vi++]=Sl,Sl=e,Ho=n}function Bh(e,n,a){On[Ln++]=fs,On[Ln++]=ps,On[Ln++]=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 qu(e){e.return!==null&&(Cs(e,1),Bh(e,1,0))}function Gu(e){for(;e===Sl;)Sl=Pi[--Vi],Pi[Vi]=null,Ho=Pi[--Vi],Pi[Vi]=null;for(;e===aa;)aa=On[--Ln],On[Ln]=null,ps=On[--Ln],On[Ln]=null,fs=On[--Ln],On[Ln]=null}function zh(e,n){On[Ln++]=fs,On[Ln++]=ps,On[Ln++]=aa,fs=n.id,ps=n.overflow,aa=e}var Zt=null,mt=null,Pe=!1,ia=null,Bn=!1,Fu=Error(o(519));function oa(e){var n=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qo(In(n,e)),Fu}function Uh(e){var n=e.stateNode,a=e.type,l=e.memoizedProps;switch(n[pt]=e,n[Vt]=l,a){case"dialog":Be("cancel",n),Be("close",n);break;case"iframe":case"object":case"embed":Be("load",n);break;case"video":case"audio":for(a=0;a<fr.length;a++)Be(fr[a],n);break;case"source":Be("error",n);break;case"img":case"image":case"link":Be("error",n),Be("load",n);break;case"details":Be("toggle",n);break;case"input":Be("invalid",n),Xm(n,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Be("invalid",n);break;case"textarea":Be("invalid",n),eh(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||n0(n.textContent,a)?(l.popover!=null&&(Be("beforetoggle",n),Be("toggle",n)),l.onScroll!=null&&Be("scroll",n),l.onScrollEnd!=null&&Be("scrollend",n),l.onClick!=null&&(n.onclick=ws),n=!0):n=!1,n||oa(e,!0)}function $h(e){for(Zt=e.return;Zt;)switch(Zt.tag){case 5:case 31:case 13:Bn=!1;return;case 27:case 3:Bn=!0;return;default:Zt=Zt.return}}function Hi(e){if(e!==Zt)return!1;if(!Pe)return $h(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")||df(e.type,e.memoizedProps)),a=!a),a&&mt&&oa(e),$h(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=d0(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));mt=d0(e)}else n===27?(n=mt,_a(e.type)?(e=gf,gf=null,mt=e):mt=n):mt=Zt?Un(e.stateNode.nextSibling):null;return!0}function Ya(){mt=Zt=null,Pe=!1}function Zu(){var e=ia;return e!==null&&(mn===null?mn=e:mn.push.apply(mn,e),ia=null),e}function qo(e){ia===null?ia=[e]:ia.push(e)}var Ku=Ke(null),Ja=null,Es=null;function ra(e,n,a){Te(Ku,n._currentValue),n._currentValue=a}function As(e){e._currentValue=Ku.current,je(Ku)}function Yu(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 Ju(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 w=m;m=f;for(var R=0;R<n.length;R++)if(w.context===n[R]){m.lanes|=a,w=m.alternate,w!==null&&(w.lanes|=a),Yu(m.return,a,e),l||(x=null);break e}m=w.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),Yu(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 qi(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 w=f.type;bn(f.pendingProps.value,x.value)||(e!==null?e.push(w):e=[w])}}else if(f===fe.current){if(x=f.alternate,x===null)throw Error(o(387));x.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(vr):e=[vr])}f=f.return}e!==null&&Ju(n,e,a,l),n.flags|=262144}function Tl(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 Ph(Ja,e)}function wl(e,n){return Ja===null&&Wa(e),Ph(e,n)}function Ph(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 Nk=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()})}},jk=t.unstable_scheduleCallback,Ck=t.unstable_NormalPriority,Ot={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Wu(){return{controller:new Nk,data:new Map,refCount:0}}function Go(e){e.refCount--,e.refCount===0&&jk(Ck,function(){e.controller.abort()})}var Fo=null,Xu=0,Gi=0,Fi=null;function Ek(e,n){if(Fo===null){var a=Fo=[];Xu=0,Gi=tf(),Fi={status:"pending",value:void 0,then:function(l){a.push(l)}}}return Xu++,n.then(Vh,Vh),n}function Vh(){if(--Xu===0&&Fo!==null){Fi!==null&&(Fi.status="fulfilled");var e=Fo;Fo=null,Gi=0,Fi=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function Ak(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 Hh=L.S;L.S=function(e,n){Nv=Ce(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&Ek(e,n),Hh!==null&&Hh(e,n)};var Xa=Ke(null);function Qu(){var e=Xa.current;return e!==null?e:dt.pooledCache}function Nl(e,n){n===null?Te(Xa,Xa.current):Te(Xa,n.pool)}function qh(){var e=Qu();return e===null?null:{parent:Ot._currentValue,pool:e}}var Zi=Error(o(460)),ed=Error(o(474)),jl=Error(o(542)),Cl={then:function(){}};function Gh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Fh(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,Kh(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,Kh(e),e}throw ei=n,Zi}}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,Zi):a}}var ei=null;function Zh(){if(ei===null)throw Error(o(459));var e=ei;return ei=null,e}function Kh(e){if(e===Zi||e===jl)throw Error(o(483))}var Ki=null,Zo=0;function El(e){var n=Zo;return Zo+=1,Ki===null&&(Ki=[]),Fh(Ki,e,n)}function Ko(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Al(e,n){throw n.$$typeof===b?Error(o(525)):(e=Object.prototype.toString.call(n),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function Yh(e){function n($,O){if(e){var H=$.deletions;H===null?($.deletions=[O],$.flags|=16):H.push(O)}}function a($,O){if(!e)return null;for(;O!==null;)n($,O),O=O.sibling;return null}function l($){for(var O=new Map;$!==null;)$.key!==null?O.set($.key,$):O.set($.index,$),$=$.sibling;return O}function f($,O){return $=js($,O),$.index=0,$.sibling=null,$}function m($,O,H){return $.index=H,e?(H=$.alternate,H!==null?(H=H.index,H<O?($.flags|=67108866,O):H):($.flags|=67108866,O)):($.flags|=1048576,O)}function x($){return e&&$.alternate===null&&($.flags|=67108866),$}function w($,O,H,Q){return O===null||O.tag!==6?(O=Vu(H,$.mode,Q),O.return=$,O):(O=f(O,H),O.return=$,O)}function R($,O,H,Q){var be=H.type;return be===N?W($,O,H.props.children,Q,H.key):O!==null&&(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===z&&Qa(be)===O.type)?(O=f(O,H.props),Ko(O,H),O.return=$,O):(O=kl(H.type,H.key,H.props,null,$.mode,Q),Ko(O,H),O.return=$,O)}function q($,O,H,Q){return O===null||O.tag!==4||O.stateNode.containerInfo!==H.containerInfo||O.stateNode.implementation!==H.implementation?(O=Hu(H,$.mode,Q),O.return=$,O):(O=f(O,H.children||[]),O.return=$,O)}function W($,O,H,Q,be){return O===null||O.tag!==7?(O=Ka(H,$.mode,Q,be),O.return=$,O):(O=f(O,H),O.return=$,O)}function ee($,O,H){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=Vu(""+O,$.mode,H),O.return=$,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case k:return H=kl(O.type,O.key,O.props,null,$.mode,H),Ko(H,O),H.return=$,H;case S:return O=Hu(O,$.mode,H),O.return=$,O;case z:return O=Qa(O),ee($,O,H)}if(J(O)||te(O))return O=Ka(O,$.mode,H,null),O.return=$,O;if(typeof O.then=="function")return ee($,El(O),H);if(O.$$typeof===E)return ee($,wl($,O),H);Al($,O)}return null}function G($,O,H,Q){var be=O!==null?O.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return be!==null?null:w($,O,""+H,Q);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case k:return H.key===be?R($,O,H,Q):null;case S:return H.key===be?q($,O,H,Q):null;case z:return H=Qa(H),G($,O,H,Q)}if(J(H)||te(H))return be!==null?null:W($,O,H,Q,null);if(typeof H.then=="function")return G($,O,El(H),Q);if(H.$$typeof===E)return G($,O,wl($,H),Q);Al($,H)}return null}function K($,O,H,Q,be){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return $=$.get(H)||null,w(O,$,""+Q,be);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case k:return $=$.get(Q.key===null?H:Q.key)||null,R(O,$,Q,be);case S:return $=$.get(Q.key===null?H:Q.key)||null,q(O,$,Q,be);case z:return Q=Qa(Q),K($,O,H,Q,be)}if(J(Q)||te(Q))return $=$.get(H)||null,W(O,$,Q,be,null);if(typeof Q.then=="function")return K($,O,H,El(Q),be);if(Q.$$typeof===E)return K($,O,H,wl(O,Q),be);Al(O,Q)}return null}function he($,O,H,Q){for(var be=null,Ye=null,ge=O,Re=O=0,$e=null;ge!==null&&Re<H.length;Re++){ge.index>Re?($e=ge,ge=null):$e=ge.sibling;var Je=G($,ge,H[Re],Q);if(Je===null){ge===null&&(ge=$e);break}e&&ge&&Je.alternate===null&&n($,ge),O=m(Je,O,Re),Ye===null?be=Je:Ye.sibling=Je,Ye=Je,ge=$e}if(Re===H.length)return a($,ge),Pe&&Cs($,Re),be;if(ge===null){for(;Re<H.length;Re++)ge=ee($,H[Re],Q),ge!==null&&(O=m(ge,O,Re),Ye===null?be=ge:Ye.sibling=ge,Ye=ge);return Pe&&Cs($,Re),be}for(ge=l(ge);Re<H.length;Re++)$e=K(ge,$,Re,H[Re],Q),$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($,wa)}),Pe&&Cs($,Re),be}function ke($,O,H,Q){if(H==null)throw Error(o(151));for(var be=null,Ye=null,ge=O,Re=O=0,$e=null,Je=H.next();ge!==null&&!Je.done;Re++,Je=H.next()){ge.index>Re?($e=ge,ge=null):$e=ge.sibling;var wa=G($,ge,Je.value,Q);if(wa===null){ge===null&&(ge=$e);break}e&&ge&&wa.alternate===null&&n($,ge),O=m(wa,O,Re),Ye===null?be=wa:Ye.sibling=wa,Ye=wa,ge=$e}if(Je.done)return a($,ge),Pe&&Cs($,Re),be;if(ge===null){for(;!Je.done;Re++,Je=H.next())Je=ee($,Je.value,Q),Je!==null&&(O=m(Je,O,Re),Ye===null?be=Je:Ye.sibling=Je,Ye=Je);return Pe&&Cs($,Re),be}for(ge=l(ge);!Je.done;Re++,Je=H.next())Je=K(ge,$,Re,Je.value,Q),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(PS){return n($,PS)}),Pe&&Cs($,Re),be}function lt($,O,H,Q){if(typeof H=="object"&&H!==null&&H.type===N&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case k:e:{for(var be=H.key;O!==null;){if(O.key===be){if(be=H.type,be===N){if(O.tag===7){a($,O.sibling),Q=f(O,H.props.children),Q.return=$,$=Q;break e}}else if(O.elementType===be||typeof be=="object"&&be!==null&&be.$$typeof===z&&Qa(be)===O.type){a($,O.sibling),Q=f(O,H.props),Ko(Q,H),Q.return=$,$=Q;break e}a($,O);break}else n($,O);O=O.sibling}H.type===N?(Q=Ka(H.props.children,$.mode,Q,H.key),Q.return=$,$=Q):(Q=kl(H.type,H.key,H.props,null,$.mode,Q),Ko(Q,H),Q.return=$,$=Q)}return x($);case S:e:{for(be=H.key;O!==null;){if(O.key===be)if(O.tag===4&&O.stateNode.containerInfo===H.containerInfo&&O.stateNode.implementation===H.implementation){a($,O.sibling),Q=f(O,H.children||[]),Q.return=$,$=Q;break e}else{a($,O);break}else n($,O);O=O.sibling}Q=Hu(H,$.mode,Q),Q.return=$,$=Q}return x($);case z:return H=Qa(H),lt($,O,H,Q)}if(J(H))return he($,O,H,Q);if(te(H)){if(be=te(H),typeof be!="function")throw Error(o(150));return H=be.call(H),ke($,O,H,Q)}if(typeof H.then=="function")return lt($,O,El(H),Q);if(H.$$typeof===E)return lt($,O,wl($,H),Q);Al($,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,O!==null&&O.tag===6?(a($,O.sibling),Q=f(O,H),Q.return=$,$=Q):(a($,O),Q=Vu(H,$.mode,Q),Q.return=$,$=Q),x($)):a($,O)}return function($,O,H,Q){try{Zo=0;var be=lt($,O,H,Q);return Ki=null,be}catch(ge){if(ge===Zi||ge===jl)throw ge;var Ye=_n(29,ge,null,$.mode);return Ye.lanes=Q,Ye.return=$,Ye}finally{}}}var ti=Yh(!0),Jh=Yh(!1),la=!1;function td(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nd(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=xl(e),Mh(e,null,a),n}return _l(e,l,n,a),xl(e)}function Yo(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 sd(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 ad=!1;function Jo(){if(ad){var e=Fi;if(e!==null)throw e}}function Wo(e,n,a,l){ad=!1;var f=e.updateQueue;la=!1;var m=f.firstBaseUpdate,x=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var R=w,q=R.next;R.next=null,x===null?m=q:x.next=q,x=R;var W=e.alternate;W!==null&&(W=W.updateQueue,w=W.lastBaseUpdate,w!==x&&(w===null?W.firstBaseUpdate=q:w.next=q,W.lastBaseUpdate=R))}if(m!==null){var ee=f.baseState;x=0,W=q=R=null,w=m;do{var G=w.lane&-536870913,K=G!==w.lane;if(K?(Ue&G)===G:(l&G)===G){G!==0&&G===Gi&&(ad=!0),W!==null&&(W=W.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var he=e,ke=w;G=n;var lt=a;switch(ke.tag){case 1:if(he=ke.payload,typeof he=="function"){ee=he.call(lt,ee,G);break e}ee=he;break e;case 3:he.flags=he.flags&-65537|128;case 0:if(he=ke.payload,G=typeof he=="function"?he.call(lt,ee,G):he,G==null)break e;ee=y({},ee,G);break e;case 2:la=!0}}G=w.callback,G!==null&&(e.flags|=64,K&&(e.flags|=8192),K=f.callbacks,K===null?f.callbacks=[G]:K.push(G))}else K={lane:G,tag:w.tag,payload:w.payload,callback:w.callback,next:null},W===null?(q=W=K,R=ee):W=W.next=K,x|=G;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;K=w,w=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);W===null&&(R=ee),f.baseState=R,f.firstBaseUpdate=q,f.lastBaseUpdate=W,m===null&&(f.shared.lanes=0),ha|=x,e.lanes=x,e.memoizedState=ee}}function Wh(e,n){if(typeof e!="function")throw Error(o(191,e));e.call(n)}function Xh(e,n){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Wh(a[e],n)}var Yi=Ke(null),Dl=Ke(0);function Qh(e,n){e=Us,Te(Dl,e),Te(Yi,n),Us=e|n.baseLanes}function id(){Te(Dl,Us),Te(Yi,Yi.current)}function od(){Us=Dl.current,je(Yi),je(Dl)}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||Yi.current!==null||n.memoizedState!==null)&&(zn=e)}function rd(e){Te(At,At.current),Te(xn,e),zn===null&&(zn=e)}function eg(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 Rl(e){for(var n=e;n!==null;){if(n.tag===13){var a=n.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||mf(a)||hf(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,Lt=null,Ml=!1,Ji=!1,ni=!1,Il=0,Xo=0,Wi=null,Dk=0;function Tt(){throw Error(o(321))}function ld(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 cd(e,n,a,l,f,m){return Ds=m,De=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,L.H=e===null||e.memoizedState===null?Bg:Td,ni=!1,m=a(l,f),ni=!1,Ji&&(m=ng(n,a,l,f)),tg(e),m}function tg(e){L.H=tr;var n=ot!==null&&ot.next!==null;if(Ds=0,Lt=ot=De=null,Ml=!1,Xo=0,Wi=null,n)throw Error(o(300));e===null||Bt||(e=e.dependencies,e!==null&&Tl(e)&&(Bt=!0))}function ng(e,n,a,l){De=e;var f=0;do{if(Ji&&(Wi=null),Xo=0,Ji=!1,25<=f)throw Error(o(301));if(f+=1,Lt=ot=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}L.H=zg,m=n(a,l)}while(Ji);return m}function Rk(){var e=L.H,n=e.useState()[0];return n=typeof n.then=="function"?Qo(n):n,e=e.useState()[0],(ot!==null?ot.memoizedState:null)!==e&&(De.flags|=1024),n}function ud(){var e=Il!==0;return Il=0,e}function dd(e,n,a){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~a}function fd(e){if(Ml){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ml=!1}Ds=0,Lt=ot=De=null,Ji=!1,Xo=Il=0,Wi=null}function an(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lt===null?De.memoizedState=Lt=e:Lt=Lt.next=e,Lt}function Dt(){if(ot===null){var e=De.alternate;e=e!==null?e.memoizedState:null}else e=ot.next;var n=Lt===null?De.memoizedState:Lt.next;if(n!==null)Lt=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},Lt===null?De.memoizedState=Lt=e:Lt=Lt.next=e}return Lt}function Ol(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qo(e){var n=Xo;return Xo+=1,Wi===null&&(Wi=[]),e=Fh(Wi,e,n),n=De,(Lt===null?n.memoizedState:Lt.next)===null&&(n=n.alternate,L.H=n===null||n.memoizedState===null?Bg:Td),e}function Ll(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Qo(e);if(e.$$typeof===E)return Kt(e)}throw Error(o(438,String(e)))}function pd(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=Ol(),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]=Y;return n.index++,a}function Rs(e,n){return typeof n=="function"?n(e):n}function Bl(e){var n=Dt();return md(n,ot,e)}function md(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 w=x=null,R=null,q=n,W=!1;do{var ee=q.lane&-536870913;if(ee!==q.lane?(Ue&ee)===ee:(Ds&ee)===ee){var G=q.revertLane;if(G===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null}),ee===Gi&&(W=!0);else if((Ds&G)===G){q=q.next,G===Gi&&(W=!0);continue}else ee={lane:0,revertLane:q.revertLane,gesture:null,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},R===null?(w=R=ee,x=m):R=R.next=ee,De.lanes|=G,ha|=G;ee=q.action,ni&&a(m,ee),m=q.hasEagerState?q.eagerState:a(m,ee)}else G={lane:ee,revertLane:q.revertLane,gesture:q.gesture,action:q.action,hasEagerState:q.hasEagerState,eagerState:q.eagerState,next:null},R===null?(w=R=G,x=m):R=R.next=G,De.lanes|=ee,ha|=ee;q=q.next}while(q!==null&&q!==n);if(R===null?x=m:R.next=w,!bn(m,e.memoizedState)&&(Bt=!0,W&&(a=Fi,a!==null)))throw a;e.memoizedState=m,e.baseState=x,e.baseQueue=R,l.lastRenderedState=m}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function hd(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)||(Bt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),a.lastRenderedState=m}return[m,l]}function sg(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,Bt=!0),f=f.queue,yd(og.bind(null,l,f,e),[e]),f.getSnapshot!==n||x||Lt!==null&&Lt.memoizedState.tag&1){if(l.flags|=2048,Xi(9,{destroy:void 0},ig.bind(null,l,f,a,n),null),dt===null)throw Error(o(349));m||(Ds&127)!==0||ag(l,n,a)}return a}function ag(e,n,a){e.flags|=16384,e={getSnapshot:n,value:a},n=De.updateQueue,n===null?(n=Ol(),De.updateQueue=n,n.stores=[e]):(a=n.stores,a===null?n.stores=[e]:a.push(e))}function ig(e,n,a,l){n.value=a,n.getSnapshot=l,rg(n)&&lg(e)}function og(e,n,a){return a(function(){rg(n)&&lg(e)})}function rg(e){var n=e.getSnapshot;e=e.value;try{var a=n();return!bn(e,a)}catch{return!0}}function lg(e){var n=Za(e,2);n!==null&&hn(n,e,2)}function gd(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 cg(e,n,a,l){return e.baseState=a,md(e,ot,typeof l=="function"?l:Rs)}function Mk(e,n,a,l,f){if($l(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)}};L.T!==null?a(!0):m.isTransition=!1,l(m),a=n.pending,a===null?(m.next=n.pending=m,ug(n,m)):(m.next=a.next,n.pending=a.next=m)}}function ug(e,n){var a=n.action,l=n.payload,f=e.state;if(n.isTransition){var m=L.T,x={};L.T=x;try{var w=a(f,l),R=L.S;R!==null&&R(x,w),dg(e,n,w)}catch(q){vd(e,n,q)}finally{m!==null&&x.types!==null&&(m.types=x.types),L.T=m}}else try{m=a(f,l),dg(e,n,m)}catch(q){vd(e,n,q)}}function dg(e,n,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){fg(e,n,l)},function(l){return vd(e,n,l)}):fg(e,n,a)}function fg(e,n,a){n.status="fulfilled",n.value=a,pg(n),e.state=a,n=e.pending,n!==null&&(a=n.next,a===n?e.pending=null:(a=a.next,n.next=a,ug(e,a)))}function vd(e,n,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do n.status="rejected",n.reason=a,pg(n),n=n.next;while(n!==l)}e.action=null}function pg(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function mg(e,n){return n}function hg(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=Bn;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:mg,lastRenderedState:n},a.queue=l,a=Ig.bind(null,De,l),l.dispatch=a,l=gd(!1),m=Sd.bind(null,De,!1,l.queue),l=an(),f={state:n,dispatch:null,action:e,pending:null},l.queue=f,a=Mk.bind(null,De,f,m,a),f.dispatch=a,l.memoizedState=e,[n,a,!1]}function gg(e){var n=Dt();return vg(n,ot,e)}function vg(e,n,a){if(n=md(e,n,mg)[0],e=Bl(Rs)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var l=Qo(n)}catch(x){throw x===Zi?jl:x}else l=n;n=Dt();var f=n.queue,m=f.dispatch;return a!==n.memoizedState&&(De.flags|=2048,Xi(9,{destroy:void 0},Ik.bind(null,f,a),null)),[l,m,e]}function Ik(e,n){e.action=n}function yg(e){var n=Dt(),a=ot;if(a!==null)return vg(n,a,e);Dt(),n=n.memoizedState,a=Dt();var l=a.queue.dispatch;return a.memoizedState=e,[n,l,!1]}function Xi(e,n,a,l){return e={tag:e,create:a,deps:l,inst:n,next:null},n=De.updateQueue,n===null&&(n=Ol(),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 bg(){return Dt().memoizedState}function zl(e,n,a,l){var f=an();De.flags|=e,f.memoizedState=Xi(1|n,{destroy:void 0},a,l===void 0?null:l)}function Ul(e,n,a,l){var f=Dt();l=l===void 0?null:l;var m=f.memoizedState.inst;ot!==null&&l!==null&&ld(l,ot.memoizedState.deps)?f.memoizedState=Xi(n,m,a,l):(De.flags|=e,f.memoizedState=Xi(1|n,m,a,l))}function _g(e,n){zl(8390656,8,e,n)}function yd(e,n){Ul(2048,8,e,n)}function Ok(e){De.flags|=4;var n=De.updateQueue;if(n===null)n=Ol(),De.updateQueue=n,n.events=[e];else{var a=n.events;a===null?n.events=[e]:a.push(e)}}function xg(e){var n=Dt().memoizedState;return Ok({ref:n,nextImpl:e}),function(){if((Qe&2)!==0)throw Error(o(440));return n.impl.apply(void 0,arguments)}}function kg(e,n){return Ul(4,2,e,n)}function Sg(e,n){return Ul(4,4,e,n)}function Tg(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 wg(e,n,a){a=a!=null?a.concat([e]):null,Ul(4,4,Tg.bind(null,n,e),a)}function bd(){}function Ng(e,n){var a=Dt();n=n===void 0?null:n;var l=a.memoizedState;return n!==null&&ld(n,l[1])?l[0]:(a.memoizedState=[e,n],e)}function jg(e,n){var a=Dt();n=n===void 0?null:n;var l=a.memoizedState;if(n!==null&&ld(n,l[1]))return l[0];if(l=e(),ni){Yn(!0);try{e()}finally{Yn(!1)}}return a.memoizedState=[l,n],l}function _d(e,n,a){return a===void 0||(Ds&1073741824)!==0&&(Ue&261930)===0?e.memoizedState=n:(e.memoizedState=a,e=Cv(),De.lanes|=e,ha|=e,a)}function Cg(e,n,a,l){return bn(a,n)?a:Yi.current!==null?(e=_d(e,a,l),bn(e,n)||(Bt=!0),e):(Ds&42)===0||(Ds&1073741824)!==0&&(Ue&261930)===0?(Bt=!0,e.memoizedState=a):(e=Cv(),De.lanes|=e,ha|=e,n)}function Eg(e,n,a,l,f){var m=Z.p;Z.p=m!==0&&8>m?m:8;var x=L.T,w={};L.T=w,Sd(e,!1,n,a);try{var R=f(),q=L.S;if(q!==null&&q(w,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var W=Ak(R,l);er(e,n,W,wn(e))}else er(e,n,l,wn(e))}catch(ee){er(e,n,{then:function(){},status:"rejected",reason:ee},wn())}finally{Z.p=m,x!==null&&w.types!==null&&(x.types=w.types),L.T=x}}function Lk(){}function xd(e,n,a,l){if(e.tag!==5)throw Error(o(476));var f=Ag(e).queue;Eg(e,f,n,ae,a===null?Lk:function(){return Dg(e),a(l)})}function Ag(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rs,lastRenderedState:ae},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 Dg(e){var n=Ag(e);n.next===null&&(n=e.alternate.memoizedState),er(e,n.next.queue,{},wn())}function kd(){return Kt(vr)}function Rg(){return Dt().memoizedState}function Mg(){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),Yo(l,n,a)),n={cache:Wu()},e.payload=n;return}n=n.return}}function zk(e,n,a){var l=wn();a={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},$l(e)?Og(n,a):(a=$u(e,n,a,l),a!==null&&(hn(a,e,l),Lg(a,n,l)))}function Ig(e,n,a){var l=wn();er(e,n,a,l)}function er(e,n,a,l){var f={lane:l,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if($l(e))Og(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,w=m(x,a);if(f.hasEagerState=!0,f.eagerState=w,bn(w,x))return _l(e,n,f,0),dt===null&&bl(),!1}catch{}finally{}if(a=$u(e,n,f,l),a!==null)return hn(a,e,l),Lg(a,n,l),!0}return!1}function Sd(e,n,a,l){if(l={lane:2,revertLane:tf(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},$l(e)){if(n)throw Error(o(479))}else n=$u(e,a,l,2),n!==null&&hn(n,e,2)}function $l(e){var n=e.alternate;return e===De||n!==null&&n===De}function Og(e,n){Ji=Ml=!0;var a=e.pending;a===null?n.next=n:(n.next=a.next,a.next=n),e.pending=n}function Lg(e,n,a){if((a&4194048)!==0){var l=n.lanes;l&=e.pendingLanes,a|=l,n.lanes=a,Fe(e,a)}}var tr={readContext:Kt,use:Ll,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};tr.useEffectEvent=Tt;var Bg={readContext:Kt,use:Ll,useCallback:function(e,n){return an().memoizedState=[e,n===void 0?null:n],e},useContext:Kt,useEffect:_g,useImperativeHandle:function(e,n,a){a=a!=null?a.concat([e]):null,zl(4194308,4,Tg.bind(null,n,e),a)},useLayoutEffect:function(e,n){return zl(4194308,4,e,n)},useInsertionEffect:function(e,n){zl(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=zk.bind(null,De,e),[l.memoizedState,e]},useRef:function(e){var n=an();return e={current:e},n.memoizedState=e},useState:function(e){e=gd(e);var n=e.queue,a=Ig.bind(null,De,n);return n.dispatch=a,[e.memoizedState,a]},useDebugValue:bd,useDeferredValue:function(e,n){var a=an();return _d(a,e,n)},useTransition:function(){var e=gd(!1);return e=Eg.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||ag(l,n,a)}f.memoizedState=a;var m={value:a,getSnapshot:n};return f.queue=m,_g(og.bind(null,l,m,e),[e]),l.flags|=2048,Xi(9,{destroy:void 0},ig.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=Il++,0<a&&(n+="H"+a.toString(32)),n+="_"}else a=Dk++,n="_"+n+"r_"+a.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:kd,useFormState:hg,useActionState:hg,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=Sd.bind(null,De,!0,a),a.dispatch=n,[e,n]},useMemoCache:pd,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)}}},Td={readContext:Kt,use:Ll,useCallback:Ng,useContext:Kt,useEffect:yd,useImperativeHandle:wg,useInsertionEffect:kg,useLayoutEffect:Sg,useMemo:jg,useReducer:Bl,useRef:bg,useState:function(){return Bl(Rs)},useDebugValue:bd,useDeferredValue:function(e,n){var a=Dt();return Cg(a,ot.memoizedState,e,n)},useTransition:function(){var e=Bl(Rs)[0],n=Dt().memoizedState;return[typeof e=="boolean"?e:Qo(e),n]},useSyncExternalStore:sg,useId:Rg,useHostTransitionStatus:kd,useFormState:gg,useActionState:gg,useOptimistic:function(e,n){var a=Dt();return cg(a,ot,e,n)},useMemoCache:pd,useCacheRefresh:Mg};Td.useEffectEvent=xg;var zg={readContext:Kt,use:Ll,useCallback:Ng,useContext:Kt,useEffect:yd,useImperativeHandle:wg,useInsertionEffect:kg,useLayoutEffect:Sg,useMemo:jg,useReducer:hd,useRef:bg,useState:function(){return hd(Rs)},useDebugValue:bd,useDeferredValue:function(e,n){var a=Dt();return ot===null?_d(a,e,n):Cg(a,ot.memoizedState,e,n)},useTransition:function(){var e=hd(Rs)[0],n=Dt().memoizedState;return[typeof e=="boolean"?e:Qo(e),n]},useSyncExternalStore:sg,useId:Rg,useHostTransitionStatus:kd,useFormState:yg,useActionState:yg,useOptimistic:function(e,n){var a=Dt();return ot!==null?cg(a,ot,e,n):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:pd,useCacheRefresh:Mg};zg.useEffectEvent=xg;function wd(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 Nd={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),Yo(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),Yo(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),Yo(n,e,a))}};function Ug(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?!Po(a,l)||!Po(f,m):!0}function $g(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&&Nd.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 Pg(e){yl(e)}function Vg(e){console.error(e)}function Hg(e){yl(e)}function Pl(e,n){try{var a=e.onUncaughtError;a(n.value,{componentStack:n.stack})}catch(l){setTimeout(function(){throw l})}}function qg(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 jd(e,n,a){return a=ca(a),a.tag=3,a.payload={element:null},a.callback=function(){Pl(e,n)},a}function Gg(e){return e=ca(e),e.tag=3,e}function Fg(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(){qg(n,a,l)}}var x=a.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(e.callback=function(){qg(n,a,l),typeof f!="function"&&(ga===null?ga=new Set([this]):ga.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function Uk(e,n,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(n=a.alternate,n!==null&&qi(n,a,f,!0),a=xn.current,a!==null){switch(a.tag){case 31:case 13:return zn===null?Ql():a.alternate===null&&wt===0&&(wt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===Cl?a.flags|=16384:(n=a.updateQueue,n===null?a.updateQueue=new Set([l]):n.add(l),Xd(e,l,f)),!1;case 22:return a.flags|=65536,l===Cl?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)),Xd(e,l,f)),!1}throw Error(o(435,a.tag))}return Xd(e,l,f),Ql(),!1}if(Pe)return n=xn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=f,l!==Fu&&(e=Error(o(422),{cause:l}),qo(In(e,a)))):(l!==Fu&&(n=Error(o(423),{cause:l}),qo(In(n,a))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=In(l,a),f=jd(e.stateNode,l,f),sd(e,f),wt!==4&&(wt=2)),!1;var m=Error(o(520),{cause:l});if(m=In(m,a),cr===null?cr=[m]:cr.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=jd(a.stateNode,l,e),sd(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=Gg(f),Fg(f,e,a,l),sd(a,f),!1}a=a.return}while(a!==null);return!1}var Cd=Error(o(461)),Bt=!1;function Yt(e,n,a,l){n.child=e===null?Jh(n,null,a,l):ti(n,e.child,a,l)}function Zg(e,n,a,l,f){a=a.render;var m=n.ref;if("ref"in l){var x={};for(var w in l)w!=="ref"&&(x[w]=l[w])}else x=l;return Wa(n),l=cd(e,n,a,x,m,f),w=ud(),e!==null&&!Bt?(dd(e,n,f),Ms(e,n,f)):(Pe&&w&&qu(n),n.flags|=1,Yt(e,n,l,f),n.child)}function Kg(e,n,a,l,f){if(e===null){var m=a.type;return typeof m=="function"&&!Pu(m)&&m.defaultProps===void 0&&a.compare===null?(n.tag=15,n.type=m,Yg(e,n,m,l,f)):(e=kl(a.type,null,l,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!Ld(e,f)){var x=m.memoizedProps;if(a=a.compare,a=a!==null?a:Po,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 Yg(e,n,a,l,f){if(e!==null){var m=e.memoizedProps;if(Po(m,l)&&e.ref===n.ref)if(Bt=!1,n.pendingProps=l=m,Ld(e,f))(e.flags&131072)!==0&&(Bt=!0);else return n.lanes=e.lanes,Ms(e,n,f)}return Ed(e,n,a,l,f)}function Jg(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 Wg(e,n,m,a,l)}if((a&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(n,m!==null?m.cachePool:null),m!==null?Qh(n,m):id(),eg(n);else return l=n.lanes=536870912,Wg(e,n,m!==null?m.baseLanes|a:a,a,l)}else m!==null?(Nl(n,m.cachePool),Qh(n,m),fa(),n.memoizedState=null):(e!==null&&Nl(n,null),id(),fa());return Yt(e,n,f,a),n.child}function nr(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function Wg(e,n,a,l,f){var m=Qu();return m=m===null?null:{parent:Ot._currentValue,pool:m},n.memoizedState={baseLanes:a,cachePool:m},e!==null&&Nl(n,null),id(),eg(n),e!==null&&qi(e,n,l,!0),n.childLanes=f,null}function Vl(e,n){return n=ql({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function Xg(e,n,a){return ti(n,e.child,null,a),e=Vl(n,n.pendingProps),e.flags|=2,kn(n),n.memoizedState=null,e}function $k(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=Vl(n,l),n.lanes=536870912,nr(null,e);if(rd(n),(e=mt)?(e=u0(e,Bn),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=Oh(e),a.return=n,n.child=a,Zt=n,mt=null)):e=null,e===null)throw oa(n);return n.lanes=536870912,null}return Vl(n,l)}var m=e.memoizedState;if(m!==null){var x=m.dehydrated;if(rd(n),f)if(n.flags&256)n.flags&=-257,n=Xg(e,n,a);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(o(558));else if(Bt||qi(e,n,a,!1),f=(a&e.childLanes)!==0,Bt||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),Cd;Ql(),n=Xg(e,n,a)}else e=m.treeContext,mt=Un(x.nextSibling),Zt=n,Pe=!0,ia=null,Bn=!1,e!==null&&zh(n,e),n=Vl(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 Hl(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 Ed(e,n,a,l,f){return Wa(n),a=cd(e,n,a,l,void 0,f),l=ud(),e!==null&&!Bt?(dd(e,n,f),Ms(e,n,f)):(Pe&&l&&qu(n),n.flags|=1,Yt(e,n,a,f),n.child)}function Qg(e,n,a,l,f,m){return Wa(n),n.updateQueue=null,a=ng(n,l,a,f),tg(e),l=ud(),e!==null&&!Bt?(dd(e,n,m),Ms(e,n,m)):(Pe&&l&&qu(n),n.flags|=1,Yt(e,n,a,m),n.child)}function ev(e,n,a,l,f){if(Wa(n),n.stateNode===null){var m=$i,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=Nd,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=l,m.state=n.memoizedState,m.refs={},td(n),x=a.contextType,m.context=typeof x=="object"&&x!==null?Kt(x):$i,m.state=n.memoizedState,x=a.getDerivedStateFromProps,typeof x=="function"&&(wd(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&&Nd.enqueueReplaceState(m,m.state,null),Wo(n,l,m,f),Jo(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!0}else if(e===null){m=n.stateNode;var w=n.memoizedProps,R=si(a,w);m.props=R;var q=m.context,W=a.contextType;x=$i,typeof W=="object"&&W!==null&&(x=Kt(W));var ee=a.getDerivedStateFromProps;W=typeof ee=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=n.pendingProps!==w,W||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||q!==x)&&$g(n,m,l,x),la=!1;var G=n.memoizedState;m.state=G,Wo(n,l,m,f),Jo(),q=n.memoizedState,w||G!==q||la?(typeof ee=="function"&&(wd(n,a,ee,l),q=n.memoizedState),(R=la||Ug(n,a,R,l,G,q,x))?(W||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=q),m.props=l,m.state=q,m.context=x,l=R):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),l=!1)}else{m=n.stateNode,nd(e,n),x=n.memoizedProps,W=si(a,x),m.props=W,ee=n.pendingProps,G=m.context,q=a.contextType,R=$i,typeof q=="object"&&q!==null&&(R=Kt(q)),w=a.getDerivedStateFromProps,(q=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x!==ee||G!==R)&&$g(n,m,l,R),la=!1,G=n.memoizedState,m.state=G,Wo(n,l,m,f),Jo();var K=n.memoizedState;x!==ee||G!==K||la||e!==null&&e.dependencies!==null&&Tl(e.dependencies)?(typeof w=="function"&&(wd(n,a,w,l),K=n.memoizedState),(W=la||Ug(n,a,W,l,G,K,R)||e!==null&&e.dependencies!==null&&Tl(e.dependencies))?(q||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,K,R),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,K,R)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),n.memoizedProps=l,n.memoizedState=K),m.props=l,m.state=K,m.context=R,l=W):(typeof m.componentDidUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||x===e.memoizedProps&&G===e.memoizedState||(n.flags|=1024),l=!1)}return m=l,Hl(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 tv(e,n,a,l){return Ya(),n.flags|=256,Yt(e,n,a,l),n.child}var Ad={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Dd(e){return{baseLanes:e,cachePool:qh()}}function Rd(e,n,a){return e=e!==null?e.childLanes&~a:0,n&&(e|=Tn),e}function nv(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=u0(e,Bn),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=Oh(e),a.return=n,n.child=a,Zt=n,mt=null)):e=null,e===null)throw oa(n);return hf(e)?n.lanes=32:n.lanes=536870912,null}var w=l.children;return l=l.fallback,f?(fa(),f=n.mode,w=ql({mode:"hidden",children:w},f),l=Ka(l,f,a,null),w.return=n,l.return=n,w.sibling=l,n.child=w,l=n.child,l.memoizedState=Dd(a),l.childLanes=Rd(e,x,a),n.memoizedState=Ad,nr(null,l)):(da(n),Md(n,w))}var R=e.memoizedState;if(R!==null&&(w=R.dehydrated,w!==null)){if(m)n.flags&256?(da(n),n.flags&=-257,n=Id(e,n,a)):n.memoizedState!==null?(fa(),n.child=e.child,n.flags|=128,n=null):(fa(),w=l.fallback,f=n.mode,l=ql({mode:"visible",children:l.children},f),w=Ka(w,f,a,null),w.flags|=2,l.return=n,w.return=n,l.sibling=w,n.child=l,ti(n,e.child,null,a),l=n.child,l.memoizedState=Dd(a),l.childLanes=Rd(e,x,a),n.memoizedState=Ad,n=nr(null,l));else if(da(n),hf(w)){if(x=w.nextSibling&&w.nextSibling.dataset,x)var q=x.dgst;x=q,l=Error(o(419)),l.stack="",l.digest=x,qo({value:l,source:null,stack:null}),n=Id(e,n,a)}else if(Bt||qi(e,n,a,!1),x=(a&e.childLanes)!==0,Bt||x){if(x=dt,x!==null&&(l=ut(x,a),l!==0&&l!==R.retryLane))throw R.retryLane=l,Za(e,l),hn(x,e,l),Cd;mf(w)||Ql(),n=Id(e,n,a)}else mf(w)?(n.flags|=192,n.child=e.child,n=null):(e=R.treeContext,mt=Un(w.nextSibling),Zt=n,Pe=!0,ia=null,Bn=!1,e!==null&&zh(n,e),n=Md(n,l.children),n.flags|=4096);return n}return f?(fa(),w=l.fallback,f=n.mode,R=e.child,q=R.sibling,l=js(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,q!==null?w=js(q,w):(w=Ka(w,f,a,null),w.flags|=2),w.return=n,l.return=n,l.sibling=w,n.child=l,nr(null,l),l=n.child,w=e.child.memoizedState,w===null?w=Dd(a):(f=w.cachePool,f!==null?(R=Ot._currentValue,f=f.parent!==R?{parent:R,pool:R}:f):f=qh(),w={baseLanes:w.baseLanes|a,cachePool:f}),l.memoizedState=w,l.childLanes=Rd(e,x,a),n.memoizedState=Ad,nr(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 Md(e,n){return n=ql({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ql(e,n){return e=_n(22,e,null,n),e.lanes=0,e}function Id(e,n,a){return ti(n,e.child,null,a),e=Md(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function sv(e,n,a){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n),Yu(e.return,n,a)}function Od(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 av(e,n,a){var l=n.pendingProps,f=l.revealOrder,m=l.tail;l=l.children;var x=At.current,w=(x&2)!==0;if(w?(x=x&1|2,n.flags|=128):x&=1,Te(At,x),Yt(e,n,l,a),l=Pe?Ho:0,!w&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&sv(e,a,n);else if(e.tag===19)sv(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&&Rl(e)===null&&(f=a),a=a.sibling;a=f,a===null?(f=n.child,n.child=null):(f=a.sibling,a.sibling=null),Od(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&&Rl(e)===null){n.child=f;break}e=f.sibling,f.sibling=a,a=f,f=e}Od(n,!0,a,null,m,l);break;case"together":Od(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(qi(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 Ld(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&Tl(e)))}function Pk(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,rd(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?nv(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||(qi(e,n,a,!1),l=(a&n.childLanes)!==0),f){if(l)return av(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,Jg(e,n,a,n.pendingProps);case 24:ra(n,Ot,e.memoizedState.cache)}return Ms(e,n,a)}function iv(e,n,a){if(e!==null)if(e.memoizedProps!==n.pendingProps)Bt=!0;else{if(!Ld(e,a)&&(n.flags&128)===0)return Bt=!1,Pk(e,n,a);Bt=(e.flags&131072)!==0}else Bt=!1,Pe&&(n.flags&1048576)!==0&&Bh(n,Ho,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")Pu(e)?(l=si(e,l),n.tag=1,n=ev(null,n,e,l,a)):(n.tag=0,n=Ed(null,n,e,l,a));else{if(e!=null){var f=e.$$typeof;if(f===A){n.tag=11,n=Zg(null,n,e,l,a);break e}else if(f===B){n.tag=14,n=Kg(null,n,e,l,a);break e}}throw n=se(e)||e,Error(o(306,n,""))}}return n;case 0:return Ed(e,n,n.type,n.pendingProps,a);case 1:return l=n.type,f=si(l,n.pendingProps),ev(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,nd(e,n),Wo(n,l,null,a);var x=n.memoizedState;if(l=x.cache,ra(n,Ot,l),l!==m.cache&&Ju(n,[Ot],a,!0),Jo(),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=tv(e,n,l,a);break e}else if(l!==f){f=In(Error(o(424)),n),qo(f),n=tv(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,Bn=!0,a=Jh(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 Hl(e,n),e===null?(a=g0(n.type,null,n.pendingProps,null))?n.memoizedState=a:Pe||(a=n.type,e=n.pendingProps,l=oc(ve.current).createElement(a),l[pt]=n,l[Vt]=e,Jt(l,a,e),Ht(l),n.stateNode=l):n.memoizedState=g0(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return vn(n),e===null&&Pe&&(l=n.stateNode=p0(n.type,n.pendingProps,ve.current),Zt=n,Bn=!0,f=mt,_a(n.type)?(gf=f,mt=Un(l.firstChild)):mt=f),Yt(e,n,n.pendingProps.children,a),Hl(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&Pe&&((f=l=mt)&&(l=vS(l,n.type,n.pendingProps,Bn),l!==null?(n.stateNode=l,Zt=n,mt=Un(l.firstChild),Bn=!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,df(f,m)?l=null:x!==null&&df(f,x)&&(n.flags|=32),n.memoizedState!==null&&(f=cd(e,n,Rk,null,null,a),vr._currentValue=f),Hl(e,n),Yt(e,n,l,a),n.child;case 6:return e===null&&Pe&&((e=a=mt)&&(a=yS(a,n.pendingProps,Bn),a!==null?(n.stateNode=a,Zt=n,mt=null,e=!0):e=!1),e||oa(n)),null;case 13:return nv(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 Zg(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 Kg(e,n,n.type,n.pendingProps,a);case 15:return Yg(e,n,n.type,n.pendingProps,a);case 19:return av(e,n,a);case 31:return $k(e,n,a);case 22:return Jg(e,n,a,n.pendingProps);case 24:return Wa(n),l=Kt(Ot),e===null?(f=Qu(),f===null&&(f=dt,m=Wu(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),n.memoizedState={parent:l,cache:f},td(n),ra(n,Ot,f)):((e.lanes&a)!==0&&(nd(e,n),Wo(n,null,null,a),Jo()),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&&Ju(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(Rv())e.flags|=8192;else throw ei=Cl,ed}else e.flags&=-16777217}function ov(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!x0(n))if(Rv())e.flags|=8192;else throw ei=Cl,ed}function Gl(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?ue():536870912,e.lanes|=n,no|=n)}function sr(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 Vk(e,n,a){var l=n.pendingProps;switch(Gu(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)&&(Hi(n)?Is(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Zu())),ht(n),null;case 26:var f=n.type,m=n.memoizedState;return e===null?(Is(n),m!==null?(ht(n),ov(n,m)):(ht(n),Bd(n,f,null,l,a))):m?m!==e.memoizedState?(Is(n),ht(n),ov(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(U(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,Hi(n)?Uh(n):(e=p0(f,l,a),n.stateNode=e,Is(n))}return ht(n),null;case 5:if(U(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,Hi(n))Uh(n);else{var x=oc(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,Hi(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||n0(e.nodeValue,a)),e||oa(n,!0)}else e=oc(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=Hi(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=Zu(),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=Hi(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=Zu(),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),Gl(n,n.updateQueue),ht(n),null);case 4:return _t(),e===null&&of(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)sr(l,!1);else{if(wt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=Rl(e),m!==null){for(n.flags|=128,sr(l,!1),e=m.updateQueue,n.updateQueue=e,Gl(n,e),n.subtreeFlags=0,e=a,a=n.child;a!==null;)Ih(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()>Jl&&(n.flags|=128,f=!0,sr(l,!1),n.lanes=4194304)}else{if(!f)if(e=Rl(m),e!==null){if(n.flags|=128,f=!0,e=e.updateQueue,n.updateQueue=e,Gl(n,e),sr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!m.alternate&&!Pe)return ht(n),null}else 2*Ce()-l.renderingStartTime>Jl&&a!==536870912&&(n.flags|=128,f=!0,sr(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),od(),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&&Gl(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 Hk(e,n){switch(Gu(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 U(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),od(),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 rv(e,n){switch(Gu(n),n.tag){case 3:As(Ot),_t();break;case 26:case 27:case 5:U(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),od(),e!==null&&je(Xa);break;case 24:As(Ot)}}function ar(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(w){at(n,n.return,w)}}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,w=x.destroy;if(w!==void 0){x.destroy=void 0,f=n;var R=a,q=w;try{q()}catch(W){at(f,R,W)}}}l=l.next}while(l!==m)}}catch(W){at(n,n.return,W)}}function lv(e){var n=e.updateQueue;if(n!==null){var a=e.stateNode;try{Xh(n,a)}catch(l){at(e,e.return,l)}}}function cv(e,n,a){a.props=si(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){at(e,n,l)}}function ir(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 uv(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 zd(e,n,a){try{var l=e.stateNode;dS(l,e.type,a,n),l[Vt]=n}catch(f){at(e,e.return,f)}}function dv(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&_a(e.type)||e.tag===4}function Ud(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dv(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 $d(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($d(e,n,a),e=e.sibling;e!==null;)$d(e,n,a),e=e.sibling}function Fl(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(Fl(e,n,a),e=e.sibling;e!==null;)Fl(e,n,a),e=e.sibling}function fv(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,Pd=!1,pv=typeof WeakSet=="function"?WeakSet:Set,qt=null;function qk(e,n){if(e=e.containerInfo,cf=pc,e=wh(e),Iu(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,w=-1,R=-1,q=0,W=0,ee=e,G=null;t:for(;;){for(var K;ee!==a||f!==0&&ee.nodeType!==3||(w=x+f),ee!==m||l!==0&&ee.nodeType!==3||(R=x+l),ee.nodeType===3&&(x+=ee.nodeValue.length),(K=ee.firstChild)!==null;)G=ee,ee=K;for(;;){if(ee===e)break t;if(G===a&&++q===f&&(w=x),G===m&&++W===l&&(R=x),(K=ee.nextSibling)!==null)break;ee=G,G=ee.parentNode}ee=K}a=w===-1||R===-1?null:{start:w,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(uf={focusedElem:e,selectionRange:a},pc=!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)pf(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":pf(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 mv(e,n,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:Bs(e,a),l&4&&ar(5,a);break;case 1:if(Bs(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&&lv(a),l&512&&ir(a,a.return);break;case 3:if(Bs(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{Xh(e,n)}catch(x){at(a,a.return,x)}}break;case 27:n===null&&l&4&&fv(a);case 26:case 5:Bs(e,a),n===null&&l&4&&uv(a),l&512&&ir(a,a.return);break;case 12:Bs(e,a);break;case 31:Bs(e,a),l&4&&vv(e,a);break;case 13:Bs(e,a),l&4&&yv(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Qk.bind(null,a),bS(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):Bs(e,a),Os=f,zt=m}break;case 30:break;default:Bs(e,a)}}function hv(e){var n=e.alternate;n!==null&&(e.alternate=null,hv(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&vu(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 Ls(e,n,a){for(a=a.child;a!==null;)gv(e,n,a),a=a.sibling}function gv(e,n,a){if(Qt&&typeof Qt.onCommitFiberUnmount=="function")try{Qt.onCommitFiberUnmount(na,a)}catch{}switch(a.tag){case 26:zt||ms(a,n),Ls(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),Ls(e,n,a),mr(a.stateNode),xt=l,dn=f;break;case 5:zt||ms(a,n);case 6:if(l=xt,f=dn,xt=null,Ls(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,l0(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),uo(e)):l0(xt,a.stateNode));break;case 4:l=xt,f=dn,xt=a.stateNode.containerInfo,dn=!0,Ls(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),Ls(e,n,a);break;case 1:zt||(ms(a,n),l=a.stateNode,typeof l.componentWillUnmount=="function"&&cv(a,n,l)),Ls(e,n,a);break;case 21:Ls(e,n,a);break;case 22:zt=(l=zt)||a.memoizedState!==null,Ls(e,n,a),zt=l;break;default:Ls(e,n,a)}}function vv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{uo(e)}catch(a){at(n,n.return,a)}}}function yv(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{uo(e)}catch(a){at(n,n.return,a)}}function Gk(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new pv),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new pv),n;default:throw Error(o(435,e.tag))}}function Zl(e,n){var a=Gk(e);n.forEach(function(l){if(!a.has(l)){a.add(l);var f=eS.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,w=x;e:for(;w!==null;){switch(w.tag){case 27:if(_a(w.type)){xt=w.stateNode,dn=!1;break e}break;case 5:xt=w.stateNode,dn=!1;break e;case 3:case 4:xt=w.stateNode.containerInfo,dn=!0;break e}w=w.return}if(xt===null)throw Error(o(160));gv(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;)bv(n,e),n=n.sibling}var Wn=null;function bv(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),ar(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[Ro]||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=b0("link","href",f).get(l+(a.href||""));if(x){for(var w=0;w<x.length;w++)if(m=x[w],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(w,1);break t}}m=f.createElement(l),Jt(m,l,a),f.head.appendChild(m);break;case"meta":if(x=b0("meta","content",f).get(l+(a.content||""))){for(w=0;w<x.length;w++)if(m=x[w],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(w,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 _0(f,e.type,e.stateNode);else e.stateNode=y0(f,l,e.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?_0(f,e.type,e.stateNode):y0(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&zd(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&&zd(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{Mi(f,"")}catch(he){at(e,e.return,he)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,zd(e,f,a!==null?a.memoizedProps:f)),l&1024&&(Pd=!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(cc=null,f=Wn,Wn=rc(n.containerInfo),fn(n,e),Wn=f,pn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{uo(n.containerInfo)}catch(he){at(e,e.return,he)}Pd&&(Pd=!1,_v(e));break;case 4:l=Wn,Wn=rc(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,Zl(e,l)));break;case 13:fn(n,e),pn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Yl=Ce()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Zl(e,l)));break;case 22:f=e.memoizedState!==null;var R=a!==null&&a.memoizedState!==null,q=Os,W=zt;if(Os=q||f,zt=W||R,fn(n,e),zt=W,Os=q,pn(e),l&8192)e:for(n=e.stateNode,n._visibility=f?n._visibility&-2:n._visibility|1,f&&(a===null||R||Os||zt||ai(e)),a=null,n=e;;){if(n.tag===5||n.tag===26){if(a===null){R=a=n;try{if(m=R.stateNode,f)x=m.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{w=R.stateNode;var ee=R.memoizedProps.style,G=ee!=null&&ee.hasOwnProperty("display")?ee.display:null;w.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(he){at(R,R.return,he)}}}else if(n.tag===6){if(a===null){R=n;try{R.stateNode.nodeValue=f?"":R.memoizedProps}catch(he){at(R,R.return,he)}}}else if(n.tag===18){if(a===null){R=n;try{var K=R.stateNode;f?c0(K,!0):c0(R.stateNode,!1)}catch(he){at(R,R.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,Zl(e,a))));break;case 19:fn(n,e),pn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Zl(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(dv(l)){a=l;break}l=l.return}if(a==null)throw Error(o(160));switch(a.tag){case 27:var f=a.stateNode,m=Ud(e);Fl(e,m,f);break;case 5:var x=a.stateNode;a.flags&32&&(Mi(x,""),a.flags&=-33);var w=Ud(e);Fl(e,w,x);break;case 3:case 4:var R=a.stateNode.containerInfo,q=Ud(e);$d(e,q,R);break;default:throw Error(o(161))}}catch(W){at(e,e.return,W)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function _v(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;_v(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function Bs(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)mv(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"&&cv(n,n.return,a),ai(n);break;case 27:mr(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),ar(4,m);break;case 1:if(zs(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(q){at(l,l.return,q)}if(l=m,f=l.updateQueue,f!==null){var w=l.stateNode;try{var R=f.shared.hiddenCallbacks;if(R!==null)for(f.shared.hiddenCallbacks=null,f=0;f<R.length;f++)Wh(R[f],w)}catch(q){at(l,l.return,q)}}a&&x&64&&lv(m),ir(m,m.return);break;case 27:fv(m);case 26:case 5:zs(f,m,a),a&&l===null&&x&4&&uv(m),ir(m,m.return);break;case 12:zs(f,m,a);break;case 31:zs(f,m,a),a&&x&4&&vv(f,m);break;case 13:zs(f,m,a),a&&x&4&&yv(f,m);break;case 22:m.memoizedState===null&&zs(f,m,a),ir(m,m.return);break;case 30:break;default:zs(f,m,a)}n=n.sibling}}function Vd(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&&Go(a))}function Hd(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&Go(e))}function Xn(e,n,a,l){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)xv(e,n,a,l),n=n.sibling}function xv(e,n,a,l){var f=n.flags;switch(n.tag){case 0:case 11:case 15:Xn(e,n,a,l),f&2048&&ar(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&&Go(e)));break;case 12:if(f&2048){Xn(e,n,a,l),e=n.stateNode;try{var m=n.memoizedProps,x=m.id,w=m.onPostCommit;typeof w=="function"&&w(x,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){at(n,n.return,R)}}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):or(e,n):m._visibility&2?Xn(e,n,a,l):(m._visibility|=2,Qi(e,n,a,l,(n.subtreeFlags&10256)!==0||!1)),f&2048&&Vd(x,n);break;case 24:Xn(e,n,a,l),f&2048&&Hd(n.alternate,n);break;default:Xn(e,n,a,l)}}function Qi(e,n,a,l,f){for(f=f&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,x=n,w=a,R=l,q=x.flags;switch(x.tag){case 0:case 11:case 15:Qi(m,x,w,R,f),ar(8,x);break;case 23:break;case 22:var W=x.stateNode;x.memoizedState!==null?W._visibility&2?Qi(m,x,w,R,f):or(m,x):(W._visibility|=2,Qi(m,x,w,R,f)),f&&q&2048&&Vd(x.alternate,x);break;case 24:Qi(m,x,w,R,f),f&&q&2048&&Hd(x.alternate,x);break;default:Qi(m,x,w,R,f)}n=n.sibling}}function or(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:or(a,l),f&2048&&Vd(l.alternate,l);break;case 24:or(a,l),f&2048&&Hd(l.alternate,l);break;default:or(a,l)}n=n.sibling}}var rr=8192;function eo(e,n,a){if(e.subtreeFlags&rr)for(e=e.child;e!==null;)kv(e,n,a),e=e.sibling}function kv(e,n,a){switch(e.tag){case 26:eo(e,n,a),e.flags&rr&&e.memoizedState!==null&&DS(a,Wn,e.memoizedState,e.memoizedProps);break;case 5:eo(e,n,a);break;case 3:case 4:var l=Wn;Wn=rc(e.stateNode.containerInfo),eo(e,n,a),Wn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=rr,rr=16777216,eo(e,n,a),rr=l):eo(e,n,a));break;default:eo(e,n,a)}}function Sv(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 lr(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,wv(l,e)}Sv(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Tv(e),e=e.sibling}function Tv(e){switch(e.tag){case 0:case 11:case 15:lr(e),e.flags&2048&&pa(9,e,e.return);break;case 3:lr(e);break;case 12:lr(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,Kl(e)):lr(e);break;default:lr(e)}}function Kl(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,wv(l,e)}Sv(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:pa(8,n,n.return),Kl(n);break;case 22:a=n.stateNode,a._visibility&2&&(a._visibility&=-3,Kl(n));break;default:Kl(n)}e=e.sibling}}function wv(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:Go(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(hv(l),l===a){qt=null;break e}if(f!==null){f.return=m,qt=f;break e}qt=m}}}var Fk={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}},Zk=typeof WeakMap=="function"?WeakMap:Map,Qe=0,dt=null,Le=null,Ue=0,st=0,Sn=null,ma=!1,to=!1,qd=!1,Us=0,wt=0,ha=0,ii=0,Gd=0,Tn=0,no=0,cr=null,mn=null,Fd=!1,Yl=0,Nv=0,Jl=1/0,Wl=null,ga=null,$t=0,va=null,so=null,$s=0,Zd=0,Kd=null,jv=null,ur=0,Yd=null;function wn(){return(Qe&2)!==0&&Ue!==0?Ue&-Ue:L.T!==null?tf():Ft()}function Cv(){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)&&(ao(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 Ev(e,n,a){if((Qe&6)!==0)throw Error(o(327));var l=!a&&(n&127)===0&&(n&e.expiredLanes)===0||ne(e,n),f=l?Jk(e,n):Wd(e,n,!0),m=l;do{if(f===0){to&&!l&&ya(e,n,0,!1);break}else{if(a=e.current.alternate,m&&!Kk(a)){f=Wd(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 w=e;f=cr;var R=w.current.memoizedState.isDehydrated;if(R&&(ao(w,x).flags|=256),x=Wd(w,x,!1),x!==2){if(qd&&!R){w.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){ao(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=Yl+300-Ce(),10<f)){if(ya(l,n,Tn,!ma),V(l,0,!0)!==0)break e;$s=n,l.timeoutHandle=o0(Av.bind(null,l,a,mn,Wl,Fd,n,Tn,ii,no,ma,m,"Throttled",-0,0),f);break e}Av(l,a,mn,Wl,Fd,n,Tn,ii,no,ma,m,null,-0,0)}}break}while(!0);hs(e)}function Av(e,n,a,l,f,m,x,w,R,q,W,ee,G,K){if(e.timeoutHandle=-1,ee=n.subtreeFlags,ee&8192||(ee&16785408)===16785408){ee={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ws},kv(n,m,ee);var he=(m&62914560)===m?Yl-Ce():(m&4194048)===m?Nv-Ce():0;if(he=RS(ee,he),he!==null){$s=m,e.cancelPendingCommit=he(zv.bind(null,e,n,m,a,l,f,x,w,R,W,ee,null,G,K)),ya(e,m,x,!q);return}}zv(e,n,m,a,l,f,x,w,R)}function Kk(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&=~Gd,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 Xl(){return(Qe&6)===0?(dr(0),!1):!0}function Jd(){if(Le!==null){if(st===0)var e=Le.return;else e=Le,Es=Ja=null,fd(e),Ki=null,Zo=0,e=Le;for(;e!==null;)rv(e.alternate,e),e=e.return;Le=null}}function ao(e,n){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,mS(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),$s=0,Jd(),dt=e,Le=a=js(e.current,null),Ue=n,st=0,Sn=null,ma=!1,to=ne(e,n),qd=!1,no=Tn=Gd=ii=ha=wt=0,mn=cr=null,Fd=!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,bl(),a}function Dv(e,n){De=null,L.H=tr,n===Zi||n===jl?(n=Zh(),st=3):n===ed?(n=Zh(),st=4):st=n===Cd?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,Sn=n,Le===null&&(wt=1,Pl(e,In(n,e.current)))}function Rv(){var e=xn.current;return e===null?!0:(Ue&4194048)===Ue?zn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?e===zn:!1}function Mv(){var e=L.H;return L.H=tr,e===null?tr:e}function Iv(){var e=L.A;return L.A=Fk,e}function Ql(){wt=4,ma||(Ue&4194048)!==Ue&&xn.current!==null||(to=!0),(ha&134217727)===0&&(ii&134217727)===0||dt===null||ya(dt,Ue,Tn,!1)}function Wd(e,n,a){var l=Qe;Qe|=2;var f=Mv(),m=Iv();(dt!==e||Ue!==n)&&(Wl=null,ao(e,n)),n=!1;var x=wt;e:do try{if(st!==0&&Le!==null){var w=Le,R=Sn;switch(st){case 8:Jd(),x=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(n=!0);var q=st;if(st=0,Sn=null,io(e,w,R,q),a&&to){x=0;break e}break;default:q=st,st=0,Sn=null,io(e,w,R,q)}}Yk(),x=wt;break}catch(W){Dv(e,W)}while(!0);return n&&e.shellSuspendCounter++,Es=Ja=null,Qe=l,L.H=f,L.A=m,Le===null&&(dt=null,Ue=0,bl()),x}function Yk(){for(;Le!==null;)Ov(Le)}function Jk(e,n){var a=Qe;Qe|=2;var l=Mv(),f=Iv();dt!==e||Ue!==n?(Wl=null,Jl=Ce()+500,ao(e,n)):to=ne(e,n);e:do try{if(st!==0&&Le!==null){n=Le;var m=Sn;t:switch(st){case 1:st=0,Sn=null,io(e,n,m,1);break;case 2:case 9:if(Gh(m)){st=0,Sn=null,Lv(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:Gh(m)?(st=0,Sn=null,Lv(n)):(st=0,Sn=null,io(e,n,m,7));break;case 5:var x=null;switch(Le.tag){case 26:x=Le.memoizedState;case 5:case 27:var w=Le;if(x?x0(x):w.stateNode.complete){st=0,Sn=null;var R=w.sibling;if(R!==null)Le=R;else{var q=w.return;q!==null?(Le=q,ec(q)):Le=null}break t}}st=0,Sn=null,io(e,n,m,5);break;case 6:st=0,Sn=null,io(e,n,m,6);break;case 8:Jd(),wt=6;break e;default:throw Error(o(462))}}Wk();break}catch(W){Dv(e,W)}while(!0);return Es=Ja=null,L.H=l,L.A=f,Qe=a,Le!==null?0:(dt=null,Ue=0,bl(),wt)}function Wk(){for(;Le!==null&&!Kn();)Ov(Le)}function Ov(e){var n=iv(e.alternate,e,Us);e.memoizedProps=e.pendingProps,n===null?ec(e):Le=n}function Lv(e){var n=e,a=n.alternate;switch(n.tag){case 15:case 0:n=Qg(a,n,n.pendingProps,n.type,void 0,Ue);break;case 11:n=Qg(a,n,n.pendingProps,n.type.render,n.ref,Ue);break;case 5:fd(n);default:rv(a,n),n=Le=Ih(n,Us),n=iv(a,n,Us)}e.memoizedProps=e.pendingProps,n===null?ec(e):Le=n}function io(e,n,a,l){Es=Ja=null,fd(n),Ki=null,Zo=0;var f=n.return;try{if(Uk(e,f,n,a,Ue)){wt=1,Pl(e,In(a,e.current)),Le=null;return}}catch(m){if(f!==null)throw Le=f,m;wt=1,Pl(e,In(a,e.current)),Le=null;return}n.flags&32768?(Pe||l===1?e=!0:to||(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)):ec(n)}function ec(e){var n=e;do{if((n.flags&32768)!==0){Bv(n,ma);return}e=n.return;var a=Vk(n.alternate,n,Us);if(a!==null){Le=a;return}if(n=n.sibling,n!==null){Le=n;return}Le=n=e}while(n!==null);wt===0&&(wt=5)}function Bv(e,n){do{var a=Hk(e.alternate,e);if(a!==null){a.flags&=32767,Le=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!n&&(e=e.sibling,e!==null)){Le=e;return}Le=e=a}while(e!==null);wt=6,Le=null}function zv(e,n,a,l,f,m,x,w,R){e.cancelPendingCommit=null;do tc();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|=Uu,ye(e,a,m,x,w,R),e===dt&&(Le=dt=null,Ue=0),so=n,va=e,$s=a,Zd=m,Kd=f,jv=l,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,tS(ds,function(){return Hv(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||l){l=L.T,L.T=null,f=Z.p,Z.p=2,x=Qe,Qe|=4;try{qk(e,n,a)}finally{Qe=x,Z.p=f,L.T=l}}$t=1,Uv(),$v(),Pv()}}function Uv(){if($t===1){$t=0;var e=va,n=so,a=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||a){a=L.T,L.T=null;var l=Z.p;Z.p=2;var f=Qe;Qe|=4;try{bv(n,e);var m=uf,x=wh(e.containerInfo),w=m.focusedElem,R=m.selectionRange;if(x!==w&&w&&w.ownerDocument&&Th(w.ownerDocument.documentElement,w)){if(R!==null&&Iu(w)){var q=R.start,W=R.end;if(W===void 0&&(W=q),"selectionStart"in w)w.selectionStart=q,w.selectionEnd=Math.min(W,w.value.length);else{var ee=w.ownerDocument||document,G=ee&&ee.defaultView||window;if(G.getSelection){var K=G.getSelection(),he=w.textContent.length,ke=Math.min(R.start,he),lt=R.end===void 0?ke:Math.min(R.end,he);!K.extend&&ke>lt&&(x=lt,lt=ke,ke=x);var $=Sh(w,ke),O=Sh(w,lt);if($&&O&&(K.rangeCount!==1||K.anchorNode!==$.node||K.anchorOffset!==$.offset||K.focusNode!==O.node||K.focusOffset!==O.offset)){var H=ee.createRange();H.setStart($.node,$.offset),K.removeAllRanges(),ke>lt?(K.addRange(H),K.extend(O.node,O.offset)):(H.setEnd(O.node,O.offset),K.addRange(H))}}}}for(ee=[],K=w;K=K.parentNode;)K.nodeType===1&&ee.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<ee.length;w++){var Q=ee[w];Q.element.scrollLeft=Q.left,Q.element.scrollTop=Q.top}}pc=!!cf,uf=cf=null}finally{Qe=f,Z.p=l,L.T=a}}e.current=n,$t=2}}function $v(){if($t===2){$t=0;var e=va,n=so,a=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||a){a=L.T,L.T=null;var l=Z.p;Z.p=2;var f=Qe;Qe|=4;try{mv(e,n.alternate,n)}finally{Qe=f,Z.p=l,L.T=a}}$t=3}}function Pv(){if($t===4||$t===3){$t=0,Ne();var e=va,n=so,a=$s,l=jv;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?$t=5:($t=0,so=va=null,Vv(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=L.T,f=Z.p,Z.p=2,L.T=null;try{for(var m=e.onRecoverableError,x=0;x<l.length;x++){var w=l[x];m(w.value,{componentStack:w.stack})}}finally{L.T=n,Z.p=f}}($s&3)!==0&&tc(),hs(e),f=e.pendingLanes,(a&261930)!==0&&(f&42)!==0?e===Yd?ur++:(ur=0,Yd=e):ur=0,dr(0)}}function Vv(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,Go(n)))}function tc(){return Uv(),$v(),Pv(),Hv()}function Hv(){if($t!==5)return!1;var e=va,n=Zd;Zd=0;var a=Ut($s),l=L.T,f=Z.p;try{Z.p=32>a?32:a,L.T=null,a=Kd,Kd=null;var m=va,x=$s;if($t=0,so=va=null,$s=0,(Qe&6)!==0)throw Error(o(331));var w=Qe;if(Qe|=4,Tv(m.current),xv(m,m.current,x,a),Qe=w,dr(0,!1),Qt&&typeof Qt.onPostCommitFiberRoot=="function")try{Qt.onPostCommitFiberRoot(na,m)}catch{}return!0}finally{Z.p=f,L.T=l,Vv(e,n)}}function qv(e,n,a){n=In(a,n),n=jd(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)qv(e,e,a);else for(;n!==null;){if(n.tag===3){qv(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=Gg(2),l=ua(n,a,2),l!==null&&(Fg(a,l,n,e),ze(l,2),hs(l));break}}n=n.return}}function Xd(e,n,a){var l=e.pingCache;if(l===null){l=e.pingCache=new Zk;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)||(qd=!0,f.add(a),e=Xk.bind(null,e,n,a),n.then(e,e))}function Xk(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()-Yl?(Qe&2)===0&&ao(e,0):Gd|=a,no===Ue&&(no=0)),hs(e)}function Gv(e,n){n===0&&(n=ue()),e=Za(e,n),e!==null&&(ze(e,n),hs(e))}function Qk(e){var n=e.memoizedState,a=0;n!==null&&(a=n.retryLane),Gv(e,a)}function eS(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),Gv(e,a)}function tS(e,n){return us(e,n)}var nc=null,oo=null,Qd=!1,sc=!1,ef=!1,ba=0;function hs(e){e!==oo&&e.next===null&&(oo===null?nc=oo=e:oo=oo.next=e),sc=!0,Qd||(Qd=!0,sS())}function dr(e,n){if(!ef&&sc){ef=!0;do for(var a=!1,l=nc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var x=l.suspendedLanes,w=l.pingedLanes;m=(1<<31-en(42|e)+1)-1,m&=f&~(x&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,Yv(l,m))}else m=Ue,m=V(l,l===dt?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||ne(l,m)||(a=!0,Yv(l,m));l=l.next}while(a);ef=!1}}function nS(){Fv()}function Fv(){sc=Qd=!1;var e=0;ba!==0&&pS()&&(e=ba);for(var n=Ce(),a=null,l=nc;l!==null;){var f=l.next,m=Zv(l,n);m===0?(l.next=null,a===null?nc=f:a.next=f,f===null&&(oo=a)):(a=l,(e!==0||(m&3)!==0)&&(sc=!0)),l=f}$t!==0&&$t!==5||dr(e),ba!==0&&(ba=0)}function Zv(e,n){for(var a=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var x=31-en(m),w=1<<x,R=f[x];R===-1?((w&a)===0||(w&l)!==0)&&(f[x]=oe(w,n)):R<=n&&(e.expiredLanes|=w),m&=~w}if(n=dt,a=Ue,a=V(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||ne(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=Kv.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 Kv(e,n){if($t!==0&&$t!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(tc()&&e.callbackNode!==a)return null;var l=Ue;return l=V(e,e===dt?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Ev(e,l,n),Zv(e,Ce()),e.callbackNode!=null&&e.callbackNode===a?Kv.bind(null,e):null)}function Yv(e,n){if(tc())return null;Ev(e,n,!0)}function sS(){hS(function(){(Qe&6)!==0?us(yn,nS):Fv()})}function tf(){if(ba===0){var e=Gi;e===0&&(e=$a,$a<<=1,($a&261888)===0&&($a=256)),ba=e}return ba}function Jv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:dl(""+e)}function Wv(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 aS(e,n,a,l,f){if(n==="submit"&&a&&a.stateNode===f){var m=Jv((f[Vt]||null).action),x=l.submitter;x&&(n=(n=x[Vt]||null)?Jv(n.formAction):x.getAttribute("formAction"),n!==null&&(m=n,x=null));var w=new hl("action","action",null,l,f);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ba!==0){var R=x?Wv(f,x):new FormData(f);xd(a,{pending:!0,data:R,method:f.method,action:m},null,R)}}else typeof m=="function"&&(w.preventDefault(),R=x?Wv(f,x):new FormData(f),xd(a,{pending:!0,data:R,method:f.method,action:m},m,R))},currentTarget:f}]})}}for(var nf=0;nf<zu.length;nf++){var sf=zu[nf],iS=sf.toLowerCase(),oS=sf[0].toUpperCase()+sf.slice(1);Jn(iS,"on"+oS)}Jn(Ch,"onAnimationEnd"),Jn(Eh,"onAnimationIteration"),Jn(Ah,"onAnimationStart"),Jn("dblclick","onDoubleClick"),Jn("focusin","onFocus"),Jn("focusout","onBlur"),Jn(kk,"onTransitionRun"),Jn(Sk,"onTransitionStart"),Jn(Tk,"onTransitionCancel"),Jn(Dh,"onTransitionEnd"),Di("onMouseEnter",["mouseout","mouseover"]),Di("onMouseLeave",["mouseout","mouseover"]),Di("onPointerEnter",["pointerout","pointerover"]),Di("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 fr="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(" "),rS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fr));function Xv(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 w=l[x],R=w.instance,q=w.currentTarget;if(w=w.listener,R!==m&&f.isPropagationStopped())break e;m=w,f.currentTarget=q;try{m(f)}catch(W){yl(W)}f.currentTarget=null,m=R}else for(x=0;x<l.length;x++){if(w=l[x],R=w.instance,q=w.currentTarget,w=w.listener,R!==m&&f.isPropagationStopped())break e;m=w,f.currentTarget=q;try{m(f)}catch(W){yl(W)}f.currentTarget=null,m=R}}}}function Be(e,n){var a=n[gu];a===void 0&&(a=n[gu]=new Set);var l=e+"__bubble";a.has(l)||(Qv(n,e,2,!1),a.add(l))}function af(e,n,a){var l=0;n&&(l|=4),Qv(a,e,l,n)}var ac="_reactListening"+Math.random().toString(36).slice(2);function of(e){if(!e[ac]){e[ac]=!0,Fm.forEach(function(a){a!=="selectionchange"&&(rS.has(a)||af(a,!1,e),af(a,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[ac]||(n[ac]=!0,af("selectionchange",!1,n))}}function Qv(e,n,a,l){switch(C0(n)){case 2:var f=OS;break;case 8:f=LS;break;default:f=xf}a=f.bind(null,n,a,e),f=void 0,!wu||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 rf(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 w=l.stateNode.containerInfo;if(w===f)break;if(x===4)for(x=l.return;x!==null;){var R=x.tag;if((R===3||R===4)&&x.stateNode.containerInfo===f)return;x=x.return}for(;w!==null;){if(x=Ci(w),x===null)return;if(R=x.tag,R===5||R===6||R===26||R===27){l=m=x;continue e}w=w.parentNode}}l=l.return}ah(function(){var q=m,W=Su(a),ee=[];e:{var G=Rh.get(e);if(G!==void 0){var K=hl,he=e;switch(e){case"keypress":if(pl(a)===0)break e;case"keydown":case"keyup":K=ek;break;case"focusin":he="focus",K=Eu;break;case"focusout":he="blur",K=Eu;break;case"beforeblur":case"afterblur":K=Eu;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=rh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=Vx;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=sk;break;case Ch:case Eh:case Ah:K=Gx;break;case Dh:K=ik;break;case"scroll":case"scrollend":K=$x;break;case"wheel":K=rk;break;case"copy":case"cut":case"paste":K=Zx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=ch;break;case"toggle":case"beforetoggle":K=ck}var ke=(n&4)!==0,lt=!ke&&(e==="scroll"||e==="scrollend"),$=ke?G!==null?G+"Capture":null:G;ke=[];for(var O=q,H;O!==null;){var Q=O;if(H=Q.stateNode,Q=Q.tag,Q!==5&&Q!==26&&Q!==27||H===null||$===null||(Q=Io(O,$),Q!=null&&ke.push(pr(O,Q,H))),lt)break;O=O.return}0<ke.length&&(G=new K(G,he,null,a,W),ee.push({event:G,listeners:ke}))}}if((n&7)===0){e:{if(G=e==="mouseover"||e==="pointerover",K=e==="mouseout"||e==="pointerout",G&&a!==ku&&(he=a.relatedTarget||a.fromElement)&&(Ci(he)||he[ji]))break e;if((K||G)&&(G=W.window===W?W:(G=W.ownerDocument)?G.defaultView||G.parentWindow:window,K?(he=a.relatedTarget||a.toElement,K=q,he=he?Ci(he):null,he!==null&&(lt=u(he),ke=he.tag,he!==lt||ke!==5&&ke!==27&&ke!==6)&&(he=null)):(K=null,he=q),K!==he)){if(ke=rh,Q="onMouseLeave",$="onMouseEnter",O="mouse",(e==="pointerout"||e==="pointerover")&&(ke=ch,Q="onPointerLeave",$="onPointerEnter",O="pointer"),lt=K==null?G:Mo(K),H=he==null?G:Mo(he),G=new ke(Q,O+"leave",K,a,W),G.target=lt,G.relatedTarget=H,Q=null,Ci(W)===q&&(ke=new ke($,O+"enter",he,a,W),ke.target=H,ke.relatedTarget=lt,Q=ke),lt=Q,K&&he)t:{for(ke=lS,$=K,O=he,H=0,Q=$;Q;Q=ke(Q))H++;Q=0;for(var be=O;be;be=ke(be))Q++;for(;0<H-Q;)$=ke($),H--;for(;0<Q-H;)O=ke(O),Q--;for(;H--;){if($===O||O!==null&&$===O.alternate){ke=$;break t}$=ke($),O=ke(O)}ke=null}else ke=null;K!==null&&e0(ee,G,K,ke,!1),he!==null&&lt!==null&&e0(ee,lt,he,ke,!0)}}e:{if(G=q?Mo(q):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var Ye=vh;else if(hh(G))if(yh)Ye=bk;else{Ye=vk;var ge=gk}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?q&&xu(q.elementType)&&(Ye=vh):Ye=yk;if(Ye&&(Ye=Ye(e,q))){gh(ee,Ye,a,W);break e}ge&&ge(e,G,q),e==="focusout"&&q&&G.type==="number"&&q.memoizedProps.value!=null&&_u(G,"number",G.value)}switch(ge=q?Mo(q):window,e){case"focusin":(hh(ge)||ge.contentEditable==="true")&&(Bi=ge,Ou=q,Vo=null);break;case"focusout":Vo=Ou=Bi=null;break;case"mousedown":Lu=!0;break;case"contextmenu":case"mouseup":case"dragend":Lu=!1,Nh(ee,a,W);break;case"selectionchange":if(xk)break;case"keydown":case"keyup":Nh(ee,a,W)}var Re;if(Du)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 Li?ph(e,a)&&($e="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&($e="onCompositionStart");$e&&(uh&&a.locale!=="ko"&&(Li||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Li&&(Re=ih()):(sa=W,Nu="value"in sa?sa.value:sa.textContent,Li=!0)),ge=ic(q,$e),0<ge.length&&($e=new lh($e,e,null,a,W),ee.push({event:$e,listeners:ge}),Re?$e.data=Re:(Re=mh(a),Re!==null&&($e.data=Re)))),(Re=dk?fk(e,a):pk(e,a))&&($e=ic(q,"onBeforeInput"),0<$e.length&&(ge=new lh("onBeforeInput","beforeinput",null,a,W),ee.push({event:ge,listeners:$e}),ge.data=Re)),aS(ee,e,q,a,W)}Xv(ee,n)})}function pr(e,n,a){return{instance:e,listener:n,currentTarget:a}}function ic(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=Io(e,a),f!=null&&l.unshift(pr(e,f,m)),f=Io(e,n),f!=null&&l.push(pr(e,f,m))),e.tag===3)return l;e=e.return}return[]}function lS(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function e0(e,n,a,l,f){for(var m=n._reactName,x=[];a!==null&&a!==l;){var w=a,R=w.alternate,q=w.stateNode;if(w=w.tag,R!==null&&R===l)break;w!==5&&w!==26&&w!==27||q===null||(R=q,f?(q=Io(a,m),q!=null&&x.unshift(pr(a,q,R))):f||(q=Io(a,m),q!=null&&x.push(pr(a,q,R)))),a=a.return}x.length!==0&&e.push({event:n,listeners:x})}var cS=/\r\n?/g,uS=/\u0000|\uFFFD/g;function t0(e){return(typeof e=="string"?e:""+e).replace(cS,`
26
- `).replace(uS,"")}function n0(e,n){return n=t0(n),t0(e)===n}function rt(e,n,a,l,f,m){switch(a){case"children":typeof l=="string"?n==="body"||n==="textarea"&&l===""||Mi(e,l):(typeof l=="number"||typeof l=="bigint")&&n!=="body"&&Mi(e,""+l);break;case"className":cl(e,"class",l);break;case"tabIndex":cl(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":cl(e,a,l);break;case"style":nh(e,l,m);break;case"data":if(n!=="object"){cl(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=dl(""+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=dl(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=ws);break;case"onScroll":l!=null&&Be("scroll",e);break;case"onScrollEnd":l!=null&&Be("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=dl(""+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":Be("beforetoggle",e),Be("toggle",e),ll(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":ll(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=zx.get(a)||a,ll(e,a,l))}}function lf(e,n,a,l,f,m){switch(a){case"style":nh(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"?Mi(e,l):(typeof l=="number"||typeof l=="bigint")&&Mi(e,""+l);break;case"onScroll":l!=null&&Be("scroll",e);break;case"onScrollEnd":l!=null&&Be("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(!Zm.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,""):ll(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":Be("error",e),Be("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":Be("invalid",e);var w=m=x=f=null,R=null,q=null;for(l in a)if(a.hasOwnProperty(l)){var W=a[l];if(W!=null)switch(l){case"name":f=W;break;case"type":x=W;break;case"checked":R=W;break;case"defaultChecked":q=W;break;case"value":m=W;break;case"defaultValue":w=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(o(137,n));break;default:rt(e,n,l,W,a,null)}}Xm(e,m,w,R,q,x,f,!1);return;case"select":Be("invalid",e),l=x=m=null;for(f in a)if(a.hasOwnProperty(f)&&(w=a[f],w!=null))switch(f){case"value":m=w;break;case"defaultValue":x=w;break;case"multiple":l=w;default:rt(e,n,f,w,a,null)}n=m,a=x,e.multiple=!!l,n!=null?Ri(e,!!l,n,!1):a!=null&&Ri(e,!!l,a,!0);return;case"textarea":Be("invalid",e),m=f=l=null;for(x in a)if(a.hasOwnProperty(x)&&(w=a[x],w!=null))switch(x){case"value":l=w;break;case"defaultValue":f=w;break;case"children":m=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(o(91));break;default:rt(e,n,x,w,a,null)}eh(e,l,f,m);return;case"option":for(R in a)if(a.hasOwnProperty(R)&&(l=a[R],l!=null))switch(R){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:rt(e,n,R,l,a,null)}return;case"dialog":Be("beforetoggle",e),Be("toggle",e),Be("cancel",e),Be("close",e);break;case"iframe":case"object":Be("load",e);break;case"video":case"audio":for(l=0;l<fr.length;l++)Be(fr[l],e);break;case"image":Be("error",e),Be("load",e);break;case"details":Be("toggle",e);break;case"embed":case"source":case"link":Be("error",e),Be("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(q in a)if(a.hasOwnProperty(q)&&(l=a[q],l!=null))switch(q){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,n));default:rt(e,n,q,l,a,null)}return;default:if(xu(n)){for(W in a)a.hasOwnProperty(W)&&(l=a[W],l!==void 0&&lf(e,n,W,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&rt(e,n,w,l,a,null))}function dS(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,w=null,R=null,q=null,W=null;for(K in a){var ee=a[K];if(a.hasOwnProperty(K)&&ee!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":R=ee;default:l.hasOwnProperty(K)||rt(e,n,K,null,l,ee)}}for(var G in l){var K=l[G];if(ee=a[G],l.hasOwnProperty(G)&&(K!=null||ee!=null))switch(G){case"type":m=K;break;case"name":f=K;break;case"checked":q=K;break;case"defaultChecked":W=K;break;case"value":x=K;break;case"defaultValue":w=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(o(137,n));break;default:K!==ee&&rt(e,n,G,K,l,ee)}}bu(e,x,w,R,q,W,m,f);return;case"select":K=x=w=G=null;for(m in a)if(R=a[m],a.hasOwnProperty(m)&&R!=null)switch(m){case"value":break;case"multiple":K=R;default:l.hasOwnProperty(m)||rt(e,n,m,null,l,R)}for(f in l)if(m=l[f],R=a[f],l.hasOwnProperty(f)&&(m!=null||R!=null))switch(f){case"value":G=m;break;case"defaultValue":w=m;break;case"multiple":x=m;default:m!==R&&rt(e,n,f,m,l,R)}n=w,a=x,l=K,G!=null?Ri(e,!!a,G,!1):!!l!=!!a&&(n!=null?Ri(e,!!a,n,!0):Ri(e,!!a,a?[]:"",!1));return;case"textarea":K=G=null;for(w in a)if(f=a[w],a.hasOwnProperty(w)&&f!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:rt(e,n,w,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":G=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)}Qm(e,G,K);return;case"option":for(var he in a)if(G=a[he],a.hasOwnProperty(he)&&G!=null&&!l.hasOwnProperty(he))switch(he){case"selected":e.selected=!1;break;default:rt(e,n,he,null,l,G)}for(R in l)if(G=l[R],K=a[R],l.hasOwnProperty(R)&&G!==K&&(G!=null||K!=null))switch(R){case"selected":e.selected=G&&typeof G!="function"&&typeof G!="symbol";break;default:rt(e,n,R,G,l,K)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ke in a)G=a[ke],a.hasOwnProperty(ke)&&G!=null&&!l.hasOwnProperty(ke)&&rt(e,n,ke,null,l,G);for(q in l)if(G=l[q],K=a[q],l.hasOwnProperty(q)&&G!==K&&(G!=null||K!=null))switch(q){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(o(137,n));break;default:rt(e,n,q,G,l,K)}return;default:if(xu(n)){for(var lt in a)G=a[lt],a.hasOwnProperty(lt)&&G!==void 0&&!l.hasOwnProperty(lt)&&lf(e,n,lt,void 0,l,G);for(W in l)G=l[W],K=a[W],!l.hasOwnProperty(W)||G===K||G===void 0&&K===void 0||lf(e,n,W,G,l,K);return}}for(var $ in a)G=a[$],a.hasOwnProperty($)&&G!=null&&!l.hasOwnProperty($)&&rt(e,n,$,null,l,G);for(ee in l)G=l[ee],K=a[ee],!l.hasOwnProperty(ee)||G===K||G==null&&K==null||rt(e,n,ee,G,l,K)}function s0(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fS(){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,w=f.duration;if(m&&w&&s0(x)){for(x=0,w=f.responseEnd,l+=1;l<a.length;l++){var R=a[l],q=R.startTime;if(q>w)break;var W=R.transferSize,ee=R.initiatorType;W&&s0(ee)&&(R=R.responseEnd,x+=W*(R<w?1:(w-q)/(R-q)))}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 cf=null,uf=null;function oc(e){return e.nodeType===9?e:e.ownerDocument}function a0(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 i0(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 df(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 ff=null;function pS(){var e=window.event;return e&&e.type==="popstate"?e===ff?!1:(ff=e,!0):(ff=null,!1)}var o0=typeof setTimeout=="function"?setTimeout:void 0,mS=typeof clearTimeout=="function"?clearTimeout:void 0,r0=typeof Promise=="function"?Promise:void 0,hS=typeof queueMicrotask=="function"?queueMicrotask:typeof r0<"u"?function(e){return r0.resolve(null).then(e).catch(gS)}:o0;function gS(e){setTimeout(function(){throw e})}function _a(e){return e==="head"}function l0(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),uo(n);return}l--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")l++;else if(a==="html")mr(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,mr(a);for(var m=a.firstChild;m;){var x=m.nextSibling,w=m.nodeName;m[Ro]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&m.rel.toLowerCase()==="stylesheet"||a.removeChild(m),m=x}}else a==="body"&&mr(e.ownerDocument.body);a=f}while(a);uo(n)}function c0(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 pf(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":pf(a),vu(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function vS(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[Ro])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 yS(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 u0(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 mf(e){return e.data==="$?"||e.data==="$~"}function hf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function bS(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 gf=null;function d0(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 f0(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 p0(e,n,a){switch(n=oc(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 mr(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);vu(e)}var $n=new Map,m0=new Set;function rc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ps=Z.d;Z.d={f:_S,r:xS,D:kS,C:SS,L:TS,m:wS,X:jS,S:NS,M:CS};function _S(){var e=Ps.f(),n=Xl();return e||n}function xS(e){var n=Ei(e);n!==null&&n.tag===5&&n.type==="form"?Dg(n):Ps.r(e)}var ro=typeof document>"u"?null:document;function h0(e,n,a){var l=ro;if(l&&typeof n=="string"&&n){var f=Rn(n);f='link[rel="'+e+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),m0.has(f)||(m0.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 kS(e){Ps.D(e),h0("dns-prefetch",e,null)}function SS(e,n){Ps.C(e,n),h0("preconnect",e,n)}function TS(e,n,a){Ps.L(e,n,a);var l=ro;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=lo(e);break;case"script":m=co(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(hr(m))||n==="script"&&l.querySelector(gr(m))||(n=l.createElement("link"),Jt(n,"link",e),Ht(n),l.head.appendChild(n)))}}function wS(e,n){Ps.m(e,n);var a=ro;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=co(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(gr(m)))return}l=a.createElement("link"),Jt(l,"link",e),Ht(l),a.head.appendChild(l)}}}function NS(e,n,a){Ps.S(e,n,a);var l=ro;if(l&&e){var f=Ai(l).hoistableStyles,m=lo(e);n=n||"default";var x=f.get(m);if(!x){var w={loading:0,preload:null};if(x=l.querySelector(hr(m)))w.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},a),(a=$n.get(m))&&vf(e,a);var R=x=l.createElement("link");Ht(R),Jt(R,"link",e),R._p=new Promise(function(q,W){R.onload=q,R.onerror=W}),R.addEventListener("load",function(){w.loading|=1}),R.addEventListener("error",function(){w.loading|=2}),w.loading|=4,lc(x,n,l)}x={type:"stylesheet",instance:x,count:1,state:w},f.set(m,x)}}}function jS(e,n){Ps.X(e,n);var a=ro;if(a&&e){var l=Ai(a).hoistableScripts,f=co(e),m=l.get(f);m||(m=a.querySelector(gr(f)),m||(e=y({src:e,async:!0},n),(n=$n.get(f))&&yf(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 CS(e,n){Ps.M(e,n);var a=ro;if(a&&e){var l=Ai(a).hoistableScripts,f=co(e),m=l.get(f);m||(m=a.querySelector(gr(f)),m||(e=y({src:e,async:!0,type:"module"},n),(n=$n.get(f))&&yf(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 g0(e,n,a,l){var f=(f=ve.current)?rc(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=lo(a.href),a=Ai(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=lo(a.href);var m=Ai(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(hr(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||ES(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=co(a),a=Ai(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 lo(e){return'href="'+Rn(e)+'"'}function hr(e){return'link[rel="stylesheet"]['+e+"]"}function v0(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function ES(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 co(e){return'[src="'+Rn(e)+'"]'}function gr(e){return"script[async]"+e}function y0(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),lc(l,a.precedence,e),n.instance=l;case"stylesheet":f=lo(a.href);var m=e.querySelector(hr(f));if(m)return n.state.loading|=4,n.instance=m,Ht(m),m;l=v0(a),(f=$n.get(f))&&vf(l,f),m=(e.ownerDocument||e).createElement("link"),Ht(m);var x=m;return x._p=new Promise(function(w,R){x.onload=w,x.onerror=R}),Jt(m,"link",l),n.state.loading|=4,lc(m,a.precedence,e),n.instance=m;case"script":return m=co(a.src),(f=e.querySelector(gr(m)))?(n.instance=f,Ht(f),f):(l=a,(f=$n.get(m))&&(l=y({},a),yf(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,lc(l,a.precedence,e));return n.instance}function lc(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 w=l[x];if(w.dataset.precedence===n)m=w;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 vf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function yf(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var cc=null;function b0(e,n,a){if(cc===null){var l=new Map,f=cc=new Map;f.set(a,l)}else f=cc,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[Ro]||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 w=l.get(x);w?w.push(m):l.set(x,[m])}}return l}function _0(e,n,a){e=e.ownerDocument||e,e.head.insertBefore(a,n==="title"?e.querySelector("head > title"):null)}function AS(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 x0(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function DS(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=lo(l.href),m=n.querySelector(hr(f));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=uc.bind(e),n.then(e,e)),a.state.loading|=4,a.instance=m,Ht(m);return}m=n.ownerDocument||n,l=v0(l),(f=$n.get(f))&&vf(l,f),m=m.createElement("link"),Ht(m);var x=m;x._p=new Promise(function(w,R){x.onload=w,x.onerror=R}),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=uc.bind(e),n.addEventListener("load",a),n.addEventListener("error",a))}}var bf=0;function RS(e,n){return e.stylesheets&&e.count===0&&fc(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var l=setTimeout(function(){if(e.stylesheets&&fc(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&bf===0&&(bf=62500*fS());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&fc(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>bf?50:800)+n);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function uc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fc(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var dc=null;function fc(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,dc=new Map,n.forEach(MS,e),dc=null,uc.call(e))}function MS(e,n){if(!(n.state.loading&4)){var a=dc.get(e);if(a)var l=a.get(null);else{a=new Map,dc.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=uc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),n.state.loading|=4}}var vr={$$typeof:E,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function IS(e,n,a,l,f,m,x,w,R){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=pe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pe(0),this.hiddenUpdates=pe(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function k0(e,n,a,l,f,m,x,w,R,q,W,ee){return e=new IS(e,n,a,x,R,q,W,ee,w),n=1,m===!0&&(n|=24),m=_n(3,null,null,n),e.current=m,m.stateNode=e,n=Wu(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:n},td(m),e}function S0(e){return e?(e=$i,e):$i}function T0(e,n,a,l,f,m){f=S0(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),Yo(a,e,n))}function w0(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<n?a:n}}function _f(e,n){w0(e,n),(e=e.alternate)&&w0(e,n)}function N0(e){if(e.tag===13||e.tag===31){var n=Za(e,67108864);n!==null&&hn(n,e,67108864),_f(e,67108864)}}function j0(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),_f(e,n)}}var pc=!0;function OS(e,n,a,l){var f=L.T;L.T=null;var m=Z.p;try{Z.p=2,xf(e,n,a,l)}finally{Z.p=m,L.T=f}}function LS(e,n,a,l){var f=L.T;L.T=null;var m=Z.p;try{Z.p=8,xf(e,n,a,l)}finally{Z.p=m,L.T=f}}function xf(e,n,a,l){if(pc){var f=kf(l);if(f===null)rf(e,n,l,mc,a),E0(e,l);else if(zS(f,e,n,a,l))l.stopPropagation();else if(E0(e,l),n&4&&-1<BS.indexOf(e)){for(;f!==null;){var m=Ei(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 w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;x;){var R=1<<31-en(x);w.entanglements[1]|=R,x&=~R}hs(m),(Qe&6)===0&&(Jl=Ce()+500,dr(0))}}break;case 31:case 13:w=Za(m,2),w!==null&&hn(w,m,2),Xl(),_f(m,2)}if(m=kf(l),m===null&&rf(e,n,l,mc,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else rf(e,n,l,null,a)}}function kf(e){return e=Su(e),Sf(e)}var mc=null;function Sf(e){if(mc=null,e=Ci(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 mc=e,null}function C0(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 wi:return 32;case Ua:return 268435456;default:return 32}default:return 32}}var Tf=!1,xa=null,ka=null,Sa=null,yr=new Map,br=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 E0(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":yr.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":br.delete(n.pointerId)}}function _r(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=Ei(n),n!==null&&N0(n)),e):(e.eventSystemFlags|=l,n=e.targetContainers,f!==null&&n.indexOf(f)===-1&&n.push(f),e)}function zS(e,n,a,l,f){switch(n){case"focusin":return xa=_r(xa,e,n,a,l,f),!0;case"dragenter":return ka=_r(ka,e,n,a,l,f),!0;case"mouseover":return Sa=_r(Sa,e,n,a,l,f),!0;case"pointerover":var m=f.pointerId;return yr.set(m,_r(yr.get(m)||null,e,n,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,br.set(m,_r(br.get(m)||null,e,n,a,l,f)),!0}return!1}function A0(e){var n=Ci(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(){j0(a)});return}}else if(n===31){if(n=p(a),n!==null){e.blockedOn=n,Et(e.priority,function(){j0(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 hc(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var a=kf(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);ku=l,a.target.dispatchEvent(l),ku=null}else return n=Ei(a),n!==null&&N0(n),e.blockedOn=a,!1;n.shift()}return!0}function D0(e,n,a){hc(e)&&a.delete(n)}function US(){Tf=!1,xa!==null&&hc(xa)&&(xa=null),ka!==null&&hc(ka)&&(ka=null),Sa!==null&&hc(Sa)&&(Sa=null),yr.forEach(D0),br.forEach(D0)}function gc(e,n){e.blockedOn===n&&(e.blockedOn=null,Tf||(Tf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,US)))}var vc=null;function R0(e){vc!==e&&(vc=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){vc===e&&(vc=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(Sf(l||a)===null)continue;break}var m=Ei(a);m!==null&&(e.splice(n,3),n-=3,xd(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function uo(e){function n(R){return gc(R,e)}xa!==null&&gc(xa,e),ka!==null&&gc(ka,e),Sa!==null&&gc(Sa,e),yr.forEach(n),br.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);)A0(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||R0(a);else if(x){var w=null;if(m&&m.hasAttribute("formAction")){if(f=m,x=m[Vt]||null)w=x.formAction;else if(Sf(f)!==null)continue}else w=x.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),R0(a)}}}function M0(){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 wf(e){this._internalRoot=e}yc.prototype.render=wf.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(o(409));var a=n.current,l=wn();T0(a,l,e,n,null,null)},yc.prototype.unmount=wf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;T0(e.current,2,null,e,null,null),Xl(),n[ji]=null}};function yc(e){this._internalRoot=e}yc.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&&A0(e)}};var I0=s.version;if(I0!=="19.2.4")throw Error(o(527,I0,"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 $S={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bc.isDisabled&&bc.supportsFiber)try{na=bc.inject($S),Qt=bc}catch{}}return kr.createRoot=function(e,n){if(!c(e))throw Error(o(299));var a=!1,l="",f=Pg,m=Vg,x=Hg;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=k0(e,1,!1,null,null,a,l,null,f,m,x,M0),e[ji]=n.current,of(e),new wf(n)},kr.hydrateRoot=function(e,n,a){if(!c(e))throw Error(o(299));var l=!1,f="",m=Pg,x=Vg,w=Hg,R=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&&(w=a.onRecoverableError),a.formState!==void 0&&(R=a.formState)),n=k0(e,1,!0,n,a??null,l,f,R,m,x,w,M0),n.context=S0(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[ji]=n.current,of(e),new yc(n)},kr.version="19.2.4",kr}var V0;function mT(){if(V0)return Nf.exports;V0=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(),Nf.exports=pT(),Nf.exports}var hT=mT();const gT="modulepreload",vT=function(t){return"/"+t},H0={},yT=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=vT(g),g in H0)return;H0[g]=!0;const v=g.endsWith(".css"),y=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${y}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":gT,v||(b.as="script"),b.crossOrigin="",b.href=g,h&&b.setAttribute("nonce",h),document.head.appendChild(b),v)return new Promise((k,S)=>{b.addEventListener("load",k),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${g}`)))})}))}function 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)})},bT=new Proxy(globalThis.fetch,{apply(t,s,i){return Reflect.apply(globalThis.fetch,s,i)}}),_T=YS({baseUrl:"/",fetch:bT}),xe=JS(WS,_T),xT="_bar_1xhb4_1",kT="_input_1xhb4_32",ST="_select_1xhb4_67",TT="_btnPrimary_1xhb4_103",wT="_btnGhost_1xhb4_173",NT="_badge_1xhb4_195",jT="_disconnectHint_1xhb4_205",Nn={bar:xT,input:kT,select:ST,btnPrimary:TT,btnGhost:wT,badge:NT,disconnectHint:jT};function CT(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 ET({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 $r({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[b,k]=_.useState(""),[S,N]=_.useState(""),j=CT(i,d),T=C=>{if(C.preventDefault(),!!b.trim())if(t==="send"){if(!s||j)return;p(s,b),k("")}else if(t==="spawn"){if(!i)return;h(i,b,S),y==null||y("Session started","success"),k(""),N("")}else{if(!o)return;g(o,void 0,i,b),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:b,onChange:C=>k(C.target.value),placeholder:"Enter prompt...",autoFocus:!0,className:Nn.input}),c&&r.jsxs("select",{value:S,onChange:C=>N(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:!b.trim()||!i,className:Nn.btnPrimary,children:"Go"})]}):t==="start"?r.jsxs("form",{onSubmit:T,className:Nn.bar,children:[r.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!0,className:Nn.input}),r.jsx("button",{type:"submit",disabled:!b.trim(),className:Nn.btnPrimary,children:"Send"})]}):r.jsxs("form",{onSubmit:T,className:Nn.bar,children:[j&&i&&r.jsx(ET,{environmentId:i,onReconnect:v}),r.jsx("input",{type:"text",value:b,onChange:C=>k(C.target.value),placeholder:"Type a message...",autoFocus:!j,disabled:j,className:Nn.input}),r.jsx("span",{title:j?"Environment is unavailable — reconnect first":void 0,children:r.jsx("button",{type:"submit",disabled:!b.trim()||j,className:Nn.btnPrimary,children:"Send"})})]})}const q0=220,G0=70,AT=40,DT=60,RT="hierarchy",MT="dependency";function IT(t){return _.useMemo(()=>{if(t.length===0)return{nodes:[],edges:[]};const s=new O0.graphlib.Graph({multigraph:!0});s.setDefaultEdgeLabel(()=>({})),s.setGraph({rankdir:"TB",nodesep:AT,ranksep:DT});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:q0,height:G0});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:RT},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:MT},style:{stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1})}}return O0.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-q0/2,y:p.y-G0/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 OT=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Xb=(...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 LT={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=_.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:c="",children:u,iconNode:d,...p},h)=>_.createElement("svg",{ref:h,...LT,width:s,height:s,stroke:t,strokeWidth:o?Number(i)*24/Number(s):i,className:Xb("lucide",c),...p},[...d.map(([g,v])=>_.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=_.forwardRef(({className:o,...c},u)=>_.createElement(BT,{ref:u,iconNode:s,className:Xb(`lucide-${OT(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 zT=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],F0=Ge("ArrowDown",zT);/**
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 UT=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Z0=Ge("ArrowUp",UT);/**
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 $T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],PT=Ge("Ban",$T);/**
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 VT=[["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"}]],HT=Ge("Brain",VT);/**
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 qT=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],_i=Ge("Check",qT);/**
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 GT=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qb=Ge("ChevronDown",GT);/**
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 FT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qs=Ge("ChevronRight",FT);/**
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 ZT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ra=Ge("Circle",ZT);/**
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 KT=[["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"}]],YT=Ge("ClipboardList",KT);/**
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 JT=[["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"}]],e_=Ge("Clipboard",JT);/**
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 WT=[["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"}]],XT=Ge("Cog",WT);/**
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 QT=[["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"}]],e2=Ge("Copy",QT);/**
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 t2=[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],n2=Ge("CornerDownRight",t2);/**
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 s2=[["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"}]],a2=Ge("FilePen",s2);/**
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 i2=[["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"}]],o2=Ge("FileText",i2);/**
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 r2=[["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"}]],l2=Ge("House",r2);/**
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 c2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Gp=Ge("Info",c2);/**
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 u2=[["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"}]],d2=Ge("Key",u2);/**
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 f2=[["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"}]],p2=Ge("Keyboard",f2);/**
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 m2=[["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"}]],h2=Ge("ListChecks",m2);/**
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 g2=[["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"}]],v2=Ge("List",g2);/**
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 y2=[["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"}]],b2=Ge("Loader",y2);/**
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 _2=[["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"}]],x2=Ge("Menu",_2);/**
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 k2=[["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"}]],S2=Ge("MessageSquare",k2);/**
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 T2=[["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"}]],w2=Ge("Monitor",T2);/**
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 N2=[["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"}]],j2=Ge("Palette",N2);/**
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 C2=[["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"}]],E2=Ge("Pause",C2);/**
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 A2=[["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"}]],D2=Ge("Pencil",A2);/**
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 R2=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],t_=Ge("Search",R2);/**
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 M2=[["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"}]],I2=Ge("Settings",M2);/**
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 O2=[["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"}]],L2=Ge("SquareCheckBig",O2);/**
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"}]],Fp=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 z2=[["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"}]],U2=Ge("User",z2);/**
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 $2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],La=Ge("X",$2),Zp=8,it=12,Gt=14,Mt=16,vp={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(E2,{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(La,{size:it}),label:"Failed"},blocked:{color:"var(--accent-yellow)",icon:r.jsx(PT,{size:it}),label:"Blocked"}};function Ma(t){return t==="blocked"?vp.blocked:vp[Jr(t)]}const P2={not_started:"statusPending",working:"statusInProgress",paused:"statusWaitingInput",complete:"statusDone",failed:"statusFailed"};function V2(t){return P2[Jr(t)]??"statusPending"}const H2=["working","paused","failed","not_started","blocked","complete"],K0=["not_started","working","paused","complete","failed"],q2={pending:"not_started",assigned:"not_started",in_progress:"working",waiting_input:"paused",review:"paused",done:"complete"};function Jr(t){return t in vp&&t!=="blocked"?t:q2[t]??"not_started"}const G2={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"},F2="_dagContainer_js4w6_1",Z2="_taskNode_js4w6_26",K2="_taskNodeBorder_js4w6_54",Y2="_taskNodeContent_js4w6_60",J2="_taskNodeHeader_js4w6_70",W2="_taskNodeIcon_js4w6_77",X2="_taskNodeTitle_js4w6_82",Q2="_taskNodeBadges_js4w6_90",ew="_childBadge_js4w6_95",tw="_depBadge_js4w6_107",nw="_handle_js4w6_119",sw="_emptyCta_js4w6_126",aw="_ctaDescription_js4w6_137",iw="_ctaButton_js4w6_144",ln={dagContainer:F2,taskNode:Z2,taskNodeBorder:K2,taskNodeContent:Y2,taskNodeHeader:J2,taskNodeIcon:W2,taskNodeTitle:X2,taskNodeBadges:Q2,childBadge:ew,depBadge:tw,handle:nw,emptyCta:sw,ctaDescription:aw,ctaButton:iw};function ow({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(L0,{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(L0,{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 Y0="popstate";function J0(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function rw(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 yp("",{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:Pr(c)}return cw(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 lw(){return Math.random().toString(36).substring(2,10)}function W0(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 yp(t,s,i=null,o,c){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?jo(s):s,state:i,key:s&&s.key||o||lw(),unstable_mask:c}}function Pr({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 jo(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 cw(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 j=v(),T=j==null?null:j-g;g=j,h&&h({action:p,location:N.location,delta:T})}function b(j,T){p="PUSH";let C=J0(j)?j:yp(N.location,j,T);g=v()+1;let E=W0(C,g),A=N.createHref(C.unstable_mask||C);try{d.pushState(E,"",A)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;c.location.assign(A)}u&&h&&h({action:p,location:N.location,delta:1})}function k(j,T){p="REPLACE";let C=J0(j)?j:yp(N.location,j,T);g=v();let E=W0(C,g),A=N.createHref(C.unstable_mask||C);d.replaceState(E,"",A),u&&h&&h({action:p,location:N.location,delta:0})}function S(j){return uw(j)}let N={get action(){return p},get location(){return t(c,d)},listen(j){if(h)throw new Error("A history only accepts one active listener");return c.addEventListener(Y0,y),h=j,()=>{c.removeEventListener(Y0,y),h=null}},createHref(j){return s(c,j)},createURL:S,encodeLocation(j){let T=S(j);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:b,replace:k,go(j){return d.go(j)}};return N}function uw(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:Pr(t);return o=o.replace(/ $/,"%20"),!s&&o.startsWith("//")&&(o=i+o),new URL(o,i)}function n_(t,s,i="/"){return dw(t,s,i,!1)}function dw(t,s,i,o){let c=typeof s=="string"?jo(s):s,u=Js(c.pathname||"/",i);if(u==null)return null;let d=s_(t);fw(d);let p=null;for(let h=0;p==null&&h<d.length;++h){let g=i_(u);p=xw(d[h],g,o)}return p}function s_(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]),b=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}".`),s_(d.children,s,b,y,h)),!(d.path==null&&!d.index)&&s.push({path:y,score:bw(y,d.index),routesMeta:b})};return t.forEach((d,p)=>{var h;if(d.path===""||!((h=d.path)!=null&&h.includes("?")))u(d,p);else for(let g of a_(d.path))u(d,p,!0,g)}),s}function a_(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=a_(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 fw(t){t.sort((s,i)=>s.score!==i.score?i.score-s.score:_w(s.routesMeta.map(o=>o.childrenIndex),i.routesMeta.map(o=>o.childrenIndex)))}var pw=/^:[\w-]+$/,mw=3,hw=2,gw=1,vw=10,yw=-2,X0=t=>t==="*";function bw(t,s){let i=t.split("/"),o=i.length;return i.some(X0)&&(o+=yw),s&&(o+=hw),i.filter(c=>!X0(c)).reduce((c,u)=>c+(pw.test(u)?mw:u===""?gw:vw),o)}function _w(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 xw(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=Vr({path:h.relativePath,caseSensitive:h.caseSensitive,end:g},v),b=h.route;if(!y&&g&&i&&!o[o.length-1].route.index&&(y=Vr({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:Nw(ys([u,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(u=ys([u,y.pathnameBase]))}return d}function Vr(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[i,o]=kw(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},b)=>{if(v==="*"){let S=p[b]||"";d=u.slice(0,u.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[b];return y&&!k?g[v]=void 0:g[v]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:u,pathnameBase:d,pattern:t}}function kw(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 i_(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 Sw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Tw(t,s="/"){let{pathname:i,search:o="",hash:c=""}=typeof t=="string"?jo(t):t,u;return i?(i=i.replace(/\/\/+/g,"/"),i.startsWith("/")?u=Q0(i.substring(1),"/"):u=Q0(i,s)):u=s,{pathname:u,search:jw(o),hash:Cw(c)}}function Q0(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 Ef(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 ww(t){return t.filter((s,i)=>i===0||s.route.path&&s.route.path.length>0)}function Kp(t){let s=ww(t);return s.map((i,o)=>o===s.length-1?i.pathname:i.pathnameBase)}function au(t,s,i,o=!1){let c;typeof t=="string"?c=jo(t):(c={...t},vt(!c.pathname||!c.pathname.includes("?"),Ef("?","pathname","search",c)),vt(!c.pathname||!c.pathname.includes("#"),Ef("#","pathname","hash",c)),vt(!c.search||!c.search.includes("#"),Ef("#","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 b=d.split("/");for(;b[0]==="..";)b.shift(),y-=1;c.pathname=b.join("/")}p=y>=0?s[y]:"/"}let h=Tw(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,"/"),Nw=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),jw=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Cw=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,Ew=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 Aw(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Dw(t){return t.map(s=>s.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var o_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function r_(t,s){let i=t;if(typeof i!="string"||!Sw.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let o=i,c=!1;if(o_)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 l_=["POST","PUT","PATCH","DELETE"];new Set(l_);var Rw=["GET",...l_];new Set(Rw);var Co=_.createContext(null);Co.displayName="DataRouter";var iu=_.createContext(null);iu.displayName="DataRouterState";var Mw=_.createContext(!1),c_=_.createContext({isTransitioning:!1});c_.displayName="ViewTransition";var Iw=_.createContext(new Map);Iw.displayName="Fetchers";var Ow=_.createContext(null);Ow.displayName="Await";var En=_.createContext(null);En.displayName="Navigation";var Wr=_.createContext(null);Wr.displayName="Location";var Fn=_.createContext({outlet:null,matches:[],isDataRoute:!1});Fn.displayName="Route";var Yp=_.createContext(null);Yp.displayName="RouteError";var u_="REACT_ROUTER_ERROR",Lw="REDIRECT",Bw="ROUTE_ERROR_RESPONSE";function zw(t){if(t.startsWith(`${u_}:${Lw}:{`))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 Uw(t){if(t.startsWith(`${u_}:${Bw}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new Ew(s.status,s.statusText,s.data)}catch{}}function $w(t,{relative:s}={}){vt(xi(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:o}=_.useContext(En),{hash:c,pathname:u,search:d}=Xr(t,{relative:s}),p=u;return i!=="/"&&(p=u==="/"?i:ys([i,u])),o.createHref({pathname:p,search:d,hash:c})}function xi(){return _.useContext(Wr)!=null}function Pt(){return vt(xi(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(Wr).location}function Nt(t){vt(xi(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:s}=Pt();return _.useMemo(()=>Vr(t,i_(s)),[s,t])}var d_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function f_(t){_.useContext(En).static||_.useLayoutEffect(t)}function ou(){let{isDataRoute:t}=_.useContext(Fn);return t?tN():Pw()}function Pw(){vt(xi(),"useNavigate() may be used only in the context of a <Router> component.");let t=_.useContext(Co),{basename:s,navigator:i}=_.useContext(En),{matches:o}=_.useContext(Fn),{pathname:c}=Pt(),u=JSON.stringify(Kp(o)),d=_.useRef(!1);return f_(()=>{d.current=!0}),_.useCallback((h,g={})=>{if(Gn(d.current,d_),!d.current)return;if(typeof h=="number"){i.go(h);return}let v=au(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 Vw=_.createContext(null);function Hw(t){let s=_.useContext(Fn).outlet;return _.useMemo(()=>s&&_.createElement(Vw.Provider,{value:t},s),[s,t])}function ls(){let{matches:t}=_.useContext(Fn),s=t[t.length-1];return s?s.params:{}}function Xr(t,{relative:s}={}){let{matches:i}=_.useContext(Fn),{pathname:o}=Pt(),c=JSON.stringify(Kp(i));return _.useMemo(()=>au(t,JSON.parse(c),o,s==="path"),[t,c,o,s])}function qw(t,s){return p_(t,s)}function p_(t,s,i){var j;vt(xi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=_.useContext(En),{matches:c}=_.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||"";h_(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"?jo(s):s;vt(h==="/"||((j=T.pathname)==null?void 0:j.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 b=y.pathname||"/",k=b;if(h!=="/"){let T=h.replace(/^\//,"").split("/");k="/"+b.replace(/^\//,"").split("/").slice(T.length).join("/")}let S=n_(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 N=Yw(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&&N?_.createElement(Wr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...y},navigationType:"POP"}},N):N}function Gw(){let t=eN(),s=Aw(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=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:u},"ErrorBoundary")," or"," ",_.createElement("code",{style:u},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},s),i?_.createElement("pre",{style:c},i):null,d)}var Fw=_.createElement(Gw,null),m_=class extends _.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=Uw(t.digest);i&&(t=i)}let s=t!==void 0?_.createElement(Fn.Provider,{value:this.props.routeContext},_.createElement(Yp.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?_.createElement(Zw,{error:t},s):s}};m_.contextType=Mw;var Af=new WeakMap;function Zw({children:t,error:s}){let{basename:i}=_.useContext(En);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let o=zw(s.digest);if(o){let c=Af.get(s);if(c)throw c;let u=r_(o.location,i);if(o_&&!Af.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 Af.set(s,d),d}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u.absoluteURL||u.to}`})}}return t}function Kw({routeContext:t,match:s,children:i}){let o=_.useContext(Co);return o&&o.static&&o.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=s.route.id),_.createElement(Fn.Provider,{value:t},i)}function Yw(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:b,errors:k}=o,S=y.route.loader&&!b.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 b,k;h(v,{location:o.location,params:((k=(b=o.matches)==null?void 0:b[0])==null?void 0:k.params)??{},unstable_pattern:Dw(o.matches),errorInfo:y})}:void 0;return c.reduceRight((v,y,b)=>{let k,S=!1,N=null,j=null;o&&(k=u&&y.route.id?u[y.route.id]:void 0,N=y.route.errorElement||Fw,d&&(p<0&&b===0?(h_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,j=null):p===b&&(S=!0,j=y.route.hydrateFallbackElement||null)));let T=s.concat(c.slice(0,b+1)),C=()=>{let E;return k?E=N:S?E=j:y.route.Component?E=_.createElement(y.route.Component,null):y.route.element?E=y.route.element:E=v,_.createElement(Kw,{match:y,routeContext:{outlet:v,matches:T,isDataRoute:o!=null},children:E})};return o&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?_.createElement(m_,{location:o.location,revalidation:o.revalidation,component:N,error:k,children:C(),routeContext:{outlet:null,matches:T,isDataRoute:!0},onError:g}):C()},null)}function Jp(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Jw(t){let s=_.useContext(Co);return vt(s,Jp(t)),s}function Ww(t){let s=_.useContext(iu);return vt(s,Jp(t)),s}function Xw(t){let s=_.useContext(Fn);return vt(s,Jp(t)),s}function Wp(t){let s=Xw(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 Qw(){return Wp("useRouteId")}function eN(){var o;let t=_.useContext(Yp),s=Ww("useRouteError"),i=Wp("useRouteError");return t!==void 0?t:(o=s.errors)==null?void 0:o[i]}function tN(){let{router:t}=Jw("useNavigate"),s=Wp("useNavigate"),i=_.useRef(!1);return f_(()=>{i.current=!0}),_.useCallback(async(c,u={})=>{Gn(i.current,d_),i.current&&(typeof c=="number"?await t.navigate(c):await t.navigate(c,{fromRouteId:s,...u}))},[t,s])}var ey={};function h_(t,s,i){!s&&!ey[t]&&(ey[t]=!0,Gn(!1,i))}_.memo(nN);function nN({routes:t,future:s,state:i,isStatic:o,onError:c}){return p_(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}=_.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}=_.useContext(Fn),{pathname:d}=Pt(),p=ou(),h=au(t,Kp(u),d,o==="path"),g=JSON.stringify(h);return _.useEffect(()=>{p(JSON.parse(g),{replace:s,state:i,relative:o})},[p,g,o,s,i]),null}function Ba(t){return Hw(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 sN({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=_.useMemo(()=>({basename:p,navigator:c,static:u,unstable_useTransitions:d,future:{}}),[p,c,u,d]);typeof i=="string"&&(i=jo(i));let{pathname:g="/",search:v="",hash:y="",state:b=null,key:k="default",unstable_mask:S}=i,N=_.useMemo(()=>{let j=Js(g,p);return j==null?null:{location:{pathname:j,search:v,hash:y,state:b,key:k,unstable_mask:S},navigationType:o}},[p,g,v,y,b,k,o,S]);return Gn(N!=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.`),N==null?null:_.createElement(En.Provider,{value:h},_.createElement(Wr.Provider,{children:s,value:N}))}function aN({children:t,location:s}){return qw(bp(t),s)}function bp(t,s=[]){let i=[];return _.Children.forEach(t,(o,c)=>{if(!_.isValidElement(o))return;let u=[...s,c];if(o.type===_.Fragment){i.push.apply(i,bp(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=bp(o.props.children,u)),i.push(d)}),i}var Lc="get",Bc="application/x-www-form-urlencoded";function ru(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function iN(t){return ru(t)&&t.tagName.toLowerCase()==="button"}function oN(t){return ru(t)&&t.tagName.toLowerCase()==="form"}function rN(t){return ru(t)&&t.tagName.toLowerCase()==="input"}function lN(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function cN(t,s){return t.button===0&&(!s||s==="_self")&&!lN(t)}function _p(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 uN(t,s){let i=_p(t);return s&&s.forEach((o,c)=>{i.has(c)||s.getAll(c).forEach(u=>{i.append(c,u)})}),i}var kc=null;function dN(){if(kc===null)try{new FormData(document.createElement("form"),0),kc=!1}catch{kc=!0}return kc}var fN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Df(t){return t!=null&&!fN.has(t)?(Gn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Bc}"`),null):t}function pN(t,s){let i,o,c,u,d;if(oN(t)){let p=t.getAttribute("action");o=p?Js(p,s):null,i=t.getAttribute("method")||Lc,c=Df(t.getAttribute("enctype"))||Bc,u=new FormData(t)}else if(iN(t)||rN(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")||Lc,c=Df(t.getAttribute("formenctype"))||Df(p.getAttribute("enctype"))||Bc,u=new FormData(p,t),!dN()){let{name:g,type:v,value:y}=t;if(v==="image"){let b=g?`${g}.`:"";u.append(`${b}x`,"0"),u.append(`${b}y`,"0")}else g&&u.append(g,y)}}else{if(ru(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=Lc,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 Xp(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function mN(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 hN(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 gN(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 vN(t,s,i){let o=await Promise.all(t.map(async c=>{let u=s.routes[c.route.id];if(u){let d=await hN(u,i);return d.links?d.links():[]}return[]}));return xN(o.flat(1).filter(gN).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function ty(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 b=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 b=="boolean")return b}return!0}):[]}function yN(t,s,{includeHydrateFallback:i}={}){return bN(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 bN(t){return[...new Set(t)]}function _N(t){let s={},i=Object.keys(t).sort();for(let o of i)s[o]=t[o];return s}function xN(t,s){let i=new Set;return new Set(s),t.reduce((o,c)=>{let u=JSON.stringify(_N(c));return i.has(u)||(i.add(u),o.push({key:u,link:c})),o},[])}function g_(){let t=_.useContext(Co);return Xp(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function kN(){let t=_.useContext(iu);return Xp(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Qp=_.createContext(void 0);Qp.displayName="FrameworkContext";function v_(){let t=_.useContext(Qp);return Xp(t,"You must render this element inside a <HydratedRouter> element"),t}function SN(t,s){let i=_.useContext(Qp),[o,c]=_.useState(!1),[u,d]=_.useState(!1),{onFocus:p,onBlur:h,onMouseEnter:g,onMouseLeave:v,onTouchStart:y}=s,b=_.useRef(null);_.useEffect(()=>{if(t==="render"&&d(!0),t==="viewport"){let N=T=>{T.forEach(C=>{d(C.isIntersecting)})},j=new IntersectionObserver(N,{threshold:.5});return b.current&&j.observe(b.current),()=>{j.disconnect()}}},[t]),_.useEffect(()=>{if(o){let N=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(N)}}},[o]);let k=()=>{c(!0)},S=()=>{c(!1),d(!1)};return i?t!=="intent"?[u,b,{}]:[u,b,{onFocus:Sr(p,k),onBlur:Sr(h,S),onMouseEnter:Sr(g,k),onMouseLeave:Sr(v,S),onTouchStart:Sr(y,k)}]:[!1,b,{}]}function Sr(t,s){return i=>{t&&t(i),i.defaultPrevented||s(i)}}function TN({page:t,...s}){let{router:i}=g_(),o=_.useMemo(()=>n_(i.routes,t,i.basename),[i.routes,t,i.basename]);return o?_.createElement(NN,{page:t,matches:o,...s}):null}function wN(t){let{manifest:s,routeModules:i}=v_(),[o,c]=_.useState([]);return _.useEffect(()=>{let u=!1;return vN(t,s,i).then(d=>{u||c(d)}),()=>{u=!0}},[t,s,i]),o}function NN({page:t,matches:s,...i}){let o=Pt(),{future:c,manifest:u,routeModules:d}=v_(),{basename:p}=g_(),{loaderData:h,matches:g}=kN(),v=_.useMemo(()=>ty(t,s,g,u,o,"data"),[t,s,g,u,o]),y=_.useMemo(()=>ty(t,s,g,u,o,"assets"),[t,s,g,u,o]),b=_.useMemo(()=>{if(t===o.pathname+o.search+o.hash)return[];let N=new Set,j=!1;if(s.forEach(C=>{var A;let E=u.routes[C.route.id];!E||!E.hasLoader||(!v.some(I=>I.route.id===C.route.id)&&C.route.id in h&&((A=d[C.route.id])!=null&&A.shouldRevalidate)||E.hasClientLoader?j=!0:N.add(C.route.id))}),N.size===0)return[];let T=mN(t,p,c.unstable_trailingSlashAwareDataRequests,"data");return j&&N.size>0&&T.searchParams.set("_routes",s.filter(C=>N.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=_.useMemo(()=>yN(y,u),[y,u]),S=wN(y);return _.createElement(_.Fragment,null,b.map(N=>_.createElement("link",{key:N,rel:"prefetch",as:"fetch",href:N,...i})),k.map(N=>_.createElement("link",{key:N,rel:"modulepreload",href:N,...i})),S.map(({key:N,link:j})=>_.createElement("link",{key:N,nonce:i.nonce,...j,crossOrigin:j.crossOrigin??i.crossOrigin})))}function jN(...t){return s=>{t.forEach(i=>{typeof i=="function"?i(s):i!=null&&(i.current=s)})}}var CN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{CN&&(window.__reactRouterVersion="7.13.2")}catch{}function EN({basename:t,children:s,unstable_useTransitions:i,window:o}){let c=_.useRef();c.current==null&&(c.current=rw({window:o,v5Compat:!0}));let u=c.current,[d,p]=_.useState({action:u.action,location:u.location}),h=_.useCallback(g=>{i===!1?p(g):_.startTransition(()=>p(g))},[i]);return _.useLayoutEffect(()=>u.listen(h),[u,h]),_.createElement(sN,{basename:t,children:s,location:d.location,navigationType:d.action,navigator:u,unstable_useTransitions:i})}var y_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,em=_.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:b,unstable_defaultShouldRevalidate:k,...S},N){let{basename:j,navigator:T,unstable_useTransitions:C}=_.useContext(En),E=typeof v=="string"&&y_.test(v),A=r_(v,j);v=A.to;let I=$w(v,{relative:c}),D=Pt(),B=null;if(p){let J=au(p,[],D.unstable_mask?D.unstable_mask.pathname:"/",!0);j!=="/"&&(J.pathname=J.pathname==="/"?j:ys([j,J.pathname])),B=T.createHref(J)}let[z,X,Y]=SN(o,S),F=MN(v,{replace:d,unstable_mask:p,state:h,target:g,preventScrollReset:y,relative:c,viewTransition:b,unstable_defaultShouldRevalidate:k,unstable_useTransitions:C});function te(J){s&&s(J),J.defaultPrevented||F(J)}let le=!(A.isExternal||u),se=_.createElement("a",{...S,...Y,href:(le?B:void 0)||A.absoluteURL||I,onClick:le?te:s,ref:jN(N,X),target:g,"data-discover":!E&&i==="render"?"true":void 0});return z&&!E?_.createElement(_.Fragment,null,se,_.createElement(TN,{page:I})):se});em.displayName="Link";var AN=_.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=Xr(d,{relative:g.relative}),b=Pt(),k=_.useContext(iu),{navigator:S,basename:N}=_.useContext(En),j=k!=null&&zN(y)&&p===!0,T=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,C=b.pathname,E=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;i||(C=C.toLowerCase(),E=E?E.toLowerCase():null,T=T.toLowerCase()),E&&N&&(E=Js(E,N)||E);const A=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let I=C===T||!c&&C.startsWith(T)&&C.charAt(A)==="/",D=E!=null&&(E===T||!c&&E.startsWith(T)&&E.charAt(T.length)==="/"),B={isActive:I,isPending:D,isTransitioning:j},z=I?s:void 0,X;typeof o=="function"?X=o(B):X=[o,I?"active":null,D?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let Y=typeof u=="function"?u(B):u;return _.createElement(em,{...g,"aria-current":z,className:X,ref:v,style:Y,to:d,viewTransition:p},typeof h=="function"?h(B):h)});AN.displayName="NavLink";var DN=_.forwardRef(({discover:t="render",fetcherKey:s,navigate:i,reloadDocument:o,replace:c,state:u,method:d=Lc,action:p,onSubmit:h,relative:g,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:b,...k},S)=>{let{unstable_useTransitions:N}=_.useContext(En),j=LN(),T=BN(p,{relative:g}),C=d.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&y_.test(p),A=I=>{if(h&&h(I),I.defaultPrevented)return;I.preventDefault();let D=I.nativeEvent.submitter,B=(D==null?void 0:D.getAttribute("formmethod"))||d,z=()=>j(D||I.currentTarget,{fetcherKey:s,method:B,navigate:i,replace:c,state:u,relative:g,preventScrollReset:v,viewTransition:y,unstable_defaultShouldRevalidate:b});N&&i!==!1?_.startTransition(()=>z()):z()};return _.createElement("form",{ref:S,method:C,action:T,onSubmit:o?h:A,...k,"data-discover":!E&&t==="render"?"true":void 0})});DN.displayName="Form";function RN(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function b_(t){let s=_.useContext(Co);return vt(s,RN(t)),s}function MN(t,{target:s,replace:i,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:p,unstable_defaultShouldRevalidate:h,unstable_useTransitions:g}={}){let v=ou(),y=Pt(),b=Xr(t,{relative:d});return _.useCallback(k=>{if(cN(k,s)){k.preventDefault();let S=i!==void 0?i:Pr(y)===Pr(b),N=()=>v(t,{replace:S,unstable_mask:o,state:c,preventScrollReset:u,relative:d,viewTransition:p,unstable_defaultShouldRevalidate:h});g?_.startTransition(()=>N()):N()}},[y,v,b,i,o,c,s,t,u,d,p,h,g])}function tm(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=_.useRef(_p(t)),i=_.useRef(!1),o=Pt(),c=_.useMemo(()=>uN(o.search,i.current?null:s.current),[o.search]),u=ou(),d=_.useCallback((p,h)=>{const g=_p(typeof p=="function"?p(new URLSearchParams(c)):p);i.current=!0,u("?"+g,h)},[u,c]);return[c,d]}var IN=0,ON=()=>`__${String(++IN)}__`;function LN(){let{router:t}=b_("useSubmit"),{basename:s}=_.useContext(En),i=Qw(),o=t.fetch,c=t.navigate;return _.useCallback(async(u,d={})=>{let{action:p,method:h,encType:g,formData:v,body:y}=pN(u,s);if(d.navigate===!1){let b=d.fetcherKey||ON();await o(b,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}=_.useContext(En),o=_.useContext(Fn);vt(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),u={...Xr(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])),Pr(u)}function zN(t,{relative:s}={}){let i=_.useContext(c_);vt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=b_("useViewTransitionState"),c=Xr(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 Vr(c.pathname,d)!=null||Vr(c.pathname,u)!=null}function bt(){const t=ou();return _.useCallback((s,i)=>{typeof s=="number"?t(s):t(s,i)},[t])}function nm(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 __(t){return`/sessions/new?${new URLSearchParams({env:t}).toString()}`}const ko="/environments",UN="/environments/new";function vi(t){return`/environments/${encodeURIComponent(t)}`}function $N(t){return`/environments/${encodeURIComponent(t)}/edit`}const xo="/settings",PN="/settings/credentials",Rf="/settings/personas",VN="/settings/personas/new";function x_(t){return`/settings/personas/${encodeURIComponent(t)}`}const HN="/settings/shortcuts",qN="/pair",GN="/chat",yi="/",FN="/tasks",k_="/workspaces/new",S_="/knowledge",lu="/findings";function ZN(t,s){return t&&s?`/environments/${encodeURIComponent(s)}/workspaces/${encodeURIComponent(t)}/findings`:lu}function xp(t,s,i){const o=encodeURIComponent(t);return s&&i?`/environments/${encodeURIComponent(i)}/workspaces/${encodeURIComponent(s)}/findings/${o}`:`/findings/${o}`}const KN=G2,YN={task:ow};function JN({workspaceId:t,environmentId:s,tasks:i,resolvedThemeId:o}){const c=bt(),u=_.useMemo(()=>i.filter(y=>y.workspaceId===t),[i,t]),{nodes:d,edges:p}=IT(u),h=_.useMemo(()=>{const y=getComputedStyle(document.documentElement),b={};for(const[k,S]of Object.entries(KN))b[k]=y.getPropertyValue(S).trim()||"#6b7a8d";return b},[o]),g=_.useCallback((y,b)=>{c(rs(b.id,void 0,t,s))},[c,t,s]),v=_.useCallback(y=>{const b=y.data;return h[b.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(qS,{nodes:d,edges:p,nodeTypes:YN,onNodeClick:g,fitView:!0,fitViewOptions:{padding:.2},minZoom:.3,maxZoom:2,children:[r.jsx(GS,{variant:FS.Dots,gap:24,size:1,color:"var(--text-disabled)"}),r.jsx(ZS,{showInteractive:!1}),r.jsx(KS,{nodeColor:v,maskColor:"var(--bg-overlay)",style:{background:"var(--bg-inset)"}})]})})}const WN="_breadcrumbs_17or2_1",XN="_list_17or2_11",QN="_item_17or2_21",ej="_separator_17or2_28",tj="_link_17or2_34",nj="_current_17or2_57",fo={breadcrumbs:WN,list:XN,item:QN,separator:ej,link:tj,current:nj};function xs({segments:t}){return r.jsx("nav",{className:fo.breadcrumbs,"aria-label":"Breadcrumb","data-testid":"breadcrumbs",children:r.jsx("ol",{className:fo.list,children:t.map((s,i)=>{const o=i===t.length-1;return r.jsxs("li",{className:fo.item,children:[i>0&&r.jsx("span",{className:fo.separator,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),s.url&&!o?r.jsx(em,{className:fo.link,to:s.url,title:s.label,children:s.label}):r.jsx("span",{className:fo.current,"aria-current":"page",title:s.label,children:s.label})]},i)})})})}const sj="_btn_dwk2o_1",aj="_sm_dwk2o_22",ij="_md_dwk2o_28",oj="_lg_dwk2o_34",rj="_primary_dwk2o_40",lj="_danger_dwk2o_55",cj="_outline_dwk2o_70",uj="_ghost_dwk2o_80",Mf={btn:sj,sm:aj,md:ij,lg:oj,primary:rj,danger:lj,outline:cj,ghost:uj},Fs=_.forwardRef(function({variant:s="primary",size:i="md",className:o,children:c,...u},d){const p=[Mf.btn,Mf[s],Mf[i],o].filter(Boolean).join(" ");return r.jsx("button",{ref:d,className:p,...u,children:c})}),dj="_copyButton_1bqk0_1",fj={copyButton:dj},pj=2e3;function mj({text:t,className:s,"data-testid":i}){const[o,c]=_.useState(!1),u=_.useRef(void 0);_.useEffect(()=>()=>{u.current!==void 0&&clearTimeout(u.current)},[]);const d=_.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},pj)}catch{}},[t]);return r.jsx("button",{type:"button",className:`${fj.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(e_,{size:Gt,"aria-hidden":"true"})})}const hj="_banner_bxqlh_1",gj="_label_bxqlh_15",vj="_text_bxqlh_25",yj="_link_bxqlh_29",Sc={banner:hj,label:gj,text:vj,link:yj};function bj(){return r.jsxs("div",{className:Sc.banner,"data-testid":"demo-banner",children:[r.jsx("span",{className:Sc.label,children:"DEMO"}),r.jsxs("span",{className:Sc.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:Sc.link,children:"Install Grackle"})," ","to use it for real."]})]})}const _j="_container_og0yp_1",xj="_chevronButton_og0yp_6",kj="_mainButton_og0yp_6",Sj="_sm_og0yp_34",Tj="_md_og0yp_34",wj="_lg_og0yp_34",Nj="_primary_og0yp_57",jj="_danger_og0yp_70",Cj="_outline_og0yp_83",Ej="_ghost_og0yp_92",Aj="_dropdown_og0yp_100",Dj="_option_og0yp_113",Rj="_optionLabel_og0yp_130",Mj="_optionDesc_og0yp_135",Vs={container:_j,chevronButton:xj,mainButton:kj,sm:Sj,md:Tj,lg:wj,primary:Nj,danger:jj,outline:Cj,ghost:Ej,dropdown:Aj,option:Dj,optionLabel:Rj,optionDesc:Mj};function T_({label:t,onClick:s,options:i,variant:o="primary",size:c="md","data-testid":u}){const[d,p]=_.useState(!1),h=_.useRef(null);_.useEffect(()=>{if(!d)return;function b(k){h.current&&k.target instanceof Node&&!h.current.contains(k.target)&&p(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[d]),_.useEffect(()=>{if(!d)return;function b(k){k.key==="Escape"&&p(!1)}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[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(b=>!b),"aria-label":`More options for ${t}`,"aria-haspopup":"menu","aria-expanded":d,"data-testid":u?`${u}-chevron`:void 0,children:r.jsx(Qb,{size:Gt,"aria-hidden":"true"})}),d&&r.jsx("div",{className:Vs.dropdown,"data-testid":u?`${u}-menu`:void 0,children:i.map((b,k)=>r.jsxs("button",{type:"button",className:Vs.option,onClick:()=>{b.onClick(),p(!1)},children:[r.jsx("span",{className:Vs.optionLabel,children:b.label}),b.description&&r.jsx("span",{className:Vs.optionDesc,children:b.description})]},k))})]})}function kp(){kp=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)),qc(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&&qc(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)},kp.apply(this,arguments)}function qc(t,s){return qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,o){return i.__proto__=o,i},qc(t,s)}function ny(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 If(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 ny(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)?ny(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 Ij=(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){rT(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(I){for(var D,B=If(I.properties.className);!(D=B()).done;){var z=D.value;if(z.slice(0,9)==="language-")return z.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 b,k;k=(b=y)!=null&&b.includes("diff-")?y.split("-")[1]:y,g=t.highlight(xc(o),k),u.properties.className=(u.properties.className||[]).concat("language-"+k)}catch(I){if(!s.ignoreMissing||!/Unknown language/.test(I.message))throw I;g=o}else g=o;g.children=(v=1,function I(D){return D.reduce(function(B,z){if(z.type==="text"){var X=z.value,Y=(X.match(/\n/g)||"").length;if(Y===0)z.position={start:{line:v,column:1},end:{line:v,column:1}},B.push(z);else for(var F,te=X.split(`
229
- `),le=If(te.entries());!(F=le()).done;){var se=F.value,J=se[0],L=se[1];B.push({type:"text",value:J===te.length-1?L:L+`
230
- `,position:{start:{line:v+J,column:1},end:{line:v+J,column:1}}})}return v+=Y,B}if(Object.prototype.hasOwnProperty.call(z,"children")){var Z=v;return z.children=I(z.children),B.push(z),z.position={start:{line:Z,column:1},end:{line:v,column:1}},B}return B.push(z),B},[])})(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,N=(function(I){var D=/{([\d,-]+)}/,B=I.split(",").map(function(Y){return Y.trim()}).join();if(D.test(B)){var z=D.exec(B)[1],X=cT(z);return function(Y){return X.includes(Y+1)}}return function(){return!1}})(h),j=(function(I){var D=kp(/showLineNumbers=(\d+)/i,{lines:1});if(D.test(I)){var B=D.exec(I);return Number(B.groups.lines)}return 1})(h),T=(function(I){for(var D=new Array(I),B=0;B<I;B++)D[B]={type:"element",tagName:"span",properties:{className:[]},children:[]};return D})(g.position.end.line),C=["showlinenumbers=false",'showlinenumbers="false"',"showlinenumbers={false}"],E=function(){var I,D,B=S.value,z=B[0],X=B[1];X.properties.className=["code-line"];var Y=uT(g,function(F){return F.position.start.line<=z+1&&F.position.end.line>=z+1});X.children=Y.children,(h.toLowerCase().includes("showLineNumbers".toLowerCase())||s.showLineNumbers===!0||typeof s.showLineNumbers=="object"&&s.showLineNumbers.includes(y))&&!C.some(function(F){return h.toLowerCase().includes(F)})&&(X.properties.line=[(z+j).toString()],X.properties.className.push("line-number")),N(z)&&X.properties.className.push("highlight-line"),(y==="diff"||(I=y)!=null&&I.includes("diff-"))&&xc(X).substring(0,1)==="-"?X.properties.className.push("deleted"):(y==="diff"||(D=y)!=null&&D.includes("diff-"))&&xc(X).substring(0,1)==="+"&&X.properties.className.push("inserted")},A=If(T.entries());!(S=A()).done;)E();T.length>0&&xc(T[T.length-1]).trim()===""&&T.pop(),o.children=T}}}})(lT);function w_(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 So(t){return t===0?"-":t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`}const sy=new Set(["grackle"]);function Eo(t){if(t.startsWith("mcp__")){const i=t.indexOf("__",5);if(i>5){const o=t.slice(5,i);if(sy.has(o))return t.slice(i+2)}}const s=t.indexOf("-");if(s>0){const i=t.slice(0,s);if(sy.has(i))return t.slice(s+1)}return t}const Oj={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 Lj(t){const s=Eo(t);return Oj[s.toLowerCase()]??"generic"}const Bj="_card_qkm9i_2",zj="_cardBlue_qkm9i_20",Uj="_cardOrange_qkm9i_24",$j="_cardGreen_qkm9i_28",Pj="_cardPurple_qkm9i_32",Vj="_cardNeutral_qkm9i_36",Hj="_cardRed_qkm9i_40",qj="_cardTeal_qkm9i_44",Gj="_header_qkm9i_48",Fj="_icon_qkm9i_55",Zj="_toolName_qkm9i_64",Kj="_fileName_qkm9i_71",Yj="_badge_qkm9i_80",Jj="_spacer_qkm9i_87",Wj="_bodyToggle_qkm9i_91",Xj="_chevron_qkm9i_109",Qj="_chevronExpanded_qkm9i_115",eC="_pre_qkm9i_119",tC="_diffAdd_qkm9i_143",nC="_diffRemove_qkm9i_155",sC="_diffContext_qkm9i_167",aC="_diffHeader_qkm9i_176",iC="_diffLine_qkm9i_182",oC="_exitOk_qkm9i_188",rC="_exitError_qkm9i_194",lC="_exitPending_qkm9i_200",cC="_inProgress_qkm9i_228",uC="_metadata_qkm9i_232",dC="_metadataPrefix_qkm9i_239",M={card:Bj,cardBlue:zj,cardOrange:Uj,cardGreen:$j,cardPurple:Pj,cardNeutral:Vj,cardRed:Hj,cardTeal:qj,header:Gj,icon:Fj,toolName:Zj,fileName:Kj,badge:Yj,spacer:Jj,bodyToggle:Wj,chevron:Xj,chevronExpanded:Qj,pre:eC,diffAdd:tC,diffRemove:nC,diffContext:sC,diffHeader:aC,diffLine:iC,exitOk:oC,exitError:rC,exitPending:lC,inProgress:cC,metadata:uC,metadataPrefix:dC};function fC(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 pC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}const Of=5;function ay({tool:t,args:s,result:i,isError:o,writeVariant:c}){const[u,d]=_.useState(!1),p=fC(s),h=pC(p),g=i===void 0,v=o?M.cardRed:c?M.cardGreen:M.cardBlue,y=c?"var(--accent-green)":"var(--accent-blue)",b=c?r.jsx(a2,{size:Gt}):r.jsx(o2,{size:Gt}),k=c?"tool-card-file-write":"tool-card-file-read",S=(i==null?void 0:i.split(`
231
- `))??[],N=S.length>Of,j=u?S:S.slice(0,Of);return r.jsxs("div",{className:`${M.card} ${v} ${g?M.inProgress:""}`,"data-testid":k,children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,children:b}),r.jsx("span",{className:M.toolName,style:{color:y},children:t}),h&&r.jsx("span",{className:M.fileName,title:p,children:h}),!g&&S.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.badge,children:[S.length," lines"]})]})]}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&S.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:j.map((T,C)=>r.jsxs("span",{className:M.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))}),N&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(T=>!T)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${u?M.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),u?"collapse":`${S.length-Of} more lines`]})]})]})}function mC(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 hC(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 gC(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 vC(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 yC(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 bC(t){const s=t.split(/[/\\]/);return s[s.length-1]||t}function _C(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=mC(o);if(c.length>0)return c}}const i=yC(t);if(i)return hC(i.oldStr,i.newStr)}const Lf=5;function xC({tool:t,args:s,result:i,isError:o,detailedResult:c}){const[u,d]=_.useState(!1),p=vC(s),h=bC(p),g=i===void 0,v=_C(s,c),y=v?gC(v):null,b=((v==null?void 0:v.length)??0)>Lf,k=u?v:v==null?void 0:v.slice(0,Lf);return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardOrange} ${g?M.inProgress:""}`,"data-testid":"tool-card-file-edit",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,children:r.jsx(D2,{size:Gt})}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow)"},children:t}),h&&r.jsx("span",{className:M.fileName,title:p,children:h}),y&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.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:M.pre,"data-testid":"tool-card-error",children:i}),!o&&k&&k.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-diff",children:k.map((S,N)=>{let j=M.diffContext;return S.type==="add"&&(j=M.diffAdd),S.type==="remove"&&(j=M.diffRemove),S.type==="header"&&(j=M.diffHeader),r.jsx("span",{className:`${M.diffLine} ${j}`,children:S.content},N)})}),b&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{d(S=>!S)},"aria-expanded":u,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${u?M.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),u?"collapse":`${((v==null?void 0:v.length)??0)-Lf} more lines`]})]}),!o&&!v&&!g&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-content",children:i})]})}const kC=/^\[exit (\d+)\]\s*/;function SC(t){const s=kC.exec(t);return s?{exitCode:Number(s[1]),output:t.slice(s[0].length)}:{exitCode:void 0,output:t}}function TC(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.command=="string"?s.command:""}function wC(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 NC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=TC(s),p=wC(d),h=i===void 0,g=i?SC(i):null,v=(g==null?void 0:g.output.split(`
235
- `))??[],y=v.length>Bf,b=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:`${M.card} ${S?M.cardRed:M.cardNeutral}`,"data-testid":"tool-card-shell",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,style:{color:"var(--text-secondary)",fontFamily:"var(--font-mono)",fontWeight:"bold"},children:"$"}),r.jsx("span",{className:M.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?M.exitOk:M.exitError,"data-testid":"tool-card-exit-code",children:[k===0?r.jsx(_i,{size:it,"aria-hidden":"true"}):r.jsx(La,{size:it,"aria-hidden":"true"})," ","exit ",k]}),h&&r.jsx("span",{className:M.exitPending,"data-testid":"tool-card-pending",children:r.jsx(b2,{size:it,"aria-hidden":"true"})})]}),!h&&g&&g.output.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-output",children:b.join(`
236
- `)}),y&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(N=>!N)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),c?"collapse":`${v.length-Bf} more lines`]})]})]})}function jC(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 zf=5;function CC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),{pattern:d,path:p}=jC(s),h=i===void 0,g=(i==null?void 0:i.split(`
237
- `).filter(b=>b.length>0))??[],v=g.length>zf,y=c?g:g.slice(0,zf);return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardPurple} ${h?M.inProgress:""}`,"data-testid":"tool-card-search",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,children:r.jsx(t_,{size:Gt})}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:t}),d&&r.jsxs("span",{className:M.fileName,"data-testid":"tool-card-pattern",children:['"',d,'"']}),p&&r.jsxs("span",{className:M.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:M.spacer}),r.jsxs("span",{className:M.badge,"data-testid":"tool-card-match-count",children:[g.length," ",g.length===1?"match":"matches"]})]})]}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&y.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-results",children:y.join(`
238
- `)}),v&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),c?"collapse":`${g.length-zf} more matches`]})]})]})}const EC="_progressBar_14f5c_1",AC="_progressFill_14f5c_9",DC="_activeTask_14f5c_16",RC="_activeIcon_14f5c_27",MC="_todoPulse_14f5c_1",IC="_activeText_14f5c_34",OC="_checklist_14f5c_48",LC="_item_14f5c_55",BC="_itemIcon_14f5c_65",zC="_itemText_14f5c_73",UC="_pending_14f5c_78",$C="_in_progress_14f5c_85",PC="_completed_14f5c_97",VC="_emptyMessage_14f5c_108",Qn={progressBar:EC,progressFill:AC,activeTask:DC,activeIcon:RC,todoPulse:MC,activeText:IC,checklist:OC,item:LC,itemIcon:BC,itemText:zC,pending:UC,in_progress:$C,completed:PC,emptyMessage:VC},HC=/^[-*]\s*\[([ xX~!/])\]\s*(.+)$/;function qC(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:iy(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:iy(i.status)})):typeof s.content=="string"?GC(s.content):[]}function iy(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 GC(t){const s=t.split(`
239
- `),i=[];for(const o of s){const c=HC.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 FC(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 ZC({args:t}){const s=qC(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:`${M.card} ${M.cardBlue}`,"data-testid":"tool-card-todo",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,children:r.jsx(h2,{size:Gt})}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:c?"Todos cleared":"Todos"}),!c&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.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:FC(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 KC(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 YC({tool:t,args:s}){const i=KC(t,s);return r.jsxs("div",{className:M.metadata,"data-testid":"tool-card-metadata",children:[r.jsx("span",{className:M.metadataPrefix,children:r.jsx(n2,{size:it})}),i]})}function JC(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 WC(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 Uf=5,$f=5;function XC({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=Eo(t),p=JC(s),h=i===void 0,{single:g,list:v}=WC(i),y=(g==null?void 0:g.title)??p.title,b=v?void 0:(g==null?void 0:g.category)??p.category,k=v?void 0:(g==null?void 0:g.tags)??p.tags;return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardPurple} ${h?M.inProgress:""}`,"data-testid":"tool-card-finding",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,"aria-hidden":"true",children:"💡"}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:d}),y&&r.jsxs("span",{className:M.fileName,"data-testid":"tool-card-finding-title",children:['"',y,'"']}),b&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsx("span",{className:M.badge,"data-testid":"tool-card-finding-category",children:b})]}),v&&!b&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.badge,"data-testid":"tool-card-finding-count",children:[v.length," ",v.length===1?"finding":"findings"]})]})]}),k&&k.length>0&&r.jsx("div",{className:M.pre,style:{padding:"4px 8px",whiteSpace:"normal"},"data-testid":"tool-card-finding-tags",children:k.map((S,N)=>r.jsxs("span",{style:{display:"inline-block",marginRight:"6px",opacity:.7,fontSize:"0.85em"},children:["#",S]},N))}),h&&!y&&s!==null&&s!==void 0&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:M.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
- `),N=S.length>$f,j=c?g.content:S.slice(0,$f).join(`
241
- `);return r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-content",children:j}),N&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(T=>!T)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${S.length-$f} more lines`]})]})})()}),!o&&v&&v.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-finding-list",children:(c?v:v.slice(0,Uf)).map((S,N)=>`${S.category?`[${S.category}] `:""}${S.title??S.id??`Finding ${N+1}`}`).join(`
242
- `)}),v.length>Uf&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Uf} more findings`]})]})]})}function QC(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 eE(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 oy(t){switch(t){case"complete":case"completed":return"✓";case"working":case"in_progress":return"●";case"paused":return"⏸";case"failed":return"✗";default:return"○"}}function tE(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 Pf=5;function nE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=Eo(t),p=QC(s),h=i===void 0,{single:g,list:v,sessionId:y}=eE(i),b=(g==null?void 0:g.title)??p.title,k=(g==null?void 0:g.status)??p.status;return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardBlue} ${h?M.inProgress:""}`,"data-testid":"tool-card-task",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📋"}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:d}),b&&r.jsxs("span",{className:M.fileName,"data-testid":"tool-card-task-title",children:['"',b,'"']}),!b&&p.taskId&&r.jsx("span",{className:M.fileName,"data-testid":"tool-card-task-id",children:p.taskId}),k&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.badge,style:{color:tE(k)},"data-testid":"tool-card-task-status",children:[oy(k)," ",k]})]}),v&&!k&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.badge,"data-testid":"tool-card-task-count",children:[v.length," ",v.length===1?"task":"tasks"]})]})]}),h&&!b&&!p.taskId&&s!==null&&s!==void 0&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&y&&r.jsxs("div",{className:M.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:M.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:M.pre,"data-testid":"tool-card-task-list",children:(c?v:v.slice(0,Pf)).map(S=>{const N=oy(S.status),j=S.title??S.id??"untitled";return`${N} ${j}`}).join(`
244
- `)}),v.length>Pf&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(S=>!S)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${v.length-Pf} more tasks`]})]})]})}function sE(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 aE(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 iE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=Eo(t),p=sE(s),h=i===void 0,g=aE(i),v=g.status??p.status,y=g.summary??p.summary;return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardGreen} ${h?M.inProgress:""}`,"data-testid":"tool-card-workpad",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,"aria-hidden":"true",children:"📓"}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-green, #4ade80)"},children:d}),v&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsx("span",{className:M.badge,"data-testid":"tool-card-workpad-status",children:v})]})]}),y&&r.jsx("pre",{className:M.pre,style:{whiteSpace:"pre-wrap"},"data-testid":"tool-card-workpad-summary",children:y}),h&&!y&&s!==null&&s!==void 0&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&!y&&!v&&!g.extra&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:i}),!o&&g.extra&&r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":"extra data"]}),c&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-workpad-extra",children:JSON.stringify(g.extra,null,2)})]})]})}function oE(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 rE(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 Vf=5;function lE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=Eo(t),p=oE(s),h=i===void 0,g=rE(i);return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardPurple} ${h?M.inProgress:""}`,"data-testid":"tool-card-knowledge",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🧠"}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-purple, #a78bfa)"},children:d}),p.query&&r.jsxs("span",{className:M.fileName,"data-testid":"tool-card-knowledge-query",children:['"',p.query,'"']}),p.id&&!p.query&&r.jsx("span",{className:M.fileName,"data-testid":"tool-card-knowledge-id",children:p.id}),g.results&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.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:M.spacer}),r.jsxs("span",{className:M.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:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&g.results&&g.results.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-knowledge-results",children:(c?g.results:g.results.slice(0,Vf)).map(v=>{var k,S,N;const y=((k=v.node)==null?void 0:k.title)??((S=v.node)==null?void 0:S.label)??((N=v.node)==null?void 0:N.id)??"node",b=v.score!==void 0?` (${(v.score*100).toFixed(0)}%)`:"";return`${y}${b}`}).join(`
245
- `)}),g.results.length>Vf&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(v=>!v)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.results.length-Vf} more results`]})]}),!o&&g.node&&!g.results&&r.jsx("pre",{className:M.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 cE(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 uE(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 dE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),d=Eo(t),p=cE(s),h=i===void 0,g=uE(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:`${M.card} ${o?M.cardRed:M.cardOrange} ${h?M.inProgress:""}`,"data-testid":"tool-card-ipc",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔀"}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-yellow, #fbbf24)"},children:d}),v&&r.jsx("span",{className:M.fileName,"data-testid":"tool-card-ipc-info",children:v}),y&&r.jsx("span",{className:M.fileName,title:p.prompt,"data-testid":"tool-card-ipc-prompt",children:y}),g.fds&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.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:M.spacer}),r.jsx("span",{className:M.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:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(s,null,2)}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&g.sessionId&&r.jsxs("div",{className:M.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:M.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:M.pre,"data-testid":"tool-card-ipc-fds",children:(c?g.fds:g.fds.slice(0,5)).map(b=>{const k=[`fd:${b.fd??"?"}`,b.permission??"",b.deliveryMode??""];return b.streamName&&k.push(b.streamName),b.owned&&k.push("(owned)"),k.filter(Boolean).join(" ")}).join(`
247
- `)}),g.fds.length>5&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(b=>!b)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${g.fds.length-5} more fds`]})]})]})}function fE(t){if(t==null||typeof t!="object")return"";const s=t;return typeof s.query=="string"?s.query:""}const Hf=8;function pE({args:t,result:s,isError:i}){const[o,c]=_.useState(!1),u=fE(t),d=s===void 0,p=(s==null?void 0:s.split(`
248
- `))??[],h=p.length>Hf,g=o?s:p.slice(0,Hf).join(`
249
- `);return r.jsxs("div",{className:`${M.card} ${i?M.cardRed:M.cardNeutral} ${d?M.inProgress:""}`,"data-testid":"tool-card-tool-search",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,"aria-hidden":"true",children:"🔧"}),r.jsx("span",{className:M.toolName,children:"ToolSearch"}),u&&r.jsxs("span",{className:M.fileName,"data-testid":"tool-card-tool-search-query",children:['"',u,'"']}),!d&&!i&&s&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:M.spacer}),r.jsxs("span",{className:M.badge,"data-testid":"tool-card-tool-search-count",children:[p.length," lines"]})]})]}),d&&!u&&t!==null&&t!==void 0&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:JSON.stringify(t,null,2)}),i&&s&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:s}),!i&&!d&&s&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-tool-search-result",children:g}),h&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{c(v=>!v)},"aria-expanded":o,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${o?M.chevronExpanded:""}`,children:"▸"}),o?"collapse":`${p.length-Hf} more lines`]})]})]})}function mE(t){const s=/^mcp__([^_]+(?:_[^_]+)*)__(.+)$/.exec(t);return s?{display:`${s[1]} / ${s[2]}`,isMcp:!0}:{display:t,isMcp:!1}}function hE(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 qf=5;function gE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),{display:d}=mE(t),p=hE(s),h=i===void 0,g=(i==null?void 0:i.split(`
250
- `))??[],v=g.length>qf,y=c?i:g.slice(0,qf).join(`
251
- `);let b="";if(s!=null)try{b=JSON.stringify(s,null,2)}catch{b=String(s)}return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardBlue} ${h?M.inProgress:""}`,"data-testid":"tool-card-generic",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,children:r.jsx(XT,{size:Gt,"aria-hidden":"true"})}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-blue)"},children:d}),p&&r.jsx("span",{className:M.fileName,children:p})]}),h&&b&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-args",children:b}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&!h&&i&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:y}),v&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(k=>!k)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,"aria-hidden":"true",children:r.jsx(Qs,{size:it})}),c?"collapse":`${g.length-qf} more lines`]})]})]})}const vE="_badgePill_o7eqc_1",yE="_modelBadge_o7eqc_14",bE="_backgroundBadge_o7eqc_26",_E="_backgroundDot_o7eqc_36",xE="_backgroundDotPulsing_o7eqc_41",kE="_description_o7eqc_55",SE="_statusLine_o7eqc_62",TE="_statusCompleted_o7eqc_72",wE="_statusRunning_o7eqc_77",NE="_statusError_o7eqc_83",jE="_promptToggle_o7eqc_88",es={badgePill:vE,modelBadge:yE,backgroundBadge:bE,backgroundDot:_E,backgroundDotPulsing:xE,description:kE,statusLine:SE,statusCompleted:TE,statusRunning:wE,statusError:NE,promptToggle:jE};function CE(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 EE=/^Agent\s+(completed|running|failed|error)\.\s*agent_id:\s*(\S+),?\s*([^\n]*)(?:\n\n([\s\S]*))?$/i;function AE(t){const s=EE.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 Gf=5;function DE({tool:t,args:s,result:i,isError:o}){const[c,u]=_.useState(!1),[d,p]=_.useState(!1),h=CE(t,s),g=i===void 0,v=h.isPoll&&i?AE(i):void 0,y=(v==null?void 0:v.content)??i,b=(y==null?void 0:y.split(`
252
- `))??[],k=b.length>Gf,S=c?y:b.slice(0,Gf).join(`
253
- `),N=h.isPoll?"Subagent":"Agent";return r.jsxs("div",{className:`${M.card} ${o?M.cardRed:M.cardTeal} ${g?M.inProgress:""}`,"data-testid":"tool-card-agent",children:[r.jsxs("div",{className:M.header,children:[r.jsx("span",{className:M.icon,style:{color:"var(--accent-teal, #2dd4bf)"},children:"▶"}),r.jsx("span",{className:M.toolName,style:{color:"var(--accent-teal, #2dd4bf)"},children:N}),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:M.fileName,"data-testid":"tool-card-agent-name",children:h.agentName}),h.agentId&&r.jsx("span",{className:M.fileName,"data-testid":"tool-card-agent-id",children:h.agentId}),r.jsx("span",{className:M.spacer}),g&&!h.isBackground&&r.jsx("span",{className:M.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(j=>!j)},"aria-expanded":d,"data-testid":"tool-card-prompt-toggle",children:[r.jsx("span",{className:`${M.chevron} ${d?M.chevronExpanded:""}`,children:"▸"}),"prompt"]}),d&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-prompt",children:h.prompt})]}),o&&i&&r.jsx("pre",{className:M.pre,"data-testid":"tool-card-error",children:i}),!o&&!g&&y&&r.jsxs(r.Fragment,{children:[r.jsx("pre",{className:M.pre,"data-testid":"tool-card-result",children:S}),k&&r.jsxs("button",{type:"button",className:M.bodyToggle,onClick:()=>{u(j=>!j)},"aria-expanded":c,"data-testid":"tool-card-toggle",children:[r.jsx("span",{className:`${M.chevron} ${c?M.chevronExpanded:""}`,children:"▸"}),c?"collapse":`${b.length-Gf} more lines`]})]})]})}function Ff(t){switch(Lj(t.tool)){case"file-read":return r.jsx(ay,{...t});case"file-edit":return r.jsx(xC,{...t});case"file-write":return r.jsx(ay,{...t,writeVariant:!0});case"shell":return r.jsx(NC,{...t});case"search":return r.jsx(CC,{...t});case"todo":return r.jsx(ZC,{...t});case"metadata":return r.jsx(YC,{...t});case"finding":return r.jsx(XC,{...t});case"task":return r.jsx(nE,{...t});case"workpad":return r.jsx(iE,{...t});case"knowledge":return r.jsx(lE,{...t});case"ipc":return r.jsx(dE,{...t});case"tool-search":return r.jsx(pE,{...t});case"agent":return r.jsx(DE,{...t});default:return r.jsx(gE,{...t})}}const RE="_systemContextEvent_hmqlm_1",ME="_systemContextHeader_hmqlm_7",IE="_systemContextBadge_hmqlm_28",OE="_systemContextToggle_hmqlm_37",LE="_systemContextPre_hmqlm_43",BE="_systemContextEllipsis_hmqlm_54",zE="_systemEvent_hmqlm_58",UE="_systemTimestamp_hmqlm_65",$E="_textEvent_hmqlm_69",PE="_codeBlockWrapper_hmqlm_156",VE="_codeBlockCopyButton_hmqlm_159",HE="_errorEvent_hmqlm_163",qE="_statusEvent_hmqlm_171",GE="_userInputEvent_hmqlm_180",FE="_userInputContent_hmqlm_186",ZE="_signalEvent_hmqlm_203",KE="_signalBadge_hmqlm_214",YE="_signalContent_hmqlm_223",JE="_usageEvent_hmqlm_228",WE="_usageBadge_hmqlm_235",XE="_defaultEvent_hmqlm_244",It={systemContextEvent:RE,systemContextHeader:ME,systemContextBadge:IE,systemContextToggle:OE,systemContextPre:LE,systemContextEllipsis:BE,systemEvent:zE,systemTimestamp:UE,textEvent:$E,codeBlockWrapper:PE,codeBlockCopyButton:VE,errorEvent:HE,statusEvent:qE,userInputEvent:GE,userInputContent:FE,signalEvent:ZE,signalBadge:KE,signalContent:YE,usageEvent:JE,usageBadge:WE,defaultEvent:XE},ry=3;function QE({content:t}){const[s,i]=_.useState(!1),o=t.split(`
254
- `),c=o.length>ry,u=s?t:o.slice(0,ry).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(Qb,{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 eA({time:t,content:s}){return r.jsxs("div",{className:It.systemEvent,children:[r.jsxs("span",{className:It.systemTimestamp,children:["[",t,"]"]})," ",s]})}function Sp(t){return typeof t=="string"?t:typeof t=="number"?String(t):Array.isArray(t)?t.map(Sp).join(""):t!=null&&typeof t=="object"&&"props"in t?Sp(t.props.children):""}function tA({children:t,node:s,...i}){const o=Sp(t);return r.jsxs("div",{className:It.codeBlockWrapper,children:[r.jsx("pre",{...i,children:t}),r.jsx(mj,{text:o,"data-testid":"copy-code-block",className:It.codeBlockCopyButton})]})}const nA={pre:tA};function sA({content:t}){return r.jsx("div",{className:It.textEvent,children:r.jsx(nu,{remarkPlugins:[su],rehypePlugins:[Ij],components:nA,children:t})})}function aA({content:t}){return r.jsxs("div",{className:It.errorEvent,children:["Error: ",t]})}function iA({content:t}){return r.jsxs("div",{className:It.statusEvent,children:["--- ",t," ---"]})}function oA({content:t}){return r.jsx("div",{className:It.userInputEvent,children:r.jsx("span",{className:It.userInputContent,children:t})})}function rA({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 lA({content:t}){let s=t;try{const i=JSON.parse(t),o=Number(i.input_tokens)||0,c=Number(i.output_tokens)||0,u=w_(o+c),d=So(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 cA({content:t}){return r.jsx("div",{className:It.defaultEvent,children:t})}function uA({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(QE,{content:t.content})}catch{}return r.jsx(eA,{time:o,content:t.content})}case"text":case"output":return r.jsx(sA,{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(Ff,{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(Ff,{tool:s.tool,args:s.args,result:u,isError:c,detailedResult:s.detailedResult}):r.jsx(Ff,{tool:"Tool output",args:void 0,result:u,isError:c})}case"error":return r.jsx(aA,{content:t.content});case"status":return r.jsx(iA,{content:t.content});case"user_input":return r.jsx(oA,{content:t.content});case"signal":return r.jsx(rA,{content:t.content});case"usage":return r.jsx(lA,{content:t.content});default:return r.jsx(cA,{content:t.content})}}const sm=_.createContext({});function am(t){const s=_.useRef(null);return s.current===null&&(s.current=t()),s.current}const cu=_.createContext(null),im=_.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});class dA extends _.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 fA({children:t,isPresent:s}){const i=_.useId(),o=_.useRef(null),c=_.useRef({width:0,height:0,top:0,left:0}),{nonce:u}=_.useContext(im);return _.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(dA,{isPresent:s,childRef:o,sizeRef:c,children:_.cloneElement(t,{ref:o})})}const pA=({children:t,initial:s,isPresent:i,onExitComplete:o,custom:c,presenceAffectsLayout:u,mode:d})=>{const p=am(mA),h=_.useId(),g=_.useCallback(y=>{p.set(y,!0);for(const b of p.values())if(!b)return;o&&o()},[p,o]),v=_.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 _.useMemo(()=>{p.forEach((y,b)=>p.set(b,!1))},[i]),_.useEffect(()=>{!i&&!p.size&&o&&o()},[i]),d==="popLayout"&&(t=r.jsx(fA,{isPresent:i,children:t})),r.jsx(cu.Provider,{value:v,children:t})};function mA(){return new Map}function N_(t=!0){const s=_.useContext(cu);if(s===null)return[!0,null];const{isPresent:i,onExitComplete:o,register:c}=s,u=_.useId();_.useEffect(()=>{t&&c(u)},[t]);const d=_.useCallback(()=>t&&o&&o(u),[u,o,t]);return!i&&o?[!1,d]:[!0]}const Tc=t=>t.key||"";function ly(t){const s=[];return _.Children.forEach(t,i=>{_.isValidElement(i)&&s.push(i)}),s}const om=typeof window<"u",j_=om?_.useLayoutEffect:_.useEffect,os=({children:t,custom:s,initial:i=!0,onExitComplete:o,presenceAffectsLayout:c=!0,mode:u="sync",propagate:d=!1})=>{const[p,h]=N_(d),g=_.useMemo(()=>ly(t),[t]),v=d&&!p?[]:g.map(Tc),y=_.useRef(!0),b=_.useRef(g),k=am(()=>new Map),[S,N]=_.useState(g),[j,T]=_.useState(g);j_(()=>{y.current=!1,b.current=g;for(let A=0;A<j.length;A++){const I=Tc(j[A]);v.includes(I)?k.delete(I):k.get(I)!==!0&&k.set(I,!1)}},[j,v.length,v.join("-")]);const C=[];if(g!==S){let A=[...g];for(let I=0;I<j.length;I++){const D=j[I],B=Tc(D);v.includes(B)||(A.splice(I,0,D),C.push(D))}u==="wait"&&C.length&&(A=C),T(ly(A)),N(g);return}const{forceRender:E}=_.useContext(sm);return r.jsx(r.Fragment,{children:j.map(A=>{const I=Tc(A),D=d&&!p?!1:g===j||v.includes(I),B=()=>{if(k.has(I))k.set(I,!0);else return;let z=!0;k.forEach(X=>{X||(z=!1)}),z&&(E==null||E(),T(b.current),d&&(h==null||h()),o&&o())};return r.jsx(pA,{isPresent:D,initial:!y.current||i?void 0:!1,custom:D?void 0:s,presenceAffectsLayout:c,mode:u,onExitComplete:D?void 0:B,children:A},I)})})},jn=t=>t;let C_=jn;const hA={useManualTiming:!1};function gA(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 wc=["read","resolveKeyframes","update","preRender","render","postRender"],vA=40;function E_(t,s){let i=!1,o=!0;const c={delta:0,timestamp:0,isProcessing:!1},u=()=>i=!0,d=wc.reduce((T,C)=>(T[C]=gA(u),T),{}),{read:p,resolveKeyframes:h,update:g,preRender:v,render:y,postRender:b}=d,k=()=>{const T=performance.now();i=!1,c.delta=o?1e3/60:Math.max(Math.min(T-c.timestamp,vA),1),c.timestamp=T,c.isProcessing=!0,p.process(c),h.process(c),g.process(c),v.process(c),y.process(c),b.process(c),c.isProcessing=!1,i&&s&&(o=!1,t(k))},S=()=>{i=!0,o=!0,c.isProcessing||t(k)};return{schedule:wc.reduce((T,C)=>{const E=d[C];return T[C]=(A,I=!1,D=!1)=>(i||S(),E.schedule(A,I,D)),T},{}),cancel:T=>{for(let C=0;C<wc.length;C++)d[wc[C]].cancel(T)},state:c,steps:d}}const{schedule:yt,cancel:Ia,state:Wt,steps:Zf}=E_(typeof requestAnimationFrame<"u"?requestAnimationFrame:jn,!0),A_=_.createContext({strict:!1}),cy={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"]},To={};for(const t in cy)To[t]={isEnabled:s=>cy[t].some(i=>!!s[i])};function yA(t){for(const s in t)To[s]={...To[s],...t[s]}}const bA=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 Gc(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||bA.has(t)}let D_=t=>!Gc(t);function _A(t){t&&(D_=s=>s.startsWith("on")?!Gc(s):t(s))}try{_A(require("@emotion/is-prop-valid").default)}catch{}function xA(t,s,i){const o={};for(const c in t)c==="values"&&typeof t.values=="object"||(D_(c)||i===!0&&Gc(c)||!s&&!Gc(c)||t.draggable&&c.startsWith("onDrag"))&&(o[c]=t[c]);return o}function kA(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 uu=_.createContext({});function Hr(t){return typeof t=="string"||Array.isArray(t)}function du(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const rm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],lm=["initial",...rm];function fu(t){return du(t.animate)||lm.some(s=>Hr(t[s]))}function R_(t){return!!(fu(t)||t.variants)}function SA(t,s){if(fu(t)){const{initial:i,animate:o}=t;return{initial:i===!1||Hr(i)?i:void 0,animate:Hr(o)?o:void 0}}return t.inherit!==!1?s:{}}function TA(t){const{initial:s,animate:i}=SA(t,_.useContext(uu));return _.useMemo(()=>({initial:s,animate:i}),[uy(s),uy(i)])}function uy(t){return Array.isArray(t)?t.join(" "):t}const wA=Symbol.for("motionComponentSymbol");function ho(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function NA(t,s,i){return _.useCallback(o=>{o&&t.onMount&&t.onMount(o),s&&(o?s.mount(o):s.unmount()),i&&(typeof i=="function"?i(o):ho(i)&&(i.current=o))},[s])}const cm=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),jA="framerAppearId",M_="data-"+cm(jA),{schedule:um}=E_(queueMicrotask,!1),I_=_.createContext({});function CA(t,s,i,o,c){var u,d;const{visualElement:p}=_.useContext(uu),h=_.useContext(A_),g=_.useContext(cu),v=_.useContext(im).reducedMotion,y=_.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 b=y.current,k=_.useContext(I_);b&&!b.projection&&c&&(b.type==="html"||b.type==="svg")&&EA(y.current,i,c,k);const S=_.useRef(!1);_.useInsertionEffect(()=>{b&&S.current&&b.update(i,g)});const N=i[M_],j=_.useRef(!!N&&!(!((u=window.MotionHandoffIsComplete)===null||u===void 0)&&u.call(window,N))&&((d=window.MotionHasOptimisedAnimation)===null||d===void 0?void 0:d.call(window,N)));return j_(()=>{b&&(S.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),um.render(b.render),j.current&&b.animationState&&b.animationState.animateChanges())}),_.useEffect(()=>{b&&(!j.current&&b.animationState&&b.animationState.animateChanges(),j.current&&(queueMicrotask(()=>{var T;(T=window.MotionHandoffMarkAsComplete)===null||T===void 0||T.call(window,N)}),j.current=!1))}),b}function EA(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:O_(t.parent)),t.projection.setOptions({layoutId:c,layout:u,alwaysMeasureLayout:!!d||p&&ho(p),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:h,layoutRoot:g})}function O_(t){if(t)return t.options.allowProjection!==!1?t.projection:O_(t.parent)}function AA({preloadedFeatures:t,createVisualElement:s,useRender:i,useVisualState:o,Component:c}){var u,d;t&&yA(t);function p(g,v){let y;const b={..._.useContext(im),...g,layoutId:DA(g)},{isStatic:k}=b,S=TA(g),N=o(g,k);if(!k&&om){RA();const j=MA(b);y=j.MeasureLayout,S.visualElement=CA(c,N,b,s,j.ProjectionNode)}return r.jsxs(uu.Provider,{value:S,children:[y&&S.visualElement?r.jsx(y,{visualElement:S.visualElement,...b}):null,i(c,g,NA(N,S.visualElement,v),N,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=_.forwardRef(p);return h[wA]=c,h}function DA({layoutId:t}){const s=_.useContext(sm).id;return s&&t!==void 0?s+"-"+t:t}function RA(t,s){_.useContext(A_).strict}function MA(t){const{drag:s,layout:i}=To;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 IA=["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 dm(t){return typeof t!="string"||t.includes("-")?!1:!!(IA.indexOf(t)>-1||/[A-Z]/u.test(t))}function dy(t){const s=[{},{}];return t==null||t.values.forEach((i,o)=>{s[0][o]=i.get(),s[1][o]=i.getVelocity()}),s}function fm(t,s,i,o){if(typeof s=="function"){const[c,u]=dy(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]=dy(o);s=s(i!==void 0?i:t.custom,c,u)}return s}const Tp=t=>Array.isArray(t),OA=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),LA=t=>Tp(t)?t[t.length-1]||0:t,nn=t=>!!(t&&t.getVelocity);function zc(t){const s=nn(t)?t.get():t;return OA(s)?s.toValue():s}function BA({scrapeMotionValuesFromProps:t,createRenderState:s,onUpdate:i},o,c,u){const d={latestValues:zA(o,c,u,t),renderState:s()};return i&&(d.onMount=p=>i({props:o,current:p,...d}),d.onUpdate=p=>i(p)),d}const L_=t=>(s,i)=>{const o=_.useContext(uu),c=_.useContext(cu),u=()=>BA(t,s,o,c);return i?u():am(u)};function zA(t,s,i,o){const c={},u=o(t,{});for(const b in u)c[b]=zc(u[b]);let{initial:d,animate:p}=t;const h=fu(t),g=R_(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"&&!du(y)){const b=Array.isArray(y)?y:[y];for(let k=0;k<b.length;k++){const S=fm(t,b[k]);if(S){const{transitionEnd:N,transition:j,...T}=S;for(const C in T){let E=T[C];if(Array.isArray(E)){const A=v?E.length-1:0;E=E[A]}E!==null&&(c[C]=E)}for(const C in N)c[C]=N[C]}}}return c}const Ao=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Si=new Set(Ao),B_=t=>s=>typeof s=="string"&&s.startsWith(t),z_=B_("--"),UA=B_("var(--"),pm=t=>UA(t)?$A.test(t.split("/*")[0].trim()):!1,$A=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,U_=(t,s)=>s&&typeof t=="number"?s.transform(t):t,Ws=(t,s,i)=>i>s?s:i<t?t:i,Do={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},qr={...Do,transform:t=>Ws(0,1,t)},Nc={...Do,default:1},Qr=t=>({test:s=>typeof s=="string"&&s.endsWith(t)&&s.split(" ").length===1,parse:parseFloat,transform:s=>`${s}${t}`}),Da=Qr("deg"),bs=Qr("%"),we=Qr("px"),PA=Qr("vh"),VA=Qr("vw"),fy={...bs,parse:t=>bs.parse(t)/100,transform:t=>bs.transform(t*100)},HA={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},qA={rotate:Da,rotateX:Da,rotateY:Da,rotateZ:Da,scale:Nc,scaleX:Nc,scaleY:Nc,scaleZ:Nc,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:qr,originX:fy,originY:fy,originZ:we},py={...Do,transform:Math.round},mm={...HA,...qA,zIndex:py,size:we,fillOpacity:qr,strokeOpacity:qr,numOctaves:py},GA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},FA=Ao.length;function ZA(t,s,i){let o="",c=!0;for(let u=0;u<FA;u++){const d=Ao[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=U_(p,mm[d]);if(!h){c=!1;const v=GA[d]||d;o+=`${v}(${g}) `}i&&(s[d]=g)}}return o=o.trim(),i?o=i(s,c?"":o):c&&(o="none"),o}function hm(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(z_(h)){c[h]=g;continue}else{const v=U_(g,mm[h]);h.startsWith("origin")?(p=!0,u[h]=v):o[h]=v}}if(s.transform||(d||i?o.transform=ZA(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 KA={offset:"stroke-dashoffset",array:"stroke-dasharray"},YA={offset:"strokeDashoffset",array:"strokeDasharray"};function JA(t,s,i=1,o=0,c=!0){t.pathLength=1;const u=c?KA:YA;t[u.offset]=we.transform(-o);const d=we.transform(s),p=we.transform(i);t[u.array]=`${d} ${p}`}function my(t,s,i){return typeof t=="string"?t:we.transform(s+i*t)}function WA(t,s,i){const o=my(s,t.x,t.width),c=my(i,t.y,t.height);return`${o} ${c}`}function gm(t,{attrX:s,attrY:i,attrScale:o,originX:c,originY:u,pathLength:d,pathSpacing:p=1,pathOffset:h=0,...g},v,y){if(hm(t,g,y),v){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:b,style:k,dimensions:S}=t;b.transform&&(S&&(k.transform=b.transform),delete b.transform),S&&(c!==void 0||u!==void 0||k.transform)&&(k.transformOrigin=WA(S,c!==void 0?c:.5,u!==void 0?u:.5)),s!==void 0&&(b.x=s),i!==void 0&&(b.y=i),o!==void 0&&(b.scale=o),d!==void 0&&JA(b,d,p,h,!1)}const vm=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),$_=()=>({...vm(),attrs:{}}),ym=t=>typeof t=="string"&&t.toLowerCase()==="svg";function P_(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 V_=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 H_(t,s,i,o){P_(t,s,void 0,o);for(const c in s.attrs)t.setAttribute(V_.has(c)?c:cm(c),s.attrs[c])}const Fc={};function XA(t){Object.assign(Fc,t)}function q_(t,{layout:s,layoutId:i}){return Si.has(t)||t.startsWith("origin")||(s||i!==void 0)&&(!!Fc[t]||t==="opacity")}function bm(t,s,i){var o;const{style:c}=t,u={};for(const d in c)(nn(c[d])||s.style&&nn(s.style[d])||q_(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 G_(t,s,i){const o=bm(t,s,i);for(const c in t)if(nn(t[c])||nn(s[c])){const u=Ao.indexOf(c)!==-1?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c;o[u]=t[c]}return o}function QA(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 hy=["x","y","width","height","cx","cy","r"],eD={useVisualState:L_({scrapeMotionValuesFromProps:G_,createRenderState:$_,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<hy.length;p++){const h=hy[p];t[h]!==s[h]&&(d=!0)}d&&yt.read(()=>{QA(i,o),yt.render(()=>{gm(o,c,ym(i.tagName),t.transformTemplate),H_(i,o)})})}})},tD={useVisualState:L_({scrapeMotionValuesFromProps:bm,createRenderState:vm})};function F_(t,s,i){for(const o in s)!nn(s[o])&&!q_(o,i)&&(t[o]=s[o])}function nD({transformTemplate:t},s){return _.useMemo(()=>{const i=vm();return hm(i,s,t),Object.assign({},i.vars,i.style)},[s])}function sD(t,s){const i=t.style||{},o={};return F_(o,i,t),Object.assign(o,nD(t,s)),o}function aD(t,s){const i={},o=sD(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 iD(t,s,i,o){const c=_.useMemo(()=>{const u=$_();return gm(u,s,ym(o),t.transformTemplate),{...u.attrs,style:{...u.style}}},[s]);if(t.style){const u={};F_(u,t.style,t),c.style={...u,...c.style}}return c}function oD(t=!1){return(i,o,c,{latestValues:u},d)=>{const h=(dm(i)?iD:aD)(o,u,d,i),g=xA(o,typeof i=="string",t),v=i!==_.Fragment?{...g,...h,ref:c}:{},{children:y}=o,b=_.useMemo(()=>nn(y)?y.get():y,[y]);return _.createElement(i,{...v,children:b})}}function rD(t,s){return function(o,{forwardMotionProps:c}={forwardMotionProps:!1}){const d={...dm(o)?eD:tD,preloadedFeatures:t,useRender:oD(c),createVisualElement:s,Component:o};return AA(d)}}function Z_(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 pu(t,s,i){const o=t.getProps();return fm(o,s,i!==void 0?i:o.custom,t)}function _m(t,s){return t?t[s]||t.default||t:void 0}const K_=new Set(["width","height","top","left","right","bottom",...Ao]);let Uc;function lD(){Uc=void 0}const _s={now:()=>(Uc===void 0&&_s.set(Wt.isProcessing||hA.useManualTiming?Wt.timestamp:performance.now()),Uc),set:t=>{Uc=t,queueMicrotask(lD)}};function xm(t,s){t.indexOf(s)===-1&&t.push(s)}function km(t,s){const i=t.indexOf(s);i>-1&&t.splice(i,1)}class Sm{constructor(){this.subscriptions=[]}add(s){return xm(this.subscriptions,s),()=>km(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 Y_(t,s){return s?t*(1e3/s):0}const gy=30,cD=t=>!isNaN(parseFloat(t));class uD{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=cD(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 Sm);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>gy)return 0;const i=Math.min(this.updatedAt-this.prevUpdatedAt,gy);return Y_(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 Gr(t,s){return new uD(t,s)}function dD(t,s,i){t.hasValue(s)?t.getValue(s).set(i):t.addValue(s,Gr(i))}function fD(t,s){const i=pu(t,s);let{transitionEnd:o={},transition:c={},...u}=i||{};u={...u,...o};for(const d in u){const p=LA(u[d]);dD(t,d,p)}}function pD(t){return!!(nn(t)&&t.add)}function wp(t,s){const i=t.getValue("willChange");if(pD(i))return i.add(s)}function J_(t){return t.props[M_]}function Tm(t){let s;return()=>(s===void 0&&(s=t()),s)}const mD=Tm(()=>window.ScrollTimeline!==void 0);class hD{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(mD()&&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 gD extends hD{then(s,i){return Promise.all(this.animations).then(s).catch(i)}}const Zs=t=>t*1e3,Ks=t=>t/1e3;function wm(t){return typeof t=="function"}function vy(t,s){t.timeline=s,t.onfinish=null}const Nm=t=>Array.isArray(t)&&typeof t[0]=="number",vD={linearEasing:void 0};function yD(t,s){const i=Tm(t);return()=>{var o;return(o=vD[s])!==null&&o!==void 0?o:i()}}const Zc=yD(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),wo=(t,s,i)=>{const o=s-t;return o===0?1:(i-t)/o},W_=(t,s,i=10)=>{let o="";const c=Math.max(Math.round(s/i),2);for(let u=0;u<c;u++)o+=t(wo(0,c-1,u))+", ";return`linear(${o.substring(0,o.length-2)})`};function X_(t){return!!(typeof t=="function"&&Zc()||!t||typeof t=="string"&&(t in Np||Zc())||Nm(t)||Array.isArray(t)&&t.every(X_))}const Er=([t,s,i,o])=>`cubic-bezier(${t}, ${s}, ${i}, ${o})`,Np={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Er([0,.65,.55,1]),circOut:Er([.55,0,1,.45]),backIn:Er([.31,.01,.66,-.59]),backOut:Er([.33,1.53,.69,.99])};function Q_(t,s){if(t)return typeof t=="function"&&Zc()?W_(t,s):Nm(t)?Er(t):Array.isArray(t)?t.map(i=>Q_(i,s)||Np.easeOut):Np[t]}const e1=(t,s,i)=>(((1-3*i+3*s)*t+(3*i-6*s))*t+3*s)*t,bD=1e-7,_D=12;function xD(t,s,i,o,c){let u,d,p=0;do d=s+(i-s)/2,u=e1(d,o,c)-t,u>0?i=d:s=d;while(Math.abs(u)>bD&&++p<_D);return d}function el(t,s,i,o){if(t===s&&i===o)return jn;const c=u=>xD(u,0,1,t,i);return u=>u===0||u===1?u:e1(c(u),s,o)}const t1=t=>s=>s<=.5?t(2*s)/2:(2-t(2*(1-s)))/2,n1=t=>s=>1-t(1-s),s1=el(.33,1.53,.69,.99),jm=n1(s1),a1=t1(jm),i1=t=>(t*=2)<1?.5*jm(t):.5*(2-Math.pow(2,-10*(t-1))),Cm=t=>1-Math.sin(Math.acos(t)),o1=n1(Cm),r1=t1(Cm),l1=t=>/^0[^.\s]+$/u.test(t);function kD(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||l1(t):!0}const Ir=t=>Math.round(t*1e5)/1e5,Em=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function SD(t){return t==null}const TD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Am=(t,s)=>i=>!!(typeof i=="string"&&TD.test(i)&&i.startsWith(t)||s&&!SD(i)&&Object.prototype.hasOwnProperty.call(i,s)),c1=(t,s,i)=>o=>{if(typeof o!="string")return o;const[c,u,d,p]=o.match(Em);return{[t]:parseFloat(c),[s]:parseFloat(u),[i]:parseFloat(d),alpha:p!==void 0?parseFloat(p):1}},wD=t=>Ws(0,255,t),Kf={...Do,transform:t=>Math.round(wD(t))},pi={test:Am("rgb","red"),parse:c1("red","green","blue"),transform:({red:t,green:s,blue:i,alpha:o=1})=>"rgba("+Kf.transform(t)+", "+Kf.transform(s)+", "+Kf.transform(i)+", "+Ir(qr.transform(o))+")"};function ND(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 jp={test:Am("#"),parse:ND,transform:pi.transform},go={test:Am("hsl","hue"),parse:c1("hue","saturation","lightness"),transform:({hue:t,saturation:s,lightness:i,alpha:o=1})=>"hsla("+Math.round(t)+", "+bs.transform(Ir(s))+", "+bs.transform(Ir(i))+", "+Ir(qr.transform(o))+")"},tn={test:t=>pi.test(t)||jp.test(t)||go.test(t),parse:t=>pi.test(t)?pi.parse(t):go.test(t)?go.parse(t):jp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?pi.transform(t):go.transform(t)},jD=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function CD(t){var s,i;return isNaN(t)&&typeof t=="string"&&(((s=t.match(Em))===null||s===void 0?void 0:s.length)||0)+(((i=t.match(jD))===null||i===void 0?void 0:i.length)||0)>0}const u1="number",d1="color",ED="var",AD="var(",yy="${}",DD=/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 Fr(t){const s=t.toString(),i=[],o={color:[],number:[],var:[]},c=[];let u=0;const p=s.replace(DD,h=>(tn.test(h)?(o.color.push(u),c.push(d1),i.push(tn.parse(h))):h.startsWith(AD)?(o.var.push(u),c.push(ED),i.push(h)):(o.number.push(u),c.push(u1),i.push(parseFloat(h))),++u,yy)).split(yy);return{values:i,split:p,indexes:o,types:c}}function f1(t){return Fr(t).values}function p1(t){const{split:s,types:i}=Fr(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===u1?u+=Ir(c[d]):p===d1?u+=tn.transform(c[d]):u+=c[d]}return u}}const RD=t=>typeof t=="number"?0:t;function MD(t){const s=f1(t);return p1(t)(s.map(RD))}const Oa={test:CD,parse:f1,createTransformer:p1,getAnimatableNone:MD},ID=new Set(["brightness","contrast","saturate","opacity"]);function OD(t){const[s,i]=t.slice(0,-1).split("(");if(s==="drop-shadow")return t;const[o]=i.match(Em)||[];if(!o)return t;const c=i.replace(o,"");let u=ID.has(s)?1:0;return o!==i&&(u*=100),s+"("+u+c+")"}const LD=/\b([a-z-]*)\(.*?\)/gu,Cp={...Oa,getAnimatableNone:t=>{const s=t.match(LD);return s?s.map(OD).join(" "):t}},BD={...mm,color:tn,backgroundColor:tn,outlineColor:tn,fill:tn,stroke:tn,borderColor:tn,borderTopColor:tn,borderRightColor:tn,borderBottomColor:tn,borderLeftColor:tn,filter:Cp,WebkitFilter:Cp},Dm=t=>BD[t];function m1(t,s){let i=Dm(t);return i!==Cp&&(i=Oa),i.getAnimatableNone?i.getAnimatableNone(s):void 0}const zD=new Set(["auto","none","0"]);function UD(t,s,i){let o=0,c;for(;o<t.length&&!c;){const u=t[o];typeof u=="string"&&!zD.has(u)&&Fr(u).values.length&&(c=t[o]),o++}if(c&&i)for(const u of s)t[u]=m1(i,c)}const by=t=>t===Do||t===we,_y=(t,s)=>parseFloat(t.split(", ")[s]),xy=(t,s)=>(i,{transform:o})=>{if(o==="none"||!o)return 0;const c=o.match(/^matrix3d\((.+)\)$/u);if(c)return _y(c[1],s);{const u=o.match(/^matrix\((.+)\)$/u);return u?_y(u[1],t):0}},$D=new Set(["x","y","z"]),PD=Ao.filter(t=>!$D.has(t));function VD(t){const s=[];return PD.forEach(i=>{const o=t.getValue(i);o!==void 0&&(s.push([i,o.get()]),o.set(i.startsWith("scale")?1:0))}),s}const No={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:xy(4,13),y:xy(5,14)};No.translateX=No.x;No.translateY=No.y;const hi=new Set;let Ep=!1,Ap=!1;function h1(){if(Ap){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=VD(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)})}Ap=!1,Ep=!1,hi.forEach(t=>t.complete()),hi.clear()}function g1(){hi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ap=!0)})}function HD(){g1(),h1()}class Rm{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),Ep||(Ep=!0,yt.read(g1),yt.resolveKeyframes(h1))):(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 v1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),qD=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function GD(t){const s=qD.exec(t);if(!s)return[,];const[,i,o,c]=s;return[`--${i??o}`,c]}function y1(t,s,i=1){const[o,c]=GD(t);if(!o)return;const u=window.getComputedStyle(s).getPropertyValue(o);if(u){const d=u.trim();return v1(d)?parseFloat(d):d}return pm(c)?y1(c,s,i+1):c}const b1=t=>s=>s.test(t),FD={test:t=>t==="auto",parse:t=>t},_1=[Do,we,bs,Da,VA,PA,FD],ky=t=>_1.find(b1(t));class x1 extends Rm{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(),pm(g))){const v=y1(g,i.current);v!==void 0&&(s[h]=v),h===s.length-1&&(this.finalKeyframe=g)}}if(this.resolveNoneKeyframes(),!K_.has(o)||s.length!==2)return;const[c,u]=s,d=ky(c),p=ky(u);if(d!==p)if(by(d)&&by(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++)kD(s[c])&&o.push(c);o.length&&UD(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=No[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]=No[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 Sy=(t,s)=>s==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Oa.test(t)||t==="0")&&!t.startsWith("url("));function ZD(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 KD(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=Sy(c,s),p=Sy(u,s);return!d||!p?!1:ZD(t)||(i==="spring"||wm(i))&&o}const YD=t=>t!==null;function mu(t,{repeat:s,repeatType:i="loop"},o){const c=t.filter(YD),u=s&&i!=="loop"&&s%2===1?0:c.length-1;return!u||o===void 0?c[u]:o}const JD=40;class k1{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>JD?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&HD(),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&&!KD(s,o,c,u))if(d)this.options.duration=0;else{h&&h(mu(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 Dp=2e4;function S1(t){let s=0;const i=50;let o=t.next(s);for(;!o.done&&s<Dp;)s+=i,o=t.next(s);return s>=Dp?1/0:s}const St=(t,s,i)=>t+(s-t)*i;function Yf(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 WD({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=Yf(h,p,t+1/3),u=Yf(h,p,t),d=Yf(h,p,t-1/3)}return{red:Math.round(c*255),green:Math.round(u*255),blue:Math.round(d*255),alpha:o}}function Kc(t,s){return i=>i>0?s:t}const Jf=(t,s,i)=>{const o=t*t,c=i*(s*s-o)+o;return c<0?0:Math.sqrt(c)},XD=[jp,pi,go],QD=t=>XD.find(s=>s.test(t));function Ty(t){const s=QD(t);if(!s)return!1;let i=s.parse(t);return s===go&&(i=WD(i)),i}const wy=(t,s)=>{const i=Ty(t),o=Ty(s);if(!i||!o)return Kc(t,s);const c={...i};return u=>(c.red=Jf(i.red,o.red,u),c.green=Jf(i.green,o.green,u),c.blue=Jf(i.blue,o.blue,u),c.alpha=St(i.alpha,o.alpha,u),pi.transform(c))},eR=(t,s)=>i=>s(t(i)),tl=(...t)=>t.reduce(eR),Rp=new Set(["none","hidden"]);function tR(t,s){return Rp.has(t)?i=>i<=0?t:s:i=>i>=1?s:t}function nR(t,s){return i=>St(t,s,i)}function Mm(t){return typeof t=="number"?nR:typeof t=="string"?pm(t)?Kc:tn.test(t)?wy:iR:Array.isArray(t)?T1:typeof t=="object"?tn.test(t)?wy:sR:Kc}function T1(t,s){const i=[...t],o=i.length,c=t.map((u,d)=>Mm(u)(u,s[d]));return u=>{for(let d=0;d<o;d++)i[d]=c[d](u);return i}}function sR(t,s){const i={...t,...s},o={};for(const c in i)t[c]!==void 0&&s[c]!==void 0&&(o[c]=Mm(t[c])(t[c],s[c]));return c=>{for(const u in o)i[u]=o[u](c);return i}}function aR(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 iR=(t,s)=>{const i=Oa.createTransformer(s),o=Fr(t),c=Fr(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?Rp.has(t)&&!c.values.length||Rp.has(s)&&!o.values.length?tR(t,s):tl(T1(aR(o,c),c.values),i):Kc(t,s)};function w1(t,s,i){return typeof t=="number"&&typeof s=="number"&&typeof i=="number"?St(t,s,i):Mm(t)(t,s)}const oR=5;function N1(t,s,i){const o=Math.max(s-oR,0);return Y_(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},Wf=.001;function rR({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,b=v-i,k=Mp(g,d),S=Math.exp(-y);return Wf-b/k*S},u=g=>{const y=g*d*t,b=y*i+i,k=Math.pow(d,2)*Math.pow(g,2)*t,S=Math.exp(-y),N=Mp(Math.pow(g,2),d);return(-c(g)+Wf>0?-1:1)*((b-k)*S)/N}):(c=g=>{const v=Math.exp(-g*t),y=(g-i)*t+1;return-Wf+v*y},u=g=>{const v=Math.exp(-g*t),y=(i-g)*(t*t);return v*y});const p=5/t,h=cR(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 lR=12;function cR(t,s,i){let o=i;for(let c=1;c<lR;c++)o=o-t(o)/s(o);return o}function Mp(t,s){return t*Math.sqrt(1-s*s)}const uR=["duration","bounce"],dR=["stiffness","damping","mass"];function Ny(t,s){return s.some(i=>t[i]!==void 0)}function fR(t){let s={velocity:jt.velocity,stiffness:jt.stiffness,damping:jt.damping,mass:jt.mass,isResolvedFromDuration:!1,...t};if(!Ny(t,dR)&&Ny(t,uR))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=rR(t);s={...s,...i,mass:jt.mass},s.isResolvedFromDuration=!0}return s}function j1(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:b,isResolvedFromDuration:k}=fR({...i,velocity:-Ks(i.velocity||0)}),S=b||0,N=g/(2*Math.sqrt(h*v)),j=d-u,T=Ks(Math.sqrt(h/v)),C=Math.abs(j)<5;o||(o=C?jt.restSpeed.granular:jt.restSpeed.default),c||(c=C?jt.restDelta.granular:jt.restDelta.default);let E;if(N<1){const I=Mp(T,N);E=D=>{const B=Math.exp(-N*T*D);return d-B*((S+N*T*j)/I*Math.sin(I*D)+j*Math.cos(I*D))}}else if(N===1)E=I=>d-Math.exp(-T*I)*(j+(S+T*j)*I);else{const I=T*Math.sqrt(N*N-1);E=D=>{const B=Math.exp(-N*T*D),z=Math.min(I*D,300);return d-B*((S+N*T*j)*Math.sinh(z)+I*j*Math.cosh(z))/I}}const A={calculatedDuration:k&&y||null,next:I=>{const D=E(I);if(k)p.done=I>=y;else{let B=0;N<1&&(B=I===0?Zs(S):N1(E,I,D));const z=Math.abs(B)<=o,X=Math.abs(d-D)<=c;p.done=z&&X}return p.value=p.done?d:D,p},toString:()=>{const I=Math.min(S1(A),Dp),D=W_(B=>A.next(I*B).value,I,30);return I+"ms "+D}};return A}function jy({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],b={done:!1,value:y},k=z=>p!==void 0&&z<p||h!==void 0&&z>h,S=z=>p===void 0?h:h===void 0||Math.abs(p-z)<Math.abs(h-z)?p:h;let N=i*s;const j=y+N,T=d===void 0?j:d(j);T!==j&&(N=T-y);const C=z=>-N*Math.exp(-z/o),E=z=>T+C(z),A=z=>{const X=C(z),Y=E(z);b.done=Math.abs(X)<=g,b.value=b.done?T:Y};let I,D;const B=z=>{k(b.value)&&(I=z,D=j1({keyframes:[b.value,S(b.value)],velocity:N1(E,z,b.value),damping:c,stiffness:u,restDelta:g,restSpeed:v}))};return B(0),{calculatedDuration:null,next:z=>{let X=!1;return!D&&I===void 0&&(X=!0,A(z),B(z)),I!==void 0&&z>=I?D.next(z-I):(!X&&A(z),b)}}}const pR=el(.42,0,1,1),mR=el(0,0,.58,1),C1=el(.42,0,.58,1),hR=t=>Array.isArray(t)&&typeof t[0]!="number",gR={linear:jn,easeIn:pR,easeInOut:C1,easeOut:mR,circIn:Cm,circInOut:r1,circOut:o1,backIn:jm,backInOut:a1,backOut:s1,anticipate:i1},Cy=t=>{if(Nm(t)){C_(t.length===4);const[s,i,o,c]=t;return el(s,i,o,c)}else if(typeof t=="string")return gR[t];return t};function vR(t,s,i){const o=[],c=i||w1,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=tl(h,p)}o.push(p)}return o}function yR(t,s,{clamp:i=!0,ease:o,mixer:c}={}){const u=t.length;if(C_(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=vR(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 b=wo(t[y],t[y+1],v);return p[y](b)};return i?v=>g(Ws(t[0],t[u-1],v)):g}function bR(t,s){const i=t[t.length-1];for(let o=1;o<=s;o++){const c=wo(0,s,o);t.push(St(i,1,c))}}function _R(t){const s=[0];return bR(s,t.length-1),s}function xR(t,s){return t.map(i=>i*s)}function kR(t,s){return t.map(()=>s||C1).splice(0,t.length-1)}function Yc({duration:t=300,keyframes:s,times:i,ease:o="easeInOut"}){const c=hR(o)?o.map(Cy):Cy(o),u={done:!1,value:s[0]},d=xR(i&&i.length===s.length?i:_R(s),t),p=yR(d,s,{ease:Array.isArray(c)?c:kR(s,c)});return{calculatedDuration:t,next:h=>(u.value=p(h),u.done=h>=t,u)}}const SR=t=>{const s=({timestamp:i})=>t(i);return{start:()=>yt.update(s,!0),stop:()=>Ia(s),now:()=>Wt.isProcessing?Wt.timestamp:_s.now()}},TR={decay:jy,inertia:jy,tween:Yc,keyframes:Yc,spring:j1},wR=t=>t/100;class Im extends k1{constructor(s){super(s),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:h}=this.options;h&&h()};const{name:i,motionValue:o,element:c,keyframes:u}=this.options,d=(c==null?void 0:c.KeyframeResolver)||Rm,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=wm(i)?i:TR[i]||Yc;let h,g;p!==Yc&&typeof s[0]!="number"&&(h=tl(wR,w1(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=S1(v));const{calculatedDuration:y}=v,b=y+c,k=b*(o+1)-c;return{generator:v,mirroredGenerator:g,mapPercentToKeyframes:h,calculatedDuration:y,resolvedDuration:b,totalDuration:k}}onPostResolved(){const{autoplay:s=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!s?this.pause():this.state=this.pendingPlayState}tick(s,i=!1){const{resolved:o}=this;if(!o){const{keyframes:z}=this.options;return{done:!0,value:z[z.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:b,repeat:k,repeatType:S,repeatDelay:N,onUpdate:j}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,s):this.speed<0&&(this.startTime=Math.min(s-v/this.speed,this.startTime)),i?this.currentTime=s:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(s-this.startTime)*this.speed;const T=this.currentTime-b*(this.speed>=0?1:-1),C=this.speed>=0?T<0:T>v;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=v);let E=this.currentTime,A=u;if(k){const z=Math.min(this.currentTime,v)/y;let X=Math.floor(z),Y=z%1;!Y&&z>=1&&(Y=1),Y===1&&X--,X=Math.min(X,k+1),!!(X%2)&&(S==="reverse"?(Y=1-Y,N&&(Y-=N/y)):S==="mirror"&&(A=d)),E=Ws(0,1,Y)*y}const I=C?{done:!1,value:h[0]}:A.next(E);p&&(I.value=p(I.value));let{done:D}=I;!C&&g!==null&&(D=this.speed>=0?this.currentTime>=v:this.currentTime<=0);const B=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&D);return B&&c!==void 0&&(I.value=mu(h,this.options,c)),j&&j(I.value),B&&this.finish(),I}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=SR,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 NR=new Set(["opacity","clipPath","filter","transform"]);function jR(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=Q_(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 CR=Tm(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Jc=10,ER=2e4;function AR(t){return wm(t.type)||t.type==="spring"||!X_(t.ease)}function DR(t,s){const i=new Im({...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<ER;)o=i.sample(u),c.push(o.value),u+=Jc;return{times:void 0,keyframes:c,duration:u-Jc,ease:"linear"}}const E1={anticipate:i1,backInOut:a1,circInOut:r1};function RR(t){return t in E1}class Ey extends k1{constructor(s){super(s);const{name:i,motionValue:o,element:c,keyframes:u}=this.options;this.resolver=new x1(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"&&Zc()&&RR(u)&&(u=E1[u]),AR(this.options)){const{onComplete:y,onUpdate:b,motionValue:k,element:S,...N}=this.options,j=DR(s,N);s=j.keyframes,s.length===1&&(s[1]=s[0]),o=j.duration,c=j.times,u=j.ease,d="keyframes"}const v=jR(p.owner.current,h,s,{...this.options,duration:o,times:c,ease:u});return v.startTime=g??this.calcStartTime(),this.pendingTimeline?(vy(v,this.pendingTimeline),this.pendingTimeline=void 0):v.onfinish=()=>{const{onComplete:y}=this.options;p.set(mu(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;vy(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:b,...k}=this.options,S=new Im({...k,keyframes:o,duration:c,type:u,ease:d,times:p,isGenerator:!0}),N=Zs(this.time);g.setWithVelocity(S.sample(N-Jc).value,S.sample(N).value,Jc)}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 CR()&&o&&NR.has(o)&&!h&&!g&&!c&&u!=="mirror"&&d!==0&&p!=="inertia"}}const MR={type:"spring",stiffness:500,damping:25,restSpeed:10},IR=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),OR={type:"keyframes",duration:.8},LR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},BR=(t,{keyframes:s})=>s.length>2?OR:Si.has(t)?t.startsWith("scale")?IR(s[1]):MR:LR;function zR({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 Om=(t,s,i,o={},c,u)=>d=>{const p=_m(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:b=>{s.set(b),p.onUpdate&&p.onUpdate(b)},onComplete:()=>{d(),p.onComplete&&p.onComplete()},name:t,motionValue:s,element:u?void 0:c};zR(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 b=mu(v.keyframes,p);if(b!==void 0)return yt.update(()=>{v.onUpdate(b),v.onComplete()}),new gD([])}return!u&&Ey.supports(v)?new Ey(v):new Im(v)};function UR({protectedKeys:t,needsAnimating:s},i){const o=t.hasOwnProperty(i)&&s[i]!==!0;return s[i]=!1,o}function A1(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 b=t.getValue(y,(u=t.latestValues[y])!==null&&u!==void 0?u:null),k=h[y];if(k===void 0||v&&UR(v,y))continue;const S={delay:i,..._m(d||{},y)};let N=!1;if(window.MotionHandoffAnimation){const T=J_(t);if(T){const C=window.MotionHandoffAnimation(T,y,yt);C!==null&&(S.startTime=C,N=!0)}}wp(t,y),b.start(Om(y,b,k,t.shouldReduceMotion&&K_.has(y)?{type:!1}:S,t,N));const j=b.animation;j&&g.push(j)}return p&&Promise.all(g).then(()=>{yt.update(()=>{p&&fD(t,p)})}),g}function Ip(t,s,i={}){var o;const c=pu(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(A1(t,c,i)):()=>Promise.resolve(),p=t.variantChildren&&t.variantChildren.size?(g=0)=>{const{delayChildren:v=0,staggerChildren:y,staggerDirection:b}=u;return $R(t,s,v+g,y,b,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 $R(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(PR).forEach((g,v)=>{g.notify("AnimationStart",s),d.push(Ip(g,s,{...u,delay:i+h(v)}).then(()=>g.notify("AnimationComplete",s)))}),Promise.all(d)}function PR(t,s){return t.sortNodePosition(s)}function VR(t,s,i={}){t.notify("AnimationStart",s);let o;if(Array.isArray(s)){const c=s.map(u=>Ip(t,u,i));o=Promise.all(c)}else if(typeof s=="string")o=Ip(t,s,i);else{const c=typeof s=="function"?pu(t,s,i.custom):s;o=Promise.all(A1(t,c,i))}return o.then(()=>{t.notify("AnimationComplete",s)})}const HR=lm.length;function D1(t){if(!t)return;if(!t.isControllingVariants){const i=t.parent?D1(t.parent)||{}:{};return t.props.initial!==void 0&&(i.initial=t.props.initial),i}const s={};for(let i=0;i<HR;i++){const o=lm[i],c=t.props[o];(Hr(c)||c===!1)&&(s[o]=c)}return s}const qR=[...rm].reverse(),GR=rm.length;function FR(t){return s=>Promise.all(s.map(({animation:i,options:o})=>VR(t,i,o)))}function ZR(t){let s=FR(t),i=Ay(),o=!0;const c=h=>(g,v)=>{var y;const b=pu(t,v,h==="exit"?(y=t.presenceContext)===null||y===void 0?void 0:y.custom:void 0);if(b){const{transition:k,transitionEnd:S,...N}=b;g={...g,...N,...S}}return g};function u(h){s=h(t)}function d(h){const{props:g}=t,v=D1(t.parent)||{},y=[],b=new Set;let k={},S=1/0;for(let j=0;j<GR;j++){const T=qR[j],C=i[T],E=g[T]!==void 0?g[T]:v[T],A=Hr(E),I=T===h?C.isActive:null;I===!1&&(S=j);let D=E===v[T]&&E!==g[T]&&A;if(D&&o&&t.manuallyAnimateOnMount&&(D=!1),C.protectedKeys={...k},!C.isActive&&I===null||!E&&!C.prevProp||du(E)||typeof E=="boolean")continue;const B=KR(C.prevProp,E);let z=B||T===h&&C.isActive&&!D&&A||j>S&&A,X=!1;const Y=Array.isArray(E)?E:[E];let F=Y.reduce(c(T),{});I===!1&&(F={});const{prevResolvedValues:te={}}=C,le={...te,...F},se=Z=>{z=!0,b.has(Z)&&(X=!0,b.delete(Z)),C.needsAnimating[Z]=!0;const ae=t.getValue(Z);ae&&(ae.liveStyle=!1)};for(const Z in le){const ae=F[Z],re=te[Z];if(k.hasOwnProperty(Z))continue;let de=!1;Tp(ae)&&Tp(re)?de=!Z_(ae,re):de=ae!==re,de?ae!=null?se(Z):b.add(Z):ae!==void 0&&b.has(Z)?se(Z):C.protectedKeys[Z]=!0}C.prevProp=E,C.prevResolvedValues=F,C.isActive&&(k={...k,...F}),o&&t.blockInitialAnimation&&(z=!1),z&&(!(D&&B)||X)&&y.push(...Y.map(Z=>({animation:Z,options:{type:T}})))}if(b.size){const j={};b.forEach(T=>{const C=t.getBaseTarget(T),E=t.getValue(T);E&&(E.liveStyle=!0),j[T]=C??null}),y.push({animation:j})}let N=!!y.length;return o&&(g.initial===!1||g.initial===g.animate)&&!t.manuallyAnimateOnMount&&(N=!1),o=!1,N?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(b=>{var k;return(k=b.animationState)===null||k===void 0?void 0:k.setActive(h,g)}),i[h].isActive=g;const y=d(h);for(const b in i)i[b].protectedKeys={};return y}return{animateChanges:d,setActive:p,setAnimateFunction:u,getState:()=>i,reset:()=>{i=Ay(),o=!0}}}function KR(t,s){return typeof s=="string"?s!==t:Array.isArray(s)?!Z_(s,t):!1}function oi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ay(){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 YR extends za{constructor(s){super(s),s.animationState||(s.animationState=ZR(s))}updateAnimationControlsSubscription(){const{animate:s}=this.node.getProps();du(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 JR=0;class WR extends za{constructor(){super(...arguments),this.id=JR++}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 XR={animation:{Feature:YR},exit:{Feature:WR}},as={x:!1,y:!1};function R1(){return as.x||as.y}function QR(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 Lm=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function Zr(t,s,i,o={passive:!0}){return t.addEventListener(s,i,o),()=>t.removeEventListener(s,i)}function nl(t){return{point:{x:t.pageX,y:t.pageY}}}const e3=t=>s=>Lm(s)&&t(s,nl(s));function Or(t,s,i,o){return Zr(t,s,e3(i),o)}const Dy=(t,s)=>Math.abs(t-s);function t3(t,s){const i=Dy(t.x,s.x),o=Dy(t.y,s.y);return Math.sqrt(i**2+o**2)}class M1{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=Qf(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,k=t3(y.offset,{x:0,y:0})>=3;if(!b&&!k)return;const{point:S}=y,{timestamp:N}=Wt;this.history.push({...S,timestamp:N});const{onStart:j,onMove:T}=this.handlers;b||(j&&j(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,y)},this.handlePointerMove=(y,b)=>{this.lastMoveEvent=y,this.lastMoveEventInfo=Xf(b,this.transformPagePoint),yt.update(this.updatePoint,!0)},this.handlePointerUp=(y,b)=>{this.end();const{onEnd:k,onSessionEnd:S,resumeAnimation:N}=this.handlers;if(this.dragSnapToOrigin&&N&&N(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const j=Qf(y.type==="pointercancel"?this.lastMoveEventInfo:Xf(b,this.transformPagePoint),this.history);this.startEvent&&k&&k(y,j),S&&S(y,j)},!Lm(s))return;this.dragSnapToOrigin=u,this.handlers=i,this.transformPagePoint=o,this.contextWindow=c||window;const d=nl(s),p=Xf(d,this.transformPagePoint),{point:h}=p,{timestamp:g}=Wt;this.history=[{...h,timestamp:g}];const{onSessionStart:v}=i;v&&v(s,Qf(p,this.history)),this.removeListeners=tl(Or(this.contextWindow,"pointermove",this.handlePointerMove),Or(this.contextWindow,"pointerup",this.handlePointerUp),Or(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(s){this.handlers=s}end(){this.removeListeners&&this.removeListeners(),Ia(this.updatePoint)}}function Xf(t,s){return s?{point:s(t.point)}:t}function Ry(t,s){return{x:t.x-s.x,y:t.y-s.y}}function Qf({point:t},s){return{point:t,delta:Ry(t,I1(s)),offset:Ry(t,n3(s)),velocity:s3(s,.1)}}function n3(t){return t[0]}function I1(t){return t[t.length-1]}function s3(t,s){if(t.length<2)return{x:0,y:0};let i=t.length-1,o=null;const c=I1(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 O1=1e-4,a3=1-O1,i3=1+O1,L1=.01,o3=0-L1,r3=0+L1;function Cn(t){return t.max-t.min}function l3(t,s,i){return Math.abs(t-s)<=i}function My(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>=a3&&t.scale<=i3||isNaN(t.scale))&&(t.scale=1),(t.translate>=o3&&t.translate<=r3||isNaN(t.translate))&&(t.translate=0)}function Lr(t,s,i,o){My(t.x,s.x,i.x,o?o.originX:void 0),My(t.y,s.y,i.y,o?o.originY:void 0)}function Iy(t,s,i){t.min=i.min+s.min,t.max=t.min+Cn(s)}function c3(t,s,i){Iy(t.x,s.x,i.x),Iy(t.y,s.y,i.y)}function Oy(t,s,i){t.min=s.min-i.min,t.max=t.min+Cn(s)}function Br(t,s,i){Oy(t.x,s.x,i.x),Oy(t.y,s.y,i.y)}function u3(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 Ly(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 d3(t,{top:s,left:i,bottom:o,right:c}){return{x:Ly(t.x,i,c),y:Ly(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 f3(t,s){return{x:By(t.x,s.x),y:By(t.y,s.y)}}function p3(t,s){let i=.5;const o=Cn(t),c=Cn(s);return c>o?i=wo(s.min,s.max-o,t.min):o>c&&(i=wo(t.min,t.max-c,s.min)),Ws(0,1,i)}function m3(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 Op=.35;function h3(t=Op){return t===!1?t=0:t===!0&&(t=Op),{x:zy(t,"left","right"),y:zy(t,"top","bottom")}}function zy(t,s,i){return{min:Uy(t,s),max:Uy(t,i)}}function Uy(t,s){return typeof t=="number"?t:t[s]||0}const $y=()=>({translate:0,scale:1,origin:0,originPoint:0}),vo=()=>({x:$y(),y:$y()}),Py=()=>({min:0,max:0}),Rt=()=>({x:Py(),y:Py()});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 g3({x:t,y:s}){return{top:s.min,right:t.max,bottom:s.max,left:t.min}}function v3(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 ep(t){return t===void 0||t===1}function Lp({scale:t,scaleX:s,scaleY:i}){return!ep(t)||!ep(s)||!ep(i)}function di(t){return Lp(t)||z1(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function z1(t){return Vy(t.x)||Vy(t.y)}function Vy(t){return t&&t!=="0%"}function Wc(t,s,i){const o=t-i,c=s*o;return i+c}function Hy(t,s,i,o,c){return c!==void 0&&(t=Wc(t,c,o)),Wc(t,i,o)+s}function Bp(t,s=0,i=1,o,c){t.min=Hy(t.min,s,i,o,c),t.max=Hy(t.max,s,i,o,c)}function U1(t,{x:s,y:i}){Bp(t.x,s.translate,s.scale,s.originPoint),Bp(t.y,i.translate,i.scale,i.originPoint)}const qy=.999999999999,Gy=1.0000000000001;function y3(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&&bo(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),d&&(s.x*=d.x.scale,s.y*=d.y.scale,U1(t,d)),o&&di(u.latestValues)&&bo(t,u.latestValues))}s.x<Gy&&s.x>qy&&(s.x=1),s.y<Gy&&s.y>qy&&(s.y=1)}function yo(t,s){t.min=t.min+s,t.max=t.max+s}function Fy(t,s,i,o,c=.5){const u=St(t.min,t.max,c);Bp(t,s,i,u,o)}function bo(t,s){Fy(t.x,s.x,s.scaleX,s.scale,s.originX),Fy(t.y,s.y,s.scaleY,s.scale,s.originY)}function $1(t,s){return B1(v3(t.getBoundingClientRect(),s))}function b3(t,s,i){const o=$1(t,i),{scroll:c}=s;return c&&(yo(o.x,c.offset.x),yo(o.y,c.offset.y)),o}const P1=({current:t})=>t?t.ownerDocument.defaultView:null,_3=new WeakMap;class x3{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(nl(v).point)},u=(v,y)=>{const{drag:b,dragPropagation:k,onDragStart:S}=this.getProps();if(b&&!k&&(this.openDragLock&&this.openDragLock(),this.openDragLock=QR(b),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),qn(j=>{let T=this.getAxisMotionValue(j).get()||0;if(bs.test(T)){const{projection:C}=this.visualElement;if(C&&C.layout){const E=C.layout.layoutBox[j];E&&(T=Cn(E)*(parseFloat(T)/100))}}this.originPoint[j]=T}),S&&yt.postRender(()=>S(v,y)),wp(this.visualElement,"transform");const{animationState:N}=this.visualElement;N&&N.setActive("whileDrag",!0)},d=(v,y)=>{const{dragPropagation:b,dragDirectionLock:k,onDirectionLock:S,onDrag:N}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:j}=y;if(k&&this.currentDirection===null){this.currentDirection=k3(j),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",y.point,j),this.updateAxis("y",y.point,j),this.visualElement.render(),N&&N(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 M1(s,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:p,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,contextWindow:P1(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||!jc(s,c,this.currentDirection))return;const u=this.getAxisMotionValue(s);let d=this.originPoint[s]+o[s];this.constraints&&this.constraints[s]&&(d=u3(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&&ho(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&c?this.constraints=d3(c.layoutBox,i):this.constraints=!1,this.elastic=h3(o),u!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&qn(d=>{this.constraints!==!1&&this.getAxisMotionValue(d)&&(this.constraints[d]=m3(c.layoutBox[d],this.constraints[d]))})}resolveRefConstraints(){const{dragConstraints:s,onMeasureDragConstraints:i}=this.getProps();if(!s||!ho(s))return!1;const o=s.current,{projection:c}=this.visualElement;if(!c||!c.layout)return!1;const u=b3(o,c.root,this.visualElement.getTransformPagePoint());let d=f3(c.layout.layoutBox,u);if(i){const p=i(g3(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(!jc(v,i,this.currentDirection))return;let y=h&&h[v]||{};d&&(y={min:0,max:0});const b=c?200:1e6,k=c?40:1e7,S={type:"inertia",velocity:o?s[v]:0,bounceStiffness:b,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 wp(this.visualElement,s),o.start(Om(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(!jc(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(!ho(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]=p3({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(!jc(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;_3.set(this.visualElement,this);const s=this.visualElement.current,i=Or(s,"pointerdown",h=>{const{drag:g,dragListener:v=!0}=this.getProps();g&&v&&this.start(h)}),o=()=>{const{dragConstraints:h}=this.getProps();ho(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=Zr(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=Op,dragMomentum:p=!0}=s;return{...s,drag:i,dragDirectionLock:o,dragPropagation:c,dragConstraints:u,dragElastic:d,dragMomentum:p}}}function jc(t,s,i){return(s===!0||s===t)&&(i===null||i===t)}function k3(t,s=10){let i=null;return Math.abs(t.y)>s?i="y":Math.abs(t.x)>s&&(i="x"),i}class S3 extends za{constructor(s){super(s),this.removeGroupControls=jn,this.removeListeners=jn,this.controls=new x3(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 Zy=t=>(s,i)=>{t&&yt.postRender(()=>t(s,i))};class T3 extends za{constructor(){super(...arguments),this.removePointerDownListener=jn}onPointerDown(s){this.session=new M1(s,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:P1(this.node)})}createPanHandlers(){const{onPanSessionStart:s,onPanStart:i,onPan:o,onPanEnd:c}=this.node.getProps();return{onSessionStart:Zy(s),onStart:Zy(i),onMove:o,onEnd:(u,d)=>{delete this.session,c&&yt.postRender(()=>c(u,d))}}}mount(){this.removePointerDownListener=Or(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 $c={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ky(t,s){return s.max===s.min?0:t/(s.max-s.min)*100}const Tr={correct:(t,s)=>{if(!s.target)return t;if(typeof t=="string")if(we.test(t))t=parseFloat(t);else return t;const i=Ky(t,s.target.x),o=Ky(t,s.target.y);return`${i}% ${o}%`}},w3={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 N3 extends _.Component{componentDidMount(){const{visualElement:s,layoutGroup:i,switchLayoutGroup:o,layoutId:c}=this.props,{projection:u}=s;XA(j3),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()})),$c.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(),um.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 V1(t){const[s,i]=N_(),o=_.useContext(sm);return r.jsx(N3,{...t,layoutGroup:o,switchLayoutGroup:_.useContext(I_),isPresent:s,safeToRemove:i})}const j3={borderRadius:{...Tr,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Tr,borderTopRightRadius:Tr,borderBottomLeftRadius:Tr,borderBottomRightRadius:Tr,boxShadow:w3};function C3(t,s,i){const o=nn(t)?t:Gr(t);return o.start(Om("",o,s,i)),o.animation}function E3(t){return t instanceof SVGElement&&t.tagName!=="svg"}const A3=(t,s)=>t.depth-s.depth;class D3{constructor(){this.children=[],this.isDirty=!1}add(s){xm(this.children,s),this.isDirty=!0}remove(s){km(this.children,s),this.isDirty=!0}forEach(s){this.isDirty&&this.children.sort(A3),this.isDirty=!1,this.children.forEach(s)}}function R3(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 H1=["TopLeft","TopRight","BottomLeft","BottomRight"],M3=H1.length,Yy=t=>typeof t=="string"?parseFloat(t):t,Jy=t=>typeof t=="number"||we.test(t);function I3(t,s,i,o,c,u){c?(t.opacity=St(0,i.opacity!==void 0?i.opacity:1,O3(o)),t.opacityExit=St(s.opacity!==void 0?s.opacity:1,0,L3(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<M3;d++){const p=`border${H1[d]}Radius`;let h=Wy(s,p),g=Wy(i,p);if(h===void 0&&g===void 0)continue;h||(h=0),g||(g=0),h===0||g===0||Jy(h)===Jy(g)?(t[p]=Math.max(St(Yy(h),Yy(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 Wy(t,s){return t[s]!==void 0?t[s]:t.borderRadius}const O3=q1(0,.5,o1),L3=q1(.5,.95,jn);function q1(t,s,i){return o=>o<t?0:o>s?1:i(wo(t,s,o))}function Xy(t,s){t.min=s.min,t.max=s.max}function Pn(t,s){Xy(t.x,s.x),Xy(t.y,s.y)}function Qy(t,s){t.translate=s.translate,t.scale=s.scale,t.originPoint=s.originPoint,t.origin=s.origin}function eb(t,s,i,o,c){return t-=s,t=Wc(t,1/i,o),c!==void 0&&(t=Wc(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=eb(t.min,s,i,p,c),t.max=eb(t.max,s,i,p,c)}function tb(t,s,[i,o,c],u,d){B3(t,s[i],s[o],s[c],s.scale,u,d)}const z3=["x","scaleX","originX"],U3=["y","scaleY","originY"];function nb(t,s,i,o){tb(t.x,s,z3,i?i.x:void 0,o?o.x:void 0),tb(t.y,s,U3,i?i.y:void 0,o?o.y:void 0)}function sb(t){return t.translate===0&&t.scale===1}function G1(t){return sb(t.x)&&sb(t.y)}function ab(t,s){return t.min===s.min&&t.max===s.max}function $3(t,s){return ab(t.x,s.x)&&ab(t.y,s.y)}function ib(t,s){return Math.round(t.min)===Math.round(s.min)&&Math.round(t.max)===Math.round(s.max)}function F1(t,s){return ib(t.x,s.x)&&ib(t.y,s.y)}function ob(t){return Cn(t.x)/Cn(t.y)}function rb(t,s){return t.translate===s.translate&&t.scale===s.scale&&t.originPoint===s.originPoint}class P3{constructor(){this.members=[]}add(s){xm(this.members,s),s.scheduleRender()}remove(s){if(km(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 V3(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:b,skewX:k,skewY:S}=i;g&&(o=`perspective(${g}px) ${o}`),v&&(o+=`rotate(${v}deg) `),y&&(o+=`rotateX(${y}deg) `),b&&(o+=`rotateY(${b}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},Ar=typeof window<"u"&&window.MotionDebug!==void 0,tp=["","X","Y","Z"],H3={visibility:"hidden"},lb=1e3;let q3=0;function np(t,s,i,o){const{latestValues:c}=s;c[t]&&(i[t]=c[t],s.setStaticValue(t,0),o&&(o[t]=0))}function Z1(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:s}=t.options;if(!s)return;const i=J_(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&&Z1(o)}function K1({attachResizeListener:t,defaultParent:s,measureScroll:i,checkIsScrollRoot:o,resetTransform:c}){return class{constructor(d={},p=s==null?void 0:s()){this.id=q3++,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,Ar&&(fi.totalNodes=fi.resolvedTargetDeltas=fi.recalculatedProjection=0),this.nodes.forEach(Z3),this.nodes.forEach(X3),this.nodes.forEach(Q3),this.nodes.forEach(K3),Ar&&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 D3)}addEventListener(d,p){return this.eventHandlers.has(d)||this.eventHandlers.set(d,new Sm),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=E3(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 b=()=>this.root.updateBlockedByResize=!1;t(d,()=>{this.root.updateBlockedByResize=!0,y&&y(),y=R3(b,250),$c.hasAnimatedSinceResize&&($c.hasAnimatedSinceResize=!1,this.nodes.forEach(ub))})}h&&this.root.registerSharedNode(h,this),this.options.animate!==!1&&v&&(h||g)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:b,hasRelativeTargetChanged:k,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const N=this.options.transition||v.getDefaultTransition()||aM,{onLayoutAnimationStart:j,onLayoutAnimationComplete:T}=v.getProps(),C=!this.targetLayout||!F1(this.targetLayout,S)||k,E=!b&&k;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||E||b&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(y,E);const A={..._m(N,"layout"),onPlay:j,onComplete:T};(v.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A)}else b||ub(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(eM),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&&Z1(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(cb);return}this.isUpdating||this.nodes.forEach(J3),this.isUpdating=!1,this.nodes.forEach(W3),this.nodes.forEach(G3),this.nodes.forEach(F3),this.clearAllSnapshots();const p=_s.now();Wt.delta=Ws(0,1e3/60,p-Wt.timestamp),Wt.timestamp=p,Wt.isProcessing=!0,Zf.update.process(Wt),Zf.preRender.process(Wt),Zf.render.process(Wt),Wt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,um.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Y3),this.sharedNodes.forEach(tM)}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&&!G1(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)),iM(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(oM))){const{scroll:v}=this.root;v&&(yo(h.x,v.offset.x),yo(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:b}=v;v!==this.root&&y&&b.layoutScroll&&(y.wasRoot&&Pn(h,d),yo(h.x,y.offset.x),yo(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&&bo(h,{x:-v.scroll.offset.x,y:-v.scroll.offset.y}),di(v.latestValues)&&bo(h,v.latestValues)}return di(this.latestValues)&&bo(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;Lp(g.latestValues)&&g.updateSnapshot();const v=Rt(),y=g.measurePageBox();Pn(v,y),nb(p,g.latestValues,g.snapshot?g.snapshot.layoutBox:void 0,v)}return di(this.latestValues)&&nb(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:b}=this.options;if(!(!this.layout||!(y||b))){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(),c3(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Pn(this.target,this.layout.layoutBox),U1(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}Ar&&fi.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Lp(this.parent.latestValues)||z1(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var 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 b=this.treeScale.x,k=this.treeScale.y;y3(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():(Qy(this.prevProjectionDelta.x,this.projectionDelta.x),Qy(this.prevProjectionDelta.y,this.projectionDelta.y)),Lr(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==b||this.treeScale.y!==k||!rb(this.projectionDelta.x,this.prevProjectionDelta.x)||!rb(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S)),Ar&&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=vo(),this.projectionDelta=vo(),this.projectionDeltaWithTransform=vo()}setAnimationOrigin(d,p=!1){const h=this.snapshot,g=h?h.latestValues:{},v={...this.latestValues},y=vo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!p;const b=Rt(),k=h?h.source:void 0,S=this.layout?this.layout.source:void 0,N=k!==S,j=this.getStack(),T=!j||j.members.length<=1,C=!!(N&&!T&&this.options.crossfade===!0&&!this.path.some(sM));this.animationProgress=0;let E;this.mixTargetDelta=A=>{const I=A/1e3;db(y.x,d.x,I),db(y.y,d.y,I),this.setTargetDelta(y),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Br(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),nM(this.relativeTarget,this.relativeTargetOrigin,b,I),E&&$3(this.relativeTarget,E)&&(this.isProjectionDirty=!1),E||(E=Rt()),Pn(E,this.relativeTarget)),N&&(this.animationValues=v,I3(v,g,this.latestValues,I,C,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},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(()=>{$c.hasAnimatedSinceResize=!0,this.currentAnimation=C3(0,lb,{...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(lb),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&&Y1(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 b=Cn(this.layout.layoutBox.y);h.y.min=d.target.y.min,h.y.max=h.y.min+b}Pn(p,h),bo(p,v),Lr(this.projectionDeltaWithTransform,this.layoutCorrected,p,v)}}registerSharedNode(d,p){this.sharedNodes.has(d)||this.sharedNodes.set(d,new P3),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&&np("z",d,g,this.animationValues);for(let v=0;v<tp.length;v++)np(`rotate${tp[v]}`,d,g,this.animationValues),np(`skew${tp[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 H3;const g={visibility:""},v=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,g.opacity="",g.pointerEvents=zc(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 N={};return this.options.layoutId&&(N.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,N.pointerEvents=zc(d==null?void 0:d.pointerEvents)||""),this.hasProjected&&!di(this.latestValues)&&(N.transform=v?v({},""):"none",this.hasProjected=!1),N}const b=y.animationValues||y.latestValues;this.applyTransformsToTarget(),g.transform=V3(this.projectionDeltaWithTransform,this.treeScale,b),v&&(g.transform=v(b,g.transform));const{x:k,y:S}=this.projectionDelta;g.transformOrigin=`${k.origin*100}% ${S.origin*100}% 0`,y.animationValues?g.opacity=y===this?(h=(p=b.opacity)!==null&&p!==void 0?p:this.latestValues.opacity)!==null&&h!==void 0?h:1:this.preserveOpacity?this.latestValues.opacity:b.opacityExit:g.opacity=y===this?b.opacity!==void 0?b.opacity:"":b.opacityExit!==void 0?b.opacityExit:0;for(const N in Fc){if(b[N]===void 0)continue;const{correct:j,applyTo:T}=Fc[N],C=g.transform==="none"?b[N]:j(b[N],y);if(T){const E=T.length;for(let A=0;A<E;A++)g[T[A]]=C}else g[N]=C}return this.options.layoutId&&(g.pointerEvents=y===this?zc(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(cb),this.root.sharedNodes.clear()}}}function G3(t){t.updateLayout()}function F3(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 b=d?i.measuredBox[y]:i.layoutBox[y],k=Cn(b);b.min=o[y].min,b.max=b.min+k}):Y1(u,i.layoutBox,o)&&qn(y=>{const b=d?i.measuredBox[y]:i.layoutBox[y],k=Cn(o[y]);b.max=b.min+k,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+k)});const p=vo();Lr(p,o,i.layoutBox);const h=vo();d?Lr(h,t.applyTransform(c,!0),i.measuredBox):Lr(h,o,i.layoutBox);const g=!G1(p);let v=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:b,layout:k}=y;if(b&&k){const S=Rt();Br(S,i.layoutBox,b.layoutBox);const N=Rt();Br(N,o,k.layoutBox),F1(S,N)||(v=!0),y.options.layoutRoot&&(t.relativeTarget=N,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 Z3(t){Ar&&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 K3(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Y3(t){t.clearSnapshot()}function cb(t){t.clearMeasurements()}function J3(t){t.isLayoutDirty=!1}function W3(t){const{visualElement:s}=t.options;s&&s.getProps().onBeforeLayoutMeasure&&s.notify("BeforeLayoutMeasure"),t.resetTransform()}function ub(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function X3(t){t.resolveTargetDelta()}function Q3(t){t.calcProjection()}function eM(t){t.resetSkewAndRotation()}function tM(t){t.removeLeadSnapshot()}function db(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 fb(t,s,i,o){t.min=St(s.min,i.min,o),t.max=St(s.max,i.max,o)}function nM(t,s,i,o){fb(t.x,s.x,i.x,o),fb(t.y,s.y,i.y,o)}function sM(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const aM={duration:.45,ease:[.4,0,.1,1]},pb=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),mb=pb("applewebkit/")&&!pb("chrome/")?Math.round:jn;function hb(t){t.min=mb(t.min),t.max=mb(t.max)}function iM(t){hb(t.x),hb(t.y)}function Y1(t,s,i){return t==="position"||t==="preserve-aspect"&&!l3(ob(s),ob(i),.2)}function oM(t){var s;return t!==t.root&&((s=t.scroll)===null||s===void 0?void 0:s.wasRoot)}const rM=K1({attachResizeListener:(t,s)=>Zr(t,"resize",s),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),sp={current:void 0},J1=K1({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!sp.current){const t=new rM({});t.mount(window),t.setOptions({layoutScroll:!0}),sp.current=t}return sp.current},resetTransform:(t,s)=>{t.style.transform=s!==void 0?s:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),lM={pan:{Feature:T3},drag:{Feature:S3,ProjectionNode:J1,MeasureLayout:V1}};function cM(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 W1(t,s){const i=cM(t),o=new AbortController,c={passive:!0,...s,signal:o.signal};return[i,c,()=>o.abort()]}function gb(t){return s=>{s.pointerType==="touch"||R1()||t(s)}}function uM(t,s,i={}){const[o,c,u]=W1(t,i),d=gb(p=>{const{target:h}=p,g=s(p);if(typeof g!="function"||!h)return;const v=gb(y=>{g(y),h.removeEventListener("pointerleave",v)});h.addEventListener("pointerleave",v,c)});return o.forEach(p=>{p.addEventListener("pointerenter",d,c)}),u}function vb(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,nl(s)))}class dM extends za{mount(){const{current:s}=this.node;s&&(this.unmount=uM(s,i=>(vb(this.node,i,"Start"),o=>vb(this.node,o,"End"))))}unmount(){}}class fM 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=tl(Zr(this.node.current,"focus",()=>this.onFocus()),Zr(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const X1=(t,s)=>s?t===s?!0:X1(t,s.parentElement):!1,pM=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function mM(t){return pM.has(t.tagName)||t.tabIndex!==-1}const Dr=new WeakSet;function yb(t){return s=>{s.key==="Enter"&&t(s)}}function ap(t,s){t.dispatchEvent(new PointerEvent("pointer"+s,{isPrimary:!0,bubbles:!0}))}const hM=(t,s)=>{const i=t.currentTarget;if(!i)return;const o=yb(()=>{if(Dr.has(i))return;ap(i,"down");const c=yb(()=>{ap(i,"up")}),u=()=>ap(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 bb(t){return Lm(t)&&!R1()}function gM(t,s,i={}){const[o,c,u]=W1(t,i),d=p=>{const h=p.currentTarget;if(!bb(p)||Dr.has(h))return;Dr.add(h);const g=s(p),v=(k,S)=>{window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",b),!(!bb(k)||!Dr.has(h))&&(Dr.delete(h),typeof g=="function"&&g(k,{success:S}))},y=k=>{v(k,i.useGlobalTarget||X1(h,k.target))},b=k=>{v(k,!1)};window.addEventListener("pointerup",y,c),window.addEventListener("pointercancel",b,c)};return o.forEach(p=>{!mM(p)&&p.getAttribute("tabindex")===null&&(p.tabIndex=0),(i.useGlobalTarget?window:p).addEventListener("pointerdown",d,c),p.addEventListener("focus",g=>hM(g,c),c)}),u}function _b(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,nl(s)))}class vM extends za{mount(){const{current:s}=this.node;s&&(this.unmount=gM(s,i=>(_b(this.node,i,"Start"),(o,{success:c})=>_b(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const zp=new WeakMap,ip=new WeakMap,yM=t=>{const s=zp.get(t.target);s&&s(t)},bM=t=>{t.forEach(yM)};function _M({root:t,...s}){const i=t||document;ip.has(i)||ip.set(i,{});const o=ip.get(i),c=JSON.stringify(s);return o[c]||(o[c]=new IntersectionObserver(bM,{root:t,...s})),o[c]}function xM(t,s,i){const o=_M(s);return zp.set(t,i),o.observe(t),()=>{zp.delete(t),o.unobserve(t)}}const kM={some:0,all:1};class SM 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:kM[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(),b=g?v:y;b&&b(h)};return xM(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(TM(s,i))&&this.startObserver()}unmount(){}}function TM({viewport:t={}},{viewport:s={}}={}){return i=>t[i]!==s[i]}const wM={inView:{Feature:SM},tap:{Feature:vM},focus:{Feature:fM},hover:{Feature:dM}},NM={layout:{ProjectionNode:J1,MeasureLayout:V1}},Xc={current:null},Bm={current:!1};function Q1(){if(Bm.current=!0,!!om)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),s=()=>Xc.current=t.matches;t.addListener(s),s()}else Xc.current=!1}const jM=[..._1,tn,Oa],CM=t=>jM.find(b1(t)),xb=new WeakMap;function EM(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,Gr(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,Gr(d!==void 0?d:c,{owner:t}))}}for(const o in i)s[o]===void 0&&t.removeValue(o);return s}const kb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class AM{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=Rm,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=fu(i),this.isVariantNode=R_(i),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(s&&s.current);const{willChange:y,...b}=this.scrapeMotionValuesFromProps(i,{},this);for(const k in b){const S=b[k];h[k]!==void 0&&nn(S)&&S.set(h[k],!1)}}mount(s){this.current=s,xb.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||Q1(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Xc.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){xb.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 To){const i=To[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<kb.length;o++){const c=kb[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=EM(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=Gr(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"&&(v1(c)||l1(c))?c=parseFloat(c):!CM(c)&&Oa.test(i)&&(c=m1(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=fm(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 Sm),this.events[s].add(i)}notify(s,...i){this.events[s]&&this.events[s].notify(...i)}}class ex extends AM{constructor(){super(...arguments),this.KeyframeResolver=x1}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 DM(t){return window.getComputedStyle(t)}class RM extends ex{constructor(){super(...arguments),this.type="html",this.renderInstance=P_}readValueFromInstance(s,i){if(Si.has(i)){const o=Dm(i);return o&&o.default||0}else{const o=DM(s),c=(z_(i)?o.getPropertyValue(i):o[i])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(s,{transformPagePoint:i}){return $1(s,i)}build(s,i,o){hm(s,i,o.transformTemplate)}scrapeMotionValuesFromProps(s,i,o){return bm(s,i,o)}}class MM extends ex{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=Dm(i);return o&&o.default||0}return i=V_.has(i)?i:cm(i),s.getAttribute(i)}scrapeMotionValuesFromProps(s,i,o){return G_(s,i,o)}build(s,i,o){gm(s,i,this.isSVGTag,o.transformTemplate)}renderInstance(s,i,o,c){H_(s,i,o,c)}mount(s){this.isSVGTag=ym(s.tagName),super.mount(s)}}const IM=(t,s)=>dm(t)?new MM(s):new RM(s,{allowProjection:t!==_.Fragment}),OM=rD({...XR,...wM,...lM,...NM},IM),Ct=kA(OM);function LM(){!Bm.current&&Q1();const[t]=_.useState(Xc.current);return t}const BM="_overlay_cmicx_1",zM="_dialog_cmicx_11",UM="_title_cmicx_30",$M="_description_cmicx_38",PM="_actions_cmicx_45",VM="_cancelButton_cmicx_52",HM="_confirmButton_cmicx_79",ri={overlay:BM,dialog:zM,title:UM,description:$M,actions:PM,cancelButton:VM,confirmButton:HM};function bi({isOpen:t,title:s,description:i,confirmLabel:o="Delete",onConfirm:c,onCancel:u}){const d=_.useId(),p=_.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 qM="_spinner_1uyt1_1",GM="_spin_1uyt1_1",FM="_sm_1uyt1_14",ZM="_md_1uyt1_20",KM="_lg_1uyt1_26",YM="_xl_1uyt1_32",Sb={spinner:qM,spin:GM,sm:FM,md:ZM,lg:KM,xl:YM};function tx({size:t="md",className:s,label:i="Loading",liveRegion:o=!1}){return r.jsx("span",{className:`${Sb.spinner} ${Sb[t]} ${s??""}`,role:o?"status":void 0,"aria-label":i,"aria-hidden":o?void 0:!0})}const JM="_splash_1bn1g_1",WM="_logo_1bn1g_11",Tb={splash:JM,logo:WM};function nx(){return r.jsxs("div",{className:Tb.splash,"data-testid":"splash-screen",children:[r.jsx("img",{src:"/grackle-logo.png",alt:"Grackle",className:Tb.logo}),r.jsx(tx,{size:"xl",label:"Loading Grackle",liveRegion:!0})]})}const XM="_row_ldkru_1",QM="_hoverActions_ldkru_5",e6="_hoverButton_ldkru_31",t6="_selectingRow_ldkru_72",n6="_selected_ldkru_83",s6="_checkboxArea_ldkru_90",a6="_checkbox_ldkru_90",i6="_contentArea_ldkru_106",ts={row:XM,hoverActions:QM,hoverButton:e6,selectingRow:t6,selected:n6,checkboxArea:s6,checkbox:a6,contentArea:i6};function o6({copyText:t,isContentBearing:s,isSelecting:i,isSelected:o,checkboxLabel:c,onSelect:u,onToggle:d,onCopied:p,children:h}){const[g,v]=_.useState(!1),y=_.useRef(void 0);_.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=_.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:()=>{b().catch(()=>{})},"aria-label":"Copy event content","data-testid":"event-hover-copy",children:g?r.jsx(_i,{size:it,"aria-hidden":"true"}):r.jsx(e_,{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(L2,{size:it,"aria-hidden":"true"})})]}),h]}):r.jsx("div",{className:ts.row,children:h})}const r6="_bar_1vah7_1",l6="_left_1vah7_21",c6="_right_1vah7_27",u6="_count_1vah7_33",d6="_toggleButton_1vah7_40",f6="_copyButton_1vah7_68",p6="_cancelButton_1vah7_108",li={bar:r6,left:l6,right:c6,count:u6,toggleButton:d6,copyButton:f6,cancelButton:p6};function m6({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(e2,{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(La,{size:it,"aria-hidden":"true"})})]})]})}const sx=50;function h6(t,s,i,o,c=sx){return o?t<c:s-t-i<c}function g6(t,s){const i=s-t;return i>0?i:0}function v6({scrollRef:t,contentLength:s,isReversed:i,paused:o}){const[c,u]=_.useState(!0),d=_.useRef(0),p=_.useRef(!1),h=_.useRef(0);_.useEffect(()=>{const v=t.current;if(!v)return;let y=!0;const b=()=>{h.current||(h.current=requestAnimationFrame(()=>{h.current=0;const k=h6(v.scrollTop,v.scrollHeight,v.clientHeight,i,sx);k!==y&&(y=k,u(k))}))};return v.addEventListener("scroll",b,{passive:!0}),()=>{v.removeEventListener("scroll",b),h.current&&(cancelAnimationFrame(h.current),h.current=0)}},[t,i]),_.useLayoutEffect(()=>{const v=t.current;!v||p.current||(p.current=!0,i?v.scrollTop=0:v.scrollTop=v.scrollHeight,u(!0))},[t,i]),_.useLayoutEffect(()=>{const v=t.current;if(v){if(o){d.current=v.scrollHeight;return}if(i&&!c){const y=g6(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=_.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 y6=new Set(["text","output","user_input","tool_use","tool_result","error"]);function Kr(t){return y6.has(t.eventType)}function b6(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 wb(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 _6(t){var i;const s=[];for(const o of t){if(!Kr(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=wb(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=wb(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 x6({events:t,formatForClipboard:s}){const[i,o]=_.useState(!1),[c,u]=_.useState(new Set),d=_.useRef(void 0),p=_.useMemo(()=>c.size,[c]),h=_.useCallback(S=>{o(!0),S!==void 0?(u(new Set([S])),d.current=S):(u(new Set),d.current=void 0)},[]),g=_.useCallback(()=>{o(!1),u(new Set),d.current=void 0},[]),v=_.useCallback((S,N)=>{if(N&&d.current!==void 0){const j=Math.min(d.current,S),T=Math.max(d.current,S);u(C=>{const E=new Set(C);for(let A=j;A<=T;A++)A<t.length&&Kr(t[A])&&E.add(A);return E})}else u(j=>{const T=new Set(j);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=_.useCallback(()=>{const S=new Set;for(let N=0;N<t.length;N++)Kr(t[N])&&S.add(N);u(S)},[t]),b=_.useCallback(()=>{u(new Set)},[]),k=_.useCallback(async()=>{const N=[...c].sort((T,C)=>T-C).filter(T=>T<t.length).map(T=>t[T]);if(N.length===0)return!1;const j=s(N);try{return await navigator.clipboard.writeText(j),!0}catch{return!1}},[c,t,s]);return{isSelecting:i,selectedIndices:c,selectedCount:p,enterSelectionMode:h,cancelSelection:g,toggleEvent:v,selectAll:y,deselectAll:b,copySelected:k}}const k6="_wrapper_1cdza_1",S6="_scrollContainer_1cdza_9",T6="_selectingPadding_1cdza_16",w6="_toolbar_1cdza_20",N6="_directionToggle_1cdza_27",j6="_scrollToAnchor_1cdza_65",C6="_scrollToAnchorBottom_1cdza_89",E6="_scrollToAnchorTop_1cdza_93",A6="_eventOverflowWarning_1cdza_97",Gs={wrapper:k6,scrollContainer:S6,selectingPadding:T6,toolbar:w6,directionToggle:N6,scrollToAnchor:j6,scrollToAnchorBottom:C6,scrollToAnchorTop:E6,eventOverflowWarning:A6};function D6(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 ax="grackle-stream-direction";function R6(){try{return localStorage.getItem(ax)==="reversed"}catch{return!1}}function M6({eventsDropped:t}){return t<=0?r.jsx(r.Fragment,{}):r.jsxs("div",{className:Gs.eventOverflowWarning,role:"alert",children:[r.jsx(Fp,{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 zm({events:t,eventsDropped:s,emptyState:i,onShowToast:o}){const c=_.useRef(null),[u,d]=_.useState(R6),p=LM(),h=x6({events:t,formatForClipboard:_6}),g=_.useMemo(()=>t.filter(Kr).length,[t]),v=_.useMemo(()=>u?[...t].reverse():t,[t,u]),{isAtAnchor:y,scrollToAnchor:b}=v6({scrollRef:c,contentLength:t.length,isReversed:u,paused:h.isSelecting}),k=()=>{const T=!u;d(T);try{localStorage.setItem(ax,T?"reversed":"default")}catch{}};_.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=_.useCallback(async()=>{await h.copySelected()&&(o==null||o(`Copied ${h.selectedCount} message${h.selectedCount===1?"":"s"} to clipboard`,"success"))},[h,o]),N=p?0:.2,j=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(F0,{size:Gt,"aria-hidden":"true"}):r.jsx(Z0,{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(M6,{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:j},animate:{opacity:1,y:0},transition:{duration:N,ease:"easeOut"},children:r.jsx(o6,{copyText:b6(T),isContentBearing:Kr(T),isSelecting:h.isSelecting,isSelected:h.selectedIndices.has(E),checkboxLabel:D6(T),onSelect:()=>{h.enterSelectionMode(E)},onToggle:A=>{h.toggleEvent(E,A)},onCopied:()=>{o==null||o("Copied to clipboard","success")},children:r.jsx(uA,{event:T,toolUseCtx:T.toolUseCtx,settled:T.settled})})},`${T.sessionId}-${T.timestamp}-${E}`)})})]}),r.jsx(os,{children:h.isSelecting&&r.jsx(m6,{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:b,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.15},"aria-label":"Scroll to latest","data-testid":"scroll-to-anchor",children:[u?r.jsx(Z0,{size:Gt,"aria-hidden":"true"}):r.jsx(F0,{size:Gt,"aria-hidden":"true"})," New events"]})})]})}function Um(t){const{value:s,onSave:i,validate:o,fieldId:c,activeFieldId:u,onActivate:d,enterToSave:p=!0,trimOnSave:h=!0}=t,[g,v]=_.useState(""),[y,b]=_.useState(""),k=_.useRef(!1),S=u===c,N=_.useCallback(B=>{v(B),b("")},[]),j=_.useCallback(()=>{b("")},[]),T=_.useCallback(()=>{k.current=!1,d==null||d(null),v(""),b("")},[d]),C=_.useCallback(()=>{const B=h?g.trim():g;if(o){const X=o(g);if(X){b(X);return}}const z=h?s.trim():s;if(B===z){T();return}i(B),T()},[g,s,h,o,i,T]),E=_.useCallback(()=>{k.current=!0,d==null||d(c),v(s),b("")},[c,s,d]),A=_.useCallback(B=>{if(k.current){k.current=!1;return}B.relatedTarget instanceof HTMLElement&&B.relatedTarget.dataset.editAction===c||C()},[c,C]),I=_.useCallback(B=>{B.key==="Escape"?T():B.key==="Enter"&&p&&C()},[T,p,C]),D=(()=>{if(!S)return!1;const B=h?s.trim():s;return(h?g.trim():g)!==B})();return _.useEffect(()=>{!S&&(g!==""||y!=="")&&(v(""),b(""))},[S,g,y]),{isEditing:S,draft:g,error:y,isDirty:D,startEdit:E,cancelEdit:T,save:C,setDraft:N,clearError:j,handleBlur:A,handleKeyDown:I,ignoreInitialBlurRef:k}}const I6="_editFieldWrapper_yuzty_1",O6="_editInput_yuzty_10",L6="_editTextarea_yuzty_42",B6="_editSelect_yuzty_78",z6="_editError_yuzty_111",U6="_editInputInvalid_yuzty_118",$6="_editHint_yuzty_123",P6="_unsavedDot_yuzty_132",V6="_metaValueClickable_yuzty_140",H6="_editButton_yuzty_159",q6="_metaPlaceholder_yuzty_175",G6="_worktreeToggle_yuzty_180",Xe={editFieldWrapper:I6,editInput:O6,editTextarea:L6,editSelect:B6,editError:z6,editInputInvalid:U6,editHint:$6,unsavedDot:P6,metaValueClickable:V6,editButton:H6,metaPlaceholder:q6,worktreeToggle:G6};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:b,"data-testid":k}=t,S=_.useRef(null),N=Um({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!0,trimOnSave:!0});if(_.useEffect(()=>{if(N.isEditing){const T=window.setTimeout(()=>{var C;(C=S.current)==null||C.focus()},0);return()=>window.clearTimeout(T)}},[N.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":b,"data-testid":k?`${k}-input`:void 0}),C&&r.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:C})]})}if(N.isEditing)return r.jsxs("div",{className:Xe.editFieldWrapper,children:[r.jsx("input",{ref:S,className:`${Xe.editInput} ${N.error?Xe.editInputInvalid:""}`,value:N.draft,onChange:T=>N.setDraft(T.target.value),onBlur:N.handleBlur,onKeyDown:N.handleKeyDown,maxLength:y,placeholder:v,"aria-label":b,"data-testid":k?`${k}-input`:void 0}),N.isDirty&&r.jsx("span",{className:Xe.unsavedDot,title:"Unsaved changes"}),N.error&&r.jsx("span",{className:Xe.editError,"data-testid":"edit-error",children:N.error}),r.jsx("span",{className:Xe.editHint,children:"Enter to save · Esc to cancel"})]});const j=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:Xe.metaValueClickable,onClick:()=>N.startEdit(),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),N.startEdit())},title:"Click to edit","aria-label":b,"data-testid":k?`${k}-button`:void 0,children:[j!==void 0?j: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 Up(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":b}=t,k=_.useRef(null),S=Um({value:s,onSave:i,validate:o,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});if(_.useEffect(()=>{if(S.isEditing){const j=window.setTimeout(()=>{var T;(T=k.current)==null||T.focus()},0);return()=>window.clearTimeout(j)}},[S.isEditing]),c==="create"){const j=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:j,placeholder:v,"aria-label":y,"data-testid":b?`${b}-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:j=>S.setDraft(j.target.value),onBlur:S.handleBlur,onKeyDown:S.handleKeyDown,title:y,"aria-label":y,"data-testid":b?`${b}-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 N=g==null?void 0:g(s);return r.jsxs("span",{role:"button",tabIndex:0,className:Xe.metaValueClickable,onClick:()=>S.startEdit(),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),S.startEdit())},title:"Click to edit","aria-label":y,"data-testid":b?`${b}-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 Qc(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":b}=t,k=_.useRef(null),S=Um({value:s,onSave:i,fieldId:u,activeFieldId:d,onActivate:p,enterToSave:!1,trimOnSave:!1});_.useEffect(()=>{if(S.isEditing){const A=window.setTimeout(()=>{var I;(I=k.current)==null||I.focus()},0);return()=>window.clearTimeout(A)}},[S.isEditing]);const N=_.useCallback(A=>{const I=A.target.value;S.ignoreInitialBlurRef.current=!1,I!==s&&i(I),S.cancelEdit()},[s,i,S]),j=_.useCallback(A=>{if(S.ignoreInitialBlurRef.current){S.ignoreInitialBlurRef.current=!1;return}A.relatedTarget instanceof HTMLElement&&A.relatedTarget.dataset.editAction===u||S.cancelEdit()},[u,S]);if(o==="create")return r.jsx("select",{className:Xe.editSelect,value:s,onChange:A=>h==null?void 0:h(A.target.value),"aria-label":y,"data-testid":b?`${b}-select`:void 0,children:c.map(A=>r.jsx("option",{value:A.value,children:A.label},A.value))});if(S.isEditing)return r.jsx("select",{ref:k,className:Xe.editSelect,value:S.draft,onChange:N,onBlur:j,title:y,"aria-label":y,"data-testid":b?`${b}-select`:void 0,children:c.map(A=>r.jsx("option",{value:A.value,children:A.label},A.value))});const T=g==null?void 0:g(s),C=(E=c.find(A=>A.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":b?`${b}-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 F6(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 Z6="_envRow_1e1r5_1",K6="_envDot_1e1r5_7",Y6="_envDotGreen_1e1r5_14",J6="_envDotYellow_1e1r5_18",W6="_envDotRed_1e1r5_22",X6="_envDotGray_1e1r5_26",_o={envRow:Z6,envDot:K6,envDotGreen:Y6,envDotYellow:J6,envDotRed:W6,envDotGray:X6};function Q6(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?_o.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?_o.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?_o.envDotRed:_o.envDotGray}function e4(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),b=[...c?[{value:"",label:"None"}]:[],...o.map(S=>({value:S.id,label:S.displayName}))],k=()=>{if(y)return r.jsxs("span",{className:_o.envRow,children:[r.jsx("span",{className:`${_o.envDot} ${Q6(y.status)}`}),y.displayName]})};return r.jsx(Qc,{value:s,onSave:i,options:b,fieldId:u,activeFieldId:d,onActivate:p,renderDisplay:k,placeholder:h,ariaLabel:g,"data-testid":v})}const t4="_nav_1snmp_1",n4="_searchForm_1snmp_8",s4="_searchInput_1snmp_15",a4="_searchButton_1snmp_33",i4="_clearButton_1snmp_68",o4="_workspaceSelect_1snmp_85",r4="_listHeader_1snmp_99",l4="_nodeList_1snmp_108",c4="_nodeItem_1snmp_116",u4="_indicator_1snmp_129",d4="_label_1snmp_136",f4="_badge_1snmp_145",Vn={nav:t4,searchForm:n4,searchInput:s4,searchButton:a4,clearButton:i4,workspaceSelect:o4,listHeader:r4,nodeList:l4,nodeItem:c4,indicator:u4,label:d4,badge:f4};function p4({nodes:t,workspaces:s,loading:i,searchQuery:o,onSearch:c,onClearSearch:u,onSelectNode:d,onWorkspaceChange:p}){const[h,g]=_.useState(""),v=_.useCallback(S=>{S.preventDefault(),h.trim()&&c(h.trim())},[h,c]),y=_.useCallback(()=>{g(""),u()},[u]),b=_.useCallback(S=>{d(S)},[d]),k=_.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:()=>{b(S.id)},onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),b(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 m4="_container_1mq5u_1",h4="_hamburger_1mq5u_33",g4="_brand_1mq5u_49",v4="_brandLogo_1mq5u_68",y4="_info_1mq5u_75",b4="_connectionLabel_1mq5u_90",_4="_connectionDot_1mq5u_103",x4="_connected_1mq5u_106",k4="_disconnected_1mq5u_110",Hs={container:m4,hamburger:h4,brand:g4,brandLogo:v4,info:y4,connectionLabel:b4,connectionDot:_4,connected:x4,disconnected:k4};function S4({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(x2,{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:Zp,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 T4="_nav_13gkc_1",w4="_tab_13gkc_35",N4="_tabIcon_13gkc_68",j4="_tabLabel_13gkc_79",C4="_tabActive_13gkc_84",wr={nav:T4,tab:w4,tabIcon:N4,tabLabel:j4,tabActive:C4},ci=[{view:"dashboard",label:"Dashboard",icon:r.jsx(l2,{size:Mt}),route:yi,testId:"sidebar-tab-dashboard"},{view:"chat",label:"Chat",icon:r.jsx(S2,{size:Mt}),route:GN,testId:"sidebar-tab-chat"},{view:"tasks",label:"Tasks",icon:r.jsx(YT,{size:Mt}),route:FN,testId:"sidebar-tab-tasks"},{view:"environments",label:"Environments",icon:r.jsx(w2,{size:Mt}),route:ko,testId:"sidebar-tab-environments"},{view:"knowledge",label:"Knowledge",icon:r.jsx(HT,{size:Mt}),route:S_,testId:"sidebar-tab-knowledge"},{view:"findings",label:"Findings",icon:r.jsx(t_,{size:Mt}),route:lu,testId:"sidebar-tab-findings"},{view:"settings",label:"Settings",icon:r.jsx(I2,{size:Mt}),route:PN,testId:"sidebar-tab-settings"}];function E4(t){return t===yi||t==="/"?"dashboard":t.startsWith("/chat")||t.startsWith("/sessions")?"chat":t.startsWith("/workspaces")||t.startsWith("/environments")?"environments":t.startsWith(S_)?"knowledge":t.startsWith(lu)?"findings":t.startsWith(xo)?"settings":"tasks"}function A4(){const t=Pt(),s=bt(),i=_.useRef(null),o=E4(t.pathname),c=_.useCallback(d=>{s(d.route)},[s]),u=_.useCallback(d=>{var y,b;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),(b=p[v])==null||b.focus()},[o,s]);return r.jsx("nav",{className:wr.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:`${wr.tab} ${p?wr.tabActive:""}`,onClick:()=>c(d),"data-testid":d.testId,title:d.label,"aria-label":d.label,children:[r.jsx("span",{className:wr.tabIcon,"aria-hidden":"true",children:d.icon}),r.jsx("span",{className:wr.tabLabel,children:d.label})]},d.view)})})}const D4="_container_pi6ii_1",R4="_content_pi6ii_66",Nb={container:D4,content:R4},M4=320,ix=220,ox=600,rx="grackle-sidebar-width";function I4(){try{const t=localStorage.getItem(rx);if(t!==null){const s=Number(t);if(Number.isFinite(s)&&s>=ix&&s<=ox)return s}}catch{}return M4}function O4(t){try{localStorage.setItem(rx,String(t))}catch{}}function L4({content:t}){const[s]=_.useState(I4),i=_.useRef(null);if(_.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>=ix&&h<=ox&&O4(h)}}});return c.observe(o),()=>{c.disconnect()}},[]),t!==void 0)return r.jsx("div",{className:Nb.container,ref:i,"data-testid":"sidebar",style:{width:s},children:r.jsx("div",{className:Nb.content,children:t})})}const B4="_bar_tnfsh_1",z4="_btnPrimary_tnfsh_32",U4="_statusText_tnfsh_85",$4="_statusCompleted_tnfsh_90",P4="_statusFailed_tnfsh_94",V4="_statusBlocked_tnfsh_98",H4="_hintText_tnfsh_103",kt={bar:B4,btnPrimary:z4,statusText:U4,statusCompleted:$4,statusFailed:P4,statusBlocked:V4,hintText:H4};function q4({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"),b=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/findings"),k=Nt("/environments/:environmentId/workspaces/:workspaceId/tasks/:taskId/edit"),S=Nt("/sessions/new"),N=Nt("/environments/:environmentId/workspaces/:workspaceId"),j=Nt("/tasks/new"),T=Nt("/chat"),C=Nt("/"),E=Nt("/settings/*"),A=u==null?void 0:u.params.sessionId,I=(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)??(b==null?void 0:b.params.taskId)??(k==null?void 0:k.params.taskId),D=v??y??b??k,B=(D==null?void 0:D.params.environmentId)??(N==null?void 0:N.params.environmentId),z=c.pathname.startsWith("/environments")&&!N&&!D,X=!!T,Y=!!S,F=!!N&&!v&&!y&&!b&&!k,te=!!j;if(!!C&&!Y&&!F&&!te||!!E||(!!g||!!k)||te||z||Y)return r.jsx(r.Fragment,{});if(X)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(F)return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Select a task or click + to create one"})});if(I){const L=s.find(re=>re.id===I);if(!L)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])),ae=L.dependsOn.some(re=>{const de=Z.get(re);return de!==void 0&&de.status!=="complete"});if(L.status==="not_started"){const re=ae?L.dependsOn.map(de=>Z.get(de)).filter(de=>de&&de.status!=="complete").map(de=>de.title):[];return r.jsx("div",{className:kt.bar,children:ae?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(L.status==="working"||L.status==="paused"){const re=L.latestSessionId||void 0,de=re?t.find(je=>je.id===re):void 0;return de&&de.status!=="stopped"?r.jsx(r.Fragment,{}):r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Waiting for agent..."})})}if(L.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(L.workspaceId,void 0,B)),className:kt.btnPrimary,children:"+ New Task"})]});if(L.status==="failed")return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:`${kt.statusText} ${kt.statusFailed}`,children:"Task failed"})})}if(A){const L=t.find(re=>re.id===A),Z=(L==null?void 0:L.status)==="stopped";if(L!==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 ",L.endReason||L.status]}),r.jsx("button",{onClick:()=>o(__(L.environmentId)),className:kt.btnPrimary,children:"+ New Chat"})]})}return r.jsx("div",{className:kt.bar,children:r.jsx("span",{className:kt.hintText,children:"Loading..."})})}const G4="_nav_14i94_1",F4="_tab_14i94_24",Z4="_tabActive_14i94_62",K4="_tabLabel_14i94_75",Y4="_statusDot_14i94_81",J4="_pulse_14i94_87",W4="_addButton_14i94_99",X4="_empty_14i94_132",Na={nav:G4,tab:F4,tabActive:Z4,tabLabel:K4,statusDot:Y4,pulse:J4,addButton:W4,empty:X4},Q4={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function eI({environments:t}){const s=bt(),i=_.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=_.useCallback(b=>{s(vi(b))},[s]),v=_.useCallback(b=>{var T;const k=(T=i.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),N=S>=0?S:t.findIndex(C=>C.id===h);let j=N;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),j=(N+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),j=(N-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),j=0;else if(b.key==="End")b.preventDefault(),j=k.length-1;else return;j<t.length&&s(vi(t[j].id)),k[j].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(b=>{const k=b.id===h,S=b.id===y,N=Q4[b.status]||"var(--text-tertiary)",j=b.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(b.id),"data-testid":"env-nav-item",children:[r.jsx("span",{className:`${Na.statusDot} ${j?Na.pulse:""}`,style:{color:N},"aria-hidden":"true",children:r.jsx(Ra,{size:Zp,fill:"currentColor"})}),r.jsx("span",{className:Na.tabLabel,title:b.displayName||b.id,children:b.displayName||b.id})]},b.id)})}),r.jsx("button",{type:"button",className:Na.addButton,onClick:()=>s(UN),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 $m(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 jb={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 eu(t){return jb[t]||jb.general}const tI="_nav_dlm8m_1",nI="_categoryPills_dlm8m_24",sI="_categoryPill_dlm8m_24",aI="_tab_dlm8m_42",iI="_tabActive_dlm8m_80",oI="_tabContent_dlm8m_93",rI="_tabLabel_dlm8m_100",lI="_tabMeta_dlm8m_106",cI="_categoryDot_dlm8m_111",uI="_empty_dlm8m_118",gs={nav:tI,categoryPills:nI,categoryPill:sI,tab:aI,tabActive:iI,tabContent:oI,tabLabel:rI,tabMeta:lI,categoryDot:cI,empty:uI};function dI({findings:t,workspaceId:s,environmentId:i}){const o=bt(),c=_.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=_.useMemo(()=>{const b=new Set(t.map(k=>k.category).filter(Boolean));return Array.from(b).sort()},[t]),g=_.useCallback(b=>{o(xp(b,s,i))},[o,s,i]),v=_.useCallback(b=>{var T;const k=(T=c.current)==null?void 0:T.querySelectorAll('[role="tab"]');if(!k||k.length===0)return;const S=Array.from(k).findIndex(C=>C===document.activeElement),N=S>=0?S:t.findIndex(C=>C.id===p);let j=N;if(b.key==="ArrowDown"||b.key==="j"||b.key==="J")b.preventDefault(),j=(N+1)%k.length;else if(b.key==="ArrowUp"||b.key==="k"||b.key==="K")b.preventDefault(),j=(N-1+k.length)%k.length;else if(b.key==="Home")b.preventDefault(),j=0;else if(b.key==="End")b.preventDefault(),j=k.length-1;else return;j<t.length&&o(xp(t[j].id,s,i)),k[j].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(b=>r.jsx("span",{className:gs.categoryPill,style:{color:eu(b).text},children:b},b))}),r.jsx("nav",{ref:c,role:"tablist","aria-orientation":"vertical","aria-label":"Findings",onKeyDown:v,children:t.map(b=>{const k=b.id===p,S=b.id===y;return r.jsxs("button",{role:"tab",type:"button","aria-selected":k,tabIndex:S?0:-1,className:`${gs.tab} ${k?gs.tabActive:""}`,onClick:()=>g(b.id),"data-testid":"finding-nav-item",children:[r.jsx("span",{className:gs.categoryDot,style:{color:eu(b.category).text},"aria-hidden":"true",children:r.jsx(Ra,{size:Zp,fill:"currentColor"})}),r.jsxs("span",{className:gs.tabContent,children:[r.jsx("span",{className:gs.tabLabel,title:b.title,children:b.title}),r.jsx("span",{className:gs.tabMeta,title:b.createdAt,children:$m(b.createdAt)})]})]},b.id)})}),t.length===0&&r.jsx("div",{className:gs.empty,children:"No findings yet. Agents will post discoveries here."})]})}function fI(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 lx({text:t,indices:s,highlightClass:i}){if(!s||s.length===0)return r.jsx(r.Fragment,{children:t});const o=fI(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 pI(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 mI(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 H2){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 hI="_container_z4i38_1",gI="_header_z4i38_5",vI="_headerActions_z4i38_17",yI="_searchInput_z4i38_23",bI="_searchHighlight_z4i38_56",_I="_groupToggle_z4i38_62",xI="_groupToggleActive_z4i38_89",kI="_addButton_z4i38_93",SI="_taskRow_z4i38_120",TI="_selected_z4i38_140",wI="_expandArrow_z4i38_150",NI="_expanded_z4i38_157",jI="_leafSpacer_z4i38_161",CI="_taskStatusIcon_z4i38_166",EI="_taskTitle_z4i38_170",AI="_workspaceBadge_z4i38_177",DI="_childCountBadge_z4i38_195",RI="_dependencyBadge_z4i38_208",MI="_blockedBadge_z4i38_220",II="_addChildButton_z4i38_225",OI="_emptyState_z4i38_268",LI="_statusGroupHeader_z4i38_275",BI="_statusGroupIcon_z4i38_294",zI="_statusGroupLabel_z4i38_298",UI="_statusGroupCount_z4i38_303",He={container:hI,header:gI,headerActions:vI,searchInput:yI,searchHighlight:bI,groupToggle:_I,groupToggleActive:xI,addButton:kI,taskRow:SI,selected:TI,expandArrow:wI,expanded:NI,leafSpacer:jI,taskStatusIcon:CI,taskTitle:EI,workspaceBadge:AI,childCountBadge:DI,dependencyBadge:RI,blockedBadge:MI,addChildButton:II,emptyState:OI,statusGroupHeader:LI,statusGroupIcon:BI,statusGroupLabel:zI,statusGroupCount:UI},$I=[{name:"title",weight:2},{name:"description",weight:1}],cx=16,PI=16,ux="grackle-task-group-by-status";function Cb(){try{return localStorage.getItem(ux)==="true"}catch{return!1}}function VI(t){try{localStorage.setItem(ux,String(t))}catch{}}function HI({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":`${cx}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-${Jr(p.status)}`,children:h.icon}),r.jsx("span",{className:He.taskTitle,title:p.title,children:r.jsx(lx,{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 dx({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),b=t.children.length>0,k=c===t.id,S=cx+s*PI,j=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:[b&&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"})}),!b&&r.jsx("span",{className:He.leafSpacer}),r.jsx("span",{className:He.taskStatusIcon,style:{color:g.color},"aria-hidden":"true","data-testid":`task-status-${Jr(t.status)}`,children:g.icon}),r.jsx("span",{className:He.taskTitle,title:t.title,children:r.jsx(lx,{text:t.title,indices:p.get(t.id),highlightClass:He.searchHighlight})}),j&&r.jsx("span",{className:He.workspaceBadge,title:j,children:j}),b&&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<QS&&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:b&&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(dx,{node:T,depth:s+1,expandedTasks:i,toggleTask:o,selectedTaskId:c,navigate:u,taskStatusById:d,titleHighlights:p,workspaceNames:h},T.id))})})]})}function qI({workspaces:t,tasks:s}){const i=bt(),[o,c]=_.useState(new Set),[u,d]=_.useState(new Set),[p,h]=_.useState(Cb),[g,v]=_.useState(Cb),[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,N=_.useMemo(()=>new Map(s.map(se=>[se.id,se.status])),[s]),j=_.useMemo(()=>new Map(t.map(se=>[se.id,se.name])),[t]),T=()=>{const se=!p;VI(se),h(se),se&&(v(!0),b(new Map))},C=se=>{b(J=>{const L=new Map(J),Z=L.has(se)?L.get(se):g;return L.set(se,!Z),L})},E=se=>y.has(se)?y.get(se):g,A=se=>{c(J=>{const L=new Set(J);return L.has(se)?(L.delete(se),d(Z=>new Set(Z).add(se))):(L.add(se),d(Z=>{const ae=new Set(Z);return ae.delete(se),ae})),L})};_.useEffect(()=>{const se=new Set(s.filter(J=>J.parentTaskId).map(J=>J.parentTaskId));se.size>0&&c(J=>{const L=new Set(J);for(const Z of se)u.has(Z)||L.add(Z);return L})},[s,u]);const[I,D]=_.useState(""),{directMatchTaskIds:B,treeMatchTaskIds:z,titleHighlights:X}=_.useMemo(()=>{if(!I.trim())return{directMatchTaskIds:null,treeMatchTaskIds:null,titleHighlights:new Map};const se=XS(s,I,$I),J=new Set(se.map(re=>re.item.id)),L=new Map;for(const re of se){const de=re.matches.find(Ke=>Ke.key==="title");de&&L.set(re.item.id,de.indices)}const Z=new Set(J),ae=new Map(s.map(re=>[re.id,re]));for(const re of[...J]){let de=ae.get(re);for(;de!=null&&de.parentTaskId;)Z.add(de.parentTaskId),de=ae.get(de.parentTaskId)}return{directMatchTaskIds:J,treeMatchTaskIds:Z,titleHighlights:L}},[I,s]),Y=B!==null,F=Y?p?B:z:null,te=F?s.filter(se=>F.has(se.id)):s,le=p?[]:pI(te);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(v2,{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:I,onChange:se=>D(se.target.value),placeholder:"Filter...","aria-label":"Filter tasks",className:He.searchInput,"data-testid":"sidebar-search"}),p?mI(te,N).map(se=>r.jsx(HI,{group:se,isExpanded:E(se.status),onToggle:()=>C(se.status),selectedTaskId:S,navigate:i,titleHighlights:X,workspaceNames:j},se.status)):le.map(se=>r.jsx(dx,{node:se,depth:0,expandedTasks:o,toggleTask:A,selectedTaskId:S,navigate:i,taskStatusById:N,titleHighlights:X,workspaceNames:j},se.id)),te.length===0&&!Y&&r.jsx("div",{className:He.emptyState,children:"No tasks yet. Click + to create one."}),te.length===0&&Y&&r.jsx("div",{className:He.emptyState,children:"No matching tasks"})]})}const GI="_toast_ed2dk_1",FI="_success_ed2dk_18",ZI="_icon_ed2dk_22",KI="_error_ed2dk_25",YI="_warning_ed2dk_32",JI="_info_ed2dk_38",WI="_message_ed2dk_53",XI="_close_ed2dk_60",Nr={toast:GI,success:FI,icon:ZI,error:KI,warning:YI,info:JI,message:WI,close:XI},QI={success:r.jsx(_i,{size:Mt}),error:r.jsx(La,{size:Mt}),warning:r.jsx(Fp,{size:Mt}),info:r.jsx(Gp,{size:Mt})};function eO({toast:t,onDismiss:s}){return _.useEffect(()=>{const i=setTimeout(()=>s(t.id),t.duration);return()=>clearTimeout(i)},[t.id,t.duration,s]),r.jsxs(Ct.div,{className:`${Nr.toast} ${Nr[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:Nr.icon,"aria-hidden":"true",children:QI[t.variant]}),r.jsx("span",{className:Nr.message,children:t.message}),r.jsx("button",{type:"button",className:Nr.close,onClick:()=>s(t.id),"aria-label":"Dismiss notification",children:r.jsx(La,{size:Gt,"aria-hidden":"true"})})]})}const tO="_container_qqse2_1",nO={container:tO};function sO({toasts:t,onDismiss:s}){return r.jsx("div",{className:nO.container,"data-testid":"toast-container",children:r.jsx(os,{children:t.map(i=>r.jsx(eO,{toast:i,onDismiss:s},i.id))})})}const aO="_callout_e5awm_1",iO="_success_e5awm_11",oO="_icon_e5awm_15",rO="_error_e5awm_18",lO="_warning_e5awm_25",cO="_info_e5awm_32",uO="_content_e5awm_48",dO="_close_e5awm_53",jr={callout:aO,success:iO,icon:oO,error:rO,warning:lO,info:cO,content:uO,close:dO},fO={success:r.jsx(_i,{size:Mt}),error:r.jsx(La,{size:Mt}),warning:r.jsx(Fp,{size:Mt}),info:r.jsx(Gp,{size:Mt})};function pO({variant:t="info",children:s,dismissible:i=!1,className:o}){const[c,u]=_.useState(!1);return r.jsx(r.Fragment,{children:!c&&r.jsxs("div",{className:[jr.callout,jr[t],o].filter(Boolean).join(" "),role:t==="error"||t==="warning"?"alert":"status",children:[r.jsx("span",{className:jr.icon,"aria-hidden":"true",children:fO[t]}),r.jsx("span",{className:jr.content,children:s}),i&&r.jsx("button",{type:"button",className:jr.close,onClick:()=>u(!0),"aria-label":"Dismiss",children:r.jsx(La,{size:Gt,"aria-hidden":"true"})})]})})}function mO({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(pO,{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 hO="_container_de44x_1",gO="_emptyState_de44x_8",vO="_card_de44x_14",yO="_cardClickable_de44x_34",bO="_cardHeader_de44x_42",_O="_categoryBadge_de44x_54",xO="_findingTitle_de44x_62",kO="_findingDate_de44x_68",SO="_findingContent_de44x_80",TO="_tags_de44x_86",wO="_tag_de44x_86",ns={container:hO,emptyState:gO,card:vO,cardClickable:yO,cardHeader:bO,categoryBadge:_O,findingTitle:xO,findingDate:kO,findingContent:SO,tags:TO,tag:wO};function fx({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=eu(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:$m(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 NO="_section_1ingb_14",jO="_sectionTitle_1ingb_26",CO="_sectionDescription_1ingb_35",EO="_tokenList_1ingb_48",AO="_tokenRow_1ingb_55",DO="_tokenBadge_1ingb_68",RO="_tokenName_1ingb_83",MO="_tokenTarget_1ingb_90",IO="_deleteButton_1ingb_99",OO="_addForm_1ingb_113",LO="_formRow_1ingb_119",BO="_input_1ingb_125",zO="_select_1ingb_155",UO="_addButton_1ingb_187",$O="_emptyStateInfo_1ingb_221",PO="_themeOptions_1ingb_229",VO="_themeOption_1ingb_229",HO="_themeOptionSelected_1ingb_254",qO="_themeOptionHeader_1ingb_259",GO="_themeOptionLabel_1ingb_266",FO="_themeOptionDesc_1ingb_273",ZO="_variantToggle_1ingb_279",KO="_variantButton_1ingb_286",YO="_variantActive_1ingb_305",JO="_themeSwatches_1ingb_311",WO="_themeSwatch_1ingb_311",XO="_systemToggle_1ingb_325",QO="_systemToggleHint_1ingb_341",e5="_themeActive_1ingb_348",t5="_aboutGrid_1ingb_354",n5="_aboutItem_1ingb_360",s5="_aboutLabel_1ingb_373",a5="_aboutValue_1ingb_379",i5="_aboutDot_1ingb_387",o5="_aboutDotConnected_1ingb_394",r5="_aboutDotDisconnected_1ingb_398",me={section:NO,sectionTitle:jO,sectionDescription:CO,tokenList:EO,tokenRow:AO,tokenBadge:DO,tokenName:RO,tokenTarget:MO,deleteButton:IO,addForm:OO,formRow:LO,input:BO,select:zO,addButton:UO,emptyStateInfo:$O,themeOptions:PO,themeOption:VO,themeOptionSelected:HO,themeOptionHeader:qO,themeOptionLabel:GO,themeOptionDesc:FO,variantToggle:ZO,variantButton:KO,variantActive:YO,themeSwatches:JO,themeSwatch:WO,systemToggle:XO,systemToggleHint:QO,themeActive:e5,aboutGrid:t5,aboutItem:n5,aboutLabel:s5,aboutValue:a5,aboutDot:i5,aboutDotConnected:o5,aboutDotDisconnected:r5},l5=[{value:"env_var",label:"Environment Variable"},{value:"file",label:"File"}];function c5({tokens:t,onSetToken:s,onDeleteToken:i,onShowToast:o}){const[c,u]=_.useState(""),[d,p]=_.useState(""),[h,g]=_.useState("env_var"),[v,y]=_.useState(""),[b,k]=_.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("")},N=T=>{k(T)},j=()=>{b&&(i(b),o==null||o("Token deleted","info")),k(null)};return r.jsxs(r.Fragment,{children:[r.jsx(bi,{isOpen:b!==null,title:"Delete Token?",description:b?`"${b}" will be permanently removed.`:void 0,onConfirm:j,onCancel:()=>k(null)}),r.jsxs("section",{className:me.section,children:[r.jsx("h3",{className:me.sectionTitle,children:"Tokens"}),r.jsx("p",{className:me.sectionDescription,children:"API tokens are auto-pushed to environments when set or updated. Values are write-only."}),t.length===0?r.jsx("div",{className:me.emptyStateInfo,children:"Add your first API token to enable service integrations."}):r.jsx("div",{className:me.tokenList,children:t.map(T=>r.jsxs("div",{className:me.tokenRow,children:[r.jsx("span",{className:me.tokenBadge,children:T.tokenType}),r.jsx("span",{className:me.tokenName,children:T.name}),r.jsx("span",{className:me.tokenTarget,children:T.tokenType==="env_var"?T.envVar:T.filePath}),r.jsx("button",{className:me.deleteButton,onClick:()=>N(T.name),title:`Delete ${T.name}`,"aria-label":`Delete ${T.name}`,children:r.jsx(La,{size:Gt,"aria-hidden":"true"})})]},T.name))}),r.jsxs("form",{className:me.addForm,onSubmit:S,children:[r.jsxs("div",{className:me.formRow,children:[r.jsx("input",{className:me.input,type:"text",placeholder:"Token name",value:c,onChange:T=>u(T.target.value)}),r.jsx("input",{className:me.input,type:"password",placeholder:"Value",value:d,onChange:T=>p(T.target.value)})]}),r.jsxs("div",{className:me.formRow,children:[r.jsx("select",{className:me.select,value:h,onChange:T=>g(T.target.value),children:l5.map(T=>r.jsx("option",{value:T.value,children:T.label},T.value))}),r.jsx("input",{className:me.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:me.addButton,type:"submit",children:"Add Token"})]})]})]})]})}const hu=[{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"]}],px=new Set(hu.map(t=>t.id)),Eb="grackle";function $p(t){return hu.find(s=>s.id===t)}function u5({themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c}){return r.jsxs("section",{className:me.section,children:[r.jsx("h3",{className:me.sectionTitle,children:"Appearance"}),r.jsx("p",{className:me.sectionDescription,children:"Choose how Grackle looks across the app."}),r.jsx("div",{className:me.themeOptions,children:hu.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:`${me.themeOption} ${p?me.themeOptionSelected:""}`,"aria-pressed":p,onClick:()=>i(u.id),children:[r.jsxs("span",{className:me.themeOptionHeader,children:[r.jsxs("span",{children:[r.jsx("span",{className:me.themeOptionLabel,children:u.label}),r.jsx("span",{className:me.themeOptionDesc,children:u.description})]}),d&&r.jsxs("span",{className:me.variantToggle,children:[r.jsx("span",{role:"button",tabIndex:0,className:`${me.variantButton} ${p&&h?me.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:`${me.variantButton} ${p&&!h?me.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:me.themeSwatches,children:u.swatches.map((g,v)=>r.jsx("span",{className:me.themeSwatch,style:{background:g}},v))})]},u.id)})}),r.jsxs("label",{className:me.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:me.systemToggleHint,children:"Automatically switches between light and dark variants when available."}),r.jsxs("p",{className:me.themeActive,children:["Active theme: ",r.jsx("strong",{children:s})]})]})}function d5({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:me.section,"data-testid":"about-panel",children:[r.jsx("h3",{className:me.sectionTitle,children:"About"}),r.jsx("p",{className:me.sectionDescription,children:"Connection status and application information."}),r.jsxs("div",{className:me.aboutGrid,children:[r.jsxs("div",{className:me.aboutItem,children:[r.jsx("span",{className:me.aboutLabel,children:"Connection"}),r.jsxs("span",{className:me.aboutValue,children:[r.jsx("span",{className:`${me.aboutDot} ${t?me.aboutDotConnected:me.aboutDotDisconnected}`}),t?"Connected":"Disconnected"]})]}),r.jsxs("div",{className:me.aboutItem,children:[r.jsx("span",{className:me.aboutLabel,children:"Environments"}),r.jsxs("span",{className:me.aboutValue,children:[o,"/",c," connected"]})]}),r.jsxs("div",{className:me.aboutItem,children:[r.jsx("span",{className:me.aboutLabel,children:"Active Sessions"}),r.jsx("span",{className:me.aboutValue,children:u})]}),r.jsxs("div",{className:me.aboutItem,children:[r.jsx("span",{className:me.aboutLabel,children:"Version"}),r.jsx("span",{className:me.aboutValue,children:"0.90.0"})]})]})]})}const f5="_container_cddyd_1",p5="_header_cddyd_8",m5="_headerTitle_cddyd_35",h5="_badge_cddyd_44",g5="_headerActions_cddyd_54",v5="_body_cddyd_61",y5="_formContent_cddyd_73",b5="_section_cddyd_85",_5="_label_cddyd_91",x5="_titleInput_cddyd_98",k5="_descriptionTextarea_cddyd_131",S5="_parentContext_cddyd_167",T5="_parentLabel_cddyd_175",w5="_parentName_cddyd_182",N5="_personaSelect_cddyd_186",j5="_depList_cddyd_220",C5="_depItem_cddyd_226",E5="_depItemSelected_cddyd_248",A5="_noDeps_cddyd_252",D5="_btnPrimary_cddyd_258",R5="_btnGhost_cddyd_289",We={container:f5,header:p5,headerTitle:m5,badge:h5,headerActions:g5,body:v5,formContent:y5,section:b5,label:_5,titleInput:x5,descriptionTextarea:k5,parentContext:S5,parentLabel:T5,parentName:w5,personaSelect:N5,depList:j5,depItem:C5,depItemSelected:E5,noDeps:A5,btnPrimary:D5,btnGhost:R5};function mx({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 b=bt(),k=t==="edit",S=k&&s?u.find(fe=>fe.id===s):void 0,N=k?(S==null?void 0:S.workspaceId)??"":i??"",[j,T]=_.useState(N),C=N||j,E=d.find(fe=>fe.id===C),A=c??(E==null?void 0:E.environmentId),I=!k&&!i,D=k?(S==null?void 0:S.parentTaskId)??"":o??"",B=D?u.find(fe=>fe.id===D):void 0,[z,X]=_.useState((S==null?void 0:S.title)??""),[Y,F]=_.useState((S==null?void 0:S.description)??""),[te,le]=_.useState((S==null?void 0:S.dependsOn)??[]),[se,J]=_.useState((S==null?void 0:S.defaultPersonaId)??""),[L,Z]=_.useState((S==null?void 0:S.canDecompose)??!1),[ae,re]=_.useState(!1),de=_.useRef(!1);_.useEffect(()=>{k&&S&&!de.current&&(de.current=!0,X(S.title),F(S.description),le(S.dependsOn),J(S.defaultPersonaId),Z(S.canDecompose))},[k,S]);const Ke=u.filter(fe=>fe.workspaceId===C&&(!k||fe.id!==s)&&fe.id!==D),je=z.trim().length>0&&(!k||S!==void 0)&&C.length>0,Te=fe=>{le(Oe=>Oe.includes(fe)?Oe.filter(_t=>_t!==fe):[...Oe,fe])},Ie=()=>{!je||ae||k&&S===void 0||(k&&s?(g(s,z.trim(),Y,te,se),y==null||y("Task updated","success"),v?v():b(rs(s,void 0,C,A),{replace:!0})):(re(!0),h(C,z.trim(),Y,te.length>0?te:void 0,D||void 0,se,L,()=>{y==null||y("Task created","success"),b(i?gi(i,A):"/tasks",{replace:!0})},fe=>{y==null||y(fe,"error"),re(!1)})))},ce=()=>{if(v){v();return}b(k&&s?rs(s,void 0,C,A):i?gi(i,A):"/tasks")},ve=k?"edit task":D?"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}),B&&r.jsxs("span",{className:We.parentContext,children:[r.jsx("span",{className:We.parentLabel,children:"Child of"}),r.jsx("span",{className:We.parentName,children:B.title})]})]}),r.jsxs("div",{className:We.headerActions,children:[r.jsx("button",{onClick:Ie,disabled:!je||ae,className:We.btnPrimary,"data-testid":"task-edit-save",children:ae?"Creating…":k?"Save Changes":"Create"}),r.jsx("button",{onClick:ce,className:We.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:We.body,children:r.jsxs("div",{className:We.formContent,children:[I&&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:j,onChange:fe=>T(fe.target.value),className:We.personaSelect,"data-testid":"task-edit-workspace",children:[r.jsx("option",{value:"",children:"Select a workspace..."}),d.map(fe=>r.jsx("option",{value:fe.id,children:fe.name},fe.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:z,onChange:fe=>X(fe.target.value),placeholder:"Task title...",autoFocus:!0,className:We.titleInput,"data-testid":"task-edit-title",onKeyDown:fe=>{fe.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:Y,onChange:fe=>F(fe.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:se,onChange:fe=>J(fe.target.value),className:We.personaSelect,"data-testid":"task-edit-persona",children:[r.jsx("option",{value:"",children:"(Inherit)"}),p.map(fe=>r.jsx("option",{value:fe.id,children:fe.name},fe.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:L,onChange:fe=>Z(fe.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(fe=>{const Oe=te.includes(fe.id);return r.jsxs("label",{className:`${We.depItem} ${Oe?We.depItemSelected:""}`,"data-testid":`dep-option-${fe.id}`,children:[r.jsx("input",{type:"checkbox",checked:Oe,onChange:()=>Te(fe.id)}),fe.title,r.jsxs("span",{style:{opacity:.5,fontSize:"11px",marginLeft:"4px"},children:["(",fe.status,")"]})]},fe.id)})})]})]})})]})}const M5="_container_legrg_1",I5="_header_legrg_8",O5="_headerTitle_legrg_35",L5="_badge_legrg_44",B5="_headerActions_legrg_54",z5="_body_legrg_61",U5="_formContent_legrg_73",$5="_section_legrg_85",P5="_label_legrg_91",V5="_nameInput_legrg_98",H5="_fieldInput_legrg_131",q5="_adapterSelect_legrg_164",G5="_readOnlyValue_legrg_198",F5="_codespaceSection_legrg_204",Z5="_codespaceActions_legrg_210",K5="_creatingHint_legrg_216",Y5="_errorHint_legrg_222",J5="_btnPrimary_legrg_235",W5="_btnGhost_legrg_266",ie={container:M5,header:I5,headerTitle:O5,badge:L5,headerActions:B5,body:z5,formContent:U5,section:$5,label:P5,nameInput:V5,fieldInput:H5,adapterSelect:q5,readOnlyValue:G5,codespaceSection:F5,codespaceActions:Z5,creatingHint:K5,errorHint:Y5,btnPrimary:J5,btnGhost:W5},Pc=1,Vc=65535;function op(t){if(!t.trim())return!0;const s=Number(t);return Number.isInteger(s)&&s>=Pc&&s<=Vc}function rp(t){try{const s=JSON.parse(t);if(typeof s=="object"&&s!==null&&!Array.isArray(s))return s}catch{}return{}}function X5({codespaceName:t,onCodespaceNameChange:s,envName:i,onEnvNameChange:o,codespaces:c,codespaceError:u,codespaceListError:d,codespaceCreating:p,onCreateCodespace:h}){const[g,v]=_.useState("pick"),[y,b]=_.useState(""),[k,S]=_.useState("");return g==="create"?r.jsxs("div",{className:ie.codespaceSection,children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Repository"}),r.jsx("input",{type:"text",value:y,onChange:N=>b(N.target.value),placeholder:"owner/repo",className:ie.fieldInput,"data-testid":"env-codespace-repo"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Machine Type"}),r.jsx("input",{type:"text",value:k,onChange:N=>S(N.target.value),placeholder:"Machine type (optional)...",className:ie.fieldInput,"data-testid":"env-codespace-machine"})]}),r.jsxs("div",{className:ie.codespaceActions,children:[r.jsx("button",{onClick:()=>{y.trim()&&(h(y.trim(),k.trim()||void 0),v("pick"),b(""),S(""))},disabled:!y.trim(),className:ie.btnPrimary,children:"Create"}),r.jsx("button",{onClick:()=>{v("pick"),b(""),S("")},className:ie.btnGhost,children:"Cancel"})]})]}):r.jsx("div",{className:ie.codespaceSection,children:r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Codespace"}),!d&&r.jsxs("select",{value:t,onChange:N=>{N.target.value==="__create__"?(v("create"),s("")):(s(N.target.value),N.target.value&&!i.trim()&&o(N.target.value))},disabled:p,className:ie.adapterSelect,"data-testid":"env-codespace-select",children:[r.jsx("option",{value:"",children:"Select a codespace..."}),c.map(N=>r.jsxs("option",{value:N.name,children:[N.name," (",N.repository,") — ",N.state]},N.name)),r.jsx("option",{value:"__create__",children:"Create new from repo..."})]}),p&&r.jsx("span",{className:ie.creatingHint,children:"Creating codespace..."}),d&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:ie.errorHint,children:d}),r.jsx("input",{type:"text",value:t,onChange:N=>s(N.target.value),placeholder:"Or enter codespace name manually...",className:ie.fieldInput,"data-testid":"env-codespace-manual"})]}),u&&!d&&r.jsx("span",{className:ie.errorHint,children:u})]})})}function hx({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 b=bt(),k=t==="edit",S=k&&s?i.find(ce=>ce.id===s):void 0,[N,j]=_.useState(""),[T,C]=_.useState("local"),[E,A]=_.useState(""),[I,D]=_.useState(""),[B,z]=_.useState(""),[X,Y]=_.useState(""),[F,te]=_.useState(""),[le,se]=_.useState(""),[J,L]=_.useState(""),[Z,ae]=_.useState(null),re=_.useCallback(()=>{const ce={};if(T==="local"){if(E.trim()&&(ce.host=E.trim()),I.trim()){const ve=Number(I);Number.isInteger(ve)&&(ce.port=ve)}}else if(T==="ssh"){if(ce.host=E.trim(),B.trim()&&(ce.user=B.trim()),I.trim()){const ve=Number(I);Number.isInteger(ve)&&(ce.sshPort=ve)}X.trim()&&(ce.identityFile=X.trim())}else T==="docker"?(F.trim()&&(ce.image=F.trim()),le.trim()&&(ce.repo=le.trim())):T==="codespace"&&(ce.codespaceName=J.trim());return ce},[T,E,I,B,X,F,le,J]),de=()=>!(!N.trim()||T==="ssh"&&!E.trim()||T==="codespace"&&!J.trim()||(T==="local"||T==="ssh")&&!op(I)),Ke=()=>{de()&&(o(N.trim(),T,re()),y==null||y("Environment added successfully","success"),b(ko,{replace:!0}))},je=()=>{b(s?vi(s):ko)},Te=_.useCallback((ce,ve)=>{if(!S||!s)return;const fe=rp(S.adapterConfig),Oe=ve.trim();Oe?fe[ce]=Oe:delete fe[ce],c(s,{adapterConfig:fe})},[S,s,c]),Ie=_.useCallback((ce,ve)=>{if(!S||!s)return;const fe=rp(S.adapterConfig);if(ve.trim()){const Oe=Number(ve);Number.isInteger(Oe)&&Oe>=Pc&&Oe<=Vc&&(fe[ce]=Oe)}else delete fe[ce];c(s,{adapterConfig:fe})},[S,s,c]);if(k){if(!S)return r.jsxs("div",{className:ie.container,children:[r.jsxs("div",{className:ie.header,children:[r.jsx("div",{className:ie.headerTitle,children:r.jsx("span",{className:ie.badge,children:"edit environment"})}),r.jsx("div",{className:ie.headerActions,children:r.jsx("button",{onClick:je,className:ie.btnGhost,children:"Back"})})]}),r.jsx("div",{className:ie.body,children:r.jsx("div",{className:ie.formContent,children:r.jsx("span",{className:ie.readOnlyValue,children:"Environment not found"})})})]});const ce=rp(S.adapterConfig);return r.jsxs("div",{className:ie.container,"data-testid":"env-edit-panel",children:[r.jsxs("div",{className:ie.header,children:[r.jsx("div",{className:ie.headerTitle,children:r.jsx("span",{className:ie.badge,children:"edit environment"})}),r.jsx("div",{className:ie.headerActions,children:r.jsx("button",{onClick:je,className:ie.btnGhost,"data-testid":"env-edit-back",children:"Back"})})]}),r.jsx("div",{className:ie.body,children:r.jsxs("div",{className:ie.formContent,children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.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:ae,placeholder:"Environment name",ariaLabel:"Environment name","data-testid":"env-edit-name"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Adapter Type"}),r.jsx("span",{className:ie.readOnlyValue,"data-testid":"env-edit-adapter-type",children:S.adapterType})]}),S.adapterType==="local"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Host"}),r.jsx(Xt,{value:String(ce.host??""),onSave:ve=>Te("host",ve),mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:ae,placeholder:"(default)",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Port"}),r.jsx(Xt,{value:String(ce.port??""),onSave:ve=>Ie("port",ve),validate:ve=>op(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"port",activeFieldId:Z,onActivate:ae,placeholder:"(default)",ariaLabel:"Port","data-testid":"env-edit-port"})]})]}),S.adapterType==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Host"}),r.jsx(Xt,{value:String(ce.host??""),onSave:ve=>Te("host",ve),validate:ve=>ve.trim()===""?"Host is required":void 0,mode:"edit",fieldId:"host",activeFieldId:Z,onActivate:ae,placeholder:"hostname or IP",ariaLabel:"Host","data-testid":"env-edit-host"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"User"}),r.jsx(Xt,{value:String(ce.user??""),onSave:ve=>Te("user",ve),mode:"edit",fieldId:"user",activeFieldId:Z,onActivate:ae,placeholder:"(default)",ariaLabel:"User","data-testid":"env-edit-user"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"SSH Port"}),r.jsx(Xt,{value:String(ce.sshPort??""),onSave:ve=>Ie("sshPort",ve),validate:ve=>op(ve)?void 0:"Port must be 1-65535",mode:"edit",fieldId:"sshPort",activeFieldId:Z,onActivate:ae,placeholder:"22",ariaLabel:"SSH Port","data-testid":"env-edit-ssh-port"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Identity File"}),r.jsx(Xt,{value:String(ce.identityFile??""),onSave:ve=>Te("identityFile",ve),mode:"edit",fieldId:"identityFile",activeFieldId:Z,onActivate:ae,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:ie.section,children:[r.jsx("label",{className:ie.label,children:"Image"}),r.jsx(Xt,{value:String(ce.image??""),onSave:ve=>Te("image",ve),mode:"edit",fieldId:"image",activeFieldId:Z,onActivate:ae,placeholder:"(default)",ariaLabel:"Image","data-testid":"env-edit-image"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Repo"}),r.jsx(Xt,{value:String(ce.repo??""),onSave:ve=>Te("repo",ve),mode:"edit",fieldId:"repo",activeFieldId:Z,onActivate:ae,placeholder:"(none)",ariaLabel:"Repo","data-testid":"env-edit-repo"})]})]}),S.adapterType==="codespace"&&r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,children:"Codespace Name"}),r.jsx(Xt,{value:String(ce.codespaceName??""),onSave:ve=>Te("codespaceName",ve),validate:ve=>ve.trim()===""?"Codespace name is required":void 0,mode:"edit",fieldId:"codespaceName",activeFieldId:Z,onActivate:ae,placeholder:"codespace-name",ariaLabel:"Codespace Name","data-testid":"env-edit-codespace-name"})]})]})})]})}return r.jsxs("div",{className:ie.container,"data-testid":"env-create-panel",children:[r.jsxs("div",{className:ie.header,children:[r.jsx("div",{className:ie.headerTitle,children:r.jsx("span",{className:ie.badge,children:"new environment"})}),r.jsxs("div",{className:ie.headerActions,children:[r.jsx("button",{onClick:Ke,disabled:!de(),className:ie.btnPrimary,"data-testid":"env-create-submit",children:"Create"}),r.jsx("button",{onClick:je,className:ie.btnGhost,children:"Cancel"})]})]}),r.jsx("div",{className:ie.body,children:r.jsxs("div",{className:ie.formContent,children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-name",children:"Name"}),r.jsx("input",{id:"env-create-name",type:"text",value:N,onChange:ce=>j(ce.target.value),placeholder:"Environment name...",autoFocus:!0,className:ie.nameInput,"data-testid":"env-create-name",onKeyDown:ce=>{ce.key==="Enter"&&de()&&Ke()}})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-adapter",children:"Adapter Type"}),r.jsxs("select",{id:"env-create-adapter",value:T,onChange:ce=>{C(ce.target.value),ce.target.value==="codespace"&&u()},className:ie.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:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:ce=>A(ce.target.value),placeholder:"Host (optional)...",className:ie.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-port",children:"Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Pc,max:Vc,value:I,onChange:ce=>D(ce.target.value),placeholder:"Port (optional)...",className:ie.fieldInput,"data-testid":"env-create-port"})]})]}),T==="ssh"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-host",children:"Host"}),r.jsx("input",{id:"env-create-host",type:"text",value:E,onChange:ce=>A(ce.target.value),placeholder:"Host (required)...",className:ie.fieldInput,"data-testid":"env-create-host"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-user",children:"User"}),r.jsx("input",{id:"env-create-user",type:"text",value:B,onChange:ce=>z(ce.target.value),placeholder:"User (optional)...",className:ie.fieldInput,"data-testid":"env-create-user"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-port",children:"SSH Port"}),r.jsx("input",{id:"env-create-port",type:"number",min:Pc,max:Vc,value:I,onChange:ce=>D(ce.target.value),placeholder:"SSH port (optional)...",className:ie.fieldInput,"data-testid":"env-create-port"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-identity",children:"Identity File"}),r.jsx("input",{id:"env-create-identity",type:"text",value:X,onChange:ce=>Y(ce.target.value),placeholder:"Identity file (optional)...",className:ie.fieldInput,"data-testid":"env-create-identity"})]})]}),T==="docker"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-image",children:"Image"}),r.jsx("input",{id:"env-create-image",type:"text",value:F,onChange:ce=>te(ce.target.value),placeholder:"Image (optional)...",className:ie.fieldInput,"data-testid":"env-create-image"})]}),r.jsxs("div",{className:ie.section,children:[r.jsx("label",{className:ie.label,htmlFor:"env-create-repo",children:"Repo"}),r.jsx("input",{id:"env-create-repo",type:"text",value:le,onChange:ce=>se(ce.target.value),placeholder:"Repo (optional)...",className:ie.fieldInput,"data-testid":"env-create-repo"})]})]}),T==="codespace"&&r.jsx(X5,{codespaceName:J,onCodespaceNameChange:L,envName:N,onEnvNameChange:j,codespaces:d,codespaceError:p,codespaceListError:h,codespaceCreating:g,onCreateCodespace:v})]})})]})}const Q5="_group_1iprv_1",eL="_groupTitle_1iprv_8",tL="_shortcutList_1iprv_17",nL="_shortcutRow_1iprv_23",sL="_keys_1iprv_36",aL="_kbd_1iprv_43",iL="_description_1iprv_60",ui={group:Q5,groupTitle:eL,shortcutList:tL,shortcutRow:nL,keys:sL,kbd:aL,description:iL},oL=[{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 rL(){return r.jsxs("section",{className:me.section,"data-testid":"keyboard-shortcuts-panel",children:[r.jsx("h3",{className:me.sectionTitle,children:"Keyboard Shortcuts"}),r.jsx("p",{className:me.sectionDescription,children:"Keyboard shortcuts for navigating and interacting with Grackle. Global shortcuts are suppressed while typing in text fields."}),oL.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 lL="_workpadSection_y8nj9_1",cL="_workpadLabel_y8nj9_9",uL="_workpadStatus_y8nj9_17",dL="_workpadSummary_y8nj9_23",fL="_workpadExtra_y8nj9_29",ja={workpadSection:lL,workpadLabel:cL,workpadStatus:uL,workpadSummary:dL,workpadExtra:fL};function pL({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 mL=[{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 hL({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:me.section,children:[r.jsx("h3",{className:me.sectionTitle,children:"Credential Providers"}),r.jsx("p",{className:me.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:me.tokenList,children:mL.map(o=>r.jsxs("div",{className:me.tokenRow,children:[r.jsx("span",{className:me.tokenName,children:o.label}),r.jsx("span",{className:me.tokenTarget,children:o.description}),r.jsx("select",{className:me.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 gL="_container_10efq_1",vL="_header_10efq_7",yL="_list_10efq_105",bL="_card_10efq_111",_L="_cardHeader_10efq_125",xL="_cardTitle_10efq_135",kL="_defaultBadge_10efq_141",SL="_cardActions_10efq_155",TL="_description_10efq_160",wL="_meta_10efq_166",NL="_empty_10efq_212",jL="_typeBadge_10efq_362",Hn={container:gL,header:vL,list:yL,card:bL,cardHeader:_L,cardTitle:xL,defaultBadge:kL,cardActions:SL,description:TL,meta:wL,empty:NL,typeBadge:jL};function CL({personas:t,appDefaultPersonaId:s,onDeletePersona:i,onSetAppDefaultPersonaId:o,onNavigateToNew:c,onNavigateToPersona:u}){const[d,p]=_.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,b=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:b?"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 EL="_container_uy08i_1",AL="_header_uy08i_7",DL="_count_uy08i_13",RL="_presets_uy08i_18",ML="_presetButton_uy08i_24",IL="_filterInput_uy08i_41",OL="_groups_uy08i_53",LL="_group_uy08i_53",BL="_groupHeader_uy08i_68",zL="_groupName_uy08i_77",UL="_groupCount_uy08i_81",$L="_toolList_uy08i_87",PL="_toolItem_uy08i_95",VL="_toolName_uy08i_103",on={container:EL,header:AL,count:DL,presets:RL,presetButton:ML,filterInput:IL,groups:OL,group:LL,groupHeader:BL,groupName:zL,groupCount:UL,toolList:$L,toolItem:PL,toolName:VL},HL=(()=>{const t=new Map;for(const s of Yb){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()}))})(),qL=[{name:"default",label:"Default",tools:Jb},{name:"worker",label:"Worker",tools:eT},{name:"orchestrator",label:"Orchestrator",tools:tT},{name:"admin",label:"Admin",tools:nT}];function Ab({selectedTools:t,onChange:s,disabled:i}){const[o,c]=_.useState(""),u=_.useMemo(()=>new Set(t),[t]),d=_.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=_.useCallback((v,y)=>{if(i)return;const b=new Set(u);for(const k of v)y?b.delete(k):b.add(k);s([...b].sort())},[u,s,i]),h=_.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 (${Jb.length} tools)`:`${t.length} of ${Yb.size} tools selected`})}),r.jsxs("div",{className:on.presets,"data-testid":"mcp-tool-presets",children:[qL.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:HL.map(({group:v,tools:y})=>{const b=g?y.filter(S=>S.toLowerCase().includes(g)):y;if(b.length===0)return null;const k=b.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(b,k),disabled:i,"data-testid":`group-toggle-${v}`}),r.jsx("span",{className:on.groupName,children:v}),r.jsxs("span",{className:on.groupCount,children:["(",b.filter(S=>u.has(S)).length,"/",b.length,")"]})]}),r.jsx("div",{className:on.toolList,children:b.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 GL="_nav_1bhou_1",FL="_tab_1bhou_24",ZL="_tabIcon_1bhou_62",KL="_tabActive_1bhou_68",Cc={nav:GL,tab:FL,tabIcon:ZL,tabActive:KL},qs=[{path:"credentials",label:"Credentials",icon:r.jsx(d2,{size:Mt})},{path:"personas",label:"Personas",icon:r.jsx(U2,{size:Mt})},{path:"appearance",label:"Appearance",icon:r.jsx(j2,{size:Mt})},{path:"shortcuts",label:"Shortcuts",icon:r.jsx(p2,{size:Mt})},{path:"about",label:"About",icon:r.jsx(Gp,{size:Mt})}];function YL(){var d;const t=Pt(),s=bt(),i=_.useRef(null),o=((d=qs.find(p=>{const h=`${xo}/${p.path}`;return t.pathname===h||t.pathname.startsWith(`${h}/`)}))==null?void 0:d.path)??qs[0].path,c=_.useCallback(p=>{s(`${xo}/${p}`)},[s]),u=_.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(N=>N===document.activeElement),v=g>=0?g:qs.findIndex(N=>N.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 b=qs[y].path;s(`${xo}/${b}`),(S=h[y])==null||S.focus()},[o,s]);return r.jsx("nav",{className:Cc.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:`${Cc.tab} ${h?Cc.tabActive:""}`,onClick:()=>c(p.path),children:[r.jsx("span",{className:Cc.tabIcon,"aria-hidden":"true",children:p.icon}),p.label]},p.path)})})}function JL({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(K0.map(u=>[u,[]]));for(const u of t){const d=Jr(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 b={task:u,isBlocked:p,childCount:g,doneChildCount:v,pausedSubBadge:y},k=c.get(d);k?k.push(b):c.get("not_started").push(b)}for(const u of c.values())u.sort((d,p)=>d.task.sortOrder-p.task.sortOrder);return K0.map(u=>{const d=Ma(u);return{status:u,label:d.label,style:d,tasks:c.get(u)??[]}})}const WL="_boardContainer_1c4y1_1",XL="_column_1c4y1_17",QL="_columnHeader_1c4y1_34",eB="_columnIcon_1c4y1_47",tB="_columnLabel_1c4y1_52",nB="_columnCount_1c4y1_57",sB="_cardList_1c4y1_67",aB="_emptyPlaceholder_1c4y1_76",iB="_card_1c4y1_67",oB="_cardHeader_1c4y1_107",rB="_cardStatusIcon_1c4y1_113",lB="_cardTitle_1c4y1_119",cB="_cardBadges_1c4y1_127",uB="_badge_1c4y1_134",dB="_blockedBadge_1c4y1_146",fB="_childBadge_1c4y1_151",pB="_depBadge_1c4y1_155",mB="_parentBadge_1c4y1_159",hB="_pausedSubBadge_1c4y1_166",gB="_personaBadge_1c4y1_170",vB="_envBadge_1c4y1_174",yB="_emptyCta_1c4y1_178",bB="_ctaButton_1c4y1_188",_B="_ctaDescription_1c4y1_204",nt={boardContainer:WL,column:XL,columnHeader:QL,columnIcon:eB,columnLabel:tB,columnCount:nB,cardList:sB,emptyPlaceholder:aB,card:iB,cardHeader:oB,cardStatusIcon:rB,cardTitle:lB,cardBadges:cB,badge:uB,blockedBadge:dB,childBadge:fB,depBadge:pB,parentBadge:mB,pausedSubBadge:hB,personaBadge:gB,envBadge:vB,emptyCta:yB,ctaButton:bB,ctaDescription:_B};function xB({workspaceId:t,environmentId:s,tasks:i,sessions:o,personas:c,environments:u}){const d=bt(),p=_.useMemo(()=>i.filter(b=>b.workspaceId===t),[i,t]),h=_.useMemo(()=>new Map(i.map(b=>[b.id,b.status])),[i]),g=_.useMemo(()=>new Map(p.map(b=>[b.id,b])),[p]),v=_.useMemo(()=>{const b=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])),N=new Map,j=new Map,T=new Map;for(const C of p)if(C.latestSessionId){const E=b.get(C.latestSessionId);if(E){if(N.set(C.id,E.endReason||E.status),E.personaId){const A=k.get(E.personaId);A&&j.set(C.id,A.name)}if(E.environmentId){const A=S.get(E.environmentId);A&&T.set(C.id,A.displayName)}}}return{sessionStatusByTaskId:N,personaNameByTaskId:j,environmentNameByTaskId:T}},[p,o,c,u]),y=_.useMemo(()=>JL({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(b=>r.jsxs("section",{className:nt.column,"data-testid":`board-column-${b.status}`,"aria-label":`${b.label}, ${b.tasks.length} ${b.tasks.length===1?"task":"tasks"}`,children:[r.jsxs("div",{className:nt.columnHeader,children:[r.jsx("span",{className:nt.columnIcon,style:{color:b.style.color},children:b.style.icon}),r.jsx("span",{className:nt.columnLabel,children:b.label}),r.jsx("span",{className:nt.columnCount,"data-testid":`board-count-${b.status}`,children:b.tasks.length})]}),r.jsx("div",{className:nt.cardList,children:b.tasks.length===0?r.jsx("div",{className:nt.emptyPlaceholder,children:"No tasks"}):r.jsx(os,{mode:"popLayout",children:b.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(kB,{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))})})]},b.status))})}function kB({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:b=>{(b.key==="Enter"||b.key===" ")&&(b.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 SB="_formContent_ymnez_1",TB="_section_ymnez_13",wB="_label_ymnez_19",NB="_titleInput_ymnez_26",jB="_descriptionTextarea_ymnez_58",CB="_selectField_ymnez_94",EB="_checkboxRow_ymnez_128",AB="_checkboxLabel_ymnez_141",DB="_fieldError_ymnez_146",gt={formContent:SB,section:TB,label:wB,titleInput:NB,descriptionTextarea:jB,selectField:CB,checkboxRow:EB,checkboxLabel:AB,fieldError:DB};function RB(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 MB=100;function IB({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:MB,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 gx=_.createContext(void 0),OB=4e3;function LB({children:t}){const[s,i]=_.useState([]),o=_.useRef(0),c=_.useCallback(d=>{i(p=>p.filter(h=>h.id!==d))},[]),u=_.useCallback((d,p="info",h=OB)=>{const g=`toast-${++o.current}`;i(v=>[...v,{id:g,message:d,variant:p,duration:h}])},[]);return r.jsx(gx.Provider,{value:{toasts:s,showToast:u,dismissToast:c},children:t})}function gn(){const t=_.useContext(gx);if(!t)throw new Error("useToast must be used within ToastProvider");return t}const Pp="grackle-theme",vx="grackle-prefer-system",yx="(prefers-color-scheme: dark)";let Rr=[],Hc;function lp(){Hc=void 0;for(const t of Rr)t()}function Vp(){return typeof window>"u"?!1:window.matchMedia(yx).matches}function zr(){if(typeof localStorage>"u")return Eb;try{const t=localStorage.getItem(Pp);if(t!==null&&px.has(t))return t}catch{}return Eb}function tu(){if(typeof localStorage>"u")return!1;try{return localStorage.getItem(vx)==="true"}catch{return!1}}function Hp(t){return hu.find(s=>s.variantLightId===t||s.variantDarkId===t)}function bx(t,s){const i=$p(t);if(i!=null&&i.variantDarkId)return s&&i.variantLightId?Vp()?i.variantDarkId:i.variantLightId:i.variantDarkId;if(i!=null&&i.hidden&&s){const o=Hp(t);if(o!=null&&o.variantLightId&&o.variantDarkId)return Vp()?o.variantDarkId:o.variantLightId}return t}function mo(t,s,i=!1){i&&document.documentElement.classList.add("no-transitions"),document.documentElement.dataset.theme=bx(t,s),i&&(document.documentElement.offsetHeight,requestAnimationFrame(()=>{document.documentElement.classList.remove("no-transitions")}))}typeof document<"u"&&mo(zr(),tu());function BB(){return Hc===void 0&&(Hc={themeId:zr(),systemDark:Vp(),preferSystem:tu()}),Hc}function zB(t){return Rr=[...Rr,t],()=>{Rr=Rr.filter(s=>s!==t)}}function UB(){const t=_.useSyncExternalStore(zB,BB),{themeId:s,preferSystem:i}=t,o=bx(s,i),c=_.useCallback(d=>{if(px.has(d)){try{localStorage.setItem(Pp,d)}catch{}mo(d,tu(),!0),lp()}},[]),u=_.useCallback(d=>{try{localStorage.setItem(vx,d?"true":"false")}catch{}if(d){const p=zr(),h=$p(p);if(h!=null&&h.hidden){const g=Hp(p);if(g)try{localStorage.setItem(Pp,g.id)}catch{}}}mo(zr(),d,!0),lp()},[]);return _.useEffect(()=>{mo(s,i)},[s,i]),_.useEffect(()=>{if(typeof window>"u")return;const d=window.matchMedia(yx),p=()=>{const h=zr(),g=tu();if(g){const v=$p(h);if(v!=null&&v.variantDarkId&&v.variantLightId&&mo(h,g),v!=null&&v.hidden){const y=Hp(h);y!=null&&y.variantDarkId&&y.variantLightId&&mo(h,g)}}lp()};return d.addEventListener("change",p),()=>{d.removeEventListener("change",p)}},[]),{themeId:s,setTheme:c,resolvedThemeId:o,preferSystem:i,setPreferSystem:u}}const _x=_.createContext(void 0);function $B({children:t}){const s=UB();return r.jsx(_x.Provider,{value:s,children:t})}function xx(){const t=_.useContext(_x);if(!t)throw new Error("useThemeContext must be used within ThemeProvider");return t}const kx=_.createContext(void 0),Sx=_.createContext(void 0);function PB({children:t}){const[s,i]=_.useState(void 0),o=_.useCallback(c=>{i(c)},[]);return r.jsx(Sx.Provider,{value:o,children:r.jsx(kx.Provider,{value:s,children:t})})}function VB(){return _.useContext(kx)}function HB(){const t=_.useContext(Sx);if(t===void 0)throw new Error("useSidebarSetter must be used within a SidebarProvider");return t}const Pm=_.createContext(void 0);function ct(){const t=_.useContext(Pm);if(!t)throw new Error("useGrackle must be used within GrackleProvider");return t}function Tx(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function wx(t,s){return console.warn(`[ws] Malformed "${t}" message: ${s}`),!1}function qB(t){return Tx(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 GB=new Set(["off","subscription","api_key"]),Ec=new Set(["off","on"]);function FB(t){return Tx(t)&&GB.has(t.claude)&&Ec.has(t.github)&&Ec.has(t.copilot)&&Ec.has(t.codex)&&Ec.has(t.goose)}function Nx(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 jx(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 po=5e3;function ZB(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 KB(t){return t?[Xs,{label:"Settings",url:xo},{label:t,url:void 0}]:[Xs,{label:"Settings",url:void 0}]}const Vm={label:"Environments",url:ko};function YB(){return[Xs,{label:"Environments",url:void 0}]}function JB(){return[Xs,{label:"New Chat",url:void 0}]}function WB(t){return[Xs,{label:`Session ${t.slice(0,8)}`,url:void 0}]}function XB(t,s,i,o){const c=i.find(d=>d.id===t),u=o.find(d=>d.id===s);return[Xs,Vm,{label:(u==null?void 0:u.displayName)??"Environment",url:vi(s)},{label:(c==null?void 0:c.name)??"Workspace",url:void 0}]}function QB(t,s,i,o,c){const u=ZB(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(Vm),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 b=u[u.length-1];return y.push({label:(b==null?void 0:b.title)??t,url:void 0}),y}const e8={label:"Findings",url:lu};function t8(){return[Xs,{label:"Findings",url:void 0}]}function Cx(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(Vm),p&&u.push({label:p.displayName,url:vi(i)}),d&&u.push({label:d.name,url:gi(s,i)}),u.push({label:"Findings",url:ZN(s,i)})}else u.push(e8);return u.push({label:t,url:void 0}),u}function Hm(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 Ac(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 n8(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 qm(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),b=y?Ac(y):void 0;if(b)try{const k=JSON.parse(v.content);i.set(b,{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 b=s.get(v),k=b?n8(b):void 0;if(!k)return v;const S=i.get(k);if(!S)return v;o.add(k),c.add(y);let N;const j=v.content.trim();if(j.startsWith("{"))try{const T=JSON.parse(j);typeof T.detailedContent=="string"&&(N=T.detailedContent)}catch{}return{...v,toolUseCtx:{...S,detailedResult:N}}}),d=[];for(let v=0;v<u.length;v++){if(u[v].eventType!=="tool_use")continue;const y=s.get(u[v]),b=y?Ac(y):void 0;b&&o.has(b)||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 b=u[v],k=u[y];let S;try{const N=JSON.parse(b.content);S={tool:N.tool,args:N.args}}catch{}if(S){let N;const j=k.content.trim();if(j.startsWith("{"))try{const E=JSON.parse(j);typeof E.detailedContent=="string"&&(N=E.detailedContent)}catch{}u[y]={...k,toolUseCtx:{...S,detailedResult:N}},c.add(y);const T=s.get(b),C=T?Ac(T):void 0;C?o.add(C):(o.add(`__seq_${v}`),s.set(b,{...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 b=Ac(y);if(b&&o.has(b))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 b=v+1;b<g.length;b++)if(g[b].eventType!=="tool_use"){y=!0;break}y&&(g[v]={...g[v],settled:!0})}return g}function s8(t,s,i){const o=t.filter(h=>h.status==="running"||h.status==="idle"||h.status==="waiting").length,c=Ex(s),u=s.filter(h=>qp(h,c)).length,d=s.filter(h=>h.status==="paused"||h.status==="failed"||qp(h,c)).length,p=i.filter(h=>h.status==="disconnected"||h.status==="error").length;return{activeSessions:o,blockedTasks:u,attentionTasks:d,unhealthyEnvironments:p}}function Ex(t){const s=new Map;for(const i of t)s.set(i.id,i.status);return s}function qp(t,s){return t.dependsOn.some(i=>s.get(i)!=="complete")}function a8(t,s){var d;const i=new Map;for(const p of s)i.set(p.id,p);const o=Ex(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}):qp(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 i8(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 o8(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"}],r8=new Map(vs.map(t=>[t.id,t]));function cp(t){const s=r8.get(t);if(!s)throw new Error(`MOCK_KNOWLEDGE_NODES is missing node "${t}"`);return s}const Db={"kn-auth-flow":{node:cp("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:cp("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:cp("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"}]}},l8=[{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}],c8=[{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}],u8=[{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"}],d8=[{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"}],f8=[{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:""}],Dc=[{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"}],p8=[{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:""}],m8=[{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:[]}],h8={"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 Rb=[{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"}}]}],Mb=400;function g8({children:t}){const[s,i]=_.useState(l8),[o,c]=_.useState(c8),[u,d]=_.useState(u8),[p,h]=_.useState(void 0),[g,v]=_.useState(d8),[y,b]=_.useState(f8),[k,S]=_.useState(Dc),[N,j]=_.useState(void 0),T=!1,[C,E]=_.useState(p8),[A,I]=_.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),[D,B]=_.useState(m8),[z]=_.useState(h8),[X,Y]=_.useState(""),[F,te]=_.useState(vs),[le,se]=_.useState(Ca),[J,L]=_.useState(void 0),[Z,ae]=_.useState(void 0),[re,de]=_.useState(""),Ke=_.useRef(void 0),je=_.useRef(0),Te=_.useRef(0),Ie=_.useRef(new Set),ce=_.useRef(new Map),ve=_.useRef(y);ve.current=y;const fe=_.useRef(new Map),Oe=_.useRef(new Map),_t=_.useCallback(V=>(je.current+=1,`mock-${V}-${String(je.current).padStart(3,"0")}`),[]),vn=_.useCallback(()=>{const V=Rb[Te.current%Rb.length];return Te.current+=1,V},[]),U=_.useCallback((V,ne,oe)=>{const ue=setTimeout(()=>{var pe;Ie.current.delete(ue),oe&&((pe=ce.current.get(oe))==null||pe.delete(ue)),V()},ne);Ie.current.add(ue),oe&&(ce.current.has(oe)||ce.current.set(oe,new Set),ce.current.get(oe).add(ue))},[]),Me=_.useCallback(V=>{const ne=ce.current.get(V);ne&&(ne.forEach(oe=>{clearTimeout(oe),Ie.current.delete(oe)}),ce.current.delete(V))},[]),et=_.useCallback((V,ne,oe)=>{c(ue=>ue.map(pe=>pe.id===V?{...pe,status:ne,...oe!==void 0?{endReason:oe}:{}}:pe))},[]),tt=_.useCallback(V=>{d(ne=>[...ne,V])},[]),qe=_.useCallback((V,ne,oe)=>{ne.forEach((ue,pe)=>{U(()=>{const ze={sessionId:V,...ue.event,timestamp:new Date().toISOString()};if(tt(ze),ue.event.eventType==="status"){const ye=Nx(ue.event.content),Ae=jx(ue.event.content);et(V,ye,Ae)}pe===ne.length-1&&oe&&oe()},ue.delayMs,V)})},[U,tt,et]),cs=_.useCallback(async(V,ne,oe,ue)=>{console.log("[MockGrackle] spawn",{environmentId:V,prompt:ne,runtime:ue});const pe=_t("sess"),ze={id:pe,environmentId:V,runtime:ue||"claude-code",status:"running",prompt:ne,startedAt:new Date().toISOString()};c(Ae=>[...Ae,ze]),h(pe);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(pe,Fe),U(()=>{et(pe,"idle"),tt({sessionId:pe,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},ut+Mb,pe),ye.resumeSteps&&fe.current.set(pe,ye.resumeSteps)}else qe(pe,ye.steps)},[_t,vn,qe,U,et,tt]),ea=_.useCallback(async V=>{console.log("[MockGrackle] kill",V),Me(V),fe.current.delete(V),et(V,"stopped","killed"),tt({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"killed"}),b(ne=>ne.map(oe=>oe.latestSessionId===V&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Me,et,tt]),An=_.useCallback(async V=>{console.log("[MockGrackle] stopGraceful",V),Me(V),fe.current.delete(V),et(V,"stopped","terminated"),tt({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"terminated"}),b(ne=>ne.map(oe=>oe.latestSessionId===V&&oe.status==="working"?{...oe,status:"not_started"}:oe))},[Me,et,tt]),Zn=_.useCallback(()=>{console.log("[MockGrackle] refresh")},[]),us=_.useCallback(async V=>{console.log("[MockGrackle] loadSessionEvents",V)},[]),ta=_.useCallback(()=>{console.log("[MockGrackle] clearEvents"),d([])},[]),Kn=_.useCallback(async(V,ne,oe,ue,pe,ze,ye,Ae,Fe)=>{console.log("[MockGrackle] createWorkspace",{name:V,description:ne});const ut={id:_t("proj"),name:V,description:ne||"",repoUrl:oe||"",environmentId:ue||"",status:"active",workingDirectory:ye||"",useWorktrees:ze??!0,defaultPersonaId:pe||"",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};v(Ze=>[...Ze,ut]),Ae&&Ae()},[_t]),Ne=_.useCallback(async V=>{console.log("[MockGrackle] archiveWorkspace",V),v(ne=>ne.map(oe=>oe.id===V?{...oe,status:"archived"}:oe))},[]),Ce=_.useCallback(async V=>{console.log("[MockGrackle] loadTasks",V)},[]),cn=_.useCallback(async(V,ne,oe,ue,pe,ze,ye,Ae,Fe)=>{console.log("[MockGrackle] createTask",{workspaceId:V,title:ne,parentTaskId:pe}),b(ut=>{const Ut=ut.filter(pt=>pt.workspaceId===V).reduce((pt,Vt)=>Math.max(pt,Vt.sortOrder),0),Ft=pe?ut.find(pt=>pt.id===pe):void 0;if(pe&&!Ft)return console.warn("[MockGrackle] Parent task not found:",pe),ut;if(Ft&&!Ft.canDecompose)return console.warn("[MockGrackle] Parent task does not have decomposition rights:",pe),ut;const Et=Ft?Ft.depth+1:0,sn={id:_t("task"),workspaceId:V,title:ne,description:oe||"",status:"not_started",branch:"",latestSessionId:"",dependsOn:ue||[],reviewNotes:void 0,sortOrder:Ut+1,createdAt:new Date().toISOString(),parentTaskId:pe||"",depth:Et,childTaskIds:[],canDecompose:ye??!pe,defaultPersonaId:ze||"",workpad:""};return[...ut,sn]}),Ae&&Ae()},[_t]),yn=_.useCallback(async(V,ne,oe,ue)=>{var ut;console.log("[MockGrackle] startTask",{taskId:V});const pe=ve.current.find(Ze=>Ze.id===V),ze=(pe==null?void 0:pe.title)??"",ye=_t("sess"),Ae={id:ye,environmentId:"env-local-01",runtime:"claude-code",status:"running",prompt:ze||V,startedAt:new Date().toISOString()};c(Ze=>[...Ze,Ae]),b(Ze=>Ze.map(Ut=>Ut.id===V?{...Ut,status:"working",latestSessionId:ye,branch:`mock/${V.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),U(()=>{et(ye,"idle"),tt({sessionId:ye,eventType:"status",timestamp:new Date().toISOString(),content:"idle"})},Ft+Mb,ye),Fe.resumeSteps){const Et=[...Fe.resumeSteps];fe.current.set(ye,Et);const sn=Et.reduce((pt,Vt)=>Math.max(pt,Vt.delayMs),0);Oe.current.set(ye,{taskId:V,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;U(()=>{Ut==="completed"?b(Ft=>Ft.map(Et=>Et.id===V&&Et.status==="working"?{...Et,status:"paused"}:Et)):Ut==="failed"&&b(Ft=>Ft.map(Et=>Et.id===V&&Et.status==="working"?{...Et,status:"failed"}:Et))},Ze+100,ye)}},[_t,vn,qe,U,et,tt]),ks=_.useCallback(async(V,ne)=>{console.log("[MockGrackle] sendInput",{sessionId:V,text:ne}),tt({sessionId:V,eventType:"output",timestamp:new Date().toISOString(),content:`User input: ${ne}`}),et(V,"running"),tt({sessionId:V,eventType:"status",timestamp:new Date().toISOString(),content:"running"});const oe=fe.current.get(V);if(oe)fe.current.delete(V),qe(V,oe);else{const pe=[{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(V,pe)}const ue=Oe.current.get(V);ue&&(Oe.current.delete(V),U(()=>{b(pe=>pe.map(ze=>ze.id===ue.taskId&&ze.status==="working"?{...ze,status:"paused"}:ze))},ue.delayAfterResume,V))},[tt,et,qe,U]),ds=_.useCallback(async V=>{console.log("[MockGrackle] completeTask",V),b(ne=>ne.map(oe=>oe.id===V?{...oe,status:"complete"}:oe))},[]),wi=_.useCallback(async V=>{console.log("[MockGrackle] resumeTask",V)},[]),Ua=_.useCallback(async(V,ne,oe,ue,pe)=>{console.log("[MockGrackle] updateTask",{taskId:V,title:ne}),b(ze=>ze.map(ye=>ye.id===V?{...ye,title:ne.trim()||ye.title,description:oe,dependsOn:ue,...pe!==void 0?{defaultPersonaId:pe}:{}}:ye))},[]),Ni=_.useCallback(async V=>{console.log("[MockGrackle] deleteTask",V),b(ne=>ne.filter(oe=>oe.id!==V))},[]),al=_.useCallback(async V=>{console.log("[MockGrackle] loadFindings",V),S(Dc.filter(ne=>ne.workspaceId===V))},[]),na=_.useCallback(async()=>{console.log("[MockGrackle] loadAllFindings"),S([...Dc])},[]),Qt=_.useCallback(async V=>{console.log("[MockGrackle] loadFinding",V);const ne=Dc.find(oe=>oe.id===V);j(ne)},[]),Yn=_.useCallback(async(V,ne,oe,ue,pe)=>{console.log("[MockGrackle] postFinding",{workspaceId:V,title:ne});const ze={id:_t("find"),workspaceId:V,taskId:"",sessionId:"",category:ue||"general",title:ne,content:oe,tags:pe||[],createdAt:new Date().toISOString()};S(ye=>[...ye,ze])},[_t]),en=_.useCallback(async()=>{console.log("[MockGrackle] loadEnvironments")},[]),il=_.useCallback(async(V,ne,oe)=>{console.log("[MockGrackle] addEnvironment",{displayName:V,adapterType:ne,adapterConfig:oe})},[]),ol=_.useCallback(async(V,ne)=>{console.log("[MockGrackle] updateEnvironment",{environmentId:V,...ne}),i(oe=>oe.map(ue=>ue.id!==V?ue:{...ue,...ne.displayName!==void 0?{displayName:ne.displayName}:{},...ne.adapterConfig!==void 0?{adapterConfig:JSON.stringify(ne.adapterConfig)}:{}}))},[]),rl=_.useCallback(async()=>{console.log("[MockGrackle] loadTokens")},[]),$a=_.useCallback(async(V,ne,oe,ue,pe)=>{console.log("[MockGrackle] setToken",{name:V,tokenType:oe}),E(ze=>[...ze.filter(Ae=>Ae.name!==V),{name:V,tokenType:oe,envVar:ue,filePath:pe,expiresAt:""}])},[]),Pa=_.useCallback(async V=>{console.log("[MockGrackle] deleteToken",V),E(ne=>ne.filter(oe=>oe.name!==V))},[]),Va=_.useCallback(async V=>{console.log("[MockGrackle] updateCredentialProviders",V),I(V)},[]);_.useEffect(()=>()=>{Ie.current.forEach(clearTimeout),Ie.current.clear()},[]);const Ss=_.useMemo(()=>({connected:!0,environmentsLoading:!1,sessionsLoading:!1,workspacesLoading:!1,tasksLoading:!1,tokensLoading:!1,credentialsLoading:!1,personasLoading:!1,send:()=>{},environments:s,sessions:o,events:u,eventsDropped:0,lastSpawnedId:p,workspaces:g,tasks:y,findings:k,selectedFinding:N,findingLoading:T,tokens:C,credentialProviders:A,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(V,ne)=>{console.log("[MockGrackle] updateWorkspace",{workspaceId:V,...ne}),v(oe=>oe.map(ue=>ue.id!==V?ue:{...ue,...ne.name!==void 0?{name:ne.name}:{},...ne.description!==void 0?{description:ne.description}:{},...ne.repoUrl!==void 0?{repoUrl:ne.repoUrl}:{},...ne.environmentId!==void 0?{environmentId:ne.environmentId}:{},...ne.workingDirectory!==void 0?{workingDirectory:ne.workingDirectory}:{},...ne.useWorktrees!==void 0?{useWorktrees:ne.useWorktrees}:{},...ne.defaultPersonaId!==void 0?{defaultPersonaId:ne.defaultPersonaId}:{},updatedAt:new Date().toISOString()}))},loadTasks:Ce,loadAllTasks:async()=>{console.log("[MockGrackle] loadAllTasks")},createTask:cn,startTask:yn,stopTask:async V=>{console.log("[MockGrackle] stopTask",{taskId:V}),await ds(V)},completeTask:ds,resumeTask:wi,updateTask:Ua,deleteTask:Ni,loadFindings:al,loadAllFindings:na,loadFinding:Qt,postFinding:Yn,loadEnvironments:en,addEnvironment:il,updateEnvironment:ol,loadTokens:rl,setToken:$a,deleteToken:Pa,updateCredentialProviders:Va,provisionStatus:{},environmentOperationError:"",clearEnvironmentOperationError:()=>{},provisionEnvironment:async(V,ne)=>{},stopEnvironment:async()=>{},removeEnvironment:async()=>{},codespaces:[],codespaceError:"",codespaceListError:"",codespaceCreating:!1,listCodespaces:async()=>{},createCodespace:async()=>{},workspaceCreating:!1,taskStartingId:void 0,personas:D,createPersona:async(V,ne,oe,ue,pe,ze,ye,Ae,Fe)=>{console.log("[MockGrackle] createPersona",{name:V});const ut={id:`mock-persona-${Date.now()}`,name:V,description:ne,systemPrompt:oe,toolConfig:"{}",runtime:ue??"claude-code",model:pe||"",maxTurns:ze||0,mcpServers:"[]",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),type:ye||"agent",script:Ae||"",allowedMcpTools:Fe||[]};return B(Ze=>[...Ze,ut]),ut},updatePersona:async(V,ne,oe,ue,pe,ze,ye,Ae,Fe,ut)=>{console.log("[MockGrackle] updatePersona",{personaId:V,name:ne});const Ze=D.find(Et=>Et.id===V);if(!Ze)throw new Error(`Persona not found: ${V}`);const Ut=new Date().toISOString(),Ft={...Ze,...ne!==void 0?{name:ne}:{},...oe!==void 0?{description:oe}:{},...ue!==void 0?{systemPrompt:ue}:{},...pe!==void 0?{runtime:pe}:{},...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 B(Et=>Et.map(sn=>sn.id===V?Ft:sn)),Ft},deletePersona:async V=>{console.log("[MockGrackle] deletePersona",V),B(ne=>ne.filter(oe=>oe.id!==V))},taskSessions:z,loadTaskSessions:async V=>{console.log("[MockGrackle] loadTaskSessions",V)},appDefaultPersonaId:X,setAppDefaultPersonaId:async V=>{console.log("[MockGrackle] setAppDefaultPersonaId",V),Y(V)},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(V,ne)=>{console.log(`[MockGrackle] loadUsage(${V}, ${ne})`)},knowledge:{graphData:{nodes:F,links:le},selectedNode:J,loading:!1,selectedId:Z,searchQuery:re,search:async V=>{if(console.log("[MockGrackle] knowledge.search",V),!V.trim()){de(V);return}de(V);const ne=Ke.current,oe=ne?vs.filter(ye=>!ye.workspaceId||ye.workspaceId===ne):vs,ue=V.toLowerCase(),pe=oe.filter(ye=>{var Ae,Fe,ut;return ye.label.toLowerCase().includes(ue)||((Ae=ye.content)==null?void 0:Ae.toLowerCase().includes(ue))||((Fe=ye.tags)==null?void 0:Fe.some(Ze=>Ze.toLowerCase().includes(ue)))||((ut=ye.category)==null?void 0:ut.toLowerCase().includes(ue))});te(pe);const ze=new Set(pe.map(ye=>ye.id));se(Ca.filter(ye=>ze.has(ye.source)&&ze.has(ye.target))),ae(void 0),L(void 0)},clearSearch:()=>{console.log("[MockGrackle] knowledge.clearSearch"),de("");const V=Ke.current,ne=V?vs.filter(ue=>!ue.workspaceId||ue.workspaceId===V):vs;te(ne);const oe=new Set(ne.map(ue=>ue.id));se(Ca.filter(ue=>oe.has(ue.source)&&oe.has(ue.target)))},selectNode:async V=>{console.log("[MockGrackle] knowledge.selectNode",V),ae(V);const ne=V in Db?Db[V]:void 0;if(ne)L(ne);else{const oe=vs.find(ue=>ue.id===V);if(oe){const ue=Ca.filter(pe=>pe.source===V||pe.target===V).map(pe=>({fromId:pe.source,toId:pe.target,type:pe.type}));L({node:oe,edges:ue})}}},clearSelection:()=>{console.log("[MockGrackle] knowledge.clearSelection"),ae(void 0),L(void 0)},expandNode:async V=>{console.log("[MockGrackle] knowledge.expandNode",V),te(ne=>{const oe=new Set(ne.map(Ae=>Ae.id)),ue=Ca.filter(Ae=>Ae.source===V||Ae.target===V),pe=new Set;for(const Ae of ue)oe.has(Ae.source)||pe.add(Ae.source),oe.has(Ae.target)||pe.add(Ae.target);if(pe.size===0)return ne;const ze=vs.filter(Ae=>pe.has(Ae.id)),ye=new Set([...oe,...pe]);return se(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}),[...ne,...ze]})},loadRecent:async V=>{if(console.log("[MockGrackle] knowledge.loadRecent",V),Ke.current=V,V){const ne=vs.filter(ue=>!ue.workspaceId||ue.workspaceId===V);te(ne);const oe=new Set(ne.map(ue=>ue.id));se(Ca.filter(ue=>oe.has(ue.source)&&oe.has(ue.target)))}else te(vs),se(Ca);de("")},handleEvent:()=>!1}}),[s,o,u,p,g,y,k,N,C,A,D,z,X,F,le,J,Z,re,cs,ks,ea,An,Zn,us,ta,Kn,Ne,Ce,cn,yn,ds,wi,Ua,Ni,al,na,Qt,Yn,en,il,ol,rl,$a,Pa,Va]);return r.jsx(Pm.Provider,{value:Ss,children:t})}const v8=3e3;function y8(t){const[s,i]=_.useState(!1),o=_.useRef(t.onSessionEvent);o.current=t.onSessionEvent;const c=_.useRef(t.onDomainEvent);c.current=t.onDomainEvent;const u=_.useRef(t.onConnect);u.current=t.onConnect;const d=_.useRef(t.onDisconnect);return d.current=t.onDisconnect,_.useEffect(()=>{let p=!1,h;async function g(){var v,y;if(!p){try{const b=xe.streamEvents({});i(!0),Promise.resolve((v=u.current)==null?void 0:v.call(u)).catch(()=>{});for await(const k of b){if(p)break;const S=k.event;if(S.case==="sessionEvent"){const N=S.value;o.current({sessionId:N.sessionId,type:N.type,timestamp:N.timestamp,content:N.content,raw:N.raw})}else if(S.case==="domainEvent"){const N=S.value;c.current({id:N.id,type:N.type,timestamp:N.timestamp,payloadJson:N.payloadJson})}}}catch(b){if(b instanceof Yr&&b.code===sT.Unauthenticated){window.location.href=qN;return}}p||(i(!1),(y=d.current)==null||y.call(d),h=setTimeout(()=>{g().catch(()=>{})},v8))}}return g().catch(()=>{}),()=>{p=!0,clearTimeout(h),i(!1)}},[]),{connected:s}}function b8(t){return{id:t.id,displayName:t.displayName,adapterType:t.adapterType,adapterConfig:t.adapterConfig||"{}",status:t.status,bootstrapped:t.bootstrapped}}function Ib(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 _8(t){return{sessionId:t.sessionId,eventType:Wb(t.type),timestamp:t.timestamp,content:t.content,raw:t.raw||void 0}}function x8(t){return{id:t.id,name:t.name,description:t.description,repoUrl:t.repoUrl,environmentId:t.environmentId,status:aT(t.status),workingDirectory:t.workingDirectory,useWorktrees:t.useWorktrees,defaultPersonaId:t.defaultPersonaId,createdAt:t.createdAt,updatedAt:t.updatedAt}}function Ob(t){return{id:t.id,workspaceId:t.workspaceId??void 0,title:t.title,description:t.description,status:iT(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 up(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 k8(t){return{name:t.name,tokenType:t.type,envVar:t.envVar,filePath:t.filePath,expiresAt:t.expiresAt}}function S8(t){return{claude:oT(t.claude),github:_c(t.github),copilot:_c(t.copilot),codex:_c(t.codex),goose:_c(t.goose)}}function T8(t){return{name:t.name,repository:t.repository,state:t.state,gitStatus:t.gitStatus}}function dp(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 w8(t){return{inputTokens:t.inputTokens,outputTokens:t.outputTokens,costUsd:t.costUsd,sessionCount:t.sessionCount}}function Rc(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 fp(t){return{source:t.fromId,target:t.toId,type:t.type}}function Ti(){const[t,s]=_.useState(!1),i=_.useRef(0),o=_.useCallback(c=>(i.current++,i.current===1&&s(!0),c.finally(()=>{i.current--,i.current===0&&s(!1)})),[]);return{loading:t,track:o}}const Lb=5e3;function Cr(t){return t instanceof Yr?t.message:"Operation failed"}function N8(){const[t,s]=_.useState([]),{loading:i,track:o}=Ti(),[c,u]=_.useState({}),[d,p]=_.useState(""),h=_.useCallback(()=>{p("")},[]),g=_.useCallback(async()=>{try{const T=await o(xe.listEnvironments({}));s(T.environments.map(b8))}catch{}},[o]),v=_.useCallback(T=>{switch(T.type){case"environment.added":return!0;case"environment.removed":{const C=T.payload.environmentId;return C&&(s(E=>E.filter(A=>A.id!==C)),u(E=>{const A={...E};return delete A[C],A})),!0}case"environment.changed":return g().catch(()=>{}),!0;case"environment.provision_progress":{const C=T.payload;if(typeof C.environmentId!="string"||typeof C.stage!="string"||typeof C.message!="string"||typeof C.progress!="number")return wx("environment.provision_progress","invalid payload"),!0;if(u(E=>({...E,[C.environmentId]:{stage:C.stage,message:C.message,progress:C.progress}})),C.stage==="ready"){const E=C.environmentId;setTimeout(()=>{u(A=>{const I={...A};return delete I[E],I})},Lb)}return!0}default:return!1}},[g]),y=_.useCallback(T=>{var C;if(T.type==="environments"){const E=Array.isArray((C=T.payload)==null?void 0:C.environments)?T.payload.environments:[];return s(E),!0}return!1},[]),b=_.useCallback(async(T,C,E)=>{p("");try{await xe.addEnvironment({displayName:T,adapterType:C,adapterConfig:JSON.stringify(E??{})})}catch(A){p(Cr(A))}},[]),k=_.useCallback(async(T,C)=>{p("");try{await xe.updateEnvironment({id:T,displayName:C.displayName,adapterConfig:C.adapterConfig?JSON.stringify(C.adapterConfig):void 0})}catch(E){p(Cr(E))}},[]),S=_.useCallback(async(T,C)=>{p("");try{const E=xe.provisionEnvironment({id:T,force:C??!1});for await(const A of E)u(I=>({...I,[T]:{stage:A.stage,message:A.message,progress:A.progress}})),A.stage==="ready"&&setTimeout(()=>{u(I=>{const D={...I};return delete D[T],D})},Lb)}catch(E){u(A=>{const I={...A};return delete I[T],I}),p(Cr(E))}},[]),N=_.useCallback(async T=>{p("");try{await xe.stopEnvironment({id:T})}catch(C){p(Cr(C))}},[]),j=_.useCallback(async T=>{p("");try{await xe.removeEnvironment({id:T})}catch(C){p(Cr(C))}},[]);return{environments:t,environmentsLoading:i,provisionStatus:c,operationError:d,clearOperationError:h,loadEnvironments:g,addEnvironment:b,updateEnvironment:k,provisionEnvironment:S,stopEnvironment:N,removeEnvironment:j,handleEvent:v,handleLegacyMessage:y}}const pp=new Set(["pending","running","idle"]),j8=new Set(["completed","failed","interrupted","hibernating","suspended"]),Bb=["pending","running","idle"];function C8(){const[t,s]=_.useState([]),{loading:i,track:o}=Ti(),[c,u]=_.useState([]),[d,p]=_.useState(0),[h,g]=_.useState(void 0),[v,y]=_.useState({}),b=_.useCallback(async()=>{try{const z=(await o(xe.listSessions({}))).sessions.map(Ib);s(X=>{const Y=new Map(X.map(F=>[F.id,F]));return z.map(F=>{const te=Y.get(F.id),le=te==null?void 0:te.status;return!le||le===F.status?F:j8.has(le)&&pp.has(F.status)?{...F,status:le,...te.endReason!==void 0?{endReason:te.endReason}:{}}:pp.has(le)&&pp.has(F.status)&&Bb.indexOf(le)>Bb.indexOf(F.status)?{...F,status:le}:F})})}catch{}},[o]),k=_.useCallback(B=>{if(B.type!=="session_event")return!1;if(!qB(B.payload))return wx("session_event","payload is not a valid SessionEvent"),!0;const z=B.payload;let X=0;if(u(Y=>{const F=[...Y,z];return F.length>po?(X=F.length-po,F.slice(-po)):F}),X>0&&p(Y=>Y+X),z.eventType==="usage")try{const Y=JSON.parse(z.content),F=Number(Y.input_tokens)||0,te=Number(Y.output_tokens)||0,le=Number(Y.cost_usd)||0;(F>0||te>0||le>0)&&s(se=>se.map(J=>J.id===z.sessionId?{...J,inputTokens:(J.inputTokens??0)+F,outputTokens:(J.outputTokens??0)+te,costUsd:(J.costUsd??0)+le}:J))}catch{}if(z.eventType==="status"){const Y=Nx(z.content),F=jx(z.content);s(te=>te.some(se=>se.id===z.sessionId)?te.map(se=>se.id===z.sessionId?{...se,status:Y,...F!==void 0?{endReason:F}:{}}:se):[...te,{id:z.sessionId,environmentId:"",runtime:"",status:Y,prompt:"",startedAt:z.timestamp,...F!==void 0?{endReason:F}:{}}])}return!0},[]),S=_.useCallback(B=>{k({type:"session_event",payload:B})},[k]),N=_.useCallback(B=>{var z,X,Y,F,te;switch(B.type){case"sessions":{const le=Array.isArray((z=B.payload)==null?void 0:z.sessions)?B.payload.sessions:[];return s(le),!0}case"spawned":{const le=(X=B.payload)==null?void 0:X.sessionId;return typeof le=="string"&&le&&g(le),b().catch(()=>{}),!0}case"session_events":{const le=Array.isArray((Y=B.payload)==null?void 0:Y.events)?B.payload.events:[];return le.length>0&&u(le),!0}case"task_sessions":{const le=(F=B.payload)==null?void 0:F.taskId;if(typeof le=="string"&&le){const se=Array.isArray((te=B.payload)==null?void 0:te.sessions)?B.payload.sessions:[];y(J=>({...J,[le]:se}))}return!0}default:return!1}},[b]),j=_.useCallback(async(B,z,X,Y)=>{try{const F=await xe.spawnAgent({environmentId:B,prompt:z,personaId:X||"",workingDirectory:Y||""});g(F.id),await b()}catch{}},[b]),T=_.useCallback(async(B,z)=>{try{await xe.sendInput({sessionId:B,text:z})}catch{}},[]),C=_.useCallback(async B=>{try{await xe.killAgent({id:B,graceful:!1})}catch{}},[]),E=_.useCallback(async B=>{try{await xe.killAgent({id:B,graceful:!0})}catch{}},[]),A=_.useCallback(async B=>{try{const X=(await xe.getSessionEvents({id:B})).events.map(_8);if(X.length>0){let Y=0;u(F=>{const te=new Set;for(const J of F)J.sessionId===B&&te.add(`${J.timestamp}|${J.eventType}`);const le=X.filter(J=>!te.has(`${J.timestamp}|${J.eventType}`)),se=[...F,...le].sort((J,L)=>J.sessionId!==L.sessionId?0:J.timestamp.localeCompare(L.timestamp));return se.length>po?(Y=se.length-po,se.slice(-po)):se}),Y>0&&p(F=>F+Y)}}catch{}},[]),I=_.useCallback(()=>{u([]),p(0)},[]),D=_.useCallback(async B=>{try{const X=(await xe.getTaskSessions({id:B})).sessions.map(Ib);y(Y=>({...Y,[B]:X}))}catch{}},[]);return{sessions:t,sessionsLoading:i,events:c,eventsDropped:d,lastSpawnedId:h,taskSessions:v,loadSessions:b,spawn:j,sendInput:T,kill:C,stopGraceful:E,loadSessionEvents:A,clearEvents:I,loadTaskSessions:D,handleMessage:k,handleSessionEvent:S,handleLegacyMessage:N}}function E8(){const[t,s]=_.useState([]),{loading:i,track:o}=Ti(),[c,u]=_.useState(!1),d=_.useCallback(async()=>{try{const b=await o(xe.listWorkspaces({}));s(b.workspaces.map(x8))}catch{}},[o]),p=_.useCallback(b=>{switch(b.type){case"workspace.created":return u(!1),d().catch(()=>{}),!0;case"workspace.archived":case"workspace.updated":return d().catch(()=>{}),!0;default:return!1}},[d]),h=_.useCallback(()=>{u(!1)},[]),g=_.useCallback(async(b,k,S,N,j,T,C,E,A)=>{u(!0);try{await xe.createWorkspace({name:b,description:k||"",repoUrl:S||"",environmentId:N||"",defaultPersonaId:j||void 0,useWorktrees:T??!0,workingDirectory:C||void 0}),u(!1),E==null||E()}catch(I){u(!1);const D=I instanceof Yr?I.message:"Failed to create workspace";A==null||A(D)}},[]),v=_.useCallback(async b=>{try{await xe.archiveWorkspace({id:b})}catch{}},[]),y=_.useCallback(async(b,k)=>{try{await xe.updateWorkspace({id:b,...k})}catch{}},[]);return{workspaces:t,workspacesLoading:i,workspaceCreating:c,loadWorkspaces:d,createWorkspace:g,archiveWorkspace:v,updateWorkspace:y,handleEvent:p,onDisconnect:h}}function A8(){const[t,s]=_.useState([]),{loading:i,track:o}=Ti(),[c,u]=_.useState(void 0),d=_.useRef({}),p=_.useCallback(async A=>{try{const D=(await xe.listTasks({workspaceId:A})).tasks.map(Ob);s(B=>[...B.filter(z=>z.workspaceId!==A),...D])}catch{}},[]),h=_.useCallback(async()=>{try{const I=(await o(xe.listTasks({}))).tasks.map(Ob);s(D=>{const B=new Set(I.map(z=>z.id));return[...D.filter(z=>!B.has(z.id)),...I]})}catch{}},[o]),g=_.useCallback((A,I)=>{const D=B=>{clearTimeout(d.current[B]),d.current[B]=setTimeout(()=>{delete d.current[B],p(B).catch(()=>{})},200)};A?D(A):I&&s(B=>{const z=B.find(X=>X.id===I);return z!=null&&z.workspaceId?D(z.workspaceId):h().catch(()=>{}),B})},[p,h]),v=_.useCallback(A=>{const I=A.payload;switch(A.type){case"task.created":{const D=typeof I.workspaceId=="string"?I.workspaceId:"";return D&&p(D).catch(()=>{}),!0}case"task.started":{const D=typeof I.taskId=="string"?I.taskId:"",B=typeof I.sessionId=="string"?I.sessionId:"",z=typeof I.workspaceId=="string"?I.workspaceId:"";return u(X=>D&&X===D?void 0:X),B&&D&&s(X=>X.map(Y=>Y.id===D?{...Y,latestSessionId:B}:Y)),g(z,D),!0}case"task.completed":case"task.deleted":case"task.reparented":case"task.updated":{const D=typeof I.workspaceId=="string"?I.workspaceId:"",B=typeof I.taskId=="string"?I.taskId:"";return g(D,B),!0}default:return!1}},[p,g]),y=_.useCallback(()=>{u(void 0)},[]),b=_.useCallback(A=>{var I,D;if(A.type==="tasks"){const B=Array.isArray((I=A.payload)==null?void 0:I.tasks)?A.payload.tasks:[],z=typeof((D=A.payload)==null?void 0:D.workspaceId)=="string"&&A.payload.workspaceId?A.payload.workspaceId:"";return s(z?X=>[...X.filter(Y=>Y.workspaceId!==z),...B]:X=>{const Y=new Set(B.map(F=>F.id));return[...X.filter(F=>!Y.has(F.id)),...B]}),!0}return!1},[]),k=_.useCallback(async(A,I,D,B,z,X,Y,F,te)=>{try{await xe.createTask({workspaceId:A,title:I,description:D||"",dependsOn:B||[],parentTaskId:z||"",defaultPersonaId:X||void 0,canDecompose:Y??void 0}),F==null||F()}catch(le){const se=le instanceof Yr?le.message:"Failed to create task";te==null||te(se)}},[]),S=_.useCallback(async(A,I,D,B)=>{u(A);try{await xe.startTask({taskId:A,personaId:I||"",environmentId:D||"",notes:B||""})}catch{u(void 0)}},[]),N=_.useCallback(async A=>{try{await xe.stopTask({id:A})}catch{}},[]),j=_.useCallback(async A=>{try{await xe.completeTask({id:A})}catch{}},[]),T=_.useCallback(async A=>{try{await xe.resumeTask({id:A})}catch{}},[]),C=_.useCallback(async(A,I,D,B,z)=>{try{await xe.updateTask({id:A,title:I,description:D,dependsOn:B,...z!==void 0?{defaultPersonaId:z}:{}})}catch{}},[]),E=_.useCallback(async A=>{try{await xe.deleteTask({id:A})}catch{}},[]);return{tasks:t,tasksLoading:i,taskStartingId:c,loadTasks:p,loadAllTasks:h,createTask:k,startTask:S,stopTask:N,completeTask:j,resumeTask:T,updateTask:C,deleteTask:E,handleEvent:v,onDisconnect:y,handleLegacyMessage:b}}function D8(){const[t,s]=_.useState([]),[i,o]=_.useState(void 0),[c,u]=_.useState(!1),d=_.useCallback(async y=>{try{const b=await xe.queryFindings({workspaceId:y});s(b.findings.map(up))}catch{}},[]),p=_.useCallback(async()=>{try{const y=await xe.queryFindings({workspaceId:""});s(y.findings.map(up))}catch{}},[]),h=_.useCallback(async y=>{o(void 0),u(!0);try{const b=await xe.getFinding({id:y});o(up(b))}catch{o(void 0)}finally{u(!1)}},[]),g=_.useCallback(y=>{if(y.type==="finding.posted"){const b=typeof y.payload.workspaceId=="string"?y.payload.workspaceId:"";return b&&d(b).catch(()=>{}),!0}return!1},[d]),v=_.useCallback(async(y,b,k,S,N)=>{try{await xe.postFinding({workspaceId:y,title:b,content:k,category:S??"general",tags:N??[]})}catch{}},[]);return{findings:t,selectedFinding:i,findingLoading:c,loadFindings:d,loadAllFindings:p,loadFinding:h,postFinding:v,handleEvent:g}}function R8(){const[t,s]=_.useState([]),{loading:i,track:o}=Ti(),c=_.useCallback(async()=>{try{const h=await o(xe.listTokens({}));s(h.tokens.map(k8))}catch{}},[o]),u=_.useCallback(h=>h.type==="token.changed"?(c().catch(()=>{}),!0):!1,[c]),d=_.useCallback(async(h,g,v,y,b)=>{try{await xe.setToken({name:h,value:g,type:v,envVar:y,filePath:b})}catch{}},[]),p=_.useCallback(async h=>{try{await xe.deleteToken({name:h})}catch{}},[]);return{tokens:t,tokensLoading:i,loadTokens:c,setToken:d,deleteToken:p,handleEvent:u}}function M8(){const[t,s]=_.useState({claude:"off",github:"off",copilot:"off",codex:"off",goose:"off"}),{loading:i,track:o}=Ti(),c=_.useCallback(async()=>{try{const p=await o(xe.getCredentialProviders({}));s(S8(p))}catch{}},[o]),u=_.useCallback(p=>p.type==="credential.providers_changed"?(FB(p.payload)&&s(p.payload),!0):!1,[]),d=_.useCallback(async p=>{const h=[{provider:"claude",value:p.claude},{provider:"github",value:p.github},{provider:"copilot",value:p.copilot},{provider:"codex",value:p.codex},{provider:"goose",value:p.goose}];await Promise.allSettled(h.map(({provider:g,value:v})=>xe.setCredentialProvider({provider:g,value:v})))},[]);return{credentialProviders:t,credentialsLoading:i,loadCredentials:c,updateCredentialProviders:d,handleEvent:u}}function I8(){const[t,s]=_.useState([]),[i,o]=_.useState(""),[c,u]=_.useState(""),[d,p]=_.useState(!1),h=_.useCallback(async()=>{try{const v=await xe.listCodespaces({});s(v.codespaces.map(T8)),u(v.error)}catch{}},[]),g=_.useCallback(async(v,y)=>{p(!0),o("");try{await xe.createCodespace({repo:v,machine:y??""}),p(!1),await h()}catch(b){p(!1);const k=b instanceof Yr?b.message:"Failed to create codespace";o(k)}},[h]);return{codespaces:t,codespaceError:i,codespaceListError:c,codespaceCreating:d,listCodespaces:h,createCodespace:g}}function O8(){const[t,s]=_.useState([]),{loading:i,track:o}=Ti(),c=_.useCallback(async()=>{try{const g=await o(xe.listPersonas({}));s(g.personas.map(dp))}catch{}},[o]),u=_.useCallback(g=>{switch(g.type){case"persona.created":case"persona.updated":case"persona.deleted":return c().catch(()=>{}),!0;default:return!1}},[c]),d=_.useCallback(async(g,v,y,b,k,S,N,j,T)=>{const C=await xe.createPersona({name:g,description:v,systemPrompt:y,runtime:b||"",model:k||"",maxTurns:S||0,type:N||"agent",script:j||"",allowedMcpTools:T||[]}),E=dp(C);return s(A=>[...A.filter(I=>I.id!==E.id),E]),E},[]),p=_.useCallback(async(g,v,y,b,k,S,N,j,T,C)=>{const E={id:g};v!==void 0&&(E.name=v),y!==void 0&&(E.description=y),b!==void 0&&(E.systemPrompt=b),k!==void 0&&(E.runtime=k),S!==void 0&&(E.model=S),N!==void 0&&(E.maxTurns=N),j!==void 0&&(E.type=j),T!==void 0&&(E.script=T),C!==void 0&&(E.allowedMcpTools={tools:C});const A=await xe.updatePersona(E),I=dp(A);return s(D=>D.map(B=>B.id===I.id?I:B)),I},[]),h=_.useCallback(async g=>{await xe.deletePersona({id:g}),s(v=>v.filter(y=>y.id!==g))},[]);return{personas:t,personasLoading:i,loadPersonas:c,createPersona:d,updatePersona:p,deletePersona:h,handleEvent:u}}function L8(t){if(t)try{return JSON.parse(t)}catch{return}}function B8(){const[t,s]=_.useState(new Map),[i,o]=_.useState([]),[c,u]=_.useState(void 0),[d,p]=_.useState(void 0),[h,g]=_.useState(!1),[v,y]=_.useState(""),b=_.useRef(""),k=_.useCallback(async A=>{const I=A??"";b.current=I,y(""),g(!0);try{const D=await xe.listRecentKnowledgeNodes({limit:30,workspaceId:I}),B=new Map,z=[];for(const X of D.nodes)B.set(X.id,Rc(X));for(const X of D.edges)z.push(fp(X));for(const X of z){const Y=B.get(X.source);Y&&(Y.val+=1);const F=B.get(X.target);F&&(F.val+=1)}s(B),o(z)}catch{}finally{g(!1)}},[]),S=_.useCallback(async A=>{if(A.trim()){y(A),p(void 0),u(void 0),g(!0);try{const I=await xe.searchKnowledge({query:A,limit:20,workspaceId:b.current}),D=new Map,B=[];for(const z of I.results){z.node&&D.set(z.node.id,Rc(z.node,z.edges.length));for(const X of z.edges)B.push(fp(X))}s(D),o(B)}catch{}finally{g(!1)}}},[]),N=_.useCallback(()=>{k(b.current).catch(()=>{})},[k]),j=_.useCallback(async A=>{p(A);try{const I=await xe.getKnowledgeNode({id:A});if(!I.node){u(void 0);return}u({node:Rc(I.node,I.edges.length),edges:I.edges.map(D=>({fromId:D.fromId,toId:D.toId,type:D.type,metadata:L8(D.metadataJson)}))})}catch{u(void 0)}},[]),T=_.useCallback(()=>{p(void 0),u(void 0)},[]),C=_.useCallback(async A=>{try{const I=await xe.expandKnowledgeNode({id:A,depth:1});s(D=>{const B=new Map(D);for(const z of I.nodes)B.has(z.id)||B.set(z.id,Rc(z));return B}),o(D=>{const B=new Set(D.map(X=>`${X.source}:${X.target}:${X.type}`)),z=[];for(const X of I.edges){const Y=fp(X),F=`${Y.source}:${Y.target}:${Y.type}`;B.has(F)||z.push(Y)}return[...D,...z]})}catch{}},[]),E=_.useCallback(A=>!1,[]);return{graphData:{nodes:[...t.values()],links:i},selectedNode:c,selectedId:d,loading:h,searchQuery:v,search:S,clearSearch:N,selectNode:j,clearSelection:T,expandNode:C,loadRecent:k,handleEvent:E}}function z8(){const t=_.useRef("default");_.useEffect(()=>{typeof Notification>"u"||(t.current=Notification.permission)},[]);function s(i){if(i.type!=="notification.escalated")return!1;if(typeof Notification>"u")return!0;if(t.current==="default")return Notification.requestPermission().then(u=>{t.current=u}).catch(()=>{}),!0;if(t.current!=="granted")return!0;const o=i.payload,c=new Notification(o.title||"Agent needs input",{body:o.message||"An agent is waiting for your input.",tag:o.escalationId,icon:"/icon-192x192.png"});return c.onclick=()=>{window.focus(),o.taskUrl&&(window.location.href=o.taskUrl),c.close()},!0}return{handleEvent:s}}function U8(){const[t,s]=_.useState(""),[i,o]=_.useState(void 0),[c,u]=_.useState({}),d=N8(),p=C8(),h=E8(),g=A8(),v=D8(),y=R8(),b=M8(),k=I8(),S=O8(),N=B8(),j=z8(),{connected:T}=y8({onSessionEvent:F=>{p.handleSessionEvent({sessionId:F.sessionId,eventType:Wb(F.type),timestamp:F.timestamp,content:F.content,raw:F.raw||void 0})},onDomainEvent:F=>{try{const te=JSON.parse(F.payloadJson);B({id:F.id,type:F.type,timestamp:F.timestamp,payload:te})}catch{console.warn("[grackle] Failed to parse domain event payloadJson:",F.payloadJson)}},onConnect:z,onDisconnect:X}),C="default_persona_id",E="onboarding_completed",A=_.useCallback(async F=>{const te=await xe.setSetting({key:C,value:F});s(te.value)},[]),I=_.useCallback(async()=>{o(!0);try{await xe.setSetting({key:E,value:"true"})}catch{}},[]),D=_.useCallback(async(F,te)=>{try{const le=await xe.getUsage({scope:F,id:te}),se=`${F}:${te}`;u(J=>({...J,[se]:w8(le)}))}catch{}},[]);function B(F){const te=F.payload.key,le=F.payload.value;if(F.type==="setting.changed"){te===C&&s(le??""),te===E&&o(le==="true");return}if(d.handleEvent(F)){(F.type==="environment.removed"||F.type==="environment.changed")&&p.loadSessions().catch(()=>{});return}if(!h.handleEvent(F)){if(g.handleEvent(F)){F.type==="task.started"&&p.loadSessions().catch(()=>{});return}v.handleEvent(F)||y.handleEvent(F)||b.handleEvent(F)||S.handleEvent(F)||N.handleEvent(F)||j.handleEvent(F)}}async function z(){d.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),y.loadTokens().catch(()=>{}),b.loadCredentials().catch(()=>{}),S.loadPersonas().catch(()=>{}),g.loadAllTasks().catch(()=>{});try{const F=await xe.getSetting({key:C});s(F.value)}catch{}try{const F=await xe.getSetting({key:E});o(F.value==="true")}catch{}}function X(){h.onDisconnect(),g.onDisconnect()}const Y=_.useCallback(()=>{d.loadEnvironments().catch(()=>{}),p.loadSessions().catch(()=>{}),h.loadWorkspaces().catch(()=>{}),y.loadTokens().catch(()=>{})},[d.loadEnvironments,p.loadSessions,h.loadWorkspaces,y.loadTokens]);return{connected:T,environmentsLoading:d.environmentsLoading,sessionsLoading:p.sessionsLoading,workspacesLoading:h.workspacesLoading,tasksLoading:g.tasksLoading,tokensLoading:y.tokensLoading,credentialsLoading:b.credentialsLoading,personasLoading:S.personasLoading,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:b.credentialProviders,updateCredentialProviders:b.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:A,onboardingCompleted:i,completeOnboarding:I,usageCache:c,loadUsage:D,knowledge:N}}function $8({children:t}){const s=U8();return r.jsx(Pm.Provider,{value:s,children:t})}function P8(t,s){const i=_.useRef(null);_.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 V8(t,s,i){const o=_.useRef(t);_.useEffect(()=>{t&&t!==o.current&&(i(t,"error"),s()),o.current=t},[t,s,i])}const H8={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 q8(t){return H8[t]}function G8(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=q8(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 F8(t,s){const i=_.useRef(void 0);_.useEffect(()=>{const o=i.current;i.current=t;const c=G8(o,t);for(const u of c)s(u.message,u.variant)},[t,s])}const Z8="_dashboard_16pzm_1",K8="_kpiStrip_16pzm_11",Y8="_kpiCard_16pzm_23",J8="_kpiValue_16pzm_68",W8="_kpiLabel_16pzm_76",X8="_bodyGrid_16pzm_84",Q8="_section_16pzm_96",ez="_sectionHeader_16pzm_109",tz="_sectionIcon_16pzm_118",nz="_sectionTitle_16pzm_123",sz="_sectionCount_16pzm_131",az="_sectionBody_16pzm_138",iz="_emptyHint_16pzm_143",oz="_sessionRow_16pzm_150",rz="_sessionPrompt_16pzm_177",lz="_sessionEnv_16pzm_186",cz="_sessionRuntime_16pzm_192",uz="_sessionStatus_16pzm_198",dz="_statusDot_16pzm_207",fz="_attentionRow_16pzm_233",pz="_attentionTitle_16pzm_259",mz="_attentionMeta_16pzm_267",hz="_reasonBadge_16pzm_274",gz="_bottomGrid_16pzm_301",vz="_envRow_16pzm_312",yz="_envName_16pzm_323",bz="_envStatusBadge_16pzm_333",_z="_workspaceRow_16pzm_369",xz="_workspaceTop_16pzm_395",kz="_workspaceName_16pzm_401",Sz="_workspaceCounts_16pzm_407",Tz="_progressBar_16pzm_415",wz="_progressFill_16pzm_422",_e={dashboard:Z8,kpiStrip:K8,kpiCard:Y8,kpiValue:J8,kpiLabel:W8,bodyGrid:X8,section:Q8,sectionHeader:ez,sectionIcon:tz,sectionTitle:nz,sectionCount:sz,sectionBody:az,emptyHint:iz,sessionRow:oz,sessionPrompt:rz,sessionEnv:lz,sessionRuntime:cz,sessionStatus:uz,statusDot:dz,attentionRow:fz,attentionTitle:pz,attentionMeta:mz,reasonBadge:hz,bottomGrid:gz,envRow:vz,envName:yz,envStatusBadge:bz,workspaceRow:_z,workspaceTop:xz,workspaceName:kz,workspaceCounts:Sz,progressBar:Tz,progressFill:wz},Nz={hidden:{opacity:0,y:12},visible:t=>({opacity:1,y:0,transition:{delay:t*.06,duration:.3,ease:"easeOut"}})},Mc={hidden:{opacity:0,y:16},visible:t=>({opacity:1,y:0,transition:{delay:.15+t*.08,duration:.35,ease:"easeOut"}})};function jz(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 Ic({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:Nz,initial:"hidden",animate:"visible",custom:o,children:[r.jsx("span",{className:_e.kpiValue,children:t}),r.jsx("span",{className:_e.kpiLabel,children:s})]})}function Cz(){const{workspaces:t,tasks:s,sessions:i,environments:o,loadTasks:c}=ct(),u=bt(),d=_.useRef(new Set);_.useEffect(()=>{for(const y of t)d.current.has(y.id)||(d.current.add(y.id),c(y.id).catch(()=>{}))},[t,c]);const p=_.useMemo(()=>s8(i,s,o),[i,s,o]),h=_.useMemo(()=>i8(i,o),[i,o]),g=_.useMemo(()=>a8(s,t),[s,t]),v=_.useMemo(()=>o8(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(Ic,{value:p.activeSessions,label:"Active Sessions",accent:"green",index:0,testId:"kpi-active-sessions"}),r.jsx(Ic,{value:p.blockedTasks,label:"Blocked Tasks",accent:"yellow",index:1,testId:"kpi-blocked-tasks"}),r.jsx(Ic,{value:p.attentionTasks,label:"Needs Attention",accent:"red",index:2,testId:"kpi-attention-tasks"}),r.jsx(Ic,{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:Mc,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:b})=>r.jsxs("button",{type:"button",className:_e.sessionRow,onClick:()=>u(nm(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:b}),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:Mc,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:b,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":b,children:b}),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:Mc,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:Mc,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:b,completedTasks:k,workingTasks:S,failedTasks:N})=>{const j=b>0?Math.round(k/b*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":jz(k,b,S,N),children:[k,"/",b,S>0&&r.jsxs("span",{style:{color:"var(--accent-green)"},"aria-hidden":"true",children:["▸",S]}),N>0&&r.jsxs("span",{style:{color:"var(--accent-red)"},"aria-hidden":"true",children:["✗",N]})]})]}),b>0&&r.jsx("div",{className:_e.progressBar,children:r.jsx("div",{className:_e.progressFill,style:{width:`${j}%`}})})]},y.id)})})]})]})]})}const Ez="_panelContainer_101ly_1",Az="_emptyState_101ly_8",Dz="_fadeIn_101ly_1",Rz="_workspaceSummary_101ly_17",Mz="_workspaceSummaryTitle_101ly_28",Iz="_workspaceSummarySubtitle_101ly_32",Oz="_header_101ly_36",Lz="_headerInfo_101ly_71",Bz="_killButton_101ly_77",zz="_headerTitle_101ly_106",Uz="_headerActions_101ly_121",$z="_taskStatusBadge_101ly_128",Pz="_taskBranch_101ly_137",Vz="_taskBlockedBadge_101ly_143",Hz="_btnPrimary_101ly_151",qz="_btnDanger_101ly_182",Gz="_btnGhost_101ly_221",Fz="_rejectInput_101ly_247",Zz="_tabBar_101ly_277",Kz="_tab_101ly_277",Yz="_active_101ly_303",Jz="_eventScroll_101ly_308",Wz="_tabContent_101ly_314",Xz="_noContext_101ly_319",Qz="_overviewContent_101ly_325",e7="_overviewDashboard_101ly_334",t7="_overviewHero_101ly_340",n7="_statusBadge_101ly_347",s7="_statusPending_101ly_359",a7="_statusAssigned_101ly_364",i7="_statusInProgress_101ly_369",o7="_statusReview_101ly_374",r7="_statusDone_101ly_379",l7="_statusFailed_101ly_384",c7="_statusWaitingInput_101ly_389",u7="_overviewBranchPill_101ly_394",d7="_branchLink_101ly_409",f7="_overviewSection_101ly_420",p7="_overviewLabel_101ly_426",m7="_overviewValue_101ly_433",h7="_overviewMuted_101ly_438",g7="_overviewMarkdown_101ly_444",v7="_envRow_101ly_513",y7="_envDot_101ly_519",b7="_envDotGreen_101ly_526",_7="_envDotYellow_101ly_530",x7="_envDotRed_101ly_534",k7="_envDotGray_101ly_538",S7="_depList_101ly_542",T7="_depItem_101ly_548",w7="_depBlocked_101ly_555",N7="_depDone_101ly_559",j7="_timeline_101ly_563",C7="_timelineRow_101ly_569",E7="_timelineKey_101ly_576",A7="_timelineValue_101ly_582",D7="_timelineDelta_101ly_586",R7="_reviewNotes_101ly_597",M7="_overviewDescription_101ly_608",I7="_waitingMessage_101ly_614",O7="_errorMessage_101ly_618",L7="_attemptSelector_101ly_622",B7="_attemptLabel_101ly_638",z7="_attemptButton_101ly_642",U7="_attemptActive_101ly_659",$7="_attemptStatus_101ly_665",P7="_emptyCta_101ly_671",V7="_ctaTitle_101ly_683",H7="_ctaDescription_101ly_689",q7="_ctaButton_101ly_696",G7="_ctaCreateForm_101ly_731",F7="_ctaCreateInput_101ly_737",Z7="_ctaCreateOk_101ly_768",K7="_ctaLink_101ly_803",Y7="_workspaceHeader_101ly_817",J7="_workspaceName_101ly_842",W7="_workspaceMeta_101ly_855",X7="_metaRow_101ly_863",Q7="_metaLabel_101ly_876",eU="_metaValue_101ly_891",tU="_archiveButton_101ly_901",nU="_repoLink_101ly_931",sU="_metaToggle_101ly_941",aU="_metaToggleArrow_101ly_962",iU="_metaToggleArrowOpen_101ly_967",oU="_progressBarContainer_101ly_971",rU="_progressBar_101ly_971",lU="_progressFill_101ly_987",cU="_progressLabel_101ly_994",uU="_metaTimestamps_101ly_1001",dU="_metaTimestamp_101ly_1001",P={panelContainer:Ez,emptyState:Az,fadeIn:Dz,workspaceSummary:Rz,workspaceSummaryTitle:Mz,workspaceSummarySubtitle:Iz,header:Oz,headerInfo:Lz,killButton:Bz,headerTitle:zz,headerActions:Uz,taskStatusBadge:$z,taskBranch:Pz,taskBlockedBadge:Vz,btnPrimary:Hz,btnDanger:qz,btnGhost:Gz,rejectInput:Fz,tabBar:Zz,tab:Kz,active:Yz,eventScroll:Jz,tabContent:Wz,noContext:Xz,overviewContent:Qz,overviewDashboard:e7,overviewHero:t7,statusBadge:n7,statusPending:s7,statusAssigned:a7,statusInProgress:i7,statusReview:o7,statusDone:r7,statusFailed:l7,statusWaitingInput:c7,overviewBranchPill:u7,branchLink:d7,overviewSection:f7,overviewLabel:p7,overviewValue:m7,overviewMuted:h7,overviewMarkdown:g7,envRow:v7,envDot:y7,envDotGreen:b7,envDotYellow:_7,envDotRed:x7,envDotGray:k7,depList:S7,depItem:T7,depBlocked:w7,depDone:N7,timeline:j7,timelineRow:C7,timelineKey:E7,timelineValue:A7,timelineDelta:D7,reviewNotes:R7,overviewDescription:M7,waitingMessage:I7,errorMessage:O7,attemptSelector:L7,attemptLabel:B7,attemptButton:z7,attemptActive:U7,attemptStatus:$7,emptyCta:P7,ctaTitle:V7,ctaDescription:H7,ctaButton:q7,ctaCreateForm:G7,ctaCreateInput:F7,ctaCreateOk:Z7,ctaLink:K7,workspaceHeader:Y7,workspaceName:J7,workspaceMeta:W7,metaRow:X7,metaLabel:Q7,metaValue:eU,archiveButton:tU,repoLink:nU,metaToggle:sU,metaToggleArrow:aU,metaToggleArrowOpen:iU,progressBarContainer:oU,progressBar:rU,progressFill:lU,progressLabel:cU,metaTimestamps:uU,metaTimestamp:dU};function fU(){return r.jsx("div",{className:P.emptyState,children:"Select a task or click + to create one"})}function pU(){return r.jsx("div",{className:P.emptyState,children:"Select an environment to manage its workspaces, or add a new one."})}function mU(){const{workspaces:t,environments:s}=ct(),i=bt(),o=s.length>0;return t.length>0?r.jsx(Cz,{}):r.jsxs("div",{className:P.emptyCta,"data-testid":"welcome-cta",children:[r.jsx("div",{className:P.ctaTitle,children:"Welcome to Grackle"}),r.jsx("div",{className:P.ctaDescription,children:"Organize your work into workspaces and let agents tackle the tasks."}),r.jsx("button",{className:P.ctaButton,onClick:()=>i(k_),disabled:!o,"data-testid":"welcome-create-button",children:"Create Your First Workspace"}),!o&&r.jsx("div",{className:P.ctaDescription,children:"Add an environment first before creating a workspace."})]})}const hU="_panelContainer_19poq_1",gU="_chatHeader_19poq_8",vU="_chatHeaderInfo_19poq_37",yU="_emptyState_19poq_43",bU="_emptyTitle_19poq_55",_U="_emptyDescription_19poq_61",xU="_emptyHint_19poq_67",mi={panelContainer:hU,chatHeader:gU,chatHeaderInfo:vU,emptyState:yU,emptyTitle:bU,emptyDescription:_U,emptyHint:xU};function kU({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 SU(){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:b,personas:k,provisionEnvironment:S}=ct(),{showToast:N}=gn(),j=_.useRef(void 0),[T,C]=_.useState(),E=t.find(Y=>Y.id===xr),A=E!=null&&E.latestSessionId?s.find(Y=>Y.id===E.latestSessionId)??(g[xr]??[]).find(Y=>Y.id===E.latestSessionId):void 0;_.useEffect(()=>{u(xr).catch(()=>{})},[u]),_.useEffect(()=>{E!=null&&E.latestSessionId&&u(xr).catch(()=>{})},[E==null?void 0:E.latestSessionId,u]),_.useEffect(()=>{A&&A.id!==j.current&&(j.current=A.id,d(A.id).catch(()=>{}))},[A==null?void 0:A.id,d]);const I=_.useMemo(()=>{if(!A)return[];const Y=i.filter(F=>F.sessionId===A.id);return qm(Hm(Y))},[i,A==null?void 0:A.id]),D=c.find(Y=>Y.adapterType==="local"&&Y.status==="connected"),B=A!==void 0&&A.status!=="stopped"&&A.status!=="suspended",z=(A==null?void 0:A.status)==="idle";_.useEffect(()=>{T&&A&&z&&(v(A.id,T).catch(()=>{}),C(void 0))},[T,z,A==null?void 0:A.id,v]);const X=_.useCallback((Y,F,te,le)=>{le&&C(le),b(Y,F,te).catch(()=>{})},[b]);return r.jsxs("div",{className:mi.panelContainer,"data-testid":"chat-page",children:[B&&r.jsxs("div",{className:mi.chatHeader,children:[r.jsxs("span",{className:mi.chatHeaderInfo,children:["Session: ",A.id.slice(0,8)," | ",A.runtime," | ",A.status]}),r.jsx(T_,{label:"Stop",onClick:()=>{h(A.id).catch(()=>{})},variant:"danger",size:"sm","data-testid":"stop-split-button",options:[{label:"Stop",description:"Graceful shutdown",onClick:()=>{h(A.id).catch(()=>{})}},{label:"Kill",description:"Force kill",onClick:()=>{p(A.id).catch(()=>{})}}]})]}),r.jsx(zm,{events:I,eventsDropped:o,emptyState:r.jsx(kU,{hasLocalEnvironment:!!D}),onShowToast:N}),D&&B&&r.jsx($r,{mode:"send",sessionId:A.id,environmentId:A.environmentId,personas:k,environments:c,onSendInput:(Y,F)=>{v(Y,F).catch(()=>{})},onSpawn:(Y,F,te)=>{y(Y,F,te).catch(()=>{})},onStartTask:(Y,F,te)=>{b(Y,F,te).catch(()=>{})},onProvisionEnvironment:Y=>{S(Y).catch(()=>{})},onShowToast:N}),D&&!B&&r.jsx($r,{mode:"start",taskId:xr,environmentId:D.id,personas:k,environments:c,onSendInput:(Y,F)=>{v(Y,F).catch(()=>{})},onSpawn:(Y,F,te)=>{y(Y,F,te).catch(()=>{})},onStartTask:X,onProvisionEnvironment:Y=>{S(Y).catch(()=>{})},onShowToast:N})]})}function TU(){const t=JB(),[s]=tm(),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:P.panelContainer,children:[r.jsx(xs,{segments:t}),r.jsx("div",{className:P.emptyState,children:"Enter a prompt below to start a new session"}),r.jsx($r,{mode:"spawn",environmentId:i,showPersonaSelect:!0,personas:d,environments:p,onSendInput:(v,y)=>{o(v,y).catch(()=>{})},onSpawn:(v,y,b)=>{c(v,y,b).catch(()=>{})},onStartTask:(v,y,b)=>{u(v,y,b).catch(()=>{})},onProvisionEnvironment:v=>{h(v).catch(()=>{})},onShowToast:g})]})}function wU({sessionId:t,session:s,isActive:i,onStop:o,onKill:c}){return r.jsxs("div",{className:P.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?` | ${w_((s.inputTokens??0)+(s.outputTokens??0))} tokens · ${So(s.costUsd??0)}`:""]}),r.jsxs("span",{className:P.headerInfo,children:[s&&r.jsx("span",{children:s.prompt.length>60?s.prompt.slice(0,60)+"...":s.prompt}),i&&r.jsx(T_,{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 NU({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?P.errorMessage:P.waitingMessage,children:i})}function jU(){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:b}=ct(),{showToast:k}=gn(),S=_.useRef(void 0),N=WB(t),j=o.find(E=>E.id===t)??void 0,T=_.useMemo(()=>{const E=t?s.filter(A=>A.sessionId===t):[];return qm(Hm(E))},[s,t]);if(_.useEffect(()=>{t&&t!==S.current&&(S.current=t,d(t).catch(()=>{}))},[t,d]),!t)return r.jsx("div",{className:P.emptyState,children:"No session selected"});const C=(j==null?void 0:j.status)==="running"||(j==null?void 0:j.status)==="idle";return r.jsxs("div",{className:P.panelContainer,children:[r.jsx(xs,{segments:N}),r.jsx(wU,{sessionId:t,session:j,isActive:C,onStop:()=>{u(t).catch(()=>{})},onKill:()=>{c(t).catch(()=>{})}}),r.jsx(zm,{events:T,eventsDropped:i,emptyState:r.jsx(NU,{session:j}),onShowToast:k}),C&&r.jsx($r,{mode:"send",sessionId:t,environmentId:j.environmentId,personas:v,environments:y,onSendInput:(E,A)=>{p(E,A).catch(()=>{})},onSpawn:(E,A,I)=>{h(E,A,I).catch(()=>{})},onStartTask:(E,A,I)=>{g(E,A,I).catch(()=>{})},onProvisionEnvironment:E=>{b(E).catch(()=>{})},onShowToast:k})]})}function CU(t){if(!t)return!1;const s=t.tagName;return!!(s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||t.isContentEditable)}function Ys(t,s){const i=_.useRef(s);i.current=s;const{key:o,ctrl:c=!1,shift:u=!1,suppressInInputs:d=!0,enabled:p=!0}=t;_.useEffect(()=>{if(!p)return;const h=g=>{if(d&&CU(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 zb(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 mp=100;function EU(t){try{const s=new URL(t);return s.protocol!=="http:"&&s.protocol!=="https:"?void 0:s.toString()}catch{return}}function AU(){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:b}=xx(),[k,S]=_.useState("tasks"),[N,j]=_.useState(!1),[T,C]=_.useState(null),[E,A]=_.useState(!1),I=_.useRef(void 0),D=u.find(J=>J.id===t),B=s??(D==null?void 0:D.environmentId)??"",z=XB(t,B,u,c);Ys({key:"1"},()=>S("graph")),Ys({key:"2"},()=>S("board")),Ys({key:"3"},()=>S("tasks")),_.useEffect(()=>{const J=I.current;I.current=t,!(J===void 0||J===t)&&T!==null&&C(null)},[t,T]);const X=p.reduce((J,L)=>J+(L.costUsd??0),0);_.useEffect(()=>{t&&y("workspace",t).catch(()=>{})},[t,y,X]);const Y=t?v[`workspace:${t}`]:void 0,F=o.filter(J=>J.workspaceId===t),te=F.filter(J=>J.status==="complete").length,le=F.length,se=le>0?Math.round(te/le*100):0;return r.jsxs("div",{className:P.panelContainer,children:[r.jsx(xs,{segments:z}),r.jsxs("div",{className:P.workspaceHeader,children:[r.jsx("span",{className:P.workspaceName,"data-testid":"workspace-name",children:r.jsx(Xt,{value:(D==null?void 0:D.name)||"",onSave:J=>{D&&g(D.id,{name:J}).catch(()=>{})},validate:J=>{const L=J.trim();if(!L)return"Name is required";if(L.length>mp)return`Max ${mp} characters`},maxLength:mp,fieldId:"name",activeFieldId:T,onActivate:C,ariaLabel:"Workspace name",renderDisplay:J=>J||t||void 0,"data-testid":"edit-name"})}),r.jsx("button",{className:P.archiveButton,onClick:()=>j(!0),title:"Archive workspace","data-testid":"archive-workspace-button",children:"Archive"})]}),r.jsxs("button",{className:P.metaToggle,onClick:()=>A(!E),"aria-expanded":!E,"aria-controls":"workspace-meta-panel","data-testid":"meta-toggle",children:[r.jsx("span",{className:`${P.metaToggleArrow} ${E?"":P.metaToggleArrowOpen}`,children:"▶"}),"Details"]}),!E&&r.jsxs("div",{className:P.workspaceMeta,"data-testid":"workspace-meta",id:"workspace-meta-panel",children:[r.jsxs("div",{className:P.metaRow,children:[r.jsx("span",{className:P.metaLabel,children:"Description"}),r.jsx("div",{className:P.metaValue,children:r.jsx(Up,{value:(D==null?void 0:D.description)||"",onSave:J=>{D&&g(D.id,{description:J}).catch(()=>{})},fieldId:"description",activeFieldId:T,onActivate:C,renderDisplay:J=>J?r.jsx("span",{className:P.overviewMarkdown,children:r.jsx(nu,{remarkPlugins:[su],children:J})}):void 0,placeholder:"No description",ariaLabel:"Workspace description","data-testid":"edit-description"})})]}),r.jsxs("div",{className:P.metaRow,children:[r.jsx("span",{className:P.metaLabel,children:"Repository"}),r.jsx("div",{className:P.metaValue,children:r.jsx(Xt,{value:(D==null?void 0:D.repoUrl)||"",onSave:J=>{D&&g(D.id,{repoUrl:J}).catch(()=>{})},validate:J=>{const L=J.trim();if(L&&!/^https?:\/\/.+/.test(L))return"Must be a valid http(s) URL"},fieldId:"repoUrl",activeFieldId:T,onActivate:C,renderDisplay:J=>{const L=EU(J);return L?r.jsx("a",{className:P.repoLink,href:L,target:"_blank",rel:"noopener noreferrer",onClick:Z=>Z.stopPropagation(),children:J}):J?r.jsx("span",{children:J}):void 0},placeholder:"No repository",ariaLabel:"Workspace repository URL","data-testid":"edit-repo"})})]}),r.jsxs("div",{className:P.metaRow,children:[r.jsx("span",{className:P.metaLabel,children:"Environment"}),r.jsx("div",{className:P.metaValue,children:r.jsx(e4,{value:(D==null?void 0:D.environmentId)||"",onSave:J=>{D&&J&&g(D.id,{environmentId:J}).catch(()=>{})},environments:c,fieldId:"environmentId",activeFieldId:T,onActivate:C,placeholder:"Select environment",ariaLabel:"Workspace environment","data-testid":"edit-env"})})]}),r.jsxs("div",{className:P.metaRow,children:[r.jsx("span",{className:P.metaLabel,children:"Persona"}),r.jsx("div",{className:P.metaValue,children:r.jsx(Qc,{value:(D==null?void 0:D.defaultPersonaId)||"",onSave:J=>{D&&g(D.id,{defaultPersonaId:J}).catch(()=>{})},options:[{value:"",label:"(Inherit)"},...d.map(J=>({value:J.id,label:J.name}))],fieldId:"defaultPersonaId",activeFieldId:T,onActivate:C,renderDisplay:J=>{const L=d.find(Z=>Z.id===J);if(L)return r.jsx("span",{children:L.name})},placeholder:(D==null?void 0:D.defaultPersonaId)||"(Inherit)",ariaLabel:"Workspace default persona","data-testid":"edit-persona"})})]}),r.jsxs("div",{className:P.metaRow,children:[r.jsx("span",{className:P.metaLabel,children:"Worktrees"}),r.jsx("div",{className:P.metaValue,children:r.jsx(F6,{checked:(D==null?void 0:D.useWorktrees)??!0,onChange:J=>{D&&g(D.id,{useWorktrees:J}).catch(()=>{})},label:"Enable worktree isolation","data-testid":"worktree-toggle"})})]}),r.jsxs("div",{className:P.metaRow,children:[r.jsx("span",{className:P.metaLabel,children:"Working Dir"}),r.jsx("div",{className:P.metaValue,children:r.jsx(Xt,{value:(D==null?void 0:D.workingDirectory)||"",onSave:J=>{D&&g(D.id,{workingDirectory:J}).catch(()=>{})},fieldId:"workingDirectory",activeFieldId:T,onActivate:C,placeholder:"Default (server default)",ariaLabel:"Working directory","data-testid":"edit-working-directory"})})]}),D&&r.jsxs("div",{className:P.metaTimestamps,children:[r.jsxs("span",{className:P.metaTimestamp,children:["Created ",zb(D.createdAt)]}),D.updatedAt&&D.updatedAt!==D.createdAt&&r.jsxs("span",{className:P.metaTimestamp,children:["· Updated ",zb(D.updatedAt)]})]})]}),le>0&&r.jsxs("div",{className:P.progressBarContainer,"data-testid":"progress-bar",children:[r.jsx("div",{className:P.progressBar,children:r.jsx("div",{className:P.progressFill,style:{width:`${se}%`}})}),r.jsxs("span",{className:P.progressLabel,children:[te,"/",le]})]}),Y&&Y.costUsd>0&&r.jsx("div",{className:P.progressBarContainer,children:r.jsxs("span",{className:P.progressLabel,children:["Usage: ",So(Y.costUsd)," (",Y.sessionCount," session",Y.sessionCount!==1?"s":"",")"]})}),r.jsxs("div",{className:P.tabBar,role:"tablist","aria-label":"Workspace view",children:[r.jsx("button",{role:"tab","aria-selected":k==="graph",className:`${P.tab} ${k==="graph"?P.active:""}`,onClick:()=>S("graph"),children:"Graph"}),r.jsx("button",{role:"tab","aria-selected":k==="board",className:`${P.tab} ${k==="board"?P.active:""}`,onClick:()=>S("board"),"data-testid":"board-tab",children:"Board"}),r.jsx("button",{role:"tab","aria-selected":k==="tasks",className:`${P.tab} ${k==="tasks"?P.active:""}`,onClick:()=>S("tasks"),children:"Tasks"})]}),k==="tasks"&&le>0&&r.jsxs("div",{className:P.workspaceSummary,children:[r.jsx("span",{className:P.workspaceSummaryTitle,children:`${te}/${le} tasks complete`}),r.jsx("span",{className:P.workspaceSummarySubtitle,children:"Select a task or click + to create one"})]}),k==="tasks"&&le===0&&r.jsxs("div",{className:P.emptyCta,children:[r.jsx("button",{className:P.ctaButton,onClick:()=>i(ki(t,void 0,B)),children:"Create Task"}),r.jsx("div",{className:P.ctaDescription,children:"Break your work into tasks and let agents tackle them"})]}),k==="board"&&r.jsx(xB,{workspaceId:t,environmentId:B,tasks:o,sessions:p,personas:d,environments:c}),k==="graph"&&r.jsx(JN,{workspaceId:t,environmentId:B,tasks:o,resolvedThemeId:b}),r.jsx(bi,{isOpen:N,title:"Archive Workspace?",description:"This will hide the workspace from the sidebar. Tasks will not be deleted.",confirmLabel:"Archive",onConfirm:()=>{D&&(h(D.id).catch(()=>{}),i("/",{replace:!0})),j(!1)},onCancel:()=>j(!1)})]})}const DU="_container_3pgew_1",RU="_header_3pgew_8",MU="_headerTitle_3pgew_35",IU="_headerActions_3pgew_44",OU="_body_3pgew_51",LU="_btnPrimary_3pgew_63",BU="_btnGhost_3pgew_94",zU="_error_3pgew_116",Ea={container:DU,header:RU,headerTitle:MU,headerActions:IU,body:OU,btnPrimary:LU,btnGhost:BU,error:zU};function UU(t){const s={};return t.name.trim()||(s.name="Name is required"),t.repoUrl.trim()&&!/^https?:\/\/.+/i.test(t.repoUrl.trim())&&(s.repoUrl="Must be a valid http(s) URL"),t.environmentId||(s.environmentId="Environment is required"),Object.keys(s).length>0?s:void 0}const $U=[{label:"Home",url:yi},{label:"New Workspace",url:void 0}];function PU(){const[t]=tm(),s=t.get("environment")??void 0,{environments:i,personas:o,createWorkspace:c,workspaceCreating:u}=ct(),{showToast:d}=gn(),p=bt(),[h,g]=_.useState(()=>{var j;return RB(void 0,s||((j=i[0])==null?void 0:j.id))}),[v,y]=_.useState(),[b,k]=_.useState();_.useEffect(()=>{s||h.environmentId||i.length===0||g(j=>{var T;return j.environmentId?j:{...j,environmentId:((T=i[0])==null?void 0:T.id)??""}})},[i,s,h.environmentId]);const S=()=>{const j=UU(h);if(j){y(j),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(()=>{})},N=()=>{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:$U})}),r.jsxs("div",{className:Ea.headerActions,children:[r.jsx("button",{className:Ea.btnGhost,onClick:N,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(tx,{size:"sm",label:"Creating"}):"Create Workspace"})]})]}),r.jsxs("div",{className:Ea.body,children:[r.jsx(IB,{values:h,onChange:j=>{g(j),y(void 0),k(void 0)},environments:i,personas:o,errors:v,disabled:u,autoFocusName:!0}),b&&r.jsx("div",{className:Ea.error,"data-testid":"workspace-create-submit-error",children:b})]})]})}function Ub(){const{workspaceId:t,environmentId:s}=ls(),[i]=tm(),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(mx,{mode:"new",workspaceId:o,parentTaskId:c,environmentId:s,tasks:u,workspaces:d,personas:p,onCreateTask:(y,b,k,S,N,j,T,C,E)=>{h(y,b,k,S,N,j,T,C,E).catch(()=>{})},onUpdateTask:(y,b,k,S,N)=>{g(y,b,k,S,N).catch(()=>{})},onShowToast:v})}function Oc(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 hp(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 $b(t){const s=t.toLowerCase();return s==="ready"||s==="running"||s==="available"||s==="connected"?P.envDotGreen:s==="provisioning"||s==="starting"||s==="pending"||s==="connecting"?P.envDotYellow:s==="error"||s==="failed"||s==="disconnected"?P.envDotRed:P.envDotGray}function VU({status:t}){const s=Ma(t),i=V2(t);return r.jsx("span",{className:`${P.statusBadge} ${P[i]??P.statusPending}`,children:s.label})}function HU({task:t,tasksById:s,environments:i,workspaces:o,taskSessions:c,selectedEnvId:u}){const{loadUsage:d,usageCache:p}=ct(),h=c.reduce((E,A)=>E+(A.costUsd??0),0);_.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}`,b=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)??"",N=S?i.find(E=>E.id===S):void 0,j=o.find(E=>E.id===t.workspaceId),T=i.find(E=>E.id===u),C=t.branch&&(j!=null&&j.repoUrl)?`${j.repoUrl.replace(/\/$/,"")}/tree/${encodeURIComponent(t.branch)}`:void 0;return r.jsxs("div",{className:P.overviewDashboard,children:[r.jsxs("div",{className:P.overviewHero,children:[r.jsx(VU,{status:t.status}),t.branch&&r.jsx("span",{className:P.overviewBranchPill,children:C?r.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:P.branchLink,children:["🔗"," ",t.branch]}):r.jsxs("span",{children:["🔗"," ",t.branch]})})]}),typeof t.description=="string"&&t.description&&r.jsxs("div",{className:P.overviewSection,children:[r.jsx("div",{className:P.overviewLabel,children:"Description"}),r.jsx("div",{className:P.overviewMarkdown,children:r.jsx(nu,{remarkPlugins:[su],children:t.description})})]}),t.workpad&&r.jsx(pL,{workpad:t.workpad}),r.jsxs("div",{className:P.overviewSection,children:[r.jsx("div",{className:P.overviewLabel,children:"Environment"}),S&&N?r.jsxs("div",{className:P.envRow,"data-testid":"task-overview-environment",children:[r.jsx("span",{className:`${P.envDot} ${$b(N.status)}`,title:N.status,"aria-label":`Status: ${N.status}`,role:"img"}),r.jsx("span",{className:P.overviewValue,children:N.displayName})]}):T?r.jsxs("div",{className:P.envRow,"data-testid":"task-overview-environment",children:[r.jsx("span",{className:`${P.envDot} ${$b(T.status)}`,title:T.status,"aria-label":`Status: ${T.status}`,role:"img"}),r.jsx("span",{className:P.overviewValue,children:T.displayName}),r.jsx("span",{className:P.overviewMuted,children:"(workspace default)"})]}):r.jsx("div",{className:P.overviewMuted,children:"Set in workspace settings"})]}),r.jsxs("div",{className:P.overviewSection,"data-testid":"task-overview-dependencies",children:[r.jsx("div",{className:P.overviewLabel,children:"Dependencies"}),t.dependsOn.length===0?r.jsx("div",{className:P.overviewMuted,children:"None"}):r.jsx("div",{className:P.depList,children:t.dependsOn.map(E=>{const A=s.get(E),I=(A==null?void 0:A.status)==="complete";return r.jsxs("div",{className:`${P.depItem} ${I?P.depDone:P.depBlocked}`,children:[r.jsx("span",{children:I?"✓":"○"}),r.jsx("span",{children:(A==null?void 0:A.title)??E})]},E)})})]}),r.jsxs("div",{className:P.overviewSection,children:[r.jsx("div",{className:P.overviewLabel,children:"Timeline"}),r.jsxs("div",{className:P.timeline,children:[t.createdAt&&r.jsxs("div",{className:P.timelineRow,children:[r.jsx("span",{className:P.timelineKey,children:"Created"}),r.jsx("span",{className:P.timelineValue,children:Oc(t.createdAt)})]}),t.assignedAt&&(()=>{const E=hp(t.createdAt,t.assignedAt);return r.jsxs("div",{className:P.timelineRow,children:[r.jsx("span",{className:P.timelineKey,children:"Assigned"}),r.jsx("span",{className:P.timelineValue,children:Oc(t.assignedAt)}),E!==void 0&&r.jsx("span",{className:P.timelineDelta,children:E})]})})(),t.startedAt&&(()=>{const E=hp(t.assignedAt??t.createdAt,t.startedAt);return r.jsxs("div",{className:P.timelineRow,children:[r.jsx("span",{className:P.timelineKey,children:"Started"}),r.jsx("span",{className:P.timelineValue,children:Oc(t.startedAt)}),E!==void 0&&r.jsx("span",{className:P.timelineDelta,children:E})]})})(),t.completedAt&&(()=>{const E=hp(t.startedAt,t.completedAt);return r.jsxs("div",{className:P.timelineRow,children:[r.jsx("span",{className:P.timelineKey,children:"Completed"}),r.jsx("span",{className:P.timelineValue,children:Oc(t.completedAt)}),E!==void 0&&r.jsx("span",{className:P.timelineDelta,children:E})]})})(),!t.createdAt&&!t.assignedAt&&!t.startedAt&&!t.completedAt&&r.jsx("div",{className:P.overviewMuted,children:"No timing data"})]})]}),v&&v.costUsd>0&&r.jsxs("div",{className:P.overviewSection,children:[r.jsx("div",{className:P.overviewLabel,children:"Usage"}),r.jsxs("div",{className:P.timeline,children:[r.jsxs("div",{className:P.timelineRow,children:[r.jsx("span",{className:P.timelineKey,children:"Cost"}),r.jsx("span",{className:P.timelineValue,children:So(v.costUsd)}),r.jsxs("span",{className:P.timelineDelta,children:[v.sessionCount," session",v.sessionCount!==1?"s":""]})]}),b&&b.costUsd>v.costUsd&&r.jsxs("div",{className:P.timelineRow,children:[r.jsx("span",{className:P.timelineKey,children:"Total (incl. subtasks)"}),r.jsx("span",{className:P.timelineValue,children:So(b.costUsd)}),r.jsxs("span",{className:P.timelineDelta,children:[b.sessionCount," session",b.sessionCount!==1?"s":""]})]})]})]}),t.reviewNotes&&r.jsxs("div",{className:P.overviewSection,children:[r.jsx("div",{className:P.overviewLabel,children:"Review Notes"}),r.jsx("div",{className:P.reviewNotes,children:t.reviewNotes})]})]})}function qU({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:P.headerActions,children:[r.jsx("button",{onClick:h,className:P.btnGhost,children:"Edit"}),r.jsx("button",{onClick:p,className:P.btnDanger,children:"Delete"})]}):r.jsxs("div",{className:P.headerActions,children:[r.jsx("button",{"data-testid":"task-header-start",onClick:o,className:P.btnPrimary,children:"Start"}),r.jsx("button",{onClick:h,className:P.btnGhost,children:"Edit"}),r.jsx("button",{onClick:p,className:P.btnDanger,children:"Delete"})]});if(t.status==="working")return r.jsxs("div",{className:P.headerActions,children:[r.jsx("button",{onClick:u,className:P.btnDanger,children:"Stop"}),r.jsx("button",{onClick:d,disabled:!s,className:P.btnGhost,children:"Pause"})]});if(t.status==="paused")return r.jsxs("div",{className:P.headerActions,children:[r.jsx("button",{onClick:u,className:P.btnPrimary,children:"Stop"}),r.jsx("button",{onClick:c,className:P.btnGhost,children:"Resume"}),r.jsx("button",{onClick:p,className:P.btnDanger,children:"Delete"})]});if(t.status==="complete")return r.jsx("div",{className:P.headerActions,children:r.jsx("button",{onClick:p,className:P.btnDanger,children:"Delete"})});if(t.status==="failed")return r.jsxs("div",{className:P.headerActions,children:[r.jsx("button",{onClick:o,className:P.btnPrimary,children:"Retry"}),r.jsx("button",{onClick:p,className:P.btnDanger,children:"Delete"})]})}function GU({taskSessions:t,selectedSessionId:s,onSelect:i}){if(!(t.length<2))return r.jsxs("div",{className:P.attemptSelector,"data-testid":"attempt-selector",children:[r.jsx("span",{className:P.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:`${P.attemptButton} ${u?P.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:P.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:b,loadFindings:k,kill:S,startTask:N,stopTask:j,resumeTask:T,deleteTask:C,createTask:E,updateTask:A,workspaces:I,taskSessions:D,loadTaskSessions:B,sendInput:z,spawn:X,personas:Y,provisionEnvironment:F}=ct(),te=_.useRef(void 0),le=_.useRef(void 0),se=_.useRef(void 0),J=_.useRef(void 0),L=_.useRef(void 0),Z=o.pathname.endsWith("/stream")?"stream":o.pathname.endsWith("/findings")?"findings":"overview",ae=o.pathname.endsWith("/edit"),[re,de]=_.useState(Z),[Ke,je]=_.useState(!1),[Te,Ie]=_.useState(void 0),[ce,ve]=_.useState(""),[fe,Oe]=_.useState(ae),_t=_.useRef(Z),vn=_.useRef(ae),U=h.find(Ne=>Ne.id===t),Me=(U==null?void 0:U.workspaceId)||void 0,et=I.find(Ne=>Ne.id===Me);_.useEffect(()=>{Z!==_t.current&&(_t.current=Z,Z!==re&&de(Z))},[Z,re]),_.useEffect(()=>{ae!==vn.current&&(vn.current=ae,ae!==fe&&Oe(ae))},[ae,fe]),_.useEffect(()=>{if(ce===""){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)}}},[ce,et==null?void 0:et.environmentId,v]);const tt=U?D[U.id]??[]:[];let qe;Te&&tt.some(Ne=>Ne.id===Te)?qe=Te:qe=(U==null?void 0:U.latestSessionId)||void 0;const cs=()=>{je(!0)},ea=()=>{if(!U)return;C(U.id).catch(()=>{}),je(!1);const Ne=i??(et==null?void 0:et.environmentId);c(U.workspaceId&&Ne?gi(U.workspaceId,Ne):"/",{replace:!0})};_.useEffect(()=>{(U==null?void 0:U.id)!==le.current&&(le.current=U==null?void 0:U.id,Ie(void 0),ve(""),Oe(ae))},[U==null?void 0:U.id,ae]),_.useEffect(()=>{if(!(U!=null&&U.id))return;const Ne=U.id!==J.current,Ce=U.latestSessionId!==L.current;(Ne||Ce)&&(J.current=U.id,L.current=U.latestSessionId,B(U.id).catch(()=>{}))},[U==null?void 0:U.id,U==null?void 0:U.latestSessionId,B]),_.useEffect(()=>{if((U==null?void 0:U.status)!==se.current){const Ne=se.current===void 0;se.current=U==null?void 0:U.status;const Ce=(U==null?void 0:U.status)==="not_started"?"overview":(U==null?void 0:U.status)==="working"||(U==null?void 0:U.status)==="paused"?"stream":(U==null?void 0:U.status)==="complete"?"findings":void 0;Ce&&Ce!==re&&!(Ne&&Z!=="overview")&&de(Ce)}},[U==null?void 0:U.status,re,Z]);const An=_.useMemo(()=>new Map(h.map(Ne=>[Ne.id,Ne])),[h]),Zn=_.useMemo(()=>{const Ne=qe?d.filter(Ce=>Ce.sessionId===qe):[];return qm(Hm(Ne))},[d,qe]),us=U?U.dependsOn.some(Ne=>{const Ce=An.get(Ne);return Ce!==void 0&&Ce.status!=="complete"}):!1,ta=_.useMemo(()=>QB(t,i,I,v,An),[t,i,I,v,An]);_.useEffect(()=>{qe&&qe!==te.current&&(te.current=qe,b(qe).catch(()=>{}))},[qe,b]),_.useEffect(()=>{re==="findings"&&Me&&k(Me).catch(()=>{})},[re,Me,k]);const Kn=Ne=>{de(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:P.panelContainer,children:[r.jsx(xs,{segments:ta}),r.jsxs("div",{className:P.header,children:[r.jsxs("span",{className:P.headerTitle,children:[r.jsx("span",{"data-testid":"task-title",children:(U==null?void 0:U.title)||t}),U&&r.jsx("span",{className:P.taskStatusBadge,"data-testid":"task-status",children:U.status}),(U==null?void 0:U.branch)&&r.jsx("span",{className:P.taskBranch,children:U.branch}),us&&r.jsx("span",{className:P.taskBlockedBadge,children:"blocked"})]}),U&&r.jsx(qU,{task:U,sessionId:qe,isBlocked:us,onStart:()=>{N(U.id,void 0,ce).catch(()=>{})},onResume:()=>{T(U.id).catch(()=>{})},onStop:()=>{j(U.id).catch(()=>{})},onPause:()=>{qe&&S(qe).catch(()=>{})},onDelete:cs,onEdit:()=>Oe(!0)})]}),r.jsxs("div",{className:P.tabBar,role:"tablist","aria-label":"Task view",children:[r.jsx("button",{role:"tab","aria-selected":re==="overview",className:`${P.tab} ${re==="overview"?P.active:""}`,onClick:()=>Kn("overview"),children:"Overview"}),r.jsx("button",{role:"tab","aria-selected":re==="stream",className:`${P.tab} ${re==="stream"?P.active:""}`,onClick:()=>Kn("stream"),children:"Stream"}),r.jsx("button",{role:"tab","aria-selected":re==="findings",className:`${P.tab} ${re==="findings"?P.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:P.overviewContent,"data-testid":"task-overview",children:fe&&U?r.jsx(mx,{mode:"edit",taskId:U.id,workspaceId:Me,environmentId:i,tasks:h,workspaces:I,personas:Y,onCreateTask:(Ne,Ce,cn,yn,ks,ds,wi,Ua,Ni)=>{E(Ne,Ce,cn,yn,ks,ds,wi,Ua,Ni).catch(()=>{})},onUpdateTask:(Ne,Ce,cn,yn,ks)=>{A(Ne,Ce,cn,yn,ks).catch(()=>{})},onEditDone:()=>{ae?c(rs(U.id,void 0,s,i),{replace:!0}):Oe(!1)},onShowToast:u}):U?r.jsx(HU,{task:U,tasksById:An,environments:v,workspaces:I,taskSessions:tt,selectedEnvId:ce}):r.jsx("div",{className:P.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(GU,{taskSessions:tt,selectedSessionId:qe,onSelect:Ne=>Ie(Ne)}),r.jsx(zm,{events:Zn,eventsDropped:p,emptyState:!qe&&U?us?r.jsx("div",{className:P.emptyCta,"data-testid":"stream-blocked-message",children:r.jsx("div",{className:P.ctaDescription,children:"This task is blocked by incomplete dependencies"})}):r.jsxs("div",{className:P.emptyCta,children:[r.jsx("button",{"data-testid":"stream-start-cta",className:P.ctaButton,onClick:()=>{N(U.id,void 0,ce).catch(()=>{})},children:"Start Task"}),r.jsx("div",{className:P.ctaDescription,children:"Click to begin agent execution"})]}):qe&&Zn.length===0?r.jsx("div",{className:P.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:P.tabContent,children:Me?r.jsx(fx,{findings:y.filter(Ne=>Ne.workspaceId===Me)}):r.jsx("div",{className:P.noContext,children:"Navigate to a task within a workspace to view findings"})},"findings")]}),(()=>{if(!U||U.status!=="working"&&U.status!=="paused")return;const Ne=qe?g.find(Ce=>Ce.id===qe):void 0;if(!(!Ne||Ne.status==="stopped"))return r.jsx($r,{mode:"send",sessionId:Ne.id,environmentId:Ne.environmentId,personas:Y,environments:v,onSendInput:(Ce,cn)=>{z(Ce,cn).catch(()=>{})},onSpawn:(Ce,cn,yn)=>{X(Ce,cn,yn).catch(()=>{})},onStartTask:(Ce,cn,yn)=>{N(Ce,cn,yn).catch(()=>{})},onProvisionEnvironment:Ce=>{F(Ce).catch(()=>{})},onShowToast:u})})(),U&&r.jsx(bi,{isOpen:Ke,title:"Delete Task?",description:`"${U.title}" will be permanently removed.`,onConfirm:ea,onCancel:()=>je(!1)})]})}function FU(){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(hx,{mode:"new",environments:t,onAddEnvironment:(v,y,b)=>{s(v,y,b).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 ZU(){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(hx,{mode:"edit",environmentId:t,environments:s,onAddEnvironment:(y,b,k)=>{i(y,b,k).catch(()=>{})},onUpdateEnvironment:(y,b)=>{o(y,b).catch(()=>{})},onListCodespaces:()=>{c().catch(()=>{})},codespaces:u,codespaceError:d,codespaceListError:p,codespaceCreating:h,onCreateCodespace:(y,b)=>{g(y,b).catch(()=>{})},onShowToast:v})}const KU="_layout_11u79_1",YU="_content_11u79_8",JU="_tabPanel_11u79_14",Ur={layout:KU,content:YU,tabPanel:JU};function WU(){const t=YB();return r.jsxs("div",{className:Ur.layout,children:[r.jsx(xs,{segments:t}),r.jsx("div",{className:Ur.content,children:r.jsx(Ba,{})})]})}const XU="_container_13sb6_1",QU="_envHeader_13sb6_6",e$="_envTitleRow_13sb6_10",t$="_statusDot_13sb6_16",n$="_envName_13sb6_21",s$="_statusBadge_13sb6_27",a$="_envMeta_13sb6_33",i$="_metaTag_13sb6_39",o$="_actions_13sb6_51",r$="_provisionMessage_13sb6_59",l$="_errorMessage_13sb6_64",c$="_section_13sb6_69",u$="_sectionHeader_13sb6_73",d$="_cardList_13sb6_121",f$="_card_13sb6_121",p$="_cardHeader_13sb6_138",m$="_cardName_13sb6_144",h$="_cardActions_13sb6_149",g$="_cardDescription_13sb6_154",v$="_cardMeta_13sb6_160",y$="_repoLink_13sb6_166",b$="_empty_13sb6_174",_$="_btnPrimary_13sb6_180",x$="_btnOutline_13sb6_214",k$="_btnSmall_13sb6_241",S$="_btnDanger_13sb6_267",Ve={container:XU,envHeader:QU,envTitleRow:e$,statusDot:t$,envName:n$,statusBadge:s$,envMeta:a$,metaTag:i$,actions:o$,provisionMessage:r$,errorMessage:l$,section:c$,sectionHeader:u$,cardList:d$,card:f$,cardHeader:p$,cardName:m$,cardActions:h$,cardDescription:g$,cardMeta:v$,repoLink:y$,empty:b$,btnPrimary:_$,btnOutline:x$,btnSmall:k$,btnDanger:S$},T$={connected:"var(--accent-green)",sleeping:"var(--accent-yellow)",error:"var(--accent-red)",disconnected:"var(--text-tertiary)",connecting:"var(--accent-blue)"};function w$(){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]=_.useState(!1),[b,k]=_.useState(!1),[S,N]=_.useState(void 0),j=i.find(te=>te.id===t);if(!t||!j)return r.jsx(is,{to:ko,replace:!0});const T=o.filter(te=>te.environmentId===j.id),C=c.filter(te=>te.environmentId===j.id),E=C.reduce((te,le)=>te+(le.costUsd??0),0),A=T$[j.status]||"var(--text-tertiary)",I=j.status==="connected",D=j.status==="connecting",B=j.status==="disconnected"||j.status==="error"||j.status==="sleeping",z=j.id in u?u[j.id]:void 0,X=()=>{h(j.id).catch(()=>{}),y(!1),s(ko,{replace:!0})},Y=()=>{k(!1),d(j.id,!0).catch(()=>{})},F=te=>{g(te).catch(()=>{}),N(void 0)};return r.jsxs("div",{className:Ve.container,children:[r.jsx(bi,{isOpen:v,title:"Delete Environment?",description:`"${j.displayName||j.id}" will be permanently removed along with all its data.`,onConfirm:X,onCancel:()=>y(!1)}),r.jsx(bi,{isOpen:b,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:Y,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:A},children:"●"}),r.jsx("h2",{className:Ve.envName,children:j.displayName||j.id}),r.jsx("span",{className:Ve.statusBadge,style:{color:A},children:j.status})]}),r.jsxs("div",{className:Ve.envMeta,children:[r.jsxs("span",{className:Ve.metaTag,children:["Adapter: ",j.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: ",So(E)]})]})]}),r.jsxs("div",{className:Ve.actions,children:[I&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:Ve.btnPrimary,onClick:()=>s(__(j.id)),children:"New Chat"}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>{p(j.id).catch(()=>{})},children:"Stop"}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>k(!0),disabled:z!==void 0,"data-testid":"env-reprovision-btn",children:"Reprovision"})]}),B&&r.jsx("button",{className:Ve.btnPrimary,onClick:()=>{d(j.id).catch(()=>{})},children:j.status==="error"?"Retry":j.status==="sleeping"?"Wake":"Connect"}),D&&z!==void 0&&r.jsx("span",{className:Ve.provisionMessage,children:z.message}),j.status==="error"&&(z==null?void 0:z.stage)==="error"&&r.jsx("span",{className:Ve.errorMessage,children:z.message}),r.jsx("button",{className:Ve.btnOutline,onClick:()=>s($N(j.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(`${k_}?environment=${encodeURIComponent(j.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(te=>r.jsx(N$,{workspace:te,confirmArchiveId:S,onOpen:()=>s(gi(te.id,j.id)),onArchive:()=>N(te.id),onConfirmArchive:()=>F(te.id),onCancelArchive:()=>N(void 0)},te.id))})]})]})}function N$({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 j$={credentials:"Credentials",personas:"Personas",appearance:"Appearance",about:"About",shortcuts:"Shortcuts"};function C$(){const s=Pt().pathname.replace(/^\/settings\/?/,"").split("/")[0],i=j$[s],o=KB(i);return r.jsxs("div",{className:Ur.layout,children:[r.jsx(xs,{segments:o}),r.jsx("div",{className:Ur.content,children:r.jsx("div",{className:Ur.tabPanel,children:r.jsx(Ba,{})},s)})]})}function E$(){const{tokens:t,setToken:s,deleteToken:i,credentialProviders:o,updateCredentialProviders:c}=ct(),{showToast:u}=gn();return r.jsxs(r.Fragment,{children:[r.jsx(hL,{credentialProviders:o,onUpdateCredentialProviders:d=>{c(d).catch(()=>{})}}),r.jsx(c5,{tokens:t,onSetToken:(d,p,h,g,v)=>{s(d,p,h,g,v).catch(()=>{})},onDeleteToken:d=>{i(d).catch(()=>{})},onShowToast:u})]})}function A$(){const{personas:t,deletePersona:s,appDefaultPersonaId:i,setAppDefaultPersonaId:o}=ct(),{showToast:c}=gn(),u=bt();return r.jsx(CL,{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(VN),onNavigateToPersona:d=>u(x_(d))})}const D$="_container_1ooin_1",R$="_form_1ooin_7",M$="_formActions_1ooin_75",I$="_editableSection_1ooin_82",O$="_defaultBadge_1ooin_93",L$="_typeToggle_1ooin_107",B$="_scriptEditor_1ooin_121",z$="_optional_1ooin_128",ss={container:D$,form:R$,formActions:M$,editableSection:I$,defaultBadge:O$,typeToggle:L$,scriptEditor:B$,optional:z$},Pb=[{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)"}],Vb=[{value:"genaiscript",label:"genaiscript"}],U$="0";function Hb(){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(b=>b.id===t);if(!g&&o.length>0&&!v)return r.jsx(is,{to:Rf,replace:!0});const y=[{label:"Settings",url:xo},{label:"Personas",url:Rf},{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($$,{existing:v,isNew:g,appDefaultPersonaId:p,onCreatePersona:c,onUpdatePersona:u,onDeletePersona:d,onSetAppDefaultPersonaId:h,onDone:()=>{s(Rf)},showToast:i})]})}function $$({existing:t,isNew:s,appDefaultPersonaId:i,onCreatePersona:o,onUpdatePersona:c,onDeletePersona:u,onSetAppDefaultPersonaId:d,onDone:p,showToast:h}){const g=bt(),[v,y]=_.useState((t==null?void 0:t.name)??""),[b,k]=_.useState((t==null?void 0:t.description)??""),[S,N]=_.useState((t==null?void 0:t.systemPrompt)??""),[j,T]=_.useState((t==null?void 0:t.runtime)??"claude-code"),[C,E]=_.useState((t==null?void 0:t.model)??"sonnet"),[A,I]=_.useState((t==null?void 0:t.maxTurns)??0),[D,B]=_.useState((t==null?void 0:t.type)==="script"?"script":"agent"),[z,X]=_.useState((t==null?void 0:t.script)??""),[Y,F]=_.useState((t==null?void 0:t.allowedMcpTools)??[]),[te,le]=_.useState(!1),[se,J]=_.useState(null),[L,Z]=_.useState(!!s);_.useEffect(()=>{if(!s&&t&&!L){Z(!0),y(t.name),k(t.description),N(t.systemPrompt);const U=t.type==="script"?"script":"agent";T(U==="script"?t.runtime||"genaiscript":t.runtime),E(t.model),I(t.maxTurns),B(U),X(t.script||""),F(t.allowedMcpTools)}},[s,t,L]);const ae=U=>{B(U),U==="script"?T("genaiscript"):j==="genaiscript"&&T("claude-code")},re=!s&&t===void 0,de=v.trim().length>0&&!re&&S.trim().length>0&&(D==="script"?z.trim().length>0:!!j&&!!C),Ke=s&&de,je=!s&&i===(t==null?void 0:t.id),Te=!s&&t&&!je&&D==="agent"&&!!j&&!!C,Ie=(U,Me)=>{if(!U.trim())return`${Me} is required`},ce=U=>{if(U.preventDefault(),!(re||!de)){if(t){c(t.id,v,b,S,j,C,A,D,z).then(()=>{h("Persona updated","success"),p()},()=>{h("Failed to save persona","error")});return}o(v,b,S,j,C,A,D,z,Y).then(Me=>{h("Persona created","success"),g(x_(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")})},fe=async(U,Me,et,tt)=>U().then(()=>{Me(),h(et,"success")},()=>{h(tt,"error")}),Oe=(U,Me)=>{if(!t)return;const et=U==="type"?String(Me):D,tt=U==="runtime"?String(Me):U==="type"?String(Me)==="script"?"genaiscript":j==="genaiscript"?"claude-code":j:j,qe=U==="model"?String(Me):C,cs=U==="maxTurns"?Number(Me):A,ea=U==="systemPrompt"?String(Me):S,An=U==="script"?String(Me):z;fe(()=>c(t.id,U==="name"?String(Me):v,U==="description"?String(Me):b,ea,tt,qe,cs,et,An),()=>{if(U==="type"){const Zn=String(Me)==="script"?"script":"agent";B(Zn),T(tt)}U==="runtime"&&T(String(Me)),U==="name"&&y(String(Me)),U==="description"&&k(String(Me)),U==="systemPrompt"&&N(String(Me)),U==="model"&&E(String(Me)),U==="maxTurns"&&I(Number(Me)),U==="script"&&X(String(Me))},"Persona updated","Failed to update persona").catch(()=>{})},_t=U=>{ce(U)},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:D==="agent",onChange:()=>ae("agent")}),"Agent"]}),r.jsxs("label",{children:[r.jsx("input",{type:"radio",name:"personaType",value:"script",checked:D==="script",onChange:()=>ae("script")}),"Script"]})]}),r.jsxs("label",{children:["Name",r.jsx("input",{type:"text",value:v,onChange:U=>y(U.target.value),placeholder:D==="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:b,onChange:U=>k(U.target.value),placeholder:"Brief description...","data-testid":"persona-detail-description"})]}),r.jsxs("label",{children:["Runtime",r.jsx("select",{value:j,onChange:U=>T(U.target.value),"data-testid":"persona-runtime-select",children:(D==="script"?Vb:Pb).map(U=>r.jsx("option",{value:U.value,children:U.label},U.value))})]}),D==="agent"&&r.jsxs(r.Fragment,{children:[r.jsxs("label",{children:["Model",r.jsx("input",{type:"text",value:C,onChange:U=>E(U.target.value),placeholder:"e.g. sonnet","data-testid":"persona-detail-model"})]}),r.jsxs("label",{children:["Max Turns",r.jsx("input",{type:"number",value:A,onChange:U=>I(parseInt(U.target.value,10)||0),min:0,"data-testid":"persona-detail-max-turns"})]}),r.jsxs("label",{children:["System Prompt",r.jsx("textarea",{value:S,onChange:U=>N(U.target.value),placeholder:"You are a senior frontend engineer...",rows:10,required:!0,"data-testid":"persona-detail-prompt"})]})]}),D==="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:U=>E(U.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:U=>N(U.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:z,onChange:U=>X(U.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"})]})]}),D==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(Ab,{selectedTools:Y,onChange:F})]}),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:()=>le(!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:U=>{Oe("name",U)},validate:U=>Ie(U,"Name"),fieldId:"persona-name",activeFieldId:se,onActivate:J,ariaLabel:"Persona name","data-testid":"persona-detail-name"})]}),r.jsxs("label",{children:["Description",r.jsx(Xt,{value:b,onSave:U=>{Oe("description",U)},fieldId:"persona-description",activeFieldId:se,onActivate:J,placeholder:"Brief description...",ariaLabel:"Persona description","data-testid":"persona-detail-description"})]}),r.jsxs("label",{children:["Type",r.jsx(Qc,{value:D,onSave:U=>{Oe("type",U)},options:[{value:"agent",label:"Agent"},{value:"script",label:"Script"}],fieldId:"persona-type",activeFieldId:se,onActivate:J,ariaLabel:"Persona type","data-testid":"persona-type-toggle"})]}),r.jsxs("label",{children:["Runtime",r.jsx(Qc,{value:j,onSave:U=>{Oe("runtime",U)},options:D==="script"?Vb:Pb,fieldId:"persona-runtime",activeFieldId:se,onActivate:J,ariaLabel:"Persona runtime","data-testid":"persona-runtime"})]}),r.jsxs("label",{children:["Model",D==="script"?" (optional)":"",r.jsx(Xt,{value:C,onSave:U=>{Oe("model",U)},validate:D==="agent"?U=>Ie(U,"Model"):void 0,fieldId:"persona-model",activeFieldId:se,onActivate:J,placeholder:D==="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(A),onSave:U=>{Oe("maxTurns",parseInt(U,10)||0)},validate:U=>/^\d+$/.test(U.trim())?void 0:"Max Turns must be a non-negative integer",fieldId:"persona-max-turns",activeFieldId:se,onActivate:J,placeholder:U$,ariaLabel:"Persona max turns","data-testid":"persona-detail-max-turns"})]}),r.jsxs("label",{children:["System Prompt",r.jsx(Up,{value:S,onSave:U=>{Oe("systemPrompt",U)},validate:U=>Ie(U,"System Prompt"),fieldId:"persona-system-prompt",activeFieldId:se,onActivate:J,placeholder:D==="script"?"Context for the script...":"You are a senior frontend engineer...",ariaLabel:"Persona system prompt","data-testid":"persona-detail-prompt"})]}),D==="script"&&r.jsxs("label",{children:["Script",r.jsx(Up,{value:z,onSave:U=>{Oe("script",U)},validate:U=>Ie(U,"Script"),fieldId:"persona-script",activeFieldId:se,onActivate:J,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"})]}),D==="agent"&&r.jsxs("div",{children:[r.jsx("label",{children:"Allowed MCP Tools"}),r.jsx(Ab,{selectedTools:Y,onChange:U=>{F(U),fe(()=>c(t.id,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,U),()=>{},"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:te,title:"Delete Persona?",description:`"${t==null?void 0:t.name}" will be permanently removed.`,confirmLabel:"Delete",onConfirm:ve,onCancel:()=>le(!1)})]})}function P$(){const{themeId:t,resolvedThemeId:s,setTheme:i,preferSystem:o,setPreferSystem:c}=xx();return r.jsx(u5,{themeId:t,resolvedThemeId:s,onSetTheme:i,preferSystem:o,onSetPreferSystem:c})}function V$(){const[t,s]=_.useState(void 0);return _.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 H$(){const{connected:t,environments:s,sessions:i}=ct(),o=V$();return r.jsxs(r.Fragment,{children:[o&&r.jsx(mO,{currentVersion:o.currentVersion,latestVersion:o.latestVersion,updateAvailable:o.updateAvailable,isDocker:o.isDocker}),r.jsx(d5,{connected:t,environments:s,sessions:i})]})}function q$(){return r.jsx(rL,{})}const qb=ki();function G$(){const t=bt();return Ys({key:"?"},()=>{t(HN)}),Ys({key:"n"},()=>{t(qb)}),Ys({key:"N"},()=>{t(qb)}),r.jsx(r.Fragment,{})}function sl(t){const s=HB();_.useLayoutEffect(()=>(s(t),()=>{s(void 0)}),[t,s])}function F$(){const{workspaces:t,tasks:s}=ct(),i=_.useMemo(()=>r.jsx(qI,{workspaces:t,tasks:s}),[t,s]);return sl(i),r.jsx(Ba,{})}function Z$(){const{environments:t}=ct(),s=_.useMemo(()=>r.jsx(eI,{environments:t}),[t]);return sl(s),r.jsx(Ba,{})}function K$(){const t=_.useMemo(()=>r.jsx(YL,{}),[]);return sl(t),r.jsx(Ba,{})}function Y$(){const{findings:t,loadFindings:s,loadAllFindings:i}=ct(),{workspaceId:o,environmentId:c}=ls();_.useEffect(()=>{o?s(o).catch(()=>{}):i().catch(()=>{})},[o,s,i]);const u=_.useMemo(()=>r.jsx(dI,{findings:t,workspaceId:o,environmentId:c}),[t,o,c]);return sl(u),r.jsx(Ba,{})}function J$(){const{knowledge:t,workspaces:s}=ct(),i=_.useCallback(p=>{t.search(p).catch(()=>{})},[t]),o=_.useCallback(()=>{t.clearSearch()},[t]),c=_.useCallback(p=>{t.selectNode(p).catch(()=>{})},[t]),u=_.useCallback(p=>{t.loadRecent(p||void 0).catch(()=>{})},[t]),d=_.useMemo(()=>r.jsx(p4,{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 sl(d),r.jsx(Ba,{})}const W$="_container_ce571_1",X$="_title_ce571_6",Gb={container:W$,title:X$};function Fb(){const{environmentId:t,workspaceId:s}=ls(),{findings:i,loadFindings:o,workspaces:c,environments:u}=ct(),d=bt();_.useEffect(()=>{s&&o(s).catch(()=>{})},[s,o]);const p=_.useCallback(g=>{d(xp(g,s,t))},[d,s,t]),h=s&&t?Cx("Findings",s,t,c,u).slice(0,-1):t8();return r.jsxs("div",{className:Gb.container,"data-testid":"findings-list-page",children:[r.jsx(xs,{segments:h}),r.jsx("h1",{className:Gb.title,children:"Findings"}),r.jsx(fx,{findings:i,onFindingClick:p})]})}const Q$="_container_1wwpb_1",e9="_notFound_1wwpb_6",t9="_header_1wwpb_12",n9="_categoryBadge_1wwpb_19",s9="_title_1wwpb_28",a9="_content_1wwpb_35",i9="_tags_1wwpb_77",o9="_tag_1wwpb_77",r9="_meta_1wwpb_92",l9="_metaTimestamp_1wwpb_100",c9="_metaLink_1wwpb_105",rn={container:Q$,notFound:e9,header:t9,categoryBadge:n9,title:s9,content:a9,tags:i9,tag:o9,meta:r9,metaTimestamp:l9,metaLink:c9};function Zb(){const{findingId:t,environmentId:s,workspaceId:i}=ls(),{selectedFinding:o,findingLoading:c,loadFinding:u,workspaces:d,environments:p}=ct(),h=bt();if(_.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=Cx(o.title,i,s,d,p),v=eu(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(nu,{remarkPlugins:[su],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:$m(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(nm(o.sessionId))},children:"View Session"})]})]})}const u9="_wizard_1260s_1",d9="_container_1260s_10",f9="_stepContent_1260s_19",p9="_logoArea_1260s_28",m9="_logoImage_1260s_32",h9="_heading_1260s_41",g9="_tagline_1260s_49",v9="_subtitle_1260s_56",y9="_featureList_1260s_64",b9="_runtimeGrid_1260s_89",_9="_runtimeCard_1260s_101",x9="_runtimeName_1260s_133",k9="_runtimeDescription_1260s_139",S9="_buttonRow_1260s_144",T9="_primaryButton_1260s_151",w9="_ghostButton_1260s_185",N9="_dots_1260s_213",j9="_dot_1260s_213",ft={wizard:u9,container:d9,stepContent:f9,logoArea:p9,logoImage:m9,heading:h9,tagline:g9,subtitle:v9,featureList:y9,runtimeGrid:b9,runtimeCard:_9,runtimeName:x9,runtimeDescription:k9,buttonRow:S9,primaryButton:T9,ghostButton:w9,dots:N9,dot:j9};function C9({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 E9({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 A9=[{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 D9({currentRuntime:t,onFinish:s,onBack:i,finishDisabled:o}){const[c,u]=_.useState(t||"claude-code");return _.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:A9.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 R9=3,Kb={"claude-code":"sonnet",copilot:"gpt-4o",codex:"o3",goose:""};function M9(){const{personas:t,updatePersona:s,completeOnboarding:i,onboardingCompleted:o}=ct(),{showToast:c}=gn(),u=bt(),[d,p]=_.useState(0),[h,g]=_.useState(!1),v=t.find(b=>b.id==="claude-code"),y=_.useCallback(b=>{g(!0);const k=[];if(v&&b!==v.runtime){const N=Kb[b]??"sonnet";k.push(s(v.id,void 0,void 0,void 0,b,N))}const S=t.find(N=>N.id===z0);if(S&&b!==S.runtime){const N=Kb[b]??"sonnet";k.push(s(z0,void 0,void 0,void 0,b,N))}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(C9,{onNext:()=>p(1)}),d===1&&r.jsx(E9,{onNext:()=>p(2),onBack:()=>p(0)}),d===2&&r.jsx(D9,{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:R9},(b,k)=>r.jsx("span",{className:ft.dot,"data-active":k===d},k))})]})})}const I9="_root_zndgp_1",O9="_body_zndgp_7",L9="_main_zndgp_19",B9="_sidebarWrapper_zndgp_26",z9="_overlay_zndgp_51",Mr={root:I9,body:O9,main:L9,sidebarWrapper:B9,overlay:z9},U9=_.lazy(()=>yT(()=>import("./KnowledgePage-CWqrA3AS.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.KnowledgePage}))),Ax=typeof window<"u"&&new URLSearchParams(window.location.search).has("mock");function $9(){const{connected:t,environments:s,sessions:i,tasks:o}=ct(),{toasts:c,dismissToast:u}=gn(),d=Pt(),p=VB(),h=p!==void 0,[g,v]=_.useState(!1),y=_.useCallback(()=>v(b=>!b),[]);return _.useEffect(()=>{v(!1)},[d.pathname]),_.useEffect(()=>{if(!g)return;const b=k=>{k.key==="Escape"&&v(!1)};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[g]),r.jsxs(r.Fragment,{children:[r.jsx(S4,{connected:t,environments:s,sessions:i,onToggleSidebar:h?y:void 0,sidebarOpen:g}),r.jsx(A4,{}),r.jsxs("div",{className:Mr.body,children:[h&&r.jsx("div",{className:Mr.sidebarWrapper,"data-sidebar-open":g,children:r.jsx(L4,{content:p})}),h&&g&&r.jsx("div",{className:Mr.overlay,"data-testid":"drawer-overlay",onClick:()=>v(!1)}),r.jsxs("div",{className:Mr.main,children:[r.jsx(Ba,{}),r.jsx(q4,{sessions:i,tasks:o,environments:s})]})]}),r.jsx(sO,{toasts:c,onDismiss:u}),r.jsx(G$,{})]})}function P9(){const{lastSpawnedId:t,environments:s,tasks:i,connected:o,onboardingCompleted:c,environmentOperationError:u,clearEnvironmentOperationError:d}=ct(),{showToast:p}=gn();P8(s,p),F8(i,p),V8(u,d,p);const h=bt(),g=Pt();return _.useEffect(()=>{t&&!g.pathname.includes("/tasks/")&&h(nm(t),{replace:!0})},[t,h,g.pathname]),o&&c===!1?r.jsx(is,{to:"/setup",replace:!0}):r.jsx(PB,{children:r.jsxs("div",{className:Mr.root,children:[Ax&&r.jsx(bj,{}),r.jsx($9,{})]})})}function gp(){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 V9(){return r.jsxs(aN,{children:[r.jsx(Se,{path:"setup",element:r.jsx(M9,{})}),r.jsxs(Se,{element:r.jsx(P9,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(mU,{})}),r.jsx(Se,{path:"chat",element:r.jsx(SU,{})}),r.jsx(Se,{path:"sessions/new",element:r.jsx(TU,{})}),r.jsx(Se,{path:"sessions/:sessionId",element:r.jsx(jU,{})}),r.jsx(Se,{element:r.jsx(J$,{}),children:r.jsx(Se,{path:"knowledge",element:r.jsx(_.Suspense,{fallback:r.jsx(nx,{}),children:r.jsx(U9,{})})})}),r.jsxs(Se,{element:r.jsx(F$,{}),children:[r.jsx(Se,{path:"tasks",element:r.jsx(fU,{})}),r.jsx(Se,{path:"tasks/new",element:r.jsx(Ub,{})}),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(Y$,{}),children:[r.jsx(Se,{path:"findings",element:r.jsx(Fb,{})}),r.jsx(Se,{path:"findings/:findingId",element:r.jsx(Zb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings",element:r.jsx(Fb,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/findings/:findingId",element:r.jsx(Zb,{})})]}),r.jsxs(Se,{element:r.jsx(Z$,{}),children:[r.jsx(Se,{path:"workspaces",element:r.jsx(is,{to:"/environments",replace:!0})}),r.jsx(Se,{path:"workspaces/new",element:r.jsx(PU,{})}),r.jsx(Se,{path:"workspaces/:workspaceId",element:r.jsx(gp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId",element:r.jsx(gp,{})}),r.jsx(Se,{path:"workspaces/:workspaceId/tasks/:taskId/*",element:r.jsx(gp,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId",element:r.jsx(AU,{})}),r.jsx(Se,{path:"environments/:environmentId/workspaces/:workspaceId/tasks/new",element:r.jsx(Ub,{})}),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(WU,{}),children:[r.jsx(Se,{index:!0,element:r.jsx(pU,{})}),r.jsx(Se,{path:"new",element:r.jsx(FU,{})}),r.jsx(Se,{path:":environmentId",element:r.jsx(w$,{})}),r.jsx(Se,{path:":environmentId/edit",element:r.jsx(ZU,{})})]})]}),r.jsx(Se,{element:r.jsx(K$,{}),children:r.jsxs(Se,{path:"settings",element:r.jsx(C$,{}),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(E$,{})}),r.jsx(Se,{path:"tokens",element:r.jsx(is,{to:"../credentials",replace:!0})}),r.jsx(Se,{path:"personas",element:r.jsx(A$,{})}),r.jsx(Se,{path:"personas/new",element:r.jsx(Hb,{})}),r.jsx(Se,{path:"personas/:personaId",element:r.jsx(Hb,{})}),r.jsx(Se,{path:"appearance",element:r.jsx(P$,{})}),r.jsx(Se,{path:"shortcuts",element:r.jsx(q$,{})}),r.jsx(Se,{path:"about",element:r.jsx(H$,{})})]})}),r.jsx(Se,{path:"*",element:r.jsx(is,{to:"/",replace:!0})})]})]})}const H9=1e4;function q9(){const{onboardingCompleted:t}=ct(),[s,i]=_.useState(!1);_.useEffect(()=>{if(t!==void 0)return;const c=setTimeout(()=>i(!0),H9);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(nx,{})},"splash"):r.jsx(Ct.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.25},style:{minHeight:"100vh"},children:r.jsx(EN,{basename:"/".replace(/\/$/,""),children:r.jsx(V9,{})})},"app")})}function G9(){const t=Ax?g8:$8;return r.jsx($B,{children:r.jsx(LB,{children:r.jsx(t,{children:r.jsx(q9,{})})})})}hT.createRoot(document.getElementById("root")).render(r.jsx(_.StrictMode,{children:r.jsx(G9,{})}));export{xs as B,S_ as K,ct as a,xp as f,nm as s,rs as t,bt as u};